diff --git a/bin/lib.d.ts b/bin/lib.d.ts index 15bcc31c8f7..e0fdf442967 100644 --- a/bin/lib.d.ts +++ b/bin/lib.d.ts @@ -14223,7 +14223,11 @@ declare function importScripts(...urls: string[]): void; /// Windows Script Host APIS ///////////////////////////// -declare var ActiveXObject: { new (s: string): any; }; + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; interface ITextWriter { Write(s: string): void; @@ -14231,11 +14235,157 @@ interface ITextWriter { Close(): void; } -declare var WScript: { - Echo(s: any): void; - StdErr: ITextWriter; - StdOut: ITextWriter; - Arguments: { length: number; Item(n: number): string; }; - ScriptFullName: string; - Quit(exitCode?: number): number; +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + /** + * The current line number in an input stream. + */ + Line: number; + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; } + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, beginning at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext). + */ + Echo(s: any): void; + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + /** + * Fully qualified path of the host executable. + */ + FullName: string; + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + /** + * Path of the directory containing the host executable. + */ + Path: string; + /** + * The filename of the currently running script. + */ + ScriptName: string; + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + /** + * Windows Script Host version + */ + Version: string; + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; diff --git a/bin/lib.es6.d.ts b/bin/lib.es6.d.ts index 114e15e6d44..edc51cad7cc 100644 --- a/bin/lib.es6.d.ts +++ b/bin/lib.es6.d.ts @@ -17205,7 +17205,11 @@ declare function importScripts(...urls: string[]): void; /// Windows Script Host APIS ///////////////////////////// -declare var ActiveXObject: { new (s: string): any; }; + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; interface ITextWriter { Write(s: string): void; @@ -17213,11 +17217,157 @@ interface ITextWriter { Close(): void; } -declare var WScript: { - Echo(s: any): void; - StdErr: ITextWriter; - StdOut: ITextWriter; - Arguments: { length: number; Item(n: number): string; }; - ScriptFullName: string; - Quit(exitCode?: number): number; +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + /** + * The current line number in an input stream. + */ + Line: number; + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; } + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, beginning at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext). + */ + Echo(s: any): void; + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + /** + * Fully qualified path of the host executable. + */ + FullName: string; + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + /** + * Path of the directory containing the host executable. + */ + Path: string; + /** + * The filename of the currently running script. + */ + ScriptName: string; + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + /** + * Windows Script Host version + */ + Version: string; + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; diff --git a/bin/lib.scriptHost.d.ts b/bin/lib.scriptHost.d.ts index 1498aeea63a..17b1fe956a2 100644 --- a/bin/lib.scriptHost.d.ts +++ b/bin/lib.scriptHost.d.ts @@ -20,7 +20,11 @@ and limitations under the License. /// Windows Script Host APIS ///////////////////////////// -declare var ActiveXObject: { new (s: string): any; }; + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; interface ITextWriter { Write(s: string): void; @@ -28,11 +32,157 @@ interface ITextWriter { Close(): void; } -declare var WScript: { - Echo(s: any): void; - StdErr: ITextWriter; - StdOut: ITextWriter; - Arguments: { length: number; Item(n: number): string; }; - ScriptFullName: string; - Quit(exitCode?: number): number; +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + /** + * The current line number in an input stream. + */ + Line: number; + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; } + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, beginning at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext). + */ + Echo(s: any): void; + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + /** + * Fully qualified path of the host executable. + */ + FullName: string; + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + /** + * Path of the directory containing the host executable. + */ + Path: string; + /** + * The filename of the currently running script. + */ + ScriptName: string; + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + /** + * Windows Script Host version + */ + Version: string; + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; diff --git a/bin/tsc.js b/bin/tsc.js index 21e5a8ff6a3..2acb2dd3a12 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -28,6 +28,7 @@ var ts; })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); var DiagnosticCategory = ts.DiagnosticCategory; })(ts || (ts = {})); +/// var ts; (function (ts) { function forEach(array, callback) { @@ -44,7 +45,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (v === value) { return true; @@ -68,7 +69,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -82,10 +83,10 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { - var _item = array[_i]; - if (f(_item)) { - result.push(_item); + for (var _i = 0; _i < array.length; _i++) { + var item_1 = array[_i]; + if (f(item_1)) { + result.push(item_1); } } } @@ -96,7 +97,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result.push(f(v)); } @@ -116,10 +117,10 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { - var _item = array[_i]; - if (!contains(result, _item)) { - result.push(_item); + for (var _i = 0; _i < array.length; _i++) { + var item_2 = array[_i]; + if (!contains(result, item_2)) { + result.push(item_2); } } } @@ -128,7 +129,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result += v[prop]; } @@ -137,7 +138,7 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0, _n = from.length; _i < _n; _i++) { + for (var _i = 0; _i < from.length; _i++) { var v = from[_i]; to.push(v); } @@ -230,9 +231,9 @@ var ts; for (var id in first) { result[id] = first[id]; } - for (var _id in second) { - if (!hasProperty(result, _id)) { - result[_id] = second[_id]; + for (var id in second) { + if (!hasProperty(result, id)) { + result[id] = second[id]; } } return result; @@ -276,13 +277,13 @@ var ts; ts.arrayToMap = arrayToMap; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (match, index) { + return args[+index + baseIndex]; + }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { - return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] - ? ts.localizedDiagnosticMessages[message] - : message; + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { @@ -353,12 +354,7 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || - compareValues(d1.start, d2.start) || - compareValues(d1.length, d2.length) || - compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || - 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -385,7 +381,9 @@ var ts; if (diagnostics.length < 2) { return diagnostics; } - var newDiagnostics = [diagnostics[0]]; + var newDiagnostics = [ + diagnostics[0] + ]; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; @@ -426,7 +424,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _n = parts.length; _i < _n; _i++) { + for (var _i = 0; _i < parts.length; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -462,7 +460,9 @@ var ts; ts.isRootedDiskPath = isRootedDiskPath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); - return [path.substr(0, rootLength)].concat(normalizedParts); + return [ + path.substr(0, rootLength) + ].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { path = normalizeSlashes(path); @@ -485,6 +485,9 @@ var ts; } ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; function getNormalizedPathComponentsOfUrl(url) { + // Get root length of http://www.website.com/folder1/foler2/ + // In this example the root is: http://www.website.com/ + // normalized path components should be ["http://www.website.com/", "folder1", "folder2"] var urlLength = url.length; var rootLength = url.indexOf("://") + "://".length; while (rootLength < urlLength) { @@ -496,7 +499,9 @@ var ts; } } if (rootLength === urlLength) { - return [url]; + return [ + url + ]; } var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { @@ -504,7 +509,9 @@ var ts; return normalizedPathComponents(url, rootLength); } else { - return [url + ts.directorySeparator]; + return [ + url + ts.directorySeparator + ]; } } function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { @@ -566,9 +573,13 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + var supportedExtensions = [ + ".d.ts", + ".ts", + ".js" + ]; function removeFileExtension(path) { - for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { + for (var _i = 0; _i < supportedExtensions.length; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -620,9 +631,15 @@ var ts; }; return Node; }, - getSymbolConstructor: function () { return Symbol; }, - getTypeConstructor: function () { return Type; }, - getSignatureConstructor: function () { return Signature; } + getSymbolConstructor: function () { + return Symbol; + }, + getTypeConstructor: function () { + return Type; + }, + getSignatureConstructor: function () { + return Signature; + } }; var Debug; (function (Debug) { @@ -647,6 +664,7 @@ var ts; Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); })(ts || (ts = {})); +/// var ts; (function (ts) { ts.sys = (function () { @@ -720,14 +738,14 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _n = files.length; _i < _n; _i++) { - var _name = files[_i]; - if (!extension || ts.fileExtensionIs(_name, extension)) { - result.push(ts.combinePaths(path, _name)); + for (var _i = 0; _i < files.length; _i++) { + var name_1 = files[_i]; + if (!extension || ts.fileExtensionIs(name_1, extension)) { + result.push(ts.combinePaths(path, name_1)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + for (var _a = 0; _a < subfolders.length; _a++) { var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } @@ -814,7 +832,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -827,9 +845,9 @@ var ts; directories.push(name); } } - for (var _a = 0, _b = directories.length; _a < _b; _a++) { - var _current = directories[_a]; - visitDirectory(_current); + for (var _a = 0; _a < directories.length; _a++) { + var current = directories[_a]; + visitDirectory(current); } } } @@ -843,9 +861,14 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + _fs.watchFile(fileName, { + persistent: true, + interval: 250 + }, fileChanged); return { - close: function () { _fs.unwatchFile(fileName, fileChanged); } + close: function () { + _fs.unwatchFile(fileName, fileChanged); + } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -898,507 +921,2554 @@ var ts; } })(); })(ts || (ts = {})); +/// var ts; (function (ts) { ts.Diagnostics = { - Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, - Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, - _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, - A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, - Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, - Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, - An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, - A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, - A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, - Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, - An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, - super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, - Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, - Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, - Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, - Type_expected: { code: 1110, category: 1, key: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, - Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, - Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, - Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, - Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, - Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, - Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, - case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, - Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, - Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, - Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, - Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, - Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, - Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, - Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, - Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, - Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, - Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, - or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, - Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, - Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, - Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, - An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, - yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, - Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, - extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, - extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, - Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, - implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, - Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, - Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, - Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, - Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, - Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, - Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, - A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, - Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, - Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, - A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, - A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, - An_import_declaration_cannot_have_modifiers: { code: 1191, category: 1, key: "An import declaration cannot have modifiers." }, - External_module_0_has_no_default_export: { code: 1192, category: 1, key: "External module '{0}' has no default export." }, - An_export_declaration_cannot_have_modifiers: { code: 1193, category: 1, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: 1, key: "Export declarations are not permitted in an internal module." }, - Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: 1, key: "Catch clause variable name must be an identifier." }, - Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: 1, key: "Catch clause variable cannot have a type annotation." }, - Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: 1, key: "Catch clause variable cannot have an initializer." }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: 1, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, - Unterminated_Unicode_escape_sequence: { code: 1199, category: 1, key: "Unterminated Unicode escape sequence." }, - Line_terminator_not_permitted_before_arrow: { code: 1200, category: 1, key: "Line terminator not permitted before arrow." }, - A_type_annotation_on_an_export_statement_is_only_allowed_in_an_ambient_external_module_declaration: { code: 1201, category: 1, key: "A type annotation on an export statement is only allowed in an ambient external module declaration." }, - Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: 1, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, - Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: 1, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: 1, key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." }, - Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: 1, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, - Decorators_are_not_valid_here: { code: 1206, category: 1, key: "Decorators are not valid here." }, - Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: 1, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, - Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, - Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, - Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, - Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, - Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, - A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, - Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, - A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, - An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, - Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, - Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, - Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, - Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, - Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, - Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, - Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, - Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, - Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, - Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, - Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, - Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, - Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, - Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, - this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, - this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, - this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, - super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, - super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, - Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, - Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, - Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, - Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, - No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, - Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, - A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, - Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, - Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, - Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, - Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, - get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, - Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, - Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, - Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, - Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, - Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, - Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, - Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, - Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, - Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, - Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, - Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, - A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, - Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, - Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, - An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, - Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, - An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, - Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, - Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, - Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, - this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, - super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, - Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, - The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: 1, key: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: 1, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, - Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: 1, key: "Invalid left-hand side in 'for...of' statement." }, - The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: 1, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." }, - The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: 1, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: 1, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: 1, key: "Cannot redeclare identifier '{0}' in catch clause" }, - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: 1, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: 1, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, - Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: 1, key: "Type '{0}' is not an array type or a string type." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, - External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: 1, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, - External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: 1, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, - Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, - Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: 1, key: "Default export of the module has or is using private name '{0}'." }, - Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: 1, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, - The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, - Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, - Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, - Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, - Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, - Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, - Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, - Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, - Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, - Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, - Print_this_message: { code: 6017, category: 2, key: "Print this message." }, - Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, - Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, - options: { code: 6024, category: 2, key: "options" }, - file: { code: 6025, category: 2, key: "file" }, - Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, - Options_Colon: { code: 6027, category: 2, key: "Options:" }, - Version_0: { code: 6029, category: 2, key: "Version {0}" }, - Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, - File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, - KIND: { code: 6034, category: 2, key: "KIND" }, - FILE: { code: 6035, category: 2, key: "FILE" }, - VERSION: { code: 6036, category: 2, key: "VERSION" }, - LOCATION: { code: 6037, category: 2, key: "LOCATION" }, - DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, - Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, - Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, - Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, - Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, - Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, - Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, - Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, - Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, - File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, - Preserve_new_lines_when_emitting_code: { code: 6057, category: 2, key: "Preserve new-lines when emitting code." }, - Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, - Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, - Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, - Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, - Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, - Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, - yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." } + Unterminated_string_literal: { + code: 1002, + category: ts.DiagnosticCategory.Error, + key: "Unterminated string literal." + }, + Identifier_expected: { + code: 1003, + category: ts.DiagnosticCategory.Error, + key: "Identifier expected." + }, + _0_expected: { + code: 1005, + category: ts.DiagnosticCategory.Error, + key: "'{0}' expected." + }, + A_file_cannot_have_a_reference_to_itself: { + code: 1006, + category: ts.DiagnosticCategory.Error, + key: "A file cannot have a reference to itself." + }, + Trailing_comma_not_allowed: { + code: 1009, + category: ts.DiagnosticCategory.Error, + key: "Trailing comma not allowed." + }, + Asterisk_Slash_expected: { + code: 1010, + category: ts.DiagnosticCategory.Error, + key: "'*/' expected." + }, + Unexpected_token: { + code: 1012, + category: ts.DiagnosticCategory.Error, + key: "Unexpected token." + }, + A_rest_parameter_must_be_last_in_a_parameter_list: { + code: 1014, + category: ts.DiagnosticCategory.Error, + key: "A rest parameter must be last in a parameter list." + }, + Parameter_cannot_have_question_mark_and_initializer: { + code: 1015, + category: ts.DiagnosticCategory.Error, + key: "Parameter cannot have question mark and initializer." + }, + A_required_parameter_cannot_follow_an_optional_parameter: { + code: 1016, + category: ts.DiagnosticCategory.Error, + key: "A required parameter cannot follow an optional parameter." + }, + An_index_signature_cannot_have_a_rest_parameter: { + code: 1017, + category: ts.DiagnosticCategory.Error, + key: "An index signature cannot have a rest parameter." + }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { + code: 1018, + category: ts.DiagnosticCategory.Error, + key: "An index signature parameter cannot have an accessibility modifier." + }, + An_index_signature_parameter_cannot_have_a_question_mark: { + code: 1019, + category: ts.DiagnosticCategory.Error, + key: "An index signature parameter cannot have a question mark." + }, + An_index_signature_parameter_cannot_have_an_initializer: { + code: 1020, + category: ts.DiagnosticCategory.Error, + key: "An index signature parameter cannot have an initializer." + }, + An_index_signature_must_have_a_type_annotation: { + code: 1021, + category: ts.DiagnosticCategory.Error, + key: "An index signature must have a type annotation." + }, + An_index_signature_parameter_must_have_a_type_annotation: { + code: 1022, + category: ts.DiagnosticCategory.Error, + key: "An index signature parameter must have a type annotation." + }, + An_index_signature_parameter_type_must_be_string_or_number: { + code: 1023, + category: ts.DiagnosticCategory.Error, + key: "An index signature parameter type must be 'string' or 'number'." + }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { + code: 1024, + category: ts.DiagnosticCategory.Error, + key: "A class or interface declaration can only have one 'extends' clause." + }, + An_extends_clause_must_precede_an_implements_clause: { + code: 1025, + category: ts.DiagnosticCategory.Error, + key: "An 'extends' clause must precede an 'implements' clause." + }, + A_class_can_only_extend_a_single_class: { + code: 1026, + category: ts.DiagnosticCategory.Error, + key: "A class can only extend a single class." + }, + A_class_declaration_can_only_have_one_implements_clause: { + code: 1027, + category: ts.DiagnosticCategory.Error, + key: "A class declaration can only have one 'implements' clause." + }, + Accessibility_modifier_already_seen: { + code: 1028, + category: ts.DiagnosticCategory.Error, + key: "Accessibility modifier already seen." + }, + _0_modifier_must_precede_1_modifier: { + code: 1029, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier must precede '{1}' modifier." + }, + _0_modifier_already_seen: { + code: 1030, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier already seen." + }, + _0_modifier_cannot_appear_on_a_class_element: { + code: 1031, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier cannot appear on a class element." + }, + An_interface_declaration_cannot_have_an_implements_clause: { + code: 1032, + category: ts.DiagnosticCategory.Error, + key: "An interface declaration cannot have an 'implements' clause." + }, + super_must_be_followed_by_an_argument_list_or_member_access: { + code: 1034, + category: ts.DiagnosticCategory.Error, + key: "'super' must be followed by an argument list or member access." + }, + Only_ambient_modules_can_use_quoted_names: { + code: 1035, + category: ts.DiagnosticCategory.Error, + key: "Only ambient modules can use quoted names." + }, + Statements_are_not_allowed_in_ambient_contexts: { + code: 1036, + category: ts.DiagnosticCategory.Error, + key: "Statements are not allowed in ambient contexts." + }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { + code: 1038, + category: ts.DiagnosticCategory.Error, + key: "A 'declare' modifier cannot be used in an already ambient context." + }, + Initializers_are_not_allowed_in_ambient_contexts: { + code: 1039, + category: ts.DiagnosticCategory.Error, + key: "Initializers are not allowed in ambient contexts." + }, + _0_modifier_cannot_appear_on_a_module_element: { + code: 1044, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier cannot appear on a module element." + }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { + code: 1045, + category: ts.DiagnosticCategory.Error, + key: "A 'declare' modifier cannot be used with an interface declaration." + }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { + code: 1046, + category: ts.DiagnosticCategory.Error, + key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." + }, + A_rest_parameter_cannot_be_optional: { + code: 1047, + category: ts.DiagnosticCategory.Error, + key: "A rest parameter cannot be optional." + }, + A_rest_parameter_cannot_have_an_initializer: { + code: 1048, + category: ts.DiagnosticCategory.Error, + key: "A rest parameter cannot have an initializer." + }, + A_set_accessor_must_have_exactly_one_parameter: { + code: 1049, + category: ts.DiagnosticCategory.Error, + key: "A 'set' accessor must have exactly one parameter." + }, + A_set_accessor_cannot_have_an_optional_parameter: { + code: 1051, + category: ts.DiagnosticCategory.Error, + key: "A 'set' accessor cannot have an optional parameter." + }, + A_set_accessor_parameter_cannot_have_an_initializer: { + code: 1052, + category: ts.DiagnosticCategory.Error, + key: "A 'set' accessor parameter cannot have an initializer." + }, + A_set_accessor_cannot_have_rest_parameter: { + code: 1053, + category: ts.DiagnosticCategory.Error, + key: "A 'set' accessor cannot have rest parameter." + }, + A_get_accessor_cannot_have_parameters: { + code: 1054, + category: ts.DiagnosticCategory.Error, + key: "A 'get' accessor cannot have parameters." + }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { + code: 1056, + category: ts.DiagnosticCategory.Error, + key: "Accessors are only available when targeting ECMAScript 5 and higher." + }, + Enum_member_must_have_initializer: { + code: 1061, + category: ts.DiagnosticCategory.Error, + key: "Enum member must have initializer." + }, + An_export_assignment_cannot_be_used_in_an_internal_module: { + code: 1063, + category: ts.DiagnosticCategory.Error, + key: "An export assignment cannot be used in an internal module." + }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { + code: 1066, + category: ts.DiagnosticCategory.Error, + key: "Ambient enum elements can only have integer literal initializers." + }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { + code: 1068, + category: ts.DiagnosticCategory.Error, + key: "Unexpected token. A constructor, method, accessor, or property was expected." + }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { + code: 1079, + category: ts.DiagnosticCategory.Error, + key: "A 'declare' modifier cannot be used with an import declaration." + }, + Invalid_reference_directive_syntax: { + code: 1084, + category: ts.DiagnosticCategory.Error, + key: "Invalid 'reference' directive syntax." + }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { + code: 1085, + category: ts.DiagnosticCategory.Error, + key: "Octal literals are not available when targeting ECMAScript 5 and higher." + }, + An_accessor_cannot_be_declared_in_an_ambient_context: { + code: 1086, + category: ts.DiagnosticCategory.Error, + key: "An accessor cannot be declared in an ambient context." + }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { + code: 1089, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier cannot appear on a constructor declaration." + }, + _0_modifier_cannot_appear_on_a_parameter: { + code: 1090, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier cannot appear on a parameter." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { + code: 1091, + category: ts.DiagnosticCategory.Error, + key: "Only a single variable declaration is allowed in a 'for...in' statement." + }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { + code: 1092, + category: ts.DiagnosticCategory.Error, + key: "Type parameters cannot appear on a constructor declaration." + }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { + code: 1093, + category: ts.DiagnosticCategory.Error, + key: "Type annotation cannot appear on a constructor declaration." + }, + An_accessor_cannot_have_type_parameters: { + code: 1094, + category: ts.DiagnosticCategory.Error, + key: "An accessor cannot have type parameters." + }, + A_set_accessor_cannot_have_a_return_type_annotation: { + code: 1095, + category: ts.DiagnosticCategory.Error, + key: "A 'set' accessor cannot have a return type annotation." + }, + An_index_signature_must_have_exactly_one_parameter: { + code: 1096, + category: ts.DiagnosticCategory.Error, + key: "An index signature must have exactly one parameter." + }, + _0_list_cannot_be_empty: { + code: 1097, + category: ts.DiagnosticCategory.Error, + key: "'{0}' list cannot be empty." + }, + Type_parameter_list_cannot_be_empty: { + code: 1098, + category: ts.DiagnosticCategory.Error, + key: "Type parameter list cannot be empty." + }, + Type_argument_list_cannot_be_empty: { + code: 1099, + category: ts.DiagnosticCategory.Error, + key: "Type argument list cannot be empty." + }, + Invalid_use_of_0_in_strict_mode: { + code: 1100, + category: ts.DiagnosticCategory.Error, + key: "Invalid use of '{0}' in strict mode." + }, + with_statements_are_not_allowed_in_strict_mode: { + code: 1101, + category: ts.DiagnosticCategory.Error, + key: "'with' statements are not allowed in strict mode." + }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { + code: 1102, + category: ts.DiagnosticCategory.Error, + key: "'delete' cannot be called on an identifier in strict mode." + }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { + code: 1104, + category: ts.DiagnosticCategory.Error, + key: "A 'continue' statement can only be used within an enclosing iteration statement." + }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { + code: 1105, + category: ts.DiagnosticCategory.Error, + key: "A 'break' statement can only be used within an enclosing iteration or switch statement." + }, + Jump_target_cannot_cross_function_boundary: { + code: 1107, + category: ts.DiagnosticCategory.Error, + key: "Jump target cannot cross function boundary." + }, + A_return_statement_can_only_be_used_within_a_function_body: { + code: 1108, + category: ts.DiagnosticCategory.Error, + key: "A 'return' statement can only be used within a function body." + }, + Expression_expected: { + code: 1109, + category: ts.DiagnosticCategory.Error, + key: "Expression expected." + }, + Type_expected: { + code: 1110, + category: ts.DiagnosticCategory.Error, + key: "Type expected." + }, + A_class_member_cannot_be_declared_optional: { + code: 1112, + category: ts.DiagnosticCategory.Error, + key: "A class member cannot be declared optional." + }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { + code: 1113, + category: ts.DiagnosticCategory.Error, + key: "A 'default' clause cannot appear more than once in a 'switch' statement." + }, + Duplicate_label_0: { + code: 1114, + category: ts.DiagnosticCategory.Error, + key: "Duplicate label '{0}'" + }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { + code: 1115, + category: ts.DiagnosticCategory.Error, + key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." + }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { + code: 1116, + category: ts.DiagnosticCategory.Error, + key: "A 'break' statement can only jump to a label of an enclosing statement." + }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { + code: 1117, + category: ts.DiagnosticCategory.Error, + key: "An object literal cannot have multiple properties with the same name in strict mode." + }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { + code: 1118, + category: ts.DiagnosticCategory.Error, + key: "An object literal cannot have multiple get/set accessors with the same name." + }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { + code: 1119, + category: ts.DiagnosticCategory.Error, + key: "An object literal cannot have property and accessor with the same name." + }, + An_export_assignment_cannot_have_modifiers: { + code: 1120, + category: ts.DiagnosticCategory.Error, + key: "An export assignment cannot have modifiers." + }, + Octal_literals_are_not_allowed_in_strict_mode: { + code: 1121, + category: ts.DiagnosticCategory.Error, + key: "Octal literals are not allowed in strict mode." + }, + A_tuple_type_element_list_cannot_be_empty: { + code: 1122, + category: ts.DiagnosticCategory.Error, + key: "A tuple type element list cannot be empty." + }, + Variable_declaration_list_cannot_be_empty: { + code: 1123, + category: ts.DiagnosticCategory.Error, + key: "Variable declaration list cannot be empty." + }, + Digit_expected: { + code: 1124, + category: ts.DiagnosticCategory.Error, + key: "Digit expected." + }, + Hexadecimal_digit_expected: { + code: 1125, + category: ts.DiagnosticCategory.Error, + key: "Hexadecimal digit expected." + }, + Unexpected_end_of_text: { + code: 1126, + category: ts.DiagnosticCategory.Error, + key: "Unexpected end of text." + }, + Invalid_character: { + code: 1127, + category: ts.DiagnosticCategory.Error, + key: "Invalid character." + }, + Declaration_or_statement_expected: { + code: 1128, + category: ts.DiagnosticCategory.Error, + key: "Declaration or statement expected." + }, + Statement_expected: { + code: 1129, + category: ts.DiagnosticCategory.Error, + key: "Statement expected." + }, + case_or_default_expected: { + code: 1130, + category: ts.DiagnosticCategory.Error, + key: "'case' or 'default' expected." + }, + Property_or_signature_expected: { + code: 1131, + category: ts.DiagnosticCategory.Error, + key: "Property or signature expected." + }, + Enum_member_expected: { + code: 1132, + category: ts.DiagnosticCategory.Error, + key: "Enum member expected." + }, + Type_reference_expected: { + code: 1133, + category: ts.DiagnosticCategory.Error, + key: "Type reference expected." + }, + Variable_declaration_expected: { + code: 1134, + category: ts.DiagnosticCategory.Error, + key: "Variable declaration expected." + }, + Argument_expression_expected: { + code: 1135, + category: ts.DiagnosticCategory.Error, + key: "Argument expression expected." + }, + Property_assignment_expected: { + code: 1136, + category: ts.DiagnosticCategory.Error, + key: "Property assignment expected." + }, + Expression_or_comma_expected: { + code: 1137, + category: ts.DiagnosticCategory.Error, + key: "Expression or comma expected." + }, + Parameter_declaration_expected: { + code: 1138, + category: ts.DiagnosticCategory.Error, + key: "Parameter declaration expected." + }, + Type_parameter_declaration_expected: { + code: 1139, + category: ts.DiagnosticCategory.Error, + key: "Type parameter declaration expected." + }, + Type_argument_expected: { + code: 1140, + category: ts.DiagnosticCategory.Error, + key: "Type argument expected." + }, + String_literal_expected: { + code: 1141, + category: ts.DiagnosticCategory.Error, + key: "String literal expected." + }, + Line_break_not_permitted_here: { + code: 1142, + category: ts.DiagnosticCategory.Error, + key: "Line break not permitted here." + }, + or_expected: { + code: 1144, + category: ts.DiagnosticCategory.Error, + key: "'{' or ';' expected." + }, + Modifiers_not_permitted_on_index_signature_members: { + code: 1145, + category: ts.DiagnosticCategory.Error, + key: "Modifiers not permitted on index signature members." + }, + Declaration_expected: { + code: 1146, + category: ts.DiagnosticCategory.Error, + key: "Declaration expected." + }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { + code: 1147, + category: ts.DiagnosticCategory.Error, + key: "Import declarations in an internal module cannot reference an external module." + }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { + code: 1148, + category: ts.DiagnosticCategory.Error, + key: "Cannot compile external modules unless the '--module' flag is provided." + }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { + code: 1149, + category: ts.DiagnosticCategory.Error, + key: "File name '{0}' differs from already included file name '{1}' only in casing" + }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { + code: 1150, + category: ts.DiagnosticCategory.Error, + key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." + }, + var_let_or_const_expected: { + code: 1152, + category: ts.DiagnosticCategory.Error, + key: "'var', 'let' or 'const' expected." + }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1153, + category: ts.DiagnosticCategory.Error, + key: "'let' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1154, + category: ts.DiagnosticCategory.Error, + key: "'const' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_must_be_initialized: { + code: 1155, + category: ts.DiagnosticCategory.Error, + key: "'const' declarations must be initialized" + }, + const_declarations_can_only_be_declared_inside_a_block: { + code: 1156, + category: ts.DiagnosticCategory.Error, + key: "'const' declarations can only be declared inside a block." + }, + let_declarations_can_only_be_declared_inside_a_block: { + code: 1157, + category: ts.DiagnosticCategory.Error, + key: "'let' declarations can only be declared inside a block." + }, + Unterminated_template_literal: { + code: 1160, + category: ts.DiagnosticCategory.Error, + key: "Unterminated template literal." + }, + Unterminated_regular_expression_literal: { + code: 1161, + category: ts.DiagnosticCategory.Error, + key: "Unterminated regular expression literal." + }, + An_object_member_cannot_be_declared_optional: { + code: 1162, + category: ts.DiagnosticCategory.Error, + key: "An object member cannot be declared optional." + }, + yield_expression_must_be_contained_within_a_generator_declaration: { + code: 1163, + category: ts.DiagnosticCategory.Error, + key: "'yield' expression must be contained_within a generator declaration." + }, + Computed_property_names_are_not_allowed_in_enums: { + code: 1164, + category: ts.DiagnosticCategory.Error, + key: "Computed property names are not allowed in enums." + }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { + code: 1165, + category: ts.DiagnosticCategory.Error, + key: "A computed property name in an ambient context must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { + code: 1166, + category: ts.DiagnosticCategory.Error, + key: "A computed property name in a class property declaration must directly refer to a built-in symbol." + }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1167, + category: ts.DiagnosticCategory.Error, + key: "Computed property names are only available when targeting ECMAScript 6 and higher." + }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { + code: 1168, + category: ts.DiagnosticCategory.Error, + key: "A computed property name in a method overload must directly refer to a built-in symbol." + }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { + code: 1169, + category: ts.DiagnosticCategory.Error, + key: "A computed property name in an interface must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { + code: 1170, + category: ts.DiagnosticCategory.Error, + key: "A computed property name in a type literal must directly refer to a built-in symbol." + }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { + code: 1171, + category: ts.DiagnosticCategory.Error, + key: "A comma expression is not allowed in a computed property name." + }, + extends_clause_already_seen: { + code: 1172, + category: ts.DiagnosticCategory.Error, + key: "'extends' clause already seen." + }, + extends_clause_must_precede_implements_clause: { + code: 1173, + category: ts.DiagnosticCategory.Error, + key: "'extends' clause must precede 'implements' clause." + }, + Classes_can_only_extend_a_single_class: { + code: 1174, + category: ts.DiagnosticCategory.Error, + key: "Classes can only extend a single class." + }, + implements_clause_already_seen: { + code: 1175, + category: ts.DiagnosticCategory.Error, + key: "'implements' clause already seen." + }, + Interface_declaration_cannot_have_implements_clause: { + code: 1176, + category: ts.DiagnosticCategory.Error, + key: "Interface declaration cannot have 'implements' clause." + }, + Binary_digit_expected: { + code: 1177, + category: ts.DiagnosticCategory.Error, + key: "Binary digit expected." + }, + Octal_digit_expected: { + code: 1178, + category: ts.DiagnosticCategory.Error, + key: "Octal digit expected." + }, + Unexpected_token_expected: { + code: 1179, + category: ts.DiagnosticCategory.Error, + key: "Unexpected token. '{' expected." + }, + Property_destructuring_pattern_expected: { + code: 1180, + category: ts.DiagnosticCategory.Error, + key: "Property destructuring pattern expected." + }, + Array_element_destructuring_pattern_expected: { + code: 1181, + category: ts.DiagnosticCategory.Error, + key: "Array element destructuring pattern expected." + }, + A_destructuring_declaration_must_have_an_initializer: { + code: 1182, + category: ts.DiagnosticCategory.Error, + key: "A destructuring declaration must have an initializer." + }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { + code: 1183, + category: ts.DiagnosticCategory.Error, + key: "Destructuring declarations are not allowed in ambient contexts." + }, + An_implementation_cannot_be_declared_in_ambient_contexts: { + code: 1184, + category: ts.DiagnosticCategory.Error, + key: "An implementation cannot be declared in ambient contexts." + }, + Modifiers_cannot_appear_here: { + code: 1184, + category: ts.DiagnosticCategory.Error, + key: "Modifiers cannot appear here." + }, + Merge_conflict_marker_encountered: { + code: 1185, + category: ts.DiagnosticCategory.Error, + key: "Merge conflict marker encountered." + }, + A_rest_element_cannot_have_an_initializer: { + code: 1186, + category: ts.DiagnosticCategory.Error, + key: "A rest element cannot have an initializer." + }, + A_parameter_property_may_not_be_a_binding_pattern: { + code: 1187, + category: ts.DiagnosticCategory.Error, + key: "A parameter property may not be a binding pattern." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { + code: 1188, + category: ts.DiagnosticCategory.Error, + key: "Only a single variable declaration is allowed in a 'for...of' statement." + }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { + code: 1189, + category: ts.DiagnosticCategory.Error, + key: "The variable declaration of a 'for...in' statement cannot have an initializer." + }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { + code: 1190, + category: ts.DiagnosticCategory.Error, + key: "The variable declaration of a 'for...of' statement cannot have an initializer." + }, + An_import_declaration_cannot_have_modifiers: { + code: 1191, + category: ts.DiagnosticCategory.Error, + key: "An import declaration cannot have modifiers." + }, + External_module_0_has_no_default_export: { + code: 1192, + category: ts.DiagnosticCategory.Error, + key: "External module '{0}' has no default export." + }, + An_export_declaration_cannot_have_modifiers: { + code: 1193, + category: ts.DiagnosticCategory.Error, + key: "An export declaration cannot have modifiers." + }, + Export_declarations_are_not_permitted_in_an_internal_module: { + code: 1194, + category: ts.DiagnosticCategory.Error, + key: "Export declarations are not permitted in an internal module." + }, + Catch_clause_variable_name_must_be_an_identifier: { + code: 1195, + category: ts.DiagnosticCategory.Error, + key: "Catch clause variable name must be an identifier." + }, + Catch_clause_variable_cannot_have_a_type_annotation: { + code: 1196, + category: ts.DiagnosticCategory.Error, + key: "Catch clause variable cannot have a type annotation." + }, + Catch_clause_variable_cannot_have_an_initializer: { + code: 1197, + category: ts.DiagnosticCategory.Error, + key: "Catch clause variable cannot have an initializer." + }, + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { + code: 1198, + category: ts.DiagnosticCategory.Error, + key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." + }, + Unterminated_Unicode_escape_sequence: { + code: 1199, + category: ts.DiagnosticCategory.Error, + key: "Unterminated Unicode escape sequence." + }, + Line_terminator_not_permitted_before_arrow: { + code: 1200, + category: ts.DiagnosticCategory.Error, + key: "Line terminator not permitted before arrow." + }, + A_type_annotation_on_an_export_statement_is_only_allowed_in_an_ambient_external_module_declaration: { + code: 1201, + category: ts.DiagnosticCategory.Error, + key: "A type annotation on an export statement is only allowed in an ambient external module declaration." + }, + Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { + code: 1202, + category: ts.DiagnosticCategory.Error, + key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." + }, + Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { + code: 1203, + category: ts.DiagnosticCategory.Error, + key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." + }, + Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { + code: 1204, + category: ts.DiagnosticCategory.Error, + key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." + }, + Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { + code: 1205, + category: ts.DiagnosticCategory.Error, + key: "Decorators are only available when targeting ECMAScript 5 and higher." + }, + Decorators_are_not_valid_here: { + code: 1206, + category: ts.DiagnosticCategory.Error, + key: "Decorators are not valid here." + }, + Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { + code: 1207, + category: ts.DiagnosticCategory.Error, + key: "Decorators cannot be applied to multiple get/set accessors of the same name." + }, + Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { + code: 1208, + category: ts.DiagnosticCategory.Error, + key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." + }, + Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { + code: 1209, + category: ts.DiagnosticCategory.Error, + key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." + }, + Duplicate_identifier_0: { + code: 2300, + category: ts.DiagnosticCategory.Error, + key: "Duplicate identifier '{0}'." + }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { + code: 2301, + category: ts.DiagnosticCategory.Error, + key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." + }, + Static_members_cannot_reference_class_type_parameters: { + code: 2302, + category: ts.DiagnosticCategory.Error, + key: "Static members cannot reference class type parameters." + }, + Circular_definition_of_import_alias_0: { + code: 2303, + category: ts.DiagnosticCategory.Error, + key: "Circular definition of import alias '{0}'." + }, + Cannot_find_name_0: { + code: 2304, + category: ts.DiagnosticCategory.Error, + key: "Cannot find name '{0}'." + }, + Module_0_has_no_exported_member_1: { + code: 2305, + category: ts.DiagnosticCategory.Error, + key: "Module '{0}' has no exported member '{1}'." + }, + File_0_is_not_an_external_module: { + code: 2306, + category: ts.DiagnosticCategory.Error, + key: "File '{0}' is not an external module." + }, + Cannot_find_external_module_0: { + code: 2307, + category: ts.DiagnosticCategory.Error, + key: "Cannot find external module '{0}'." + }, + A_module_cannot_have_more_than_one_export_assignment: { + code: 2308, + category: ts.DiagnosticCategory.Error, + key: "A module cannot have more than one export assignment." + }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { + code: 2309, + category: ts.DiagnosticCategory.Error, + key: "An export assignment cannot be used in a module with other exported elements." + }, + Type_0_recursively_references_itself_as_a_base_type: { + code: 2310, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' recursively references itself as a base type." + }, + A_class_may_only_extend_another_class: { + code: 2311, + category: ts.DiagnosticCategory.Error, + key: "A class may only extend another class." + }, + An_interface_may_only_extend_a_class_or_another_interface: { + code: 2312, + category: ts.DiagnosticCategory.Error, + key: "An interface may only extend a class or another interface." + }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { + code: 2313, + category: ts.DiagnosticCategory.Error, + key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." + }, + Generic_type_0_requires_1_type_argument_s: { + code: 2314, + category: ts.DiagnosticCategory.Error, + key: "Generic type '{0}' requires {1} type argument(s)." + }, + Type_0_is_not_generic: { + code: 2315, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' is not generic." + }, + Global_type_0_must_be_a_class_or_interface_type: { + code: 2316, + category: ts.DiagnosticCategory.Error, + key: "Global type '{0}' must be a class or interface type." + }, + Global_type_0_must_have_1_type_parameter_s: { + code: 2317, + category: ts.DiagnosticCategory.Error, + key: "Global type '{0}' must have {1} type parameter(s)." + }, + Cannot_find_global_type_0: { + code: 2318, + category: ts.DiagnosticCategory.Error, + key: "Cannot find global type '{0}'." + }, + Named_property_0_of_types_1_and_2_are_not_identical: { + code: 2319, + category: ts.DiagnosticCategory.Error, + key: "Named property '{0}' of types '{1}' and '{2}' are not identical." + }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { + code: 2320, + category: ts.DiagnosticCategory.Error, + key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." + }, + Excessive_stack_depth_comparing_types_0_and_1: { + code: 2321, + category: ts.DiagnosticCategory.Error, + key: "Excessive stack depth comparing types '{0}' and '{1}'." + }, + Type_0_is_not_assignable_to_type_1: { + code: 2322, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' is not assignable to type '{1}'." + }, + Property_0_is_missing_in_type_1: { + code: 2324, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is missing in type '{1}'." + }, + Property_0_is_private_in_type_1_but_not_in_type_2: { + code: 2325, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is private in type '{1}' but not in type '{2}'." + }, + Types_of_property_0_are_incompatible: { + code: 2326, + category: ts.DiagnosticCategory.Error, + key: "Types of property '{0}' are incompatible." + }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { + code: 2327, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." + }, + Types_of_parameters_0_and_1_are_incompatible: { + code: 2328, + category: ts.DiagnosticCategory.Error, + key: "Types of parameters '{0}' and '{1}' are incompatible." + }, + Index_signature_is_missing_in_type_0: { + code: 2329, + category: ts.DiagnosticCategory.Error, + key: "Index signature is missing in type '{0}'." + }, + Index_signatures_are_incompatible: { + code: 2330, + category: ts.DiagnosticCategory.Error, + key: "Index signatures are incompatible." + }, + this_cannot_be_referenced_in_a_module_body: { + code: 2331, + category: ts.DiagnosticCategory.Error, + key: "'this' cannot be referenced in a module body." + }, + this_cannot_be_referenced_in_current_location: { + code: 2332, + category: ts.DiagnosticCategory.Error, + key: "'this' cannot be referenced in current location." + }, + this_cannot_be_referenced_in_constructor_arguments: { + code: 2333, + category: ts.DiagnosticCategory.Error, + key: "'this' cannot be referenced in constructor arguments." + }, + this_cannot_be_referenced_in_a_static_property_initializer: { + code: 2334, + category: ts.DiagnosticCategory.Error, + key: "'this' cannot be referenced in a static property initializer." + }, + super_can_only_be_referenced_in_a_derived_class: { + code: 2335, + category: ts.DiagnosticCategory.Error, + key: "'super' can only be referenced in a derived class." + }, + super_cannot_be_referenced_in_constructor_arguments: { + code: 2336, + category: ts.DiagnosticCategory.Error, + key: "'super' cannot be referenced in constructor arguments." + }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { + code: 2337, + category: ts.DiagnosticCategory.Error, + key: "Super calls are not permitted outside constructors or in nested functions inside constructors" + }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { + code: 2338, + category: ts.DiagnosticCategory.Error, + key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" + }, + Property_0_does_not_exist_on_type_1: { + code: 2339, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' does not exist on type '{1}'." + }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { + code: 2340, + category: ts.DiagnosticCategory.Error, + key: "Only public and protected methods of the base class are accessible via the 'super' keyword" + }, + Property_0_is_private_and_only_accessible_within_class_1: { + code: 2341, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is private and only accessible within class '{1}'." + }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { + code: 2342, + category: ts.DiagnosticCategory.Error, + key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." + }, + Type_0_does_not_satisfy_the_constraint_1: { + code: 2344, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' does not satisfy the constraint '{1}'." + }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { + code: 2345, + category: ts.DiagnosticCategory.Error, + key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." + }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { + code: 2346, + category: ts.DiagnosticCategory.Error, + key: "Supplied parameters do not match any signature of call target." + }, + Untyped_function_calls_may_not_accept_type_arguments: { + code: 2347, + category: ts.DiagnosticCategory.Error, + key: "Untyped function calls may not accept type arguments." + }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { + code: 2348, + category: ts.DiagnosticCategory.Error, + key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" + }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { + code: 2349, + category: ts.DiagnosticCategory.Error, + key: "Cannot invoke an expression whose type lacks a call signature." + }, + Only_a_void_function_can_be_called_with_the_new_keyword: { + code: 2350, + category: ts.DiagnosticCategory.Error, + key: "Only a void function can be called with the 'new' keyword." + }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { + code: 2351, + category: ts.DiagnosticCategory.Error, + key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." + }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { + code: 2352, + category: ts.DiagnosticCategory.Error, + key: "Neither type '{0}' nor type '{1}' is assignable to the other." + }, + No_best_common_type_exists_among_return_expressions: { + code: 2354, + category: ts.DiagnosticCategory.Error, + key: "No best common type exists among return expressions." + }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2355, + category: ts.DiagnosticCategory.Error, + key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." + }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { + code: 2356, + category: ts.DiagnosticCategory.Error, + key: "An arithmetic operand must be of type 'any', 'number' or an enum type." + }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { + code: 2357, + category: ts.DiagnosticCategory.Error, + key: "The operand of an increment or decrement operator must be a variable, property or indexer." + }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2358, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." + }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { + code: 2359, + category: ts.DiagnosticCategory.Error, + key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." + }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { + code: 2360, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." + }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2361, + category: ts.DiagnosticCategory.Error, + key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" + }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2362, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2363, + category: ts.DiagnosticCategory.Error, + key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + Invalid_left_hand_side_of_assignment_expression: { + code: 2364, + category: ts.DiagnosticCategory.Error, + key: "Invalid left-hand side of assignment expression." + }, + Operator_0_cannot_be_applied_to_types_1_and_2: { + code: 2365, + category: ts.DiagnosticCategory.Error, + key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." + }, + Type_parameter_name_cannot_be_0: { + code: 2368, + category: ts.DiagnosticCategory.Error, + key: "Type parameter name cannot be '{0}'" + }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { + code: 2369, + category: ts.DiagnosticCategory.Error, + key: "A parameter property is only allowed in a constructor implementation." + }, + A_rest_parameter_must_be_of_an_array_type: { + code: 2370, + category: ts.DiagnosticCategory.Error, + key: "A rest parameter must be of an array type." + }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { + code: 2371, + category: ts.DiagnosticCategory.Error, + key: "A parameter initializer is only allowed in a function or constructor implementation." + }, + Parameter_0_cannot_be_referenced_in_its_initializer: { + code: 2372, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' cannot be referenced in its initializer." + }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { + code: 2373, + category: ts.DiagnosticCategory.Error, + key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." + }, + Duplicate_string_index_signature: { + code: 2374, + category: ts.DiagnosticCategory.Error, + key: "Duplicate string index signature." + }, + Duplicate_number_index_signature: { + code: 2375, + category: ts.DiagnosticCategory.Error, + key: "Duplicate number index signature." + }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { + code: 2376, + category: ts.DiagnosticCategory.Error, + key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." + }, + Constructors_for_derived_classes_must_contain_a_super_call: { + code: 2377, + category: ts.DiagnosticCategory.Error, + key: "Constructors for derived classes must contain a 'super' call." + }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2378, + category: ts.DiagnosticCategory.Error, + key: "A 'get' accessor must return a value or consist of a single 'throw' statement." + }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { + code: 2379, + category: ts.DiagnosticCategory.Error, + key: "Getter and setter accessors do not agree in visibility." + }, + get_and_set_accessor_must_have_the_same_type: { + code: 2380, + category: ts.DiagnosticCategory.Error, + key: "'get' and 'set' accessor must have the same type." + }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { + code: 2381, + category: ts.DiagnosticCategory.Error, + key: "A signature with an implementation cannot use a string literal type." + }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { + code: 2382, + category: ts.DiagnosticCategory.Error, + key: "Specialized overload signature is not assignable to any non-specialized signature." + }, + Overload_signatures_must_all_be_exported_or_not_exported: { + code: 2383, + category: ts.DiagnosticCategory.Error, + key: "Overload signatures must all be exported or not exported." + }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { + code: 2384, + category: ts.DiagnosticCategory.Error, + key: "Overload signatures must all be ambient or non-ambient." + }, + Overload_signatures_must_all_be_public_private_or_protected: { + code: 2385, + category: ts.DiagnosticCategory.Error, + key: "Overload signatures must all be public, private or protected." + }, + Overload_signatures_must_all_be_optional_or_required: { + code: 2386, + category: ts.DiagnosticCategory.Error, + key: "Overload signatures must all be optional or required." + }, + Function_overload_must_be_static: { + code: 2387, + category: ts.DiagnosticCategory.Error, + key: "Function overload must be static." + }, + Function_overload_must_not_be_static: { + code: 2388, + category: ts.DiagnosticCategory.Error, + key: "Function overload must not be static." + }, + Function_implementation_name_must_be_0: { + code: 2389, + category: ts.DiagnosticCategory.Error, + key: "Function implementation name must be '{0}'." + }, + Constructor_implementation_is_missing: { + code: 2390, + category: ts.DiagnosticCategory.Error, + key: "Constructor implementation is missing." + }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { + code: 2391, + category: ts.DiagnosticCategory.Error, + key: "Function implementation is missing or not immediately following the declaration." + }, + Multiple_constructor_implementations_are_not_allowed: { + code: 2392, + category: ts.DiagnosticCategory.Error, + key: "Multiple constructor implementations are not allowed." + }, + Duplicate_function_implementation: { + code: 2393, + category: ts.DiagnosticCategory.Error, + key: "Duplicate function implementation." + }, + Overload_signature_is_not_compatible_with_function_implementation: { + code: 2394, + category: ts.DiagnosticCategory.Error, + key: "Overload signature is not compatible with function implementation." + }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { + code: 2395, + category: ts.DiagnosticCategory.Error, + key: "Individual declarations in merged declaration {0} must be all exported or all local." + }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { + code: 2396, + category: ts.DiagnosticCategory.Error, + key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." + }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { + code: 2399, + category: ts.DiagnosticCategory.Error, + key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." + }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { + code: 2400, + category: ts.DiagnosticCategory.Error, + key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." + }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { + code: 2401, + category: ts.DiagnosticCategory.Error, + key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." + }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { + code: 2402, + category: ts.DiagnosticCategory.Error, + key: "Expression resolves to '_super' that compiler uses to capture base class reference." + }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { + code: 2403, + category: ts.DiagnosticCategory.Error, + key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." + }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { + code: 2404, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...in' statement cannot use a type annotation." + }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { + code: 2405, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." + }, + Invalid_left_hand_side_in_for_in_statement: { + code: 2406, + category: ts.DiagnosticCategory.Error, + key: "Invalid left-hand side in 'for...in' statement." + }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2407, + category: ts.DiagnosticCategory.Error, + key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." + }, + Setters_cannot_return_a_value: { + code: 2408, + category: ts.DiagnosticCategory.Error, + key: "Setters cannot return a value." + }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { + code: 2409, + category: ts.DiagnosticCategory.Error, + key: "Return type of constructor signature must be assignable to the instance type of the class" + }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { + code: 2410, + category: ts.DiagnosticCategory.Error, + key: "All symbols within a 'with' block will be resolved to 'any'." + }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { + code: 2411, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." + }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { + code: 2412, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." + }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { + code: 2413, + category: ts.DiagnosticCategory.Error, + key: "Numeric index type '{0}' is not assignable to string index type '{1}'." + }, + Class_name_cannot_be_0: { + code: 2414, + category: ts.DiagnosticCategory.Error, + key: "Class name cannot be '{0}'" + }, + Class_0_incorrectly_extends_base_class_1: { + code: 2415, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' incorrectly extends base class '{1}'." + }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { + code: 2417, + category: ts.DiagnosticCategory.Error, + key: "Class static side '{0}' incorrectly extends base class static side '{1}'." + }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { + code: 2419, + category: ts.DiagnosticCategory.Error, + key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." + }, + Class_0_incorrectly_implements_interface_1: { + code: 2420, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' incorrectly implements interface '{1}'." + }, + A_class_may_only_implement_another_class_or_interface: { + code: 2422, + category: ts.DiagnosticCategory.Error, + key: "A class may only implement another class or interface." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { + code: 2423, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { + code: 2424, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." + }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2425, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." + }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2426, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." + }, + Interface_name_cannot_be_0: { + code: 2427, + category: ts.DiagnosticCategory.Error, + key: "Interface name cannot be '{0}'" + }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { + code: 2428, + category: ts.DiagnosticCategory.Error, + key: "All declarations of an interface must have identical type parameters." + }, + Interface_0_incorrectly_extends_interface_1: { + code: 2430, + category: ts.DiagnosticCategory.Error, + key: "Interface '{0}' incorrectly extends interface '{1}'." + }, + Enum_name_cannot_be_0: { + code: 2431, + category: ts.DiagnosticCategory.Error, + key: "Enum name cannot be '{0}'" + }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { + code: 2432, + category: ts.DiagnosticCategory.Error, + key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." + }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { + code: 2433, + category: ts.DiagnosticCategory.Error, + key: "A module declaration cannot be in a different file from a class or function with which it is merged" + }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { + code: 2434, + category: ts.DiagnosticCategory.Error, + key: "A module declaration cannot be located prior to a class or function with which it is merged" + }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { + code: 2435, + category: ts.DiagnosticCategory.Error, + key: "Ambient external modules cannot be nested in other modules." + }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { + code: 2436, + category: ts.DiagnosticCategory.Error, + key: "Ambient external module declaration cannot specify relative module name." + }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { + code: 2437, + category: ts.DiagnosticCategory.Error, + key: "Module '{0}' is hidden by a local declaration with the same name" + }, + Import_name_cannot_be_0: { + code: 2438, + category: ts.DiagnosticCategory.Error, + key: "Import name cannot be '{0}'" + }, + Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { + code: 2439, + category: ts.DiagnosticCategory.Error, + key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." + }, + Import_declaration_conflicts_with_local_declaration_of_0: { + code: 2440, + category: ts.DiagnosticCategory.Error, + key: "Import declaration conflicts with local declaration of '{0}'" + }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { + code: 2441, + category: ts.DiagnosticCategory.Error, + key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." + }, + Types_have_separate_declarations_of_a_private_property_0: { + code: 2442, + category: ts.DiagnosticCategory.Error, + key: "Types have separate declarations of a private property '{0}'." + }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { + code: 2443, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." + }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { + code: 2444, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." + }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { + code: 2445, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." + }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { + code: 2446, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." + }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { + code: 2447, + category: ts.DiagnosticCategory.Error, + key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." + }, + Block_scoped_variable_0_used_before_its_declaration: { + code: 2448, + category: ts.DiagnosticCategory.Error, + key: "Block-scoped variable '{0}' used before its declaration." + }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { + code: 2449, + category: ts.DiagnosticCategory.Error, + key: "The operand of an increment or decrement operator cannot be a constant." + }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { + code: 2450, + category: ts.DiagnosticCategory.Error, + key: "Left-hand side of assignment expression cannot be a constant." + }, + Cannot_redeclare_block_scoped_variable_0: { + code: 2451, + category: ts.DiagnosticCategory.Error, + key: "Cannot redeclare block-scoped variable '{0}'." + }, + An_enum_member_cannot_have_a_numeric_name: { + code: 2452, + category: ts.DiagnosticCategory.Error, + key: "An enum member cannot have a numeric name." + }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { + code: 2453, + category: ts.DiagnosticCategory.Error, + key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." + }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { + code: 2455, + category: ts.DiagnosticCategory.Error, + key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." + }, + Type_alias_0_circularly_references_itself: { + code: 2456, + category: ts.DiagnosticCategory.Error, + key: "Type alias '{0}' circularly references itself." + }, + Type_alias_name_cannot_be_0: { + code: 2457, + category: ts.DiagnosticCategory.Error, + key: "Type alias name cannot be '{0}'" + }, + An_AMD_module_cannot_have_multiple_name_assignments: { + code: 2458, + category: ts.DiagnosticCategory.Error, + key: "An AMD module cannot have multiple name assignments." + }, + Type_0_has_no_property_1_and_no_string_index_signature: { + code: 2459, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' has no property '{1}' and no string index signature." + }, + Type_0_has_no_property_1: { + code: 2460, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' has no property '{1}'." + }, + Type_0_is_not_an_array_type: { + code: 2461, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' is not an array type." + }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { + code: 2462, + category: ts.DiagnosticCategory.Error, + key: "A rest element must be last in an array destructuring pattern" + }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { + code: 2463, + category: ts.DiagnosticCategory.Error, + key: "A binding pattern parameter cannot be optional in an implementation signature." + }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { + code: 2464, + category: ts.DiagnosticCategory.Error, + key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." + }, + this_cannot_be_referenced_in_a_computed_property_name: { + code: 2465, + category: ts.DiagnosticCategory.Error, + key: "'this' cannot be referenced in a computed property name." + }, + super_cannot_be_referenced_in_a_computed_property_name: { + code: 2466, + category: ts.DiagnosticCategory.Error, + key: "'super' cannot be referenced in a computed property name." + }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { + code: 2467, + category: ts.DiagnosticCategory.Error, + key: "A computed property name cannot reference a type parameter from its containing type." + }, + Cannot_find_global_value_0: { + code: 2468, + category: ts.DiagnosticCategory.Error, + key: "Cannot find global value '{0}'." + }, + The_0_operator_cannot_be_applied_to_type_symbol: { + code: 2469, + category: ts.DiagnosticCategory.Error, + key: "The '{0}' operator cannot be applied to type 'symbol'." + }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { + code: 2470, + category: ts.DiagnosticCategory.Error, + key: "'Symbol' reference does not refer to the global Symbol constructor object." + }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { + code: 2471, + category: ts.DiagnosticCategory.Error, + key: "A computed property name of the form '{0}' must be of type 'symbol'." + }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 2472, + category: ts.DiagnosticCategory.Error, + key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." + }, + Enum_declarations_must_all_be_const_or_non_const: { + code: 2473, + category: ts.DiagnosticCategory.Error, + key: "Enum declarations must all be const or non-const." + }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { + code: 2474, + category: ts.DiagnosticCategory.Error, + key: "In 'const' enum declarations member initializer must be constant expression." + }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { + code: 2475, + category: ts.DiagnosticCategory.Error, + key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." + }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { + code: 2476, + category: ts.DiagnosticCategory.Error, + key: "A const enum member can only be accessed using a string literal." + }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { + code: 2477, + category: ts.DiagnosticCategory.Error, + key: "'const' enum member initializer was evaluated to a non-finite value." + }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { + code: 2478, + category: ts.DiagnosticCategory.Error, + key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." + }, + Property_0_does_not_exist_on_const_enum_1: { + code: 2479, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' does not exist on 'const' enum '{1}'." + }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { + code: 2480, + category: ts.DiagnosticCategory.Error, + key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." + }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { + code: 2481, + category: ts.DiagnosticCategory.Error, + key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." + }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { + code: 2483, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...of' statement cannot use a type annotation." + }, + Export_declaration_conflicts_with_exported_declaration_of_0: { + code: 2484, + category: ts.DiagnosticCategory.Error, + key: "Export declaration conflicts with exported declaration of '{0}'" + }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { + code: 2485, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { + code: 2486, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." + }, + Invalid_left_hand_side_in_for_of_statement: { + code: 2487, + category: ts.DiagnosticCategory.Error, + key: "Invalid left-hand side in 'for...of' statement." + }, + The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { + code: 2488, + category: ts.DiagnosticCategory.Error, + key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." + }, + The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { + code: 2489, + category: ts.DiagnosticCategory.Error, + key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." + }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { + code: 2490, + category: ts.DiagnosticCategory.Error, + key: "The type returned by the 'next()' method of an iterator must have a 'value' property." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { + code: 2491, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." + }, + Cannot_redeclare_identifier_0_in_catch_clause: { + code: 2492, + category: ts.DiagnosticCategory.Error, + key: "Cannot redeclare identifier '{0}' in catch clause" + }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { + code: 2493, + category: ts.DiagnosticCategory.Error, + key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." + }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { + code: 2494, + category: ts.DiagnosticCategory.Error, + key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." + }, + Type_0_is_not_an_array_type_or_a_string_type: { + code: 2495, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' is not an array type or a string type." + }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { + code: 2496, + category: ts.DiagnosticCategory.Error, + key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." + }, + External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { + code: 2497, + category: ts.DiagnosticCategory.Error, + key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." + }, + External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { + code: 2498, + category: ts.DiagnosticCategory.Error, + key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." + }, + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { + code: 2499, + category: ts.DiagnosticCategory.Error, + key: "An interface can only extend an identifier/qualified-name with optional type arguments." + }, + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { + code: 2500, + category: ts.DiagnosticCategory.Error, + key: "A class can only implement an identifier/qualified-name with optional type arguments." + }, + Import_declaration_0_is_using_private_name_1: { + code: 4000, + category: ts.DiagnosticCategory.Error, + key: "Import declaration '{0}' is using private name '{1}'." + }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4002, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4004, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4006, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4008, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4010, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4012, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4014, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4016, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of exported function has or is using private name '{1}'." + }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4019, + category: ts.DiagnosticCategory.Error, + key: "Implements clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4020, + category: ts.DiagnosticCategory.Error, + key: "Extends clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { + code: 4022, + category: ts.DiagnosticCategory.Error, + key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." + }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4023, + category: ts.DiagnosticCategory.Error, + key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." + }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { + code: 4024, + category: ts.DiagnosticCategory.Error, + key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." + }, + Exported_variable_0_has_or_is_using_private_name_1: { + code: 4025, + category: ts.DiagnosticCategory.Error, + key: "Exported variable '{0}' has or is using private name '{1}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4026, + category: ts.DiagnosticCategory.Error, + key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4027, + category: ts.DiagnosticCategory.Error, + key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4028, + category: ts.DiagnosticCategory.Error, + key: "Public static property '{0}' of exported class has or is using private name '{1}'." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4029, + category: ts.DiagnosticCategory.Error, + key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4030, + category: ts.DiagnosticCategory.Error, + key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4031, + category: ts.DiagnosticCategory.Error, + key: "Public property '{0}' of exported class has or is using private name '{1}'." + }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4032, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." + }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4033, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' of exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4034, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4035, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4036, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4037, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4038, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4039, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4040, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4041, + category: ts.DiagnosticCategory.Error, + key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4042, + category: ts.DiagnosticCategory.Error, + key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4043, + category: ts.DiagnosticCategory.Error, + key: "Return type of public property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4044, + category: ts.DiagnosticCategory.Error, + key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4045, + category: ts.DiagnosticCategory.Error, + key: "Return type of constructor signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4046, + category: ts.DiagnosticCategory.Error, + key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4047, + category: ts.DiagnosticCategory.Error, + key: "Return type of call signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4048, + category: ts.DiagnosticCategory.Error, + key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4049, + category: ts.DiagnosticCategory.Error, + key: "Return type of index signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4050, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4051, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4052, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static method from exported class has or is using private name '{0}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4053, + category: ts.DiagnosticCategory.Error, + key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4054, + category: ts.DiagnosticCategory.Error, + key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4055, + category: ts.DiagnosticCategory.Error, + key: "Return type of public method from exported class has or is using private name '{0}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4056, + category: ts.DiagnosticCategory.Error, + key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { + code: 4057, + category: ts.DiagnosticCategory.Error, + key: "Return type of method from exported interface has or is using private name '{0}'." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4058, + category: ts.DiagnosticCategory.Error, + key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { + code: 4059, + category: ts.DiagnosticCategory.Error, + key: "Return type of exported function has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { + code: 4060, + category: ts.DiagnosticCategory.Error, + key: "Return type of exported function has or is using private name '{0}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4061, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4062, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { + code: 4063, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4064, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4065, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4066, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4067, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4068, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4069, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4070, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4071, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4072, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4073, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4074, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4075, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4076, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { + code: 4077, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4078, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of exported function has or is using private name '{1}'." + }, + Exported_type_alias_0_has_or_is_using_private_name_1: { + code: 4081, + category: ts.DiagnosticCategory.Error, + key: "Exported type alias '{0}' has or is using private name '{1}'." + }, + Default_export_of_the_module_has_or_is_using_private_name_0: { + code: 4082, + category: ts.DiagnosticCategory.Error, + key: "Default export of the module has or is using private name '{0}'." + }, + Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { + code: 4091, + category: ts.DiagnosticCategory.Error, + key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." + }, + The_current_host_does_not_support_the_0_option: { + code: 5001, + category: ts.DiagnosticCategory.Error, + key: "The current host does not support the '{0}' option." + }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { + code: 5009, + category: ts.DiagnosticCategory.Error, + key: "Cannot find the common subdirectory path for the input files." + }, + Cannot_read_file_0_Colon_1: { + code: 5012, + category: ts.DiagnosticCategory.Error, + key: "Cannot read file '{0}': {1}" + }, + Unsupported_file_encoding: { + code: 5013, + category: ts.DiagnosticCategory.Error, + key: "Unsupported file encoding." + }, + Unknown_compiler_option_0: { + code: 5023, + category: ts.DiagnosticCategory.Error, + key: "Unknown compiler option '{0}'." + }, + Compiler_option_0_requires_a_value_of_type_1: { + code: 5024, + category: ts.DiagnosticCategory.Error, + key: "Compiler option '{0}' requires a value of type {1}." + }, + Could_not_write_file_0_Colon_1: { + code: 5033, + category: ts.DiagnosticCategory.Error, + key: "Could not write file '{0}': {1}" + }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5038, + category: ts.DiagnosticCategory.Error, + key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5039, + category: ts.DiagnosticCategory.Error, + key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { + code: 5040, + category: ts.DiagnosticCategory.Error, + key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." + }, + Option_noEmit_cannot_be_specified_with_option_declaration: { + code: 5041, + category: ts.DiagnosticCategory.Error, + key: "Option 'noEmit' cannot be specified with option 'declaration'." + }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { + code: 5042, + category: ts.DiagnosticCategory.Error, + key: "Option 'project' cannot be mixed with source files on a command line." + }, + Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { + code: 5043, + category: ts.DiagnosticCategory.Error, + key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." + }, + Option_declaration_cannot_be_specified_with_option_separateCompilation: { + code: 5044, + category: ts.DiagnosticCategory.Error, + key: "Option 'declaration' cannot be specified with option 'separateCompilation'." + }, + Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { + code: 5045, + category: ts.DiagnosticCategory.Error, + key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." + }, + Option_out_cannot_be_specified_with_option_separateCompilation: { + code: 5046, + category: ts.DiagnosticCategory.Error, + key: "Option 'out' cannot be specified with option 'separateCompilation'." + }, + Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { + code: 5047, + category: ts.DiagnosticCategory.Error, + key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." + }, + Concatenate_and_emit_output_to_single_file: { + code: 6001, + category: ts.DiagnosticCategory.Message, + key: "Concatenate and emit output to single file." + }, + Generates_corresponding_d_ts_file: { + code: 6002, + category: ts.DiagnosticCategory.Message, + key: "Generates corresponding '.d.ts' file." + }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { + code: 6003, + category: ts.DiagnosticCategory.Message, + key: "Specifies the location where debugger should locate map files instead of generated locations." + }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { + code: 6004, + category: ts.DiagnosticCategory.Message, + key: "Specifies the location where debugger should locate TypeScript files instead of source locations." + }, + Watch_input_files: { + code: 6005, + category: ts.DiagnosticCategory.Message, + key: "Watch input files." + }, + Redirect_output_structure_to_the_directory: { + code: 6006, + category: ts.DiagnosticCategory.Message, + key: "Redirect output structure to the directory." + }, + Do_not_erase_const_enum_declarations_in_generated_code: { + code: 6007, + category: ts.DiagnosticCategory.Message, + key: "Do not erase const enum declarations in generated code." + }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { + code: 6008, + category: ts.DiagnosticCategory.Message, + key: "Do not emit outputs if any type checking errors were reported." + }, + Do_not_emit_comments_to_output: { + code: 6009, + category: ts.DiagnosticCategory.Message, + key: "Do not emit comments to output." + }, + Do_not_emit_outputs: { + code: 6010, + category: ts.DiagnosticCategory.Message, + key: "Do not emit outputs." + }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { + code: 6015, + category: ts.DiagnosticCategory.Message, + key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" + }, + Specify_module_code_generation_Colon_commonjs_or_amd: { + code: 6016, + category: ts.DiagnosticCategory.Message, + key: "Specify module code generation: 'commonjs' or 'amd'" + }, + Print_this_message: { + code: 6017, + category: ts.DiagnosticCategory.Message, + key: "Print this message." + }, + Print_the_compiler_s_version: { + code: 6019, + category: ts.DiagnosticCategory.Message, + key: "Print the compiler's version." + }, + Compile_the_project_in_the_given_directory: { + code: 6020, + category: ts.DiagnosticCategory.Message, + key: "Compile the project in the given directory." + }, + Syntax_Colon_0: { + code: 6023, + category: ts.DiagnosticCategory.Message, + key: "Syntax: {0}" + }, + options: { + code: 6024, + category: ts.DiagnosticCategory.Message, + key: "options" + }, + file: { + code: 6025, + category: ts.DiagnosticCategory.Message, + key: "file" + }, + Examples_Colon_0: { + code: 6026, + category: ts.DiagnosticCategory.Message, + key: "Examples: {0}" + }, + Options_Colon: { + code: 6027, + category: ts.DiagnosticCategory.Message, + key: "Options:" + }, + Version_0: { + code: 6029, + category: ts.DiagnosticCategory.Message, + key: "Version {0}" + }, + Insert_command_line_options_and_files_from_a_file: { + code: 6030, + category: ts.DiagnosticCategory.Message, + key: "Insert command line options and files from a file." + }, + File_change_detected_Starting_incremental_compilation: { + code: 6032, + category: ts.DiagnosticCategory.Message, + key: "File change detected. Starting incremental compilation..." + }, + KIND: { + code: 6034, + category: ts.DiagnosticCategory.Message, + key: "KIND" + }, + FILE: { + code: 6035, + category: ts.DiagnosticCategory.Message, + key: "FILE" + }, + VERSION: { + code: 6036, + category: ts.DiagnosticCategory.Message, + key: "VERSION" + }, + LOCATION: { + code: 6037, + category: ts.DiagnosticCategory.Message, + key: "LOCATION" + }, + DIRECTORY: { + code: 6038, + category: ts.DiagnosticCategory.Message, + key: "DIRECTORY" + }, + Compilation_complete_Watching_for_file_changes: { + code: 6042, + category: ts.DiagnosticCategory.Message, + key: "Compilation complete. Watching for file changes." + }, + Generates_corresponding_map_file: { + code: 6043, + category: ts.DiagnosticCategory.Message, + key: "Generates corresponding '.map' file." + }, + Compiler_option_0_expects_an_argument: { + code: 6044, + category: ts.DiagnosticCategory.Error, + key: "Compiler option '{0}' expects an argument." + }, + Unterminated_quoted_string_in_response_file_0: { + code: 6045, + category: ts.DiagnosticCategory.Error, + key: "Unterminated quoted string in response file '{0}'." + }, + Argument_for_module_option_must_be_commonjs_or_amd: { + code: 6046, + category: ts.DiagnosticCategory.Error, + key: "Argument for '--module' option must be 'commonjs' or 'amd'." + }, + Argument_for_target_option_must_be_es3_es5_or_es6: { + code: 6047, + category: ts.DiagnosticCategory.Error, + key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." + }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { + code: 6048, + category: ts.DiagnosticCategory.Error, + key: "Locale must be of the form or -. For example '{0}' or '{1}'." + }, + Unsupported_locale_0: { + code: 6049, + category: ts.DiagnosticCategory.Error, + key: "Unsupported locale '{0}'." + }, + Unable_to_open_file_0: { + code: 6050, + category: ts.DiagnosticCategory.Error, + key: "Unable to open file '{0}'." + }, + Corrupted_locale_file_0: { + code: 6051, + category: ts.DiagnosticCategory.Error, + key: "Corrupted locale file {0}." + }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { + code: 6052, + category: ts.DiagnosticCategory.Message, + key: "Raise error on expressions and declarations with an implied 'any' type." + }, + File_0_not_found: { + code: 6053, + category: ts.DiagnosticCategory.Error, + key: "File '{0}' not found." + }, + File_0_must_have_extension_ts_or_d_ts: { + code: 6054, + category: ts.DiagnosticCategory.Error, + key: "File '{0}' must have extension '.ts' or '.d.ts'." + }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { + code: 6055, + category: ts.DiagnosticCategory.Message, + key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." + }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { + code: 6056, + category: ts.DiagnosticCategory.Message, + key: "Do not emit declarations for code that has an '@internal' annotation." + }, + Preserve_new_lines_when_emitting_code: { + code: 6057, + category: ts.DiagnosticCategory.Message, + key: "Preserve new-lines when emitting code." + }, + Variable_0_implicitly_has_an_1_type: { + code: 7005, + category: ts.DiagnosticCategory.Error, + key: "Variable '{0}' implicitly has an '{1}' type." + }, + Parameter_0_implicitly_has_an_1_type: { + code: 7006, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' implicitly has an '{1}' type." + }, + Member_0_implicitly_has_an_1_type: { + code: 7008, + category: ts.DiagnosticCategory.Error, + key: "Member '{0}' implicitly has an '{1}' type." + }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { + code: 7009, + category: ts.DiagnosticCategory.Error, + key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." + }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { + code: 7010, + category: ts.DiagnosticCategory.Error, + key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." + }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { + code: 7011, + category: ts.DiagnosticCategory.Error, + key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." + }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7013, + category: ts.DiagnosticCategory.Error, + key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { + code: 7016, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." + }, + Index_signature_of_object_type_implicitly_has_an_any_type: { + code: 7017, + category: ts.DiagnosticCategory.Error, + key: "Index signature of object type implicitly has an 'any' type." + }, + Object_literal_s_property_0_implicitly_has_an_1_type: { + code: 7018, + category: ts.DiagnosticCategory.Error, + key: "Object literal's property '{0}' implicitly has an '{1}' type." + }, + Rest_parameter_0_implicitly_has_an_any_type: { + code: 7019, + category: ts.DiagnosticCategory.Error, + key: "Rest parameter '{0}' implicitly has an 'any[]' type." + }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7020, + category: ts.DiagnosticCategory.Error, + key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { + code: 7021, + category: ts.DiagnosticCategory.Error, + key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." + }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { + code: 7022, + category: ts.DiagnosticCategory.Error, + key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." + }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7023, + category: ts.DiagnosticCategory.Error, + key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7024, + category: ts.DiagnosticCategory.Error, + key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + You_cannot_rename_this_element: { + code: 8000, + category: ts.DiagnosticCategory.Error, + key: "You cannot rename this element." + }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { + code: 8001, + category: ts.DiagnosticCategory.Error, + key: "You cannot rename elements that are defined in the standard TypeScript library." + }, + yield_expressions_are_not_currently_supported: { + code: 9000, + category: ts.DiagnosticCategory.Error, + key: "'yield' expressions are not currently supported." + }, + Generators_are_not_currently_supported: { + code: 9001, + category: ts.DiagnosticCategory.Error, + key: "Generators are not currently supported." + }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { + code: 9002, + category: ts.DiagnosticCategory.Error, + key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." + }, + class_expressions_are_not_currently_supported: { + code: 9003, + category: ts.DiagnosticCategory.Error, + key: "'class' expressions are not currently supported." + }, + class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { + code: 9004, + category: ts.DiagnosticCategory.Error, + key: "'class' declarations are only supported directly inside a module or as a top level declaration." + } }; })(ts || (ts = {})); +/// +/// var ts; (function (ts) { var textToToken = { @@ -1514,10 +3584,2806 @@ var ts; "^=": 64, "@": 52 }; - var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1610, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1786, + 1788, + 1808, + 1808, + 1810, + 1836, + 1920, + 1957, + 2309, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2784, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3294, + 3294, + 3296, + 3297, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3424, + 3425, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3805, + 3840, + 3840, + 3904, + 3911, + 3913, + 3946, + 3976, + 3979, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4176, + 4181, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6067, + 6176, + 6263, + 6272, + 6312, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8319, + 8319, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12445, + 12446, + 12449, + 12538, + 12540, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES3IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 768, + 846, + 864, + 866, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1155, + 1158, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1441, + 1443, + 1465, + 1467, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1476, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1621, + 1632, + 1641, + 1648, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1773, + 1776, + 1788, + 1808, + 1836, + 1840, + 1866, + 1920, + 1968, + 2305, + 2307, + 2309, + 2361, + 2364, + 2381, + 2384, + 2388, + 2392, + 2403, + 2406, + 2415, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2492, + 2494, + 2500, + 2503, + 2504, + 2507, + 2509, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2562, + 2562, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2649, + 2652, + 2654, + 2654, + 2662, + 2676, + 2689, + 2691, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2784, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2876, + 2883, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2913, + 2918, + 2927, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3031, + 3031, + 3047, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3134, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3168, + 3169, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3262, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3297, + 3302, + 3311, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3390, + 3395, + 3398, + 3400, + 3402, + 3405, + 3415, + 3415, + 3424, + 3425, + 3430, + 3439, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3805, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3946, + 3953, + 3972, + 3974, + 3979, + 3984, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4140, + 4146, + 4150, + 4153, + 4160, + 4169, + 4176, + 4185, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 4969, + 4977, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6099, + 6112, + 6121, + 6160, + 6169, + 6176, + 6263, + 6272, + 6313, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8255, + 8256, + 8319, + 8319, + 8400, + 8412, + 8417, + 8417, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12441, + 12442, + 12445, + 12446, + 12449, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65056, + 65059, + 65075, + 65076, + 65101, + 65103, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65381, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 880, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1568, + 1610, + 1646, + 1647, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1774, + 1775, + 1786, + 1788, + 1791, + 1791, + 1808, + 1808, + 1810, + 1839, + 1869, + 1957, + 1969, + 1969, + 1994, + 2026, + 2036, + 2037, + 2042, + 2042, + 2048, + 2069, + 2074, + 2074, + 2084, + 2084, + 2088, + 2088, + 2112, + 2136, + 2208, + 2208, + 2210, + 2220, + 2308, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2417, + 2423, + 2425, + 2431, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2493, + 2493, + 2510, + 2510, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2785, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2929, + 2929, + 2947, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3024, + 3024, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3133, + 3160, + 3161, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3261, + 3261, + 3294, + 3294, + 3296, + 3297, + 3313, + 3314, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3389, + 3406, + 3406, + 3424, + 3425, + 3450, + 3455, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3807, + 3840, + 3840, + 3904, + 3911, + 3913, + 3948, + 3976, + 3980, + 4096, + 4138, + 4159, + 4159, + 4176, + 4181, + 4186, + 4189, + 4193, + 4193, + 4197, + 4198, + 4206, + 4208, + 4213, + 4225, + 4238, + 4238, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5905, + 5920, + 5937, + 5952, + 5969, + 5984, + 5996, + 5998, + 6000, + 6016, + 6067, + 6103, + 6103, + 6108, + 6108, + 6176, + 6263, + 6272, + 6312, + 6314, + 6314, + 6320, + 6389, + 6400, + 6428, + 6480, + 6509, + 6512, + 6516, + 6528, + 6571, + 6593, + 6599, + 6656, + 6678, + 6688, + 6740, + 6823, + 6823, + 6917, + 6963, + 6981, + 6987, + 7043, + 7072, + 7086, + 7087, + 7098, + 7141, + 7168, + 7203, + 7245, + 7247, + 7258, + 7293, + 7401, + 7404, + 7406, + 7409, + 7413, + 7414, + 7424, + 7615, + 7680, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11502, + 11506, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11648, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11823, + 11823, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42527, + 42538, + 42539, + 42560, + 42606, + 42623, + 42647, + 42656, + 42735, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43009, + 43011, + 43013, + 43015, + 43018, + 43020, + 43042, + 43072, + 43123, + 43138, + 43187, + 43250, + 43255, + 43259, + 43259, + 43274, + 43301, + 43312, + 43334, + 43360, + 43388, + 43396, + 43442, + 43471, + 43471, + 43520, + 43560, + 43584, + 43586, + 43588, + 43595, + 43616, + 43638, + 43642, + 43642, + 43648, + 43695, + 43697, + 43697, + 43701, + 43702, + 43705, + 43709, + 43712, + 43712, + 43714, + 43714, + 43739, + 43741, + 43744, + 43754, + 43762, + 43764, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44002, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 768, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1155, + 1159, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1477, + 1479, + 1479, + 1488, + 1514, + 1520, + 1522, + 1552, + 1562, + 1568, + 1641, + 1646, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1788, + 1791, + 1791, + 1808, + 1866, + 1869, + 1969, + 1984, + 2037, + 2042, + 2042, + 2048, + 2093, + 2112, + 2139, + 2208, + 2208, + 2210, + 2220, + 2276, + 2302, + 2304, + 2403, + 2406, + 2415, + 2417, + 2423, + 2425, + 2431, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2500, + 2503, + 2504, + 2507, + 2510, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2561, + 2563, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2641, + 2641, + 2649, + 2652, + 2654, + 2654, + 2662, + 2677, + 2689, + 2691, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2787, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2876, + 2884, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2915, + 2918, + 2927, + 2929, + 2929, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3024, + 3024, + 3031, + 3031, + 3046, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3160, + 3161, + 3168, + 3171, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3260, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3299, + 3302, + 3311, + 3313, + 3314, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3396, + 3398, + 3400, + 3402, + 3406, + 3415, + 3415, + 3424, + 3427, + 3430, + 3439, + 3450, + 3455, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3807, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3948, + 3953, + 3972, + 3974, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4169, + 4176, + 4253, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4957, + 4959, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5908, + 5920, + 5940, + 5952, + 5971, + 5984, + 5996, + 5998, + 6000, + 6002, + 6003, + 6016, + 6099, + 6103, + 6103, + 6108, + 6109, + 6112, + 6121, + 6155, + 6157, + 6160, + 6169, + 6176, + 6263, + 6272, + 6314, + 6320, + 6389, + 6400, + 6428, + 6432, + 6443, + 6448, + 6459, + 6470, + 6509, + 6512, + 6516, + 6528, + 6571, + 6576, + 6601, + 6608, + 6617, + 6656, + 6683, + 6688, + 6750, + 6752, + 6780, + 6783, + 6793, + 6800, + 6809, + 6823, + 6823, + 6912, + 6987, + 6992, + 7001, + 7019, + 7027, + 7040, + 7155, + 7168, + 7223, + 7232, + 7241, + 7245, + 7293, + 7376, + 7378, + 7380, + 7414, + 7424, + 7654, + 7676, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8204, + 8205, + 8255, + 8256, + 8276, + 8276, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8400, + 8412, + 8417, + 8417, + 8421, + 8432, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11647, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11744, + 11775, + 11823, + 11823, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12441, + 12442, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42539, + 42560, + 42607, + 42612, + 42621, + 42623, + 42647, + 42655, + 42737, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43047, + 43072, + 43123, + 43136, + 43204, + 43216, + 43225, + 43232, + 43255, + 43259, + 43259, + 43264, + 43309, + 43312, + 43347, + 43360, + 43388, + 43392, + 43456, + 43471, + 43481, + 43520, + 43574, + 43584, + 43597, + 43600, + 43609, + 43616, + 43638, + 43642, + 43643, + 43648, + 43714, + 43739, + 43741, + 43744, + 43759, + 43762, + 43766, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44010, + 44012, + 44013, + 44016, + 44025, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65024, + 65039, + 65056, + 65062, + 65075, + 65076, + 65101, + 65103, + 65136, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; function lookupInUnicodeMap(code, map) { if (code < map[0]) { return false; @@ -1541,21 +6407,17 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierStart) : - lookupInUnicodeMap(code, unicodeES3IdentifierStart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierPart) : - lookupInUnicodeMap(code, unicodeES3IdentifierPart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; - for (var _name in source) { - if (source.hasOwnProperty(_name)) { - result[source[_name]] = _name; + for (var name_2 in source) { + if (source.hasOwnProperty(name_2)) { + result[source[name_2]] = name_2; } } return result; @@ -1626,25 +6488,21 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || - ch === 9 || - ch === 11 || - ch === 12 || - ch === 160 || - ch === 133 || - ch === 5760 || - ch >= 8192 && ch <= 8203 || - ch === 8239 || - ch === 8287 || - ch === 12288 || - ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 133 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { - return ch === 10 || - ch === 13 || - ch === 8232 || - ch === 8233; + // ES5 7.3: + // The ECMAScript line terminator characters are listed in Table 3. + // Table 3 � Line Terminator Characters + // Code Unit Value Name Formal Name + // \u000A Line Feed + // \u000D Carriage Return + // \u2028 Line separator + // \u2029 Paragraph separator + // Only the characters in Table 3 are treated as line terminators. Other new line or line + // breaking characters are treated as white space but not as line terminators. + return ch === 10 || ch === 13 || ch === 8232 || ch === 8233; } ts.isLineBreak = isLineBreak; function isDigit(ch) { @@ -1727,8 +6585,7 @@ var ts; return false; } } - return ch === 61 || - text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -1747,8 +6604,8 @@ var ts; else { ts.Debug.assert(ch === 61); while (pos < len) { - var _ch = text.charCodeAt(pos); - if (_ch === 62 && isConflictMarkerTrivia(text, pos)) { + var ch_1 = text.charCodeAt(pos); + if (ch_1 === 62 && isConflictMarkerTrivia(text, pos)) { break; } pos++; @@ -1810,7 +6667,11 @@ var ts; if (!result) { result = []; } - result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + result.push({ + pos: startPos, + end: pos, + hasTrailingNewLine: hasTrailingNewLine + }); } continue; } @@ -1837,15 +6698,11 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -1864,14 +6721,10 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -2148,8 +7001,8 @@ var ts; return result; } function getIdentifierToken() { - var _len = tokenValue.length; - if (_len >= 2 && _len <= 11) { + 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]; @@ -2301,13 +7154,13 @@ var ts; pos += 2; var commentClosed = false; while (pos < len) { - var _ch = text.charCodeAt(pos); - if (_ch === 42 && text.charCodeAt(pos + 1) === 47) { + var ch_2 = text.charCodeAt(pos); + if (ch_2 === 42 && text.charCodeAt(pos + 1) === 47) { pos += 2; commentClosed = true; break; } - if (isLineBreak(_ch)) { + if (isLineBreak(ch_2)) { precedingLineBreak = true; } pos++; @@ -2340,22 +7193,22 @@ var ts; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { pos += 2; - var _value = scanBinaryOrOctalDigits(2); - if (_value < 0) { + var value = scanBinaryOrOctalDigits(2); + if (value < 0) { error(ts.Diagnostics.Binary_digit_expected); - _value = 0; + value = 0; } - tokenValue = "" + _value; + tokenValue = "" + value; return token = 7; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { pos += 2; - var _value_1 = scanBinaryOrOctalDigits(8); - if (_value_1 < 0) { + var value = scanBinaryOrOctalDigits(8); + if (value < 0) { error(ts.Diagnostics.Octal_digit_expected); - _value_1 = 0; + value = 0; } - tokenValue = "" + _value_1; + tokenValue = "" + value; return token = 7; } if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { @@ -2596,17 +7449,39 @@ var ts; } setText(text); return { - getStartPos: function () { return startPos; }, - getTextPos: function () { return pos; }, - getToken: function () { return token; }, - getTokenPos: function () { return tokenPos; }, - getTokenText: function () { return text.substring(tokenPos, pos); }, - getTokenValue: function () { return tokenValue; }, - hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, - hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 65 || token > 101; }, - isReservedWord: function () { return token >= 66 && token <= 101; }, - isUnterminated: function () { return tokenIsUnterminated; }, + getStartPos: function () { + return startPos; + }, + getTextPos: function () { + return pos; + }, + getToken: function () { + return token; + }, + getTokenPos: function () { + return tokenPos; + }, + getTokenText: function () { + return text.substring(tokenPos, pos); + }, + getTokenValue: function () { + return tokenValue; + }, + hasExtendedUnicodeEscape: function () { + return hasExtendedUnicodeEscape; + }, + hasPrecedingLineBreak: function () { + return precedingLineBreak; + }, + isIdentifier: function () { + return token === 65 || token > 101; + }, + isReservedWord: function () { + return token >= 66 && token <= 101; + }, + isUnterminated: function () { + return tokenIsUnterminated; + }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -2619,20 +7494,21 @@ var ts; } ts.createScanner = createScanner; })(ts || (ts = {})); +/// var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 199 || node.kind === 200) { + if (node.kind === 202 || node.kind === 203) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 206 || node.kind === 205) && !(node.flags & 1)) { + else if ((node.kind === 209 || node.kind === 208) && !(node.flags & 1)) { return 0; } - else if (node.kind === 203) { + else if (node.kind === 206) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -2648,7 +7524,7 @@ var ts; }); return state; } - else if (node.kind === 202) { + else if (node.kind === 205) { return getModuleInstanceState(node.body); } else { @@ -2663,7 +7539,7 @@ var ts; } ts.bindSourceFile = bindSourceFile; function bindSourceFileWorker(file) { - var _parent; + var parent; var container; var blockScopeContainer; var lastContainer; @@ -2701,7 +7577,7 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 202 && node.name.kind === 8) { + if (node.kind === 205 && node.name.kind === 8) { return '"' + node.name.text + '"'; } if (node.name.kind === 127) { @@ -2722,12 +7598,12 @@ var ts; return "__new"; case 140: return "__index"; - case 212: + case 215: return "__export"; - case 211: + case 214: return node.isExportEquals ? "export=" : "default"; - case 197: - case 198: + case 200: + case 201: return node.flags & 256 ? "default" : undefined; } } @@ -2736,22 +7612,20 @@ var ts; } function declareSymbol(symbols, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var _name = node.flags & 256 && parent ? "default" : getDeclarationName(node); + var name = node.flags & 256 && parent ? "default" : getDeclarationName(node); var symbol; - if (_name !== undefined) { - symbol = ts.hasProperty(symbols, _name) ? symbols[_name] : (symbols[_name] = createSymbol(0, _name)); + if (name !== undefined) { + symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); if (symbol.flags & excludes) { if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 - : ts.Diagnostics.Duplicate_identifier_0; + var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); - symbol = createSymbol(0, _name); + symbol = createSymbol(0, name); } } else { @@ -2759,7 +7633,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 198 && symbol.exports) { + if ((node.kind === 201 || node.kind === 174) && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -2775,7 +7649,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 214 || (node.kind === 205 && hasExportModifier)) { + if (node.kind === 217 || (node.kind === 208 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -2784,9 +7658,7 @@ var ts; } else { if (hasExportModifier || container.flags & 32768) { - var exportKind = (symbolKind & 107455 ? 1048576 : 0) | - (symbolKind & 793056 ? 2097152 : 0) | - (symbolKind & 1536 ? 4194304 : 0); + var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; @@ -2800,10 +7672,10 @@ var ts; if (symbolKind & 255504) { node.locals = {}; } - var saveParent = _parent; + var saveParent = parent; var saveContainer = container; var savedBlockScopeContainer = blockScopeContainer; - _parent = node; + parent = node; if (symbolKind & 262128) { container = node; if (lastContainer) { @@ -2812,19 +7684,19 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 224); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227); } ts.forEachChild(node, bind); container = saveContainer; - _parent = saveParent; + parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 202: + case 205: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -2839,22 +7711,23 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 198: + case 174: + case 201: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } case 145: case 154: - case 199: + case 202: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 201: + case 204: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -2869,11 +7742,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 224 ? node : node.body; - if (body.kind === 224 || body.kind === 203) { - for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { + var body = node.kind === 227 ? node : node.body; + if (body.kind === 227 || body.kind === 206) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 212 || stat.kind === 211) { + if (stat.kind === 215 || stat.kind === 214) { return true; } } @@ -2911,6 +7784,12 @@ var ts; } } function bindFunctionOrConstructorType(node) { + // For a given function symbol "<...>(...) => T" we want to generate a symbol identical + // to the one we would get for: { <...>(...): T } + // + // We do that by making an anonymous type literal symbol, and then setting the function + // symbol as its sole member. To the rest of the system, this symbol will be indistinguishable + // from an actual type literal symbol you would have gotten had you used the long form. var symbol = createSymbol(131072, getDeclarationName(node)); addDeclarationToSymbol(symbol, node, 131072); bindChildren(node, 131072, false); @@ -2929,10 +7808,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 202: + case 205: declareModuleMember(node, 2, 107455); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -2949,7 +7828,7 @@ var ts; return "__" + ts.indexOf(node.parent.parameters, node); } function bind(node) { - node.parent = _parent; + node.parent = parent; switch (node.kind) { case 128: bindDeclaration(node, 262144, 530912, false); @@ -2957,7 +7836,7 @@ var ts; case 129: bindParameter(node); break; - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); @@ -2973,11 +7852,11 @@ var ts; case 131: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 221: - case 222: + case 224: + case 225: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 223: + case 226: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 138: @@ -2989,7 +7868,7 @@ var ts; case 133: bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; - case 197: + case 200: bindDeclaration(node, 16, 106927, true); break; case 135: @@ -3015,19 +7894,22 @@ var ts; case 163: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 220: + case 174: + bindAnonymousDeclaration(node, 32, "__class", false); + break; + case 223: bindCatchVariableDeclaration(node); break; - case 198: + case 201: bindDeclaration(node, 32, 899583, false); break; - case 199: + case 202: bindDeclaration(node, 64, 792992, false); break; - case 200: + case 203: bindDeclaration(node, 524288, 793056, false); break; - case 201: + case 204: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -3035,16 +7917,16 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 202: + case 205: bindModuleDeclaration(node); break; - case 205: case 208: - case 210: - case 214: + case 211: + case 213: + case 217: bindDeclaration(node, 8388608, 8388608, false); break; - case 207: + case 210: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -3052,13 +7934,13 @@ var ts; bindChildren(node, 0, false); } break; - case 212: + case 215: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 211: + case 214: if (node.expression && node.expression.kind === 65) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } @@ -3067,27 +7949,27 @@ var ts; } bindChildren(node, 0, false); break; - case 224: + case 227: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 176: + case 179: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 220: - case 183: - case 184: - case 185: - case 204: + case 223: + case 186: + case 187: + case 188: + case 207: bindChildren(node, 0, true); break; default: - var saveParent = _parent; - _parent = node; + var saveParent = parent; + parent = node; ts.forEachChild(node, bind); - _parent = saveParent; + parent = saveParent; } } function bindParameter(node) { @@ -3097,9 +7979,7 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && - node.parent.kind === 135 && - node.parent.parent.kind === 198) { + if (node.flags & 112 && node.parent.kind === 135 && (node.parent.parent.kind === 201 || node.parent.parent.kind === 174)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -3114,11 +7994,12 @@ var ts; } } })(ts || (ts = {})); +/// var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -3131,9 +8012,13 @@ var ts; function getSingleLineStringWriter() { if (stringWriters.length == 0) { var str = ""; - var writeText = function (text) { return str += text; }; + var writeText = function (text) { + return str += text; + }; return { - string: function () { return str; }, + string: function () { + return str; + }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -3141,11 +8026,18 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { return str += " "; }, - increaseIndent: function () { }, - decreaseIndent: function () { }, - clear: function () { return str = ""; }, - trackSymbol: function () { } + writeLine: function () { + return str += " "; + }, + increaseIndent: function () { + }, + decreaseIndent: function () { + }, + clear: function () { + return str = ""; + }, + trackSymbol: function () { + } }; } return stringWriters.pop(); @@ -3167,8 +8059,7 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 128)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 32) !== 0) || - ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 32) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 64; } @@ -3176,7 +8067,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 224) { + while (node && node.kind !== 227) { node = node.parent; } return node; @@ -3247,8 +8138,7 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 12288) !== 0 || - isCatchClauseVariableDeclaration(declaration); + return (getCombinedNodeFlags(declaration) & 12288) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function getEnclosingBlockScopeContainer(node) { @@ -3258,15 +8148,15 @@ var ts; return current; } switch (current.kind) { - case 224: - case 204: - case 220: - case 202: - case 183: - case 184: - case 185: + case 227: + case 207: + case 223: + case 205: + case 186: + case 187: + case 188: return current; - case 176: + case 179: if (!isFunctionLike(current.parent)) { return current; } @@ -3276,10 +8166,7 @@ var ts; } ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { - return declaration && - declaration.kind === 195 && - declaration.parent && - declaration.parent.kind === 220; + return declaration && declaration.kind === 198 && declaration.parent && declaration.parent.kind === 223; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3316,14 +8203,21 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 195: - case 152: + case 227: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + if (pos_1 === sourceFile.text.length) { + return createTextSpan(0, 0); + } + return getSpanOfTokenAtPosition(sourceFile, pos_1); case 198: - case 199: - case 202: + case 152: case 201: - case 223: - case 197: + case 174: + case 202: + case 205: + case 204: + case 226: + case 200: case 162: errorNode = node.name; break; @@ -3331,9 +8225,7 @@ var ts; if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); } - var pos = nodeIsMissing(errorNode) - ? errorNode.pos - : ts.skipTrivia(sourceFile.text, errorNode.pos); + var pos = nodeIsMissing(errorNode) ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); return createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; @@ -3346,7 +8238,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 201 && isConst(node); + return node.kind === 204 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { @@ -3358,14 +8250,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 195) { + if (node.kind === 198) { node = node.parent; } - if (node && node.kind === 196) { + if (node && node.kind === 199) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 177) { + if (node && node.kind === 180) { flags |= node.flags; } return flags; @@ -3380,7 +8272,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 179 && node.expression.kind === 8; + return node.kind === 182 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -3395,9 +8287,7 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -3406,23 +8296,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188: + case 191: return visitor(node); - case 204: - case 176: - case 180: - case 181: - case 182: + case 207: + case 179: case 183: case 184: case 185: - case 189: - case 190: - case 217: - case 218: - case 191: + case 186: + case 187: + case 188: + case 192: case 193: case 220: + case 221: + case 194: + case 196: + case 223: return ts.forEachChild(node, traverse); } } @@ -3432,13 +8322,13 @@ var ts; if (node) { switch (node.kind) { case 152: - case 223: + case 226: case 129: - case 221: + case 224: case 132: case 131: - case 222: - case 195: + case 225: + case 198: return true; } } @@ -3450,7 +8340,7 @@ var ts; switch (node.kind) { case 135: case 162: - case 197: + case 200: case 163: case 134: case 133: @@ -3463,7 +8353,7 @@ var ts; case 143: case 162: case 163: - case 197: + case 200: return true; } } @@ -3471,7 +8361,7 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 176 && isFunctionLike(node.parent); + return node && node.kind === 179 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -3495,7 +8385,7 @@ var ts; } switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; @@ -3504,9 +8394,9 @@ var ts; if (!includeArrowFunctions) { continue; } - case 197: + case 200: case 162: - case 202: + case 205: case 132: case 131: case 134: @@ -3514,8 +8404,8 @@ var ts; case 135: case 136: case 137: - case 201: - case 224: + case 204: + case 227: return node; } } @@ -3528,12 +8418,12 @@ var ts; return node; switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; break; - case 197: + case 200: case 162: case 163: if (!includeFunctions) { @@ -3560,23 +8450,23 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 198: + case 201: return true; case 132: - return node.parent.kind === 198; + return node.parent.kind === 201; case 129: - return node.parent.body && node.parent.parent.kind === 198; + return node.parent.body && node.parent.parent.kind === 201; case 136: case 137: case 134: - return node.body && node.parent.kind === 198; + return node.body && node.parent.kind === 201; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 198: + case 201: if (node.decorators) { return true; } @@ -3604,7 +8494,7 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 198: + case 201: return ts.forEach(node.members, nodeOrChildIsDecorated); case 134: case 137: @@ -3635,6 +8525,7 @@ var ts; case 160: case 161: case 162: + case 174: case 163: case 166: case 164: @@ -3646,7 +8537,7 @@ var ts; case 173: case 171: case 10: - case 174: + case 175: return true; case 126: while (node.parent.kind === 126) { @@ -3659,45 +8550,42 @@ var ts; } case 7: case 8: - var _parent = node.parent; - switch (_parent.kind) { - case 195: + var parent_1 = node.parent; + switch (parent_1.kind) { + case 198: case 129: case 132: case 131: - case 223: - case 221: + case 226: + case 224: case 152: - return _parent.initializer === node; - case 179: - case 180: - case 181: + return parent_1.initializer === node; case 182: - case 188: - case 189: - case 190: - case 217: - case 192: - case 190: - return _parent.expression === node; case 183: - var forStatement = _parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 196) || - forStatement.condition === node || - forStatement.iterator === node; case 184: case 185: - var forInStatement = _parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 196) || - forInStatement.expression === node; + case 191: + case 192: + case 193: + case 220: + case 195: + case 193: + return parent_1.expression === node; + case 186: + var forStatement = parent_1; + return (forStatement.initializer === node && forStatement.initializer.kind !== 199) || forStatement.condition === node || forStatement.iterator === node; + case 187: + case 188: + var forInStatement = parent_1; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199) || forInStatement.expression === node; case 160: - return node === _parent.expression; - case 175: - return node === _parent.expression; + return node === parent_1.expression; + case 176: + return node === parent_1.expression; case 127: - return node === _parent.expression; + return node === parent_1.expression; default: - if (isExpression(_parent)) { + if (isExpression(parent_1)) { return true; } } @@ -3707,12 +8595,11 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || - (preserveConstEnums && moduleState === 2); + return moduleState === 1 || (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind === 216; + return node.kind === 208 && node.moduleReference.kind === 219; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -3721,20 +8608,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind !== 216; + return node.kind === 208 && node.moduleReference.kind !== 219; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 206) { + if (node.kind === 209) { return node.moduleSpecifier; } - if (node.kind === 205) { + if (node.kind === 208) { var reference = node.moduleReference; - if (reference.kind === 216) { + if (reference.kind === 219) { return reference.expression; } } - if (node.kind === 212) { + if (node.kind === 215) { return node.moduleSpecifier; } } @@ -3751,8 +8638,8 @@ var ts; case 134: case 133: return node.questionToken !== undefined; - case 222: - case 221: + case 225: + case 224: case 132: case 131: return node.questionToken !== undefined; @@ -3795,31 +8682,31 @@ var ts; switch (node.kind) { case 163: case 152: - case 198: - case 135: case 201: - case 223: - case 214: - case 197: + case 135: + case 204: + case 226: + case 217: + case 200: case 162: case 136: - case 207: - case 205: case 210: - case 199: + case 208: + case 213: + case 202: case 134: case 133: - case 202: - case 208: + case 205: + case 211: case 129: - case 221: + case 224: case 132: case 131: case 137: - case 222: - case 200: + case 225: + case 203: case 128: - case 195: + case 198: return true; } return false; @@ -3827,25 +8714,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 187: - case 186: - case 194: - case 181: - case 179: - case 178: - case 184: - case 185: - case 183: - case 180: - case 191: - case 188: case 190: - case 94: - case 193: - case 177: - case 182: case 189: - case 211: + case 197: + case 184: + case 182: + case 181: + case 187: + case 188: + case 186: + case 183: + case 194: + case 191: + case 193: + case 94: + case 196: + case 180: + case 185: + case 192: + case 214: return true; default: return false; @@ -3870,37 +8757,32 @@ var ts; if (name.kind !== 65 && name.kind !== 8 && name.kind !== 7) { return false; } - var _parent = name.parent; - if (_parent.kind === 210 || _parent.kind === 214) { - if (_parent.propertyName) { + var parent = name.parent; + if (parent.kind === 213 || parent.kind === 217) { + if (parent.propertyName) { return true; } } - if (isDeclaration(_parent)) { - return _parent.name === name; + if (isDeclaration(parent)) { + return parent.name === name; } return false; } ts.isDeclarationName = isDeclarationName; function isAliasSymbolDeclaration(node) { - return node.kind === 205 || - node.kind === 207 && !!node.name || - node.kind === 208 || - node.kind === 210 || - node.kind === 214 || - node.kind === 211 && node.expression.kind === 65; + return node.kind === 208 || node.kind === 210 && !!node.name || node.kind === 211 || node.kind === 213 || node.kind === 217 || node.kind === 214 && node.expression.kind === 65; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; - function getClassBaseTypeNode(node) { + function getClassExtendsHeritageClauseElement(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } - ts.getClassBaseTypeNode = getClassBaseTypeNode; - function getClassImplementedTypeNodes(node) { + ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; + function getClassImplementsHeritageClauseElements(node) { var heritageClause = getHeritageClause(node.heritageClauses, 103); return heritageClause ? heritageClause.types : undefined; } - ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause ? heritageClause.types : undefined; @@ -3908,7 +8790,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _n = clauses.length; _i < _n; _i++) { + for (var _i = 0; _i < clauses.length; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -3979,9 +8861,7 @@ var ts; } ts.isTrivia = isTrivia; function hasDynamicName(declaration) { - return declaration.name && - declaration.name.kind === 127 && - !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && declaration.name.kind === 127 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { @@ -4085,7 +8965,10 @@ var ts; if (length < 0) { throw new Error("length < 0"); } - return { start: start, length: length }; + return { + start: start, + length: length + }; } ts.createTextSpan = createTextSpan; function createTextSpanFromBounds(start, end) { @@ -4104,7 +8987,10 @@ var ts; if (newLength < 0) { throw new Error("newLength < 0"); } - return { span: span, newLength: newLength }; + return { + span: span, + newLength: newLength + }; } ts.createTextChangeRange = createTextChangeRange; ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); @@ -4135,7 +9021,7 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 202 || n.kind === 224; + return isFunctionLike(n) || n.kind === 205 || n.kind === 227; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -4245,12 +9131,15 @@ var ts; } var nonAsciiCharacters = /[^\u0000-\u007F]/g; function escapeNonAsciiCharacters(s) { - return nonAsciiCharacters.test(s) ? - s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : - s; + return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { + return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + }) : s; } ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; - var indentStrings = ["", " "]; + var indentStrings = [ + "", + " " + ]; function getIndentString(level) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; @@ -4312,13 +9201,27 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { return indent++; }, - decreaseIndent: function () { return indent--; }, - getIndent: function () { return indent; }, - getTextPos: function () { return output.length; }, - getLine: function () { return lineCount + 1; }, - getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, - getText: function () { return output; } + increaseIndent: function () { + return indent++; + }, + decreaseIndent: function () { + return indent--; + }, + getIndent: function () { + return indent; + }, + getTextPos: function () { + return output.length; + }, + getLine: function () { + return lineCount + 1; + }, + getColumn: function () { + return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; + }, + getText: function () { + return output; + } }; } ts.createTextWriter = createTextWriter; @@ -4387,8 +9290,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 136 || member.kind === 137) - && (member.flags & 128) === (accessor.flags & 128)) { + if ((member.kind === 136 || member.kind === 137) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -4417,8 +9319,7 @@ var ts; } ts.getAllAccessorDeclarations = getAllAccessorDeclarations; function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -4449,9 +9350,7 @@ var ts; var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount - ? currentSourceFile.text.length + 1 - : getStartPositionOfLine(currentLine + 1, currentSourceFile); + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); @@ -4505,10 +9404,35 @@ var ts; } } ts.writeCommentRange = writeCommentRange; + function isSupportedHeritageClauseElement(node) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; + function isSupportedHeritageClauseElementExpression(node) { + if (node.kind === 65) { + return true; + } + else if (node.kind === 155) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + else { + return false; + } + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 126 && node.parent.right === node) || (node.parent.kind === 155 && node.parent.name === node); + } + ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function getLocalSymbolForExportDefault(symbol) { + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256) ? symbol.valueDeclaration.localSymbol : undefined; + } + ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; })(ts || (ts = {})); +/// +/// var ts; (function (ts) { - var nodeConstructors = new Array(226); + var nodeConstructors = new Array(229); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -4530,7 +9454,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -4547,58 +9471,34 @@ var ts; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { case 126: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); case 128: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); case 129: case 132: case 131: - case 221: - case 222: - case 195: + case 224: + case 225: + case 198: case 152: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 142: case 143: case 138: case 139: case 140: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); case 134: case 133: case 135: case 136: case 137: case 162: - case 197: + case 200: case 163: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); case 141: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNodes, node.typeArguments); + return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); case 144: return visitNode(cbNode, node.exprName); case 145: @@ -4619,23 +9519,16 @@ var ts; case 154: return visitNodes(cbNodes, node.properties); case 155: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.dotToken) || - visitNode(cbNode, node.name); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); case 156: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.argumentExpression); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); case 157: case 158: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.typeArguments) || - visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); case 159: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.template); + return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); case 160: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); case 161: return visitNode(cbNode, node.expression); case 164: @@ -4647,221 +9540,195 @@ var ts; case 167: return visitNode(cbNode, node.operand); case 172: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); case 168: return visitNode(cbNode, node.operand); case 169: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); case 170: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); + return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); case 173: return visitNode(cbNode, node.expression); - case 176: - case 203: - return visitNodes(cbNodes, node.statements); - case 224: - return visitNodes(cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 177: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 196: - return visitNodes(cbNodes, node.declarations); case 179: - return visitNode(cbNode, node.expression); - case 180: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 181: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 182: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 183: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.iterator) || - visitNode(cbNode, node.statement); - case 184: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 185: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 186: - case 187: - return visitNode(cbNode, node.label); - case 188: - return visitNode(cbNode, node.expression); - case 189: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 190: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 204: - return visitNodes(cbNodes, node.clauses); - case 217: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); - case 218: + case 206: return visitNodes(cbNodes, node.statements); - case 191: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 192: + case 227: + return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); + case 180: + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); + case 199: + return visitNodes(cbNodes, node.declarations); + case 182: return visitNode(cbNode, node.expression); + case 183: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); + case 184: + return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); + case 185: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 186: + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); + case 187: + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 188: + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 189: + case 190: + return visitNode(cbNode, node.label); + case 191: + return visitNode(cbNode, node.expression); + case 192: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 193: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); + case 207: + return visitNodes(cbNodes, node.clauses); case 220: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); + case 221: + return visitNodes(cbNodes, node.statements); + case 194: + return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); + case 195: + return visitNode(cbNode, node.expression); + case 196: + return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); + case 223: + return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 130: return visitNode(cbNode, node.expression); - 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 199: - 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 200: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); case 201: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); - case 223: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + case 174: + 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 202: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); + 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 203: + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); + case 204: + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); + case 226: + return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 205: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 206: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier); - case 207: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 208: - return visitNode(cbNode, node.name); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 209: - case 213: - return visitNodes(cbNodes, node.elements); - case 212: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); case 210: - case 214: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); case 211: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); + return visitNode(cbNode, node.name); + case 212: + case 216: + return visitNodes(cbNodes, node.elements); + case 215: + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); + case 213: + case 217: + return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); + case 214: + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); case 171: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 175: + case 176: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 127: return visitNode(cbNode, node.expression); - case 219: + case 222: return visitNodes(cbNodes, node.types); - case 216: + case 177: + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); + case 219: return visitNode(cbNode, node.expression); - case 215: + case 218: return visitNodes(cbNodes, node.decorators); } } ts.forEachChild = forEachChild; function parsingContextErrors(context) { switch (context) { - case 0: return ts.Diagnostics.Declaration_or_statement_expected; - case 1: return ts.Diagnostics.Declaration_or_statement_expected; - case 2: return ts.Diagnostics.Statement_expected; - case 3: return ts.Diagnostics.case_or_default_expected; - case 4: return ts.Diagnostics.Statement_expected; - case 5: return ts.Diagnostics.Property_or_signature_expected; - case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; - case 9: return ts.Diagnostics.Variable_declaration_expected; - case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; - case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; - case 12: return ts.Diagnostics.Argument_expression_expected; - case 13: return ts.Diagnostics.Property_assignment_expected; - case 14: return ts.Diagnostics.Expression_or_comma_expected; - case 15: return ts.Diagnostics.Parameter_declaration_expected; - case 16: return ts.Diagnostics.Type_parameter_declaration_expected; - case 17: return ts.Diagnostics.Type_argument_expected; - case 18: return ts.Diagnostics.Type_expected; - case 19: return ts.Diagnostics.Unexpected_token_expected; - case 20: return ts.Diagnostics.Identifier_expected; + case 0: + return ts.Diagnostics.Declaration_or_statement_expected; + case 1: + return ts.Diagnostics.Declaration_or_statement_expected; + case 2: + return ts.Diagnostics.Statement_expected; + case 3: + return ts.Diagnostics.case_or_default_expected; + case 4: + return ts.Diagnostics.Statement_expected; + case 5: + return ts.Diagnostics.Property_or_signature_expected; + case 6: + return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: + return ts.Diagnostics.Enum_member_expected; + case 8: + return ts.Diagnostics.Expression_expected; + case 9: + return ts.Diagnostics.Variable_declaration_expected; + case 10: + return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: + return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: + return ts.Diagnostics.Argument_expression_expected; + case 13: + return ts.Diagnostics.Property_assignment_expected; + case 14: + return ts.Diagnostics.Expression_or_comma_expected; + case 15: + return ts.Diagnostics.Parameter_declaration_expected; + case 16: + return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: + return ts.Diagnostics.Type_argument_expected; + case 18: + return ts.Diagnostics.Type_expected; + case 19: + return ts.Diagnostics.Unexpected_token_expected; + case 20: + return ts.Diagnostics.Identifier_expected; } } ; function modifierToFlag(token) { switch (token) { - case 110: return 128; - case 109: return 16; - case 108: return 64; - case 107: return 32; - case 78: return 1; - case 115: return 2; - case 70: return 8192; - case 73: return 256; + case 110: + return 128; + case 109: + return 16; + case 108: + return 64; + case 107: + return 32; + case 78: + return 1; + case 115: + return 2; + case 70: + return 8192; + case 73: + return 256; } return 0; } ts.modifierToFlag = modifierToFlag; function fixupParentReferences(sourceFile) { - var _parent = sourceFile; + // normally parent references are set during binding. However, for clients that only need + // a syntax tree, and no semantic features, then the binding process is an unnecessary + // overhead. This functions allows us to set all the parents, without all the expense of + // binding. + var parent = sourceFile; forEachChild(sourceFile, visitNode); return; function visitNode(n) { - if (n.parent !== _parent) { - n.parent = _parent; - var saveParent = _parent; - _parent = n; + if (n.parent !== parent) { + n.parent = parent; + var saveParent = parent; + parent = n; forEachChild(n, visitNode); - _parent = saveParent; + parent = saveParent; } } } @@ -4899,7 +9766,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -4963,7 +9830,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5079,8 +9946,7 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 65 && - (node.text === "eval" || node.text === "arguments"); + return node.kind === 65 && (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -5163,7 +10029,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(224, 0); + var sourceFile = createNode(227, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -5284,8 +10150,8 @@ var ts; } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); - var _length = scanner.getTextPos() - start; - parseErrorAtPosition(start, _length, message, arg0); + var length = scanner.getTextPos() - start; + parseErrorAtPosition(start, length, message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { var lastError = ts.lastOrUndefined(sourceFile.parseDiagnostics); @@ -5324,9 +10190,7 @@ var ts; var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var saveContextFlags = contextFlags; - var result = isLookAhead - ? scanner.lookAhead(callback) - : scanner.tryScan(callback); + var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); ts.Debug.assert(saveContextFlags === contextFlags); if (!result || isLookAhead) { token = saveToken; @@ -5377,8 +10241,7 @@ var ts; return undefined; } function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { - return parseOptionalToken(t) || - createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); + return parseOptionalToken(t) || createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); } function parseTokenNode() { var node = createNode(token); @@ -5455,9 +10318,7 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || - token === 8 || - token === 7; + return isIdentifierOrKeyword() || token === 8 || token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -5510,10 +10371,7 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 - || token === 14 - || token === 35 - || isLiteralPropertyName(); + return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); @@ -5536,7 +10394,7 @@ var ts; case 5: return isStartOfTypeMember(); case 6: - return lookAhead(isClassMemberStart); + return lookAhead(isClassMemberStart) || (token === 22 && !inErrorRecovery); case 7: return token === 18 || isLiteralPropertyName(); case 13: @@ -5544,7 +10402,15 @@ var ts; case 10: return isLiteralPropertyName(); case 8: - return isIdentifier() && !isNotHeritageClauseTypeName(); + if (token === 14) { + return lookAhead(isValidHeritageClauseObjectLiteral); + } + if (!inErrorRecovery) { + return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + else { + return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); + } case 9: return isIdentifierOrPattern(); case 11: @@ -5566,17 +10432,28 @@ var ts; } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } + function isValidHeritageClauseObjectLiteral() { + ts.Debug.assert(token === 14); + if (nextToken() === 15) { + var next = nextToken(); + return next === 23 || next === 14 || next === 79 || next === 103; + } + return true; + } function nextTokenIsIdentifier() { nextToken(); return isIdentifier(); } - function isNotHeritageClauseTypeName() { - if (token === 103 || - token === 79) { - return lookAhead(nextTokenIsIdentifier); + function isHeritageClauseExtendsOrImplementsKeyword() { + if (token === 103 || token === 79) { + return lookAhead(nextTokenIsStartOfExpression); } return false; } + function nextTokenIsStartOfExpression() { + nextToken(); + return isStartOfExpression(); + } function isListTerminator(kind) { if (token === 1) { return true; @@ -5726,26 +10603,26 @@ var ts; case 15: return isReusableParameter(node); case 19: - case 8: case 16: case 18: case 17: case 12: case 13: + case 8: } return false; } function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 206: - case 205: - case 212: - case 211: - case 198: - case 199: - case 202: + case 209: + case 208: + case 215: + case 214: case 201: + case 202: + case 205: + case 204: return true; } return isReusableStatement(node); @@ -5761,6 +10638,7 @@ var ts; case 136: case 137: case 132: + case 178: return true; } } @@ -5769,8 +10647,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 217: - case 218: + case 220: + case 221: return true; } } @@ -5779,33 +10657,33 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 197: - case 177: - case 176: + case 200: case 180: case 179: - case 192: - case 188: - case 190: - case 187: - case 186: - case 184: - case 185: case 183: case 182: - case 189: - case 178: - case 193: + case 195: case 191: + case 193: + case 190: + case 189: + case 187: + case 188: + case 186: + case 185: + case 192: case 181: + case 196: case 194: + case 184: + case 197: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 223; + return node.kind === 226; } function isReusableTypeMember(node) { if (node) { @@ -5821,7 +10699,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 195) { + if (node.kind !== 198) { return false; } var variableDeclarator = node; @@ -5927,7 +10805,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(175); + var span = createNode(176); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -5953,9 +10831,7 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 - && sourceText.charCodeAt(tokenPos) === 48 - && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 16384; } return node; @@ -5994,9 +10870,7 @@ var ts; } function parseParameterType() { if (parseOptional(51)) { - return token === 8 - ? parseLiteralNode(true) - : parseType(); + return token === 8 ? parseLiteralNode(true) : parseType(); } return undefined; } @@ -6112,11 +10986,11 @@ var ts; } function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); - var _name = parsePropertyName(); + var name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (token === 16 || token === 24) { var method = createNode(133, fullStart); - method.name = _name; + method.name = name; method.questionToken = questionToken; fillSignature(51, false, false, method); parseTypeMemberSemicolon(); @@ -6124,7 +10998,7 @@ var ts; } else { var property = createNode(131, fullStart); - property.name = _name; + property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); @@ -6155,11 +11029,7 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || - token === 24 || - token === 50 || - token === 51 || - canParseSemicolon(); + return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); } function parseTypeMember() { switch (token) { @@ -6167,9 +11037,7 @@ var ts; case 24: return parseSignatureMember(138); case 18: - return isIndexSignature() - ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) - : parsePropertyOrMethodSignature(); + return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) : parsePropertyOrMethodSignature(); case 88: if (lookAhead(isStartOfConstructSignature)) { return parseSignatureMember(139); @@ -6193,9 +11061,7 @@ var ts; var fullStart = scanner.getStartPos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); - return isIndexSignature() - ? parseIndexSignatureDeclaration(fullStart, decorators, modifiers) - : undefined; + return isIndexSignature() ? parseIndexSignatureDeclaration(fullStart, decorators, modifiers) : undefined; } function isStartOfConstructSignature() { nextToken(); @@ -6301,7 +11167,9 @@ var ts; function parseUnionTypeOrHigher() { var type = parseArrayTypeOrHigher(); if (token === 44) { - var types = [type]; + var types = [ + type + ]; types.pos = type.pos; while (parseOptional(44)) { types.push(parseArrayTypeOrHigher()); @@ -6326,9 +11194,7 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || - token === 50 || token === 53 || - isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || token === 50 || token === 53 || isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -6362,7 +11228,7 @@ var ts; function parseTypeAnnotation() { return parseOptional(51) ? parseType() : undefined; } - function isStartOfExpression() { + function isStartOfLeftHandSideExpression() { switch (token) { case 93: case 91: @@ -6377,9 +11243,21 @@ var ts; case 18: case 14: case 83: + case 69: case 88: case 36: case 57: + case 65: + return true; + default: + return isIdentifier(); + } + } + function isStartOfExpression() { + if (isStartOfLeftHandSideExpression()) { + return true; + } + switch (token) { case 33: case 34: case 47: @@ -6390,7 +11268,6 @@ var ts; case 38: case 39: case 24: - case 65: case 111: return true; default: @@ -6401,9 +11278,12 @@ var ts; } } function isStartOfExpressionStatement() { - return token !== 14 && token !== 83 && token !== 52 && isStartOfExpression(); + return token !== 14 && token !== 83 && token !== 69 && token !== 52 && isStartOfExpression(); } function parseExpression() { + // Expression[in]: + // AssignmentExpression[in] + // Expression[in] , AssignmentExpression[in] var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { setDecoratorContext(false); @@ -6428,6 +11308,15 @@ var ts; return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { + // AssignmentExpression[in,yield]: + // 1) ConditionalExpression[?in,?yield] + // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield] + // 3) LeftHandSideExpression AssignmentOperator AssignmentExpression[?in,?yield] + // 4) ArrowFunctionExpression[?in,?yield] + // 5) [+Yield] YieldExpression[?In] + // + // Note: for ease of implementation we treat productions '2' and '3' as the same thing. + // (i.e. they're both BinaryExpressions with an assignment operator in it). if (isYieldExpression()) { return parseYieldExpression(); } @@ -6462,14 +11351,12 @@ var ts; } function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { nextToken(); - return !scanner.hasPrecedingLineBreak() && - (isIdentifier() || token === 14 || token === 18); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 14 || token === 18); } function parseYieldExpression() { var node = createNode(172); nextToken(); - if (!scanner.hasPrecedingLineBreak() && - (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -6484,7 +11371,9 @@ var ts; var parameter = createNode(129, identifier.pos); parameter.name = identifier; finishNode(parameter); - node.parameters = [parameter]; + node.parameters = [ + parameter + ]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; node.equalsGreaterThanToken = parseExpectedToken(32, false, ts.Diagnostics._0_expected, "=>"); @@ -6496,17 +11385,13 @@ var ts; if (triState === 0) { return undefined; } - var arrowFunction = triState === 1 - ? parseParenthesizedArrowFunctionExpressionHead(true) - : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { return undefined; } var lastToken = token; arrowFunction.equalsGreaterThanToken = parseExpectedToken(32, false, ts.Diagnostics._0_expected, "=>"); - arrowFunction.body = (lastToken === 32 || lastToken === 14) - ? parseArrowFunctionExpressionBody() - : parseIdentifier(); + arrowFunction.body = (lastToken === 32 || lastToken === 14) ? parseArrowFunctionExpressionBody() : parseIdentifier(); return finishNode(arrowFunction); } function isParenthesizedArrowFunctionExpression() { @@ -6570,7 +11455,7 @@ var ts; if (token === 14) { return parseFunctionBlock(false, false); } - if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 83) { + if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 83 && token !== 69) { return parseFunctionBlock(false, true); } return parseAssignmentExpressionOrHigher(); @@ -6719,9 +11604,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 91 - ? parseSuperExpression() - : parseMemberExpressionOrHigher(); + var expression = token === 91 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); } function parseMemberExpressionOrHigher() { @@ -6775,9 +11658,7 @@ var ts; if (token === 10 || token === 11) { var tagExpression = createNode(159, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 - ? parseLiteralNode() - : parseTemplateExpression(); + tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); continue; } @@ -6800,10 +11681,10 @@ var ts; continue; } else if (token === 16) { - var _callExpr = createNode(157, expression.pos); - _callExpr.expression = expression; - _callExpr.arguments = parseArgumentList(); - expression = finishNode(_callExpr); + var callExpr = createNode(157, expression.pos); + callExpr.expression = expression; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); continue; } return expression; @@ -6823,9 +11704,7 @@ var ts; if (!parseExpected(25)) { return undefined; } - return typeArguments && canFollowTypeArgumentsInExpression() - ? typeArguments - : undefined; + return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; } function canFollowTypeArgumentsInExpression() { switch (token) { @@ -6835,7 +11714,6 @@ var ts; case 19: case 51: case 22: - case 23: case 50: case 28: case 30: @@ -6849,6 +11727,8 @@ var ts; case 15: case 1: return true; + case 23: + case 14: default: return false; } @@ -6871,6 +11751,8 @@ var ts; return parseArrayLiteralExpression(); case 14: return parseObjectLiteralExpression(); + case 69: + return parseClassExpression(); case 83: return parseFunctionExpression(); case 88: @@ -6900,9 +11782,7 @@ var ts; return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(174) : - parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(175) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); @@ -6942,13 +11822,13 @@ var ts; return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(222, fullStart); + var shorthandDeclaration = createNode(225, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(221, fullStart); + var propertyAssignment = createNode(224, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6996,7 +11876,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(176); + var node = createNode(179); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -7021,12 +11901,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(178); + var node = createNode(181); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(180); + var node = createNode(183); parseExpected(84); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7036,7 +11916,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(181); + var node = createNode(184); parseExpected(75); node.statement = parseStatement(); parseExpected(100); @@ -7047,7 +11927,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(182); + var node = createNode(185); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7070,21 +11950,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86)) { - var forInStatement = createNode(184, pos); + var forInStatement = createNode(187, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(125)) { - var forOfStatement = createNode(185, pos); + var forOfStatement = createNode(188, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(183, pos); + var forStatement = createNode(186, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -7102,7 +11982,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 187 ? 66 : 71); + parseExpected(kind === 190 ? 66 : 71); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -7110,7 +11990,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(188); + var node = createNode(191); parseExpected(90); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -7119,7 +11999,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(189); + var node = createNode(192); parseExpected(101); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7128,7 +12008,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(217); + var node = createNode(220); parseExpected(67); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -7136,7 +12016,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(218); + var node = createNode(221); parseExpected(73); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -7146,12 +12026,12 @@ var ts; return token === 67 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(190); + var node = createNode(193); parseExpected(92); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); - var caseBlock = createNode(204, scanner.getStartPos()); + var caseBlock = createNode(207, scanner.getStartPos()); parseExpected(14); caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); @@ -7159,14 +12039,16 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(192); + // ThrowStatement[Yield] : + // throw [no LineTerminator here]Expression[In, ?Yield]; + var node = createNode(195); parseExpected(94); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(193); + var node = createNode(196); parseExpected(96); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 ? parseCatchClause() : undefined; @@ -7177,7 +12059,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(220); + var result = createNode(223); parseExpected(68); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7187,7 +12069,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(194); + var node = createNode(197); parseExpected(72); parseSemicolon(); return finishNode(node); @@ -7196,13 +12078,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 && parseOptional(51)) { - var labeledStatement = createNode(191, fullStart); + var labeledStatement = createNode(194, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(179, fullStart); + var expressionStatement = createNode(182, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -7210,7 +12092,7 @@ var ts; } function isStartOfStatement(inErrorRecovery) { if (ts.isModifier(token)) { - var result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return true; } @@ -7222,6 +12104,7 @@ var ts; case 98: case 105: case 83: + case 69: case 84: case 75: case 100: @@ -7241,7 +12124,6 @@ var ts; var isConstEnum = lookAhead(nextTokenIsEnumKeyword); return !isConstEnum; case 104: - case 69: case 117: case 77: case 123: @@ -7276,6 +12158,8 @@ var ts; return parseVariableStatement(scanner.getStartPos(), undefined, undefined); case 83: return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 69: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); case 22: return parseEmptyStatement(); case 84: @@ -7287,9 +12171,9 @@ var ts; case 82: return parseForOrForInOrForOfStatement(); case 71: - return parseBreakOrContinueStatement(186); + return parseBreakOrContinueStatement(189); case 66: - return parseBreakOrContinueStatement(187); + return parseBreakOrContinueStatement(190); case 90: return parseReturnStatement(); case 101: @@ -7310,7 +12194,7 @@ var ts; } default: if (ts.isModifier(token) || token === 52) { - var result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return result; } @@ -7318,7 +12202,7 @@ var ts; return parseExpressionOrLabeledStatement(); } } - function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers() { + function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers() { var start = scanner.getStartPos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -7338,6 +12222,8 @@ var ts; return parseVariableStatement(start, decorators, modifiers); case 83: return parseFunctionDeclaration(start, decorators, modifiers); + case 69: + return parseClassDeclaration(start, decorators, modifiers); } return undefined; } @@ -7350,7 +12236,7 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(174); + return createNode(175); } var node = createNode(152); node.dotDotDotToken = parseOptionalToken(21); @@ -7399,7 +12285,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(195); + var node = createNode(198); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -7408,7 +12294,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(196); + var node = createNode(199); switch (token) { case 98: break; @@ -7437,7 +12323,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(177, fullStart); + var node = createNode(180, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -7445,7 +12331,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(200, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83); @@ -7488,13 +12374,13 @@ var ts; } function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) { var asteriskToken = parseOptionalToken(35); - var _name = parsePropertyName(); + var name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (asteriskToken || token === 16 || token === 24) { - return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, _name, questionToken, ts.Diagnostics.or_expected); + return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } else { - return parsePropertyDeclaration(fullStart, decorators, modifiers, _name, questionToken); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken); } } function parseNonParameterInitializer() { @@ -7588,6 +12474,11 @@ var ts; return modifiers; } function parseClassElement() { + if (token === 22) { + var result = createNode(178); + nextToken(); + return finishNode(result); + } var fullStart = getNodePos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -7601,25 +12492,27 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(fullStart, decorators, modifiers); } - if (isIdentifierOrKeyword() || - token === 8 || - token === 7 || - token === 35 || - token === 18) { + if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators) { - var _name = createMissingNode(65, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, _name, undefined); + var name_3 = createMissingNode(65, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_3, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } + function parseClassExpression() { + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 174); + } function parseClassDeclaration(fullStart, decorators, modifiers) { + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201); + } + function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var savedStrictModeContext = inStrictModeContext(); if (languageVersion >= 2) { setStrictModeContext(true); } - var node = createNode(198, fullStart); + var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(69); @@ -7627,9 +12520,7 @@ var ts; node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(14)) { - node.members = inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseClassMembers) - : parseClassMembers(); + node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); parseExpected(15); } else { @@ -7640,10 +12531,11 @@ var ts; return finishedNode; } function parseHeritageClauses(isClassHeritageClause) { + // ClassTail[Yield,GeneratorParameter] : See 14.5 + // [~GeneratorParameter]ClassHeritage[?Yield]opt { ClassBody[?Yield]opt } + // [+GeneratorParameter] ClassHeritageopt { ClassBodyopt } if (isHeritageClause()) { - return isClassHeritageClause && inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseHeritageClausesWorker) - : parseHeritageClausesWorker(); + return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); } return undefined; } @@ -7652,14 +12544,22 @@ var ts; } function parseHeritageClause() { if (token === 79 || token === 103) { - var node = createNode(219); + var node = createNode(222); node.token = token; nextToken(); - node.types = parseDelimitedList(8, parseTypeReference); + node.types = parseDelimitedList(8, parseHeritageClauseElement); return finishNode(node); } return undefined; } + function parseHeritageClauseElement() { + var node = createNode(177); + node.expression = parseLeftHandSideExpressionOrHigher(); + if (token === 24) { + node.typeArguments = parseBracketedList(17, parseType, 24, 25); + } + return finishNode(node); + } function isHeritageClause() { return token === 79 || token === 103; } @@ -7667,7 +12567,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(199, fullStart); + var node = createNode(202, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(104); @@ -7678,7 +12578,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200, fullStart); + var node = createNode(203, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(123); @@ -7689,13 +12589,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(223, scanner.getStartPos()); + var node = createNode(226, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(201, fullStart); + var node = createNode(204, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77); @@ -7710,7 +12610,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(203, scanner.getStartPos()); + var node = createNode(206, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -7721,18 +12621,16 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) - ? parseInternalModuleTail(getNodePos(), undefined, undefined, 1) - : parseModuleBlock(); + node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, undefined, 1) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -7741,21 +12639,17 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { parseExpected(117); - return token === 8 - ? parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) - : parseInternalModuleTail(fullStart, decorators, modifiers, modifiers ? modifiers.flags : 0); + return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) : parseInternalModuleTail(fullStart, decorators, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 118 && - lookAhead(nextTokenIsOpenParen); + return token === 118 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || - token === 124; + return token === 23 || token === 124; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(85); @@ -7764,7 +12658,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 124) { - var importEqualsDeclaration = createNode(205, fullStart); + var importEqualsDeclaration = createNode(208, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -7774,12 +12668,10 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(206, fullStart); + var importDeclaration = createNode(209, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); - if (identifier || - token === 35 || - token === 14) { + if (identifier || token === 35 || token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); parseExpected(124); } @@ -7788,23 +12680,26 @@ var ts; return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(207, fullStart); + //ImportClause: + // ImportedDefaultBinding + // NameSpaceImport + // NamedImports + // ImportedDefaultBinding, NameSpaceImport + // ImportedDefaultBinding, NamedImports + var importClause = createNode(210, fullStart); if (identifier) { importClause.name = identifier; } - if (!importClause.name || - parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(209); + if (!importClause.name || parseOptional(23)) { + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(212); } return finishNode(importClause); } function parseModuleReference() { - return isExternalModuleReference() - ? parseExternalModuleReference() - : parseEntityName(false); + return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(216); + var node = createNode(219); parseExpected(118); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -7819,7 +12714,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(208); + var namespaceImport = createNode(211); parseExpected(35); parseExpected(102); namespaceImport.name = parseIdentifier(); @@ -7827,14 +12722,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 209 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 212 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(214); + return parseImportOrExportSpecifier(217); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(210); + return parseImportOrExportSpecifier(213); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -7853,13 +12748,13 @@ var ts; else { node.name = identifierName; } - if (kind === 210 && checkIdentifierIsKeyword) { + if (kind === 213 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35)) { @@ -7867,7 +12762,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(213); + node.exportClause = parseNamedImportsOrExports(216); if (parseOptional(124)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -7876,7 +12771,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(211, fullStart); + var node = createNode(214, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53)) { @@ -7940,13 +12835,11 @@ var ts; } function nextTokenCanFollowImportKeyword() { nextToken(); - return isIdentifierOrKeyword() || token === 8 || - token === 35 || token === 14; + return isIdentifierOrKeyword() || token === 8 || token === 35 || token === 14; } function nextTokenCanFollowExportKeyword() { nextToken(); - return token === 53 || token === 35 || - token === 14 || token === 73 || isDeclarationStart(true); + return token === 53 || token === 35 || token === 14 || token === 73 || isDeclarationStart(true); } function nextTokenIsDeclarationStart() { nextToken(); @@ -7989,7 +12882,7 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); default: if (decorators) { - var node = createMissingNode(215, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(218, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8008,9 +12901,7 @@ var ts; return parseSourceElementOrModuleElement(); } function parseSourceElementOrModuleElement() { - return isDeclarationStart() - ? parseDeclaration() - : parseStatement(); + return isDeclarationStart() ? parseDeclaration() : parseStatement(); } function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); @@ -8025,7 +12916,10 @@ var ts; if (kind !== 2) { break; } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; + var range = { + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos() + }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -8056,7 +12950,10 @@ var ts; var pathMatchResult = pathRegex.exec(comment); var nameMatchResult = nameRegex.exec(comment); if (pathMatchResult) { - var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined }; + var amdDependency = { + path: pathMatchResult[2], + name: nameMatchResult ? nameMatchResult[2] : undefined + }; amdDependencies.push(amdDependency); } } @@ -8068,13 +12965,7 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 - || node.kind === 205 && node.moduleReference.kind === 216 - || node.kind === 206 - || node.kind === 211 - || node.kind === 212 - ? node - : undefined; + return node.flags & 1 || node.kind === 208 && node.moduleReference.kind === 219 || node.kind === 209 || node.kind === 214 || node.kind === 215 ? node : undefined; }); } } @@ -8089,6 +12980,7 @@ var ts; case 153: case 161: case 154: + case 174: case 162: case 65: case 9: @@ -8112,6 +13004,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; })(ts || (ts = {})); +/// var ts; (function (ts) { var nextSymbolId = 1; @@ -8144,12 +13037,24 @@ var ts; var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { - getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, - getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, - getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, - getTypeCount: function () { return typeCount; }, - isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, - isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + getNodeCount: function () { + return ts.sum(host.getSourceFiles(), "nodeCount"); + }, + getIdentifierCount: function () { + return ts.sum(host.getSourceFiles(), "identifierCount"); + }, + getSymbolCount: function () { + return ts.sum(host.getSourceFiles(), "symbolCount"); + }, + getTypeCount: function () { + return typeCount; + }, + isUndefinedSymbol: function (symbol) { + return symbol === undefinedSymbol; + }, + isArgumentsSymbol: function (symbol) { + return symbol === argumentsSymbol; + }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, @@ -8248,9 +13153,7 @@ var ts; return emitResolver; } function error(location, message, arg0, arg1, arg2) { - var diagnostic = location - ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) - : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); diagnostics.add(diagnostic); } function createSymbol(flags, name) { @@ -8336,8 +13239,7 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { error(node.name ? node.name : node, message, symbolToString(source)); }); @@ -8382,10 +13284,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 224); + return ts.getAncestor(node, 227); } function isGlobalSourceFile(node) { - return node.kind === 224 && !ts.isExternalModule(node); + return node.kind === 227 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -8427,25 +13329,33 @@ var ts; } } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 214)) { + if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 217)) { + break loop; + } + result = undefined; + } + else if (location.kind === 227) { + result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { break loop; } result = undefined; } break; - case 201: + case 204: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; case 132: case 131: - if (location.parent.kind === 198 && !(location.flags & 128)) { + if (location.parent.kind === 201 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -8454,8 +13364,8 @@ var ts; } } break; - case 198: - case 199: + case 201: + case 202: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -8466,7 +13376,7 @@ var ts; break; case 127: grandparent = location.parent.parent; - if (grandparent.kind === 198 || grandparent.kind === 199) { + if (grandparent.kind === 201 || grandparent.kind === 202) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -8478,7 +13388,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 163: if (name === "arguments") { result = argumentsSymbol; @@ -8490,8 +13400,15 @@ var ts; result = argumentsSymbol; break loop; } - var id = location.name; - if (id && name === id.text) { + var functionName = location.name; + if (functionName && name === functionName.text) { + result = location.symbol; + break loop; + } + break; + case 174: + var className = location.name; + if (className && name === className.text) { result = location.symbol; break loop; } @@ -8531,18 +13448,18 @@ var ts; } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2) !== 0); - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); + var declaration = ts.forEach(result.declarations, function (d) { + return ts.isBlockOrCatchScoped(d) ? d : undefined; + }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 195); + var variableDeclaration = ts.getAncestor(declaration, 198); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 177 || - variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 180 || variableDeclaration.parent.parent.kind === 186) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 185 || - variableDeclaration.parent.parent.kind === 184) { + else if (variableDeclaration.parent.parent.kind === 188 || variableDeclaration.parent.parent.kind === 187) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -8564,20 +13481,22 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } - while (node && node.kind !== 206) { + while (node && node.kind !== 209) { node = node.parent; } return node; } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.forEach(symbol.declarations, function (d) { + return ts.isAliasSymbolDeclaration(d) ? d : undefined; + }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 216) { + if (node.moduleReference.kind === 219) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -8600,7 +13519,7 @@ var ts; if (moduleSymbol.flags & 3) { var typeAnnotation = moduleSymbol.valueDeclaration.type; if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); + return getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name); } } } @@ -8631,7 +13550,7 @@ var ts; if (symbol.flags & 3) { var typeAnnotation = symbol.valueDeclaration.type; if (typeAnnotation) { - return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); + return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name)); } } } @@ -8639,15 +13558,13 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var _name = specifier.propertyName || specifier.name; - if (_name.text) { - var symbolFromModule = getExportOfModule(targetSymbol, _name.text); - var symbolFromVariable = getPropertyOfVariable(targetSymbol, _name.text); - var symbol = symbolFromModule && symbolFromVariable ? - combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : - symbolFromModule || symbolFromVariable; + var name_4 = specifier.propertyName || specifier.name; + if (name_4.text) { + var symbolFromModule = getExportOfModule(targetSymbol, name_4.text); + var symbolFromVariable = getPropertyOfVariable(targetSymbol, name_4.text); + var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(_name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(_name)); + error(name_4, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_4)); } return symbol; } @@ -8657,26 +13574,24 @@ var ts; return getExternalModuleMember(node.parent.parent.parent, node); } function getTargetOfExportSpecifier(node) { - return node.parent.parent.moduleSpecifier ? - getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); + return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); } function getTargetOfExportAssignment(node) { return node.expression && resolveEntityName(node.expression, 107455 | 793056 | 1536); } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 205: - return getTargetOfImportEqualsDeclaration(node); - case 207: - return getTargetOfImportClause(node); case 208: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node); case 210: - return getTargetOfImportSpecifier(node); - case 214: - return getTargetOfExportSpecifier(node); + return getTargetOfImportClause(node); case 211: + return getTargetOfNamespaceImport(node); + case 213: + return getTargetOfImportSpecifier(node); + case 217: + return getTargetOfExportSpecifier(node); + case 214: return getTargetOfExportAssignment(node); } } @@ -8705,8 +13620,11 @@ var ts; function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); - if (target && target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target)) { - markAliasSymbolAsReferenced(symbol); + if (target) { + var markAlias = (target === unknownSymbol && compilerOptions.separateCompilation) || (target !== unknownSymbol && (target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); + if (markAlias) { + markAliasSymbolAsReferenced(symbol); + } } } function markAliasSymbolAsReferenced(symbol) { @@ -8714,10 +13632,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 211 && node.expression) { + if (node.kind === 214 && node.expression) { checkExpressionCached(node.expression); } - else if (node.kind === 214) { + else if (node.kind === 217) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -8727,17 +13645,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 205); + importDeclaration = ts.getAncestor(entityName, 208); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 65 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 65 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (entityName.kind === 65 || entityName.parent.kind === 126) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 205); + ts.Debug.assert(entityName.parent.kind === 208); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -8745,7 +13663,7 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(name, meaning) { - if (ts.getFullWidth(name) === 0) { + if (ts.nodeIsMissing(name)) { return undefined; } var symbol; @@ -8755,18 +13673,22 @@ var ts; return undefined; } } - else if (name.kind === 126) { - var namespace = resolveEntityName(name.left, 1536); - if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) { + else if (name.kind === 126 || name.kind === 155) { + var left = name.kind === 126 ? name.left : name.expression; + var right = name.kind === 126 ? name.right : name.name; + var namespace = resolveEntityName(left, 1536); + if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; } - var right = name.right; symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; } } + else { + ts.Debug.fail("Unknown entity name kind."); + } ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } @@ -8855,7 +13777,7 @@ var ts; } var exportStars = symbol.exports["__export"]; if (exportStars) { - for (var _i = 0, _a = exportStars.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; visit(resolveExternalModuleName(node, node.moduleSpecifier)); } @@ -8874,9 +13796,7 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 1048576) !== 0 - ? getMergedSymbol(symbol.exportSymbol) - : symbol; + return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; } function symbolIsValue(symbol) { if (symbol.flags & 16777216) { @@ -8892,7 +13812,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _n = members.length; _i < _n; _i++) { + for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; if (member.kind === 135 && ts.nodeIsPresent(member.body)) { return member; @@ -8915,10 +13835,7 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && - name.charCodeAt(1) === 95 && - name.charCodeAt(2) !== 95 && - name.charCodeAt(2) !== 64; + return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -8952,25 +13869,25 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var _location = enclosingDeclaration; _location; _location = _location.parent) { - if (_location.locals && !isGlobalSourceFile(_location)) { - if (result = callback(_location.locals)) { + 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)) { return result; } } - switch (_location.kind) { - case 224: - if (!ts.isExternalModule(_location)) { + switch (location_1.kind) { + case 227: + if (!ts.isExternalModule(location_1)) { break; } - case 202: - if (result = callback(getSymbolOfNode(_location).exports)) { + case 205: + if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 198: - case 199: - if (result = callback(getSymbolOfNode(_location).members)) { + case 201: + case 202: + if (result = callback(getSymbolOfNode(location_1).members)) { return result; } break; @@ -8992,24 +13909,28 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && - canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { - return [symbol]; + return [ + symbol + ]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=") { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; + return [ + symbolFromSymbolTable + ]; } var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + return [ + symbolFromSymbolTable + ].concat(accessibleSymbolsFromExports); } } } @@ -9074,7 +13995,9 @@ var ts; errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) }; } - return { accessibility: 0 }; + return { + accessibility: 0 + }; function getExternalModuleContainer(declaration) { for (; declaration; declaration = declaration.parent) { if (hasExternalModuleSymbol(declaration)) { @@ -9084,21 +14007,23 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 202 && declaration.name.kind === 8) || - (declaration.kind === 224 && ts.isExternalModule(declaration)); + return (declaration.kind === 205 && declaration.name.kind === 8) || (declaration.kind === 227 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; - if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { + if (ts.forEach(symbol.declarations, function (declaration) { + return !getIsDeclarationVisible(declaration); + })) { return undefined; } - return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; + return { + accessibility: 0, + aliasesToMakeVisible: aliasesToMakeVisible + }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { var anyImportSyntax = getAnyImportSyntax(declaration); - if (anyImportSyntax && - !(anyImportSyntax.flags & 1) && - isDeclarationVisible(anyImportSyntax.parent)) { + if (anyImportSyntax && !(anyImportSyntax.flags & 1) && isDeclarationVisible(anyImportSyntax.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) { @@ -9106,7 +14031,9 @@ var ts; } } else { - aliasesToMakeVisible = [anyImportSyntax]; + aliasesToMakeVisible = [ + anyImportSyntax + ]; } return true; } @@ -9120,8 +14047,7 @@ var ts; if (entityName.parent.kind === 144) { meaning = 107455 | 1048576; } - else if (entityName.kind === 126 || - entityName.parent.kind === 205) { + else if (entityName.kind === 126 || entityName.kind === 155 || entityName.parent.kind === 208) { meaning = 1536; } else { @@ -9168,7 +14094,7 @@ var ts; while (node.kind === 149) { node = node.parent; } - if (node.kind === 200) { + if (node.kind === 203) { return getSymbolOfNode(node); } } @@ -9207,12 +14133,11 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || - needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -9241,8 +14166,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 1048703) { - writer.writeKeyword(!(globalFlags & 16) && - (type.flags & 1) ? "any" : type.intrinsicName); + writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -9335,16 +14259,14 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && - ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && - (type.symbol.parent || - ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 224 || declaration.parent.kind === 203; - })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.flags & 128; + })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 227 || declaration.parent.kind === 206; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || - (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); } } } @@ -9396,17 +14318,17 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { - var _signature = _c[_b]; + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { + var signature = _c[_b]; writeKeyword(writer, 88); writeSpace(writer); - buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -9436,18 +14358,18 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { - var p = _f[_e]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _h = 0, _j = signatures.length; _h < _j; _h++) { - var _signature_1 = signatures[_h]; + for (var _f = 0; _f < signatures.length; _f++) { + var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); } - buildSignatureDisplay(_signature_1, writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -9572,12 +14494,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 202) { + if (node.kind === 205) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 224) { + else if (node.kind === 227) { return ts.isExternalModule(node) ? node : undefined; } } @@ -9622,24 +14544,22 @@ var ts; switch (node.kind) { case 152: return isDeclarationVisible(node.parent.parent); - case 195: - if (ts.isBindingPattern(node.name) && - !node.name.elements.length) { + case 198: + if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 202: - case 198: - case 199: - case 200: - case 197: - case 201: case 205: - var _parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 205 && _parent.kind !== 224 && ts.isInAmbientContext(_parent))) { - return isGlobalSourceFile(_parent); + case 201: + case 202: + case 203: + case 200: + case 204: + case 208: + var parent_2 = getDeclarationContainer(node); + if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 208 && parent_2.kind !== 227 && ts.isInAmbientContext(parent_2))) { + return isGlobalSourceFile(parent_2); } - return isDeclarationVisible(_parent); + return isDeclarationVisible(parent_2); case 132: case 131: case 136: @@ -9654,7 +14574,7 @@ var ts; case 138: case 140: case 129: - case 203: + case 206: case 142: case 143: case 145: @@ -9664,13 +14584,15 @@ var ts; case 148: case 149: return isDeclarationVisible(node.parent); - case 207: - case 208: case 210: + case 211: + case 213: return false; case 128: - case 224: + case 227: return true; + case 214: + return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } @@ -9685,10 +14607,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 211) { + if (node.parent && node.parent.kind === 214) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 217) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -9720,11 +14642,13 @@ var ts; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 195 ? node.parent.parent.parent : node.parent; + return node.kind === 198 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); - return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { + return anyType; + })) : classType; } function getTypeOfPropertyOfType(type, name) { var prop = getPropertyOfType(type, name); @@ -9744,12 +14668,10 @@ var ts; } var type; if (pattern.kind === 150) { - var _name = declaration.propertyName || declaration.name; - type = getTypeOfPropertyOfType(parentType, _name.text) || - isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || - getIndexTypeOfType(parentType, 0); + var name_5 = declaration.propertyName || declaration.name; + type = getTypeOfPropertyOfType(parentType, name_5.text) || isNumericLiteralName(name_5.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(_name)); + error(name_5, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_5)); return unknownType; } } @@ -9778,17 +14700,17 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 184) { + if (declaration.parent.parent.kind === 187) { return anyType; } - if (declaration.parent.parent.kind === 185) { + if (declaration.parent.parent.kind === 188) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var func = declaration.parent; @@ -9806,7 +14728,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 222) { + if (declaration.kind === 225) { return checkIdentifier(declaration.name); } return undefined; @@ -9824,8 +14746,8 @@ var ts; var members = {}; ts.forEach(pattern.elements, function (e) { var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); - var _name = e.propertyName || e.name; - var symbol = createSymbol(flags, _name.text); + var name = e.propertyName || e.name; + var symbol = createSymbol(flags, name.text); symbol.type = getTypeFromBindingElement(e); members[symbol.name] = symbol; }); @@ -9835,7 +14757,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 174 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 175 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -9843,9 +14765,7 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 150 - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 150 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -9853,7 +14773,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 221 ? getWidenedType(type) : type; + return declaration.kind !== 224 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -9874,16 +14794,16 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 220) { + if (declaration.parent.kind === 223) { return links.type = anyType; } - if (declaration.kind === 211) { + if (declaration.kind === 214) { var exportAssignment = declaration; if (exportAssignment.expression) { return links.type = checkExpression(exportAssignment.expression); } else if (exportAssignment.type) { - return links.type = getTypeFromTypeNode(exportAssignment.type); + return links.type = getTypeFromTypeNodeOrHeritageClauseElement(exportAssignment.type); } else { return links.type = anyType; @@ -9898,9 +14818,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); } } @@ -9912,11 +14830,11 @@ var ts; function getAnnotatedAccessorType(accessor) { if (accessor) { if (accessor.kind === 136) { - return accessor.type && getTypeFromTypeNode(accessor.type); + return accessor.type && getTypeFromTypeNodeOrHeritageClauseElement(accessor.type); } else { var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation && getTypeFromTypeNodeOrHeritageClauseElement(setterTypeAnnotation); } } return undefined; @@ -9961,8 +14879,8 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var _getter = ts.getDeclarationOfKind(symbol, 136); - error(_getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + var getter = ts.getDeclarationOfKind(symbol, 136); + error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } } @@ -10028,13 +14946,15 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 199 || node.kind === 198) { + if (node.kind === 202 || node.kind === 201) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!result) { - result = [tp]; + result = [ + tp + ]; } else if (!ts.contains(result, tp)) { result.push(tp); @@ -10059,10 +14979,10 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(symbol, 198); - var baseTypeNode = ts.getClassBaseTypeNode(declaration); + var declaration = ts.getDeclarationOfKind(symbol, 201); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + var baseType = getTypeFromHeritageClauseElement(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10100,9 +15020,9 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 199 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 202 && ts.getInterfaceBaseTypeNodes(declaration)) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { - var baseType = getTypeFromTypeReferenceNode(node); + var baseType = getTypeFromHeritageClauseElement(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10131,16 +15051,16 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 200); - var type = getTypeFromTypeNode(declaration.type); + var declaration = ts.getDeclarationOfKind(symbol, 203); + var type = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var _declaration = ts.getDeclarationOfKind(symbol, 200); - error(_declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + var declaration = ts.getDeclarationOfKind(symbol, 203); + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; } @@ -10196,7 +15116,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -10204,14 +15124,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSymbols.length; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -10220,7 +15140,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSignatures.length; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -10281,14 +15201,15 @@ var ts; var baseType = classType.baseTypes[0]; var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); return ts.map(baseSignatures, function (baseSignature) { - var signature = baseType.flags & 4096 ? - getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; return signature; }); } - return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; + return [ + createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false) + ]; } function createTupleTypeMemberSymbols(memberTypes) { var members = {}; @@ -10317,16 +15238,18 @@ var ts; return true; } function getUnionSignatures(types, kind) { - var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var signatureLists = ts.map(types, function (t) { + return getSignaturesOfType(t, kind); + }); var signatures = signatureLists[0]; - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; } } - for (var _i_1 = 1; _i_1 < signatureLists.length; _i_1++) { - if (!signatureListsIdentical(signatures, signatureLists[_i_1])) { + for (var i_1 = 1; i_1 < signatureLists.length; i_1++) { + if (!signatureListsIdentical(signatures, signatureLists[i_1])) { return emptyArray; } } @@ -10334,13 +15257,15 @@ var ts; for (var i = 0; i < result.length; i++) { var s = result[i]; s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); + s.unionSignatures = ts.map(signatureLists, function (signatures) { + return signatures[i]; + }); } return result; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -10476,7 +15401,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -10485,7 +15410,9 @@ var ts; return undefined; } if (!props) { - props = [prop]; + props = [ + prop + ]; } else { props.push(prop); @@ -10494,12 +15421,12 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0, _b = props.length; _a < _b; _a++) { - var _prop = props[_a]; - if (_prop.declarations) { - declarations.push.apply(declarations, _prop.declarations); + for (var _a = 0; _a < props.length; _a++) { + var prop = props[_a]; + if (prop.declarations) { + declarations.push.apply(declarations, prop.declarations); } - propTypes.push(getTypeOfSymbol(_prop)); + propTypes.push(getTypeOfSymbol(prop)); } var result = createSymbol(4 | 67108864 | 268435456, name); result.unionType = unionType; @@ -10536,9 +15463,9 @@ var ts; } } if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { - var _symbol = getPropertyOfObjectType(globalFunctionType, name); - if (_symbol) - return _symbol; + var symbol = getPropertyOfObjectType(globalFunctionType, name); + if (symbol) + return symbol; } return getPropertyOfObjectType(globalObjectType, name); } @@ -10594,8 +15521,7 @@ var ts; var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var classType = declaration.kind === 135 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; - var typeParameters = classType ? classType.typeParameters : - declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; @@ -10619,7 +15545,7 @@ var ts; returnType = classType; } else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); + returnType = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } else { if (declaration.kind === 136 && !ts.hasDynamicName(declaration)) { @@ -10643,7 +15569,7 @@ var ts; switch (node.kind) { case 142: case 143: - case 197: + case 200: case 134: case 133: case 135: @@ -10727,8 +15653,12 @@ var ts; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; - type.callSignatures = !isConstructor ? [signature] : emptyArray; - type.constructSignatures = isConstructor ? [signature] : emptyArray; + type.callSignatures = !isConstructor ? [ + signature + ] : emptyArray; + type.constructSignatures = isConstructor ? [ + signature + ] : emptyArray; signature.isolatedSignatureType = type; } return signature.isolatedSignatureType; @@ -10741,7 +15671,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -10756,9 +15686,7 @@ var ts; } function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType - : undefined; + return declaration ? declaration.type ? getTypeFromTypeNodeOrHeritageClauseElement(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { if (!type.constraint) { @@ -10767,7 +15695,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128).constraint); + type.constraint = getTypeFromTypeNodeOrHeritageClauseElement(ts.getDeclarationOfKind(type.symbol, 128).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -10791,7 +15719,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } @@ -10814,7 +15742,9 @@ var ts; return links.isIllegalTypeReferenceInConstraint; } var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { + return d.parent === currentNode.parent; + })) { currentNode = currentNode.parent; } links.isIllegalTypeReferenceInConstraint = currentNode.kind === 128; @@ -10828,7 +15758,9 @@ var ts; if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { + return d.parent == typeParameter.parent; + }); } } if (links.isIllegalTypeReferenceInConstraint) { @@ -10842,31 +15774,40 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReferenceNode(node) { + function getTypeFromTypeReference(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromHeritageClauseElement(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromTypeReferenceOrHeritageClauseElement(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var symbol = resolveEntityName(node.typeName, 793056); var type; - if (symbol) { - if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - type = unknownType; - } - else { - type = getDeclaredTypeOfSymbol(symbol); - if (type.flags & (1024 | 2048) && type.flags & 4096) { - var typeParameters = type.typeParameters; - if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); - } - else { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); - type = undefined; - } + if (node.kind !== 177 || ts.isSupportedHeritageClauseElement(node)) { + var typeNameOrExpression = node.kind === 141 ? node.typeName : node.expression; + var symbol = resolveEntityName(typeNameOrExpression, 793056); + if (symbol) { + if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; } else { - if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); - type = undefined; + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 | 2048) && type.flags & 4096) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNodeOrHeritageClauseElement)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } } } } @@ -10885,12 +15826,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 198: - case 199: case 201: + case 202: + case 204: return declaration; } } @@ -10927,12 +15868,14 @@ var ts; } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); - return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [ + elementType + ]) : emptyObjectType; } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + links.resolvedType = createArrayType(getTypeFromTypeNodeOrHeritageClauseElement(node.elementType)); } return links.resolvedType; } @@ -10948,7 +15891,7 @@ var ts; function getTypeFromTupleTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNodeOrHeritageClauseElement)); } return links.resolvedType; } @@ -10968,13 +15911,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -10992,7 +15935,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -11039,7 +15982,7 @@ var ts; function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNodeOrHeritageClauseElement), true); } return links.resolvedType; } @@ -11065,7 +16008,7 @@ var ts; } return links.resolvedType; } - function getTypeFromTypeNode(node) { + function getTypeFromTypeNodeOrHeritageClauseElement(node) { switch (node.kind) { case 112: return anyType; @@ -11082,7 +16025,9 @@ var ts; case 8: return getTypeFromStringLiteral(node); case 141: - return getTypeFromTypeReferenceNode(node); + return getTypeFromTypeReference(node); + case 177: + return getTypeFromHeritageClauseElement(node); case 144: return getTypeFromTypeQueryNode(node); case 146: @@ -11092,7 +16037,7 @@ var ts; case 148: return getTypeFromUnionTypeNode(node); case 149: - return getTypeFromTypeNode(node.type); + return getTypeFromTypeNodeOrHeritageClauseElement(node.type); case 142: case 143: case 145: @@ -11108,7 +16053,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _n = items.length; _i < _n; _i++) { + for (var _i = 0; _i < items.length; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -11117,15 +16062,21 @@ var ts; return items; } function createUnaryTypeMapper(source, target) { - return function (t) { return t === source ? target : t; }; + return function (t) { + return t === source ? target : t; + }; } function createBinaryTypeMapper(source1, target1, source2, target2) { - return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; + return function (t) { + return t === source1 ? target1 : t === source2 ? target2 : t; + }; } function createTypeMapper(sources, targets) { switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + case 1: + return createUnaryTypeMapper(sources[0], targets[0]); + case 2: + return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -11137,18 +16088,24 @@ var ts; }; } function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; + return function (t) { + return t === source ? anyType : t; + }; } function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + return function (t) { + return t === source1 || t === source2 ? anyType : t; + }; } function createTypeEraser(sources) { switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); + case 1: + return createUnaryTypeEraser(sources[0]); + case 2: + return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _n = sources.length; _i < _n; _i++) { + for (var _i = 0; _i < sources.length; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -11172,7 +16129,9 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return mapper2(mapper1(t)); }; + return function (t) { + return mapper2(mapper1(t)); + }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -11233,8 +16192,7 @@ var ts; return mapper(type); } if (type.flags & 32768) { - return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? - instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -11259,12 +16217,10 @@ var ts; case 153: return ts.forEach(node.elements, isContextSensitive); case 170: - return isContextSensitive(node.whenTrue) || - isContextSensitive(node.whenFalse); + return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); case 169: - return node.operatorToken.kind === 49 && - (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 221: + return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 224: return isContextSensitive(node.initializer); case 134: case 133: @@ -11275,7 +16231,9 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { + return p.type; + }); } function getTypeWithoutConstructors(type) { if (type.flags & 48128) { @@ -11347,7 +16305,7 @@ var ts; errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } function isRelatedTo(source, target, reportErrors, headMessage) { - var _result; + var result; if (source === target) return -1; if (relation !== identityRelation) { @@ -11371,54 +16329,53 @@ var ts; if (source.flags & 16384 || target.flags & 16384) { if (relation === identityRelation) { if (source.flags & 16384 && target.flags & 16384) { - if (_result = unionTypeRelatedToUnionType(source, target)) { - if (_result &= unionTypeRelatedToUnionType(target, source)) { - return _result; + if (result = unionTypeRelatedToUnionType(source, target)) { + if (result &= unionTypeRelatedToUnionType(target, source)) { + return result; } } } else if (source.flags & 16384) { - if (_result = unionTypeRelatedToType(source, target, reportErrors)) { - return _result; + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; } } else { - if (_result = unionTypeRelatedToType(target, source, reportErrors)) { - return _result; + if (result = unionTypeRelatedToType(target, source, reportErrors)) { + return result; } } } else { if (source.flags & 16384) { - if (_result = unionTypeRelatedToType(source, target, reportErrors)) { - return _result; + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; } } else { - if (_result = typeRelatedToUnionType(source, target, reportErrors)) { - return _result; + if (result = typeRelatedToUnionType(source, target, reportErrors)) { + return result; } } } } else if (source.flags & 512 && target.flags & 512) { - if (_result = typeParameterRelatedTo(source, target, reportErrors)) { - return _result; + if (result = typeParameterRelatedTo(source, target, reportErrors)) { + return result; } } else { var saveErrorInfo = errorInfo; if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (_result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { - return _result; + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; } } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && - (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors))) { errorInfo = saveErrorInfo; - return _result; + return result; } } if (reportErrors) { @@ -11434,17 +16391,17 @@ var ts; return 0; } function unionTypeRelatedToUnionType(source, target) { - var _result = -1; + var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { return 0; } - _result &= related; + result &= related; } - return _result; + return result; } function typeRelatedToUnionType(source, target, reportErrors) { var targetTypes = target.types; @@ -11457,28 +16414,28 @@ var ts; return 0; } function unionTypeRelatedToType(source, target, reportErrors) { - var _result = -1; + var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return 0; } - _result &= related; + result &= related; } - return _result; + return result; } function typesRelatedTo(sources, targets, reportErrors) { - var _result = -1; + var result = -1; for (var i = 0, len = sources.length; i < len; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0; } - _result &= related; + result &= related; } - return _result; + return result; } function typeParameterRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -11543,20 +16500,20 @@ var ts; expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; - var _result; + var result; if (expandingFlags === 3) { - _result = 1; + result = 1; } else { - _result = propertiesRelatedTo(source, target, reportErrors); - if (_result) { - _result &= signaturesRelatedTo(source, target, 0, reportErrors); - if (_result) { - _result &= signaturesRelatedTo(source, target, 1, reportErrors); - if (_result) { - _result &= stringIndexTypesRelatedTo(source, target, reportErrors); - if (_result) { - _result &= numberIndexTypesRelatedTo(source, target, reportErrors); + result = propertiesRelatedTo(source, target, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 0, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (result) { + result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (result) { + result &= numberIndexTypesRelatedTo(source, target, reportErrors); } } } @@ -11564,23 +16521,23 @@ var ts; } expandingFlags = saveExpandingFlags; depth--; - if (_result) { + if (result) { var maybeCache = maybeStack[depth]; - var destinationCache = (_result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; ts.copyMap(maybeCache, destinationCache); } else { relation[id] = reportErrors ? 3 : 2; } - return _result; + return result; } function isDeeplyNestedGeneric(type, stack) { if (type.flags & 4096 && depth >= 10) { - var _target = type.target; + var target_1 = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === _target) { + if (t.flags & 4096 && t.target === target_1) { count++; if (count >= 10) return true; @@ -11593,10 +16550,10 @@ var ts; if (relation === identityRelation) { return propertiesIdenticalTo(source, target); } - var _result = -1; + var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -11648,7 +16605,7 @@ var ts; } return 0; } - _result &= related; + result &= related; if (sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); @@ -11658,7 +16615,7 @@ var ts; } } } - return _result; + return result; } function propertiesIdenticalTo(source, target) { var sourceProperties = getPropertiesOfObjectType(source); @@ -11666,8 +16623,8 @@ var ts; if (sourceProperties.length !== targetProperties.length) { return 0; } - var _result = -1; - for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { + var result = -1; + for (var _i = 0; _i < sourceProperties.length; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -11677,9 +16634,9 @@ var ts; if (!related) { return 0; } - _result &= related; + result &= related; } - return _result; + return result; } function signaturesRelatedTo(source, target, kind, reportErrors) { if (relation === identityRelation) { @@ -11690,18 +16647,18 @@ var ts; } var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); - var _result = -1; + var result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceSignatures.length; _a++) { var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { - _result &= related; + result &= related; errorInfo = saveErrorInfo; continue outer; } @@ -11711,7 +16668,7 @@ var ts; return 0; } } - return _result; + return result; } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { @@ -11741,14 +16698,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - var _result = -1; + var result = -1; for (var i = 0; i < checkCount; i++) { - var _s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var _t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + var s_1 = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var t_1 = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); var saveErrorInfo = errorInfo; - var related = isRelatedTo(_s, _t, reportErrors); + var related = isRelatedTo(s_1, t_1, reportErrors); if (!related) { - related = isRelatedTo(_t, _s, false); + related = isRelatedTo(t_1, s_1, false); if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); @@ -11757,13 +16714,13 @@ var ts; } errorInfo = saveErrorInfo; } - _result &= related; + result &= related; } var t = getReturnTypeOfSignature(target); if (t === voidType) - return _result; + return result; var s = getReturnTypeOfSignature(source); - return _result & isRelatedTo(s, t, reportErrors); + return result & isRelatedTo(s, t, reportErrors); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -11771,15 +16728,15 @@ var ts; if (sourceSignatures.length !== targetSignatures.length) { return 0; } - var _result = -1; + var result = -1; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); if (!related) { return 0; } - _result &= related; + result &= related; } - return _result; + return result; } function stringIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -11876,9 +16833,7 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || - source.minArgumentCount !== target.minArgumentCount || - source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -11899,14 +16854,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - for (var _i = 0, _len = source.parameters.length; _i < _len; _i++) { - var s = source.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[_i]); - var t = target.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[_i]); - var _related = compareTypes(s, t); - if (!_related) { + for (var i = 0, len = source.parameters.length; i < len; i++) { + var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var related = compareTypes(s, t); + if (!related) { return 0; } - result &= _related; + result &= related; } if (compareReturnTypes) { result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); @@ -11914,7 +16869,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -11922,7 +16877,9 @@ var ts; return true; } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + return ts.forEach(types, function (t) { + return isSupertypeOfEach(t, types) ? t : undefined; + }); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -12020,17 +16977,17 @@ var ts; return reportWideningErrorsInType(type.typeArguments[0]); } if (type.flags & 131072) { - var _errorReported = false; + var errorReported = false; ts.forEach(getPropertiesOfObjectType(type), function (p) { var t = getTypeOfSymbol(p); if (t.flags & 262144) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } - _errorReported = true; + errorReported = true; } }); - return _errorReported; + return errorReported; } return false; } @@ -12043,11 +17000,9 @@ var ts; diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 129: - diagnostic = declaration.dotDotDotToken ? - ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : - ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 197: + case 200: case 134: case 133: case 136: @@ -12100,9 +17055,13 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { + for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; - inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); + inferences.push({ + primary: undefined, + secondary: undefined, + isFixed: false + }); } return { typeParameters: typeParameters, @@ -12127,11 +17086,11 @@ var ts; } function isWithinDepthLimit(type, stack) { if (depth >= 5) { - var _target = type.target; + var target_2 = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === _target) { + if (t.flags & 4096 && t.target === target_2) { count++; } } @@ -12149,9 +17108,7 @@ var ts; if (target === typeParameters[i]) { var inferences = context.inferences[i]; if (!inferences.isFixed) { - var candidates = inferiority ? - inferences.secondary || (inferences.secondary = []) : - inferences.primary || (inferences.primary = []); + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); if (!ts.contains(candidates, source)) { candidates.push(source); } @@ -12163,16 +17120,16 @@ var ts; else if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { var sourceTypes = source.typeArguments; var targetTypes = target.typeArguments; - for (var _i = 0; _i < sourceTypes.length; _i++) { - inferFromTypes(sourceTypes[_i], targetTypes[_i]); + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); } } else if (target.flags & 16384) { - var _targetTypes = target.types; + var targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _a = 0, _n = _targetTypes.length; _a < _n; _a++) { - var t = _targetTypes[_a]; + for (var _i = 0; _i < targetTypes.length; _i++) { + var t = targetTypes[_i]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -12188,14 +17145,13 @@ var ts; } } else if (source.flags & 16384) { - var _sourceTypes = source.types; - for (var _b = 0, _c = _sourceTypes.length; _b < _c; _b++) { - var sourceType = _sourceTypes[_b]; + var sourceTypes = source.types; + for (var _a = 0; _a < sourceTypes.length; _a++) { + var sourceType = sourceTypes[_a]; inferFromTypes(sourceType, target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || - (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -12216,7 +17172,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -12289,7 +17245,7 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; } return links.resolvedSymbol; } @@ -12311,8 +17267,12 @@ var ts; function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { if (type.flags & 16384) { var types = type.types; - if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); + if (ts.forEach(types, function (t) { + return !!(t.flags & typeKind) === isOfTypeKind; + })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { + return !(t.flags & typeKind) === isOfTypeKind; + })); if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } @@ -12360,7 +17320,7 @@ var ts; switch (node.kind) { case 169: return isAssignedInBinaryExpression(node); - case 195: + case 198: case 152: return isAssignedInVariableDeclaration(node); case 150: @@ -12380,24 +17340,24 @@ var ts; case 168: case 170: case 173: - case 176: - case 177: case 179: case 180: - case 181: case 182: case 183: case 184: case 185: + case 186: + case 187: case 188: - case 189: - case 190: - case 217: - case 218: case 191: case 192: case 193: case 220: + case 221: + case 194: + case 195: + case 196: + case 223: return ts.forEachChild(node, isAssignedIn); } return false; @@ -12405,13 +17365,14 @@ var ts; } function resolveLocation(node) { var containerNodes = []; - for (var _parent = node.parent; _parent; _parent = _parent.parent) { - if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && - isContextSensitive(_parent)) { - containerNodes.unshift(_parent); + for (var parent_3 = node.parent; parent_3; parent_3 = parent_3.parent) { + if ((ts.isExpression(parent_3) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent_3)) { + containerNodes.unshift(parent_3); } } - ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); + ts.forEach(containerNodes, function (node) { + getTypeOfNode(node); + }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -12433,7 +17394,7 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 180: + case 183: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } @@ -12453,9 +17414,9 @@ var ts; } } break; - case 224: - case 202: - case 197: + case 227: + case 205: + case 200: case 134: case 133: case 136: @@ -12540,7 +17501,9 @@ var ts; return targetType; } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + return getUnionType(ts.filter(type.types, function (t) { + return isTypeSubtypeOf(t, targetType); + })); } return type; } @@ -12596,17 +17559,15 @@ var ts; return false; } function checkBlockScopedBindingCapturedInLoop(node, symbol) { - if (languageVersion >= 2 || - (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 220) { + if (languageVersion >= 2 || (symbol.flags & 2) === 0 || symbol.valueDeclaration.parent.kind === 223) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 196) { + while (container.kind !== 199) { container = container.parent; } container = container.parent; - if (container.kind === 177) { + if (container.kind === 180) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -12623,7 +17584,7 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; getNodeLinks(node).flags |= 2; if (container.kind === 132 || container.kind === 135) { getNodeLinks(classNode).flags |= 4; @@ -12640,10 +17601,10 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 202: + case 205: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 201: + case 204: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 135: @@ -12664,7 +17625,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -12681,9 +17642,9 @@ var ts; } function checkSuperExpression(node) { var isCallExpression = node.parent.kind === 157 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); var baseClass; - if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); baseClass = classType.baseTypes.length && classType.baseTypes[0]; } @@ -12704,23 +17665,12 @@ var ts; container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 198) { + if (container && container.parent && container.parent.kind === 201) { if (container.flags & 128) { - canUseSuperExpression = - container.kind === 134 || - container.kind === 133 || - container.kind === 136 || - container.kind === 137; + canUseSuperExpression = container.kind === 134 || container.kind === 133 || container.kind === 136 || container.kind === 137; } else { - canUseSuperExpression = - container.kind === 134 || - container.kind === 133 || - container.kind === 136 || - container.kind === 137 || - container.kind === 132 || - container.kind === 131 || - container.kind === 135; + canUseSuperExpression = container.kind === 134 || container.kind === 133 || container.kind === 136 || container.kind === 137 || container.kind === 132 || container.kind === 131 || container.kind === 135; } } } @@ -12767,8 +17717,7 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && - funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -12780,7 +17729,7 @@ var ts; var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var type = getContextuallyTypedParameterType(declaration); @@ -12846,7 +17795,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -12854,7 +17803,10 @@ var ts; mappedType = t; } else if (!mappedTypes) { - mappedTypes = [mappedType, t]; + mappedTypes = [ + mappedType, + t + ]; } else { mappedTypes.push(t); @@ -12870,13 +17822,17 @@ var ts; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); + return applyToContextualType(type, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }) : getIndexTypeOfObjectOrUnionType(type, kind)); } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -12896,8 +17852,7 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || - getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -12906,9 +17861,7 @@ var ts; var type = getContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) - || getIndexTypeOfContextualType(type, 1) - || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); } return undefined; } @@ -12923,35 +17876,35 @@ var ts; if (node.contextualType) { return node.contextualType; } - var _parent = node.parent; - switch (_parent.kind) { - case 195: + var parent = node.parent; + switch (parent.kind) { + case 198: case 129: case 132: case 131: case 152: return getContextualTypeForInitializerExpression(node); case 163: - case 188: + case 191: return getContextualTypeForReturnExpression(node); case 157: case 158: - return getContextualTypeForArgument(_parent, node); + return getContextualTypeForArgument(parent, node); case 160: - return getTypeFromTypeNode(_parent.type); + return getTypeFromTypeNodeOrHeritageClauseElement(parent.type); case 169: return getContextualTypeForBinaryOperand(node); - case 221: - return getContextualTypeForObjectLiteralElement(_parent); + case 224: + return getContextualTypeForObjectLiteralElement(parent); case 153: return getContextualTypeForElementExpression(node); case 170: return getContextualTypeForConditionalOperand(node); - case 175: - ts.Debug.assert(_parent.parent.kind === 171); - return getContextualTypeForSubstitutionExpression(_parent.parent, node); + case 176: + ts.Debug.assert(parent.parent.kind === 171); + return getContextualTypeForSubstitutionExpression(parent.parent, node); case 161: - return getContextualType(_parent); + return getContextualType(parent); } return undefined; } @@ -12972,9 +17925,7 @@ var ts; } function getContextualSignature(node) { ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); if (!type) { return undefined; } @@ -12983,16 +17934,17 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; - if (signatureList && - getSignaturesOfObjectOrUnionType(current, 0).length > 1) { + if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; } var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { - signatureList = [signature]; + signatureList = [ + signature + ]; } else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; @@ -13014,15 +17966,15 @@ var ts; return mapper && mapper !== identityMapper; } function isAssignmentTarget(node) { - var _parent = node.parent; - if (_parent.kind === 169 && _parent.operatorToken.kind === 53 && _parent.left === node) { + var parent = node.parent; + if (parent.kind === 169 && parent.operatorToken.kind === 53 && parent.left === node) { return true; } - if (_parent.kind === 221) { - return isAssignmentTarget(_parent.parent); + if (parent.kind === 224) { + return isAssignmentTarget(parent.parent); } - if (_parent.kind === 153) { - return isAssignmentTarget(_parent); + if (parent.kind === 153) { + return isAssignmentTarget(parent); } return false; } @@ -13087,24 +18039,20 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 221 || - memberDecl.kind === 222 || - ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 224 || memberDecl.kind === 225 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 221) { + if (memberDecl.kind === 224) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 134) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 222); - type = memberDecl.name.kind === 127 - ? unknownType - : checkExpression(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 225); + type = memberDecl.name.kind === 127 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -13137,15 +18085,15 @@ var ts; for (var i = 0; i < propertiesArray.length; i++) { var propertyDecl = node.properties[i]; if (kind === 0 || isNumericName(propertyDecl.name)) { - var _type = getTypeOfSymbol(propertiesArray[i]); - if (!ts.contains(propTypes, _type)) { - propTypes.push(_type); + var type = getTypeOfSymbol(propertiesArray[i]); + if (!ts.contains(propTypes, type)) { + propTypes.push(type); } } } - var _result = propTypes.length ? getUnionType(propTypes) : undefinedType; - typeFlags |= _result.flags; - return _result; + var result_1 = propTypes.length ? getUnionType(propTypes) : undefinedType; + typeFlags |= result_1.flags; + return result_1; } return undefined; } @@ -13161,7 +18109,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 198); + var enclosingClassDeclaration = ts.getAncestor(node, 201); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -13220,9 +18168,7 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 155 - ? node.expression - : node.left; + var left = node.kind === 155 ? node.expression : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); @@ -13248,9 +18194,9 @@ var ts; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { - var _start = node.end - "]".length; - var _end = node.end; - grammarErrorAtPos(sourceFile, _start, _end - _start, ts.Diagnostics.Expression_expected); + var start = node.end - "]".length; + var end = node.end; + grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); } } var objectType = getApparentType(checkExpression(node.expression)); @@ -13259,21 +18205,20 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && - (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } if (node.argumentExpression) { - var _name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (_name !== undefined) { - var prop = getPropertyOfType(objectType, _name); + var name_6 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name_6 !== undefined) { + var prop = getPropertyOfType(objectType, name_6); if (prop) { getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } else if (isConstEnum) { - error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, _name, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_6, symbolToString(objectType.symbol)); return unknownType; } } @@ -13360,22 +18305,22 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var _parent = signature.declaration && signature.declaration.parent; + var parent_4 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && _parent === lastParent) { + if (lastParent && parent_4 === lastParent) { index++; } else { - lastParent = _parent; + lastParent = parent_4; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = _parent; + lastParent = parent_4; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -13409,7 +18354,7 @@ var ts; var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); - callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } else { var templateLiteral = tagExpression.template; @@ -13427,8 +18372,7 @@ var ts; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -13445,8 +18389,7 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -13470,27 +18413,27 @@ var ts; if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) { context.failedTypeParameterIndex = undefined; } - for (var _i = 0; _i < args.length; _i++) { - var arg = args[_i]; - if (arg.kind !== 174) { - var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : _i); + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + if (arg.kind !== 175) { + var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = void 0; - if (_i === 0 && args[_i].parent.kind === 159) { + if (i === 0 && args[i].parent.kind === 159) { argType = globalTemplateStringsArrayType; } else { - var mapper = excludeArgument && excludeArgument[_i] !== undefined ? identityMapper : inferenceMapper; + var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } inferTypes(context, argType, paramType); } } if (excludeArgument) { - for (var _i_1 = 0; _i_1 < args.length; _i_1++) { - if (excludeArgument[_i_1] === false) { - var _arg = args[_i_1]; - var _paramType = getTypeAtPosition(signature, _arg.kind === 173 ? -1 : _i_1); - inferTypes(context, checkExpressionWithContextualType(_arg, _paramType, inferenceMapper), _paramType); + for (var i = 0; i < args.length; i++) { + if (excludeArgument[i] === false) { + var arg = args[i]; + var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); + inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -13501,7 +18444,7 @@ var ts; var typeArgumentsAreAssignable = true; for (var i = 0; i < typeParameters.length; i++) { var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); + var typeArgument = getTypeFromTypeNodeOrHeritageClauseElement(typeArgNode); typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); @@ -13515,11 +18458,9 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); - var argType = i === 0 && node.kind === 159 ? globalTemplateStringsArrayType : - arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : - checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = i === 0 && node.kind === 159 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -13531,7 +18472,9 @@ var ts; var args; if (node.kind === 159) { var template = node.template; - args = [template]; + args = [ + template + ]; if (template.kind === 171) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); @@ -13545,8 +18488,8 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91) { - var containingClass = ts.getAncestor(callExpression, 198); - var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + var containingClass = ts.getAncestor(callExpression, 201); + var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } else { @@ -13613,7 +18556,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -13622,45 +18565,43 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _a = 0, _b = candidates.length; _a < _b; _a++) { - var originalCandidate = candidates[_a]; + for (var _i = 0; _i < candidates.length; _i++) { + var originalCandidate = candidates[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; } - var _candidate = void 0; + var candidate = void 0; var typeArgumentsAreValid = void 0; - var inferenceContext = originalCandidate.typeParameters - ? createInferenceContext(originalCandidate.typeParameters, false) - : undefined; + var inferenceContext = originalCandidate.typeParameters ? createInferenceContext(originalCandidate.typeParameters, false) : undefined; while (true) { - _candidate = originalCandidate; - if (_candidate.typeParameters) { + candidate = originalCandidate; + if (candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = new Array(_candidate.typeParameters.length); - typeArgumentsAreValid = checkTypeArguments(_candidate, typeArguments, typeArgumentTypes, false); + typeArgumentTypes = new Array(candidate.typeParameters.length); + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); } else { - inferTypeArguments(_candidate, args, excludeArgument, inferenceContext); + inferTypeArguments(candidate, args, excludeArgument, inferenceContext); typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; typeArgumentTypes = inferenceContext.inferredTypes; } if (!typeArgumentsAreValid) { break; } - _candidate = getSignatureInstantiation(_candidate, typeArgumentTypes); + candidate = getSignatureInstantiation(candidate, typeArgumentTypes); } - if (!checkApplicableSignature(node, args, _candidate, relation, excludeArgument, false)) { + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { break; } var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; if (index < 0) { - return _candidate; + return candidate; } excludeArgument[index] = false; } if (originalCandidate.typeParameters) { - var instantiatedCandidate = _candidate; + var instantiatedCandidate = candidate; if (typeArgumentsAreValid) { candidateForArgumentError = instantiatedCandidate; } @@ -13672,7 +18613,7 @@ var ts; } } else { - ts.Debug.assert(originalCandidate === _candidate); + ts.Debug.assert(originalCandidate === candidate); candidateForArgumentError = originalCandidate; } } @@ -13787,10 +18728,7 @@ var ts; } if (node.kind === 158) { var declaration = signature.declaration; - if (declaration && - declaration.kind !== 135 && - declaration.kind !== 139 && - declaration.kind !== 143) { + if (declaration && declaration.kind !== 135 && declaration.kind !== 139 && declaration.kind !== 143) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -13804,7 +18742,7 @@ var ts; } function checkTypeAssertion(node) { var exprType = checkExpression(node.expression); - var targetType = getTypeFromTypeNode(node.type); + var targetType = getTypeFromTypeNodeOrHeritageClauseElement(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { @@ -13815,13 +18753,9 @@ var ts; } function getTypeAtPosition(signature, pos) { if (pos >= 0) { - return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; } - return signature.hasRestParameter ? - getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : - anyArrayType; + return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -13831,9 +18765,9 @@ var ts; links.type = instantiateType(getTypeAtPosition(context, i), mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { - var _parameter = signature.parameters[signature.parameters.length - 1]; - var _links = getSymbolLinks(_parameter); - _links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); + var parameter = signature.parameters[signature.parameters.length - 1]; + var links = getSymbolLinks(parameter); + links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); } } function getReturnTypeFromBody(func, contextualMapper) { @@ -13842,7 +18776,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 176) { + if (func.body.kind !== 179) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -13880,7 +18814,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 192); + return (body.statements.length === 1) && (body.statements[0].kind === 195); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -13889,7 +18823,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 176) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 179) { return; } var bodyBlock = func.body; @@ -13941,16 +18875,16 @@ var ts; function checkFunctionExpressionOrObjectLiteralMethodBody(node) { ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); if (node.type) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (node.body) { - if (node.body.kind === 176) { + if (node.body.kind === 179) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); if (node.type) { - checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrHeritageClauseElement(node.type), node.body, undefined); } checkFunctionExpressionBodies(node.body); } @@ -13970,14 +18904,16 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 65: { - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; - } - case 155: { - var _symbol = findSymbol(n); - return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; - } + case 65: + { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + } + case 155: + { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; + } case 156: return true; case 161: @@ -13989,39 +18925,28 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 65: - case 155: { - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; - } - case 156: { - var index = n.argumentExpression; - var _symbol = findSymbol(n.expression); - if (_symbol && index && index.kind === 8) { - var _name = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + case 155: + { + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + } + case 156: + { + var index = n.argumentExpression; + var symbol = findSymbol(n.expression); + if (symbol && index && index.kind === 8) { + var name_7 = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_7); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + } + return false; } - return false; - } case 161: return isConstVariableReference(n.expression); default: return false; } } - function isImportedNameFromExternalModule(n) { - switch (n.kind) { - case 156: - case 155: { - var symbol = findSymbol(n.expression); - return symbol && symbol.flags & 8388608 && isExternalModuleSymbol(resolveAlias(symbol)); - } - case 161: - return isImportedNameFromExternalModule(n.expression); - default: - return false; - } - } if (!isReferenceOrErrorExpression(n)) { error(n, invalidReferenceMessage); return false; @@ -14030,9 +18955,6 @@ var ts; error(n, constantVariableMessage); return false; } - if (isImportedNameFromExternalModule(n)) { - error(n, invalidReferenceMessage); - } return true; } function checkDeleteExpression(node) { @@ -14090,7 +19012,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -14106,7 +19028,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -14142,19 +19064,16 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 221 || p.kind === 222) { - var _name = p.name; - var type = sourceType.flags & 1 ? sourceType : - getTypeOfPropertyOfType(sourceType, _name.text) || - isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || - getIndexTypeOfType(sourceType, 0); + if (p.kind === 224 || p.kind === 225) { + var name_8 = p.name; + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name_8.text) || isNumericLiteralName(name_8.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { - checkDestructuringAssignment(p.initializer || _name, type); + checkDestructuringAssignment(p.initializer || name_8, type); } else { - error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(_name)); + error(name_8, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_8)); } } else { @@ -14171,12 +19090,10 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { var propName = "" + i; - var type = sourceType.flags & 1 ? sourceType : - isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : - getIndexTypeOfType(sourceType, 1); + var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } @@ -14257,9 +19174,7 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && - (rightType.flags & 8) && - (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { @@ -14321,7 +19236,10 @@ var ts; case 48: return rightType; case 49: - return getUnionType([leftType, rightType]); + return getUnionType([ + leftType, + rightType + ]); case 53: checkAssignmentOperator(rightType); return rightType; @@ -14329,9 +19247,7 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : - someConstituentTypeHasKind(rightType, 1048576) ? node.right : - undefined; + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); return false; @@ -14377,7 +19293,10 @@ var ts; checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); var type2 = checkExpression(node.whenFalse, contextualMapper); - return getUnionType([type1, type2]); + return getUnionType([ + type1, + type2 + ]); } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { @@ -14441,9 +19360,7 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 155 && node.parent.expression === node) || - (node.parent.kind === 156 && node.parent.expression === node) || - ((node.kind === 65 || node.kind === 126) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 155 && node.parent.expression === node) || (node.parent.kind === 156 && node.parent.expression === node) || ((node.kind === 65 || node.kind === 126) && 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); } @@ -14493,6 +19410,8 @@ var ts; return checkTypeAssertion(node); case 161: return checkExpression(node.expression, contextualMapper); + case 174: + return checkClassExpression(node); case 162: case 163: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -14512,7 +19431,7 @@ var ts; return checkConditionalExpression(node, contextualMapper); case 173: return checkSpreadElementExpression(node, contextualMapper); - case 174: + case 175: return undefinedType; case 172: checkYieldExpression(node); @@ -14531,6 +19450,12 @@ var ts; } } function checkParameter(node) { + // Grammar checking + // It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs as the + // Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code + // or if its FunctionBody is strict code(11.1.5). + // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a + // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); @@ -14553,9 +19478,7 @@ var ts; if (node.kind === 140) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 || node.kind === 197 || node.kind === 143 || - node.kind === 138 || node.kind === 135 || - node.kind === 139) { + else if (node.kind === 142 || node.kind === 200 || node.kind === 143 || node.kind === 138 || node.kind === 135 || node.kind === 139) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -14579,7 +19502,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 199) { + if (node.kind === 202) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -14589,7 +19512,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -14647,32 +19570,33 @@ var ts; } switch (n.kind) { case 162: - case 197: + case 200: case 163: - case 154: return false; - default: return ts.forEachChild(n, containsSuperCall); + case 154: + return false; + default: + return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { if (n.kind === 93) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 && n.kind !== 197) { + else if (n.kind !== 162 && n.kind !== 200) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 132 && - !(n.flags & 128) && - !!n.initializer; + return n.kind === 132 && !(n.flags & 128) && !!n.initializer; } - if (ts.getClassBaseTypeNode(node.parent)) { + if (ts.getClassExtendsHeritageClauseElement(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { + return p.flags & (16 | 32 | 64); + }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 179 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 182 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -14716,9 +19640,15 @@ var ts; function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeReference(node) { + function checkTypeReferenceNode(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkHeritageClauseElement(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkTypeReferenceOrHeritageClauseElement(node) { checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceNode(node); + var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); if (type !== unknownType && node.typeArguments) { var len = node.typeArguments.length; for (var i = 0; i < len; i++) { @@ -14771,7 +19701,7 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 199) { + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202) { ts.Debug.assert(signatureDeclarationNode.kind === 138 || signatureDeclarationNode.kind === 139); var signatureKind = signatureDeclarationNode.kind === 138 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); @@ -14781,7 +19711,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { + for (var _i = 0; _i < signaturesToCheck.length; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -14791,7 +19721,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 199 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 202 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -14848,7 +19778,7 @@ var ts; var declarations = symbol.declarations; var isConstructor = (symbol.flags & 16384) !== 0; function reportImplementationExpectedError(node) { - if (node.name && ts.getFullWidth(node.name) === 0) { + if (node.name && ts.nodeIsMissing(node.name)) { return; } var seen = false; @@ -14862,16 +19792,16 @@ var ts; }); if (subsequentNode) { if (subsequentNode.kind === node.kind) { - var _errorNode = subsequentNode.name || subsequentNode; + var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { ts.Debug.assert(node.kind === 134 || node.kind === 133); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(_errorNode, diagnostic); + error(errorNode_1, diagnostic); return; } else if (ts.nodeIsPresent(subsequentNode.body)) { - error(_errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); + error(errorNode_1, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); return; } } @@ -14887,15 +19817,15 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 199 || node.parent.kind === 145 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 202 || node.parent.kind === 145 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 197 || node.kind === 134 || node.kind === 133 || node.kind === 135) { + if (node.kind === 200 || node.kind === 134 || node.kind === 133 || node.kind === 135) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -14946,7 +19876,7 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + for (var _a = 0; _a < signatures.length; _a++) { var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); @@ -14992,19 +19922,19 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 199: - return 2097152; case 202: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 - ? 4194304 | 1048576 - : 4194304; - case 198: - case 201: - return 2097152 | 1048576; + return 2097152; case 205: + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; + case 201: + case 204: + return 2097152 | 1048576; + case 208: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); + ts.forEach(target.declarations, function (d) { + result |= getDeclarationSpaces(d); + }); return result; default: return 1048576; @@ -15015,10 +19945,12 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 198: + case 201: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); - var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]); + var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [ + classConstructorType + ]); checkTypeAssignableTo(exprType, classDecoratorType, node); break; case 132: @@ -15028,7 +19960,9 @@ var ts; case 136: case 137: var methodType = getTypeOfNode(node.parent); - var methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType, [methodType]); + var methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType, [ + methodType + ]); checkTypeAssignableTo(exprType, methodDecoratorType, node); break; case 129: @@ -15041,7 +19975,7 @@ var ts; return; } switch (node.kind) { - case 198: + case 201: case 134: case 136: case 137: @@ -15056,10 +19990,7 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || - checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionName(node.name) || - checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -15086,18 +20017,18 @@ var ts; } checkSourceElement(node.body); if (node.type && !isAccessor(node.kind)) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !node.type && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } } function checkBlock(node) { - if (node.kind === 176) { + if (node.kind === 179) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 203) { + if (ts.isFunctionBlock(node) || node.kind === 206) { checkFunctionExpressionBodies(node); } } @@ -15115,12 +20046,7 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 132 || - node.kind === 131 || - node.kind === 134 || - node.kind === 133 || - node.kind === 136 || - node.kind === 137) { + if (node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 133 || node.kind === 136 || node.kind === 137) { return false; } if (ts.isInAmbientContext(node)) { @@ -15141,8 +20067,8 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4) { - var _isDeclaration = node.kind !== 65; - if (_isDeclaration) { + var isDeclaration_1 = node.kind !== 65; + if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } else { @@ -15157,13 +20083,13 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } - if (ts.getClassBaseTypeNode(enclosingClass)) { - var _isDeclaration = node.kind !== 65; - if (_isDeclaration) { + if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { + var isDeclaration_2 = node.kind !== 65; + if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -15175,40 +20101,35 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 202 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 205 && ts.getModuleInstanceState(node) !== 1) { return; } - var _parent = getDeclarationContainer(node); - if (_parent.kind === 224 && ts.isExternalModule(_parent)) { + var parent = getDeclarationContainer(node); + if (parent.kind === 227 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkVarDeclaredNamesNotShadowed(node) { + // - ScriptBody : StatementList + // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList + // also occurs in the VarDeclaredNames of StatementList. if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { return; } - if (node.kind === 195 && !node.initializer) { + if (node.kind === 198 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && - localDeclarationSymbol !== symbol && - localDeclarationSymbol.flags & 2) { + if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 196); - var container = varDeclList.parent.kind === 177 && varDeclList.parent.parent - ? varDeclList.parent.parent - : undefined; - var namesShareScope = container && - (container.kind === 176 && ts.isFunctionLike(container.parent) || - container.kind === 203 || - container.kind === 202 || - container.kind === 224); + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199); + var container = varDeclList.parent.kind === 180 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; + var namesShareScope = container && (container.kind === 179 && ts.isFunctionLike(container.parent) || container.kind === 206 || container.kind === 205 || container.kind === 227); if (!namesShareScope) { - 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); + var name_9 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_9, name_9); } } } @@ -15289,7 +20210,7 @@ var ts; } if (node.kind !== 132 && node.kind !== 131) { checkExportsOnMergedDeclarations(node); - if (node.kind === 195 || node.kind === 152) { + if (node.kind === 198 || node.kind === 152) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -15318,7 +20239,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 176 || node.kind === 154) { + if (node.kind === 179 || node.kind === 154) { return true; } node = node.parent; @@ -15346,12 +20267,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 196) { + if (node.initializer && node.initializer.kind == 199) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -15366,7 +20287,7 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { checkForInOrForOfVariableDeclaration(node); } else { @@ -15387,7 +20308,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { 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); @@ -15422,21 +20343,44 @@ var ts; } function checkRightHandSideOfForOf(rhsExpression) { var expressionType = getTypeOfExpression(rhsExpression); - return languageVersion >= 2 - ? checkIteratedType(expressionType, rhsExpression) - : checkElementTypeOfArrayOrString(expressionType, rhsExpression); + return languageVersion >= 2 ? checkIteratedType(expressionType, rhsExpression) : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } function checkIteratedType(iterable, expressionForError) { ts.Debug.assert(languageVersion >= 2); var iteratedType = getIteratedType(iterable, expressionForError); if (expressionForError && iteratedType) { - var completeIterableType = globalIterableType !== emptyObjectType - ? createTypeReference(globalIterableType, [iteratedType]) - : emptyObjectType; + var completeIterableType = globalIterableType !== emptyObjectType ? createTypeReference(globalIterableType, [ + iteratedType + ]) : emptyObjectType; checkTypeAssignableTo(iterable, completeIterableType, expressionForError); } return iteratedType; function getIteratedType(iterable, expressionForError) { + // We want to treat type as an iterable, and get the type it is an iterable of. The iterable + // must have the following structure (annotated with the names of the variables below): + // + // { // iterable + // [Symbol.iterator]: { // iteratorFunction + // (): { // iterator + // next: { // iteratorNextFunction + // (): { // iteratorNextResult + // value: T // iteratorNextValue + // } + // } + // } + // } + // } + // + // T is the type we are after. At every level that involves analyzing return types + // of signatures, we union the return types of all the signatures. + // + // Another thing to note is that at any step of this process, we could run into a dead end, + // meaning either the property is missing, or we run into the anyType. If either of these things + // happens, we return undefined to signal that we could not find the iterated type. If a property + // is missing, and the previous step did not result in 'any', then we also give an error if the + // caller requested it. Then the caller can decide what to do in the case where there is no iterated + // type. This is different from returning anyType, because that would signify that we have matched the + // whole pattern and that T (above) is 'any'. if (allConstituentTypesHaveKind(iterable, 1)) { return undefined; } @@ -15496,9 +20440,7 @@ var ts; } if (!isArrayLikeType(arrayType)) { if (!reportedError) { - var diagnostic = hasStringConstituent - ? ts.Diagnostics.Type_0_is_not_an_array_type - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + var diagnostic = hasStringConstituent ? ts.Diagnostics.Type_0_is_not_an_array_type : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(expressionForError, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : unknownType; @@ -15508,7 +20450,10 @@ var ts; if (arrayElementType.flags & 258) { return stringType; } - return getUnionType([arrayElementType, stringType]); + return getUnionType([ + arrayElementType, + stringType + ]); } return arrayElementType; } @@ -15561,7 +20506,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 218 && !hasDuplicateDefaultClause) { + if (clause.kind === 221 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -15573,7 +20518,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 217) { + if (produceDiagnostics && clause.kind === 220) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -15590,7 +20535,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 191 && current.label.text === node.label.text) { + if (current.kind === 194 && 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; @@ -15654,9 +20599,9 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 198) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 201) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -15670,7 +20615,9 @@ var ts; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; if (!errorNode && (type.flags & 2048)) { - var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { + return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); + }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -15684,22 +20631,22 @@ var ts; if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { return; } - var _errorNode; + var errorNode; if (prop.valueDeclaration.name.kind === 127 || prop.parent === containingType.symbol) { - _errorNode = prop.valueDeclaration; + errorNode = prop.valueDeclaration; } else if (indexDeclaration) { - _errorNode = indexDeclaration; + errorNode = indexDeclaration; } else if (containingType.flags & 2048) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); - _errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { + return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); + }); + errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } - if (_errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 - ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 - : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; - error(_errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { + var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } } @@ -15729,7 +20676,15 @@ var ts; } } } + function checkClassExpression(node) { + grammarErrorOnNode(node, ts.Diagnostics.class_expressions_are_not_currently_supported); + ts.forEach(node.members, checkSourceElement); + return unknownType; + } function checkClassDeclaration(node) { + if (node.parent.kind !== 206 && node.parent.kind !== 227) { + grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + } checkGrammarClassDeclarationHeritageClauses(node); checkDecorators(node); if (node.name) { @@ -15742,10 +20697,13 @@ var ts; var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); var staticType = getTypeOfSymbol(symbol); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); + } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkTypeReference(baseTypeNode); + checkHeritageClauseElement(baseTypeNode); } if (type.baseTypes.length) { if (produceDiagnostics) { @@ -15753,19 +20711,24 @@ var ts; checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); var staticBaseType = getTypeOfSymbol(baseType.symbol); checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType.symbol !== resolveEntityName(baseTypeNode.typeName, 107455)) { + if (baseType.symbol !== resolveEntityName(baseTypeNode.expression, 107455)) { error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); } checkKindsOfPropertyMemberOverrides(type, baseType); } - checkExpressionOrQualifiedName(baseTypeNode.typeName); } - var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (type.baseTypes.length || (baseTypeNode && compilerOptions.separateCompilation)) { + checkExpressionOrQualifiedName(baseTypeNode.expression); + } + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - checkTypeReference(typeRefNode); + if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromTypeReferenceNode(typeRefNode); + var t = getTypeFromHeritageClauseElement(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { @@ -15788,8 +20751,21 @@ var ts; return s.flags & 16777216 ? getSymbolLinks(s).target : s; } function checkKindsOfPropertyMemberOverrides(type, baseType) { + // TypeScript 1.0 spec (April 2014): 8.2.3 + // A derived class inherits all members from its base class it doesn't override. + // Inheritance means that a derived class implicitly contains all non - overridden members of the base class. + // Both public and private property members are inherited, but only public property members can be overridden. + // A property member in a derived class is said to override a property member in a base class + // when the derived class property member has the same name and kind(instance or static) + // as the base class property member. + // The type of an overriding property member must be assignable(section 3.8.4) + // to the type of the overridden property member, or otherwise a compile - time error occurs. + // Base class instance member functions can be overridden by derived class instance member functions, + // but not by other kinds of members. + // 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. var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < baseProperties.length; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -15853,7 +20829,7 @@ var ts; if (!tp1.constraint || !tp2.constraint) { return false; } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + if (!isTypeIdenticalTo(getTypeFromTypeNodeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrHeritageClauseElement(tp2.constraint))) { return false; } } @@ -15864,15 +20840,23 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(type.declaredProperties, function (p) { + seen[p.name] = { + prop: p, + containingType: type + }; + }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0, _c = properties.length; _b < _c; _b++) { + for (var _b = 0; _b < properties.length; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { prop: prop, containingType: base }; + seen[prop.name] = { + prop: prop, + containingType: base + }; } else { var existing = seen[prop.name]; @@ -15897,7 +20881,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 199); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -15913,7 +20897,12 @@ var ts; } } } - ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { + if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(heritageElement); + }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { checkTypeForDuplicateIndexSignatures(node); @@ -15925,8 +20914,8 @@ var ts; checkSourceElement(node.type); } function computeEnumMemberValues(node) { - var _nodeLinks = getNodeLinks(node); - if (!(_nodeLinks.flags & 128)) { + var nodeLinks = getNodeLinks(node); + if (!(nodeLinks.flags & 128)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; @@ -15963,7 +20952,7 @@ var ts; getNodeLinks(member).enumMemberValue = autoValue++; } }); - _nodeLinks.flags |= 128; + nodeLinks.flags |= 128; } function getConstantValueForEnumMemberInitializer(initializer) { return evalConstant(initializer); @@ -15975,9 +20964,12 @@ var ts; return undefined; } switch (e.operator) { - case 33: return value; - case 34: return -value; - case 47: return ~value; + case 33: + return value; + case 34: + return -value; + case 47: + return ~value; } return undefined; case 169: @@ -15990,17 +20982,28 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 44: return left | right; - case 43: return left & right; - case 41: return left >> right; - case 42: return left >>> right; - case 40: return left << right; - case 45: return left ^ right; - case 35: return left * right; - case 36: return left / right; - case 33: return left + right; - case 34: return left - right; - case 37: return left % right; + case 44: + return left | right; + case 43: + return left & right; + case 41: + return left >> right; + case 42: + return left >>> right; + case 40: + return left << right; + case 45: + return left ^ right; + case 35: + return left * right; + case 36: + return left / right; + case 33: + return left + right; + case 34: + return left - right; + case 37: + return left % right; } return undefined; case 7: @@ -16012,17 +21015,16 @@ var ts; case 155: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); - var _enumType; + var enumType; var propertyName; if (e.kind === 65) { - _enumType = currentType; + enumType = currentType; propertyName = e.text; } else { var expression; if (e.kind === 156) { - if (e.argumentExpression === undefined || - e.argumentExpression.kind !== 8) { + if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { return undefined; } expression = e.expression; @@ -16044,15 +21046,15 @@ var ts; return undefined; } } - _enumType = checkExpression(expression); - if (!(_enumType.symbol && (_enumType.symbol.flags & 384))) { + enumType = checkExpression(expression); + if (!(enumType.symbol && (enumType.symbol.flags & 384))) { return undefined; } } if (propertyName === undefined) { return undefined; } - var property = getPropertyOfObjectType(_enumType, propertyName); + var property = getPropertyOfObjectType(enumType, propertyName); if (!property || !(property.flags & 8)) { return undefined; } @@ -16078,11 +21080,14 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); + var enumIsConst = ts.isConst(node); + if (compilerOptions.separateCompilation && enumIsConst && ts.isInAmbientContext(node)) { + error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided); + } var enumSymbol = getSymbolOfNode(node); var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { if (enumSymbol.declarations.length > 1) { - var enumIsConst = ts.isConst(node); ts.forEach(enumSymbol.declarations, function (decl) { if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); @@ -16091,7 +21096,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 201) { + if (declaration.kind !== 204) { return false; } var enumDeclaration = declaration; @@ -16112,9 +21117,9 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 198 || (declaration.kind === 197 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 201 || (declaration.kind === 200 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -16131,10 +21136,7 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 512 - && symbol.declarations.length > 1 - && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -16157,22 +21159,29 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 126) { - node = node.left; + while (true) { + if (node.kind === 126) { + node = node.left; + } + else if (node.kind === 155) { + node = node.expression; + } + else { + break; + } } + ts.Debug.assert(node.kind === 65); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (ts.getFullWidth(moduleName) !== 0 && moduleName.kind !== 8) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { - error(moduleName, node.kind === 212 ? - ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : - ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { + error(moduleName, node.kind === 215 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -16185,13 +21194,9 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | - (symbol.flags & 793056 ? 793056 : 0) | - (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 214 ? - ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : - ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + var message = node.kind === 217 ? 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)); } } @@ -16212,7 +21217,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { checkImportBinding(importClause.namedBindings); } else { @@ -16257,8 +21262,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); } } @@ -16277,8 +21282,8 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 224 ? node.parent : node.parent.parent; - if (container.kind === 202 && container.name.kind === 65) { + var container = node.parent.kind === 227 ? node.parent : node.parent.parent; + if (container.kind === 205 && container.name.kind === 65) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; } @@ -16305,10 +21310,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 224) { + if (node.kind === 227) { return node.statements; } - if (node.kind === 202 && node.body.kind === 203) { + if (node.kind === 205 && node.body.kind === 206) { return node.body.statements; } return emptyArray; @@ -16360,7 +21365,7 @@ var ts; case 137: return checkAccessorDeclaration(node); case 141: - return checkTypeReference(node); + return checkTypeReferenceNode(node); case 144: return checkTypeQuery(node); case 145: @@ -16373,71 +21378,71 @@ var ts; return checkUnionType(node); case 149: return checkSourceElement(node.type); - case 197: + case 200: return checkFunctionDeclaration(node); - case 176: - case 203: - return checkBlock(node); - case 177: - return checkVariableStatement(node); case 179: - return checkExpressionStatement(node); + case 206: + return checkBlock(node); case 180: - return checkIfStatement(node); - case 181: - return checkDoStatement(node); + return checkVariableStatement(node); case 182: - return checkWhileStatement(node); + return checkExpressionStatement(node); case 183: - return checkForStatement(node); + return checkIfStatement(node); case 184: - return checkForInStatement(node); + return checkDoStatement(node); case 185: - return checkForOfStatement(node); + return checkWhileStatement(node); case 186: + return checkForStatement(node); case 187: - return checkBreakOrContinueStatement(node); + return checkForInStatement(node); case 188: - return checkReturnStatement(node); + return checkForOfStatement(node); case 189: - return checkWithStatement(node); case 190: - return checkSwitchStatement(node); + return checkBreakOrContinueStatement(node); case 191: - return checkLabeledStatement(node); + return checkReturnStatement(node); case 192: - return checkThrowStatement(node); + return checkWithStatement(node); case 193: - return checkTryStatement(node); + return checkSwitchStatement(node); + case 194: + return checkLabeledStatement(node); case 195: + return checkThrowStatement(node); + case 196: + return checkTryStatement(node); + case 198: return checkVariableDeclaration(node); case 152: return checkBindingElement(node); - case 198: - return checkClassDeclaration(node); - case 199: - return checkInterfaceDeclaration(node); - case 200: - return checkTypeAliasDeclaration(node); case 201: - return checkEnumDeclaration(node); + return checkClassDeclaration(node); case 202: - return checkModuleDeclaration(node); - case 206: - return checkImportDeclaration(node); + return checkInterfaceDeclaration(node); + case 203: + return checkTypeAliasDeclaration(node); + case 204: + return checkEnumDeclaration(node); case 205: + return checkModuleDeclaration(node); + case 209: + return checkImportDeclaration(node); + case 208: return checkImportEqualsDeclaration(node); - case 212: - return checkExportDeclaration(node); - case 211: - return checkExportAssignment(node); - case 178: - checkGrammarStatementInAmbientContext(node); - return; - case 194: - checkGrammarStatementInAmbientContext(node); - return; case 215: + return checkExportDeclaration(node); + case 214: + return checkExportAssignment(node); + case 181: + checkGrammarStatementInAmbientContext(node); + return; + case 197: + checkGrammarStatementInAmbientContext(node); + return; + case 218: return checkMissingDeclaration(node); } } @@ -16458,10 +21463,10 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 189: + case 192: checkFunctionExpressionBodies(node.expression); break; case 129: @@ -16472,14 +21477,14 @@ var ts; case 152: case 153: case 154: - case 221: + case 224: case 155: case 156: case 157: case 158: case 159: case 171: - case 175: + case 176: case 160: case 161: case 165: @@ -16490,12 +21495,9 @@ var ts; case 169: case 170: case 173: - case 176: - case 203: - case 177: case 179: + case 206: case 180: - case 181: case 182: case 183: case 184: @@ -16503,21 +21505,24 @@ var ts; case 186: case 187: case 188: + case 189: case 190: - case 204: - case 217: - case 218: case 191: - case 192: case 193: + case 207: case 220: + case 221: + case 194: case 195: case 196: - case 198: - case 201: case 223: - case 211: - case 224: + case 198: + case 199: + case 201: + case 204: + case 226: + case 214: + case 227: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -16572,7 +21577,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 189 && node.parent.statement === node) { + if (node.parent.kind === 192 && node.parent.statement === node) { return true; } node = node.parent; @@ -16594,18 +21599,18 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) { break; } - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -16646,17 +21651,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -16674,27 +21679,33 @@ var ts; return symbolsToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 65 && - isTypeDeclaration(name.parent) && - name.parent.name === name; + return name.kind == 65 && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { case 128: - case 198: - case 199: - case 200: case 201: + case 202: + case 203: + case 204: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126) + while (node.parent && node.parent.kind === 126) { node = node.parent; + } return node.parent && node.parent.kind === 141; } - function isTypeNode(node) { + function isHeritageClauseElementIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 155) { + node = node.parent; + } + return node.parent && node.parent.kind === 177; + } + function isTypeNodeOrHeritageClauseElement(node) { if (141 <= node.kind && node.kind <= 149) { return true; } @@ -16709,28 +21720,36 @@ var ts; return node.parent.kind !== 166; case 8: return node.parent.kind === 129; + case 177: + return true; case 65: if (node.parent.kind === 126 && node.parent.right === node) { node = node.parent; } + else if (node.parent.kind === 155 && node.parent.name === node) { + node = node.parent; + } case 126: - ts.Debug.assert(node.kind === 65 || node.kind === 126, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); - var _parent = node.parent; - if (_parent.kind === 144) { + case 155: + ts.Debug.assert(node.kind === 65 || node.kind === 126 || node.kind === 155, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + var parent_5 = node.parent; + if (parent_5.kind === 144) { return false; } - if (141 <= _parent.kind && _parent.kind <= 149) { + if (141 <= parent_5.kind && parent_5.kind <= 149) { return true; } - switch (_parent.kind) { + switch (parent_5.kind) { + case 177: + return true; case 128: - return node === _parent.constraint; + return node === parent_5.constraint; case 132: case 131: case 129: - case 195: - return node === _parent.type; - case 197: + case 198: + return node === parent_5.type; + case 200: case 162: case 163: case 135: @@ -16738,16 +21757,16 @@ var ts; case 133: case 136: case 137: - return node === _parent.type; + return node === parent_5.type; case 138: case 139: case 140: - return node === _parent.type; + return node === parent_5.type; case 160: - return node === _parent.type; + return node === parent_5.type; case 157: case 158: - return _parent.typeArguments && ts.indexOf(_parent.typeArguments, node) >= 0; + return parent_5.typeArguments && ts.indexOf(parent_5.typeArguments, node) >= 0; case 159: return false; } @@ -16758,10 +21777,10 @@ var ts; while (nodeOnRightSide.parent.kind === 126) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 205) { + if (nodeOnRightSide.parent.kind === 208) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 211) { + if (nodeOnRightSide.parent.kind === 214) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -16769,15 +21788,11 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } - function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 && node.parent.right === node) || - (node.parent.kind === 155 && node.parent.name === node); - } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 211) { + if (entityName.parent.kind === 214) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 155) { @@ -16785,11 +21800,16 @@ var ts; return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } } - if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (ts.isExpression(entityName)) { - if (ts.getFullWidth(entityName) === 0) { + if (isHeritageClauseElementIdentifier(entityName)) { + var meaning = entityName.parent.kind === 177 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, meaning); + } + else if (ts.isExpression(entityName)) { + if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 65) { @@ -16804,17 +21824,17 @@ var ts; return getNodeLinks(entityName).resolvedSymbol; } else if (entityName.kind === 126) { - var _symbol = getNodeLinks(entityName).resolvedSymbol; - if (!_symbol) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { checkQualifiedName(entityName); } return getNodeLinks(entityName).resolvedSymbol; } } else if (isTypeReferenceIdentifier(entityName)) { - var _meaning = entityName.parent.kind === 141 ? 793056 : 1536; - _meaning |= 8388608; - return resolveEntityName(entityName, _meaning); + var meaning = entityName.parent.kind === 141 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, meaning); } return undefined; } @@ -16826,9 +21846,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 211 - ? getSymbolOfEntityNameOrPropertyAccessExpression(node) - : getSymbolOfPartOfRightHandSideOfImportEquals(node); + return node.parent.kind === 214 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 65: @@ -16847,10 +21865,7 @@ var ts; return undefined; case 8: var moduleName; - if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && - ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 206 || node.parent.kind === 212) && - node.parent.moduleSpecifier === node)) { + if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === 209 || node.parent.kind === 215) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: @@ -16868,7 +21883,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 222) { + if (location && location.kind === 225) { return resolveEntityName(location.name, 107455); } return undefined; @@ -16877,37 +21892,37 @@ var ts; if (isInsideWithStatementBody(node)) { return unknownType; } + if (isTypeNodeOrHeritageClauseElement(node)) { + return getTypeFromTypeNodeOrHeritageClauseElement(node); + } if (ts.isExpression(node)) { return getTypeOfExpression(node); } - if (isTypeNode(node)) { - return getTypeFromTypeNode(node); - } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); } if (isTypeDeclarationName(node)) { - var _symbol = getSymbolInfo(node); - return _symbol && getDeclaredTypeOfSymbol(_symbol); + var symbol = getSymbolInfo(node); + return symbol && getDeclaredTypeOfSymbol(symbol); } if (ts.isDeclaration(node)) { - var _symbol_1 = getSymbolOfNode(node); - return getTypeOfSymbol(_symbol_1); + var symbol = getSymbolOfNode(node); + return getTypeOfSymbol(symbol); } if (ts.isDeclarationName(node)) { - var _symbol_2 = getSymbolInfo(node); - return _symbol_2 && getTypeOfSymbol(_symbol_2); + var symbol = getSymbolInfo(node); + return symbol && getTypeOfSymbol(symbol); } if (isInRightSideOfImportOrExportAssignment(node)) { - var _symbol_3 = getSymbolInfo(node); - var declaredType = _symbol_3 && getDeclaredTypeOfSymbol(_symbol_3); - return declaredType !== unknownType ? declaredType : getTypeOfSymbol(_symbol_3); + var symbol = getSymbolInfo(node); + var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); + return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); } return unknownType; } function getTypeOfExpression(expr) { - if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } return checkExpression(expr); @@ -16927,22 +21942,26 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols = []; - var _name = symbol.name; + var name_10 = symbol.name; ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { - symbols.push(getPropertyOfType(t, _name)); + symbols.push(getPropertyOfType(t, name_10)); }); return symbols; } else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; if (target) { - return [target]; + return [ + target + ]; } } - return [symbol]; + return [ + symbol + ]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 224; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { if (languageVersion >= 2) { @@ -16950,10 +21969,10 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 207) { + if (node.kind === 210) { return getGeneratedNameForNode(node.parent) + ".default"; } - if (node.kind === 210) { + if (node.kind === 213) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -16970,7 +21989,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 202 || node.kind === 201) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 205 || node.kind === 204) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -16993,29 +22012,33 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 205: - case 207: case 208: case 210: - case 214: + case 211: + case 213: + case 217: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 212: + case 215: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 211: + case 214: return node.expression && node.expression.kind === 65 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 224 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 227 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } - return isAliasResolvedToValue(getSymbolOfNode(node)); + var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); + return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - return target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + if (target === unknownSymbol && compilerOptions.separateCompilation) { + return true; + } + return target !== unknownSymbol && target && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -17028,7 +22051,9 @@ var ts; } } if (checkChildren) { - return ts.forEachChild(node, function (node) { return isReferencedAliasDeclaration(node, checkChildren); }); + return ts.forEachChild(node, function (node) { + return isReferencedAliasDeclaration(node, checkChildren); + }); } return false; } @@ -17036,8 +22061,7 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || - (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -17049,7 +22073,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 223) { + if (node.kind === 226) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -17062,9 +22086,7 @@ var ts; } function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (2048 | 131072)) - ? getTypeOfSymbol(symbol) - : unknownType; + var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -17084,13 +22106,9 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 195 && n.parent.name === n); - var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || - getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 107455 | 8388608, undefined, undefined); - var isLetOrConst = symbol && - (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 220; + var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 198 && n.parent.name === n); + var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); + var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 223; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -17196,17 +22214,17 @@ var ts; case 134: case 133: case 140: - case 198: - case 199: - case 202: case 201: - case 177: - case 197: - case 200: - case 206: + case 202: case 205: - case 212: - case 211: + case 204: + case 180: + case 200: + case 203: + case 209: + case 208: + case 215: + case 214: case 129: break; default: @@ -17217,7 +22235,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 109: @@ -17241,7 +22259,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -17250,7 +22268,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 129) { @@ -17266,7 +22284,7 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 129) { @@ -17278,13 +22296,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 129) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 203) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -17303,10 +22321,10 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 206 || node.kind === 205) && flags & 2) { + else if ((node.kind === 209 || node.kind === 208) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 199 && flags & 2) { + else if (node.kind === 202 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } else if (node.kind === 129 && (flags & 112) && ts.isBindingPattern(node.name)) { @@ -17365,8 +22383,7 @@ var ts; } function checkGrammarFunctionLikeDeclaration(node) { var file = ts.getSourceFileOfNode(node); - return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) || - checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); + return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { if (node.kind === 163) { @@ -17428,23 +22445,21 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || - checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _n = arguments.length; _i < _n; _i++) { + for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 174) { + if (arg.kind === 175) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || - checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -17461,7 +22476,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -17489,7 +22504,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -17535,19 +22550,18 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - var _name = prop.name; - if (prop.kind === 174 || - _name.kind === 127) { - checkGrammarComputedPropertyName(_name); + var name_11 = prop.name; + if (prop.kind === 175 || name_11.kind === 127) { + checkGrammarComputedPropertyName(name_11); continue; } var currentKind = void 0; - if (prop.kind === 221 || prop.kind === 222) { + if (prop.kind === 224 || prop.kind === 225) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (_name.kind === 7) { - checkGrammarNumbericLiteral(_name); + if (name_11.kind === 7) { + checkGrammarNumbericLiteral(name_11); } currentKind = Property; } @@ -17563,26 +22577,26 @@ var ts; else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, _name.text)) { - seen[_name.text] = currentKind; + if (!ts.hasProperty(seen, name_11.text)) { + seen[name_11.text] = currentKind; } else { - var existingKind = seen[_name.text]; + var existingKind = seen[name_11.text]; if (currentKind === Property && existingKind === Property) { if (inStrictMode) { - grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + grammarErrorOnNode(name_11, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); } } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[_name.text] = currentKind | existingKind; + seen[name_11.text] = currentKind | existingKind; } else { - return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name_11, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name_11, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -17591,27 +22605,21 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 196) { + if (forInOrOfStatement.initializer.kind === 199) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 184 - ? 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; + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var _diagnostic = forInOrOfStatement.kind === 184 - ? 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); + var diagnostic = forInOrOfStatement.kind === 187 ? 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_1 = forInOrOfStatement.kind === 184 - ? 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_1); + var diagnostic = forInOrOfStatement.kind === 187 ? 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); } } } @@ -17664,9 +22672,7 @@ var ts; } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionLikeDeclaration(node) || - checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { return true; } if (node.parent.kind === 154) { @@ -17677,7 +22683,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -17688,7 +22694,7 @@ 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 === 199) { + else if (node.parent.kind === 202) { 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 === 145) { @@ -17697,13 +22703,13 @@ var ts; } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return true; - case 191: + case 194: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -17715,18 +22721,17 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 191: + case 194: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 186 - && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 189 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } return false; } break; - case 190: - if (node.kind === 187 && !node.label) { + case 193: + if (node.kind === 190 && !node.label) { return false; } break; @@ -17739,16 +22744,12 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 187 - ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement - : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 190 ? 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 === 187 - ? 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); + var message = node.kind === 190 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); } } function checkGrammarBindingElement(node) { @@ -17764,11 +22765,8 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 184 && node.parent.parent.kind !== 185) { + if (node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { if (ts.isInAmbientContext(node)) { - if (ts.isBindingPattern(node.name)) { - return grammarErrorOnNode(node, ts.Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); - } if (node.initializer) { var equalsTokenLength = "=".length; return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); @@ -17784,8 +22782,7 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || - checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 65) { @@ -17795,7 +22792,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _n = elements.length; _i < _n; _i++) { + for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -17812,15 +22809,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 180: - case 181: - case 182: - case 189: case 183: case 184: case 185: + case 192: + case 186: + case 187: + case 188: return false; - case 191: + case 194: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -17853,7 +22850,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; if (node.name.kind === 127) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -17917,13 +22914,12 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 198) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (node.parent.kind === 201) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -17938,21 +22934,15 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 199 || - node.kind === 206 || - node.kind === 205 || - node.kind === 212 || - node.kind === 211 || - (node.flags & 2) || - (node.flags & (1 | 256))) { + if (node.kind === 202 || node.kind === 209 || node.kind === 208 || node.kind === 215 || node.kind === 214 || (node.flags & 2) || (node.flags & (1 | 256))) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 177) { + if (ts.isDeclaration(decl) || decl.kind === 180) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -17971,10 +22961,10 @@ 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 === 176 || node.parent.kind === 203 || node.parent.kind === 224) { - var _links = getNodeLinks(node.parent); - if (!_links.hasReportedStatementInAmbientContext) { - return _links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + if (node.parent.kind === 179 || node.parent.kind === 206 || node.parent.kind === 227) { + 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); } } else { @@ -18004,6 +22994,7 @@ var ts; } ts.createTypeChecker = createTypeChecker; })(ts || (ts = {})); +/// var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { @@ -18026,7 +23017,8 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { + } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var moduleElementDeclarationEmitInfo = []; var asynchronousSubModuleDeclarationEmitInfo; @@ -18036,9 +23028,7 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 2048) || - ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || - !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 2048) || ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!ts.isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -18051,7 +23041,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 206); + ts.Debug.assert(aliasEmitInfo.node.kind === 209); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -18068,8 +23058,7 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (ts.isExternalModuleOrDeclarationFile(referencedFile) && - !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (ts.isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -18100,17 +23089,17 @@ var ts; } } function createAndSetNewTextWriterWithSymbolWriter() { - var _writer = ts.createTextWriter(newLine); - _writer.trackSymbol = trackSymbol; - _writer.writeKeyword = _writer.write; - _writer.writeOperator = _writer.write; - _writer.writePunctuation = _writer.write; - _writer.writeSpace = _writer.write; - _writer.writeStringLiteral = _writer.writeLiteral; - _writer.writeParameter = _writer.write; - _writer.writeSymbol = _writer.write; - setWriter(_writer); - return _writer; + var writer = ts.createTextWriter(newLine); + writer.trackSymbol = trackSymbol; + writer.writeKeyword = writer.write; + writer.writeOperator = writer.write; + writer.writePunctuation = writer.write; + writer.writeSpace = writer.write; + writer.writeStringLiteral = writer.writeLiteral; + writer.writeParameter = writer.write; + writer.writeSymbol = writer.write; + setWriter(writer); + return writer; } function setWriter(newWriter) { writer = newWriter; @@ -18121,24 +23110,28 @@ var ts; decreaseIndent = newWriter.decreaseIndent; } function writeAsynchronousModuleElements(nodes) { - var _oldWriter = writer; + var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 195) { + if (declaration.kind === 198) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 209 || declaration.kind === 210 || declaration.kind === 207) { + else if (declaration.kind === 212 || declaration.kind === 213 || declaration.kind === 210) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { nodeToCheck = declaration; } - var moduleElementEmitInfo = ts.forEach(moduleElementDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); + var moduleElementEmitInfo = ts.forEach(moduleElementDeclarationEmitInfo, function (declEmitInfo) { + return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; + }); if (!moduleElementEmitInfo && asynchronousSubModuleDeclarationEmitInfo) { - moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); + moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { + return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; + }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 206) { + if (moduleElementEmitInfo.node.kind === 209) { moduleElementEmitInfo.isVisible = true; } else { @@ -18146,12 +23139,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -18159,7 +23152,7 @@ var ts; } } }); - setWriter(_oldWriter); + setWriter(oldWriter); } function handleSymbolAccessibilityError(symbolAccesibilityResult) { if (symbolAccesibilityResult.accessibility === 0) { @@ -18204,14 +23197,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { @@ -18246,6 +23239,8 @@ var ts; case 99: case 8: return writeTextOfNode(currentSourceFile, type); + case 177: + return emitHeritageClauseElement(type); case 141: return emitTypeReference(type); case 144: @@ -18267,11 +23262,9 @@ var ts; return emitEntityName(type); case 126: return emitEntityName(type); - default: - ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 205 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 208 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -18279,10 +23272,22 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var qualifiedName = entityName; - writeEntityName(qualifiedName.left); + var left = entityName.kind === 126 ? entityName.left : entityName.expression; + var right = entityName.kind === 126 ? entityName.right : entityName.name; + writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, qualifiedName.right); + writeTextOfNode(currentSourceFile, right); + } + } + } + function emitHeritageClauseElement(node) { + if (ts.isSupportedHeritageClauseElement(node)) { + ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 155); + emitEntityName(node.expression); + if (node.typeArguments) { + write("<"); + emitCommaList(node.typeArguments, emitType); + write(">"); } } } @@ -18366,10 +23371,9 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 205 || - (node.parent.kind === 224 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 208 || (node.parent.kind === 227 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 224) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -18378,11 +23382,10 @@ var ts; }); } else { - if (node.kind === 206) { + if (node.kind === 209) { var importDeclaration = node; if (importDeclaration.importClause) { - isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || - isVisibleNamedBinding(importDeclaration.importClause.namedBindings); + isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || isVisibleNamedBinding(importDeclaration.importClause.namedBindings); } } moduleElementDeclarationEmitInfo.push({ @@ -18396,23 +23399,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 197: - return writeFunctionDeclaration(node); - case 177: - return writeVariableStatement(node); - case 199: - return writeInterfaceDeclaration(node); - case 198: - return writeClassDeclaration(node); case 200: - return writeTypeAliasDeclaration(node); - case 201: - return writeEnumDeclaration(node); + return writeFunctionDeclaration(node); + case 180: + return writeVariableStatement(node); case 202: - return writeModuleDeclaration(node); + return writeInterfaceDeclaration(node); + case 201: + return writeClassDeclaration(node); + case 203: + return writeTypeAliasDeclaration(node); + case 204: + return writeEnumDeclaration(node); case 205: + return writeModuleDeclaration(node); + case 208: return writeImportEqualsDeclaration(node); - case 206: + case 209: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -18426,7 +23429,7 @@ var ts; if (node.flags & 256) { write("default "); } - else if (node.kind !== 199) { + else if (node.kind !== 202) { write("declare "); } } @@ -18470,11 +23473,13 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 208) { + if (namedBindings.kind === 211) { return resolver.isDeclarationVisible(namedBindings); } else { - return ts.forEach(namedBindings.elements, function (namedImport) { return resolver.isDeclarationVisible(namedImport); }); + return ts.forEach(namedBindings.elements, function (namedImport) { + return resolver.isDeclarationVisible(namedImport); + }); } } } @@ -18496,7 +23501,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -18547,7 +23552,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 203) { + while (node.body.kind !== 206) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -18618,15 +23623,8 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 142 || - node.parent.kind === 143 || - (node.parent.parent && node.parent.parent.kind === 145)) { - ts.Debug.assert(node.parent.kind === 134 || - node.parent.kind === 133 || - node.parent.kind === 142 || - node.parent.kind === 143 || - node.parent.kind === 138 || - node.parent.kind === 139); + if (node.parent.kind === 142 || node.parent.kind === 143 || (node.parent.parent && node.parent.parent.kind === 145)) { + ts.Debug.assert(node.parent.kind === 134 || node.parent.kind === 133 || node.parent.kind === 142 || node.parent.kind === 143 || node.parent.kind === 138 || node.parent.kind === 139); emitType(node.constraint); } else { @@ -18636,10 +23634,10 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 198: + case 201: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 199: + case 202: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 139: @@ -18653,14 +23651,14 @@ var ts; if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { + else if (node.parent.parent.kind === 201) { 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 197: + case 200: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -18685,13 +23683,13 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + if (ts.isSupportedHeritageClauseElement(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 198) { - 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; + if (node.parent.parent.kind === 201) { + diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; @@ -18721,11 +23719,13 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], false); + emitHeritageClause([ + baseTypeNode + ], false); } - emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); write(" {"); writeLine(); increaseIndent(); @@ -18765,7 +23765,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 195 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 198 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -18783,32 +23783,18 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 195) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + if (node.kind === 198) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 132 || node.kind === 131) { if (node.flags & 128) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 198) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + else if (node.parent.kind === 201) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - return symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } } @@ -18821,7 +23807,14 @@ var ts; } : undefined; } function emitBindingPattern(bindingPattern) { - emitCommaList(bindingPattern.elements, emitBindingElement); + var elements = []; + for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 175) { + elements.push(element); + } + } + emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { @@ -18850,7 +23843,9 @@ var ts; } } function isVariableStatementVisible(node) { - return ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + return ts.forEach(node.declarationList.declarations, function (varDeclaration) { + return resolver.isDeclarationVisible(varDeclaration); + }); } function writeVariableStatement(node) { emitJsDocComments(node); @@ -18896,25 +23891,17 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 136 - ? accessor.type - : accessor.parameters.length > 0 - ? accessor.parameters[0].type - : undefined; + return accessor.kind === 136 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 137) { if (accessorWithTypeAnnotation.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -18924,18 +23911,10 @@ var ts; } else { if (accessorWithTypeAnnotation.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { diagnosticMessage: diagnosticMessage, @@ -18951,13 +23930,13 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 197) { + if (node.kind === 200) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 134) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 197) { + if (node.kind === 200) { write("function "); writeTextOfNode(currentSourceFile, node.name); } @@ -19016,48 +23995,28 @@ var ts; var diagnosticMessage; switch (node.kind) { case 139: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 140: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 134: case 133: if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 198) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + else if (node.parent.kind === 201) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 197: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + case 200: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind); @@ -19075,7 +24034,7 @@ var ts; write("..."); } if (ts.isBindingPattern(node.name)) { - write("_" + ts.indexOf(node.parent.parameters, node)); + emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); @@ -19084,88 +24043,109 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 142 || - node.parent.kind === 143 || - node.parent.parent.kind === 145) { + if (node.parent.kind === 142 || node.parent.kind === 143 || node.parent.parent.kind === 145) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage; - switch (node.parent.kind) { - case 135: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - break; - case 139: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - break; - case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - break; - case 134: - case 133: - if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; - } - else if (node.parent.parent.kind === 198) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; - } - else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; - } - break; - case 197: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - break; - default: - ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); - } - return { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: node.name - }; + } : undefined; + } + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { + switch (node.parent.kind) { + case 135: + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + case 139: + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + case 138: + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 134: + case 133: + if (node.parent.flags & 128) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 201) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + case 200: + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + default: + ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); + } + } + function emitBindingPattern(bindingPattern) { + if (bindingPattern.kind === 150) { + write("{"); + emitCommaList(bindingPattern.elements, emitBindingElement); + write("}"); + } + else if (bindingPattern.kind === 151) { + write("["); + var elements = bindingPattern.elements; + emitCommaList(elements, emitBindingElement); + if (elements && elements.hasTrailingComma) { + write(", "); + } + write("]"); + } + } + function emitBindingElement(bindingElement) { + function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: bindingElement, + typeName: bindingElement.name + } : undefined; + } + if (bindingElement.kind === 175) { + write(" "); + } + else if (bindingElement.kind === 152) { + if (bindingElement.propertyName) { + writeTextOfNode(currentSourceFile, bindingElement.propertyName); + write(": "); + emitBindingPattern(bindingElement.name); + } + else if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + emitBindingPattern(bindingElement.name); + } + else { + ts.Debug.assert(bindingElement.name.kind === 65); + if (bindingElement.dotDotDotToken) { + write("..."); + } + writeTextOfNode(currentSourceFile, bindingElement.name); + } + } + } } } function emitNode(node) { switch (node.kind) { - case 197: - case 202: - case 205: - case 199: - case 198: case 200: + case 205: + case 208: + case 202: case 201: + case 203: + case 204: return emitModuleElement(node, isModuleElementVisible(node)); - case 177: + case 180: return emitModuleElement(node, isVariableStatementVisible(node)); - case 206: + case 209: return emitModuleElement(node, !node.importClause); - case 212: + case 215: return emitExportDeclaration(node); case 135: case 134: @@ -19181,20 +24161,16 @@ var ts; case 132: case 131: return emitPropertyDeclaration(node); - case 223: + case 226: return emitEnumMemberDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFile(node); } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 2048 - ? referencedFile.fileName - : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) - ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") - : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 2048 ? referencedFile.fileName : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -19202,26 +24178,27 @@ var ts; function writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics) { var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); if (!emitDeclarationResult.reportedDeclarationError) { - var declarationOutput = emitDeclarationResult.referencePathsOutput - + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); + var declarationOutput = emitDeclarationResult.referencePathsOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, diagnostics, ts.removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, host.getCompilerOptions().emitBOM); } function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) { var appliedSyncOutputPos = 0; - var _declarationOutput = ""; + var declarationOutput = ""; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.asynchronousOutput) { - _declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); - _declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo); + declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); + declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo); appliedSyncOutputPos = aliasEmitInfo.outputPos; } }); - _declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos); - return _declarationOutput; + declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos); + return declarationOutput; } } ts.writeDeclarationFile = writeDeclarationFile; })(ts || (ts = {})); +/// +/// var ts; (function (ts) { function isExternalModuleOrDeclarationFile(sourceFile) { @@ -19285,7 +24262,6 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; - var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var generatedNameSet = {}; var nodeToGeneratedName = []; @@ -19304,11 +24280,15 @@ var ts; var detachedCommentsInfo; var writeComment = ts.writeCommentRange; var emit = emitNodeWithoutSourceMap; - var emitStart = function (node) { }; - var emitEnd = function (node) { }; + var emitStart = function (node) { + }; + var emitEnd = function (node) { + }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - var scopeEmitEnd = function () { }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { + }; + var scopeEmitEnd = function () { + }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); @@ -19331,9 +24311,7 @@ var ts; emit(sourceFile); } function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentSourceFile.identifiers, name) && - !ts.hasProperty(generatedNameSet, name); + return !resolver.hasGlobalName(name) && !ts.hasProperty(currentSourceFile.identifiers, name) && !ts.hasProperty(generatedNameSet, name); } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { @@ -19347,9 +24325,9 @@ var ts; var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var _name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(_name)) { - return _name; + var name_12 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); + if (isUniqueName(name_12)) { + return name_12; } } } @@ -19377,14 +24355,13 @@ var ts; } function generateNameForModuleOrEnum(node) { if (node.name.kind === 65) { - var _name = node.name.text; - assignGeneratedName(node, isUniqueLocalName(_name, node) ? _name : makeUniqueName(_name)); + var name_13 = node.name.text; + assignGeneratedName(node, isUniqueLocalName(name_13, node) ? name_13 : makeUniqueName(name_13)); } } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + var baseName = expr.kind === 8 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; assignGeneratedName(node, makeUniqueName(baseName)); } function generateNameForImportDeclaration(node) { @@ -19404,24 +24381,24 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 197: - case 198: + case 200: + case 201: generateNameForFunctionOrClassDeclaration(node); break; - case 202: + case 205: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 201: + case 204: generateNameForModuleOrEnum(node); break; - case 206: + case 209: generateNameForImportDeclaration(node); break; - case 212: + case 215: generateNameForExportDeclaration(node); break; - case 211: + case 214: generateNameForExportAssignment(node); break; } @@ -19507,12 +24484,7 @@ var ts; sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine != emittedLine || - lastRecordedSourceMapSpan.emittedColumn != emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -19557,8 +24529,8 @@ var ts; if (scopeName) { var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { - var _name = node.name; - if (!_name || _name.kind !== 127) { + var name_14 = node.name; + if (!name_14 || name_14.kind !== 127) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -19575,20 +24547,10 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 197 || - node.kind === 162 || - node.kind === 134 || - node.kind === 133 || - node.kind === 136 || - node.kind === 137 || - node.kind === 202 || - node.kind === 198 || - node.kind === 201) { + else if (node.kind === 200 || node.kind === 162 || node.kind === 134 || node.kind === 133 || node.kind === 136 || node.kind === 137 || node.kind === 205 || node.kind === 201 || node.kind === 204) { if (node.name) { - var _name = node.name; - scopeName = _name.kind === 127 - ? ts.getTextOfNode(_name) - : node.name.text; + var name_15 = node.name; + scopeName = name_15.kind === 127 ? ts.getTextOfNode(name_15) : node.name.text; } recordScopeNameStart(scopeName); } @@ -19671,7 +24633,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 224) { + if (node.kind != 227) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -19756,7 +24718,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -19766,7 +24728,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -19780,7 +24742,7 @@ var ts; write(","); } decreaseIndent(); - if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -19914,8 +24876,7 @@ var ts; if (node.template.kind === 171) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 169 - && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 169 && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -19926,8 +24887,7 @@ var ts; ts.forEachChild(node, emit); return; } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); + var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); if (emitOuterParens) { write("("); } @@ -19938,8 +24898,7 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 161 - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 161 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -19953,6 +24912,19 @@ var ts; write(")"); } function shouldEmitTemplateHead() { + // If this expression has an empty head literal and the first template span has a non-empty + // literal, then emitting the empty head literal is not necessary. + // `${ foo } and ${ bar }` + // can be emitted as + // foo + " and " + bar + // This is because it is only required that one of the first two operands in the emit + // output must be a string literal, so that the other operand and all following operands + // are forced into strings. + // + // If the first template span has an empty literal, then the head must still be emitted. + // `${ foo }${ bar }` + // must still be emitted as + // "" + foo + bar ts.Debug.assert(node.templateSpans.length !== 0); return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; } @@ -20029,38 +25001,38 @@ var ts; } } function isNotExpressionIdentifier(node) { - var _parent = node.parent; - switch (_parent.kind) { + var parent = node.parent; + switch (parent.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: - case 197: + case 200: case 136: case 137: case 162: - case 198: - case 199: case 201: case 202: + case 204: case 205: - case 207: case 208: - return _parent.name === node; case 210: - case 214: - return _parent.name === node || _parent.propertyName === node; - case 187: - case 186: case 211: + return parent.name === node; + case 213: + case 217: + return parent.name === node || parent.propertyName === node; + case 190: + case 189: + case 214: return false; - case 191: + case 194: return node.parent.label === node; } } @@ -20170,8 +25142,8 @@ var ts; function emitListWithSpread(elements, multiLine, trailingComma) { var pos = 0; var group = 0; - var _length = elements.length; - while (pos < _length) { + var length = elements.length; + while (pos < length) { if (group === 1) { write(".concat("); } @@ -20186,14 +25158,14 @@ var ts; } else { var i = pos; - while (i < _length && elements[i].kind !== 173) { + while (i < length && elements[i].kind !== 173) { i++; } write("["); if (multiLine) { increaseIndent(); } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === _length); + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); if (multiLine) { decreaseIndent(); } @@ -20254,9 +25226,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 221: + case 224: return property.initializer; - case 222: + case 225: return createIdentifier(resolver.getExpressionNameSubstitution(property.name, getGeneratedNameForNode)); case 134: return createFunctionExpression(property.parameters, property.body); @@ -20269,8 +25241,8 @@ var ts; var propertyDescriptor = ts.createSynthesizedNode(154); var descriptorProperties = []; if (getAccessor) { - var _getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); - descriptorProperties.push(_getProperty); + var getProperty_1 = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty_1); } if (setAccessor) { var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); @@ -20295,8 +25267,8 @@ var ts; } function createNodeArray() { var elements = []; - for (var _i = 0; _i < arguments.length; _i++) { - elements[_i - 0] = arguments[_i]; + for (var _a = 0; _a < arguments.length; _a++) { + elements[_a - 0] = arguments[_a]; } var result = elements; result.pos = -1; @@ -20311,7 +25283,7 @@ var ts; return result; } function createExpressionStatement(expression) { - var result = ts.createSynthesizedNode(179); + var result = ts.createSynthesizedNode(182); result.expression = expression; return result; } @@ -20330,7 +25302,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(221); + var result = ts.createSynthesizedNode(224); result.name = name; result.initializer = initializer; return result; @@ -20423,6 +25395,9 @@ var ts; } } function tryEmitConstantValue(node) { + if (compilerOptions.separateCompilation) { + return false; + } var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { write(constantValue.toString()); @@ -20435,7 +25410,7 @@ var ts; return false; } function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); @@ -20475,7 +25450,9 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 173; }); + return ts.forEach(elements, function (e) { + return e.kind === 173; + }); } function skipParentheses(node) { while (node.kind === 161 || node.kind === 160) { @@ -20588,14 +25565,7 @@ var ts; while (operand.kind == 160) { operand = operand.expression; } - if (operand.kind !== 167 && - operand.kind !== 166 && - operand.kind !== 165 && - operand.kind !== 164 && - operand.kind !== 168 && - operand.kind !== 158 && - !(operand.kind === 157 && node.parent.kind === 158) && - !(operand.kind === 162 && node.parent.kind === 157)) { + if (operand.kind !== 167 && operand.kind !== 166 && operand.kind !== 165 && operand.kind !== 164 && operand.kind !== 168 && operand.kind !== 158 && !(operand.kind === 157 && node.parent.kind === 158) && !(operand.kind === 162 && node.parent.kind === 157)) { emit(operand); return; } @@ -20638,9 +25608,8 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 53 && - (node.left.kind === 154 || node.left.kind === 153)) { - emitDestructuring(node, node.parent.kind === 179); + if (languageVersion < 2 && node.operatorToken.kind === 53 && (node.left.kind === 154 || node.left.kind === 153)) { + emitDestructuring(node, node.parent.kind === 182); } else { emit(node.left); @@ -20676,13 +25645,13 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 176) { + if (node && node.kind === 179) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { - if (preserveNewLines && isSingleLineEmptyBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -20691,12 +25660,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 203) { - ts.Debug.assert(node.parent.kind === 202); + if (node.kind === 206) { + ts.Debug.assert(node.parent.kind === 205); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 203) { + if (node.kind === 206) { emitTempDeclarations(true); } decreaseIndent(); @@ -20705,7 +25674,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 176) { + if (node.kind === 179) { write(" "); emit(node); } @@ -20730,7 +25699,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76, node.thenStatement.end); - if (node.elseStatement.kind === 180) { + if (node.elseStatement.kind === 183) { write(" "); emit(node.elseStatement); } @@ -20742,7 +25711,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { write(" "); } else { @@ -20786,7 +25755,7 @@ var ts; var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 196) { + if (node.initializer && node.initializer.kind === 199) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; emitStartOfVariableDeclarationList(declarations[0], endPos); @@ -20804,13 +25773,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 185) { + if (languageVersion < 2 && node.kind === 188) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; @@ -20822,7 +25791,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 184) { + if (node.kind === 187) { write(" in "); } else { @@ -20833,13 +25802,32 @@ var ts; emitEmbeddedStatement(node.statement); } function emitDownLevelForOfStatement(node) { + // The following ES6 code: + // + // for (let v of expr) { } + // + // should be emitted as + // + // for (let _i = 0, _a = expr; _i < _a.length; _i++) { + // let v = _a[_i]; + // } + // + // where _a and _i are temps emitted to capture the RHS and the counter, + // respectively. + // When the left hand side is an expression instead of a let declaration, + // the "let v" is not emitted. + // When the left hand side is a let/const, the v is renamed if there is + // another v in scope. + // Note that all assignments to the LHS are emitted in the body, including + // all destructuring. + // Note also that because an extra statement is needed to assign to the LHS, + // for-of bodies are always emitted as blocks. var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); var rhsIsIdentifier = node.expression.kind === 65; var counter = createTempVariable(268435456); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(536870912) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -20853,24 +25841,12 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } - if (cachedLength) { - write(", "); - emitNodeWithoutSourceMap(cachedLength); - write(" = "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - if (cachedLength) { - emitNodeWithoutSourceMap(cachedLength); - } - else { - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } + emitNodeWithoutSourceMap(rhsReference); + write(".length"); emitEnd(node.initializer); write("; "); emitStart(node.initializer); @@ -20883,7 +25859,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -20914,7 +25890,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { emitLines(node.statement.statements); } else { @@ -20926,7 +25902,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 187 ? 66 : 71, node.pos); + emitToken(node.kind === 190 ? 66 : 71, node.pos); emitOptional(" ", node.label); write(";"); } @@ -20959,19 +25935,16 @@ var ts; emitToken(15, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, node2.end); + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === ts.getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 217) { + if (node.kind === 220) { write("case "); emit(node.expression); write(":"); @@ -20979,7 +25952,7 @@ var ts; else { write("default:"); } - if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -21026,7 +25999,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 202); + } while (node && node.kind !== 205); return node; } function emitContainingModuleName(node) { @@ -21059,11 +26032,11 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (node.name) { - emitModuleMemberName(node); + if (node.flags & 256) { + write("exports.default"); } else { - write("exports.default"); + emitModuleMemberName(node); } write(" = "); emitDeclarationName(node); @@ -21073,8 +26046,8 @@ var ts; } function emitExportMemberAssignments(name) { if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _i = 0, _a = exportSpecifiers[name.text], _n = _a.length; _i < _n; _i++) { - var specifier = _a[_i]; + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { + var specifier = _b[_a]; writeLine(); emitStart(specifier.name); emitContainingModuleName(specifier); @@ -21089,7 +26062,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var _isDeclaration = (root.kind === 195 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; + var isDeclaration = (root.kind === 198 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; if (root.kind === 169) { emitAssignmentExpression(root); } @@ -21102,7 +26075,7 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 195 || name.parent.kind === 152)) { + if (name.parent && (name.parent.kind === 198 || name.parent.kind === 152)) { emitModuleMemberName(name.parent); } else { @@ -21114,7 +26087,7 @@ var ts; function ensureIdentifier(expr) { if (expr.kind !== 65) { var identifier = createTempVariable(0); - if (!_isDeclaration) { + if (!isDeclaration) { recordTempDeclaration(identifier); } emitAssignment(identifier, expr); @@ -21169,9 +26142,9 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _i = 0, _n = properties.length; _i < _n; _i++) { - var p = properties[_i]; - if (p.kind === 221 || p.kind === 222) { + for (var _a = 0; _a < properties.length; _a++) { + var p = properties[_a]; + if (p.kind === 224 || p.kind === 225) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -21184,7 +26157,7 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } @@ -21215,18 +26188,18 @@ var ts; } function emitAssignmentExpression(root) { var target = root.left; - var _value = root.right; + var value = root.right; if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, _value); + emitDestructuringAssignment(target, value); } else { if (root.parent.kind !== 161) { write("("); } - _value = ensureIdentifier(_value); - emitDestructuringAssignment(target, _value); + value = ensureIdentifier(value); + emitDestructuringAssignment(target, value); write(", "); - emit(_value); + emit(value); if (root.parent.kind !== 161) { write(")"); } @@ -21251,7 +26224,7 @@ var ts; var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 174) { + else if (element.kind !== 175) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -21285,11 +26258,8 @@ var ts; emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && - (getCombinedFlagsForIdentifier(node.name) & 4096); - if (isUninitializedLet && - node.parent.parent.kind !== 184 && - node.parent.parent.kind !== 185) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); + if (isUninitializedLet && node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { initializer = createVoidZero(); } } @@ -21297,48 +26267,43 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 174) { + if (node.kind === 175) { return; } - var _name = node.name; - if (_name.kind === 65) { - emitExportMemberAssignments(_name); + var name = node.name; + if (name.kind === 65) { + emitExportMemberAssignments(name); } - else if (ts.isBindingPattern(_name)) { - ts.forEach(_name.elements, emitExportVariableAssignments); + else if (ts.isBindingPattern(name)) { + ts.forEach(name.elements, emitExportVariableAssignments); } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 195 && node.parent.kind !== 152)) { + if (!node.parent || (node.parent.kind !== 198 && node.parent.kind !== 152)) { return 0; } return ts.getCombinedNodeFlags(node.parent); } function renameNonTopLevelLetAndConst(node) { - if (languageVersion >= 2 || - ts.nodeIsSynthesized(node) || - node.kind !== 65 || - (node.parent.kind !== 195 && node.parent.kind !== 152)) { + if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 65 || (node.parent.kind !== 198 && node.parent.kind !== 152)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); if (((combinedFlags & 12288) === 0) || combinedFlags & 1) { return; } - var list = ts.getAncestor(node, 196); - if (list.parent.kind === 177) { - var isSourceFileLevelBinding = list.parent.parent.kind === 224; - var isModuleLevelBinding = list.parent.parent.kind === 203; - var isFunctionLevelBinding = list.parent.parent.kind === 176 && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 199); + if (list.parent.kind === 180) { + var isSourceFileLevelBinding = list.parent.parent.kind === 227; + var isModuleLevelBinding = list.parent.parent.kind === 206; + var isFunctionLevelBinding = list.parent.parent.kind === 179 && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var _parent = blockScopeContainer.kind === 224 - ? blockScopeContainer - : blockScopeContainer.parent; - if (resolver.resolvesToSomeValue(_parent, node.text)) { + var parent = blockScopeContainer.kind === 227 ? blockScopeContainer : blockScopeContainer.parent; + if (resolver.resolvesToSomeValue(parent, node.text)) { var variableId = resolver.getBlockScopedVariableId(node); if (!blockScopedVariableToGeneratedName) { blockScopedVariableToGeneratedName = []; @@ -21348,9 +26313,7 @@ var ts; } } function isES6ExportedDeclaration(node) { - return !!(node.flags & 1) && - languageVersion >= 2 && - node.parent.kind === 224; + return !!(node.flags & 1) && languageVersion >= 2 && node.parent.kind === 227; } function emitVariableStatement(node) { if (!(node.flags & 1)) { @@ -21369,12 +26332,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2) { if (ts.isBindingPattern(node.name)) { - var _name = createTempVariable(0); + var name_16 = createTempVariable(0); if (!tempParameters) { tempParameters = []; } - tempParameters.push(_name); - emit(_name); + tempParameters.push(name_16); + emit(name_16); } else { emit(node.name); @@ -21475,8 +26438,8 @@ var ts; if (node.kind === 162) { return !!node.name; } - else if (node.kind === 197) { - return !!node.name || (languageVersion >= 2 && !(node.flags & 256)); + if (node.kind === 200) { + return !!node.name || languageVersion < 2; } } function emitFunctionDeclaration(node) { @@ -21499,7 +26462,7 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 197 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 200 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } if (node.kind !== 134 && node.kind !== 133) { @@ -21549,7 +26512,7 @@ var ts; if (!node.body) { write(" { }"); } - else if (node.body.kind === 176) { + else if (node.body.kind === 179) { emitBlockFunctionBody(node, node.body); } else { @@ -21588,7 +26551,7 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); @@ -21625,9 +26588,9 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { - var statement = _a[_i]; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { + var statement = _b[_a]; write(" "); emit(statement); } @@ -21649,7 +26612,7 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 179) { + if (statement && statement.kind === 182) { var expr = statement.expression; if (expr && expr.kind === 157) { var func = expr.expression; @@ -21715,7 +26678,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 134 || node.kind === 133) { + if (member.kind === 178) { + writeLine(); + write(";"); + } + else if (member.kind === 134 || node.kind === 133) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -21782,12 +26749,12 @@ var ts; }); } function emitMemberFunctionsForES6AndHigher(node) { - for (var _i = 0, _a = node.members, _n = _a.length; _i < _n; _i++) { - var member = _a[_i]; + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; if ((member.kind === 134 || node.kind === 133) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 || node.kind === 133 || member.kind === 136 || member.kind === 137) { + else if (member.kind === 134 || member.kind === 136 || member.kind === 137) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -21805,9 +26772,13 @@ var ts; emitEnd(member); emitTrailingComments(member); } + else if (member.kind === 178) { + writeLine(); + write(";"); + } } } - function emitConstructor(node, baseTypeNode) { + function emitConstructor(node, baseTypeElement) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; @@ -21842,7 +26813,7 @@ var ts; emitSignatureParameters(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { write("(...args)"); } else { @@ -21860,7 +26831,7 @@ var ts; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); - if (baseTypeNode) { + if (baseTypeElement) { var superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); @@ -21870,16 +26841,16 @@ var ts; emitParameterPropertyAssignments(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { writeLine(); - emitStart(baseTypeNode); + emitStart(baseTypeElement); if (languageVersion < 2) { write("_super.apply(this, arguments);"); } else { write("super(...args);"); } - emitEnd(baseTypeNode); + emitEnd(baseTypeElement); } } emitMemberAssignments(node, 0); @@ -21906,28 +26877,36 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { if (languageVersion < 2) { - emitClassDeclarationBelowES6(node); + emitClassLikeDeclarationBelowES6(node); } else { - emitClassDeclarationForES6AndHigher(node); + emitClassLikeDeclarationForES6AndHigher(node); } } - function emitClassDeclarationForES6AndHigher(node) { + function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { - write("export "); + if (node.kind === 201) { + if (thisNodeIsDecorated) { + if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 256) { - write("default "); + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 256) { + write("default "); + } } } write("class"); @@ -21935,10 +26914,10 @@ var ts; write(" "); emitDeclarationName(node); } - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write(" extends "); - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); } write(" {"); increaseIndent(); @@ -21981,11 +26960,14 @@ var ts; write(";"); } } - function emitClassDeclarationBelowES6(node) { - write("var "); - emitDeclarationName(node); - write(" = (function ("); - var baseTypeNode = ts.getClassBaseTypeNode(node); + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 201) { + write("var "); + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write("_super"); } @@ -22032,11 +27014,16 @@ var ts; emitStart(node); write(")("); if (baseTypeNode) { - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 201) { + write(";"); } - write(");"); emitEnd(node); - emitExportMemberAssignment(node); + if (node.kind === 201) { + emitExportMemberAssignment(node); + } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } @@ -22180,7 +27167,7 @@ var ts; } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums; + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.separateCompilation; } function emitEnumDeclaration(node) { if (!shouldEmitEnumDeclaration(node)) { @@ -22259,13 +27246,13 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 202) { + if (moduleDeclaration.body.kind === 205) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } } function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation); } function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); @@ -22287,7 +27274,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 203) { + if (node.body.kind === 206) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -22336,16 +27323,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 208) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 206 && node.importClause && !!node.importClause.name; + return node.kind === 209 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -22372,7 +27359,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -22398,7 +27385,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 205 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 208 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -22410,7 +27397,7 @@ var ts; write(" = "); } else { - var isNakedImport = 206 && !node.importClause; + var isNakedImport = 209 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -22452,8 +27439,7 @@ var ts; emitExternalImportDeclaration(node); return; } - if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + if (resolver.isReferencedAliasDeclaration(node) || (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); if (isES6ExportedDeclaration(node)) { @@ -22485,8 +27471,8 @@ var ts; emitRequire(ts.getExternalModuleName(node)); write(";"); } - for (var _i = 0, _a = node.exportClause.elements, _n = _a.length; _i < _n; _i++) { - var specifier = _a[_i]; + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { + var specifier = _b[_a]; if (resolver.isValueAliasDeclaration(specifier)) { writeLine(); emitStart(specifier); @@ -22540,8 +27526,8 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(languageVersion >= 2); var needsComma = false; - for (var _i = 0, _n = specifiers.length; _i < _n; _i++) { - var specifier = specifiers[_i]; + for (var _a = 0; _a < specifiers.length; _a++) { + var specifier = specifiers[_a]; if (shouldEmit(specifier)) { if (needsComma) { write(", "); @@ -22565,8 +27551,7 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 197 && - expression.kind !== 198) { + if (expression.kind !== 200 && expression.kind !== 201) { write(";"); } emitEnd(node); @@ -22587,21 +27572,20 @@ var ts; exportSpecifiers = {}; exportEquals = undefined; hasExportStars = false; - for (var _i = 0, _a = sourceFile.statements, _n = _a.length; _i < _n; _i++) { - var node = _a[_i]; + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { + var node = _b[_a]; switch (node.kind) { - case 206: - if (!node.importClause || - resolver.isReferencedAliasDeclaration(node.importClause, true)) { + case 209: + if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 205: - if (node.moduleReference.kind === 216 && resolver.isReferencedAliasDeclaration(node)) { + case 208: + if (node.moduleReference.kind === 219 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 212: + case 215: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -22612,14 +27596,14 @@ var ts; } } else { - for (var _b = 0, _c = node.exportClause.elements, _d = _c.length; _b < _d; _b++) { - var specifier = _c[_b]; - var _name = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[_name] || (exportSpecifiers[_name] = [])).push(specifier); + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; + var name_17 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_17] || (exportSpecifiers[name_17] = [])).push(specifier); } } break; - case 211: + case 214: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -22661,8 +27645,8 @@ var ts; write("\"" + node.amdModuleName + "\", "); } write("[\"require\", \"exports\""); - for (var _i = 0, _n = externalImports.length; _i < _n; _i++) { - var importNode = externalImports[_i]; + for (var _a = 0; _a < externalImports.length; _a++) { + var importNode = externalImports[_a]; write(", "); var moduleName = ts.getExternalModuleName(importNode); if (moduleName.kind === 8) { @@ -22672,29 +27656,29 @@ var ts; write("\"\""); } } - for (var _a = 0, _b = node.amdDependencies, _c = _b.length; _a < _c; _a++) { - var amdDependency = _b[_a]; + for (var _b = 0, _c = node.amdDependencies; _b < _c.length; _b++) { + var amdDependency = _c[_b]; var text = "\"" + amdDependency.path + "\""; write(", "); write(text); } write("], function (require, exports"); - for (var _d = 0, _e = externalImports.length; _d < _e; _d++) { - var _importNode = externalImports[_d]; + for (var _d = 0; _d < externalImports.length; _d++) { + var importNode = externalImports[_d]; write(", "); - var namespaceDeclaration = getNamespaceDeclarationNode(_importNode); - if (namespaceDeclaration && !isDefaultImport(_importNode)) { + var namespaceDeclaration = getNamespaceDeclarationNode(importNode); + if (namespaceDeclaration && !isDefaultImport(importNode)) { emit(namespaceDeclaration.name); } else { - write(getGeneratedNameForNode(_importNode)); + write(getGeneratedNameForNode(importNode)); } } - for (var _f = 0, _g = node.amdDependencies, _h = _g.length; _f < _h; _f++) { - var _amdDependency = _g[_f]; - if (_amdDependency.name) { + for (var _e = 0, _f = node.amdDependencies; _e < _f.length; _e++) { + var amdDependency = _f[_e]; + if (amdDependency.name) { write(", "); - write(_amdDependency.name); + write(amdDependency.name); } } write(") {"); @@ -22813,34 +27797,30 @@ var ts; if (node.flags & 2) { return emitOnlyPinnedOrTripleSlashComments(node); } - var _emitComments = shouldEmitLeadingAndTrailingComments(node); - if (_emitComments) { + var emitComments = shouldEmitLeadingAndTrailingComments(node); + if (emitComments) { emitLeadingComments(node); } emitJavaScriptWorker(node, allowGeneratedIdentifiers); - if (_emitComments) { + if (emitComments) { emitTrailingComments(node); } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 199: - case 197: - case 206: - case 205: - case 200: - case 211: - return false; case 202: + case 200: + case 209: + case 208: + case 203: + case 214: + return false; + case 205: return shouldEmitModuleDeclaration(node); - case 201: + case 204: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 176 && - node.parent && - node.parent.kind === 163 && - node.parent.body === node && - compilerOptions.target <= 1) { + if (node.kind !== 179 && node.parent && node.parent.kind === 163 && node.parent.body === node && compilerOptions.target <= 1) { return false; } return true; @@ -22878,7 +27858,7 @@ var ts; return emitLiteral(node); case 171: return emitTemplateExpression(node); - case 175: + case 176: return emitTemplateSpan(node); case 126: return emitQualifiedName(node); @@ -22892,9 +27872,9 @@ var ts; return emitArrayLiteral(node); case 154: return emitObjectLiteral(node); - case 221: + case 224: return emitPropertyAssignment(node); - case 222: + case 225: return emitShorthandPropertyAssignment(node); case 127: return emitComputedPropertyName(node); @@ -22912,7 +27892,7 @@ var ts; return emit(node.expression); case 161: return emitParenExpression(node); - case 197: + case 200: case 162: case 163: return emitFunctionDeclaration(node); @@ -22932,71 +27912,73 @@ var ts; return emitConditionalExpression(node); case 173: return emitSpreadElementExpression(node); - case 174: + case 175: return; - case 176: - case 203: - return emitBlock(node); - case 177: - return emitVariableStatement(node); - case 178: - return write(";"); case 179: - return emitExpressionStatement(node); - case 180: - return emitIfStatement(node); - case 181: - return emitDoStatement(node); - case 182: - return emitWhileStatement(node); - case 183: - return emitForStatement(node); - case 185: - case 184: - return emitForInOrForOfStatement(node); - case 186: - case 187: - return emitBreakOrContinueStatement(node); - case 188: - return emitReturnStatement(node); - case 189: - return emitWithStatement(node); - case 190: - return emitSwitchStatement(node); - case 217: - case 218: - return emitCaseOrDefaultClause(node); - case 191: - return emitLabelledStatement(node); - case 192: - return emitThrowStatement(node); - case 193: - return emitTryStatement(node); - case 220: - return emitCatchClause(node); - case 194: - return emitDebuggerStatement(node); - case 195: - return emitVariableDeclaration(node); - case 198: - return emitClassDeclaration(node); - case 199: - return emitInterfaceDeclaration(node); - case 201: - return emitEnumDeclaration(node); - case 223: - return emitEnumMember(node); - case 202: - return emitModuleDeclaration(node); case 206: - return emitImportDeclaration(node); + return emitBlock(node); + case 180: + return emitVariableStatement(node); + case 181: + return write(";"); + case 182: + return emitExpressionStatement(node); + case 183: + return emitIfStatement(node); + case 184: + return emitDoStatement(node); + case 185: + return emitWhileStatement(node); + case 186: + return emitForStatement(node); + case 188: + case 187: + return emitForInOrForOfStatement(node); + case 189: + case 190: + return emitBreakOrContinueStatement(node); + case 191: + return emitReturnStatement(node); + case 192: + return emitWithStatement(node); + case 193: + return emitSwitchStatement(node); + case 220: + case 221: + return emitCaseOrDefaultClause(node); + case 194: + return emitLabelledStatement(node); + case 195: + return emitThrowStatement(node); + case 196: + return emitTryStatement(node); + case 223: + return emitCatchClause(node); + case 197: + return emitDebuggerStatement(node); + case 198: + return emitVariableDeclaration(node); + case 174: + return emitClassExpression(node); + case 201: + return emitClassDeclaration(node); + case 202: + return emitInterfaceDeclaration(node); + case 204: + return emitEnumDeclaration(node); + case 226: + return emitEnumMember(node); case 205: + return emitModuleDeclaration(node); + case 209: + return emitImportDeclaration(node); + case 208: return emitImportEqualsDeclaration(node); - case 212: + case 215: return emitExportDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFileNode(node); } } @@ -23024,7 +28006,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.pos !== node.parent.pos) { + if (node.parent.kind === 227 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -23036,7 +28018,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.end !== node.parent.end) { + if (node.parent.kind === 227 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -23065,7 +28047,10 @@ var ts; leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } leadingComments = filterComments(leadingComments, compilerOptions.removeComments); - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { + pos: pos, + end: pos + }, leadingComments); ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedComments(node) { @@ -23090,12 +28075,17 @@ var ts; if (nodeLine >= lastCommentLine + 2) { ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + var currentDetachedCommentInfo = { + nodePos: node.pos, + detachedCommentEndPos: detachedComments[detachedComments.length - 1].end + }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } else { - detachedCommentsInfo = [currentDetachedCommentInfo]; + detachedCommentsInfo = [ + currentDetachedCommentInfo + ]; } } } @@ -23105,10 +28095,7 @@ var ts; if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && - currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -23122,13 +28109,15 @@ var ts; } ts.emitFiles = emitFiles; })(ts || (ts = {})); +/// +/// var ts; (function (ts) { ts.programTime = 0; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0.0"; + ts.version = "1.5.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -23161,9 +28150,7 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode - ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText - : e.message); + onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); } text = ""; } @@ -23201,12 +28188,20 @@ var ts; } return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibFileName: function (options) { + return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); + }, writeFile: writeFile, - getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, - useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCurrentDirectory: function () { + return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); + }, + useCaseSensitiveFileNames: function () { + return ts.sys.useCaseSensitiveFileNames; + }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { return ts.sys.newLine; } + getNewLine: function () { + return ts.sys.newLine; + } }; } ts.createCompilerHost = createCompilerHost; @@ -23252,7 +28247,9 @@ var ts; var noDiagnosticsTypeChecker; var start = new Date().getTime(); host = host || createCompilerHost(options); - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + ts.forEach(rootNames, function (name) { + return processRootFile(name, false); + }); if (!seenNoDefaultLib) { processRootFile(host.getDefaultLibFileName(options), true); } @@ -23260,21 +28257,35 @@ var ts; ts.programTime += new Date().getTime() - start; program = { getSourceFile: getSourceFile, - getSourceFiles: function () { return files; }, - getCompilerOptions: function () { return options; }, + getSourceFiles: function () { + return files; + }, + getCompilerOptions: function () { + return options; + }, getSyntacticDiagnostics: getSyntacticDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getTypeChecker: getTypeChecker, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { return commonSourceDirectory; }, + getCommonSourceDirectory: function () { + return commonSourceDirectory; + }, emit: emit, getCurrentDirectory: host.getCurrentDirectory, - getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, - getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, - getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, - getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + getNodeCount: function () { + return getDiagnosticsProducingTypeChecker().getNodeCount(); + }, + getIdentifierCount: function () { + return getDiagnosticsProducingTypeChecker().getIdentifierCount(); + }, + getSymbolCount: function () { + return getDiagnosticsProducingTypeChecker().getSymbolCount(); + }, + getTypeCount: function () { + return getDiagnosticsProducingTypeChecker().getTypeCount(); + } }; return program; function getEmitHost(writeFileCallback) { @@ -23297,12 +28308,16 @@ var ts; } function emit(sourceFile, writeFileCallback) { if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { - return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + return { + diagnostics: [], + sourceMaps: undefined, + emitSkipped: true + }; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); - var _start = new Date().getTime(); + var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); - ts.emitTime += new Date().getTime() - _start; + ts.emitTime += new Date().getTime() - start; return emitResult; } function getSourceFile(fileName) { @@ -23342,7 +28357,8 @@ var ts; function getDeclarationDiagnosticsForFile(sourceFile) { if (!ts.isDeclarationFile(sourceFile)) { var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); - var writeFile = function () { }; + var writeFile = function () { + }; return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); } } @@ -23360,11 +28376,11 @@ var ts; processSourceFile(ts.normalizePath(fileName), isDefaultLib); } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var _start; - var _length; + var start; + var length; if (refEnd !== undefined && refPos !== undefined) { - _start = refPos; - _length = refEnd - refPos; + start = refPos; + length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { @@ -23389,7 +28405,7 @@ var ts; } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, _start, _length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); } else { diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); @@ -23433,14 +28449,14 @@ var ts; return file; } function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { - var _file = filesByName[canonicalName]; - if (_file && host.useCaseSensitiveFileNames()) { - var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(_file.fileName, host.getCurrentDirectory()) : _file.fileName; + var file = filesByName[canonicalName]; + if (file && host.useCaseSensitiveFileNames()) { + var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } - return _file; + return file; } } function processReferencedFiles(file, basePath) { @@ -23451,7 +28467,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 206 || node.kind === 205 || node.kind === 212) { + if (node.kind === 209 || node.kind === 208 || node.kind === 215) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -23471,17 +28487,16 @@ var ts; } } } - else if (node.kind === 202 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 205 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { - var _searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(_searchName + ".ts", nameLiteral); + var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); + var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); if (!tsFile) { - findModuleSourceFile(_searchName + ".d.ts", nameLiteral); + findModuleSourceFile(searchName + ".d.ts", nameLiteral); } } } @@ -23493,6 +28508,20 @@ var ts; } } function verifyCompilerOptions() { + if (options.separateCompilation) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation)); + } + if (options.declaration) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation)); + } + if (options.noEmitOnError) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation)); + } + if (options.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); + } + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); @@ -23503,24 +28532,32 @@ var ts; return; } var languageVersion = options.target || 0; - var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); - if (firstExternalModuleSourceFile && !options.module) { + var firstExternalModuleSourceFile = ts.forEach(files, function (f) { + return ts.isExternalModule(f) ? f : undefined; + }); + if (options.separateCompilation) { if (!options.module && languageVersion < 2) { - var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } + var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { + return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; + }); + if (firstNonExternalModuleSourceFile) { + var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + } + } + else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { + var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher)); } - if (options.outDir || - options.sourceRoot || - (options.mapRoot && - (!options.out || firstExternalModuleSourceFile !== undefined))) { + if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) - && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + if (!(sourceFile.flags & 2048) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); if (commonPathComponents) { @@ -23560,6 +28597,10 @@ var ts; } ts.createProgram = createProgram; })(ts || (ts = {})); +/// +/// +/// +/// var ts; (function (ts) { ts.optionDeclarations = [ @@ -23567,10 +28608,6 @@ var ts; name: "charset", type: "string" }, - { - name: "codepage", - type: "number" - }, { name: "declaration", shortName: "d", @@ -23636,10 +28673,6 @@ var ts; name: "noLib", type: "boolean" }, - { - name: "noLibCheck", - type: "boolean" - }, { name: "noResolve", type: "boolean" @@ -23675,6 +28708,10 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "separateCompilation", + type: "boolean" + }, { name: "sourceMap", type: "boolean", @@ -23698,22 +28735,14 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, - { - name: "preserveNewLines", - type: "boolean", - description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, - experimental: true - }, - { - name: "cacheDownlevelForOfLength", - type: "boolean", - description: "Cache length access when downlevel emitting for-of statements", - experimental: true - }, { name: "target", shortName: "t", - type: { "es3": 0, "es5": 1, "es6": 2 }, + type: { + "es3": 0, + "es5": 1, + "es6": 2 + }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 @@ -23893,7 +28922,9 @@ var ts; var files = []; if (ts.hasProperty(json, "files")) { if (json["files"] instanceof Array) { - var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); + var files = ts.map(json["files"], function (s) { + return ts.combinePaths(basePath, s); + }); } } else { @@ -23910,6 +28941,8 @@ var ts; } ts.parseConfigFile = parseConfigFile; })(ts || (ts = {})); +/// +/// var ts; (function (ts) { function validateLocaleAndSetLanguage(locale, errors) { @@ -23920,8 +28953,7 @@ var ts; } var language = matchResult[1]; var territory = matchResult[3]; - if (!trySetLanguageAndTerritory(language, territory, errors) && - !trySetLanguageAndTerritory(language, undefined, errors)) { + if (!trySetLanguageAndTerritory(language, territory, errors) && !trySetLanguageAndTerritory(language, undefined, errors)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_locale_0, locale)); return false; } @@ -24021,32 +29053,32 @@ var ts; if (commandLine.options.locale) { if (!isJSONSupported()) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale")); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors); } if (commandLine.errors.length > 0) { reportDiagnostics(commandLine.errors); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } if (commandLine.options.version) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Version_0, ts.version)); - return ts.sys.exit(0); + return ts.sys.exit(ts.ExitStatus.Success); } if (commandLine.options.help) { printVersion(); printHelp(); - return ts.sys.exit(0); + return ts.sys.exit(ts.ExitStatus.Success); } if (commandLine.options.project) { if (!isJSONSupported()) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--project")); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } configFileName = ts.normalizePath(ts.combinePaths(commandLine.options.project, "tsconfig.json")); if (commandLine.fileNames.length !== 0) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } } else if (commandLine.fileNames.length === 0 && isJSONSupported()) { @@ -24056,12 +29088,12 @@ var ts; if (commandLine.fileNames.length === 0 && !configFileName) { printVersion(); printHelp(); - return ts.sys.exit(0); + return ts.sys.exit(ts.ExitStatus.Success); } if (commandLine.options.watch) { if (!ts.sys.watchFile) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } if (configFileName) { configFileWatcher = ts.sys.watchFile(configFileName, configFileChanged); @@ -24074,12 +29106,12 @@ var ts; var configObject = ts.readConfigFile(configFileName); if (!configObject) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, configFileName)); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } var configParseResult = ts.parseConfigFile(configObject, ts.getDirectoryPath(configFileName)); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } rootFileNames = configParseResult.fileNames; compilerOptions = ts.extend(commandLine.options, configParseResult.options); @@ -24108,7 +29140,9 @@ var ts; } var sourceFile = hostGetSourceFile(fileName, languageVersion, onError); if (sourceFile && compilerOptions.watch) { - sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function () { return sourceFileChanged(sourceFile); }); + sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function () { + return sourceFileChanged(sourceFile); + }); } return sourceFile; } @@ -24127,6 +29161,7 @@ var ts; cachedProgram = program; } function sourceFileChanged(sourceFile) { + sourceFile.fileWatcher.close(); sourceFile.fileWatcher = undefined; startTimer(); } @@ -24180,7 +29215,10 @@ var ts; reportTimeStatistic("Emit time", ts.emitTime); reportTimeStatistic("Total time", ts.programTime + ts.bindTime + ts.checkTime + ts.emitTime); } - return { program: program, exitStatus: exitStatus }; + return { + program: program, + exitStatus: exitStatus + }; function compileProgram() { var diagnostics = program.getSyntacticDiagnostics(); reportDiagnostics(diagnostics); @@ -24193,19 +29231,17 @@ var ts; } } if (compilerOptions.noEmit) { - return diagnostics.length - ? 1 - : 0; + return diagnostics.length ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success; } var emitOutput = program.emit(); reportDiagnostics(emitOutput.diagnostics); if (emitOutput.emitSkipped) { - return 1; + return ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } if (diagnostics.length > 0 || emitOutput.diagnostics.length > 0) { - return 2; + return ts.ExitStatus.DiagnosticsPresent_OutputsGenerated; } - return 0; + return ts.ExitStatus.Success; } } function printVersion() { @@ -24226,8 +29262,12 @@ var ts; output += padding + "tsc @args.txt" + ts.sys.newLine; output += ts.sys.newLine; output += getDiagnosticText(ts.Diagnostics.Options_Colon) + ts.sys.newLine; - var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { return !v.experimental; }); - optsList.sort(function (a, b) { return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); }); + var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { + return !v.experimental; + }); + optsList.sort(function (a, b) { + return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); + }); var marginLength = 0; var usageColumn = []; var descriptionColumn = []; diff --git a/bin/tsserver.js b/bin/tsserver.js index f05e1f27f34..e7cd07fc7a8 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -45,7 +45,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (v === value) { return true; @@ -69,7 +69,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -83,7 +83,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_1 = array[_i]; if (f(item_1)) { result.push(item_1); @@ -97,7 +97,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result.push(f(v)); } @@ -117,7 +117,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_2 = array[_i]; if (!contains(result, item_2)) { result.push(item_2); @@ -129,7 +129,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result += v[prop]; } @@ -138,7 +138,7 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0, _n = from.length; _i < _n; _i++) { + for (var _i = 0; _i < from.length; _i++) { var v = from[_i]; to.push(v); } @@ -427,7 +427,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _n = parts.length; _i < _n; _i++) { + for (var _i = 0; _i < parts.length; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -572,7 +572,7 @@ var ts; ts.fileExtensionIs = fileExtensionIs; var supportedExtensions = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { + for (var _i = 0; _i < supportedExtensions.length; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -725,14 +725,14 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var name_1 = files[_i]; if (!extension || ts.fileExtensionIs(name_1, extension)) { result.push(ts.combinePaths(path, name_1)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + for (var _a = 0; _a < subfolders.length; _a++) { var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } @@ -819,7 +819,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -832,7 +832,7 @@ var ts; directories.push(name); } } - for (var _a = 0, _b = directories.length; _a < _b; _a++) { + for (var _a = 0; _a < directories.length; _a++) { var current = directories[_a]; visitDirectory(current); } @@ -1070,6 +1070,8 @@ var ts; Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, + Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, + Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -1256,6 +1258,8 @@ var ts; The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1339,6 +1343,11 @@ var ts; Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, + Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { code: 5043, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." }, + Option_declaration_cannot_be_specified_with_option_separateCompilation: { code: 5044, category: ts.DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'separateCompilation'." }, + Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, + Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, + Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1402,7 +1411,10 @@ var ts; You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." }, yield_expressions_are_not_currently_supported: { code: 9000, category: ts.DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." } + Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "'class' expressions are not currently supported." }, + class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: ts.DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." } }; })(ts || (ts = {})); /// @@ -2648,10 +2660,6 @@ var ts; name: "charset", type: "string" }, - { - name: "codepage", - type: "number" - }, { name: "declaration", shortName: "d", @@ -2717,10 +2725,6 @@ var ts; name: "noLib", type: "boolean" }, - { - name: "noLibCheck", - type: "boolean" - }, { name: "noResolve", type: "boolean" @@ -2756,6 +2760,10 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "separateCompilation", + type: "boolean" + }, { name: "sourceMap", type: "boolean", @@ -2779,18 +2787,6 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, - { - name: "preserveNewLines", - type: "boolean", - description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, - experimental: true - }, - { - name: "cacheDownlevelForOfLength", - type: "boolean", - description: "Cache length access when downlevel emitting for-of statements", - experimental: true - }, { name: "target", shortName: "t", @@ -2996,7 +2992,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -3054,7 +3050,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 224) { + while (node && node.kind !== 227) { node = node.parent; } return node; @@ -3136,15 +3132,15 @@ var ts; return current; } switch (current.kind) { - case 224: - case 204: - case 220: - case 202: - case 183: - case 184: - case 185: + case 227: + case 207: + case 223: + case 205: + case 186: + case 187: + case 188: return current; - case 176: + case 179: if (!isFunctionLike(current.parent)) { return current; } @@ -3155,9 +3151,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 195 && + declaration.kind === 198 && declaration.parent && - declaration.parent.kind === 220; + declaration.parent.kind === 223; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3194,14 +3190,21 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 195: - case 152: + case 227: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + if (pos_1 === sourceFile.text.length) { + return createTextSpan(0, 0); + } + return getSpanOfTokenAtPosition(sourceFile, pos_1); case 198: - case 199: - case 202: + case 152: case 201: - case 223: - case 197: + case 174: + case 202: + case 205: + case 204: + case 226: + case 200: case 162: errorNode = node.name; break; @@ -3224,7 +3227,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 201 && isConst(node); + return node.kind === 204 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { @@ -3236,14 +3239,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 195) { + if (node.kind === 198) { node = node.parent; } - if (node && node.kind === 196) { + if (node && node.kind === 199) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 177) { + if (node && node.kind === 180) { flags |= node.flags; } return flags; @@ -3258,7 +3261,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 179 && node.expression.kind === 8; + return node.kind === 182 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -3284,23 +3287,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188: + case 191: return visitor(node); - case 204: - case 176: - case 180: - case 181: - case 182: + case 207: + case 179: case 183: case 184: case 185: - case 189: - case 190: - case 217: - case 218: - case 191: + case 186: + case 187: + case 188: + case 192: case 193: case 220: + case 221: + case 194: + case 196: + case 223: return ts.forEachChild(node, traverse); } } @@ -3310,13 +3313,13 @@ var ts; if (node) { switch (node.kind) { case 152: - case 223: + case 226: case 129: - case 221: + case 224: case 132: case 131: - case 222: - case 195: + case 225: + case 198: return true; } } @@ -3328,7 +3331,7 @@ var ts; switch (node.kind) { case 135: case 162: - case 197: + case 200: case 163: case 134: case 133: @@ -3341,7 +3344,7 @@ var ts; case 143: case 162: case 163: - case 197: + case 200: return true; } } @@ -3349,7 +3352,7 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 176 && isFunctionLike(node.parent); + return node && node.kind === 179 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -3373,7 +3376,7 @@ var ts; } switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; @@ -3382,9 +3385,9 @@ var ts; if (!includeArrowFunctions) { continue; } - case 197: + case 200: case 162: - case 202: + case 205: case 132: case 131: case 134: @@ -3392,8 +3395,8 @@ var ts; case 135: case 136: case 137: - case 201: - case 224: + case 204: + case 227: return node; } } @@ -3406,12 +3409,12 @@ var ts; return node; switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; break; - case 197: + case 200: case 162: case 163: if (!includeFunctions) { @@ -3438,23 +3441,23 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 198: + case 201: return true; case 132: - return node.parent.kind === 198; + return node.parent.kind === 201; case 129: - return node.parent.body && node.parent.parent.kind === 198; + return node.parent.body && node.parent.parent.kind === 201; case 136: case 137: case 134: - return node.body && node.parent.kind === 198; + return node.body && node.parent.kind === 201; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 198: + case 201: if (node.decorators) { return true; } @@ -3482,7 +3485,7 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 198: + case 201: return ts.forEach(node.members, nodeOrChildIsDecorated); case 134: case 137: @@ -3513,6 +3516,7 @@ var ts; case 160: case 161: case 162: + case 174: case 163: case 166: case 164: @@ -3524,7 +3528,7 @@ var ts; case 173: case 171: case 10: - case 174: + case 175: return true; case 126: while (node.parent.kind === 126) { @@ -3539,38 +3543,38 @@ var ts; case 8: var parent_1 = node.parent; switch (parent_1.kind) { - case 195: + case 198: case 129: case 132: case 131: - case 223: - case 221: + case 226: + case 224: case 152: return parent_1.initializer === node; - case 179: - case 180: - case 181: case 182: - case 188: - case 189: - case 190: - case 217: - case 192: - case 190: - return parent_1.expression === node; case 183: - var forStatement = parent_1; - return (forStatement.initializer === node && forStatement.initializer.kind !== 196) || - forStatement.condition === node || - forStatement.iterator === node; case 184: case 185: + case 191: + case 192: + case 193: + case 220: + case 195: + case 193: + return parent_1.expression === node; + case 186: + var forStatement = parent_1; + return (forStatement.initializer === node && forStatement.initializer.kind !== 199) || + forStatement.condition === node || + forStatement.iterator === node; + case 187: + case 188: var forInStatement = parent_1; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 196) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199) || forInStatement.expression === node; case 160: return node === parent_1.expression; - case 175: + case 176: return node === parent_1.expression; case 127: return node === parent_1.expression; @@ -3590,7 +3594,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind === 216; + return node.kind === 208 && node.moduleReference.kind === 219; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -3599,20 +3603,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind !== 216; + return node.kind === 208 && node.moduleReference.kind !== 219; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 206) { + if (node.kind === 209) { return node.moduleSpecifier; } - if (node.kind === 205) { + if (node.kind === 208) { var reference = node.moduleReference; - if (reference.kind === 216) { + if (reference.kind === 219) { return reference.expression; } } - if (node.kind === 212) { + if (node.kind === 215) { return node.moduleSpecifier; } } @@ -3629,8 +3633,8 @@ var ts; case 134: case 133: return node.questionToken !== undefined; - case 222: - case 221: + case 225: + case 224: case 132: case 131: return node.questionToken !== undefined; @@ -3673,31 +3677,31 @@ var ts; switch (node.kind) { case 163: case 152: - case 198: - case 135: case 201: - case 223: - case 214: - case 197: + case 135: + case 204: + case 226: + case 217: + case 200: case 162: case 136: - case 207: - case 205: case 210: - case 199: + case 208: + case 213: + case 202: case 134: case 133: - case 202: - case 208: + case 205: + case 211: case 129: - case 221: + case 224: case 132: case 131: case 137: - case 222: - case 200: + case 225: + case 203: case 128: - case 195: + case 198: return true; } return false; @@ -3705,25 +3709,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 187: - case 186: - case 194: - case 181: - case 179: - case 178: - case 184: - case 185: - case 183: - case 180: - case 191: - case 188: case 190: - case 94: - case 193: - case 177: - case 182: case 189: - case 211: + case 197: + case 184: + case 182: + case 181: + case 187: + case 188: + case 186: + case 183: + case 194: + case 191: + case 193: + case 94: + case 196: + case 180: + case 185: + case 192: + case 214: return true; default: return false; @@ -3749,7 +3753,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 210 || parent.kind === 214) { + if (parent.kind === 213 || parent.kind === 217) { if (parent.propertyName) { return true; } @@ -3761,24 +3765,24 @@ var ts; } ts.isDeclarationName = isDeclarationName; function isAliasSymbolDeclaration(node) { - return node.kind === 205 || - node.kind === 207 && !!node.name || - node.kind === 208 || - node.kind === 210 || - node.kind === 214 || - node.kind === 211 && node.expression.kind === 65; + return node.kind === 208 || + node.kind === 210 && !!node.name || + node.kind === 211 || + node.kind === 213 || + node.kind === 217 || + node.kind === 214 && node.expression.kind === 65; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; - function getClassBaseTypeNode(node) { + function getClassExtendsHeritageClauseElement(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } - ts.getClassBaseTypeNode = getClassBaseTypeNode; - function getClassImplementedTypeNodes(node) { + ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; + function getClassImplementsHeritageClauseElements(node) { var heritageClause = getHeritageClause(node.heritageClauses, 103); return heritageClause ? heritageClause.types : undefined; } - ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause ? heritageClause.types : undefined; @@ -3786,7 +3790,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _n = clauses.length; _i < _n; _i++) { + for (var _i = 0; _i < clauses.length; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -4013,7 +4017,7 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 202 || n.kind === 224; + return isFunctionLike(n) || n.kind === 205 || n.kind === 227; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -4383,12 +4387,36 @@ var ts; } } ts.writeCommentRange = writeCommentRange; + function isSupportedHeritageClauseElement(node) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; + function isSupportedHeritageClauseElementExpression(node) { + if (node.kind === 65) { + return true; + } + else if (node.kind === 155) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + else { + return false; + } + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 126 && node.parent.right === node) || + (node.parent.kind === 155 && node.parent.name === node); + } + ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function getLocalSymbolForExportDefault(symbol) { + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256) ? symbol.valueDeclaration.localSymbol : undefined; + } + ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; })(ts || (ts = {})); /// /// var ts; (function (ts) { - var nodeConstructors = new Array(226); + var nodeConstructors = new Array(229); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -4410,7 +4438,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -4436,9 +4464,9 @@ var ts; case 129: case 132: case 131: - case 221: - case 222: - case 195: + case 224: + case 225: + case 198: case 152: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -4464,7 +4492,7 @@ var ts; case 136: case 137: case 162: - case 197: + case 200: case 163: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -4543,150 +4571,154 @@ var ts; visitNode(cbNode, node.whenFalse); case 173: return visitNode(cbNode, node.expression); - case 176: - case 203: + case 179: + case 206: return visitNodes(cbNodes, node.statements); - case 224: + case 227: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 177: + case 180: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 196: + case 199: return visitNodes(cbNodes, node.declarations); - case 179: + case 182: return visitNode(cbNode, node.expression); - case 180: + case 183: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 181: + case 184: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 182: + case 185: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 183: + case 186: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); - case 184: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 185: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 186: case 187: - return visitNode(cbNode, node.label); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 189: + case 190: + return visitNode(cbNode, node.label); + case 191: + return visitNode(cbNode, node.expression); + case 192: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 190: + case 193: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 204: + case 207: return visitNodes(cbNodes, node.clauses); - case 217: + case 220: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 218: + case 221: return visitNodes(cbNodes, node.statements); - case 191: + case 194: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 192: + case 195: return visitNode(cbNode, node.expression); - case 193: + case 196: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 220: + case 223: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 130: return visitNode(cbNode, node.expression); - 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 199: - 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 200: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); case 201: + case 174: 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 223: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); case 202: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 203: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 204: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 226: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); case 205: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 208: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 206: + case 209: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 207: + case 210: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 208: + case 211: return visitNode(cbNode, node.name); - case 209: - case 213: - return visitNodes(cbNodes, node.elements); case 212: + case 216: + return visitNodes(cbNodes, node.elements); + case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 210: - case 214: + case 213: + case 217: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 211: + case 214: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); case 171: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 175: + case 176: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 127: return visitNode(cbNode, node.expression); - case 219: + case 222: return visitNodes(cbNodes, node.types); - case 216: + case 177: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments); + case 219: return visitNode(cbNode, node.expression); - case 215: + case 218: return visitNodes(cbNodes, node.decorators); } } @@ -4701,7 +4733,7 @@ var ts; case 5: return ts.Diagnostics.Property_or_signature_expected; case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; + case 8: return ts.Diagnostics.Expression_expected; case 9: return ts.Diagnostics.Variable_declaration_expected; case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; @@ -4783,7 +4815,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -4847,7 +4879,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5047,7 +5079,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(224, 0); + var sourceFile = createNode(227, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -5420,7 +5452,7 @@ var ts; case 5: return isStartOfTypeMember(); case 6: - return lookAhead(isClassMemberStart); + return lookAhead(isClassMemberStart) || (token === 22 && !inErrorRecovery); case 7: return token === 18 || isLiteralPropertyName(); case 13: @@ -5428,7 +5460,15 @@ var ts; case 10: return isLiteralPropertyName(); case 8: - return isIdentifier() && !isNotHeritageClauseTypeName(); + if (token === 14) { + return lookAhead(isValidHeritageClauseObjectLiteral); + } + if (!inErrorRecovery) { + return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + else { + return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); + } case 9: return isIdentifierOrPattern(); case 11: @@ -5450,17 +5490,29 @@ var ts; } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } + function isValidHeritageClauseObjectLiteral() { + ts.Debug.assert(token === 14); + if (nextToken() === 15) { + var next = nextToken(); + return next === 23 || next === 14 || next === 79 || next === 103; + } + return true; + } function nextTokenIsIdentifier() { nextToken(); return isIdentifier(); } - function isNotHeritageClauseTypeName() { + function isHeritageClauseExtendsOrImplementsKeyword() { if (token === 103 || token === 79) { - return lookAhead(nextTokenIsIdentifier); + return lookAhead(nextTokenIsStartOfExpression); } return false; } + function nextTokenIsStartOfExpression() { + nextToken(); + return isStartOfExpression(); + } function isListTerminator(kind) { if (token === 1) { return true; @@ -5610,26 +5662,26 @@ var ts; case 15: return isReusableParameter(node); case 19: - case 8: case 16: case 18: case 17: case 12: case 13: + case 8: } return false; } function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 206: - case 205: - case 212: - case 211: - case 198: - case 199: - case 202: + case 209: + case 208: + case 215: + case 214: case 201: + case 202: + case 205: + case 204: return true; } return isReusableStatement(node); @@ -5645,6 +5697,7 @@ var ts; case 136: case 137: case 132: + case 178: return true; } } @@ -5653,8 +5706,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 217: - case 218: + case 220: + case 221: return true; } } @@ -5663,33 +5716,33 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 197: - case 177: - case 176: + case 200: case 180: case 179: - case 192: - case 188: - case 190: - case 187: - case 186: - case 184: - case 185: case 183: case 182: - case 189: - case 178: - case 193: + case 195: case 191: + case 193: + case 190: + case 189: + case 187: + case 188: + case 186: + case 185: + case 192: case 181: + case 196: case 194: + case 184: + case 197: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 223; + return node.kind === 226; } function isReusableTypeMember(node) { if (node) { @@ -5705,7 +5758,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 195) { + if (node.kind !== 198) { return false; } var variableDeclarator = node; @@ -5811,7 +5864,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(175); + var span = createNode(176); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -6246,7 +6299,7 @@ var ts; function parseTypeAnnotation() { return parseOptional(51) ? parseType() : undefined; } - function isStartOfExpression() { + function isStartOfLeftHandSideExpression() { switch (token) { case 93: case 91: @@ -6261,9 +6314,21 @@ var ts; case 18: case 14: case 83: + case 69: case 88: case 36: case 57: + case 65: + return true; + default: + return isIdentifier(); + } + } + function isStartOfExpression() { + if (isStartOfLeftHandSideExpression()) { + return true; + } + switch (token) { case 33: case 34: case 47: @@ -6274,7 +6339,6 @@ var ts; case 38: case 39: case 24: - case 65: case 111: return true; default: @@ -6285,7 +6349,11 @@ var ts; } } function isStartOfExpressionStatement() { - return token !== 14 && token !== 83 && token !== 52 && isStartOfExpression(); + return token !== 14 && + token !== 83 && + token !== 69 && + token !== 52 && + isStartOfExpression(); } function parseExpression() { // Expression[in]: @@ -6466,7 +6534,10 @@ var ts; if (token === 14) { return parseFunctionBlock(false, false); } - if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 83) { + if (isStartOfStatement(true) && + !isStartOfExpressionStatement() && + token !== 83 && + token !== 69) { return parseFunctionBlock(false, true); } return parseAssignmentExpressionOrHigher(); @@ -6731,7 +6802,6 @@ var ts; case 19: case 51: case 22: - case 23: case 50: case 28: case 30: @@ -6745,6 +6815,8 @@ var ts; case 15: case 1: return true; + case 23: + case 14: default: return false; } @@ -6767,6 +6839,8 @@ var ts; return parseArrayLiteralExpression(); case 14: return parseObjectLiteralExpression(); + case 69: + return parseClassExpression(); case 83: return parseFunctionExpression(); case 88: @@ -6797,7 +6871,7 @@ var ts; } function parseArgumentOrArrayLiteralElement() { return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(174) : + token === 23 ? createNode(175) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { @@ -6838,13 +6912,13 @@ var ts; return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(222, fullStart); + var shorthandDeclaration = createNode(225, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(221, fullStart); + var propertyAssignment = createNode(224, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6892,7 +6966,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(176); + var node = createNode(179); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -6917,12 +6991,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(178); + var node = createNode(181); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(180); + var node = createNode(183); parseExpected(84); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6932,7 +7006,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(181); + var node = createNode(184); parseExpected(75); node.statement = parseStatement(); parseExpected(100); @@ -6943,7 +7017,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(182); + var node = createNode(185); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6966,21 +7040,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86)) { - var forInStatement = createNode(184, pos); + var forInStatement = createNode(187, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(125)) { - var forOfStatement = createNode(185, pos); + var forOfStatement = createNode(188, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(183, pos); + var forStatement = createNode(186, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -6998,7 +7072,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 187 ? 66 : 71); + parseExpected(kind === 190 ? 66 : 71); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -7006,7 +7080,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(188); + var node = createNode(191); parseExpected(90); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -7015,7 +7089,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(189); + var node = createNode(192); parseExpected(101); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7024,7 +7098,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(217); + var node = createNode(220); parseExpected(67); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -7032,7 +7106,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(218); + var node = createNode(221); parseExpected(73); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -7042,12 +7116,12 @@ var ts; return token === 67 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(190); + var node = createNode(193); parseExpected(92); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); - var caseBlock = createNode(204, scanner.getStartPos()); + var caseBlock = createNode(207, scanner.getStartPos()); parseExpected(14); caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); @@ -7057,14 +7131,14 @@ var ts; function parseThrowStatement() { // ThrowStatement[Yield] : // throw [no LineTerminator here]Expression[In, ?Yield]; - var node = createNode(192); + var node = createNode(195); parseExpected(94); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(193); + var node = createNode(196); parseExpected(96); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 ? parseCatchClause() : undefined; @@ -7075,7 +7149,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(220); + var result = createNode(223); parseExpected(68); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7085,7 +7159,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(194); + var node = createNode(197); parseExpected(72); parseSemicolon(); return finishNode(node); @@ -7094,13 +7168,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 && parseOptional(51)) { - var labeledStatement = createNode(191, fullStart); + var labeledStatement = createNode(194, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(179, fullStart); + var expressionStatement = createNode(182, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -7108,7 +7182,7 @@ var ts; } function isStartOfStatement(inErrorRecovery) { if (ts.isModifier(token)) { - var result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return true; } @@ -7120,6 +7194,7 @@ var ts; case 98: case 105: case 83: + case 69: case 84: case 75: case 100: @@ -7139,7 +7214,6 @@ var ts; var isConstEnum = lookAhead(nextTokenIsEnumKeyword); return !isConstEnum; case 104: - case 69: case 117: case 77: case 123: @@ -7174,6 +7248,8 @@ var ts; return parseVariableStatement(scanner.getStartPos(), undefined, undefined); case 83: return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 69: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); case 22: return parseEmptyStatement(); case 84: @@ -7185,9 +7261,9 @@ var ts; case 82: return parseForOrForInOrForOfStatement(); case 71: - return parseBreakOrContinueStatement(186); + return parseBreakOrContinueStatement(189); case 66: - return parseBreakOrContinueStatement(187); + return parseBreakOrContinueStatement(190); case 90: return parseReturnStatement(); case 101: @@ -7208,7 +7284,7 @@ var ts; } default: if (ts.isModifier(token) || token === 52) { - var result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return result; } @@ -7216,7 +7292,7 @@ var ts; return parseExpressionOrLabeledStatement(); } } - function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers() { + function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers() { var start = scanner.getStartPos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -7236,6 +7312,8 @@ var ts; return parseVariableStatement(start, decorators, modifiers); case 83: return parseFunctionDeclaration(start, decorators, modifiers); + case 69: + return parseClassDeclaration(start, decorators, modifiers); } return undefined; } @@ -7248,7 +7326,7 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(174); + return createNode(175); } var node = createNode(152); node.dotDotDotToken = parseOptionalToken(21); @@ -7297,7 +7375,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(195); + var node = createNode(198); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -7306,7 +7384,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(196); + var node = createNode(199); switch (token) { case 98: break; @@ -7335,7 +7413,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(177, fullStart); + var node = createNode(180, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -7343,7 +7421,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(200, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83); @@ -7486,6 +7564,11 @@ var ts; return modifiers; } function parseClassElement() { + if (token === 22) { + var result = createNode(178); + nextToken(); + return finishNode(result); + } var fullStart = getNodePos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -7512,12 +7595,18 @@ var ts; } ts.Debug.fail("Should not have attempted to parse class member declaration."); } + function parseClassExpression() { + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 174); + } function parseClassDeclaration(fullStart, decorators, modifiers) { + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201); + } + function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var savedStrictModeContext = inStrictModeContext(); if (languageVersion >= 2) { setStrictModeContext(true); } - var node = createNode(198, fullStart); + var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(69); @@ -7553,14 +7642,22 @@ var ts; } function parseHeritageClause() { if (token === 79 || token === 103) { - var node = createNode(219); + var node = createNode(222); node.token = token; nextToken(); - node.types = parseDelimitedList(8, parseTypeReference); + node.types = parseDelimitedList(8, parseHeritageClauseElement); return finishNode(node); } return undefined; } + function parseHeritageClauseElement() { + var node = createNode(177); + node.expression = parseLeftHandSideExpressionOrHigher(); + if (token === 24) { + node.typeArguments = parseBracketedList(17, parseType, 24, 25); + } + return finishNode(node); + } function isHeritageClause() { return token === 79 || token === 103; } @@ -7568,7 +7665,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(199, fullStart); + var node = createNode(202, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(104); @@ -7579,7 +7676,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200, fullStart); + var node = createNode(203, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(123); @@ -7590,13 +7687,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(223, scanner.getStartPos()); + var node = createNode(226, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(201, fullStart); + var node = createNode(204, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77); @@ -7611,7 +7708,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(203, scanner.getStartPos()); + var node = createNode(206, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -7622,7 +7719,7 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; @@ -7633,7 +7730,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -7665,7 +7762,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 124) { - var importEqualsDeclaration = createNode(205, fullStart); + var importEqualsDeclaration = createNode(208, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -7675,7 +7772,7 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(206, fullStart); + var importDeclaration = createNode(209, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || @@ -7695,13 +7792,13 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(207, fullStart); + var importClause = createNode(210, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(209); + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(212); } return finishNode(importClause); } @@ -7711,7 +7808,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(216); + var node = createNode(219); parseExpected(118); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -7726,7 +7823,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(208); + var namespaceImport = createNode(211); parseExpected(35); parseExpected(102); namespaceImport.name = parseIdentifier(); @@ -7734,14 +7831,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 209 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 212 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(214); + return parseImportOrExportSpecifier(217); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(210); + return parseImportOrExportSpecifier(213); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -7760,13 +7857,13 @@ var ts; else { node.name = identifierName; } - if (kind === 210 && checkIdentifierIsKeyword) { + if (kind === 213 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35)) { @@ -7774,7 +7871,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(213); + node.exportClause = parseNamedImportsOrExports(216); if (parseOptional(124)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -7783,7 +7880,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(211, fullStart); + var node = createNode(214, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53)) { @@ -7896,7 +7993,7 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); default: if (decorators) { - var node = createMissingNode(215, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(218, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -7976,10 +8073,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 205 && node.moduleReference.kind === 216 - || node.kind === 206 - || node.kind === 211 - || node.kind === 212 + || node.kind === 208 && node.moduleReference.kind === 219 + || node.kind === 209 + || node.kind === 214 + || node.kind === 215 ? node : undefined; }); @@ -7996,6 +8093,7 @@ var ts; case 153: case 161: case 154: + case 174: case 162: case 65: case 9: @@ -8024,16 +8122,16 @@ var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 199 || node.kind === 200) { + if (node.kind === 202 || node.kind === 203) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 206 || node.kind === 205) && !(node.flags & 1)) { + else if ((node.kind === 209 || node.kind === 208) && !(node.flags & 1)) { return 0; } - else if (node.kind === 203) { + else if (node.kind === 206) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -8049,7 +8147,7 @@ var ts; }); return state; } - else if (node.kind === 202) { + else if (node.kind === 205) { return getModuleInstanceState(node.body); } else { @@ -8102,7 +8200,7 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 202 && node.name.kind === 8) { + if (node.kind === 205 && node.name.kind === 8) { return '"' + node.name.text + '"'; } if (node.name.kind === 127) { @@ -8123,12 +8221,12 @@ var ts; return "__new"; case 140: return "__index"; - case 212: + case 215: return "__export"; - case 211: + case 214: return node.isExportEquals ? "export=" : "default"; - case 197: - case 198: + case 200: + case 201: return node.flags & 256 ? "default" : undefined; } } @@ -8160,7 +8258,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 198 && symbol.exports) { + if ((node.kind === 201 || node.kind === 174) && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -8176,7 +8274,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 214 || (node.kind === 205 && hasExportModifier)) { + if (node.kind === 217 || (node.kind === 208 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -8213,7 +8311,7 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 224); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227); } ts.forEachChild(node, bind); container = saveContainer; @@ -8222,10 +8320,10 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 202: + case 205: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -8240,22 +8338,23 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 198: + case 174: + case 201: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } case 145: case 154: - case 199: + case 202: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 201: + case 204: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -8270,11 +8369,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 224 ? node : node.body; - if (body.kind === 224 || body.kind === 203) { - for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { + var body = node.kind === 227 ? node : node.body; + if (body.kind === 227 || body.kind === 206) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 212 || stat.kind === 211) { + if (stat.kind === 215 || stat.kind === 214) { return true; } } @@ -8336,10 +8435,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 202: + case 205: declareModuleMember(node, 2, 107455); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -8364,7 +8463,7 @@ var ts; case 129: bindParameter(node); break; - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); @@ -8380,11 +8479,11 @@ var ts; case 131: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 221: - case 222: + case 224: + case 225: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 223: + case 226: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 138: @@ -8396,7 +8495,7 @@ var ts; case 133: bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; - case 197: + case 200: bindDeclaration(node, 16, 106927, true); break; case 135: @@ -8422,19 +8521,22 @@ var ts; case 163: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 220: + case 174: + bindAnonymousDeclaration(node, 32, "__class", false); + break; + case 223: bindCatchVariableDeclaration(node); break; - case 198: + case 201: bindDeclaration(node, 32, 899583, false); break; - case 199: + case 202: bindDeclaration(node, 64, 792992, false); break; - case 200: + case 203: bindDeclaration(node, 524288, 793056, false); break; - case 201: + case 204: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -8442,16 +8544,16 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 202: + case 205: bindModuleDeclaration(node); break; - case 205: case 208: - case 210: - case 214: + case 211: + case 213: + case 217: bindDeclaration(node, 8388608, 8388608, false); break; - case 207: + case 210: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -8459,13 +8561,13 @@ var ts; bindChildren(node, 0, false); } break; - case 212: + case 215: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 211: + case 214: if (node.expression && node.expression.kind === 65) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } @@ -8474,20 +8576,20 @@ var ts; } bindChildren(node, 0, false); break; - case 224: + case 227: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 176: + case 179: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 220: - case 183: - case 184: - case 185: - case 204: + case 223: + case 186: + case 187: + case 188: + case 207: bindChildren(node, 0, true); break; default: @@ -8506,7 +8608,7 @@ var ts; } if (node.flags & 112 && node.parent.kind === 135 && - node.parent.parent.kind === 198) { + (node.parent.parent.kind === 201 || node.parent.parent.kind === 174)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -8792,10 +8894,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 224); + return ts.getAncestor(node, 227); } function isGlobalSourceFile(node) { - return node.kind === 224 && !ts.isExternalModule(node); + return node.kind === 227 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -8837,25 +8939,33 @@ var ts; } } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 214)) { + if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 217)) { + break loop; + } + result = undefined; + } + else if (location.kind === 227) { + result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { break loop; } result = undefined; } break; - case 201: + case 204: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; case 132: case 131: - if (location.parent.kind === 198 && !(location.flags & 128)) { + if (location.parent.kind === 201 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -8864,8 +8974,8 @@ var ts; } } break; - case 198: - case 199: + case 201: + case 202: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -8876,7 +8986,7 @@ var ts; break; case 127: grandparent = location.parent.parent; - if (grandparent.kind === 198 || grandparent.kind === 199) { + if (grandparent.kind === 201 || grandparent.kind === 202) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -8888,7 +8998,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 163: if (name === "arguments") { result = argumentsSymbol; @@ -8900,8 +9010,15 @@ var ts; result = argumentsSymbol; break loop; } - var id = location.name; - if (id && name === id.text) { + var functionName = location.name; + if (functionName && name === functionName.text) { + result = location.symbol; + break loop; + } + break; + case 174: + var className = location.name; + if (className && name === className.text) { result = location.symbol; break loop; } @@ -8945,14 +9062,14 @@ var ts; ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 195); + var variableDeclaration = ts.getAncestor(declaration, 198); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 177 || - variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 180 || + variableDeclaration.parent.parent.kind === 186) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 185 || - variableDeclaration.parent.parent.kind === 184) { + else if (variableDeclaration.parent.parent.kind === 188 || + variableDeclaration.parent.parent.kind === 187) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -8974,10 +9091,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } - while (node && node.kind !== 206) { + while (node && node.kind !== 209) { node = node.parent; } return node; @@ -8987,7 +9104,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 216) { + if (node.moduleReference.kind === 219) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -9010,7 +9127,7 @@ var ts; if (moduleSymbol.flags & 3) { var typeAnnotation = moduleSymbol.valueDeclaration.type; if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); + return getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name); } } } @@ -9041,7 +9158,7 @@ var ts; if (symbol.flags & 3) { var typeAnnotation = symbol.valueDeclaration.type; if (typeAnnotation) { - return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); + return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name)); } } } @@ -9076,17 +9193,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 205: - return getTargetOfImportEqualsDeclaration(node); - case 207: - return getTargetOfImportClause(node); case 208: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node); case 210: - return getTargetOfImportSpecifier(node); - case 214: - return getTargetOfExportSpecifier(node); + return getTargetOfImportClause(node); case 211: + return getTargetOfNamespaceImport(node); + case 213: + return getTargetOfImportSpecifier(node); + case 217: + return getTargetOfExportSpecifier(node); + case 214: return getTargetOfExportAssignment(node); } } @@ -9115,8 +9232,12 @@ var ts; function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); - if (target && target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target)) { - markAliasSymbolAsReferenced(symbol); + if (target) { + var markAlias = (target === unknownSymbol && compilerOptions.separateCompilation) || + (target !== unknownSymbol && (target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); + if (markAlias) { + markAliasSymbolAsReferenced(symbol); + } } } function markAliasSymbolAsReferenced(symbol) { @@ -9124,10 +9245,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 211 && node.expression) { + if (node.kind === 214 && node.expression) { checkExpressionCached(node.expression); } - else if (node.kind === 214) { + else if (node.kind === 217) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -9137,17 +9258,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 205); + importDeclaration = ts.getAncestor(entityName, 208); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 65 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 65 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (entityName.kind === 65 || entityName.parent.kind === 126) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 205); + ts.Debug.assert(entityName.parent.kind === 208); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -9155,7 +9276,7 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(name, meaning) { - if (ts.getFullWidth(name) === 0) { + if (ts.nodeIsMissing(name)) { return undefined; } var symbol; @@ -9165,18 +9286,22 @@ var ts; return undefined; } } - else if (name.kind === 126) { - var namespace = resolveEntityName(name.left, 1536); - if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) { + else if (name.kind === 126 || name.kind === 155) { + var left = name.kind === 126 ? name.left : name.expression; + var right = name.kind === 126 ? name.right : name.name; + var namespace = resolveEntityName(left, 1536); + if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; } - var right = name.right; symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; } } + else { + ts.Debug.fail("Unknown entity name kind."); + } ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } @@ -9265,7 +9390,7 @@ var ts; } var exportStars = symbol.exports["__export"]; if (exportStars) { - for (var _i = 0, _a = exportStars.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; visit(resolveExternalModuleName(node, node.moduleSpecifier)); } @@ -9302,7 +9427,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _n = members.length; _i < _n; _i++) { + for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; if (member.kind === 135 && ts.nodeIsPresent(member.body)) { return member; @@ -9369,17 +9494,17 @@ var ts; } } switch (location_1.kind) { - case 224: + case 227: if (!ts.isExternalModule(location_1)) { break; } - case 202: + case 205: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 198: - case 199: + case 201: + case 202: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -9410,7 +9535,7 @@ var ts; return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608) { + if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=") { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -9494,8 +9619,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 202 && declaration.name.kind === 8) || - (declaration.kind === 224 && ts.isExternalModule(declaration)); + return (declaration.kind === 205 && declaration.name.kind === 8) || + (declaration.kind === 227 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9530,8 +9655,8 @@ var ts; if (entityName.parent.kind === 144) { meaning = 107455 | 1048576; } - else if (entityName.kind === 126 || - entityName.parent.kind === 205) { + else if (entityName.kind === 126 || entityName.kind === 155 || + entityName.parent.kind === 208) { meaning = 1536; } else { @@ -9578,7 +9703,7 @@ var ts; while (node.kind === 149) { node = node.parent; } - if (node.kind === 200) { + if (node.kind === 203) { return getSymbolOfNode(node); } } @@ -9622,7 +9747,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -9750,7 +9875,7 @@ var ts; var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 224 || declaration.parent.kind === 203; + return declaration.parent.kind === 227 || declaration.parent.kind === 206; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -9806,13 +9931,13 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; writeKeyword(writer, 88); writeSpace(writer); @@ -9846,13 +9971,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { - var p = _f[_e]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _h = 0, _j = signatures.length; _h < _j; _h++) { - var signature = signatures[_h]; + for (var _f = 0; _f < signatures.length; _f++) { + var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -9982,12 +10107,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 202) { + if (node.kind === 205) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 224) { + else if (node.kind === 227) { return ts.isExternalModule(node) ? node : undefined; } } @@ -10032,21 +10157,21 @@ var ts; switch (node.kind) { case 152: return isDeclarationVisible(node.parent.parent); - case 195: + case 198: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 202: - case 198: - case 199: - case 200: - case 197: - case 201: case 205: + case 201: + case 202: + case 203: + case 200: + case 204: + case 208: var parent_2 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 205 && parent_2.kind !== 224 && ts.isInAmbientContext(parent_2))) { + !(node.kind !== 208 && parent_2.kind !== 227 && ts.isInAmbientContext(parent_2))) { return isGlobalSourceFile(parent_2); } return isDeclarationVisible(parent_2); @@ -10064,7 +10189,7 @@ var ts; case 138: case 140: case 129: - case 203: + case 206: case 142: case 143: case 145: @@ -10074,13 +10199,15 @@ var ts; case 148: case 149: return isDeclarationVisible(node.parent); - case 207: - case 208: case 210: + case 211: + case 213: return false; case 128: - case 224: + case 227: return true; + case 214: + return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } @@ -10095,10 +10222,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 211) { + if (node.parent && node.parent.kind === 214) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 217) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -10130,7 +10257,7 @@ var ts; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 195 ? node.parent.parent.parent : node.parent; + return node.kind === 198 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -10188,17 +10315,17 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 184) { + if (declaration.parent.parent.kind === 187) { return anyType; } - if (declaration.parent.parent.kind === 185) { + if (declaration.parent.parent.kind === 188) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var func = declaration.parent; @@ -10216,7 +10343,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 222) { + if (declaration.kind === 225) { return checkIdentifier(declaration.name); } return undefined; @@ -10245,7 +10372,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 174 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 175 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -10263,7 +10390,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 221 ? getWidenedType(type) : type; + return declaration.kind !== 224 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -10284,16 +10411,16 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 220) { + if (declaration.parent.kind === 223) { return links.type = anyType; } - if (declaration.kind === 211) { + if (declaration.kind === 214) { var exportAssignment = declaration; if (exportAssignment.expression) { return links.type = checkExpression(exportAssignment.expression); } else if (exportAssignment.type) { - return links.type = getTypeFromTypeNode(exportAssignment.type); + return links.type = getTypeFromTypeNodeOrHeritageClauseElement(exportAssignment.type); } else { return links.type = anyType; @@ -10322,11 +10449,11 @@ var ts; function getAnnotatedAccessorType(accessor) { if (accessor) { if (accessor.kind === 136) { - return accessor.type && getTypeFromTypeNode(accessor.type); + return accessor.type && getTypeFromTypeNodeOrHeritageClauseElement(accessor.type); } else { var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation && getTypeFromTypeNodeOrHeritageClauseElement(setterTypeAnnotation); } } return undefined; @@ -10438,7 +10565,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 199 || node.kind === 198) { + if (node.kind === 202 || node.kind === 201) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10469,10 +10596,10 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(symbol, 198); - var baseTypeNode = ts.getClassBaseTypeNode(declaration); + var declaration = ts.getDeclarationOfKind(symbol, 201); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + var baseType = getTypeFromHeritageClauseElement(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10510,9 +10637,9 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 199 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 202 && ts.getInterfaceBaseTypeNodes(declaration)) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { - var baseType = getTypeFromTypeReferenceNode(node); + var baseType = getTypeFromHeritageClauseElement(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10541,15 +10668,15 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 200); - var type = getTypeFromTypeNode(declaration.type); + var declaration = ts.getDeclarationOfKind(symbol, 203); + var type = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 200); + var declaration = ts.getDeclarationOfKind(symbol, 203); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -10606,7 +10733,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -10614,14 +10741,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSymbols.length; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -10630,7 +10757,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSignatures.length; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -10729,7 +10856,7 @@ var ts; function getUnionSignatures(types, kind) { var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -10750,7 +10877,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -10886,7 +11013,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -10904,7 +11031,7 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0, _b = props.length; _a < _b; _a++) { + for (var _a = 0; _a < props.length; _a++) { var prop = props[_a]; if (prop.declarations) { declarations.push.apply(declarations, prop.declarations); @@ -11029,7 +11156,7 @@ var ts; returnType = classType; } else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); + returnType = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } else { if (declaration.kind === 136 && !ts.hasDynamicName(declaration)) { @@ -11053,7 +11180,7 @@ var ts; switch (node.kind) { case 142: case 143: - case 197: + case 200: case 134: case 133: case 135: @@ -11151,7 +11278,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -11167,7 +11294,7 @@ var ts; function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType + ? declaration.type ? getTypeFromTypeNodeOrHeritageClauseElement(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { @@ -11177,7 +11304,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128).constraint); + type.constraint = getTypeFromTypeNodeOrHeritageClauseElement(ts.getDeclarationOfKind(type.symbol, 128).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -11201,7 +11328,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } @@ -11252,31 +11379,42 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReferenceNode(node) { + function getTypeFromTypeReference(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromHeritageClauseElement(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromTypeReferenceOrHeritageClauseElement(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var symbol = resolveEntityName(node.typeName, 793056); var type; - if (symbol) { - if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - type = unknownType; - } - else { - type = getDeclaredTypeOfSymbol(symbol); - if (type.flags & (1024 | 2048) && type.flags & 4096) { - var typeParameters = type.typeParameters; - if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); - } - else { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); - type = undefined; - } + if (node.kind !== 177 || ts.isSupportedHeritageClauseElement(node)) { + var typeNameOrExpression = node.kind === 141 + ? node.typeName + : node.expression; + var symbol = resolveEntityName(typeNameOrExpression, 793056); + if (symbol) { + if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; } else { - if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); - type = undefined; + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 | 2048) && type.flags & 4096) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNodeOrHeritageClauseElement)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } } } } @@ -11295,12 +11433,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 198: - case 199: case 201: + case 202: + case 204: return declaration; } } @@ -11342,7 +11480,7 @@ var ts; function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + links.resolvedType = createArrayType(getTypeFromTypeNodeOrHeritageClauseElement(node.elementType)); } return links.resolvedType; } @@ -11358,7 +11496,7 @@ var ts; function getTypeFromTupleTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNodeOrHeritageClauseElement)); } return links.resolvedType; } @@ -11378,13 +11516,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -11402,7 +11540,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -11449,7 +11587,7 @@ var ts; function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNodeOrHeritageClauseElement), true); } return links.resolvedType; } @@ -11475,7 +11613,7 @@ var ts; } return links.resolvedType; } - function getTypeFromTypeNode(node) { + function getTypeFromTypeNodeOrHeritageClauseElement(node) { switch (node.kind) { case 112: return anyType; @@ -11492,7 +11630,9 @@ var ts; case 8: return getTypeFromStringLiteral(node); case 141: - return getTypeFromTypeReferenceNode(node); + return getTypeFromTypeReference(node); + case 177: + return getTypeFromHeritageClauseElement(node); case 144: return getTypeFromTypeQueryNode(node); case 146: @@ -11502,7 +11642,7 @@ var ts; case 148: return getTypeFromUnionTypeNode(node); case 149: - return getTypeFromTypeNode(node.type); + return getTypeFromTypeNodeOrHeritageClauseElement(node.type); case 142: case 143: case 145: @@ -11518,7 +11658,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _n = items.length; _i < _n; _i++) { + for (var _i = 0; _i < items.length; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -11558,7 +11698,7 @@ var ts; case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _n = sources.length; _i < _n; _i++) { + for (var _i = 0; _i < sources.length; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -11674,7 +11814,7 @@ var ts; case 169: return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 221: + case 224: return isContextSensitive(node.initializer); case 134: case 133: @@ -11846,7 +11986,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -11869,7 +12009,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -12006,7 +12146,7 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -12077,7 +12217,7 @@ var ts; return 0; } var result = -1; - for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceProperties.length; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -12102,11 +12242,11 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceSignatures.length; _a++) { var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); @@ -12324,7 +12464,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -12457,7 +12597,7 @@ var ts; ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 197: + case 200: case 134: case 133: case 136: @@ -12510,7 +12650,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { + for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); } @@ -12581,7 +12721,7 @@ var ts; var targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _i = 0, _n = targetTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < targetTypes.length; _i++) { var t = targetTypes[_i]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -12599,7 +12739,7 @@ var ts; } else if (source.flags & 16384) { var sourceTypes = source.types; - for (var _a = 0, _b = sourceTypes.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceTypes.length; _a++) { var sourceType = sourceTypes[_a]; inferFromTypes(sourceType, target); } @@ -12626,7 +12766,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -12699,7 +12839,7 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; } return links.resolvedSymbol; } @@ -12770,7 +12910,7 @@ var ts; switch (node.kind) { case 169: return isAssignedInBinaryExpression(node); - case 195: + case 198: case 152: return isAssignedInVariableDeclaration(node); case 150: @@ -12790,24 +12930,24 @@ var ts; case 168: case 170: case 173: - case 176: - case 177: case 179: case 180: - case 181: case 182: case 183: case 184: case 185: + case 186: + case 187: case 188: - case 189: - case 190: - case 217: - case 218: case 191: case 192: case 193: case 220: + case 221: + case 194: + case 195: + case 196: + case 223: return ts.forEachChild(node, isAssignedIn); } return false; @@ -12843,7 +12983,7 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 180: + case 183: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } @@ -12863,9 +13003,9 @@ var ts; } } break; - case 224: - case 202: - case 197: + case 227: + case 205: + case 200: case 134: case 133: case 136: @@ -13008,15 +13148,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 220) { + symbol.valueDeclaration.parent.kind === 223) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 196) { + while (container.kind !== 199) { container = container.parent; } container = container.parent; - if (container.kind === 177) { + if (container.kind === 180) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -13033,7 +13173,7 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; getNodeLinks(node).flags |= 2; if (container.kind === 132 || container.kind === 135) { getNodeLinks(classNode).flags |= 4; @@ -13050,10 +13190,10 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 202: + case 205: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 201: + case 204: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 135: @@ -13074,7 +13214,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -13091,9 +13231,9 @@ var ts; } function checkSuperExpression(node) { var isCallExpression = node.parent.kind === 157 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); var baseClass; - if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); baseClass = classType.baseTypes.length && classType.baseTypes[0]; } @@ -13114,7 +13254,7 @@ var ts; container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 198) { + if (container && container.parent && container.parent.kind === 201) { if (container.flags & 128) { canUseSuperExpression = container.kind === 134 || @@ -13190,7 +13330,7 @@ var ts; var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var type = getContextuallyTypedParameterType(declaration); @@ -13256,7 +13396,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -13335,29 +13475,29 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 195: + case 198: case 129: case 132: case 131: case 152: return getContextualTypeForInitializerExpression(node); case 163: - case 188: + case 191: return getContextualTypeForReturnExpression(node); case 157: case 158: return getContextualTypeForArgument(parent, node); case 160: - return getTypeFromTypeNode(parent.type); + return getTypeFromTypeNodeOrHeritageClauseElement(parent.type); case 169: return getContextualTypeForBinaryOperand(node); - case 221: + case 224: return getContextualTypeForObjectLiteralElement(parent); case 153: return getContextualTypeForElementExpression(node); case 170: return getContextualTypeForConditionalOperand(node); - case 175: + case 176: ts.Debug.assert(parent.parent.kind === 171); return getContextualTypeForSubstitutionExpression(parent.parent, node); case 161: @@ -13393,7 +13533,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { @@ -13428,7 +13568,7 @@ var ts; if (parent.kind === 169 && parent.operatorToken.kind === 53 && parent.left === node) { return true; } - if (parent.kind === 221) { + if (parent.kind === 224) { return isAssignmentTarget(parent.parent); } if (parent.kind === 153) { @@ -13497,21 +13637,21 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 221 || - memberDecl.kind === 222 || + if (memberDecl.kind === 224 || + memberDecl.kind === 225 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 221) { + if (memberDecl.kind === 224) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 134) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 222); + ts.Debug.assert(memberDecl.kind === 225); type = memberDecl.name.kind === 127 ? unknownType : checkExpression(memberDecl.name, contextualMapper); @@ -13571,7 +13711,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 198); + var enclosingClassDeclaration = ts.getAncestor(node, 201); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -13770,7 +13910,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var parent_4 = signature.declaration && signature.declaration.parent; @@ -13819,7 +13959,7 @@ var ts; var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); - callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } else { var templateLiteral = tagExpression.template; @@ -13882,7 +14022,7 @@ var ts; } for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = void 0; if (i === 0 && args[i].parent.kind === 159) { @@ -13911,7 +14051,7 @@ var ts; var typeArgumentsAreAssignable = true; for (var i = 0; i < typeParameters.length; i++) { var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); + var typeArgument = getTypeFromTypeNodeOrHeritageClauseElement(typeArgNode); typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); @@ -13925,7 +14065,7 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = i === 0 && node.kind === 159 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : @@ -13955,8 +14095,8 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91) { - var containingClass = ts.getAncestor(callExpression, 198); - var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + var containingClass = ts.getAncestor(callExpression, 201); + var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } else { @@ -14023,7 +14163,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -14032,7 +14172,7 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var originalCandidate = candidates[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; @@ -14214,7 +14354,7 @@ var ts; } function checkTypeAssertion(node) { var exprType = checkExpression(node.expression); - var targetType = getTypeFromTypeNode(node.type); + var targetType = getTypeFromTypeNodeOrHeritageClauseElement(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { @@ -14252,7 +14392,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 176) { + if (func.body.kind !== 179) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -14290,7 +14430,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 192); + return (body.statements.length === 1) && (body.statements[0].kind === 195); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -14299,7 +14439,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 176) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 179) { return; } var bodyBlock = func.body; @@ -14351,16 +14491,16 @@ var ts; function checkFunctionExpressionOrObjectLiteralMethodBody(node) { ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); if (node.type) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (node.body) { - if (node.body.kind === 176) { + if (node.body.kind === 179) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); if (node.type) { - checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrHeritageClauseElement(node.type), node.body, undefined); } checkFunctionExpressionBodies(node.body); } @@ -14419,19 +14559,6 @@ var ts; return false; } } - function isImportedNameFromExternalModule(n) { - switch (n.kind) { - case 156: - case 155: { - var symbol = findSymbol(n.expression); - return symbol && symbol.flags & 8388608 && isExternalModuleSymbol(resolveAlias(symbol)); - } - case 161: - return isImportedNameFromExternalModule(n.expression); - default: - return false; - } - } if (!isReferenceOrErrorExpression(n)) { error(n, invalidReferenceMessage); return false; @@ -14440,9 +14567,6 @@ var ts; error(n, constantVariableMessage); return false; } - if (isImportedNameFromExternalModule(n)) { - error(n, invalidReferenceMessage); - } return true; } function checkDeleteExpression(node) { @@ -14500,7 +14624,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -14516,7 +14640,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -14552,9 +14676,9 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var name_8 = p.name; var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name_8.text) || @@ -14581,7 +14705,7 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { var propName = "" + i; var type = sourceType.flags & 1 ? sourceType : @@ -14903,6 +15027,8 @@ var ts; return checkTypeAssertion(node); case 161: return checkExpression(node.expression, contextualMapper); + case 174: + return checkClassExpression(node); case 162: case 163: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -14922,7 +15048,7 @@ var ts; return checkConditionalExpression(node, contextualMapper); case 173: return checkSpreadElementExpression(node, contextualMapper); - case 174: + case 175: return undefinedType; case 172: checkYieldExpression(node); @@ -14969,7 +15095,7 @@ var ts; if (node.kind === 140) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 || node.kind === 197 || node.kind === 143 || + else if (node.kind === 142 || node.kind === 200 || node.kind === 143 || node.kind === 138 || node.kind === 135 || node.kind === 139) { checkGrammarFunctionLikeDeclaration(node); @@ -14995,7 +15121,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 199) { + if (node.kind === 202) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -15005,7 +15131,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -15063,7 +15189,7 @@ var ts; } switch (n.kind) { case 162: - case 197: + case 200: case 163: case 154: return false; default: return ts.forEachChild(n, containsSuperCall); @@ -15073,7 +15199,7 @@ var ts; if (n.kind === 93) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 && n.kind !== 197) { + else if (n.kind !== 162 && n.kind !== 200) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -15082,13 +15208,13 @@ var ts; !(n.flags & 128) && !!n.initializer; } - if (ts.getClassBaseTypeNode(node.parent)) { + if (ts.getClassExtendsHeritageClauseElement(node.parent)) { if (containsSuperCall(node.body)) { var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 179 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 182 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -15132,9 +15258,15 @@ var ts; function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeReference(node) { + function checkTypeReferenceNode(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkHeritageClauseElement(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkTypeReferenceOrHeritageClauseElement(node) { checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceNode(node); + var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); if (type !== unknownType && node.typeArguments) { var len = node.typeArguments.length; for (var i = 0; i < len; i++) { @@ -15187,7 +15319,7 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 199) { + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202) { ts.Debug.assert(signatureDeclarationNode.kind === 138 || signatureDeclarationNode.kind === 139); var signatureKind = signatureDeclarationNode.kind === 138 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); @@ -15197,7 +15329,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { + for (var _i = 0; _i < signaturesToCheck.length; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -15207,7 +15339,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 199 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 202 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -15264,7 +15396,7 @@ var ts; var declarations = symbol.declarations; var isConstructor = (symbol.flags & 16384) !== 0; function reportImplementationExpectedError(node) { - if (node.name && ts.getFullWidth(node.name) === 0) { + if (node.name && ts.nodeIsMissing(node.name)) { return; } var seen = false; @@ -15303,15 +15435,15 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 199 || node.parent.kind === 145 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 202 || node.parent.kind === 145 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 197 || node.kind === 134 || node.kind === 133 || node.kind === 135) { + if (node.kind === 200 || node.kind === 134 || node.kind === 133 || node.kind === 135) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -15362,7 +15494,7 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + for (var _a = 0; _a < signatures.length; _a++) { var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); @@ -15408,16 +15540,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 199: - return 2097152; case 202: + return 2097152; + case 205: return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 198: case 201: + case 204: return 2097152 | 1048576; - case 205: + case 208: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -15431,7 +15563,7 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 198: + case 201: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]); @@ -15457,7 +15589,7 @@ var ts; return; } switch (node.kind) { - case 198: + case 201: case 134: case 136: case 137: @@ -15502,18 +15634,18 @@ var ts; } checkSourceElement(node.body); if (node.type && !isAccessor(node.kind)) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !node.type && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } } function checkBlock(node) { - if (node.kind === 176) { + if (node.kind === 179) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 203) { + if (ts.isFunctionBlock(node) || node.kind === 206) { checkFunctionExpressionBodies(node); } } @@ -15573,11 +15705,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } - if (ts.getClassBaseTypeNode(enclosingClass)) { + if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var isDeclaration_2 = node.kind !== 65; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); @@ -15591,11 +15723,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 202 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 205 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 224 && ts.isExternalModule(parent)) { + if (parent.kind === 227 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -15606,7 +15738,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { return; } - if (node.kind === 195 && !node.initializer) { + if (node.kind === 198 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -15616,15 +15748,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 196); - var container = varDeclList.parent.kind === 177 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199); + var container = varDeclList.parent.kind === 180 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 176 && ts.isFunctionLike(container.parent) || - container.kind === 203 || - container.kind === 202 || - container.kind === 224); + (container.kind === 179 && ts.isFunctionLike(container.parent) || + container.kind === 206 || + container.kind === 205 || + container.kind === 227); if (!namesShareScope) { var name_9 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_9, name_9); @@ -15708,7 +15840,7 @@ var ts; } if (node.kind !== 132 && node.kind !== 131) { checkExportsOnMergedDeclarations(node); - if (node.kind === 195 || node.kind === 152) { + if (node.kind === 198 || node.kind === 152) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -15737,7 +15869,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 176 || node.kind === 154) { + if (node.kind === 179 || node.kind === 154) { return true; } node = node.parent; @@ -15765,12 +15897,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 196) { + if (node.initializer && node.initializer.kind == 199) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -15785,7 +15917,7 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { checkForInOrForOfVariableDeclaration(node); } else { @@ -15806,7 +15938,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { 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); @@ -16005,7 +16137,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 218 && !hasDuplicateDefaultClause) { + if (clause.kind === 221 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -16017,7 +16149,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 217) { + if (produceDiagnostics && clause.kind === 220) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -16034,7 +16166,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 191 && current.label.text === node.label.text) { + if (current.kind === 194 && 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; @@ -16098,9 +16230,9 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 198) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 201) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -16173,7 +16305,15 @@ var ts; } } } + function checkClassExpression(node) { + grammarErrorOnNode(node, ts.Diagnostics.class_expressions_are_not_currently_supported); + ts.forEach(node.members, checkSourceElement); + return unknownType; + } function checkClassDeclaration(node) { + if (node.parent.kind !== 206 && node.parent.kind !== 227) { + grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + } checkGrammarClassDeclarationHeritageClauses(node); checkDecorators(node); if (node.name) { @@ -16186,10 +16326,13 @@ var ts; var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); var staticType = getTypeOfSymbol(symbol); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); + } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkTypeReference(baseTypeNode); + checkHeritageClauseElement(baseTypeNode); } if (type.baseTypes.length) { if (produceDiagnostics) { @@ -16197,19 +16340,24 @@ var ts; checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); var staticBaseType = getTypeOfSymbol(baseType.symbol); checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType.symbol !== resolveEntityName(baseTypeNode.typeName, 107455)) { + if (baseType.symbol !== resolveEntityName(baseTypeNode.expression, 107455)) { error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); } checkKindsOfPropertyMemberOverrides(type, baseType); } - checkExpressionOrQualifiedName(baseTypeNode.typeName); } - var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (type.baseTypes.length || (baseTypeNode && compilerOptions.separateCompilation)) { + checkExpressionOrQualifiedName(baseTypeNode.expression); + } + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - checkTypeReference(typeRefNode); + if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromTypeReferenceNode(typeRefNode); + var t = getTypeFromHeritageClauseElement(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { @@ -16246,7 +16394,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. var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < baseProperties.length; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -16310,7 +16458,7 @@ var ts; if (!tp1.constraint || !tp2.constraint) { return false; } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + if (!isTypeIdenticalTo(getTypeFromTypeNodeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrHeritageClauseElement(tp2.constraint))) { return false; } } @@ -16323,10 +16471,10 @@ var ts; var seen = {}; ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0, _c = properties.length; _b < _c; _b++) { + for (var _b = 0; _b < properties.length; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; @@ -16354,7 +16502,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 199); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -16370,7 +16518,12 @@ var ts; } } } - ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { + if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(heritageElement); + }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { checkTypeForDuplicateIndexSignatures(node); @@ -16535,11 +16688,14 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); + var enumIsConst = ts.isConst(node); + if (compilerOptions.separateCompilation && enumIsConst && ts.isInAmbientContext(node)) { + error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided); + } var enumSymbol = getSymbolOfNode(node); var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { if (enumSymbol.declarations.length > 1) { - var enumIsConst = ts.isConst(node); ts.forEach(enumSymbol.declarations, function (decl) { if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); @@ -16548,7 +16704,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 201) { + if (declaration.kind !== 204) { return false; } var enumDeclaration = declaration; @@ -16569,9 +16725,9 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 198 || (declaration.kind === 197 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 201 || (declaration.kind === 200 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -16591,7 +16747,7 @@ var ts; if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -16614,20 +16770,29 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 126) { - node = node.left; + while (true) { + if (node.kind === 126) { + node = node.left; + } + else if (node.kind === 155) { + node = node.expression; + } + else { + break; + } } + ts.Debug.assert(node.kind === 65); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (ts.getFullWidth(moduleName) !== 0 && moduleName.kind !== 8) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { - error(moduleName, node.kind === 212 ? + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { + error(moduleName, node.kind === 215 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; @@ -16646,7 +16811,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 214 ? + var message = node.kind === 217 ? 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)); @@ -16669,7 +16834,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { checkImportBinding(importClause.namedBindings); } else { @@ -16714,8 +16879,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); } } @@ -16734,8 +16899,8 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 224 ? node.parent : node.parent.parent; - if (container.kind === 202 && container.name.kind === 65) { + var container = node.parent.kind === 227 ? node.parent : node.parent.parent; + if (container.kind === 205 && container.name.kind === 65) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; } @@ -16762,10 +16927,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 224) { + if (node.kind === 227) { return node.statements; } - if (node.kind === 202 && node.body.kind === 203) { + if (node.kind === 205 && node.body.kind === 206) { return node.body.statements; } return emptyArray; @@ -16817,7 +16982,7 @@ var ts; case 137: return checkAccessorDeclaration(node); case 141: - return checkTypeReference(node); + return checkTypeReferenceNode(node); case 144: return checkTypeQuery(node); case 145: @@ -16830,71 +16995,71 @@ var ts; return checkUnionType(node); case 149: return checkSourceElement(node.type); - case 197: + case 200: return checkFunctionDeclaration(node); - case 176: - case 203: - return checkBlock(node); - case 177: - return checkVariableStatement(node); case 179: - return checkExpressionStatement(node); + case 206: + return checkBlock(node); case 180: - return checkIfStatement(node); - case 181: - return checkDoStatement(node); + return checkVariableStatement(node); case 182: - return checkWhileStatement(node); + return checkExpressionStatement(node); case 183: - return checkForStatement(node); + return checkIfStatement(node); case 184: - return checkForInStatement(node); + return checkDoStatement(node); case 185: - return checkForOfStatement(node); + return checkWhileStatement(node); case 186: + return checkForStatement(node); case 187: - return checkBreakOrContinueStatement(node); + return checkForInStatement(node); case 188: - return checkReturnStatement(node); + return checkForOfStatement(node); case 189: - return checkWithStatement(node); case 190: - return checkSwitchStatement(node); + return checkBreakOrContinueStatement(node); case 191: - return checkLabeledStatement(node); + return checkReturnStatement(node); case 192: - return checkThrowStatement(node); + return checkWithStatement(node); case 193: - return checkTryStatement(node); + return checkSwitchStatement(node); + case 194: + return checkLabeledStatement(node); case 195: + return checkThrowStatement(node); + case 196: + return checkTryStatement(node); + case 198: return checkVariableDeclaration(node); case 152: return checkBindingElement(node); - case 198: - return checkClassDeclaration(node); - case 199: - return checkInterfaceDeclaration(node); - case 200: - return checkTypeAliasDeclaration(node); case 201: - return checkEnumDeclaration(node); + return checkClassDeclaration(node); case 202: - return checkModuleDeclaration(node); - case 206: - return checkImportDeclaration(node); + return checkInterfaceDeclaration(node); + case 203: + return checkTypeAliasDeclaration(node); + case 204: + return checkEnumDeclaration(node); case 205: + return checkModuleDeclaration(node); + case 209: + return checkImportDeclaration(node); + case 208: return checkImportEqualsDeclaration(node); - case 212: - return checkExportDeclaration(node); - case 211: - return checkExportAssignment(node); - case 178: - checkGrammarStatementInAmbientContext(node); - return; - case 194: - checkGrammarStatementInAmbientContext(node); - return; case 215: + return checkExportDeclaration(node); + case 214: + return checkExportAssignment(node); + case 181: + checkGrammarStatementInAmbientContext(node); + return; + case 197: + checkGrammarStatementInAmbientContext(node); + return; + case 218: return checkMissingDeclaration(node); } } @@ -16915,10 +17080,10 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 189: + case 192: checkFunctionExpressionBodies(node.expression); break; case 129: @@ -16929,14 +17094,14 @@ var ts; case 152: case 153: case 154: - case 221: + case 224: case 155: case 156: case 157: case 158: case 159: case 171: - case 175: + case 176: case 160: case 161: case 165: @@ -16947,12 +17112,9 @@ var ts; case 169: case 170: case 173: - case 176: - case 203: - case 177: case 179: + case 206: case 180: - case 181: case 182: case 183: case 184: @@ -16960,21 +17122,24 @@ var ts; case 186: case 187: case 188: + case 189: case 190: - case 204: - case 217: - case 218: case 191: - case 192: case 193: + case 207: case 220: + case 221: + case 194: case 195: case 196: - case 198: - case 201: case 223: - case 211: - case 224: + case 198: + case 199: + case 201: + case 204: + case 226: + case 214: + case 227: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -17029,7 +17194,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 189 && node.parent.statement === node) { + if (node.parent.kind === 192 && node.parent.statement === node) { return true; } node = node.parent; @@ -17051,18 +17216,18 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) { break; } - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17103,17 +17268,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17138,20 +17303,28 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 128: - case 198: - case 199: - case 200: case 201: + case 202: + case 203: + case 204: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126) + while (node.parent && node.parent.kind === 126) { node = node.parent; + } return node.parent && node.parent.kind === 141; } - function isTypeNode(node) { + function isHeritageClauseElementIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 155) { + node = node.parent; + } + return node.parent && node.parent.kind === 177; + } + function isTypeNodeOrHeritageClauseElement(node) { if (141 <= node.kind && node.kind <= 149) { return true; } @@ -17166,12 +17339,18 @@ var ts; return node.parent.kind !== 166; case 8: return node.parent.kind === 129; + case 177: + return true; case 65: if (node.parent.kind === 126 && node.parent.right === node) { node = node.parent; } + else if (node.parent.kind === 155 && node.parent.name === node) { + node = node.parent; + } case 126: - ts.Debug.assert(node.kind === 65 || node.kind === 126, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 155: + ts.Debug.assert(node.kind === 65 || node.kind === 126 || node.kind === 155, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_5 = node.parent; if (parent_5.kind === 144) { return false; @@ -17180,14 +17359,16 @@ var ts; return true; } switch (parent_5.kind) { + case 177: + return true; case 128: return node === parent_5.constraint; case 132: case 131: case 129: - case 195: + case 198: return node === parent_5.type; - case 197: + case 200: case 162: case 163: case 135: @@ -17215,10 +17396,10 @@ var ts; while (nodeOnRightSide.parent.kind === 126) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 205) { + if (nodeOnRightSide.parent.kind === 208) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 211) { + if (nodeOnRightSide.parent.kind === 214) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -17226,15 +17407,11 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } - function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 && node.parent.right === node) || - (node.parent.kind === 155 && node.parent.name === node); - } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 211) { + if (entityName.parent.kind === 214) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 155) { @@ -17242,11 +17419,16 @@ var ts; return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } } - if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (ts.isExpression(entityName)) { - if (ts.getFullWidth(entityName) === 0) { + if (isHeritageClauseElementIdentifier(entityName)) { + var meaning = entityName.parent.kind === 177 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, meaning); + } + else if (ts.isExpression(entityName)) { + if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 65) { @@ -17283,7 +17465,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 211 + return node.parent.kind === 214 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } @@ -17306,7 +17488,7 @@ var ts; var moduleName; if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 206 || node.parent.kind === 212) && + ((node.parent.kind === 209 || node.parent.kind === 215) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -17325,7 +17507,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 222) { + if (location && location.kind === 225) { return resolveEntityName(location.name, 107455); } return undefined; @@ -17334,12 +17516,12 @@ var ts; if (isInsideWithStatementBody(node)) { return unknownType; } + if (isTypeNodeOrHeritageClauseElement(node)) { + return getTypeFromTypeNodeOrHeritageClauseElement(node); + } if (ts.isExpression(node)) { return getTypeOfExpression(node); } - if (isTypeNode(node)) { - return getTypeFromTypeNode(node); - } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -17364,7 +17546,7 @@ var ts; return unknownType; } function getTypeOfExpression(expr) { - if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } return checkExpression(expr); @@ -17399,7 +17581,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 224; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { if (languageVersion >= 2) { @@ -17407,10 +17589,10 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 207) { + if (node.kind === 210) { return getGeneratedNameForNode(node.parent) + ".default"; } - if (node.kind === 210) { + if (node.kind === 213) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -17427,7 +17609,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 202 || node.kind === 201) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 205 || node.kind === 204) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -17450,29 +17632,33 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 205: - case 207: case 208: case 210: - case 214: + case 211: + case 213: + case 217: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 212: + case 215: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 211: + case 214: return node.expression && node.expression.kind === 65 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 224 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 227 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } - return isAliasResolvedToValue(getSymbolOfNode(node)); + var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); + return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - return target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + if (target === unknownSymbol && compilerOptions.separateCompilation) { + return true; + } + return target !== unknownSymbol && target && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -17506,7 +17692,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 223) { + if (node.kind === 226) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -17541,13 +17727,13 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 195 && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 198 && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 220; + symbol.valueDeclaration.parent.kind !== 223; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -17653,17 +17839,17 @@ var ts; case 134: case 133: case 140: - case 198: - case 199: - case 202: case 201: - case 177: - case 197: - case 200: - case 206: + case 202: case 205: - case 212: - case 211: + case 204: + case 180: + case 200: + case 203: + case 209: + case 208: + case 215: + case 214: case 129: break; default: @@ -17674,7 +17860,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 109: @@ -17698,7 +17884,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -17707,7 +17893,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 129) { @@ -17723,7 +17909,7 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 129) { @@ -17735,13 +17921,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 129) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 203) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -17760,10 +17946,10 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 206 || node.kind === 205) && flags & 2) { + else if ((node.kind === 209 || node.kind === 208) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 199 && flags & 2) { + else if (node.kind === 202 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } else if (node.kind === 129 && (flags & 112) && ts.isBindingPattern(node.name)) { @@ -17891,9 +18077,9 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _n = arguments.length; _i < _n; _i++) { + for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 174) { + if (arg.kind === 175) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -17918,7 +18104,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -17946,7 +18132,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -17992,16 +18178,16 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_11 = prop.name; - if (prop.kind === 174 || + if (prop.kind === 175 || name_11.kind === 127) { checkGrammarComputedPropertyName(name_11); continue; } var currentKind = void 0; - if (prop.kind === 221 || prop.kind === 222) { + if (prop.kind === 224 || prop.kind === 225) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_11.kind === 7) { checkGrammarNumbericLiteral(name_11); @@ -18048,24 +18234,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 196) { + if (forInOrOfStatement.initializer.kind === 199) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? 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 === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? 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); @@ -18134,7 +18320,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -18145,7 +18331,7 @@ 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 === 199) { + else if (node.parent.kind === 202) { 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 === 145) { @@ -18154,13 +18340,13 @@ var ts; } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return true; - case 191: + case 194: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -18172,9 +18358,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 191: + case 194: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 186 + var isMisplacedContinueLabel = node.kind === 189 && !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); @@ -18182,8 +18368,8 @@ var ts; return false; } break; - case 190: - if (node.kind === 187 && !node.label) { + case 193: + if (node.kind === 190 && !node.label) { return false; } break; @@ -18196,13 +18382,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 187 + var message = node.kind === 190 ? 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 === 187 + var message = node.kind === 190 ? 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); @@ -18221,11 +18407,8 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 184 && node.parent.parent.kind !== 185) { + if (node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { if (ts.isInAmbientContext(node)) { - if (ts.isBindingPattern(node.name)) { - return grammarErrorOnNode(node, ts.Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); - } if (node.initializer) { var equalsTokenLength = "=".length; return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); @@ -18252,7 +18435,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _n = elements.length; _i < _n; _i++) { + for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -18269,15 +18452,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 180: - case 181: - case 182: - case 189: case 183: case 184: case 185: + case 192: + case 186: + case 187: + case 188: return false; - case 191: + case 194: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -18310,7 +18493,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; if (node.name.kind === 127) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -18374,13 +18557,13 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -18395,11 +18578,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 199 || - node.kind === 206 || - node.kind === 205 || - node.kind === 212 || - node.kind === 211 || + if (node.kind === 202 || + node.kind === 209 || + node.kind === 208 || + node.kind === 215 || + node.kind === 214 || (node.flags & 2) || (node.flags & (1 | 256))) { return false; @@ -18407,9 +18590,9 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 177) { + if (ts.isDeclaration(decl) || decl.kind === 180) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -18428,7 +18611,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 === 176 || node.parent.kind === 203 || node.parent.kind === 224) { + if (node.parent.kind === 179 || node.parent.kind === 206 || node.parent.kind === 227) { 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); @@ -18509,7 +18692,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 206); + ts.Debug.assert(aliasEmitInfo.node.kind === 209); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -18582,10 +18765,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 195) { + if (declaration.kind === 198) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 209 || declaration.kind === 210 || declaration.kind === 207) { + else if (declaration.kind === 212 || declaration.kind === 213 || declaration.kind === 210) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -18596,7 +18779,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 206) { + if (moduleElementEmitInfo.node.kind === 209) { moduleElementEmitInfo.isVisible = true; } else { @@ -18604,12 +18787,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -18662,14 +18845,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { @@ -18704,6 +18887,8 @@ var ts; case 99: case 8: return writeTextOfNode(currentSourceFile, type); + case 177: + return emitHeritageClauseElement(type); case 141: return emitTypeReference(type); case 144: @@ -18725,11 +18910,9 @@ var ts; return emitEntityName(type); case 126: return emitEntityName(type); - default: - ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 205 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 208 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -18737,10 +18920,22 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var qualifiedName = entityName; - writeEntityName(qualifiedName.left); + var left = entityName.kind === 126 ? entityName.left : entityName.expression; + var right = entityName.kind === 126 ? entityName.right : entityName.name; + writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, qualifiedName.right); + writeTextOfNode(currentSourceFile, right); + } + } + } + function emitHeritageClauseElement(node) { + if (ts.isSupportedHeritageClauseElement(node)) { + ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 155); + emitEntityName(node.expression); + if (node.typeArguments) { + write("<"); + emitCommaList(node.typeArguments, emitType); + write(">"); } } } @@ -18824,10 +19019,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 205 || - (node.parent.kind === 224 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 208 || + (node.parent.kind === 227 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 224) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -18836,7 +19031,7 @@ var ts; }); } else { - if (node.kind === 206) { + if (node.kind === 209) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -18854,23 +19049,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 197: - return writeFunctionDeclaration(node); - case 177: - return writeVariableStatement(node); - case 199: - return writeInterfaceDeclaration(node); - case 198: - return writeClassDeclaration(node); case 200: - return writeTypeAliasDeclaration(node); - case 201: - return writeEnumDeclaration(node); + return writeFunctionDeclaration(node); + case 180: + return writeVariableStatement(node); case 202: - return writeModuleDeclaration(node); + return writeInterfaceDeclaration(node); + case 201: + return writeClassDeclaration(node); + case 203: + return writeTypeAliasDeclaration(node); + case 204: + return writeEnumDeclaration(node); case 205: + return writeModuleDeclaration(node); + case 208: return writeImportEqualsDeclaration(node); - case 206: + case 209: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -18884,7 +19079,7 @@ var ts; if (node.flags & 256) { write("default "); } - else if (node.kind !== 199) { + else if (node.kind !== 202) { write("declare "); } } @@ -18928,7 +19123,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 208) { + if (namedBindings.kind === 211) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -18954,7 +19149,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -19005,7 +19200,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 203) { + while (node.body.kind !== 206) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -19094,10 +19289,10 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 198: + case 201: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 199: + case 202: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 139: @@ -19111,14 +19306,14 @@ var ts; if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { + else if (node.parent.parent.kind === 201) { 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 197: + case 200: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -19143,10 +19338,12 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + if (ts.isSupportedHeritageClauseElement(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { 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; @@ -19179,11 +19376,11 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { emitHeritageClause([baseTypeNode], false); } - emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); write(" {"); writeLine(); increaseIndent(); @@ -19223,7 +19420,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 195 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 198 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -19241,7 +19438,7 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 195) { + if (node.kind === 198) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19256,7 +19453,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 === 198) { + else if (node.parent.kind === 201) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19279,7 +19476,14 @@ var ts; } : undefined; } function emitBindingPattern(bindingPattern) { - emitCommaList(bindingPattern.elements, emitBindingElement); + var elements = []; + for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 175) { + elements.push(element); + } + } + emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { @@ -19409,13 +19613,13 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 197) { + if (node.kind === 200) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 134) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 197) { + if (node.kind === 200) { write("function "); writeTextOfNode(currentSourceFile, node.name); } @@ -19497,7 +19701,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 === 198) { + else if (node.parent.kind === 201) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19510,7 +19714,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 197: + case 200: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19533,7 +19737,7 @@ var ts; write("..."); } if (ts.isBindingPattern(node.name)) { - write("_" + ts.indexOf(node.parent.parameters, node)); + emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); @@ -19551,79 +19755,124 @@ var ts; writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage; + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { case 135: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - break; case 139: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 134: case 133: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + else if (node.parent.parent.kind === 201) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - break; - case 197: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 200: + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); } - return { - diagnosticMessage: diagnosticMessage, - errorNode: node, - typeName: node.name - }; + } + function emitBindingPattern(bindingPattern) { + if (bindingPattern.kind === 150) { + write("{"); + emitCommaList(bindingPattern.elements, emitBindingElement); + write("}"); + } + else if (bindingPattern.kind === 151) { + write("["); + var elements = bindingPattern.elements; + emitCommaList(elements, emitBindingElement); + if (elements && elements.hasTrailingComma) { + write(", "); + } + write("]"); + } + } + function emitBindingElement(bindingElement) { + function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: bindingElement, + typeName: bindingElement.name + } : undefined; + } + if (bindingElement.kind === 175) { + write(" "); + } + else if (bindingElement.kind === 152) { + if (bindingElement.propertyName) { + writeTextOfNode(currentSourceFile, bindingElement.propertyName); + write(": "); + emitBindingPattern(bindingElement.name); + } + else if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + emitBindingPattern(bindingElement.name); + } + else { + ts.Debug.assert(bindingElement.name.kind === 65); + if (bindingElement.dotDotDotToken) { + write("..."); + } + writeTextOfNode(currentSourceFile, bindingElement.name); + } + } + } } } function emitNode(node) { switch (node.kind) { - case 197: - case 202: - case 205: - case 199: - case 198: case 200: + case 205: + case 208: + case 202: case 201: + case 203: + case 204: return emitModuleElement(node, isModuleElementVisible(node)); - case 177: + case 180: return emitModuleElement(node, isVariableStatementVisible(node)); - case 206: + case 209: return emitModuleElement(node, !node.importClause); - case 212: + case 215: return emitExportDeclaration(node); case 135: case 134: @@ -19639,11 +19888,11 @@ var ts; case 132: case 131: return emitPropertyDeclaration(node); - case 223: + case 226: return emitEnumMemberDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFile(node); } } @@ -19745,7 +19994,6 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; - var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var generatedNameSet = {}; var nodeToGeneratedName = []; @@ -19864,24 +20112,24 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 197: - case 198: + case 200: + case 201: generateNameForFunctionOrClassDeclaration(node); break; - case 202: + case 205: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 201: + case 204: generateNameForModuleOrEnum(node); break; - case 206: + case 209: generateNameForImportDeclaration(node); break; - case 212: + case 215: generateNameForExportDeclaration(node); break; - case 211: + case 214: generateNameForExportAssignment(node); break; } @@ -20035,15 +20283,15 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 197 || + else if (node.kind === 200 || node.kind === 162 || node.kind === 134 || node.kind === 133 || node.kind === 136 || node.kind === 137 || - node.kind === 202 || - node.kind === 198 || - node.kind === 201) { + node.kind === 205 || + node.kind === 201 || + node.kind === 204) { if (node.name) { var name_15 = node.name; scopeName = name_15.kind === 127 @@ -20131,7 +20379,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 224) { + if (node.kind != 227) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -20216,7 +20464,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -20226,7 +20474,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -20240,7 +20488,7 @@ var ts; write(","); } decreaseIndent(); - if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -20505,35 +20753,35 @@ var ts; var parent = node.parent; switch (parent.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: - case 197: + case 200: case 136: case 137: case 162: - case 198: - case 199: case 201: case 202: + case 204: case 205: - case 207: case 208: - return parent.name === node; case 210: - case 214: - return parent.name === node || parent.propertyName === node; - case 187: - case 186: case 211: + return parent.name === node; + case 213: + case 217: + return parent.name === node || parent.propertyName === node; + case 190: + case 189: + case 214: return false; - case 191: + case 194: return node.parent.label === node; } } @@ -20727,9 +20975,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 221: + case 224: return property.initializer; - case 222: + case 225: return createIdentifier(resolver.getExpressionNameSubstitution(property.name, getGeneratedNameForNode)); case 134: return createFunctionExpression(property.parameters, property.body); @@ -20784,7 +21032,7 @@ var ts; return result; } function createExpressionStatement(expression) { - var result = ts.createSynthesizedNode(179); + var result = ts.createSynthesizedNode(182); result.expression = expression; return result; } @@ -20803,7 +21051,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(221); + var result = ts.createSynthesizedNode(224); result.name = name; result.initializer = initializer; return result; @@ -20896,6 +21144,9 @@ var ts; } } function tryEmitConstantValue(node) { + if (compilerOptions.separateCompilation) { + return false; + } var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { write(constantValue.toString()); @@ -20908,7 +21159,7 @@ var ts; return false; } function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); @@ -21113,7 +21364,7 @@ var ts; function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 53 && (node.left.kind === 154 || node.left.kind === 153)) { - emitDestructuring(node, node.parent.kind === 179); + emitDestructuring(node, node.parent.kind === 182); } else { emit(node.left); @@ -21149,13 +21400,13 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 176) { + if (node && node.kind === 179) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { - if (preserveNewLines && isSingleLineEmptyBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -21164,12 +21415,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 203) { - ts.Debug.assert(node.parent.kind === 202); + if (node.kind === 206) { + ts.Debug.assert(node.parent.kind === 205); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 203) { + if (node.kind === 206) { emitTempDeclarations(true); } decreaseIndent(); @@ -21178,7 +21429,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 176) { + if (node.kind === 179) { write(" "); emit(node); } @@ -21203,7 +21454,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76, node.thenStatement.end); - if (node.elseStatement.kind === 180) { + if (node.elseStatement.kind === 183) { write(" "); emit(node.elseStatement); } @@ -21215,7 +21466,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { write(" "); } else { @@ -21259,7 +21510,7 @@ var ts; var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 196) { + if (node.initializer && node.initializer.kind === 199) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; emitStartOfVariableDeclarationList(declarations[0], endPos); @@ -21277,13 +21528,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 185) { + if (languageVersion < 2 && node.kind === 188) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; @@ -21295,7 +21546,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 184) { + if (node.kind === 187) { write(" in "); } else { @@ -21332,7 +21583,6 @@ var ts; var rhsIsIdentifier = node.expression.kind === 65; var counter = createTempVariable(268435456); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(536870912) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -21346,24 +21596,12 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } - if (cachedLength) { - write(", "); - emitNodeWithoutSourceMap(cachedLength); - write(" = "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - if (cachedLength) { - emitNodeWithoutSourceMap(cachedLength); - } - else { - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } + emitNodeWithoutSourceMap(rhsReference); + write(".length"); emitEnd(node.initializer); write("; "); emitStart(node.initializer); @@ -21376,7 +21614,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -21407,7 +21645,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { emitLines(node.statement.statements); } else { @@ -21419,7 +21657,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 187 ? 66 : 71, node.pos); + emitToken(node.kind === 190 ? 66 : 71, node.pos); emitOptional(" ", node.label); write(";"); } @@ -21464,7 +21702,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 217) { + if (node.kind === 220) { write("case "); emit(node.expression); write(":"); @@ -21472,7 +21710,7 @@ var ts; else { write("default:"); } - if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -21519,7 +21757,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 202); + } while (node && node.kind !== 205); return node; } function emitContainingModuleName(node) { @@ -21552,11 +21790,11 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (node.name) { - emitModuleMemberName(node); + if (node.flags & 256) { + write("exports.default"); } else { - write("exports.default"); + emitModuleMemberName(node); } write(" = "); emitDeclarationName(node); @@ -21566,7 +21804,7 @@ var ts; } function emitExportMemberAssignments(name) { if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _a = 0, _b = exportSpecifiers[name.text], _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); emitStart(specifier.name); @@ -21582,7 +21820,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var isDeclaration = (root.kind === 195 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; + var isDeclaration = (root.kind === 198 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; if (root.kind === 169) { emitAssignmentExpression(root); } @@ -21595,7 +21833,7 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 195 || name.parent.kind === 152)) { + if (name.parent && (name.parent.kind === 198 || name.parent.kind === 152)) { emitModuleMemberName(name.parent); } else { @@ -21662,9 +21900,9 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _a = 0, _b = properties.length; _a < _b; _a++) { + for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -21677,7 +21915,7 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } @@ -21744,7 +21982,7 @@ var ts; var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 174) { + else if (element.kind !== 175) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -21781,8 +22019,8 @@ var ts; var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); if (isUninitializedLet && - node.parent.parent.kind !== 184 && - node.parent.parent.kind !== 185) { + node.parent.parent.kind !== 187 && + node.parent.parent.kind !== 188) { initializer = createVoidZero(); } } @@ -21790,7 +22028,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 174) { + if (node.kind === 175) { return; } var name = node.name; @@ -21802,7 +22040,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 195 && node.parent.kind !== 152)) { + if (!node.parent || (node.parent.kind !== 198 && node.parent.kind !== 152)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -21811,24 +22049,24 @@ var ts; if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 65 || - (node.parent.kind !== 195 && node.parent.kind !== 152)) { + (node.parent.kind !== 198 && node.parent.kind !== 152)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); if (((combinedFlags & 12288) === 0) || combinedFlags & 1) { return; } - var list = ts.getAncestor(node, 196); - if (list.parent.kind === 177) { - var isSourceFileLevelBinding = list.parent.parent.kind === 224; - var isModuleLevelBinding = list.parent.parent.kind === 203; - var isFunctionLevelBinding = list.parent.parent.kind === 176 && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 199); + if (list.parent.kind === 180) { + var isSourceFileLevelBinding = list.parent.parent.kind === 227; + var isModuleLevelBinding = list.parent.parent.kind === 206; + var isFunctionLevelBinding = list.parent.parent.kind === 179 && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 224 + var parent = blockScopeContainer.kind === 227 ? blockScopeContainer : blockScopeContainer.parent; if (resolver.resolvesToSomeValue(parent, node.text)) { @@ -21843,7 +22081,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && languageVersion >= 2 && - node.parent.kind === 224; + node.parent.kind === 227; } function emitVariableStatement(node) { if (!(node.flags & 1)) { @@ -21968,8 +22206,8 @@ var ts; if (node.kind === 162) { return !!node.name; } - else if (node.kind === 197) { - return !!node.name || (languageVersion >= 2 && !(node.flags & 256)); + if (node.kind === 200) { + return !!node.name || languageVersion < 2; } } function emitFunctionDeclaration(node) { @@ -21992,7 +22230,7 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 197 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 200 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } if (node.kind !== 134 && node.kind !== 133) { @@ -22042,7 +22280,7 @@ var ts; if (!node.body) { write(" { }"); } - else if (node.body.kind === 176) { + else if (node.body.kind === 179) { emitBlockFunctionBody(node, node.body); } else { @@ -22081,7 +22319,7 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); @@ -22118,8 +22356,8 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements, _c = _b.length; _a < _c; _a++) { + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { var statement = _b[_a]; write(" "); emit(statement); @@ -22142,7 +22380,7 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 179) { + if (statement && statement.kind === 182) { var expr = statement.expression; if (expr && expr.kind === 157) { var func = expr.expression; @@ -22208,7 +22446,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 134 || node.kind === 133) { + if (member.kind === 178) { + writeLine(); + write(";"); + } + else if (member.kind === 134 || node.kind === 133) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -22275,12 +22517,14 @@ var ts; }); } function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; if ((member.kind === 134 || node.kind === 133) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 || node.kind === 133 || member.kind === 136 || member.kind === 137) { + else if (member.kind === 134 || + member.kind === 136 || + member.kind === 137) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -22298,9 +22542,13 @@ var ts; emitEnd(member); emitTrailingComments(member); } + else if (member.kind === 178) { + writeLine(); + write(";"); + } } } - function emitConstructor(node, baseTypeNode) { + function emitConstructor(node, baseTypeElement) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; @@ -22335,7 +22583,7 @@ var ts; emitSignatureParameters(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { write("(...args)"); } else { @@ -22353,7 +22601,7 @@ var ts; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); - if (baseTypeNode) { + if (baseTypeElement) { var superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); @@ -22363,16 +22611,16 @@ var ts; emitParameterPropertyAssignments(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { writeLine(); - emitStart(baseTypeNode); + emitStart(baseTypeElement); if (languageVersion < 2) { write("_super.apply(this, arguments);"); } else { write("super(...args);"); } - emitEnd(baseTypeNode); + emitEnd(baseTypeElement); } } emitMemberAssignments(node, 0); @@ -22399,28 +22647,36 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { if (languageVersion < 2) { - emitClassDeclarationBelowES6(node); + emitClassLikeDeclarationBelowES6(node); } else { - emitClassDeclarationForES6AndHigher(node); + emitClassLikeDeclarationForES6AndHigher(node); } } - function emitClassDeclarationForES6AndHigher(node) { + function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { - write("export "); + if (node.kind === 201) { + if (thisNodeIsDecorated) { + if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 256) { - write("default "); + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 256) { + write("default "); + } } } write("class"); @@ -22428,10 +22684,10 @@ var ts; write(" "); emitDeclarationName(node); } - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write(" extends "); - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); } write(" {"); increaseIndent(); @@ -22474,11 +22730,14 @@ var ts; write(";"); } } - function emitClassDeclarationBelowES6(node) { - write("var "); - emitDeclarationName(node); - write(" = (function ("); - var baseTypeNode = ts.getClassBaseTypeNode(node); + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 201) { + write("var "); + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write("_super"); } @@ -22525,11 +22784,16 @@ var ts; emitStart(node); write(")("); if (baseTypeNode) { - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 201) { + write(";"); } - write(");"); emitEnd(node); - emitExportMemberAssignment(node); + if (node.kind === 201) { + emitExportMemberAssignment(node); + } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } @@ -22673,7 +22937,7 @@ var ts; } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums; + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.separateCompilation; } function emitEnumDeclaration(node) { if (!shouldEmitEnumDeclaration(node)) { @@ -22752,13 +23016,13 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 202) { + if (moduleDeclaration.body.kind === 205) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } } function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation); } function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); @@ -22780,7 +23044,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 203) { + if (node.body.kind === 206) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -22829,16 +23093,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 208) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 206 && node.importClause && !!node.importClause.name; + return node.kind === 209 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -22865,7 +23129,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -22891,7 +23155,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 205 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 208 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -22903,7 +23167,7 @@ var ts; write(" = "); } else { - var isNakedImport = 206 && !node.importClause; + var isNakedImport = 209 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -22978,7 +23242,7 @@ var ts; emitRequire(ts.getExternalModuleName(node)); write(";"); } - for (var _a = 0, _b = node.exportClause.elements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { var specifier = _b[_a]; if (resolver.isValueAliasDeclaration(specifier)) { writeLine(); @@ -23033,7 +23297,7 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(languageVersion >= 2); var needsComma = false; - for (var _a = 0, _b = specifiers.length; _a < _b; _a++) { + for (var _a = 0; _a < specifiers.length; _a++) { var specifier = specifiers[_a]; if (shouldEmit(specifier)) { if (needsComma) { @@ -23058,8 +23322,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 197 && - expression.kind !== 198) { + if (expression.kind !== 200 && + expression.kind !== 201) { write(";"); } emitEnd(node); @@ -23080,21 +23344,21 @@ var ts; exportSpecifiers = {}; exportEquals = undefined; hasExportStars = false; - for (var _a = 0, _b = sourceFile.statements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 206: + case 209: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 205: - if (node.moduleReference.kind === 216 && resolver.isReferencedAliasDeclaration(node)) { + case 208: + if (node.moduleReference.kind === 219 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 212: + case 215: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -23105,14 +23369,14 @@ var ts; } } else { - for (var _d = 0, _e = node.exportClause.elements, _f = _e.length; _d < _f; _d++) { - var specifier = _e[_d]; + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; var name_17 = (specifier.propertyName || specifier.name).text; (exportSpecifiers[name_17] || (exportSpecifiers[name_17] = [])).push(specifier); } } break; - case 211: + case 214: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -23154,7 +23418,7 @@ var ts; write("\"" + node.amdModuleName + "\", "); } write("[\"require\", \"exports\""); - for (var _a = 0, _b = externalImports.length; _a < _b; _a++) { + for (var _a = 0; _a < externalImports.length; _a++) { var importNode = externalImports[_a]; write(", "); var moduleName = ts.getExternalModuleName(importNode); @@ -23165,15 +23429,15 @@ var ts; write("\"\""); } } - for (var _c = 0, _d = node.amdDependencies, _e = _d.length; _c < _e; _c++) { - var amdDependency = _d[_c]; + for (var _b = 0, _c = node.amdDependencies; _b < _c.length; _b++) { + var amdDependency = _c[_b]; var text = "\"" + amdDependency.path + "\""; write(", "); write(text); } write("], function (require, exports"); - for (var _f = 0, _g = externalImports.length; _f < _g; _f++) { - var importNode = externalImports[_f]; + for (var _d = 0; _d < externalImports.length; _d++) { + var importNode = externalImports[_d]; write(", "); var namespaceDeclaration = getNamespaceDeclarationNode(importNode); if (namespaceDeclaration && !isDefaultImport(importNode)) { @@ -23183,8 +23447,8 @@ var ts; write(getGeneratedNameForNode(importNode)); } } - for (var _h = 0, _j = node.amdDependencies, _k = _j.length; _h < _k; _h++) { - var amdDependency = _j[_h]; + for (var _e = 0, _f = node.amdDependencies; _e < _f.length; _e++) { + var amdDependency = _f[_e]; if (amdDependency.name) { write(", "); write(amdDependency.name); @@ -23317,19 +23581,19 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 199: - case 197: - case 206: - case 205: - case 200: - case 211: - return false; case 202: + case 200: + case 209: + case 208: + case 203: + case 214: + return false; + case 205: return shouldEmitModuleDeclaration(node); - case 201: + case 204: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 176 && + if (node.kind !== 179 && node.parent && node.parent.kind === 163 && node.parent.body === node && @@ -23371,7 +23635,7 @@ var ts; return emitLiteral(node); case 171: return emitTemplateExpression(node); - case 175: + case 176: return emitTemplateSpan(node); case 126: return emitQualifiedName(node); @@ -23385,9 +23649,9 @@ var ts; return emitArrayLiteral(node); case 154: return emitObjectLiteral(node); - case 221: + case 224: return emitPropertyAssignment(node); - case 222: + case 225: return emitShorthandPropertyAssignment(node); case 127: return emitComputedPropertyName(node); @@ -23405,7 +23669,7 @@ var ts; return emit(node.expression); case 161: return emitParenExpression(node); - case 197: + case 200: case 162: case 163: return emitFunctionDeclaration(node); @@ -23425,71 +23689,73 @@ var ts; return emitConditionalExpression(node); case 173: return emitSpreadElementExpression(node); - case 174: + case 175: return; - case 176: - case 203: - return emitBlock(node); - case 177: - return emitVariableStatement(node); - case 178: - return write(";"); case 179: - return emitExpressionStatement(node); - case 180: - return emitIfStatement(node); - case 181: - return emitDoStatement(node); - case 182: - return emitWhileStatement(node); - case 183: - return emitForStatement(node); - case 185: - case 184: - return emitForInOrForOfStatement(node); - case 186: - case 187: - return emitBreakOrContinueStatement(node); - case 188: - return emitReturnStatement(node); - case 189: - return emitWithStatement(node); - case 190: - return emitSwitchStatement(node); - case 217: - case 218: - return emitCaseOrDefaultClause(node); - case 191: - return emitLabelledStatement(node); - case 192: - return emitThrowStatement(node); - case 193: - return emitTryStatement(node); - case 220: - return emitCatchClause(node); - case 194: - return emitDebuggerStatement(node); - case 195: - return emitVariableDeclaration(node); - case 198: - return emitClassDeclaration(node); - case 199: - return emitInterfaceDeclaration(node); - case 201: - return emitEnumDeclaration(node); - case 223: - return emitEnumMember(node); - case 202: - return emitModuleDeclaration(node); case 206: - return emitImportDeclaration(node); + return emitBlock(node); + case 180: + return emitVariableStatement(node); + case 181: + return write(";"); + case 182: + return emitExpressionStatement(node); + case 183: + return emitIfStatement(node); + case 184: + return emitDoStatement(node); + case 185: + return emitWhileStatement(node); + case 186: + return emitForStatement(node); + case 188: + case 187: + return emitForInOrForOfStatement(node); + case 189: + case 190: + return emitBreakOrContinueStatement(node); + case 191: + return emitReturnStatement(node); + case 192: + return emitWithStatement(node); + case 193: + return emitSwitchStatement(node); + case 220: + case 221: + return emitCaseOrDefaultClause(node); + case 194: + return emitLabelledStatement(node); + case 195: + return emitThrowStatement(node); + case 196: + return emitTryStatement(node); + case 223: + return emitCatchClause(node); + case 197: + return emitDebuggerStatement(node); + case 198: + return emitVariableDeclaration(node); + case 174: + return emitClassExpression(node); + case 201: + return emitClassDeclaration(node); + case 202: + return emitInterfaceDeclaration(node); + case 204: + return emitEnumDeclaration(node); + case 226: + return emitEnumMember(node); case 205: + return emitModuleDeclaration(node); + case 209: + return emitImportDeclaration(node); + case 208: return emitImportEqualsDeclaration(node); - case 212: + case 215: return emitExportDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFileNode(node); } } @@ -23517,7 +23783,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.pos !== node.parent.pos) { + if (node.parent.kind === 227 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -23529,7 +23795,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.end !== node.parent.end) { + if (node.parent.kind === 227 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -23623,7 +23889,7 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0.0"; + ts.version = "1.5.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -23946,7 +24212,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 206 || node.kind === 205 || node.kind === 212) { + if (node.kind === 209 || node.kind === 208 || node.kind === 215) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -23966,7 +24232,7 @@ var ts; } } } - else if (node.kind === 202 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 205 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { @@ -23988,6 +24254,20 @@ var ts; } } function verifyCompilerOptions() { + if (options.separateCompilation) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation)); + } + if (options.declaration) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation)); + } + if (options.noEmitOnError) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation)); + } + if (options.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); + } + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); @@ -23999,11 +24279,19 @@ var ts; } var languageVersion = options.target || 0; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); - if (firstExternalModuleSourceFile && !options.module) { + if (options.separateCompilation) { if (!options.module && languageVersion < 2) { - var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } + var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); + if (firstNonExternalModuleSourceFile) { + var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + } + } + else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { + var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher)); @@ -24096,10 +24384,10 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } - if (node.parent.kind === 183) { + if (node.parent.kind === 186) { return textSpan(node); } if (node.parent.kind === 169 && node.parent.operatorToken.kind === 23) { @@ -24110,15 +24398,15 @@ var ts; } } switch (node.kind) { - case 177: + case 180: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 195: + case 198: case 132: case 131: return spanInVariableDeclaration(node); case 129: return spanInParameterDeclaration(node); - case 197: + case 200: case 134: case 133: case 136: @@ -24127,70 +24415,70 @@ var ts; case 162: case 163: return spanInFunctionDeclaration(node); - case 176: + case 179: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 203: + case 206: return spanInBlock(node); - case 220: + case 223: return spanInBlock(node.block); - case 179: - return textSpan(node.expression); - case 188: - return textSpan(node.getChildAt(0), node.expression); case 182: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 181: - return spanInNode(node.statement); - case 194: - return textSpan(node.getChildAt(0)); - case 180: - return textSpan(node, ts.findNextToken(node.expression, node)); + return textSpan(node.expression); case 191: - return spanInNode(node.statement); - case 187: - case 186: - return textSpan(node.getChildAt(0), node.label); - case 183: - return spanInForStatement(node); - case 184: + return textSpan(node.getChildAt(0), node.expression); case 185: return textSpan(node, ts.findNextToken(node.expression, node)); - case 190: + case 184: + return spanInNode(node.statement); + case 197: + return textSpan(node.getChildAt(0)); + case 183: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 194: + return spanInNode(node.statement); + case 190: + case 189: + return textSpan(node.getChildAt(0), node.label); + case 186: + return spanInForStatement(node); + case 187: + case 188: return textSpan(node, ts.findNextToken(node.expression, node)); - case 217: - case 218: - return spanInNode(node.statements[0]); case 193: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 220: + case 221: + return spanInNode(node.statements[0]); + case 196: return spanInBlock(node.tryBlock); - case 192: + case 195: return textSpan(node, node.expression); - case 211: + case 214: if (!node.expression) { return undefined; } return textSpan(node, node.expression); - case 205: + case 208: return textSpan(node, node.moduleReference); - case 206: + case 209: return textSpan(node, node.moduleSpecifier); - case 212: + case 215: return textSpan(node, node.moduleSpecifier); - case 202: + case 205: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 198: case 201: - case 223: + case 204: + case 226: case 157: case 158: return textSpan(node); - case 189: + case 192: return spanInNode(node.statement); - case 199: - case 200: + case 202: + case 203: return undefined; case 22: case 1: @@ -24217,7 +24505,7 @@ var ts; case 81: return spanInNextNode(node); default: - if (node.parent.kind === 221 && node.parent.name === node) { + if (node.parent.kind === 224 && node.parent.name === node) { return spanInNode(node.parent.initializer); } if (node.parent.kind === 160 && node.parent.type === node) { @@ -24230,12 +24518,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 184 || - variableDeclaration.parent.parent.kind === 185) { + if (variableDeclaration.parent.parent.kind === 187 || + variableDeclaration.parent.parent.kind === 188) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 177; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 183 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 180; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 186 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -24281,7 +24569,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 198 && functionDeclaration.kind !== 135); + (functionDeclaration.parent.kind === 201 && functionDeclaration.kind !== 135); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -24301,23 +24589,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 202: + case 205: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 182: - case 180: - case 184: case 185: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 183: + case 187: + case 188: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 186: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 196) { + if (forStatement.initializer.kind === 199) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -24336,34 +24624,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 201: + case 204: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 198: + case 201: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 204: + case 207: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 203: + case 206: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } + case 204: case 201: - case 198: return textSpan(node); - case 176: + case 179: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 220: + case 223: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 204: + case 207: var caseBlock = node.parent; var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { @@ -24375,7 +24663,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -24383,16 +24671,16 @@ var ts; function spanInCloseParenToken(node) { switch (node.parent.kind) { case 162: - case 197: + case 200: case 163: case 134: case 133: case 136: case 137: case 135: - case 182: - case 181: - case 183: + case 185: + case 184: + case 186: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -24400,7 +24688,7 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 221) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 224) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -24412,7 +24700,7 @@ var ts; return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); @@ -24464,23 +24752,23 @@ var ts; return; } switch (n.kind) { - case 176: + case 179: if (!ts.isFunctionBlock(n)) { var parent_6 = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent_6.kind === 181 || - parent_6.kind === 184 || - parent_6.kind === 185 || + if (parent_6.kind === 184 || + parent_6.kind === 187 || + parent_6.kind === 188 || + parent_6.kind === 186 || parent_6.kind === 183 || - parent_6.kind === 180 || - parent_6.kind === 182 || - parent_6.kind === 189 || - parent_6.kind === 220) { + parent_6.kind === 185 || + parent_6.kind === 192 || + parent_6.kind === 223) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_6.kind === 193) { + if (parent_6.kind === 196) { var tryStatement = parent_6; if (tryStatement.tryBlock === n) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); @@ -24503,17 +24791,17 @@ var ts; }); break; } - case 203: { + case 206: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 198: - case 199: case 201: + case 202: + case 204: case 154: - case 204: { + case 207: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -24545,7 +24833,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -24577,7 +24865,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -24658,7 +24946,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < bestMatchKind) { @@ -24705,14 +24993,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 202: + case 205: do { current = current.parent; - } while (current.kind === 202); - case 198: + } while (current.kind === 205); case 201: - case 199: - case 197: + case 204: + case 202: + case 200: indent++; } current = current.parent; @@ -24723,26 +25011,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 177: + case 180: ts.forEach(node.declarationList.declarations, visit); break; case 150: case 151: ts.forEach(node.elements, visit); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { childNodes.push(importClause.namedBindings); } else { @@ -24752,19 +25040,19 @@ var ts; } break; case 152: - case 195: + case 198: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 198: case 201: - case 199: + case 204: case 202: - case 197: case 205: - case 210: - case 214: + case 200: + case 208: + case 213: + case 217: childNodes.push(node); break; } @@ -24796,20 +25084,20 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 198: case 201: - case 199: + case 204: + case 202: topLevelNodes.push(node); break; - case 202: + case 205: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 197: + case 200: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -24820,9 +25108,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 197) { - if (functionDeclaration.body && functionDeclaration.body.kind === 176) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 197 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 200) { + if (functionDeclaration.body && functionDeclaration.body.kind === 179) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 200 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -24835,7 +25123,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; var item_3 = createItem(child); if (item_3 !== undefined) { @@ -24860,9 +25148,9 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems, _n = _a.length; _i < _n; _i++) { + outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { var sourceChild = _a[_i]; - for (var _b = 0, _c = target.childItems, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); @@ -24892,7 +25180,7 @@ var ts; return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); case 140: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 223: + case 226: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); case 138: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); @@ -24901,16 +25189,16 @@ var ts; case 132: case 131: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 197: + case 200: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 195: + case 198: case 152: var variableDeclarationNode; var name_18; if (node.kind === 152) { name_18 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 195) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 198) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -24931,11 +25219,11 @@ var ts; } case 135: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 214: - case 210: - case 205: - case 207: + case 217: + case 213: case 208: + case 210: + case 211: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -24965,17 +25253,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 224: + case 227: return createSourceFileItem(node); - case 198: - return createClassItem(node); case 201: + return createClassItem(node); + case 204: return createEnumItem(node); - case 199: - return createIterfaceItem(node); case 202: + return createIterfaceItem(node); + case 205: return createModuleItem(node); - case 197: + case 200: return createFunctionItem(node); } return undefined; @@ -24985,7 +25273,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 202) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 205) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -24997,7 +25285,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if ((node.name || node.flags & 256) && node.body && node.body.kind === 176) { + if ((node.name || node.flags & 256) && node.body && node.body.kind === 179) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem((!node.name && node.flags & 256) ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -25045,13 +25333,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 202) { + while (node.body.kind === 205) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 224 + return node.kind === 227 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -25143,7 +25431,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0, _n = wordSpans.length; _i < _n; _i++) { + for (var _i = 0; _i < wordSpans.length; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -25196,7 +25484,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0, _n = subWordTextChunks.length; _i < _n; _i++) { + for (var _i = 0; _i < subWordTextChunks.length; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -25581,7 +25869,7 @@ var ts; var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 175 && node.parent.parent.parent.kind === 159) { + else if (node.parent.kind === 176 && node.parent.parent.parent.kind === 159) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; @@ -25598,7 +25886,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0, _n = listChildren.length; _i < _n; _i++) { + for (var _i = 0; _i < listChildren.length; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -25658,7 +25946,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 224; n = n.parent) { + for (var n = node; n.kind !== 227; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -25839,17 +26127,17 @@ var ts; return false; } switch (n.kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 154: case 150: case 145: - case 176: - case 203: - case 204: + case 179: + case 206: + case 207: return nodeEndsWith(n, 15, sourceFile); - case 220: + case 223: return isCompletedNode(n.block, sourceFile); case 158: if (!n.arguments) { @@ -25865,7 +26153,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 134: case 133: @@ -25879,14 +26167,14 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 17, sourceFile); - case 202: + case 205: return n.body && isCompletedNode(n.body, sourceFile); - case 180: + case 183: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 179: + case 182: return isCompletedNode(n.expression, sourceFile); case 153: case 151: @@ -25899,15 +26187,15 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19, sourceFile); - case 217: - case 218: + case 220: + case 221: return false; - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: return isCompletedNode(n.statement, sourceFile); - case 181: + case 184: var hasWhileKeyword = findChildOfKind(n, 100, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 17, sourceFile); @@ -25927,7 +26215,7 @@ var ts; case 171: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 175: + case 176: return ts.nodeIsPresent(n.literal); case 167: return isCompletedNode(n.operand, sourceFile); @@ -25976,7 +26264,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 225 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 228 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -26041,7 +26329,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); @@ -26082,7 +26370,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 224); + ts.Debug.assert(startNode !== undefined || n.kind === 227); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -26122,7 +26410,7 @@ var ts; if (node.kind === 141 || node.kind === 157) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 198 || node.kind === 199) { + if (ts.isFunctionLike(node) || node.kind === 201 || node.kind === 202) { return node.typeParameters; } return undefined; @@ -26819,7 +27107,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -27003,7 +27291,7 @@ var ts; throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 183; + return context.contextNode.kind === 186; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); @@ -27013,16 +27301,16 @@ var ts; case 169: case 170: return true; - case 205: - case 195: + case 208: + case 198: case 129: - case 223: + case 226: case 132: case 131: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; - case 184: + case 187: return context.currentTokenSpan.kind === 86 || context.nextTokenSpan.kind === 86; - case 185: + case 188: return context.currentTokenSpan.kind === 125 || context.nextTokenSpan.kind === 125; case 152: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; @@ -27074,17 +27362,17 @@ var ts; return true; } switch (node.kind) { - case 176: - case 204: + case 179: + case 207: case 154: - case 203: + case 206: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 197: + case 200: case 134: case 133: case 136: @@ -27093,7 +27381,7 @@ var ts; case 162: case 135: case 163: - case 199: + case 202: return true; } return false; @@ -27103,40 +27391,40 @@ var ts; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 198: - case 199: case 201: - case 145: case 202: + case 204: + case 145: + case 205: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 198: - case 202: case 201: - case 176: - case 220: - case 203: - case 190: + case 205: + case 204: + case 179: + case 223: + case 206: + case 193: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 180: - case 190: case 183: - case 184: - case 185: - case 182: case 193: - case 181: - case 189: - case 220: + case 186: + case 187: + case 188: + case 185: + case 196: + case 184: + case 192: + case 223: return true; default: return false; @@ -27161,14 +27449,14 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 196 && + return context.currentTokenParent.kind === 199 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 202; + return context.contextNode.kind === 205; }; Rules.IsObjectTypeContext = function (context) { return context.contextNode.kind === 145; @@ -27179,9 +27467,9 @@ var ts; } switch (parent.kind) { case 141: - case 198: - case 199: - case 197: + case 201: + case 202: + case 200: case 162: case 163: case 134: @@ -27272,7 +27560,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(), _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -27686,17 +27974,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 198: - case 199: - return ts.rangeContainsRange(parent.members, node); + case 201: case 202: + return ts.rangeContainsRange(parent.members, node); + case 205: var body = parent.body; - return body && body.kind === 176 && ts.rangeContainsRange(body.statements, node); - case 224: - case 176: - case 203: + return body && body.kind === 179 && ts.rangeContainsRange(body.statements, node); + case 227: + case 179: + case 206: return ts.rangeContainsRange(parent.statements, node); - case 220: + case 223: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -27815,9 +28103,9 @@ var ts; if (indentation === -1) { if (isSomeBlock(node.kind)) { if (isSomeBlock(parent.kind) || - parent.kind === 224 || - parent.kind === 217 || - parent.kind === 218) { + parent.kind === 227 || + parent.kind === 220 || + parent.kind === 221) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -27848,10 +28136,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 198: return 69; - case 199: return 104; - case 197: return 83; - case 201: return 201; + case 201: return 69; + case 202: return 104; + case 200: return 83; + case 204: return 204; case 136: return 116; case 137: return 120; case 134: @@ -27990,7 +28278,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, true); } @@ -28035,7 +28323,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -28070,7 +28358,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0, _n = trivia.length; _i < _n; _i++) { + for (var _i = 0; _i < trivia.length; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -28250,8 +28538,8 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 176: - case 203: + case 179: + case 206: return true; } return false; @@ -28259,7 +28547,7 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 135: - case 197: + case 200: case 162: case 134: case 133: @@ -28462,7 +28750,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 224 || !parentAndChildShareLine); + (parent.kind === 227 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -28486,7 +28774,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 180 && parent.elseStatement === child) { + if (parent.kind === 183 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 76, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -28508,7 +28796,7 @@ var ts; return node.parent.properties; case 153: return node.parent.elements; - case 197: + case 200: case 162: case 163: case 134: @@ -28595,25 +28883,25 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 153: - case 176: - case 203: + case 179: + case 206: case 154: case 145: case 147: - case 204: - case 218: - case 217: + case 207: + case 221: + case 220: case 161: case 157: case 158: - case 177: - case 195: - case 211: - case 188: + case 180: + case 198: + case 214: + case 191: case 170: case 151: case 150: @@ -28626,13 +28914,13 @@ var ts; return true; } switch (parent) { - case 181: - case 182: case 184: case 185: + case 187: + case 188: + case 186: case 183: - case 180: - case 197: + case 200: case 162: case 134: case 133: @@ -28641,7 +28929,7 @@ var ts; case 135: case 136: case 137: - return child !== 176; + return child !== 179; default: return false; } @@ -28743,10 +29031,10 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(225, nodes.pos, nodes.end, 1024, this); + var list = createNode(228, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -28805,7 +29093,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (child.kind < 126) { return child; @@ -28871,13 +29159,13 @@ var ts; } }); } - if (declaration.kind === 202 && declaration.body.kind === 202) { + if (declaration.kind === 205 && declaration.body.kind === 205) { return; } - while (declaration.kind === 202 && declaration.parent.kind === 202) { + while (declaration.kind === 205 && declaration.parent.kind === 205) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 195 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 198 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -29162,7 +29450,7 @@ var ts; var namedDeclarations = []; ts.forEachChild(sourceFile, function visit(node) { switch (node.kind) { - case 197: + case 200: case 134: case 133: var functionDeclaration = node; @@ -29181,17 +29469,17 @@ var ts; ts.forEachChild(node, visit); } break; - case 198: - case 199: - case 200: case 201: case 202: + case 203: + case 204: case 205: - case 214: - case 210: - case 205: - case 207: case 208: + case 217: + case 213: + case 208: + case 210: + case 211: case 136: case 137: case 145: @@ -29199,14 +29487,14 @@ var ts; namedDeclarations.push(node); } case 135: - case 177: - case 196: + case 180: + case 199: case 150: case 151: - case 203: + case 206: ts.forEachChild(node, visit); break; - case 176: + case 179: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } @@ -29215,30 +29503,30 @@ var ts; if (!(node.flags & 112)) { break; } - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 223: + case 226: case 132: case 131: namedDeclarations.push(node); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { namedDeclarations.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { namedDeclarations.push(importClause.namedBindings); } else { @@ -29380,11 +29668,11 @@ var ts; if (declaration.kind === 162) { return true; } - if (declaration.kind !== 195 && declaration.kind !== 197) { + if (declaration.kind !== 198 && declaration.kind !== 200) { return false; } for (var parent_7 = declaration.parent; !ts.isFunctionBlock(parent_7); parent_7 = parent_7.parent) { - if (parent_7.kind === 224 || parent_7.kind === 203) { + if (parent_7.kind === 227 || parent_7.kind === 206) { return false; } } @@ -29425,7 +29713,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -29509,6 +29797,37 @@ var ts; sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; } + function transpile(input, compilerOptions, fileName, diagnostics) { + var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions(); + options.separateCompilation = true; + options.allowNonTsExtensions = true; + var inputFileName = fileName || "module.ts"; + var sourceFile = ts.createSourceFile(inputFileName, input, options.target); + if (diagnostics && sourceFile.parseDiagnostics) { + diagnostics.push.apply(diagnostics, sourceFile.parseDiagnostics); + } + var outputText; + var compilerHost = { + getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, + writeFile: function (name, text, writeByteOrderMark) { + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + outputText = text; + }, + getDefaultLibFileName: function () { return "lib.d.ts"; }, + useCaseSensitiveFileNames: function () { return false; }, + getCanonicalFileName: function (fileName) { return fileName; }, + getCurrentDirectory: function () { return ""; }, + getNewLine: function () { return "\r\n"; } + }; + var program = ts.createProgram([inputFileName], options, compilerHost); + if (diagnostics) { + diagnostics.push.apply(diagnostics, program.getGlobalDiagnostics()); + } + program.emit(); + ts.Debug.assert(outputText !== undefined, "Output generation failed"); + return outputText; + } + ts.transpile = transpile; function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { var sourceFile = ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); setSourceFileFields(sourceFile, scriptSnapshot, version); @@ -29750,7 +30069,7 @@ var ts; ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 191 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 194 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -29759,16 +30078,16 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 65 && - (node.parent.kind === 187 || node.parent.kind === 186) && + (node.parent.kind === 190 || node.parent.kind === 189) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 65 && - node.parent.kind === 191 && + node.parent.kind === 194 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 191; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 194; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -29797,7 +30116,7 @@ var ts; return node && node.parent && node.parent.kind === 158 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 202 && node.parent.name === node; + return node.parent.kind === 205 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 65 && @@ -29805,20 +30124,20 @@ var ts; } function isNameOfPropertyAssignment(node) { return (node.kind === 65 || node.kind === 8 || node.kind === 7) && - (node.parent.kind === 221 || node.parent.kind === 222) && node.parent.name === node; + (node.parent.kind === 224 || node.parent.kind === 225) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { case 132: case 131: - case 221: - case 223: + case 224: + case 226: case 134: case 133: case 136: case 137: - case 202: + case 205: return node.parent.name === node; case 156: return node.parent.argumentExpression === node; @@ -29872,17 +30191,17 @@ var ts; return undefined; } switch (node.kind) { - case 224: + case 227: case 134: case 133: - case 197: + case 200: case 162: case 136: case 137: - case 198: - case 199: case 201: case 202: + case 204: + case 205: return node; } } @@ -29890,18 +30209,18 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 202: return ScriptElementKind.moduleElement; - case 198: return ScriptElementKind.classElement; - case 199: return ScriptElementKind.interfaceElement; - case 200: return ScriptElementKind.typeElement; - case 201: return ScriptElementKind.enumElement; - case 195: + case 205: return ScriptElementKind.moduleElement; + case 201: return ScriptElementKind.classElement; + case 202: return ScriptElementKind.interfaceElement; + case 203: return ScriptElementKind.typeElement; + case 204: return ScriptElementKind.enumElement; + case 198: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 197: return ScriptElementKind.functionElement; + case 200: return ScriptElementKind.functionElement; case 136: return ScriptElementKind.memberGetAccessorElement; case 137: return ScriptElementKind.memberSetAccessorElement; case 134: @@ -29915,13 +30234,13 @@ var ts; case 138: return ScriptElementKind.callSignatureElement; case 135: return ScriptElementKind.constructorImplementationElement; case 128: return ScriptElementKind.typeParameterElement; - case 223: return ScriptElementKind.variableElement; + case 226: return ScriptElementKind.variableElement; case 129: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 205: - case 210: - case 207: - case 214: case 208: + case 213: + case 210: + case 217: + case 211: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -29981,7 +30300,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0, _n = oldSourceFiles.length; _i < _n; _i++) { + for (var _i = 0; _i < oldSourceFiles.length; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -30016,7 +30335,7 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; if (!sourceFileUpToDate(program.getSourceFile(fileName))) { return false; @@ -30064,6 +30383,12 @@ var ts; if (!displayName) { return undefined; } + if (displayName === "default") { + var localSymbol = ts.getLocalSymbolForExportDefault(symbol); + if (localSymbol && localSymbol.name) { + displayName = symbol.valueDeclaration.localSymbol.name; + } + } var firstCharCode = displayName.charCodeAt(0); if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; @@ -30180,11 +30505,11 @@ var ts; symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); } } - else if (ts.getAncestor(contextToken, 207)) { + else if (ts.getAncestor(contextToken, 210)) { isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(contextToken)) { - var importDeclaration = ts.getAncestor(contextToken, 206); + var importDeclaration = ts.getAncestor(contextToken, 209); ts.Debug.assert(importDeclaration !== undefined); var exports_2 = typeInfoResolver.getExportsOfExternalModule(importDeclaration); symbols = filterModuleExports(exports_2, importDeclaration); @@ -30199,7 +30524,7 @@ var ts; var adjustedPosition = previousToken !== contextToken ? previousToken.getStart() : position; - var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile); + var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; var symbolMeanings = 793056 | 107455 | 1536 | 8388608; symbols = typeInfoResolver.getSymbolsInScope(scopeNode, symbolMeanings); } @@ -30224,7 +30549,7 @@ var ts; function showCompletionsInImportsClause(node) { if (node) { if (node.kind === 14 || node.kind === 23) { - return node.parent.kind === 209; + return node.parent.kind === 212; } } return false; @@ -30249,16 +30574,16 @@ var ts; case 117: return true; case 20: - return containingNodeKind === 202; + return containingNodeKind === 205; case 14: - return containingNodeKind === 198; + return containingNodeKind === 201; case 53: - return containingNodeKind === 195 + return containingNodeKind === 198 || containingNodeKind === 169; case 11: return containingNodeKind === 171; case 12: - return containingNodeKind === 175; + return containingNodeKind === 176; case 109: case 107: case 108: @@ -30307,7 +30632,7 @@ var ts; switch (kind) { case 162: case 163: - case 197: + case 200: case 134: case 133: case 136: @@ -30324,14 +30649,14 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 195 || - containingNodeKind === 196 || - containingNodeKind === 177 || - containingNodeKind === 201 || - isFunction(containingNodeKind) || - containingNodeKind === 198 || - containingNodeKind === 197 || + return containingNodeKind === 198 || containingNodeKind === 199 || + containingNodeKind === 180 || + containingNodeKind === 204 || + isFunction(containingNodeKind) || + containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || containingNodeKind === 151 || containingNodeKind === 150; case 20: @@ -30339,21 +30664,21 @@ var ts; case 18: return containingNodeKind === 151; case 16: - return containingNodeKind === 220 || + return containingNodeKind === 223 || isFunction(containingNodeKind); case 14: - return containingNodeKind === 201 || - containingNodeKind === 199 || + return containingNodeKind === 204 || + containingNodeKind === 202 || containingNodeKind === 145 || containingNodeKind === 150; case 22: return containingNodeKind === 131 && - (previousToken.parent.parent.kind === 199 || + (previousToken.parent.parent.kind === 202 || previousToken.parent.parent.kind === 145); case 24: - return containingNodeKind === 198 || - containingNodeKind === 197 || - containingNodeKind === 199 || + return containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || isFunction(containingNodeKind); case 110: return containingNodeKind === 132; @@ -30406,7 +30731,7 @@ var ts; return exports; } if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 209) { + importDeclaration.importClause.namedBindings.kind === 212) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -30423,7 +30748,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 221 && m.kind !== 222) { + if (m.kind !== 224 && m.kind !== 225) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -30459,7 +30784,7 @@ var ts; var start = new Date().getTime(); var entries = []; var nameToSymbol = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; var entry = createCompletionEntry(symbol, typeInfoResolver, location); if (entry) { @@ -30774,7 +31099,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 223) { + if (declaration.kind === 226) { var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -30790,7 +31115,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 205) { + if (declaration.kind === 208) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -30989,7 +31314,7 @@ var ts; symbol = typeInfoResolver.getAliasedSymbol(symbol); } } - if (node.parent.kind === 222) { + if (node.parent.kind === 225) { var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -31017,7 +31342,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 114) { if (symbol.flags & 32) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 198); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 201); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -31034,7 +31359,7 @@ var ts; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 135) || - (!selectConstructors && (d.kind === 197 || d.kind === 134 || d.kind === 133))) { + (!selectConstructors && (d.kind === 200 || d.kind === 134 || d.kind === 133))) { declarations.push(d); if (d.body) definition = d; @@ -31052,6 +31377,17 @@ var ts; } } function getOccurrencesAtPosition(fileName, position) { + var results = getOccurrencesAtPositionCore(fileName, position); + if (results) { + var sourceFile = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results.forEach(function (value) { + var targetFile = getCanonicalFileName(ts.normalizeSlashes(value.fileName)); + ts.Debug.assert(sourceFile == targetFile, "Unexpected file in results. Found results in " + targetFile + " expected only results in " + sourceFile + "."); + }); + } + return results; + } + function getOccurrencesAtPositionCore(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingWord(sourceFile, position); @@ -31065,58 +31401,58 @@ var ts; switch (node.kind) { case 84: case 76: - if (hasKind(node.parent, 180)) { + if (hasKind(node.parent, 183)) { return getIfElseOccurrences(node.parent); } break; case 90: - if (hasKind(node.parent, 188)) { + if (hasKind(node.parent, 191)) { return getReturnOccurrences(node.parent); } break; case 94: - if (hasKind(node.parent, 192)) { + if (hasKind(node.parent, 195)) { return getThrowOccurrences(node.parent); } break; case 68: - if (hasKind(parent(parent(node)), 193)) { + if (hasKind(parent(parent(node)), 196)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 96: case 81: - if (hasKind(parent(node), 193)) { + if (hasKind(parent(node), 196)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 92: - if (hasKind(node.parent, 190)) { + if (hasKind(node.parent, 193)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 67: case 73: - if (hasKind(parent(parent(parent(node))), 190)) { + if (hasKind(parent(parent(parent(node))), 193)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 66: case 71: - if (hasKind(node.parent, 187) || hasKind(node.parent, 186)) { + if (hasKind(node.parent, 190) || hasKind(node.parent, 189)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 82: - if (hasKind(node.parent, 183) || - hasKind(node.parent, 184) || - hasKind(node.parent, 185)) { + if (hasKind(node.parent, 186) || + hasKind(node.parent, 187) || + hasKind(node.parent, 188)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 100: case 75: - if (hasKind(node.parent, 182) || hasKind(node.parent, 181)) { + if (hasKind(node.parent, 185) || hasKind(node.parent, 184)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -31132,14 +31468,14 @@ var ts; } default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 177)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 180)) { return getModifierOccurrences(node.kind, node.parent); } } return undefined; function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 180) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 183) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -31150,7 +31486,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 180)) { + if (!hasKind(ifStatement.elseStatement, 183)) { break; } ifStatement = ifStatement.elseStatement; @@ -31183,7 +31519,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 176))) { + if (!(func && hasKind(func.body, 179))) { return undefined; } var keywords = []; @@ -31216,10 +31552,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 192) { + if (node.kind === 195) { statementAccumulator.push(node); } - else if (node.kind === 193) { + else if (node.kind === 196) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -31241,10 +31577,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent_9 = child.parent; - if (ts.isFunctionBlock(parent_9) || parent_9.kind === 224) { + if (ts.isFunctionBlock(parent_9) || parent_9.kind === 227) { return parent_9; } - if (parent_9.kind === 193) { + if (parent_9.kind === 196) { var tryStatement = parent_9; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -31269,7 +31605,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 82, 100, 75)) { - if (loopNode.kind === 181) { + if (loopNode.kind === 184) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 100)) { @@ -31304,13 +31640,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return getLoopBreakContinueOccurrences(owner); - case 190: + case 193: return getSwitchCaseDefaultOccurrences(owner); } } @@ -31321,7 +31657,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 187 || node.kind === 186) { + if (node.kind === 190 || node.kind === 189) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -31337,15 +31673,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { switch (node_1.kind) { - case 190: - if (statement.kind === 186) { + case 193: + if (statement.kind === 189) { continue; } - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: - case 181: + case 184: if (!statement.label || isLabeledBy(node_1, statement.label.text)) { return node_1; } @@ -31384,18 +31720,18 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 198 || + if (!(container.kind === 201 || (declaration.kind === 129 && hasKind(container, 135)))) { return undefined; } } else if (modifier === 110) { - if (container.kind !== 198) { + if (container.kind !== 201) { return undefined; } } else if (modifier === 78 || modifier === 115) { - if (!(container.kind === 203 || container.kind === 224)) { + if (!(container.kind === 206 || container.kind === 227)) { return undefined; } } @@ -31406,14 +31742,14 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 203: - case 224: + case 206: + case 227: nodes = container.statements; break; case 135: nodes = container.parameters.concat(container.parent.members); break; - case 198: + case 201: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { @@ -31475,7 +31811,7 @@ var ts; return undefined; } var referenceEntries = []; - for (var _i = 0, _n = referenceSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < referenceSymbols.length; _i++) { var referenceSymbol = referenceSymbols[_i]; ts.addRange(referenceEntries, referenceSymbol.references); } @@ -31578,12 +31914,12 @@ var ts; } function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 210 || location.parent.kind === 214) && + (location.parent.kind === 213 || location.parent.kind === 217) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 210 || declaration.kind === 214; + return declaration.kind === 213 || declaration.kind === 217; }); } function getDeclaredName(symbol, location) { @@ -31620,7 +31956,7 @@ var ts; if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 198); + return ts.getAncestor(privateDeclaration, 201); } } if (symbol.flags & 8388608) { @@ -31632,7 +31968,7 @@ var ts; var scope = undefined; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -31641,7 +31977,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 224 && !ts.isExternalModule(container)) { + if (container.kind === 227 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -31847,11 +32183,11 @@ var ts; staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 224: + case 227: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 197: + case 200: case 162: break; default: @@ -31859,7 +32195,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 224) { + if (searchSpaceNode.kind === 227) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -31891,7 +32227,7 @@ var ts; var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { case 162: - case 197: + case 200: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } @@ -31902,13 +32238,13 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; - case 198: + case 201: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 224: - if (container.kind === 224 && !ts.isExternalModule(container)) { + case 227: + if (container.kind === 227 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -31943,11 +32279,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 198) { - getPropertySymbolFromTypeReference(ts.getClassBaseTypeNode(declaration)); - ts.forEach(ts.getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); + if (declaration.kind === 201) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 199) { + else if (declaration.kind === 202) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -32030,7 +32366,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -32098,32 +32434,32 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: - case 220: + case 223: return 1; case 128: - case 199: - case 200: + case 202: + case 203: case 145: return 2; - case 198: case 201: + case 204: return 1 | 2; - case 202: + case 205: if (node.name.kind === 8) { return 4 | 1; } @@ -32133,31 +32469,51 @@ var ts; else { return 4; } - case 209: - case 210: - case 205: - case 206: - case 211: case 212: + case 213: + case 208: + case 209: + case 214: + case 215: return 1 | 2 | 4; - case 224: + case 227: return 4 | 1; } return 1 | 2 | 4; ts.Debug.fail("Unknown declaration type"); } function isTypeReference(node) { - if (isRightSideOfQualifiedName(node)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 141; + return node.parent.kind === 141 || node.parent.kind === 177; } function isNamespaceReference(node) { + return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); + } + function isPropertyAccessNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 155) { + while (root.parent && root.parent.kind === 155) { + root = root.parent; + } + isLastClause = root.name === node; + } + if (!isLastClause && root.parent.kind === 177 && root.parent.parent.kind === 222) { + var decl = root.parent.parent.parent; + return (decl.kind === 201 && root.parent.parent.token === 103) || + (decl.kind === 202 && root.parent.parent.token === 79); + } + return false; + } + function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; if (root.parent.kind === 126) { - while (root.parent && root.parent.kind === 126) + while (root.parent && root.parent.kind === 126) { root = root.parent; + } isLastClause = root.right === node; } return root.parent.kind === 141 && !isLastClause; @@ -32172,13 +32528,13 @@ var ts; ts.Debug.assert(node.kind === 65); if (node.parent.kind === 126 && node.parent.right === node && - node.parent.parent.kind === 205) { + node.parent.parent.kind === 208) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 211) { + if (node.parent.kind === 214) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -32231,7 +32587,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 202 && + if (nodeForStartPos.parent.parent.kind === 205 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -32287,7 +32643,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 202 && ts.getModuleInstanceState(declaration) == 1; + return declaration.kind === 205 && ts.getModuleInstanceState(declaration) == 1; }); } } @@ -32405,7 +32761,7 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 53) { - if (token.parent.kind === 195 || + if (token.parent.kind === 198 || token.parent.kind === 132 || token.parent.kind === 129) { return ClassificationTypeNames.operator; @@ -32435,7 +32791,7 @@ var ts; else if (tokenKind === 65) { if (token) { switch (token.parent.kind) { - case 198: + case 201: if (token.parent.name === token) { return ClassificationTypeNames.className; } @@ -32445,17 +32801,17 @@ var ts; return ClassificationTypeNames.typeParameterName; } return; - case 199: + case 202: if (token.parent.name === token) { return ClassificationTypeNames.interfaceName; } return; - case 201: + case 204: if (token.parent.name === token) { return ClassificationTypeNames.enumName; } return; - case 202: + case 205: if (token.parent.name === token) { return ClassificationTypeNames.moduleName; } @@ -32468,7 +32824,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -32493,7 +32849,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0, _n = childNodes.length; _i < _n; _i++) { + for (var _i = 0; _i < childNodes.length; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -32626,7 +32982,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var sourceFile_1 = current.getSourceFile(); if (sourceFile_1 && getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { @@ -32716,7 +33072,7 @@ var ts; case 8: case 7: if (ts.isDeclarationName(node) || - node.parent.kind === 216 || + node.parent.kind === 219 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -33017,7 +33373,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 224 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 227 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index 3181d423310..e817dfb54ae 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -196,59 +196,62 @@ declare module "typescript" { TemplateExpression = 171, YieldExpression = 172, SpreadElementExpression = 173, - OmittedExpression = 174, - TemplateSpan = 175, - Block = 176, - VariableStatement = 177, - EmptyStatement = 178, - ExpressionStatement = 179, - IfStatement = 180, - DoStatement = 181, - WhileStatement = 182, - ForStatement = 183, - ForInStatement = 184, - ForOfStatement = 185, - ContinueStatement = 186, - BreakStatement = 187, - ReturnStatement = 188, - WithStatement = 189, - SwitchStatement = 190, - LabeledStatement = 191, - ThrowStatement = 192, - TryStatement = 193, - DebuggerStatement = 194, - VariableDeclaration = 195, - VariableDeclarationList = 196, - FunctionDeclaration = 197, - ClassDeclaration = 198, - InterfaceDeclaration = 199, - TypeAliasDeclaration = 200, - EnumDeclaration = 201, - ModuleDeclaration = 202, - ModuleBlock = 203, - CaseBlock = 204, - ImportEqualsDeclaration = 205, - ImportDeclaration = 206, - ImportClause = 207, - NamespaceImport = 208, - NamedImports = 209, - ImportSpecifier = 210, - ExportAssignment = 211, - ExportDeclaration = 212, - NamedExports = 213, - ExportSpecifier = 214, - MissingDeclaration = 215, - ExternalModuleReference = 216, - CaseClause = 217, - DefaultClause = 218, - HeritageClause = 219, - CatchClause = 220, - PropertyAssignment = 221, - ShorthandPropertyAssignment = 222, - EnumMember = 223, - SourceFile = 224, - SyntaxList = 225, - Count = 226, + ClassExpression = 174, + OmittedExpression = 175, + TemplateSpan = 176, + HeritageClauseElement = 177, + SemicolonClassElement = 178, + Block = 179, + VariableStatement = 180, + EmptyStatement = 181, + ExpressionStatement = 182, + IfStatement = 183, + DoStatement = 184, + WhileStatement = 185, + ForStatement = 186, + ForInStatement = 187, + ForOfStatement = 188, + ContinueStatement = 189, + BreakStatement = 190, + ReturnStatement = 191, + WithStatement = 192, + SwitchStatement = 193, + LabeledStatement = 194, + ThrowStatement = 195, + TryStatement = 196, + DebuggerStatement = 197, + VariableDeclaration = 198, + VariableDeclarationList = 199, + FunctionDeclaration = 200, + ClassDeclaration = 201, + InterfaceDeclaration = 202, + TypeAliasDeclaration = 203, + EnumDeclaration = 204, + ModuleDeclaration = 205, + ModuleBlock = 206, + CaseBlock = 207, + ImportEqualsDeclaration = 208, + ImportDeclaration = 209, + ImportClause = 210, + NamespaceImport = 211, + NamedImports = 212, + ImportSpecifier = 213, + ExportAssignment = 214, + ExportDeclaration = 215, + NamedExports = 216, + ExportSpecifier = 217, + MissingDeclaration = 218, + ExternalModuleReference = 219, + CaseClause = 220, + DefaultClause = 221, + HeritageClause = 222, + CatchClause = 223, + PropertyAssignment = 224, + ShorthandPropertyAssignment = 225, + EnumMember = 226, + SourceFile = 227, + SyntaxList = 228, + Count = 229, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -432,6 +435,9 @@ declare module "typescript" { interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { body?: Block; } + interface SemicolonClassElement extends ClassElement { + _semicolonClassElementBrand: any; + } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; body: Block; @@ -570,6 +576,10 @@ declare module "typescript" { typeArguments?: NodeArray; arguments: NodeArray; } + interface HeritageClauseElement extends Node { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + } interface NewExpression extends CallExpression, PrimaryExpression { } interface TaggedTemplateExpression extends MemberExpression { @@ -664,12 +674,16 @@ declare module "typescript" { interface ModuleElement extends Node { _moduleElementBrand: any; } - interface ClassDeclaration extends Declaration, ModuleElement { + interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + } interface ClassElement extends Declaration { _classElementBrand: any; } @@ -681,7 +695,7 @@ declare module "typescript" { } interface HeritageClause extends Node { token: SyntaxKind; - types?: NodeArray; + types?: NodeArray; } interface TypeAliasDeclaration extends Declaration, ModuleElement { name: Identifier; @@ -923,7 +937,7 @@ declare module "typescript" { writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; @@ -1179,7 +1193,6 @@ declare module "typescript" { interface CompilerOptions { allowNonTsExtensions?: boolean; charset?: string; - codepage?: number; declaration?: boolean; diagnostics?: boolean; emitBOM?: boolean; @@ -1193,7 +1206,6 @@ declare module "typescript" { noErrorTruncation?: boolean; noImplicitAny?: boolean; noLib?: boolean; - noLibCheck?: boolean; noResolve?: boolean; out?: string; outDir?: string; @@ -1206,6 +1218,7 @@ declare module "typescript" { target?: ScriptTarget; version?: boolean; watch?: boolean; + separateCompilation?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { @@ -1454,6 +1467,20 @@ declare module "typescript" { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; @@ -1947,6 +1974,7 @@ declare module "typescript" { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; diff --git a/bin/typescript.js b/bin/typescript.js index 2a8a4725b29..0ea54239508 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -190,59 +190,62 @@ var ts; SyntaxKind[SyntaxKind["TemplateExpression"] = 171] = "TemplateExpression"; SyntaxKind[SyntaxKind["YieldExpression"] = 172] = "YieldExpression"; SyntaxKind[SyntaxKind["SpreadElementExpression"] = 173] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 174] = "OmittedExpression"; - SyntaxKind[SyntaxKind["TemplateSpan"] = 175] = "TemplateSpan"; - SyntaxKind[SyntaxKind["Block"] = 176] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 177] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 178] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 179] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 180] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 181] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 182] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 183] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 184] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 185] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 186] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 187] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 188] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 189] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 190] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 191] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 192] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 193] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 194] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 195] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 196] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 197] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 198] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 199] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 200] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 201] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 202] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 203] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 204] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 205] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 206] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 207] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 208] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 209] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 210] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 211] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 212] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 213] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 214] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 215] = "MissingDeclaration"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 216] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["CaseClause"] = 217] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 218] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 219] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 220] = "CatchClause"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 221] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 222] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 223] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 224] = "SourceFile"; - SyntaxKind[SyntaxKind["SyntaxList"] = 225] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 226] = "Count"; + SyntaxKind[SyntaxKind["ClassExpression"] = 174] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 175] = "OmittedExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 176] = "TemplateSpan"; + SyntaxKind[SyntaxKind["HeritageClauseElement"] = 177] = "HeritageClauseElement"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 178] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["Block"] = 179] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 180] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 181] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 182] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 183] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 184] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 185] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 186] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 187] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 188] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 189] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 190] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 191] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 192] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 193] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 194] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 195] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 196] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 197] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 198] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 199] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 200] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 201] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 202] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 203] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 204] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 205] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 206] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 207] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 208] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 209] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 210] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 211] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 212] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 213] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 214] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 215] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 216] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 217] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 218] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 219] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["CaseClause"] = 220] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 221] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 222] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 223] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 224] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 225] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 226] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 227] = "SourceFile"; + SyntaxKind[SyntaxKind["SyntaxList"] = 228] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 229] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 53] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 64] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 66] = "FirstReservedWord"; @@ -632,7 +635,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (v === value) { return true; @@ -656,7 +659,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -670,7 +673,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_1 = array[_i]; if (f(item_1)) { result.push(item_1); @@ -684,7 +687,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result.push(f(v)); } @@ -704,7 +707,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_2 = array[_i]; if (!contains(result, item_2)) { result.push(item_2); @@ -716,7 +719,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result += v[prop]; } @@ -725,7 +728,7 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0, _n = from.length; _i < _n; _i++) { + for (var _i = 0; _i < from.length; _i++) { var v = from[_i]; to.push(v); } @@ -1014,7 +1017,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _n = parts.length; _i < _n; _i++) { + for (var _i = 0; _i < parts.length; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -1159,7 +1162,7 @@ var ts; ts.fileExtensionIs = fileExtensionIs; var supportedExtensions = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { + for (var _i = 0; _i < supportedExtensions.length; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -1319,14 +1322,14 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var name_1 = files[_i]; if (!extension || ts.fileExtensionIs(name_1, extension)) { result.push(ts.combinePaths(path, name_1)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + for (var _a = 0; _a < subfolders.length; _a++) { var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } @@ -1413,7 +1416,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -1426,7 +1429,7 @@ var ts; directories.push(name); } } - for (var _a = 0, _b = directories.length; _a < _b; _a++) { + for (var _a = 0; _a < directories.length; _a++) { var current = directories[_a]; visitDirectory(current); } @@ -1664,6 +1667,8 @@ var ts; Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, + Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, + Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -1850,6 +1855,8 @@ var ts; The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1933,6 +1940,11 @@ var ts; Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, + Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { code: 5043, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." }, + Option_declaration_cannot_be_specified_with_option_separateCompilation: { code: 5044, category: ts.DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'separateCompilation'." }, + Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, + Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, + Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1996,7 +2008,10 @@ var ts; You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." }, yield_expressions_are_not_currently_supported: { code: 9000, category: ts.DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." } + Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "'class' expressions are not currently supported." }, + class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: ts.DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." } }; })(ts || (ts = {})); /// @@ -3242,16 +3257,16 @@ var ts; })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); var ModuleInstanceState = ts.ModuleInstanceState; function getModuleInstanceState(node) { - if (node.kind === 199 || node.kind === 200) { + if (node.kind === 202 || node.kind === 203) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 206 || node.kind === 205) && !(node.flags & 1)) { + else if ((node.kind === 209 || node.kind === 208) && !(node.flags & 1)) { return 0; } - else if (node.kind === 203) { + else if (node.kind === 206) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -3267,7 +3282,7 @@ var ts; }); return state; } - else if (node.kind === 202) { + else if (node.kind === 205) { return getModuleInstanceState(node.body); } else { @@ -3320,7 +3335,7 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 202 && node.name.kind === 8) { + if (node.kind === 205 && node.name.kind === 8) { return '"' + node.name.text + '"'; } if (node.name.kind === 127) { @@ -3341,12 +3356,12 @@ var ts; return "__new"; case 140: return "__index"; - case 212: + case 215: return "__export"; - case 211: + case 214: return node.isExportEquals ? "export=" : "default"; - case 197: - case 198: + case 200: + case 201: return node.flags & 256 ? "default" : undefined; } } @@ -3378,7 +3393,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 198 && symbol.exports) { + if ((node.kind === 201 || node.kind === 174) && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -3394,7 +3409,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 214 || (node.kind === 205 && hasExportModifier)) { + if (node.kind === 217 || (node.kind === 208 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -3431,7 +3446,7 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 224); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227); } ts.forEachChild(node, bind); container = saveContainer; @@ -3440,10 +3455,10 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 202: + case 205: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -3458,22 +3473,23 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 198: + case 174: + case 201: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } case 145: case 154: - case 199: + case 202: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 201: + case 204: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -3488,11 +3504,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 224 ? node : node.body; - if (body.kind === 224 || body.kind === 203) { - for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { + var body = node.kind === 227 ? node : node.body; + if (body.kind === 227 || body.kind === 206) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 212 || stat.kind === 211) { + if (stat.kind === 215 || stat.kind === 214) { return true; } } @@ -3554,10 +3570,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 202: + case 205: declareModuleMember(node, 2, 107455); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -3582,7 +3598,7 @@ var ts; case 129: bindParameter(node); break; - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); @@ -3598,11 +3614,11 @@ var ts; case 131: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 221: - case 222: + case 224: + case 225: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 223: + case 226: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 138: @@ -3614,7 +3630,7 @@ var ts; case 133: bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; - case 197: + case 200: bindDeclaration(node, 16, 106927, true); break; case 135: @@ -3640,19 +3656,22 @@ var ts; case 163: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 220: + case 174: + bindAnonymousDeclaration(node, 32, "__class", false); + break; + case 223: bindCatchVariableDeclaration(node); break; - case 198: + case 201: bindDeclaration(node, 32, 899583, false); break; - case 199: + case 202: bindDeclaration(node, 64, 792992, false); break; - case 200: + case 203: bindDeclaration(node, 524288, 793056, false); break; - case 201: + case 204: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -3660,16 +3679,16 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 202: + case 205: bindModuleDeclaration(node); break; - case 205: case 208: - case 210: - case 214: + case 211: + case 213: + case 217: bindDeclaration(node, 8388608, 8388608, false); break; - case 207: + case 210: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -3677,13 +3696,13 @@ var ts; bindChildren(node, 0, false); } break; - case 212: + case 215: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 211: + case 214: if (node.expression && node.expression.kind === 65) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } @@ -3692,20 +3711,20 @@ var ts; } bindChildren(node, 0, false); break; - case 224: + case 227: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 176: + case 179: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 220: - case 183: - case 184: - case 185: - case 204: + case 223: + case 186: + case 187: + case 188: + case 207: bindChildren(node, 0, true); break; default: @@ -3724,7 +3743,7 @@ var ts; } if (node.flags & 112 && node.parent.kind === 135 && - node.parent.parent.kind === 198) { + (node.parent.parent.kind === 201 || node.parent.parent.kind === 174)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -3744,7 +3763,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -3802,7 +3821,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 224) { + while (node && node.kind !== 227) { node = node.parent; } return node; @@ -3884,15 +3903,15 @@ var ts; return current; } switch (current.kind) { - case 224: - case 204: - case 220: - case 202: - case 183: - case 184: - case 185: + case 227: + case 207: + case 223: + case 205: + case 186: + case 187: + case 188: return current; - case 176: + case 179: if (!isFunctionLike(current.parent)) { return current; } @@ -3903,9 +3922,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 195 && + declaration.kind === 198 && declaration.parent && - declaration.parent.kind === 220; + declaration.parent.kind === 223; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3942,14 +3961,21 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 195: - case 152: + case 227: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + if (pos_1 === sourceFile.text.length) { + return createTextSpan(0, 0); + } + return getSpanOfTokenAtPosition(sourceFile, pos_1); case 198: - case 199: - case 202: + case 152: case 201: - case 223: - case 197: + case 174: + case 202: + case 205: + case 204: + case 226: + case 200: case 162: errorNode = node.name; break; @@ -3972,7 +3998,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 201 && isConst(node); + return node.kind === 204 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { @@ -3984,14 +4010,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 195) { + if (node.kind === 198) { node = node.parent; } - if (node && node.kind === 196) { + if (node && node.kind === 199) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 177) { + if (node && node.kind === 180) { flags |= node.flags; } return flags; @@ -4006,7 +4032,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 179 && node.expression.kind === 8; + return node.kind === 182 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -4032,23 +4058,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188: + case 191: return visitor(node); - case 204: - case 176: - case 180: - case 181: - case 182: + case 207: + case 179: case 183: case 184: case 185: - case 189: - case 190: - case 217: - case 218: - case 191: + case 186: + case 187: + case 188: + case 192: case 193: case 220: + case 221: + case 194: + case 196: + case 223: return ts.forEachChild(node, traverse); } } @@ -4058,13 +4084,13 @@ var ts; if (node) { switch (node.kind) { case 152: - case 223: + case 226: case 129: - case 221: + case 224: case 132: case 131: - case 222: - case 195: + case 225: + case 198: return true; } } @@ -4076,7 +4102,7 @@ var ts; switch (node.kind) { case 135: case 162: - case 197: + case 200: case 163: case 134: case 133: @@ -4089,7 +4115,7 @@ var ts; case 143: case 162: case 163: - case 197: + case 200: return true; } } @@ -4097,7 +4123,7 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 176 && isFunctionLike(node.parent); + return node && node.kind === 179 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -4121,7 +4147,7 @@ var ts; } switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; @@ -4130,9 +4156,9 @@ var ts; if (!includeArrowFunctions) { continue; } - case 197: + case 200: case 162: - case 202: + case 205: case 132: case 131: case 134: @@ -4140,8 +4166,8 @@ var ts; case 135: case 136: case 137: - case 201: - case 224: + case 204: + case 227: return node; } } @@ -4154,12 +4180,12 @@ var ts; return node; switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; break; - case 197: + case 200: case 162: case 163: if (!includeFunctions) { @@ -4186,23 +4212,23 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 198: + case 201: return true; case 132: - return node.parent.kind === 198; + return node.parent.kind === 201; case 129: - return node.parent.body && node.parent.parent.kind === 198; + return node.parent.body && node.parent.parent.kind === 201; case 136: case 137: case 134: - return node.body && node.parent.kind === 198; + return node.body && node.parent.kind === 201; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 198: + case 201: if (node.decorators) { return true; } @@ -4230,7 +4256,7 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 198: + case 201: return ts.forEach(node.members, nodeOrChildIsDecorated); case 134: case 137: @@ -4261,6 +4287,7 @@ var ts; case 160: case 161: case 162: + case 174: case 163: case 166: case 164: @@ -4272,7 +4299,7 @@ var ts; case 173: case 171: case 10: - case 174: + case 175: return true; case 126: while (node.parent.kind === 126) { @@ -4287,38 +4314,38 @@ var ts; case 8: var parent_1 = node.parent; switch (parent_1.kind) { - case 195: + case 198: case 129: case 132: case 131: - case 223: - case 221: + case 226: + case 224: case 152: return parent_1.initializer === node; - case 179: - case 180: - case 181: case 182: - case 188: - case 189: - case 190: - case 217: - case 192: - case 190: - return parent_1.expression === node; case 183: - var forStatement = parent_1; - return (forStatement.initializer === node && forStatement.initializer.kind !== 196) || - forStatement.condition === node || - forStatement.iterator === node; case 184: case 185: + case 191: + case 192: + case 193: + case 220: + case 195: + case 193: + return parent_1.expression === node; + case 186: + var forStatement = parent_1; + return (forStatement.initializer === node && forStatement.initializer.kind !== 199) || + forStatement.condition === node || + forStatement.iterator === node; + case 187: + case 188: var forInStatement = parent_1; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 196) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199) || forInStatement.expression === node; case 160: return node === parent_1.expression; - case 175: + case 176: return node === parent_1.expression; case 127: return node === parent_1.expression; @@ -4338,7 +4365,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind === 216; + return node.kind === 208 && node.moduleReference.kind === 219; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4347,20 +4374,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind !== 216; + return node.kind === 208 && node.moduleReference.kind !== 219; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 206) { + if (node.kind === 209) { return node.moduleSpecifier; } - if (node.kind === 205) { + if (node.kind === 208) { var reference = node.moduleReference; - if (reference.kind === 216) { + if (reference.kind === 219) { return reference.expression; } } - if (node.kind === 212) { + if (node.kind === 215) { return node.moduleSpecifier; } } @@ -4377,8 +4404,8 @@ var ts; case 134: case 133: return node.questionToken !== undefined; - case 222: - case 221: + case 225: + case 224: case 132: case 131: return node.questionToken !== undefined; @@ -4421,31 +4448,31 @@ var ts; switch (node.kind) { case 163: case 152: - case 198: - case 135: case 201: - case 223: - case 214: - case 197: + case 135: + case 204: + case 226: + case 217: + case 200: case 162: case 136: - case 207: - case 205: case 210: - case 199: + case 208: + case 213: + case 202: case 134: case 133: - case 202: - case 208: + case 205: + case 211: case 129: - case 221: + case 224: case 132: case 131: case 137: - case 222: - case 200: + case 225: + case 203: case 128: - case 195: + case 198: return true; } return false; @@ -4453,25 +4480,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 187: - case 186: - case 194: - case 181: - case 179: - case 178: - case 184: - case 185: - case 183: - case 180: - case 191: - case 188: case 190: - case 94: - case 193: - case 177: - case 182: case 189: - case 211: + case 197: + case 184: + case 182: + case 181: + case 187: + case 188: + case 186: + case 183: + case 194: + case 191: + case 193: + case 94: + case 196: + case 180: + case 185: + case 192: + case 214: return true; default: return false; @@ -4497,7 +4524,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 210 || parent.kind === 214) { + if (parent.kind === 213 || parent.kind === 217) { if (parent.propertyName) { return true; } @@ -4509,24 +4536,24 @@ var ts; } ts.isDeclarationName = isDeclarationName; function isAliasSymbolDeclaration(node) { - return node.kind === 205 || - node.kind === 207 && !!node.name || - node.kind === 208 || - node.kind === 210 || - node.kind === 214 || - node.kind === 211 && node.expression.kind === 65; + return node.kind === 208 || + node.kind === 210 && !!node.name || + node.kind === 211 || + node.kind === 213 || + node.kind === 217 || + node.kind === 214 && node.expression.kind === 65; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; - function getClassBaseTypeNode(node) { + function getClassExtendsHeritageClauseElement(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } - ts.getClassBaseTypeNode = getClassBaseTypeNode; - function getClassImplementedTypeNodes(node) { + ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; + function getClassImplementsHeritageClauseElements(node) { var heritageClause = getHeritageClause(node.heritageClauses, 103); return heritageClause ? heritageClause.types : undefined; } - ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause ? heritageClause.types : undefined; @@ -4534,7 +4561,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _n = clauses.length; _i < _n; _i++) { + for (var _i = 0; _i < clauses.length; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -4761,7 +4788,7 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 202 || n.kind === 224; + return isFunctionLike(n) || n.kind === 205 || n.kind === 227; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -5131,12 +5158,36 @@ var ts; } } ts.writeCommentRange = writeCommentRange; + function isSupportedHeritageClauseElement(node) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; + function isSupportedHeritageClauseElementExpression(node) { + if (node.kind === 65) { + return true; + } + else if (node.kind === 155) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + else { + return false; + } + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 126 && node.parent.right === node) || + (node.parent.kind === 155 && node.parent.name === node); + } + ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function getLocalSymbolForExportDefault(symbol) { + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256) ? symbol.valueDeclaration.localSymbol : undefined; + } + ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; })(ts || (ts = {})); /// /// var ts; (function (ts) { - var nodeConstructors = new Array(226); + var nodeConstructors = new Array(229); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -5158,7 +5209,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -5184,9 +5235,9 @@ var ts; case 129: case 132: case 131: - case 221: - case 222: - case 195: + case 224: + case 225: + case 198: case 152: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -5212,7 +5263,7 @@ var ts; case 136: case 137: case 162: - case 197: + case 200: case 163: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -5291,150 +5342,154 @@ var ts; visitNode(cbNode, node.whenFalse); case 173: return visitNode(cbNode, node.expression); - case 176: - case 203: + case 179: + case 206: return visitNodes(cbNodes, node.statements); - case 224: + case 227: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 177: + case 180: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 196: + case 199: return visitNodes(cbNodes, node.declarations); - case 179: + case 182: return visitNode(cbNode, node.expression); - case 180: + case 183: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 181: + case 184: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 182: + case 185: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 183: + case 186: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); - case 184: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 185: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 186: case 187: - return visitNode(cbNode, node.label); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 189: + case 190: + return visitNode(cbNode, node.label); + case 191: + return visitNode(cbNode, node.expression); + case 192: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 190: + case 193: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 204: + case 207: return visitNodes(cbNodes, node.clauses); - case 217: + case 220: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 218: + case 221: return visitNodes(cbNodes, node.statements); - case 191: + case 194: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 192: + case 195: return visitNode(cbNode, node.expression); - case 193: + case 196: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 220: + case 223: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 130: return visitNode(cbNode, node.expression); - 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 199: - 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 200: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); case 201: + case 174: 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 223: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); case 202: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 203: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 204: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 226: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); case 205: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 208: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 206: + case 209: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 207: + case 210: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 208: + case 211: return visitNode(cbNode, node.name); - case 209: - case 213: - return visitNodes(cbNodes, node.elements); case 212: + case 216: + return visitNodes(cbNodes, node.elements); + case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 210: - case 214: + case 213: + case 217: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 211: + case 214: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); case 171: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 175: + case 176: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 127: return visitNode(cbNode, node.expression); - case 219: + case 222: return visitNodes(cbNodes, node.types); - case 216: + case 177: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments); + case 219: return visitNode(cbNode, node.expression); - case 215: + case 218: return visitNodes(cbNodes, node.decorators); } } @@ -5449,7 +5504,7 @@ var ts; ParsingContext[ParsingContext["TypeMembers"] = 5] = "TypeMembers"; ParsingContext[ParsingContext["ClassMembers"] = 6] = "ClassMembers"; ParsingContext[ParsingContext["EnumMembers"] = 7] = "EnumMembers"; - ParsingContext[ParsingContext["TypeReferences"] = 8] = "TypeReferences"; + ParsingContext[ParsingContext["HeritageClauseElement"] = 8] = "HeritageClauseElement"; ParsingContext[ParsingContext["VariableDeclarations"] = 9] = "VariableDeclarations"; ParsingContext[ParsingContext["ObjectBindingElements"] = 10] = "ObjectBindingElements"; ParsingContext[ParsingContext["ArrayBindingElements"] = 11] = "ArrayBindingElements"; @@ -5480,7 +5535,7 @@ var ts; case 5: return ts.Diagnostics.Property_or_signature_expected; case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; + case 8: return ts.Diagnostics.Expression_expected; case 9: return ts.Diagnostics.Variable_declaration_expected; case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; @@ -5562,7 +5617,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5626,7 +5681,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5830,7 +5885,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(224, 0); + var sourceFile = createNode(227, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -6203,7 +6258,7 @@ var ts; case 5: return isStartOfTypeMember(); case 6: - return lookAhead(isClassMemberStart); + return lookAhead(isClassMemberStart) || (token === 22 && !inErrorRecovery); case 7: return token === 18 || isLiteralPropertyName(); case 13: @@ -6211,7 +6266,15 @@ var ts; case 10: return isLiteralPropertyName(); case 8: - return isIdentifier() && !isNotHeritageClauseTypeName(); + if (token === 14) { + return lookAhead(isValidHeritageClauseObjectLiteral); + } + if (!inErrorRecovery) { + return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + else { + return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); + } case 9: return isIdentifierOrPattern(); case 11: @@ -6233,17 +6296,29 @@ var ts; } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } + function isValidHeritageClauseObjectLiteral() { + ts.Debug.assert(token === 14); + if (nextToken() === 15) { + var next = nextToken(); + return next === 23 || next === 14 || next === 79 || next === 103; + } + return true; + } function nextTokenIsIdentifier() { nextToken(); return isIdentifier(); } - function isNotHeritageClauseTypeName() { + function isHeritageClauseExtendsOrImplementsKeyword() { if (token === 103 || token === 79) { - return lookAhead(nextTokenIsIdentifier); + return lookAhead(nextTokenIsStartOfExpression); } return false; } + function nextTokenIsStartOfExpression() { + nextToken(); + return isStartOfExpression(); + } function isListTerminator(kind) { if (token === 1) { return true; @@ -6393,26 +6468,26 @@ var ts; case 15: return isReusableParameter(node); case 19: - case 8: case 16: case 18: case 17: case 12: case 13: + case 8: } return false; } function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 206: - case 205: - case 212: - case 211: - case 198: - case 199: - case 202: + case 209: + case 208: + case 215: + case 214: case 201: + case 202: + case 205: + case 204: return true; } return isReusableStatement(node); @@ -6428,6 +6503,7 @@ var ts; case 136: case 137: case 132: + case 178: return true; } } @@ -6436,8 +6512,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 217: - case 218: + case 220: + case 221: return true; } } @@ -6446,33 +6522,33 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 197: - case 177: - case 176: + case 200: case 180: case 179: - case 192: - case 188: - case 190: - case 187: - case 186: - case 184: - case 185: case 183: case 182: - case 189: - case 178: - case 193: + case 195: case 191: + case 193: + case 190: + case 189: + case 187: + case 188: + case 186: + case 185: + case 192: case 181: + case 196: case 194: + case 184: + case 197: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 223; + return node.kind === 226; } function isReusableTypeMember(node) { if (node) { @@ -6488,7 +6564,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 195) { + if (node.kind !== 198) { return false; } var variableDeclarator = node; @@ -6594,7 +6670,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(175); + var span = createNode(176); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -7029,7 +7105,7 @@ var ts; function parseTypeAnnotation() { return parseOptional(51) ? parseType() : undefined; } - function isStartOfExpression() { + function isStartOfLeftHandSideExpression() { switch (token) { case 93: case 91: @@ -7044,9 +7120,21 @@ var ts; case 18: case 14: case 83: + case 69: case 88: case 36: case 57: + case 65: + return true; + default: + return isIdentifier(); + } + } + function isStartOfExpression() { + if (isStartOfLeftHandSideExpression()) { + return true; + } + switch (token) { case 33: case 34: case 47: @@ -7057,7 +7145,6 @@ var ts; case 38: case 39: case 24: - case 65: case 111: return true; default: @@ -7068,7 +7155,11 @@ var ts; } } function isStartOfExpressionStatement() { - return token !== 14 && token !== 83 && token !== 52 && isStartOfExpression(); + return token !== 14 && + token !== 83 && + token !== 69 && + token !== 52 && + isStartOfExpression(); } function parseExpression() { // Expression[in]: @@ -7249,7 +7340,10 @@ var ts; if (token === 14) { return parseFunctionBlock(false, false); } - if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 83) { + if (isStartOfStatement(true) && + !isStartOfExpressionStatement() && + token !== 83 && + token !== 69) { return parseFunctionBlock(false, true); } return parseAssignmentExpressionOrHigher(); @@ -7514,7 +7608,6 @@ var ts; case 19: case 51: case 22: - case 23: case 50: case 28: case 30: @@ -7528,6 +7621,8 @@ var ts; case 15: case 1: return true; + case 23: + case 14: default: return false; } @@ -7550,6 +7645,8 @@ var ts; return parseArrayLiteralExpression(); case 14: return parseObjectLiteralExpression(); + case 69: + return parseClassExpression(); case 83: return parseFunctionExpression(); case 88: @@ -7580,7 +7677,7 @@ var ts; } function parseArgumentOrArrayLiteralElement() { return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(174) : + token === 23 ? createNode(175) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { @@ -7621,13 +7718,13 @@ var ts; return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(222, fullStart); + var shorthandDeclaration = createNode(225, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(221, fullStart); + var propertyAssignment = createNode(224, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -7675,7 +7772,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(176); + var node = createNode(179); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -7700,12 +7797,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(178); + var node = createNode(181); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(180); + var node = createNode(183); parseExpected(84); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7715,7 +7812,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(181); + var node = createNode(184); parseExpected(75); node.statement = parseStatement(); parseExpected(100); @@ -7726,7 +7823,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(182); + var node = createNode(185); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7749,21 +7846,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86)) { - var forInStatement = createNode(184, pos); + var forInStatement = createNode(187, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(125)) { - var forOfStatement = createNode(185, pos); + var forOfStatement = createNode(188, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(183, pos); + var forStatement = createNode(186, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -7781,7 +7878,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 187 ? 66 : 71); + parseExpected(kind === 190 ? 66 : 71); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -7789,7 +7886,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(188); + var node = createNode(191); parseExpected(90); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -7798,7 +7895,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(189); + var node = createNode(192); parseExpected(101); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7807,7 +7904,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(217); + var node = createNode(220); parseExpected(67); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -7815,7 +7912,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(218); + var node = createNode(221); parseExpected(73); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -7825,12 +7922,12 @@ var ts; return token === 67 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(190); + var node = createNode(193); parseExpected(92); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); - var caseBlock = createNode(204, scanner.getStartPos()); + var caseBlock = createNode(207, scanner.getStartPos()); parseExpected(14); caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); @@ -7840,14 +7937,14 @@ var ts; function parseThrowStatement() { // ThrowStatement[Yield] : // throw [no LineTerminator here]Expression[In, ?Yield]; - var node = createNode(192); + var node = createNode(195); parseExpected(94); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(193); + var node = createNode(196); parseExpected(96); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 ? parseCatchClause() : undefined; @@ -7858,7 +7955,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(220); + var result = createNode(223); parseExpected(68); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7868,7 +7965,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(194); + var node = createNode(197); parseExpected(72); parseSemicolon(); return finishNode(node); @@ -7877,13 +7974,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 && parseOptional(51)) { - var labeledStatement = createNode(191, fullStart); + var labeledStatement = createNode(194, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(179, fullStart); + var expressionStatement = createNode(182, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -7891,7 +7988,7 @@ var ts; } function isStartOfStatement(inErrorRecovery) { if (ts.isModifier(token)) { - var result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return true; } @@ -7903,6 +8000,7 @@ var ts; case 98: case 105: case 83: + case 69: case 84: case 75: case 100: @@ -7922,7 +8020,6 @@ var ts; var isConstEnum = lookAhead(nextTokenIsEnumKeyword); return !isConstEnum; case 104: - case 69: case 117: case 77: case 123: @@ -7957,6 +8054,8 @@ var ts; return parseVariableStatement(scanner.getStartPos(), undefined, undefined); case 83: return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 69: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); case 22: return parseEmptyStatement(); case 84: @@ -7968,9 +8067,9 @@ var ts; case 82: return parseForOrForInOrForOfStatement(); case 71: - return parseBreakOrContinueStatement(186); + return parseBreakOrContinueStatement(189); case 66: - return parseBreakOrContinueStatement(187); + return parseBreakOrContinueStatement(190); case 90: return parseReturnStatement(); case 101: @@ -7991,7 +8090,7 @@ var ts; } default: if (ts.isModifier(token) || token === 52) { - var result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return result; } @@ -7999,7 +8098,7 @@ var ts; return parseExpressionOrLabeledStatement(); } } - function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers() { + function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers() { var start = scanner.getStartPos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -8019,6 +8118,8 @@ var ts; return parseVariableStatement(start, decorators, modifiers); case 83: return parseFunctionDeclaration(start, decorators, modifiers); + case 69: + return parseClassDeclaration(start, decorators, modifiers); } return undefined; } @@ -8031,7 +8132,7 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(174); + return createNode(175); } var node = createNode(152); node.dotDotDotToken = parseOptionalToken(21); @@ -8080,7 +8181,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(195); + var node = createNode(198); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -8089,7 +8190,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(196); + var node = createNode(199); switch (token) { case 98: break; @@ -8118,7 +8219,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(177, fullStart); + var node = createNode(180, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -8126,7 +8227,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(200, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83); @@ -8269,6 +8370,11 @@ var ts; return modifiers; } function parseClassElement() { + if (token === 22) { + var result = createNode(178); + nextToken(); + return finishNode(result); + } var fullStart = getNodePos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -8295,12 +8401,18 @@ var ts; } ts.Debug.fail("Should not have attempted to parse class member declaration."); } + function parseClassExpression() { + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 174); + } function parseClassDeclaration(fullStart, decorators, modifiers) { + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201); + } + function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var savedStrictModeContext = inStrictModeContext(); if (languageVersion >= 2) { setStrictModeContext(true); } - var node = createNode(198, fullStart); + var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(69); @@ -8336,14 +8448,22 @@ var ts; } function parseHeritageClause() { if (token === 79 || token === 103) { - var node = createNode(219); + var node = createNode(222); node.token = token; nextToken(); - node.types = parseDelimitedList(8, parseTypeReference); + node.types = parseDelimitedList(8, parseHeritageClauseElement); return finishNode(node); } return undefined; } + function parseHeritageClauseElement() { + var node = createNode(177); + node.expression = parseLeftHandSideExpressionOrHigher(); + if (token === 24) { + node.typeArguments = parseBracketedList(17, parseType, 24, 25); + } + return finishNode(node); + } function isHeritageClause() { return token === 79 || token === 103; } @@ -8351,7 +8471,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(199, fullStart); + var node = createNode(202, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(104); @@ -8362,7 +8482,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200, fullStart); + var node = createNode(203, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(123); @@ -8373,13 +8493,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(223, scanner.getStartPos()); + var node = createNode(226, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(201, fullStart); + var node = createNode(204, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77); @@ -8394,7 +8514,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(203, scanner.getStartPos()); + var node = createNode(206, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -8405,7 +8525,7 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; @@ -8416,7 +8536,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -8448,7 +8568,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 124) { - var importEqualsDeclaration = createNode(205, fullStart); + var importEqualsDeclaration = createNode(208, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -8458,7 +8578,7 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(206, fullStart); + var importDeclaration = createNode(209, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || @@ -8478,13 +8598,13 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(207, fullStart); + var importClause = createNode(210, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(209); + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(212); } return finishNode(importClause); } @@ -8494,7 +8614,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(216); + var node = createNode(219); parseExpected(118); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -8509,7 +8629,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(208); + var namespaceImport = createNode(211); parseExpected(35); parseExpected(102); namespaceImport.name = parseIdentifier(); @@ -8517,14 +8637,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 209 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 212 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(214); + return parseImportOrExportSpecifier(217); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(210); + return parseImportOrExportSpecifier(213); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -8543,13 +8663,13 @@ var ts; else { node.name = identifierName; } - if (kind === 210 && checkIdentifierIsKeyword) { + if (kind === 213 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35)) { @@ -8557,7 +8677,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(213); + node.exportClause = parseNamedImportsOrExports(216); if (parseOptional(124)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -8566,7 +8686,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(211, fullStart); + var node = createNode(214, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53)) { @@ -8679,7 +8799,7 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); default: if (decorators) { - var node = createMissingNode(215, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(218, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8759,10 +8879,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 205 && node.moduleReference.kind === 216 - || node.kind === 206 - || node.kind === 211 - || node.kind === 212 + || node.kind === 208 && node.moduleReference.kind === 219 + || node.kind === 209 + || node.kind === 214 + || node.kind === 215 ? node : undefined; }); @@ -8779,6 +8899,7 @@ var ts; case 153: case 161: case 154: + case 174: case 162: case 65: case 9: @@ -9073,10 +9194,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 224); + return ts.getAncestor(node, 227); } function isGlobalSourceFile(node) { - return node.kind === 224 && !ts.isExternalModule(node); + return node.kind === 227 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -9118,25 +9239,33 @@ var ts; } } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 214)) { + if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 217)) { + break loop; + } + result = undefined; + } + else if (location.kind === 227) { + result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { break loop; } result = undefined; } break; - case 201: + case 204: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; case 132: case 131: - if (location.parent.kind === 198 && !(location.flags & 128)) { + if (location.parent.kind === 201 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -9145,8 +9274,8 @@ var ts; } } break; - case 198: - case 199: + case 201: + case 202: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -9157,7 +9286,7 @@ var ts; break; case 127: grandparent = location.parent.parent; - if (grandparent.kind === 198 || grandparent.kind === 199) { + if (grandparent.kind === 201 || grandparent.kind === 202) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -9169,7 +9298,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 163: if (name === "arguments") { result = argumentsSymbol; @@ -9181,8 +9310,15 @@ var ts; result = argumentsSymbol; break loop; } - var id = location.name; - if (id && name === id.text) { + var functionName = location.name; + if (functionName && name === functionName.text) { + result = location.symbol; + break loop; + } + break; + case 174: + var className = location.name; + if (className && name === className.text) { result = location.symbol; break loop; } @@ -9226,14 +9362,14 @@ var ts; ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 195); + var variableDeclaration = ts.getAncestor(declaration, 198); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 177 || - variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 180 || + variableDeclaration.parent.parent.kind === 186) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 185 || - variableDeclaration.parent.parent.kind === 184) { + else if (variableDeclaration.parent.parent.kind === 188 || + variableDeclaration.parent.parent.kind === 187) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -9255,10 +9391,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } - while (node && node.kind !== 206) { + while (node && node.kind !== 209) { node = node.parent; } return node; @@ -9268,7 +9404,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 216) { + if (node.moduleReference.kind === 219) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -9291,7 +9427,7 @@ var ts; if (moduleSymbol.flags & 3) { var typeAnnotation = moduleSymbol.valueDeclaration.type; if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); + return getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name); } } } @@ -9322,7 +9458,7 @@ var ts; if (symbol.flags & 3) { var typeAnnotation = symbol.valueDeclaration.type; if (typeAnnotation) { - return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); + return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name)); } } } @@ -9357,17 +9493,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 205: - return getTargetOfImportEqualsDeclaration(node); - case 207: - return getTargetOfImportClause(node); case 208: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node); case 210: - return getTargetOfImportSpecifier(node); - case 214: - return getTargetOfExportSpecifier(node); + return getTargetOfImportClause(node); case 211: + return getTargetOfNamespaceImport(node); + case 213: + return getTargetOfImportSpecifier(node); + case 217: + return getTargetOfExportSpecifier(node); + case 214: return getTargetOfExportAssignment(node); } } @@ -9396,8 +9532,12 @@ var ts; function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); - if (target && target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target)) { - markAliasSymbolAsReferenced(symbol); + if (target) { + var markAlias = (target === unknownSymbol && compilerOptions.separateCompilation) || + (target !== unknownSymbol && (target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); + if (markAlias) { + markAliasSymbolAsReferenced(symbol); + } } } function markAliasSymbolAsReferenced(symbol) { @@ -9405,10 +9545,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 211 && node.expression) { + if (node.kind === 214 && node.expression) { checkExpressionCached(node.expression); } - else if (node.kind === 214) { + else if (node.kind === 217) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -9418,17 +9558,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 205); + importDeclaration = ts.getAncestor(entityName, 208); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 65 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 65 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (entityName.kind === 65 || entityName.parent.kind === 126) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 205); + ts.Debug.assert(entityName.parent.kind === 208); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -9436,7 +9576,7 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(name, meaning) { - if (ts.getFullWidth(name) === 0) { + if (ts.nodeIsMissing(name)) { return undefined; } var symbol; @@ -9446,18 +9586,22 @@ var ts; return undefined; } } - else if (name.kind === 126) { - var namespace = resolveEntityName(name.left, 1536); - if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) { + else if (name.kind === 126 || name.kind === 155) { + var left = name.kind === 126 ? name.left : name.expression; + var right = name.kind === 126 ? name.right : name.name; + var namespace = resolveEntityName(left, 1536); + if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; } - var right = name.right; symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; } } + else { + ts.Debug.fail("Unknown entity name kind."); + } ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } @@ -9546,7 +9690,7 @@ var ts; } var exportStars = symbol.exports["__export"]; if (exportStars) { - for (var _i = 0, _a = exportStars.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; visit(resolveExternalModuleName(node, node.moduleSpecifier)); } @@ -9583,7 +9727,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _n = members.length; _i < _n; _i++) { + for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; if (member.kind === 135 && ts.nodeIsPresent(member.body)) { return member; @@ -9650,17 +9794,17 @@ var ts; } } switch (location_1.kind) { - case 224: + case 227: if (!ts.isExternalModule(location_1)) { break; } - case 202: + case 205: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 198: - case 199: + case 201: + case 202: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -9691,7 +9835,7 @@ var ts; return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608) { + if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=") { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -9775,8 +9919,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 202 && declaration.name.kind === 8) || - (declaration.kind === 224 && ts.isExternalModule(declaration)); + return (declaration.kind === 205 && declaration.name.kind === 8) || + (declaration.kind === 227 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9811,8 +9955,8 @@ var ts; if (entityName.parent.kind === 144) { meaning = 107455 | 1048576; } - else if (entityName.kind === 126 || - entityName.parent.kind === 205) { + else if (entityName.kind === 126 || entityName.kind === 155 || + entityName.parent.kind === 208) { meaning = 1536; } else { @@ -9859,7 +10003,7 @@ var ts; while (node.kind === 149) { node = node.parent; } - if (node.kind === 200) { + if (node.kind === 203) { return getSymbolOfNode(node); } } @@ -9903,7 +10047,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -10031,7 +10175,7 @@ var ts; var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 224 || declaration.parent.kind === 203; + return declaration.parent.kind === 227 || declaration.parent.kind === 206; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -10087,13 +10231,13 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; writeKeyword(writer, 88); writeSpace(writer); @@ -10127,13 +10271,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { - var p = _f[_e]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _h = 0, _j = signatures.length; _h < _j; _h++) { - var signature = signatures[_h]; + for (var _f = 0; _f < signatures.length; _f++) { + var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -10263,12 +10407,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 202) { + if (node.kind === 205) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 224) { + else if (node.kind === 227) { return ts.isExternalModule(node) ? node : undefined; } } @@ -10313,21 +10457,21 @@ var ts; switch (node.kind) { case 152: return isDeclarationVisible(node.parent.parent); - case 195: + case 198: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 202: - case 198: - case 199: - case 200: - case 197: - case 201: case 205: + case 201: + case 202: + case 203: + case 200: + case 204: + case 208: var parent_2 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 205 && parent_2.kind !== 224 && ts.isInAmbientContext(parent_2))) { + !(node.kind !== 208 && parent_2.kind !== 227 && ts.isInAmbientContext(parent_2))) { return isGlobalSourceFile(parent_2); } return isDeclarationVisible(parent_2); @@ -10345,7 +10489,7 @@ var ts; case 138: case 140: case 129: - case 203: + case 206: case 142: case 143: case 145: @@ -10355,13 +10499,15 @@ var ts; case 148: case 149: return isDeclarationVisible(node.parent); - case 207: - case 208: case 210: + case 211: + case 213: return false; case 128: - case 224: + case 227: return true; + case 214: + return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } @@ -10376,10 +10522,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 211) { + if (node.parent && node.parent.kind === 214) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 217) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -10411,7 +10557,7 @@ var ts; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 195 ? node.parent.parent.parent : node.parent; + return node.kind === 198 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -10469,17 +10615,17 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 184) { + if (declaration.parent.parent.kind === 187) { return anyType; } - if (declaration.parent.parent.kind === 185) { + if (declaration.parent.parent.kind === 188) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var func = declaration.parent; @@ -10497,7 +10643,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 222) { + if (declaration.kind === 225) { return checkIdentifier(declaration.name); } return undefined; @@ -10526,7 +10672,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 174 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 175 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -10544,7 +10690,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 221 ? getWidenedType(type) : type; + return declaration.kind !== 224 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -10565,16 +10711,16 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 220) { + if (declaration.parent.kind === 223) { return links.type = anyType; } - if (declaration.kind === 211) { + if (declaration.kind === 214) { var exportAssignment = declaration; if (exportAssignment.expression) { return links.type = checkExpression(exportAssignment.expression); } else if (exportAssignment.type) { - return links.type = getTypeFromTypeNode(exportAssignment.type); + return links.type = getTypeFromTypeNodeOrHeritageClauseElement(exportAssignment.type); } else { return links.type = anyType; @@ -10603,11 +10749,11 @@ var ts; function getAnnotatedAccessorType(accessor) { if (accessor) { if (accessor.kind === 136) { - return accessor.type && getTypeFromTypeNode(accessor.type); + return accessor.type && getTypeFromTypeNodeOrHeritageClauseElement(accessor.type); } else { var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation && getTypeFromTypeNodeOrHeritageClauseElement(setterTypeAnnotation); } } return undefined; @@ -10719,7 +10865,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 199 || node.kind === 198) { + if (node.kind === 202 || node.kind === 201) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10750,10 +10896,10 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(symbol, 198); - var baseTypeNode = ts.getClassBaseTypeNode(declaration); + var declaration = ts.getDeclarationOfKind(symbol, 201); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + var baseType = getTypeFromHeritageClauseElement(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10791,9 +10937,9 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 199 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 202 && ts.getInterfaceBaseTypeNodes(declaration)) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { - var baseType = getTypeFromTypeReferenceNode(node); + var baseType = getTypeFromHeritageClauseElement(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10822,15 +10968,15 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 200); - var type = getTypeFromTypeNode(declaration.type); + var declaration = ts.getDeclarationOfKind(symbol, 203); + var type = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 200); + var declaration = ts.getDeclarationOfKind(symbol, 203); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -10887,7 +11033,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -10895,14 +11041,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSymbols.length; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -10911,7 +11057,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSignatures.length; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -11010,7 +11156,7 @@ var ts; function getUnionSignatures(types, kind) { var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -11031,7 +11177,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -11167,7 +11313,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -11185,7 +11331,7 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0, _b = props.length; _a < _b; _a++) { + for (var _a = 0; _a < props.length; _a++) { var prop = props[_a]; if (prop.declarations) { declarations.push.apply(declarations, prop.declarations); @@ -11310,7 +11456,7 @@ var ts; returnType = classType; } else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); + returnType = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } else { if (declaration.kind === 136 && !ts.hasDynamicName(declaration)) { @@ -11334,7 +11480,7 @@ var ts; switch (node.kind) { case 142: case 143: - case 197: + case 200: case 134: case 133: case 135: @@ -11432,7 +11578,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -11448,7 +11594,7 @@ var ts; function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType + ? declaration.type ? getTypeFromTypeNodeOrHeritageClauseElement(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { @@ -11458,7 +11604,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128).constraint); + type.constraint = getTypeFromTypeNodeOrHeritageClauseElement(ts.getDeclarationOfKind(type.symbol, 128).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -11482,7 +11628,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } @@ -11533,31 +11679,42 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReferenceNode(node) { + function getTypeFromTypeReference(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromHeritageClauseElement(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromTypeReferenceOrHeritageClauseElement(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var symbol = resolveEntityName(node.typeName, 793056); var type; - if (symbol) { - if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - type = unknownType; - } - else { - type = getDeclaredTypeOfSymbol(symbol); - if (type.flags & (1024 | 2048) && type.flags & 4096) { - var typeParameters = type.typeParameters; - if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); - } - else { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); - type = undefined; - } + if (node.kind !== 177 || ts.isSupportedHeritageClauseElement(node)) { + var typeNameOrExpression = node.kind === 141 + ? node.typeName + : node.expression; + var symbol = resolveEntityName(typeNameOrExpression, 793056); + if (symbol) { + if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; } else { - if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); - type = undefined; + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 | 2048) && type.flags & 4096) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNodeOrHeritageClauseElement)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } } } } @@ -11576,12 +11733,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 198: - case 199: case 201: + case 202: + case 204: return declaration; } } @@ -11623,7 +11780,7 @@ var ts; function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + links.resolvedType = createArrayType(getTypeFromTypeNodeOrHeritageClauseElement(node.elementType)); } return links.resolvedType; } @@ -11639,7 +11796,7 @@ var ts; function getTypeFromTupleTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNodeOrHeritageClauseElement)); } return links.resolvedType; } @@ -11659,13 +11816,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -11683,7 +11840,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -11730,7 +11887,7 @@ var ts; function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNodeOrHeritageClauseElement), true); } return links.resolvedType; } @@ -11756,7 +11913,7 @@ var ts; } return links.resolvedType; } - function getTypeFromTypeNode(node) { + function getTypeFromTypeNodeOrHeritageClauseElement(node) { switch (node.kind) { case 112: return anyType; @@ -11773,7 +11930,9 @@ var ts; case 8: return getTypeFromStringLiteral(node); case 141: - return getTypeFromTypeReferenceNode(node); + return getTypeFromTypeReference(node); + case 177: + return getTypeFromHeritageClauseElement(node); case 144: return getTypeFromTypeQueryNode(node); case 146: @@ -11783,7 +11942,7 @@ var ts; case 148: return getTypeFromUnionTypeNode(node); case 149: - return getTypeFromTypeNode(node.type); + return getTypeFromTypeNodeOrHeritageClauseElement(node.type); case 142: case 143: case 145: @@ -11799,7 +11958,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _n = items.length; _i < _n; _i++) { + for (var _i = 0; _i < items.length; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -11839,7 +11998,7 @@ var ts; case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _n = sources.length; _i < _n; _i++) { + for (var _i = 0; _i < sources.length; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -11955,7 +12114,7 @@ var ts; case 169: return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 221: + case 224: return isContextSensitive(node.initializer); case 134: case 133: @@ -12127,7 +12286,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -12150,7 +12309,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -12287,7 +12446,7 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -12358,7 +12517,7 @@ var ts; return 0; } var result = -1; - for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceProperties.length; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -12383,11 +12542,11 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceSignatures.length; _a++) { var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); @@ -12605,7 +12764,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -12738,7 +12897,7 @@ var ts; ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 197: + case 200: case 134: case 133: case 136: @@ -12791,7 +12950,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { + for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); } @@ -12862,7 +13021,7 @@ var ts; var targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _i = 0, _n = targetTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < targetTypes.length; _i++) { var t = targetTypes[_i]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -12880,7 +13039,7 @@ var ts; } else if (source.flags & 16384) { var sourceTypes = source.types; - for (var _a = 0, _b = sourceTypes.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceTypes.length; _a++) { var sourceType = sourceTypes[_a]; inferFromTypes(sourceType, target); } @@ -12907,7 +13066,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -12980,7 +13139,7 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; } return links.resolvedSymbol; } @@ -13051,7 +13210,7 @@ var ts; switch (node.kind) { case 169: return isAssignedInBinaryExpression(node); - case 195: + case 198: case 152: return isAssignedInVariableDeclaration(node); case 150: @@ -13071,24 +13230,24 @@ var ts; case 168: case 170: case 173: - case 176: - case 177: case 179: case 180: - case 181: case 182: case 183: case 184: case 185: + case 186: + case 187: case 188: - case 189: - case 190: - case 217: - case 218: case 191: case 192: case 193: case 220: + case 221: + case 194: + case 195: + case 196: + case 223: return ts.forEachChild(node, isAssignedIn); } return false; @@ -13124,7 +13283,7 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 180: + case 183: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } @@ -13144,9 +13303,9 @@ var ts; } } break; - case 224: - case 202: - case 197: + case 227: + case 205: + case 200: case 134: case 133: case 136: @@ -13289,15 +13448,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 220) { + symbol.valueDeclaration.parent.kind === 223) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 196) { + while (container.kind !== 199) { container = container.parent; } container = container.parent; - if (container.kind === 177) { + if (container.kind === 180) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -13314,7 +13473,7 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; getNodeLinks(node).flags |= 2; if (container.kind === 132 || container.kind === 135) { getNodeLinks(classNode).flags |= 4; @@ -13331,10 +13490,10 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 202: + case 205: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 201: + case 204: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 135: @@ -13355,7 +13514,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -13372,9 +13531,9 @@ var ts; } function checkSuperExpression(node) { var isCallExpression = node.parent.kind === 157 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); var baseClass; - if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); baseClass = classType.baseTypes.length && classType.baseTypes[0]; } @@ -13395,7 +13554,7 @@ var ts; container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 198) { + if (container && container.parent && container.parent.kind === 201) { if (container.flags & 128) { canUseSuperExpression = container.kind === 134 || @@ -13471,7 +13630,7 @@ var ts; var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var type = getContextuallyTypedParameterType(declaration); @@ -13537,7 +13696,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -13616,29 +13775,29 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 195: + case 198: case 129: case 132: case 131: case 152: return getContextualTypeForInitializerExpression(node); case 163: - case 188: + case 191: return getContextualTypeForReturnExpression(node); case 157: case 158: return getContextualTypeForArgument(parent, node); case 160: - return getTypeFromTypeNode(parent.type); + return getTypeFromTypeNodeOrHeritageClauseElement(parent.type); case 169: return getContextualTypeForBinaryOperand(node); - case 221: + case 224: return getContextualTypeForObjectLiteralElement(parent); case 153: return getContextualTypeForElementExpression(node); case 170: return getContextualTypeForConditionalOperand(node); - case 175: + case 176: ts.Debug.assert(parent.parent.kind === 171); return getContextualTypeForSubstitutionExpression(parent.parent, node); case 161: @@ -13674,7 +13833,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { @@ -13709,7 +13868,7 @@ var ts; if (parent.kind === 169 && parent.operatorToken.kind === 53 && parent.left === node) { return true; } - if (parent.kind === 221) { + if (parent.kind === 224) { return isAssignmentTarget(parent.parent); } if (parent.kind === 153) { @@ -13778,21 +13937,21 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 221 || - memberDecl.kind === 222 || + if (memberDecl.kind === 224 || + memberDecl.kind === 225 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 221) { + if (memberDecl.kind === 224) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 134) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 222); + ts.Debug.assert(memberDecl.kind === 225); type = memberDecl.name.kind === 127 ? unknownType : checkExpression(memberDecl.name, contextualMapper); @@ -13852,7 +14011,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 198); + var enclosingClassDeclaration = ts.getAncestor(node, 201); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -14051,7 +14210,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var parent_4 = signature.declaration && signature.declaration.parent; @@ -14100,7 +14259,7 @@ var ts; var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); - callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } else { var templateLiteral = tagExpression.template; @@ -14163,7 +14322,7 @@ var ts; } for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = void 0; if (i === 0 && args[i].parent.kind === 159) { @@ -14192,7 +14351,7 @@ var ts; var typeArgumentsAreAssignable = true; for (var i = 0; i < typeParameters.length; i++) { var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); + var typeArgument = getTypeFromTypeNodeOrHeritageClauseElement(typeArgNode); typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); @@ -14206,7 +14365,7 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = i === 0 && node.kind === 159 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : @@ -14236,8 +14395,8 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91) { - var containingClass = ts.getAncestor(callExpression, 198); - var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + var containingClass = ts.getAncestor(callExpression, 201); + var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } else { @@ -14304,7 +14463,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -14313,7 +14472,7 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var originalCandidate = candidates[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; @@ -14495,7 +14654,7 @@ var ts; } function checkTypeAssertion(node) { var exprType = checkExpression(node.expression); - var targetType = getTypeFromTypeNode(node.type); + var targetType = getTypeFromTypeNodeOrHeritageClauseElement(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { @@ -14533,7 +14692,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 176) { + if (func.body.kind !== 179) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -14571,7 +14730,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 192); + return (body.statements.length === 1) && (body.statements[0].kind === 195); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -14580,7 +14739,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 176) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 179) { return; } var bodyBlock = func.body; @@ -14632,16 +14791,16 @@ var ts; function checkFunctionExpressionOrObjectLiteralMethodBody(node) { ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); if (node.type) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (node.body) { - if (node.body.kind === 176) { + if (node.body.kind === 179) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); if (node.type) { - checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrHeritageClauseElement(node.type), node.body, undefined); } checkFunctionExpressionBodies(node.body); } @@ -14700,19 +14859,6 @@ var ts; return false; } } - function isImportedNameFromExternalModule(n) { - switch (n.kind) { - case 156: - case 155: { - var symbol = findSymbol(n.expression); - return symbol && symbol.flags & 8388608 && isExternalModuleSymbol(resolveAlias(symbol)); - } - case 161: - return isImportedNameFromExternalModule(n.expression); - default: - return false; - } - } if (!isReferenceOrErrorExpression(n)) { error(n, invalidReferenceMessage); return false; @@ -14721,9 +14867,6 @@ var ts; error(n, constantVariableMessage); return false; } - if (isImportedNameFromExternalModule(n)) { - error(n, invalidReferenceMessage); - } return true; } function checkDeleteExpression(node) { @@ -14781,7 +14924,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -14797,7 +14940,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -14833,9 +14976,9 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var name_8 = p.name; var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name_8.text) || @@ -14862,7 +15005,7 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { var propName = "" + i; var type = sourceType.flags & 1 ? sourceType : @@ -15184,6 +15327,8 @@ var ts; return checkTypeAssertion(node); case 161: return checkExpression(node.expression, contextualMapper); + case 174: + return checkClassExpression(node); case 162: case 163: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -15203,7 +15348,7 @@ var ts; return checkConditionalExpression(node, contextualMapper); case 173: return checkSpreadElementExpression(node, contextualMapper); - case 174: + case 175: return undefinedType; case 172: checkYieldExpression(node); @@ -15250,7 +15395,7 @@ var ts; if (node.kind === 140) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 || node.kind === 197 || node.kind === 143 || + else if (node.kind === 142 || node.kind === 200 || node.kind === 143 || node.kind === 138 || node.kind === 135 || node.kind === 139) { checkGrammarFunctionLikeDeclaration(node); @@ -15276,7 +15421,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 199) { + if (node.kind === 202) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -15286,7 +15431,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -15344,7 +15489,7 @@ var ts; } switch (n.kind) { case 162: - case 197: + case 200: case 163: case 154: return false; default: return ts.forEachChild(n, containsSuperCall); @@ -15354,7 +15499,7 @@ var ts; if (n.kind === 93) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 && n.kind !== 197) { + else if (n.kind !== 162 && n.kind !== 200) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -15363,13 +15508,13 @@ var ts; !(n.flags & 128) && !!n.initializer; } - if (ts.getClassBaseTypeNode(node.parent)) { + if (ts.getClassExtendsHeritageClauseElement(node.parent)) { if (containsSuperCall(node.body)) { var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 179 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 182 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -15413,9 +15558,15 @@ var ts; function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeReference(node) { + function checkTypeReferenceNode(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkHeritageClauseElement(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkTypeReferenceOrHeritageClauseElement(node) { checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceNode(node); + var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); if (type !== unknownType && node.typeArguments) { var len = node.typeArguments.length; for (var i = 0; i < len; i++) { @@ -15468,7 +15619,7 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 199) { + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202) { ts.Debug.assert(signatureDeclarationNode.kind === 138 || signatureDeclarationNode.kind === 139); var signatureKind = signatureDeclarationNode.kind === 138 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); @@ -15478,7 +15629,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { + for (var _i = 0; _i < signaturesToCheck.length; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -15488,7 +15639,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 199 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 202 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -15545,7 +15696,7 @@ var ts; var declarations = symbol.declarations; var isConstructor = (symbol.flags & 16384) !== 0; function reportImplementationExpectedError(node) { - if (node.name && ts.getFullWidth(node.name) === 0) { + if (node.name && ts.nodeIsMissing(node.name)) { return; } var seen = false; @@ -15584,15 +15735,15 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 199 || node.parent.kind === 145 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 202 || node.parent.kind === 145 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 197 || node.kind === 134 || node.kind === 133 || node.kind === 135) { + if (node.kind === 200 || node.kind === 134 || node.kind === 133 || node.kind === 135) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -15643,7 +15794,7 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + for (var _a = 0; _a < signatures.length; _a++) { var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); @@ -15689,16 +15840,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 199: - return 2097152; case 202: + return 2097152; + case 205: return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 198: case 201: + case 204: return 2097152 | 1048576; - case 205: + case 208: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -15712,7 +15863,7 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 198: + case 201: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]); @@ -15738,7 +15889,7 @@ var ts; return; } switch (node.kind) { - case 198: + case 201: case 134: case 136: case 137: @@ -15783,18 +15934,18 @@ var ts; } checkSourceElement(node.body); if (node.type && !isAccessor(node.kind)) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !node.type && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } } function checkBlock(node) { - if (node.kind === 176) { + if (node.kind === 179) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 203) { + if (ts.isFunctionBlock(node) || node.kind === 206) { checkFunctionExpressionBodies(node); } } @@ -15854,11 +16005,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } - if (ts.getClassBaseTypeNode(enclosingClass)) { + if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var isDeclaration_2 = node.kind !== 65; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); @@ -15872,11 +16023,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 202 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 205 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 224 && ts.isExternalModule(parent)) { + if (parent.kind === 227 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -15887,7 +16038,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { return; } - if (node.kind === 195 && !node.initializer) { + if (node.kind === 198 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -15897,15 +16048,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 196); - var container = varDeclList.parent.kind === 177 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199); + var container = varDeclList.parent.kind === 180 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 176 && ts.isFunctionLike(container.parent) || - container.kind === 203 || - container.kind === 202 || - container.kind === 224); + (container.kind === 179 && ts.isFunctionLike(container.parent) || + container.kind === 206 || + container.kind === 205 || + container.kind === 227); if (!namesShareScope) { var name_9 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_9, name_9); @@ -15989,7 +16140,7 @@ var ts; } if (node.kind !== 132 && node.kind !== 131) { checkExportsOnMergedDeclarations(node); - if (node.kind === 195 || node.kind === 152) { + if (node.kind === 198 || node.kind === 152) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -16018,7 +16169,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 176 || node.kind === 154) { + if (node.kind === 179 || node.kind === 154) { return true; } node = node.parent; @@ -16046,12 +16197,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 196) { + if (node.initializer && node.initializer.kind == 199) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -16066,7 +16217,7 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { checkForInOrForOfVariableDeclaration(node); } else { @@ -16087,7 +16238,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { 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); @@ -16286,7 +16437,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 218 && !hasDuplicateDefaultClause) { + if (clause.kind === 221 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -16298,7 +16449,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 217) { + if (produceDiagnostics && clause.kind === 220) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -16315,7 +16466,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 191 && current.label.text === node.label.text) { + if (current.kind === 194 && 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; @@ -16379,9 +16530,9 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 198) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 201) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -16454,7 +16605,15 @@ var ts; } } } + function checkClassExpression(node) { + grammarErrorOnNode(node, ts.Diagnostics.class_expressions_are_not_currently_supported); + ts.forEach(node.members, checkSourceElement); + return unknownType; + } function checkClassDeclaration(node) { + if (node.parent.kind !== 206 && node.parent.kind !== 227) { + grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + } checkGrammarClassDeclarationHeritageClauses(node); checkDecorators(node); if (node.name) { @@ -16467,10 +16626,13 @@ var ts; var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); var staticType = getTypeOfSymbol(symbol); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); + } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkTypeReference(baseTypeNode); + checkHeritageClauseElement(baseTypeNode); } if (type.baseTypes.length) { if (produceDiagnostics) { @@ -16478,19 +16640,24 @@ var ts; checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); var staticBaseType = getTypeOfSymbol(baseType.symbol); checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType.symbol !== resolveEntityName(baseTypeNode.typeName, 107455)) { + if (baseType.symbol !== resolveEntityName(baseTypeNode.expression, 107455)) { error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); } checkKindsOfPropertyMemberOverrides(type, baseType); } - checkExpressionOrQualifiedName(baseTypeNode.typeName); } - var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (type.baseTypes.length || (baseTypeNode && compilerOptions.separateCompilation)) { + checkExpressionOrQualifiedName(baseTypeNode.expression); + } + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - checkTypeReference(typeRefNode); + if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromTypeReferenceNode(typeRefNode); + var t = getTypeFromHeritageClauseElement(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { @@ -16527,7 +16694,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. var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < baseProperties.length; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -16591,7 +16758,7 @@ var ts; if (!tp1.constraint || !tp2.constraint) { return false; } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + if (!isTypeIdenticalTo(getTypeFromTypeNodeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrHeritageClauseElement(tp2.constraint))) { return false; } } @@ -16604,10 +16771,10 @@ var ts; var seen = {}; ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0, _c = properties.length; _b < _c; _b++) { + for (var _b = 0; _b < properties.length; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; @@ -16635,7 +16802,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 199); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -16651,7 +16818,12 @@ var ts; } } } - ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { + if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(heritageElement); + }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { checkTypeForDuplicateIndexSignatures(node); @@ -16816,11 +16988,14 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); + var enumIsConst = ts.isConst(node); + if (compilerOptions.separateCompilation && enumIsConst && ts.isInAmbientContext(node)) { + error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided); + } var enumSymbol = getSymbolOfNode(node); var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { if (enumSymbol.declarations.length > 1) { - var enumIsConst = ts.isConst(node); ts.forEach(enumSymbol.declarations, function (decl) { if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); @@ -16829,7 +17004,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 201) { + if (declaration.kind !== 204) { return false; } var enumDeclaration = declaration; @@ -16850,9 +17025,9 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 198 || (declaration.kind === 197 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 201 || (declaration.kind === 200 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -16872,7 +17047,7 @@ var ts; if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -16895,20 +17070,29 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 126) { - node = node.left; + while (true) { + if (node.kind === 126) { + node = node.left; + } + else if (node.kind === 155) { + node = node.expression; + } + else { + break; + } } + ts.Debug.assert(node.kind === 65); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (ts.getFullWidth(moduleName) !== 0 && moduleName.kind !== 8) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { - error(moduleName, node.kind === 212 ? + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { + error(moduleName, node.kind === 215 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; @@ -16927,7 +17111,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 214 ? + var message = node.kind === 217 ? 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)); @@ -16950,7 +17134,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { checkImportBinding(importClause.namedBindings); } else { @@ -16995,8 +17179,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); } } @@ -17015,8 +17199,8 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 224 ? node.parent : node.parent.parent; - if (container.kind === 202 && container.name.kind === 65) { + var container = node.parent.kind === 227 ? node.parent : node.parent.parent; + if (container.kind === 205 && container.name.kind === 65) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; } @@ -17043,10 +17227,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 224) { + if (node.kind === 227) { return node.statements; } - if (node.kind === 202 && node.body.kind === 203) { + if (node.kind === 205 && node.body.kind === 206) { return node.body.statements; } return emptyArray; @@ -17098,7 +17282,7 @@ var ts; case 137: return checkAccessorDeclaration(node); case 141: - return checkTypeReference(node); + return checkTypeReferenceNode(node); case 144: return checkTypeQuery(node); case 145: @@ -17111,71 +17295,71 @@ var ts; return checkUnionType(node); case 149: return checkSourceElement(node.type); - case 197: + case 200: return checkFunctionDeclaration(node); - case 176: - case 203: - return checkBlock(node); - case 177: - return checkVariableStatement(node); case 179: - return checkExpressionStatement(node); + case 206: + return checkBlock(node); case 180: - return checkIfStatement(node); - case 181: - return checkDoStatement(node); + return checkVariableStatement(node); case 182: - return checkWhileStatement(node); + return checkExpressionStatement(node); case 183: - return checkForStatement(node); + return checkIfStatement(node); case 184: - return checkForInStatement(node); + return checkDoStatement(node); case 185: - return checkForOfStatement(node); + return checkWhileStatement(node); case 186: + return checkForStatement(node); case 187: - return checkBreakOrContinueStatement(node); + return checkForInStatement(node); case 188: - return checkReturnStatement(node); + return checkForOfStatement(node); case 189: - return checkWithStatement(node); case 190: - return checkSwitchStatement(node); + return checkBreakOrContinueStatement(node); case 191: - return checkLabeledStatement(node); + return checkReturnStatement(node); case 192: - return checkThrowStatement(node); + return checkWithStatement(node); case 193: - return checkTryStatement(node); + return checkSwitchStatement(node); + case 194: + return checkLabeledStatement(node); case 195: + return checkThrowStatement(node); + case 196: + return checkTryStatement(node); + case 198: return checkVariableDeclaration(node); case 152: return checkBindingElement(node); - case 198: - return checkClassDeclaration(node); - case 199: - return checkInterfaceDeclaration(node); - case 200: - return checkTypeAliasDeclaration(node); case 201: - return checkEnumDeclaration(node); + return checkClassDeclaration(node); case 202: - return checkModuleDeclaration(node); - case 206: - return checkImportDeclaration(node); + return checkInterfaceDeclaration(node); + case 203: + return checkTypeAliasDeclaration(node); + case 204: + return checkEnumDeclaration(node); case 205: + return checkModuleDeclaration(node); + case 209: + return checkImportDeclaration(node); + case 208: return checkImportEqualsDeclaration(node); - case 212: - return checkExportDeclaration(node); - case 211: - return checkExportAssignment(node); - case 178: - checkGrammarStatementInAmbientContext(node); - return; - case 194: - checkGrammarStatementInAmbientContext(node); - return; case 215: + return checkExportDeclaration(node); + case 214: + return checkExportAssignment(node); + case 181: + checkGrammarStatementInAmbientContext(node); + return; + case 197: + checkGrammarStatementInAmbientContext(node); + return; + case 218: return checkMissingDeclaration(node); } } @@ -17196,10 +17380,10 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 189: + case 192: checkFunctionExpressionBodies(node.expression); break; case 129: @@ -17210,14 +17394,14 @@ var ts; case 152: case 153: case 154: - case 221: + case 224: case 155: case 156: case 157: case 158: case 159: case 171: - case 175: + case 176: case 160: case 161: case 165: @@ -17228,12 +17412,9 @@ var ts; case 169: case 170: case 173: - case 176: - case 203: - case 177: case 179: + case 206: case 180: - case 181: case 182: case 183: case 184: @@ -17241,21 +17422,24 @@ var ts; case 186: case 187: case 188: + case 189: case 190: - case 204: - case 217: - case 218: case 191: - case 192: case 193: + case 207: case 220: + case 221: + case 194: case 195: case 196: - case 198: - case 201: case 223: - case 211: - case 224: + case 198: + case 199: + case 201: + case 204: + case 226: + case 214: + case 227: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -17310,7 +17494,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 189 && node.parent.statement === node) { + if (node.parent.kind === 192 && node.parent.statement === node) { return true; } node = node.parent; @@ -17332,18 +17516,18 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) { break; } - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17384,17 +17568,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17419,20 +17603,28 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 128: - case 198: - case 199: - case 200: case 201: + case 202: + case 203: + case 204: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126) + while (node.parent && node.parent.kind === 126) { node = node.parent; + } return node.parent && node.parent.kind === 141; } - function isTypeNode(node) { + function isHeritageClauseElementIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 155) { + node = node.parent; + } + return node.parent && node.parent.kind === 177; + } + function isTypeNodeOrHeritageClauseElement(node) { if (141 <= node.kind && node.kind <= 149) { return true; } @@ -17447,12 +17639,18 @@ var ts; return node.parent.kind !== 166; case 8: return node.parent.kind === 129; + case 177: + return true; case 65: if (node.parent.kind === 126 && node.parent.right === node) { node = node.parent; } + else if (node.parent.kind === 155 && node.parent.name === node) { + node = node.parent; + } case 126: - ts.Debug.assert(node.kind === 65 || node.kind === 126, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 155: + ts.Debug.assert(node.kind === 65 || node.kind === 126 || node.kind === 155, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_5 = node.parent; if (parent_5.kind === 144) { return false; @@ -17461,14 +17659,16 @@ var ts; return true; } switch (parent_5.kind) { + case 177: + return true; case 128: return node === parent_5.constraint; case 132: case 131: case 129: - case 195: + case 198: return node === parent_5.type; - case 197: + case 200: case 162: case 163: case 135: @@ -17496,10 +17696,10 @@ var ts; while (nodeOnRightSide.parent.kind === 126) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 205) { + if (nodeOnRightSide.parent.kind === 208) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 211) { + if (nodeOnRightSide.parent.kind === 214) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -17507,15 +17707,11 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } - function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 && node.parent.right === node) || - (node.parent.kind === 155 && node.parent.name === node); - } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 211) { + if (entityName.parent.kind === 214) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 155) { @@ -17523,11 +17719,16 @@ var ts; return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } } - if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (ts.isExpression(entityName)) { - if (ts.getFullWidth(entityName) === 0) { + if (isHeritageClauseElementIdentifier(entityName)) { + var meaning = entityName.parent.kind === 177 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, meaning); + } + else if (ts.isExpression(entityName)) { + if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 65) { @@ -17564,7 +17765,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 211 + return node.parent.kind === 214 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } @@ -17587,7 +17788,7 @@ var ts; var moduleName; if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 206 || node.parent.kind === 212) && + ((node.parent.kind === 209 || node.parent.kind === 215) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -17606,7 +17807,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 222) { + if (location && location.kind === 225) { return resolveEntityName(location.name, 107455); } return undefined; @@ -17615,12 +17816,12 @@ var ts; if (isInsideWithStatementBody(node)) { return unknownType; } + if (isTypeNodeOrHeritageClauseElement(node)) { + return getTypeFromTypeNodeOrHeritageClauseElement(node); + } if (ts.isExpression(node)) { return getTypeOfExpression(node); } - if (isTypeNode(node)) { - return getTypeFromTypeNode(node); - } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -17645,7 +17846,7 @@ var ts; return unknownType; } function getTypeOfExpression(expr) { - if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } return checkExpression(expr); @@ -17680,7 +17881,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 224; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { if (languageVersion >= 2) { @@ -17688,10 +17889,10 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 207) { + if (node.kind === 210) { return getGeneratedNameForNode(node.parent) + ".default"; } - if (node.kind === 210) { + if (node.kind === 213) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -17708,7 +17909,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 202 || node.kind === 201) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 205 || node.kind === 204) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -17731,29 +17932,33 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 205: - case 207: case 208: case 210: - case 214: + case 211: + case 213: + case 217: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 212: + case 215: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 211: + case 214: return node.expression && node.expression.kind === 65 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 224 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 227 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } - return isAliasResolvedToValue(getSymbolOfNode(node)); + var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); + return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - return target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + if (target === unknownSymbol && compilerOptions.separateCompilation) { + return true; + } + return target !== unknownSymbol && target && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -17787,7 +17992,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 223) { + if (node.kind === 226) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -17822,13 +18027,13 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 195 && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 198 && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 220; + symbol.valueDeclaration.parent.kind !== 223; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -17934,17 +18139,17 @@ var ts; case 134: case 133: case 140: - case 198: - case 199: - case 202: case 201: - case 177: - case 197: - case 200: - case 206: + case 202: case 205: - case 212: - case 211: + case 204: + case 180: + case 200: + case 203: + case 209: + case 208: + case 215: + case 214: case 129: break; default: @@ -17955,7 +18160,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 109: @@ -17979,7 +18184,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -17988,7 +18193,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 129) { @@ -18004,7 +18209,7 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 129) { @@ -18016,13 +18221,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 129) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 203) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -18041,10 +18246,10 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 206 || node.kind === 205) && flags & 2) { + else if ((node.kind === 209 || node.kind === 208) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 199 && flags & 2) { + else if (node.kind === 202 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } else if (node.kind === 129 && (flags & 112) && ts.isBindingPattern(node.name)) { @@ -18172,9 +18377,9 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _n = arguments.length; _i < _n; _i++) { + for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 174) { + if (arg.kind === 175) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -18199,7 +18404,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -18227,7 +18432,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -18273,16 +18478,16 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_11 = prop.name; - if (prop.kind === 174 || + if (prop.kind === 175 || name_11.kind === 127) { checkGrammarComputedPropertyName(name_11); continue; } var currentKind = void 0; - if (prop.kind === 221 || prop.kind === 222) { + if (prop.kind === 224 || prop.kind === 225) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_11.kind === 7) { checkGrammarNumbericLiteral(name_11); @@ -18329,24 +18534,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 196) { + if (forInOrOfStatement.initializer.kind === 199) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? 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 === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? 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); @@ -18415,7 +18620,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -18426,7 +18631,7 @@ 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 === 199) { + else if (node.parent.kind === 202) { 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 === 145) { @@ -18435,13 +18640,13 @@ var ts; } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return true; - case 191: + case 194: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -18453,9 +18658,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 191: + case 194: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 186 + var isMisplacedContinueLabel = node.kind === 189 && !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); @@ -18463,8 +18668,8 @@ var ts; return false; } break; - case 190: - if (node.kind === 187 && !node.label) { + case 193: + if (node.kind === 190 && !node.label) { return false; } break; @@ -18477,13 +18682,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 187 + var message = node.kind === 190 ? 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 === 187 + var message = node.kind === 190 ? 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); @@ -18502,11 +18707,8 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 184 && node.parent.parent.kind !== 185) { + if (node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { if (ts.isInAmbientContext(node)) { - if (ts.isBindingPattern(node.name)) { - return grammarErrorOnNode(node, ts.Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); - } if (node.initializer) { var equalsTokenLength = "=".length; return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); @@ -18533,7 +18735,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _n = elements.length; _i < _n; _i++) { + for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -18550,15 +18752,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 180: - case 181: - case 182: - case 189: case 183: case 184: case 185: + case 192: + case 186: + case 187: + case 188: return false; - case 191: + case 194: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -18591,7 +18793,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; if (node.name.kind === 127) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -18655,13 +18857,13 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -18676,11 +18878,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 199 || - node.kind === 206 || - node.kind === 205 || - node.kind === 212 || - node.kind === 211 || + if (node.kind === 202 || + node.kind === 209 || + node.kind === 208 || + node.kind === 215 || + node.kind === 214 || (node.flags & 2) || (node.flags & (1 | 256))) { return false; @@ -18688,9 +18890,9 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 177) { + if (ts.isDeclaration(decl) || decl.kind === 180) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -18709,7 +18911,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 === 176 || node.parent.kind === 203 || node.parent.kind === 224) { + if (node.parent.kind === 179 || node.parent.kind === 206 || node.parent.kind === 227) { 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); @@ -18790,7 +18992,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 206); + ts.Debug.assert(aliasEmitInfo.node.kind === 209); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -18863,10 +19065,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 195) { + if (declaration.kind === 198) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 209 || declaration.kind === 210 || declaration.kind === 207) { + else if (declaration.kind === 212 || declaration.kind === 213 || declaration.kind === 210) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -18877,7 +19079,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 206) { + if (moduleElementEmitInfo.node.kind === 209) { moduleElementEmitInfo.isVisible = true; } else { @@ -18885,12 +19087,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -18943,14 +19145,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { @@ -18985,6 +19187,8 @@ var ts; case 99: case 8: return writeTextOfNode(currentSourceFile, type); + case 177: + return emitHeritageClauseElement(type); case 141: return emitTypeReference(type); case 144: @@ -19006,11 +19210,9 @@ var ts; return emitEntityName(type); case 126: return emitEntityName(type); - default: - ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 205 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 208 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -19018,10 +19220,22 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var qualifiedName = entityName; - writeEntityName(qualifiedName.left); + var left = entityName.kind === 126 ? entityName.left : entityName.expression; + var right = entityName.kind === 126 ? entityName.right : entityName.name; + writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, qualifiedName.right); + writeTextOfNode(currentSourceFile, right); + } + } + } + function emitHeritageClauseElement(node) { + if (ts.isSupportedHeritageClauseElement(node)) { + ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 155); + emitEntityName(node.expression); + if (node.typeArguments) { + write("<"); + emitCommaList(node.typeArguments, emitType); + write(">"); } } } @@ -19105,10 +19319,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 205 || - (node.parent.kind === 224 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 208 || + (node.parent.kind === 227 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 224) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -19117,7 +19331,7 @@ var ts; }); } else { - if (node.kind === 206) { + if (node.kind === 209) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -19135,23 +19349,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 197: - return writeFunctionDeclaration(node); - case 177: - return writeVariableStatement(node); - case 199: - return writeInterfaceDeclaration(node); - case 198: - return writeClassDeclaration(node); case 200: - return writeTypeAliasDeclaration(node); - case 201: - return writeEnumDeclaration(node); + return writeFunctionDeclaration(node); + case 180: + return writeVariableStatement(node); case 202: - return writeModuleDeclaration(node); + return writeInterfaceDeclaration(node); + case 201: + return writeClassDeclaration(node); + case 203: + return writeTypeAliasDeclaration(node); + case 204: + return writeEnumDeclaration(node); case 205: + return writeModuleDeclaration(node); + case 208: return writeImportEqualsDeclaration(node); - case 206: + case 209: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -19165,7 +19379,7 @@ var ts; if (node.flags & 256) { write("default "); } - else if (node.kind !== 199) { + else if (node.kind !== 202) { write("declare "); } } @@ -19209,7 +19423,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 208) { + if (namedBindings.kind === 211) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -19235,7 +19449,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -19286,7 +19500,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 203) { + while (node.body.kind !== 206) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -19375,10 +19589,10 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 198: + case 201: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 199: + case 202: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 139: @@ -19392,14 +19606,14 @@ var ts; if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { + else if (node.parent.parent.kind === 201) { 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 197: + case 200: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -19424,10 +19638,12 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + if (ts.isSupportedHeritageClauseElement(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { 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; @@ -19460,11 +19676,11 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { emitHeritageClause([baseTypeNode], false); } - emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); write(" {"); writeLine(); increaseIndent(); @@ -19504,7 +19720,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 195 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 198 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -19522,7 +19738,7 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 195) { + if (node.kind === 198) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19537,7 +19753,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 === 198) { + else if (node.parent.kind === 201) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19560,7 +19776,14 @@ var ts; } : undefined; } function emitBindingPattern(bindingPattern) { - emitCommaList(bindingPattern.elements, emitBindingElement); + var elements = []; + for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 175) { + elements.push(element); + } + } + emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { @@ -19690,13 +19913,13 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 197) { + if (node.kind === 200) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 134) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 197) { + if (node.kind === 200) { write("function "); writeTextOfNode(currentSourceFile, node.name); } @@ -19778,7 +20001,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 === 198) { + else if (node.parent.kind === 201) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19791,7 +20014,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 197: + case 200: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19814,7 +20037,7 @@ var ts; write("..."); } if (ts.isBindingPattern(node.name)) { - write("_" + ts.indexOf(node.parent.parameters, node)); + emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); @@ -19832,79 +20055,124 @@ var ts; writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage; + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { case 135: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - break; case 139: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 134: case 133: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + else if (node.parent.parent.kind === 201) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - break; - case 197: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 200: + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); } - return { - diagnosticMessage: diagnosticMessage, - errorNode: node, - typeName: node.name - }; + } + function emitBindingPattern(bindingPattern) { + if (bindingPattern.kind === 150) { + write("{"); + emitCommaList(bindingPattern.elements, emitBindingElement); + write("}"); + } + else if (bindingPattern.kind === 151) { + write("["); + var elements = bindingPattern.elements; + emitCommaList(elements, emitBindingElement); + if (elements && elements.hasTrailingComma) { + write(", "); + } + write("]"); + } + } + function emitBindingElement(bindingElement) { + function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: bindingElement, + typeName: bindingElement.name + } : undefined; + } + if (bindingElement.kind === 175) { + write(" "); + } + else if (bindingElement.kind === 152) { + if (bindingElement.propertyName) { + writeTextOfNode(currentSourceFile, bindingElement.propertyName); + write(": "); + emitBindingPattern(bindingElement.name); + } + else if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + emitBindingPattern(bindingElement.name); + } + else { + ts.Debug.assert(bindingElement.name.kind === 65); + if (bindingElement.dotDotDotToken) { + write("..."); + } + writeTextOfNode(currentSourceFile, bindingElement.name); + } + } + } } } function emitNode(node) { switch (node.kind) { - case 197: - case 202: - case 205: - case 199: - case 198: case 200: + case 205: + case 208: + case 202: case 201: + case 203: + case 204: return emitModuleElement(node, isModuleElementVisible(node)); - case 177: + case 180: return emitModuleElement(node, isVariableStatementVisible(node)); - case 206: + case 209: return emitModuleElement(node, !node.importClause); - case 212: + case 215: return emitExportDeclaration(node); case 135: case 134: @@ -19920,11 +20188,11 @@ var ts; case 132: case 131: return emitPropertyDeclaration(node); - case 223: + case 226: return emitEnumMemberDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFile(node); } } @@ -20033,7 +20301,6 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; - var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var generatedNameSet = {}; var nodeToGeneratedName = []; @@ -20152,24 +20419,24 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 197: - case 198: + case 200: + case 201: generateNameForFunctionOrClassDeclaration(node); break; - case 202: + case 205: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 201: + case 204: generateNameForModuleOrEnum(node); break; - case 206: + case 209: generateNameForImportDeclaration(node); break; - case 212: + case 215: generateNameForExportDeclaration(node); break; - case 211: + case 214: generateNameForExportAssignment(node); break; } @@ -20323,15 +20590,15 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 197 || + else if (node.kind === 200 || node.kind === 162 || node.kind === 134 || node.kind === 133 || node.kind === 136 || node.kind === 137 || - node.kind === 202 || - node.kind === 198 || - node.kind === 201) { + node.kind === 205 || + node.kind === 201 || + node.kind === 204) { if (node.name) { var name_15 = node.name; scopeName = name_15.kind === 127 @@ -20419,7 +20686,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 224) { + if (node.kind != 227) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -20504,7 +20771,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -20514,7 +20781,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -20528,7 +20795,7 @@ var ts; write(","); } decreaseIndent(); - if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -20793,35 +21060,35 @@ var ts; var parent = node.parent; switch (parent.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: - case 197: + case 200: case 136: case 137: case 162: - case 198: - case 199: case 201: case 202: + case 204: case 205: - case 207: case 208: - return parent.name === node; case 210: - case 214: - return parent.name === node || parent.propertyName === node; - case 187: - case 186: case 211: + return parent.name === node; + case 213: + case 217: + return parent.name === node || parent.propertyName === node; + case 190: + case 189: + case 214: return false; - case 191: + case 194: return node.parent.label === node; } } @@ -21015,9 +21282,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 221: + case 224: return property.initializer; - case 222: + case 225: return createIdentifier(resolver.getExpressionNameSubstitution(property.name, getGeneratedNameForNode)); case 134: return createFunctionExpression(property.parameters, property.body); @@ -21072,7 +21339,7 @@ var ts; return result; } function createExpressionStatement(expression) { - var result = ts.createSynthesizedNode(179); + var result = ts.createSynthesizedNode(182); result.expression = expression; return result; } @@ -21091,7 +21358,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(221); + var result = ts.createSynthesizedNode(224); result.name = name; result.initializer = initializer; return result; @@ -21184,6 +21451,9 @@ var ts; } } function tryEmitConstantValue(node) { + if (compilerOptions.separateCompilation) { + return false; + } var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { write(constantValue.toString()); @@ -21196,7 +21466,7 @@ var ts; return false; } function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); @@ -21401,7 +21671,7 @@ var ts; function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 53 && (node.left.kind === 154 || node.left.kind === 153)) { - emitDestructuring(node, node.parent.kind === 179); + emitDestructuring(node, node.parent.kind === 182); } else { emit(node.left); @@ -21437,13 +21707,13 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 176) { + if (node && node.kind === 179) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { - if (preserveNewLines && isSingleLineEmptyBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -21452,12 +21722,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 203) { - ts.Debug.assert(node.parent.kind === 202); + if (node.kind === 206) { + ts.Debug.assert(node.parent.kind === 205); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 203) { + if (node.kind === 206) { emitTempDeclarations(true); } decreaseIndent(); @@ -21466,7 +21736,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 176) { + if (node.kind === 179) { write(" "); emit(node); } @@ -21491,7 +21761,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76, node.thenStatement.end); - if (node.elseStatement.kind === 180) { + if (node.elseStatement.kind === 183) { write(" "); emit(node.elseStatement); } @@ -21503,7 +21773,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { write(" "); } else { @@ -21547,7 +21817,7 @@ var ts; var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 196) { + if (node.initializer && node.initializer.kind === 199) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; emitStartOfVariableDeclarationList(declarations[0], endPos); @@ -21565,13 +21835,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 185) { + if (languageVersion < 2 && node.kind === 188) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; @@ -21583,7 +21853,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 184) { + if (node.kind === 187) { write(" in "); } else { @@ -21620,7 +21890,6 @@ var ts; var rhsIsIdentifier = node.expression.kind === 65; var counter = createTempVariable(268435456); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(536870912) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -21634,24 +21903,12 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } - if (cachedLength) { - write(", "); - emitNodeWithoutSourceMap(cachedLength); - write(" = "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - if (cachedLength) { - emitNodeWithoutSourceMap(cachedLength); - } - else { - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } + emitNodeWithoutSourceMap(rhsReference); + write(".length"); emitEnd(node.initializer); write("; "); emitStart(node.initializer); @@ -21664,7 +21921,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -21695,7 +21952,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { emitLines(node.statement.statements); } else { @@ -21707,7 +21964,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 187 ? 66 : 71, node.pos); + emitToken(node.kind === 190 ? 66 : 71, node.pos); emitOptional(" ", node.label); write(";"); } @@ -21752,7 +22009,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 217) { + if (node.kind === 220) { write("case "); emit(node.expression); write(":"); @@ -21760,7 +22017,7 @@ var ts; else { write("default:"); } - if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -21807,7 +22064,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 202); + } while (node && node.kind !== 205); return node; } function emitContainingModuleName(node) { @@ -21840,11 +22097,11 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (node.name) { - emitModuleMemberName(node); + if (node.flags & 256) { + write("exports.default"); } else { - write("exports.default"); + emitModuleMemberName(node); } write(" = "); emitDeclarationName(node); @@ -21854,7 +22111,7 @@ var ts; } function emitExportMemberAssignments(name) { if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _a = 0, _b = exportSpecifiers[name.text], _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); emitStart(specifier.name); @@ -21870,7 +22127,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var isDeclaration = (root.kind === 195 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; + var isDeclaration = (root.kind === 198 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; if (root.kind === 169) { emitAssignmentExpression(root); } @@ -21883,7 +22140,7 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 195 || name.parent.kind === 152)) { + if (name.parent && (name.parent.kind === 198 || name.parent.kind === 152)) { emitModuleMemberName(name.parent); } else { @@ -21950,9 +22207,9 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _a = 0, _b = properties.length; _a < _b; _a++) { + for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -21965,7 +22222,7 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } @@ -22032,7 +22289,7 @@ var ts; var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 174) { + else if (element.kind !== 175) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -22069,8 +22326,8 @@ var ts; var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); if (isUninitializedLet && - node.parent.parent.kind !== 184 && - node.parent.parent.kind !== 185) { + node.parent.parent.kind !== 187 && + node.parent.parent.kind !== 188) { initializer = createVoidZero(); } } @@ -22078,7 +22335,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 174) { + if (node.kind === 175) { return; } var name = node.name; @@ -22090,7 +22347,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 195 && node.parent.kind !== 152)) { + if (!node.parent || (node.parent.kind !== 198 && node.parent.kind !== 152)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -22099,24 +22356,24 @@ var ts; if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 65 || - (node.parent.kind !== 195 && node.parent.kind !== 152)) { + (node.parent.kind !== 198 && node.parent.kind !== 152)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); if (((combinedFlags & 12288) === 0) || combinedFlags & 1) { return; } - var list = ts.getAncestor(node, 196); - if (list.parent.kind === 177) { - var isSourceFileLevelBinding = list.parent.parent.kind === 224; - var isModuleLevelBinding = list.parent.parent.kind === 203; - var isFunctionLevelBinding = list.parent.parent.kind === 176 && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 199); + if (list.parent.kind === 180) { + var isSourceFileLevelBinding = list.parent.parent.kind === 227; + var isModuleLevelBinding = list.parent.parent.kind === 206; + var isFunctionLevelBinding = list.parent.parent.kind === 179 && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 224 + var parent = blockScopeContainer.kind === 227 ? blockScopeContainer : blockScopeContainer.parent; if (resolver.resolvesToSomeValue(parent, node.text)) { @@ -22131,7 +22388,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && languageVersion >= 2 && - node.parent.kind === 224; + node.parent.kind === 227; } function emitVariableStatement(node) { if (!(node.flags & 1)) { @@ -22256,8 +22513,8 @@ var ts; if (node.kind === 162) { return !!node.name; } - else if (node.kind === 197) { - return !!node.name || (languageVersion >= 2 && !(node.flags & 256)); + if (node.kind === 200) { + return !!node.name || languageVersion < 2; } } function emitFunctionDeclaration(node) { @@ -22280,7 +22537,7 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 197 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 200 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } if (node.kind !== 134 && node.kind !== 133) { @@ -22330,7 +22587,7 @@ var ts; if (!node.body) { write(" { }"); } - else if (node.body.kind === 176) { + else if (node.body.kind === 179) { emitBlockFunctionBody(node, node.body); } else { @@ -22369,7 +22626,7 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); @@ -22406,8 +22663,8 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements, _c = _b.length; _a < _c; _a++) { + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { var statement = _b[_a]; write(" "); emit(statement); @@ -22430,7 +22687,7 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 179) { + if (statement && statement.kind === 182) { var expr = statement.expression; if (expr && expr.kind === 157) { var func = expr.expression; @@ -22496,7 +22753,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 134 || node.kind === 133) { + if (member.kind === 178) { + writeLine(); + write(";"); + } + else if (member.kind === 134 || node.kind === 133) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -22563,12 +22824,14 @@ var ts; }); } function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; if ((member.kind === 134 || node.kind === 133) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 || node.kind === 133 || member.kind === 136 || member.kind === 137) { + else if (member.kind === 134 || + member.kind === 136 || + member.kind === 137) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -22586,9 +22849,13 @@ var ts; emitEnd(member); emitTrailingComments(member); } + else if (member.kind === 178) { + writeLine(); + write(";"); + } } } - function emitConstructor(node, baseTypeNode) { + function emitConstructor(node, baseTypeElement) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; @@ -22623,7 +22890,7 @@ var ts; emitSignatureParameters(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { write("(...args)"); } else { @@ -22641,7 +22908,7 @@ var ts; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); - if (baseTypeNode) { + if (baseTypeElement) { var superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); @@ -22651,16 +22918,16 @@ var ts; emitParameterPropertyAssignments(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { writeLine(); - emitStart(baseTypeNode); + emitStart(baseTypeElement); if (languageVersion < 2) { write("_super.apply(this, arguments);"); } else { write("super(...args);"); } - emitEnd(baseTypeNode); + emitEnd(baseTypeElement); } } emitMemberAssignments(node, 0); @@ -22687,28 +22954,36 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { if (languageVersion < 2) { - emitClassDeclarationBelowES6(node); + emitClassLikeDeclarationBelowES6(node); } else { - emitClassDeclarationForES6AndHigher(node); + emitClassLikeDeclarationForES6AndHigher(node); } } - function emitClassDeclarationForES6AndHigher(node) { + function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { - write("export "); + if (node.kind === 201) { + if (thisNodeIsDecorated) { + if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 256) { - write("default "); + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 256) { + write("default "); + } } } write("class"); @@ -22716,10 +22991,10 @@ var ts; write(" "); emitDeclarationName(node); } - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write(" extends "); - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); } write(" {"); increaseIndent(); @@ -22762,11 +23037,14 @@ var ts; write(";"); } } - function emitClassDeclarationBelowES6(node) { - write("var "); - emitDeclarationName(node); - write(" = (function ("); - var baseTypeNode = ts.getClassBaseTypeNode(node); + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 201) { + write("var "); + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write("_super"); } @@ -22813,11 +23091,16 @@ var ts; emitStart(node); write(")("); if (baseTypeNode) { - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 201) { + write(";"); } - write(");"); emitEnd(node); - emitExportMemberAssignment(node); + if (node.kind === 201) { + emitExportMemberAssignment(node); + } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } @@ -22961,7 +23244,7 @@ var ts; } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums; + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.separateCompilation; } function emitEnumDeclaration(node) { if (!shouldEmitEnumDeclaration(node)) { @@ -23040,13 +23323,13 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 202) { + if (moduleDeclaration.body.kind === 205) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } } function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation); } function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); @@ -23068,7 +23351,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 203) { + if (node.body.kind === 206) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -23117,16 +23400,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 208) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 206 && node.importClause && !!node.importClause.name; + return node.kind === 209 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -23153,7 +23436,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -23179,7 +23462,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 205 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 208 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -23191,7 +23474,7 @@ var ts; write(" = "); } else { - var isNakedImport = 206 && !node.importClause; + var isNakedImport = 209 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -23266,7 +23549,7 @@ var ts; emitRequire(ts.getExternalModuleName(node)); write(";"); } - for (var _a = 0, _b = node.exportClause.elements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { var specifier = _b[_a]; if (resolver.isValueAliasDeclaration(specifier)) { writeLine(); @@ -23321,7 +23604,7 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(languageVersion >= 2); var needsComma = false; - for (var _a = 0, _b = specifiers.length; _a < _b; _a++) { + for (var _a = 0; _a < specifiers.length; _a++) { var specifier = specifiers[_a]; if (shouldEmit(specifier)) { if (needsComma) { @@ -23346,8 +23629,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 197 && - expression.kind !== 198) { + if (expression.kind !== 200 && + expression.kind !== 201) { write(";"); } emitEnd(node); @@ -23368,21 +23651,21 @@ var ts; exportSpecifiers = {}; exportEquals = undefined; hasExportStars = false; - for (var _a = 0, _b = sourceFile.statements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 206: + case 209: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 205: - if (node.moduleReference.kind === 216 && resolver.isReferencedAliasDeclaration(node)) { + case 208: + if (node.moduleReference.kind === 219 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 212: + case 215: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -23393,14 +23676,14 @@ var ts; } } else { - for (var _d = 0, _e = node.exportClause.elements, _f = _e.length; _d < _f; _d++) { - var specifier = _e[_d]; + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; var name_17 = (specifier.propertyName || specifier.name).text; (exportSpecifiers[name_17] || (exportSpecifiers[name_17] = [])).push(specifier); } } break; - case 211: + case 214: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -23442,7 +23725,7 @@ var ts; write("\"" + node.amdModuleName + "\", "); } write("[\"require\", \"exports\""); - for (var _a = 0, _b = externalImports.length; _a < _b; _a++) { + for (var _a = 0; _a < externalImports.length; _a++) { var importNode = externalImports[_a]; write(", "); var moduleName = ts.getExternalModuleName(importNode); @@ -23453,15 +23736,15 @@ var ts; write("\"\""); } } - for (var _c = 0, _d = node.amdDependencies, _e = _d.length; _c < _e; _c++) { - var amdDependency = _d[_c]; + for (var _b = 0, _c = node.amdDependencies; _b < _c.length; _b++) { + var amdDependency = _c[_b]; var text = "\"" + amdDependency.path + "\""; write(", "); write(text); } write("], function (require, exports"); - for (var _f = 0, _g = externalImports.length; _f < _g; _f++) { - var importNode = externalImports[_f]; + for (var _d = 0; _d < externalImports.length; _d++) { + var importNode = externalImports[_d]; write(", "); var namespaceDeclaration = getNamespaceDeclarationNode(importNode); if (namespaceDeclaration && !isDefaultImport(importNode)) { @@ -23471,8 +23754,8 @@ var ts; write(getGeneratedNameForNode(importNode)); } } - for (var _h = 0, _j = node.amdDependencies, _k = _j.length; _h < _k; _h++) { - var amdDependency = _j[_h]; + for (var _e = 0, _f = node.amdDependencies; _e < _f.length; _e++) { + var amdDependency = _f[_e]; if (amdDependency.name) { write(", "); write(amdDependency.name); @@ -23605,19 +23888,19 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 199: - case 197: - case 206: - case 205: - case 200: - case 211: - return false; case 202: + case 200: + case 209: + case 208: + case 203: + case 214: + return false; + case 205: return shouldEmitModuleDeclaration(node); - case 201: + case 204: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 176 && + if (node.kind !== 179 && node.parent && node.parent.kind === 163 && node.parent.body === node && @@ -23659,7 +23942,7 @@ var ts; return emitLiteral(node); case 171: return emitTemplateExpression(node); - case 175: + case 176: return emitTemplateSpan(node); case 126: return emitQualifiedName(node); @@ -23673,9 +23956,9 @@ var ts; return emitArrayLiteral(node); case 154: return emitObjectLiteral(node); - case 221: + case 224: return emitPropertyAssignment(node); - case 222: + case 225: return emitShorthandPropertyAssignment(node); case 127: return emitComputedPropertyName(node); @@ -23693,7 +23976,7 @@ var ts; return emit(node.expression); case 161: return emitParenExpression(node); - case 197: + case 200: case 162: case 163: return emitFunctionDeclaration(node); @@ -23713,71 +23996,73 @@ var ts; return emitConditionalExpression(node); case 173: return emitSpreadElementExpression(node); - case 174: + case 175: return; - case 176: - case 203: - return emitBlock(node); - case 177: - return emitVariableStatement(node); - case 178: - return write(";"); case 179: - return emitExpressionStatement(node); - case 180: - return emitIfStatement(node); - case 181: - return emitDoStatement(node); - case 182: - return emitWhileStatement(node); - case 183: - return emitForStatement(node); - case 185: - case 184: - return emitForInOrForOfStatement(node); - case 186: - case 187: - return emitBreakOrContinueStatement(node); - case 188: - return emitReturnStatement(node); - case 189: - return emitWithStatement(node); - case 190: - return emitSwitchStatement(node); - case 217: - case 218: - return emitCaseOrDefaultClause(node); - case 191: - return emitLabelledStatement(node); - case 192: - return emitThrowStatement(node); - case 193: - return emitTryStatement(node); - case 220: - return emitCatchClause(node); - case 194: - return emitDebuggerStatement(node); - case 195: - return emitVariableDeclaration(node); - case 198: - return emitClassDeclaration(node); - case 199: - return emitInterfaceDeclaration(node); - case 201: - return emitEnumDeclaration(node); - case 223: - return emitEnumMember(node); - case 202: - return emitModuleDeclaration(node); case 206: - return emitImportDeclaration(node); + return emitBlock(node); + case 180: + return emitVariableStatement(node); + case 181: + return write(";"); + case 182: + return emitExpressionStatement(node); + case 183: + return emitIfStatement(node); + case 184: + return emitDoStatement(node); + case 185: + return emitWhileStatement(node); + case 186: + return emitForStatement(node); + case 188: + case 187: + return emitForInOrForOfStatement(node); + case 189: + case 190: + return emitBreakOrContinueStatement(node); + case 191: + return emitReturnStatement(node); + case 192: + return emitWithStatement(node); + case 193: + return emitSwitchStatement(node); + case 220: + case 221: + return emitCaseOrDefaultClause(node); + case 194: + return emitLabelledStatement(node); + case 195: + return emitThrowStatement(node); + case 196: + return emitTryStatement(node); + case 223: + return emitCatchClause(node); + case 197: + return emitDebuggerStatement(node); + case 198: + return emitVariableDeclaration(node); + case 174: + return emitClassExpression(node); + case 201: + return emitClassDeclaration(node); + case 202: + return emitInterfaceDeclaration(node); + case 204: + return emitEnumDeclaration(node); + case 226: + return emitEnumMember(node); case 205: + return emitModuleDeclaration(node); + case 209: + return emitImportDeclaration(node); + case 208: return emitImportEqualsDeclaration(node); - case 212: + case 215: return emitExportDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFileNode(node); } } @@ -23805,7 +24090,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.pos !== node.parent.pos) { + if (node.parent.kind === 227 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -23817,7 +24102,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.end !== node.parent.end) { + if (node.parent.kind === 227 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -23911,7 +24196,7 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0.0"; + ts.version = "1.5.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -24234,7 +24519,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 206 || node.kind === 205 || node.kind === 212) { + if (node.kind === 209 || node.kind === 208 || node.kind === 215) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -24254,7 +24539,7 @@ var ts; } } } - else if (node.kind === 202 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 205 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { @@ -24276,6 +24561,20 @@ var ts; } } function verifyCompilerOptions() { + if (options.separateCompilation) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation)); + } + if (options.declaration) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation)); + } + if (options.noEmitOnError) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation)); + } + if (options.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); + } + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); @@ -24287,11 +24586,19 @@ var ts; } var languageVersion = options.target || 0; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); - if (firstExternalModuleSourceFile && !options.module) { + if (options.separateCompilation) { if (!options.module && languageVersion < 2) { - var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } + var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); + if (firstNonExternalModuleSourceFile) { + var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + } + } + else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { + var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher)); @@ -24354,10 +24661,6 @@ var ts; name: "charset", type: "string" }, - { - name: "codepage", - type: "number" - }, { name: "declaration", shortName: "d", @@ -24423,10 +24726,6 @@ var ts; name: "noLib", type: "boolean" }, - { - name: "noLibCheck", - type: "boolean" - }, { name: "noResolve", type: "boolean" @@ -24462,6 +24761,10 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "separateCompilation", + type: "boolean" + }, { name: "sourceMap", type: "boolean", @@ -24485,18 +24788,6 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, - { - name: "preserveNewLines", - type: "boolean", - description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, - experimental: true - }, - { - name: "cacheDownlevelForOfLength", - type: "boolean", - description: "Cache length access when downlevel emitting for-of statements", - experimental: true - }, { name: "target", shortName: "t", @@ -24739,23 +25030,23 @@ var ts; return; } switch (n.kind) { - case 176: + case 179: if (!ts.isFunctionBlock(n)) { var parent_6 = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent_6.kind === 181 || - parent_6.kind === 184 || - parent_6.kind === 185 || + if (parent_6.kind === 184 || + parent_6.kind === 187 || + parent_6.kind === 188 || + parent_6.kind === 186 || parent_6.kind === 183 || - parent_6.kind === 180 || - parent_6.kind === 182 || - parent_6.kind === 189 || - parent_6.kind === 220) { + parent_6.kind === 185 || + parent_6.kind === 192 || + parent_6.kind === 223) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_6.kind === 193) { + if (parent_6.kind === 196) { var tryStatement = parent_6; if (tryStatement.tryBlock === n) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); @@ -24778,17 +25069,17 @@ var ts; }); break; } - case 203: { + case 206: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 198: - case 199: case 201: + case 202: + case 204: case 154: - case 204: { + case 207: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -24820,7 +25111,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -24852,7 +25143,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -24933,7 +25224,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < bestMatchKind) { @@ -24980,14 +25271,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 202: + case 205: do { current = current.parent; - } while (current.kind === 202); - case 198: + } while (current.kind === 205); case 201: - case 199: - case 197: + case 204: + case 202: + case 200: indent++; } current = current.parent; @@ -24998,26 +25289,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 177: + case 180: ts.forEach(node.declarationList.declarations, visit); break; case 150: case 151: ts.forEach(node.elements, visit); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { childNodes.push(importClause.namedBindings); } else { @@ -25027,19 +25318,19 @@ var ts; } break; case 152: - case 195: + case 198: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 198: case 201: - case 199: + case 204: case 202: - case 197: case 205: - case 210: - case 214: + case 200: + case 208: + case 213: + case 217: childNodes.push(node); break; } @@ -25071,20 +25362,20 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 198: case 201: - case 199: + case 204: + case 202: topLevelNodes.push(node); break; - case 202: + case 205: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 197: + case 200: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -25095,9 +25386,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 197) { - if (functionDeclaration.body && functionDeclaration.body.kind === 176) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 197 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 200) { + if (functionDeclaration.body && functionDeclaration.body.kind === 179) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 200 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -25110,7 +25401,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; var item_3 = createItem(child); if (item_3 !== undefined) { @@ -25135,9 +25426,9 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems, _n = _a.length; _i < _n; _i++) { + outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { var sourceChild = _a[_i]; - for (var _b = 0, _c = target.childItems, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); @@ -25167,7 +25458,7 @@ var ts; return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); case 140: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 223: + case 226: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); case 138: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); @@ -25176,16 +25467,16 @@ var ts; case 132: case 131: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 197: + case 200: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 195: + case 198: case 152: var variableDeclarationNode; var name_18; if (node.kind === 152) { name_18 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 195) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 198) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -25206,11 +25497,11 @@ var ts; } case 135: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 214: - case 210: - case 205: - case 207: + case 217: + case 213: case 208: + case 210: + case 211: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -25240,17 +25531,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 224: + case 227: return createSourceFileItem(node); - case 198: - return createClassItem(node); case 201: + return createClassItem(node); + case 204: return createEnumItem(node); - case 199: - return createIterfaceItem(node); case 202: + return createIterfaceItem(node); + case 205: return createModuleItem(node); - case 197: + case 200: return createFunctionItem(node); } return undefined; @@ -25260,7 +25551,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 202) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 205) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -25272,7 +25563,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if ((node.name || node.flags & 256) && node.body && node.body.kind === 176) { + if ((node.name || node.flags & 256) && node.body && node.body.kind === 179) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem((!node.name && node.flags & 256) ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -25320,13 +25611,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 202) { + while (node.body.kind === 205) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 224 + return node.kind === 227 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -25418,7 +25709,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0, _n = wordSpans.length; _i < _n; _i++) { + for (var _i = 0; _i < wordSpans.length; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -25471,7 +25762,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0, _n = subWordTextChunks.length; _i < _n; _i++) { + for (var _i = 0; _i < subWordTextChunks.length; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -25862,7 +26153,7 @@ var ts; var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 175 && node.parent.parent.parent.kind === 159) { + else if (node.parent.kind === 176 && node.parent.parent.parent.kind === 159) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; @@ -25879,7 +26170,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0, _n = listChildren.length; _i < _n; _i++) { + for (var _i = 0; _i < listChildren.length; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -25939,7 +26230,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 224; n = n.parent) { + for (var n = node; n.kind !== 227; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -26120,17 +26411,17 @@ var ts; return false; } switch (n.kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 154: case 150: case 145: - case 176: - case 203: - case 204: + case 179: + case 206: + case 207: return nodeEndsWith(n, 15, sourceFile); - case 220: + case 223: return isCompletedNode(n.block, sourceFile); case 158: if (!n.arguments) { @@ -26146,7 +26437,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 134: case 133: @@ -26160,14 +26451,14 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 17, sourceFile); - case 202: + case 205: return n.body && isCompletedNode(n.body, sourceFile); - case 180: + case 183: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 179: + case 182: return isCompletedNode(n.expression, sourceFile); case 153: case 151: @@ -26180,15 +26471,15 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19, sourceFile); - case 217: - case 218: + case 220: + case 221: return false; - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: return isCompletedNode(n.statement, sourceFile); - case 181: + case 184: var hasWhileKeyword = findChildOfKind(n, 100, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 17, sourceFile); @@ -26208,7 +26499,7 @@ var ts; case 171: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 175: + case 176: return ts.nodeIsPresent(n.literal); case 167: return isCompletedNode(n.operand, sourceFile); @@ -26257,7 +26548,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 225 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 228 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -26322,7 +26613,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); @@ -26363,7 +26654,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 224); + ts.Debug.assert(startNode !== undefined || n.kind === 227); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -26403,7 +26694,7 @@ var ts; if (node.kind === 141 || node.kind === 157) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 198 || node.kind === 199) { + if (ts.isFunctionLike(node) || node.kind === 201 || node.kind === 202) { return node.typeParameters; } return undefined; @@ -27145,7 +27436,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -27329,7 +27620,7 @@ var ts; throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 183; + return context.contextNode.kind === 186; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); @@ -27339,16 +27630,16 @@ var ts; case 169: case 170: return true; - case 205: - case 195: + case 208: + case 198: case 129: - case 223: + case 226: case 132: case 131: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; - case 184: + case 187: return context.currentTokenSpan.kind === 86 || context.nextTokenSpan.kind === 86; - case 185: + case 188: return context.currentTokenSpan.kind === 125 || context.nextTokenSpan.kind === 125; case 152: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; @@ -27400,17 +27691,17 @@ var ts; return true; } switch (node.kind) { - case 176: - case 204: + case 179: + case 207: case 154: - case 203: + case 206: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 197: + case 200: case 134: case 133: case 136: @@ -27419,7 +27710,7 @@ var ts; case 162: case 135: case 163: - case 199: + case 202: return true; } return false; @@ -27429,40 +27720,40 @@ var ts; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 198: - case 199: case 201: - case 145: case 202: + case 204: + case 145: + case 205: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 198: - case 202: case 201: - case 176: - case 220: - case 203: - case 190: + case 205: + case 204: + case 179: + case 223: + case 206: + case 193: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 180: - case 190: case 183: - case 184: - case 185: - case 182: case 193: - case 181: - case 189: - case 220: + case 186: + case 187: + case 188: + case 185: + case 196: + case 184: + case 192: + case 223: return true; default: return false; @@ -27487,14 +27778,14 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 196 && + return context.currentTokenParent.kind === 199 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 202; + return context.contextNode.kind === 205; }; Rules.IsObjectTypeContext = function (context) { return context.contextNode.kind === 145; @@ -27505,9 +27796,9 @@ var ts; } switch (parent.kind) { case 141: - case 198: - case 199: - case 197: + case 201: + case 202: + case 200: case 162: case 163: case 134: @@ -27598,7 +27889,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(), _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -28016,17 +28307,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 198: - case 199: - return ts.rangeContainsRange(parent.members, node); + case 201: case 202: + return ts.rangeContainsRange(parent.members, node); + case 205: var body = parent.body; - return body && body.kind === 176 && ts.rangeContainsRange(body.statements, node); - case 224: - case 176: - case 203: + return body && body.kind === 179 && ts.rangeContainsRange(body.statements, node); + case 227: + case 179: + case 206: return ts.rangeContainsRange(parent.statements, node); - case 220: + case 223: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -28145,9 +28436,9 @@ var ts; if (indentation === -1) { if (isSomeBlock(node.kind)) { if (isSomeBlock(parent.kind) || - parent.kind === 224 || - parent.kind === 217 || - parent.kind === 218) { + parent.kind === 227 || + parent.kind === 220 || + parent.kind === 221) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -28178,10 +28469,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 198: return 69; - case 199: return 104; - case 197: return 83; - case 201: return 201; + case 201: return 69; + case 202: return 104; + case 200: return 83; + case 204: return 204; case 136: return 116; case 137: return 120; case 134: @@ -28320,7 +28611,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, true); } @@ -28365,7 +28656,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -28400,7 +28691,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0, _n = trivia.length; _i < _n; _i++) { + for (var _i = 0; _i < trivia.length; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -28580,8 +28871,8 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 176: - case 203: + case 179: + case 206: return true; } return false; @@ -28589,7 +28880,7 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 135: - case 197: + case 200: case 162: case 134: case 133: @@ -28796,7 +29087,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 224 || !parentAndChildShareLine); + (parent.kind === 227 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -28820,7 +29111,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 180 && parent.elseStatement === child) { + if (parent.kind === 183 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 76, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -28842,7 +29133,7 @@ var ts; return node.parent.properties; case 153: return node.parent.elements; - case 197: + case 200: case 162: case 163: case 134: @@ -28929,25 +29220,25 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 153: - case 176: - case 203: + case 179: + case 206: case 154: case 145: case 147: - case 204: - case 218: - case 217: + case 207: + case 221: + case 220: case 161: case 157: case 158: - case 177: - case 195: - case 211: - case 188: + case 180: + case 198: + case 214: + case 191: case 170: case 151: case 150: @@ -28960,13 +29251,13 @@ var ts; return true; } switch (parent) { - case 181: - case 182: case 184: case 185: + case 187: + case 188: + case 186: case 183: - case 180: - case 197: + case 200: case 162: case 134: case 133: @@ -28975,7 +29266,7 @@ var ts; case 135: case 136: case 137: - return child !== 176; + return child !== 179; default: return false; } @@ -29077,10 +29368,10 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(225, nodes.pos, nodes.end, 1024, this); + var list = createNode(228, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -29139,7 +29430,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (child.kind < 126) { return child; @@ -29205,13 +29496,13 @@ var ts; } }); } - if (declaration.kind === 202 && declaration.body.kind === 202) { + if (declaration.kind === 205 && declaration.body.kind === 205) { return; } - while (declaration.kind === 202 && declaration.parent.kind === 202) { + while (declaration.kind === 205 && declaration.parent.kind === 205) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 195 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 198 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -29496,7 +29787,7 @@ var ts; var namedDeclarations = []; ts.forEachChild(sourceFile, function visit(node) { switch (node.kind) { - case 197: + case 200: case 134: case 133: var functionDeclaration = node; @@ -29515,17 +29806,17 @@ var ts; ts.forEachChild(node, visit); } break; - case 198: - case 199: - case 200: case 201: case 202: + case 203: + case 204: case 205: - case 214: - case 210: - case 205: - case 207: case 208: + case 217: + case 213: + case 208: + case 210: + case 211: case 136: case 137: case 145: @@ -29533,14 +29824,14 @@ var ts; namedDeclarations.push(node); } case 135: - case 177: - case 196: + case 180: + case 199: case 150: case 151: - case 203: + case 206: ts.forEachChild(node, visit); break; - case 176: + case 179: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } @@ -29549,30 +29840,30 @@ var ts; if (!(node.flags & 112)) { break; } - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 223: + case 226: case 132: case 131: namedDeclarations.push(node); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { namedDeclarations.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { namedDeclarations.push(importClause.namedBindings); } else { @@ -29730,11 +30021,11 @@ var ts; if (declaration.kind === 162) { return true; } - if (declaration.kind !== 195 && declaration.kind !== 197) { + if (declaration.kind !== 198 && declaration.kind !== 200) { return false; } for (var parent_7 = declaration.parent; !ts.isFunctionBlock(parent_7); parent_7 = parent_7.parent) { - if (parent_7.kind === 224 || parent_7.kind === 203) { + if (parent_7.kind === 227 || parent_7.kind === 206) { return false; } } @@ -29775,7 +30066,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -29859,6 +30150,37 @@ var ts; sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; } + function transpile(input, compilerOptions, fileName, diagnostics) { + var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions(); + options.separateCompilation = true; + options.allowNonTsExtensions = true; + var inputFileName = fileName || "module.ts"; + var sourceFile = ts.createSourceFile(inputFileName, input, options.target); + if (diagnostics && sourceFile.parseDiagnostics) { + diagnostics.push.apply(diagnostics, sourceFile.parseDiagnostics); + } + var outputText; + var compilerHost = { + getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, + writeFile: function (name, text, writeByteOrderMark) { + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + outputText = text; + }, + getDefaultLibFileName: function () { return "lib.d.ts"; }, + useCaseSensitiveFileNames: function () { return false; }, + getCanonicalFileName: function (fileName) { return fileName; }, + getCurrentDirectory: function () { return ""; }, + getNewLine: function () { return "\r\n"; } + }; + var program = ts.createProgram([inputFileName], options, compilerHost); + if (diagnostics) { + diagnostics.push.apply(diagnostics, program.getGlobalDiagnostics()); + } + program.emit(); + ts.Debug.assert(outputText !== undefined, "Output generation failed"); + return outputText; + } + ts.transpile = transpile; function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { var sourceFile = ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); setSourceFileFields(sourceFile, scriptSnapshot, version); @@ -30100,7 +30422,7 @@ var ts; ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 191 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 194 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -30109,16 +30431,16 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 65 && - (node.parent.kind === 187 || node.parent.kind === 186) && + (node.parent.kind === 190 || node.parent.kind === 189) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 65 && - node.parent.kind === 191 && + node.parent.kind === 194 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 191; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 194; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -30147,7 +30469,7 @@ var ts; return node && node.parent && node.parent.kind === 158 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 202 && node.parent.name === node; + return node.parent.kind === 205 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 65 && @@ -30155,20 +30477,20 @@ var ts; } function isNameOfPropertyAssignment(node) { return (node.kind === 65 || node.kind === 8 || node.kind === 7) && - (node.parent.kind === 221 || node.parent.kind === 222) && node.parent.name === node; + (node.parent.kind === 224 || node.parent.kind === 225) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { case 132: case 131: - case 221: - case 223: + case 224: + case 226: case 134: case 133: case 136: case 137: - case 202: + case 205: return node.parent.name === node; case 156: return node.parent.argumentExpression === node; @@ -30237,17 +30559,17 @@ var ts; return undefined; } switch (node.kind) { - case 224: + case 227: case 134: case 133: - case 197: + case 200: case 162: case 136: case 137: - case 198: - case 199: case 201: case 202: + case 204: + case 205: return node; } } @@ -30255,18 +30577,18 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 202: return ScriptElementKind.moduleElement; - case 198: return ScriptElementKind.classElement; - case 199: return ScriptElementKind.interfaceElement; - case 200: return ScriptElementKind.typeElement; - case 201: return ScriptElementKind.enumElement; - case 195: + case 205: return ScriptElementKind.moduleElement; + case 201: return ScriptElementKind.classElement; + case 202: return ScriptElementKind.interfaceElement; + case 203: return ScriptElementKind.typeElement; + case 204: return ScriptElementKind.enumElement; + case 198: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 197: return ScriptElementKind.functionElement; + case 200: return ScriptElementKind.functionElement; case 136: return ScriptElementKind.memberGetAccessorElement; case 137: return ScriptElementKind.memberSetAccessorElement; case 134: @@ -30280,13 +30602,13 @@ var ts; case 138: return ScriptElementKind.callSignatureElement; case 135: return ScriptElementKind.constructorImplementationElement; case 128: return ScriptElementKind.typeParameterElement; - case 223: return ScriptElementKind.variableElement; + case 226: return ScriptElementKind.variableElement; case 129: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 205: - case 210: - case 207: - case 214: case 208: + case 213: + case 210: + case 217: + case 211: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -30346,7 +30668,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0, _n = oldSourceFiles.length; _i < _n; _i++) { + for (var _i = 0; _i < oldSourceFiles.length; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -30381,7 +30703,7 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; if (!sourceFileUpToDate(program.getSourceFile(fileName))) { return false; @@ -30429,6 +30751,12 @@ var ts; if (!displayName) { return undefined; } + if (displayName === "default") { + var localSymbol = ts.getLocalSymbolForExportDefault(symbol); + if (localSymbol && localSymbol.name) { + displayName = symbol.valueDeclaration.localSymbol.name; + } + } var firstCharCode = displayName.charCodeAt(0); if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; @@ -30545,11 +30873,11 @@ var ts; symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); } } - else if (ts.getAncestor(contextToken, 207)) { + else if (ts.getAncestor(contextToken, 210)) { isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(contextToken)) { - var importDeclaration = ts.getAncestor(contextToken, 206); + var importDeclaration = ts.getAncestor(contextToken, 209); ts.Debug.assert(importDeclaration !== undefined); var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); symbols = filterModuleExports(exports, importDeclaration); @@ -30564,7 +30892,7 @@ var ts; var adjustedPosition = previousToken !== contextToken ? previousToken.getStart() : position; - var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile); + var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; var symbolMeanings = 793056 | 107455 | 1536 | 8388608; symbols = typeInfoResolver.getSymbolsInScope(scopeNode, symbolMeanings); } @@ -30589,7 +30917,7 @@ var ts; function showCompletionsInImportsClause(node) { if (node) { if (node.kind === 14 || node.kind === 23) { - return node.parent.kind === 209; + return node.parent.kind === 212; } } return false; @@ -30614,16 +30942,16 @@ var ts; case 117: return true; case 20: - return containingNodeKind === 202; + return containingNodeKind === 205; case 14: - return containingNodeKind === 198; + return containingNodeKind === 201; case 53: - return containingNodeKind === 195 + return containingNodeKind === 198 || containingNodeKind === 169; case 11: return containingNodeKind === 171; case 12: - return containingNodeKind === 175; + return containingNodeKind === 176; case 109: case 107: case 108: @@ -30672,7 +31000,7 @@ var ts; switch (kind) { case 162: case 163: - case 197: + case 200: case 134: case 133: case 136: @@ -30689,14 +31017,14 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 195 || - containingNodeKind === 196 || - containingNodeKind === 177 || - containingNodeKind === 201 || - isFunction(containingNodeKind) || - containingNodeKind === 198 || - containingNodeKind === 197 || + return containingNodeKind === 198 || containingNodeKind === 199 || + containingNodeKind === 180 || + containingNodeKind === 204 || + isFunction(containingNodeKind) || + containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || containingNodeKind === 151 || containingNodeKind === 150; case 20: @@ -30704,21 +31032,21 @@ var ts; case 18: return containingNodeKind === 151; case 16: - return containingNodeKind === 220 || + return containingNodeKind === 223 || isFunction(containingNodeKind); case 14: - return containingNodeKind === 201 || - containingNodeKind === 199 || + return containingNodeKind === 204 || + containingNodeKind === 202 || containingNodeKind === 145 || containingNodeKind === 150; case 22: return containingNodeKind === 131 && - (previousToken.parent.parent.kind === 199 || + (previousToken.parent.parent.kind === 202 || previousToken.parent.parent.kind === 145); case 24: - return containingNodeKind === 198 || - containingNodeKind === 197 || - containingNodeKind === 199 || + return containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || isFunction(containingNodeKind); case 110: return containingNodeKind === 132; @@ -30771,7 +31099,7 @@ var ts; return exports; } if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 209) { + importDeclaration.importClause.namedBindings.kind === 212) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -30788,7 +31116,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 221 && m.kind !== 222) { + if (m.kind !== 224 && m.kind !== 225) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -30824,7 +31152,7 @@ var ts; var start = new Date().getTime(); var entries = []; var nameToSymbol = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; var entry = createCompletionEntry(symbol, typeInfoResolver, location); if (entry) { @@ -31139,7 +31467,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 223) { + if (declaration.kind === 226) { var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -31155,7 +31483,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 205) { + if (declaration.kind === 208) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -31354,7 +31682,7 @@ var ts; symbol = typeInfoResolver.getAliasedSymbol(symbol); } } - if (node.parent.kind === 222) { + if (node.parent.kind === 225) { var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -31382,7 +31710,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 114) { if (symbol.flags & 32) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 198); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 201); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -31399,7 +31727,7 @@ var ts; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 135) || - (!selectConstructors && (d.kind === 197 || d.kind === 134 || d.kind === 133))) { + (!selectConstructors && (d.kind === 200 || d.kind === 134 || d.kind === 133))) { declarations.push(d); if (d.body) definition = d; @@ -31417,6 +31745,17 @@ var ts; } } function getOccurrencesAtPosition(fileName, position) { + var results = getOccurrencesAtPositionCore(fileName, position); + if (results) { + var sourceFile = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results.forEach(function (value) { + var targetFile = getCanonicalFileName(ts.normalizeSlashes(value.fileName)); + ts.Debug.assert(sourceFile == targetFile, "Unexpected file in results. Found results in " + targetFile + " expected only results in " + sourceFile + "."); + }); + } + return results; + } + function getOccurrencesAtPositionCore(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingWord(sourceFile, position); @@ -31430,58 +31769,58 @@ var ts; switch (node.kind) { case 84: case 76: - if (hasKind(node.parent, 180)) { + if (hasKind(node.parent, 183)) { return getIfElseOccurrences(node.parent); } break; case 90: - if (hasKind(node.parent, 188)) { + if (hasKind(node.parent, 191)) { return getReturnOccurrences(node.parent); } break; case 94: - if (hasKind(node.parent, 192)) { + if (hasKind(node.parent, 195)) { return getThrowOccurrences(node.parent); } break; case 68: - if (hasKind(parent(parent(node)), 193)) { + if (hasKind(parent(parent(node)), 196)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 96: case 81: - if (hasKind(parent(node), 193)) { + if (hasKind(parent(node), 196)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 92: - if (hasKind(node.parent, 190)) { + if (hasKind(node.parent, 193)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 67: case 73: - if (hasKind(parent(parent(parent(node))), 190)) { + if (hasKind(parent(parent(parent(node))), 193)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 66: case 71: - if (hasKind(node.parent, 187) || hasKind(node.parent, 186)) { + if (hasKind(node.parent, 190) || hasKind(node.parent, 189)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 82: - if (hasKind(node.parent, 183) || - hasKind(node.parent, 184) || - hasKind(node.parent, 185)) { + if (hasKind(node.parent, 186) || + hasKind(node.parent, 187) || + hasKind(node.parent, 188)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 100: case 75: - if (hasKind(node.parent, 182) || hasKind(node.parent, 181)) { + if (hasKind(node.parent, 185) || hasKind(node.parent, 184)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -31497,14 +31836,14 @@ var ts; } default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 177)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 180)) { return getModifierOccurrences(node.kind, node.parent); } } return undefined; function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 180) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 183) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -31515,7 +31854,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 180)) { + if (!hasKind(ifStatement.elseStatement, 183)) { break; } ifStatement = ifStatement.elseStatement; @@ -31548,7 +31887,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 176))) { + if (!(func && hasKind(func.body, 179))) { return undefined; } var keywords = []; @@ -31581,10 +31920,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 192) { + if (node.kind === 195) { statementAccumulator.push(node); } - else if (node.kind === 193) { + else if (node.kind === 196) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -31606,10 +31945,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent_9 = child.parent; - if (ts.isFunctionBlock(parent_9) || parent_9.kind === 224) { + if (ts.isFunctionBlock(parent_9) || parent_9.kind === 227) { return parent_9; } - if (parent_9.kind === 193) { + if (parent_9.kind === 196) { var tryStatement = parent_9; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -31634,7 +31973,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 82, 100, 75)) { - if (loopNode.kind === 181) { + if (loopNode.kind === 184) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 100)) { @@ -31669,13 +32008,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return getLoopBreakContinueOccurrences(owner); - case 190: + case 193: return getSwitchCaseDefaultOccurrences(owner); } } @@ -31686,7 +32025,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 187 || node.kind === 186) { + if (node.kind === 190 || node.kind === 189) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -31702,15 +32041,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { switch (node_1.kind) { - case 190: - if (statement.kind === 186) { + case 193: + if (statement.kind === 189) { continue; } - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: - case 181: + case 184: if (!statement.label || isLabeledBy(node_1, statement.label.text)) { return node_1; } @@ -31749,18 +32088,18 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 198 || + if (!(container.kind === 201 || (declaration.kind === 129 && hasKind(container, 135)))) { return undefined; } } else if (modifier === 110) { - if (container.kind !== 198) { + if (container.kind !== 201) { return undefined; } } else if (modifier === 78 || modifier === 115) { - if (!(container.kind === 203 || container.kind === 224)) { + if (!(container.kind === 206 || container.kind === 227)) { return undefined; } } @@ -31771,14 +32110,14 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 203: - case 224: + case 206: + case 227: nodes = container.statements; break; case 135: nodes = container.parameters.concat(container.parent.members); break; - case 198: + case 201: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { @@ -31840,7 +32179,7 @@ var ts; return undefined; } var referenceEntries = []; - for (var _i = 0, _n = referenceSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < referenceSymbols.length; _i++) { var referenceSymbol = referenceSymbols[_i]; ts.addRange(referenceEntries, referenceSymbol.references); } @@ -31943,12 +32282,12 @@ var ts; } function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 210 || location.parent.kind === 214) && + (location.parent.kind === 213 || location.parent.kind === 217) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 210 || declaration.kind === 214; + return declaration.kind === 213 || declaration.kind === 217; }); } function getDeclaredName(symbol, location) { @@ -31985,7 +32324,7 @@ var ts; if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 198); + return ts.getAncestor(privateDeclaration, 201); } } if (symbol.flags & 8388608) { @@ -31997,7 +32336,7 @@ var ts; var scope = undefined; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -32006,7 +32345,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 224 && !ts.isExternalModule(container)) { + if (container.kind === 227 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -32212,11 +32551,11 @@ var ts; staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 224: + case 227: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 197: + case 200: case 162: break; default: @@ -32224,7 +32563,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 224) { + if (searchSpaceNode.kind === 227) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -32256,7 +32595,7 @@ var ts; var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { case 162: - case 197: + case 200: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } @@ -32267,13 +32606,13 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; - case 198: + case 201: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 224: - if (container.kind === 224 && !ts.isExternalModule(container)) { + case 227: + if (container.kind === 227 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -32308,11 +32647,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 198) { - getPropertySymbolFromTypeReference(ts.getClassBaseTypeNode(declaration)); - ts.forEach(ts.getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); + if (declaration.kind === 201) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 199) { + else if (declaration.kind === 202) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -32395,7 +32734,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -32463,32 +32802,32 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: - case 220: + case 223: return 1; case 128: - case 199: - case 200: + case 202: + case 203: case 145: return 2; - case 198: case 201: + case 204: return 1 | 2; - case 202: + case 205: if (node.name.kind === 8) { return 4 | 1; } @@ -32498,31 +32837,51 @@ var ts; else { return 4; } - case 209: - case 210: - case 205: - case 206: - case 211: case 212: + case 213: + case 208: + case 209: + case 214: + case 215: return 1 | 2 | 4; - case 224: + case 227: return 4 | 1; } return 1 | 2 | 4; ts.Debug.fail("Unknown declaration type"); } function isTypeReference(node) { - if (isRightSideOfQualifiedName(node)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 141; + return node.parent.kind === 141 || node.parent.kind === 177; } function isNamespaceReference(node) { + return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); + } + function isPropertyAccessNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 155) { + while (root.parent && root.parent.kind === 155) { + root = root.parent; + } + isLastClause = root.name === node; + } + if (!isLastClause && root.parent.kind === 177 && root.parent.parent.kind === 222) { + var decl = root.parent.parent.parent; + return (decl.kind === 201 && root.parent.parent.token === 103) || + (decl.kind === 202 && root.parent.parent.token === 79); + } + return false; + } + function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; if (root.parent.kind === 126) { - while (root.parent && root.parent.kind === 126) + while (root.parent && root.parent.kind === 126) { root = root.parent; + } isLastClause = root.right === node; } return root.parent.kind === 141 && !isLastClause; @@ -32537,13 +32896,13 @@ var ts; ts.Debug.assert(node.kind === 65); if (node.parent.kind === 126 && node.parent.right === node && - node.parent.parent.kind === 205) { + node.parent.parent.kind === 208) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 211) { + if (node.parent.kind === 214) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -32596,7 +32955,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 202 && + if (nodeForStartPos.parent.parent.kind === 205 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -32652,7 +33011,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 202 && ts.getModuleInstanceState(declaration) == 1; + return declaration.kind === 205 && ts.getModuleInstanceState(declaration) == 1; }); } } @@ -32770,7 +33129,7 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 53) { - if (token.parent.kind === 195 || + if (token.parent.kind === 198 || token.parent.kind === 132 || token.parent.kind === 129) { return ClassificationTypeNames.operator; @@ -32800,7 +33159,7 @@ var ts; else if (tokenKind === 65) { if (token) { switch (token.parent.kind) { - case 198: + case 201: if (token.parent.name === token) { return ClassificationTypeNames.className; } @@ -32810,17 +33169,17 @@ var ts; return ClassificationTypeNames.typeParameterName; } return; - case 199: + case 202: if (token.parent.name === token) { return ClassificationTypeNames.interfaceName; } return; - case 201: + case 204: if (token.parent.name === token) { return ClassificationTypeNames.enumName; } return; - case 202: + case 205: if (token.parent.name === token) { return ClassificationTypeNames.moduleName; } @@ -32833,7 +33192,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -32858,7 +33217,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0, _n = childNodes.length; _i < _n; _i++) { + for (var _i = 0; _i < childNodes.length; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -32991,7 +33350,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var sourceFile_1 = current.getSourceFile(); if (sourceFile_1 && getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { @@ -33081,7 +33440,7 @@ var ts; case 8: case 7: if (ts.isDeclarationName(node) || - node.parent.kind === 216 || + node.parent.kind === 219 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -33382,7 +33741,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 224 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 227 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -33439,10 +33798,10 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } - if (node.parent.kind === 183) { + if (node.parent.kind === 186) { return textSpan(node); } if (node.parent.kind === 169 && node.parent.operatorToken.kind === 23) { @@ -33453,15 +33812,15 @@ var ts; } } switch (node.kind) { - case 177: + case 180: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 195: + case 198: case 132: case 131: return spanInVariableDeclaration(node); case 129: return spanInParameterDeclaration(node); - case 197: + case 200: case 134: case 133: case 136: @@ -33470,70 +33829,70 @@ var ts; case 162: case 163: return spanInFunctionDeclaration(node); - case 176: + case 179: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 203: + case 206: return spanInBlock(node); - case 220: + case 223: return spanInBlock(node.block); - case 179: - return textSpan(node.expression); - case 188: - return textSpan(node.getChildAt(0), node.expression); case 182: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 181: - return spanInNode(node.statement); - case 194: - return textSpan(node.getChildAt(0)); - case 180: - return textSpan(node, ts.findNextToken(node.expression, node)); + return textSpan(node.expression); case 191: - return spanInNode(node.statement); - case 187: - case 186: - return textSpan(node.getChildAt(0), node.label); - case 183: - return spanInForStatement(node); - case 184: + return textSpan(node.getChildAt(0), node.expression); case 185: return textSpan(node, ts.findNextToken(node.expression, node)); - case 190: + case 184: + return spanInNode(node.statement); + case 197: + return textSpan(node.getChildAt(0)); + case 183: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 194: + return spanInNode(node.statement); + case 190: + case 189: + return textSpan(node.getChildAt(0), node.label); + case 186: + return spanInForStatement(node); + case 187: + case 188: return textSpan(node, ts.findNextToken(node.expression, node)); - case 217: - case 218: - return spanInNode(node.statements[0]); case 193: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 220: + case 221: + return spanInNode(node.statements[0]); + case 196: return spanInBlock(node.tryBlock); - case 192: + case 195: return textSpan(node, node.expression); - case 211: + case 214: if (!node.expression) { return undefined; } return textSpan(node, node.expression); - case 205: + case 208: return textSpan(node, node.moduleReference); - case 206: + case 209: return textSpan(node, node.moduleSpecifier); - case 212: + case 215: return textSpan(node, node.moduleSpecifier); - case 202: + case 205: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 198: case 201: - case 223: + case 204: + case 226: case 157: case 158: return textSpan(node); - case 189: + case 192: return spanInNode(node.statement); - case 199: - case 200: + case 202: + case 203: return undefined; case 22: case 1: @@ -33560,7 +33919,7 @@ var ts; case 81: return spanInNextNode(node); default: - if (node.parent.kind === 221 && node.parent.name === node) { + if (node.parent.kind === 224 && node.parent.name === node) { return spanInNode(node.parent.initializer); } if (node.parent.kind === 160 && node.parent.type === node) { @@ -33573,12 +33932,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 184 || - variableDeclaration.parent.parent.kind === 185) { + if (variableDeclaration.parent.parent.kind === 187 || + variableDeclaration.parent.parent.kind === 188) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 177; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 183 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 180; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 186 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -33624,7 +33983,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 198 && functionDeclaration.kind !== 135); + (functionDeclaration.parent.kind === 201 && functionDeclaration.kind !== 135); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -33644,23 +34003,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 202: + case 205: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 182: - case 180: - case 184: case 185: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 183: + case 187: + case 188: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 186: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 196) { + if (forStatement.initializer.kind === 199) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -33679,34 +34038,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 201: + case 204: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 198: + case 201: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 204: + case 207: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 203: + case 206: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } + case 204: case 201: - case 198: return textSpan(node); - case 176: + case 179: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 220: + case 223: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 204: + case 207: var caseBlock = node.parent; var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { @@ -33718,7 +34077,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -33726,16 +34085,16 @@ var ts; function spanInCloseParenToken(node) { switch (node.parent.kind) { case 162: - case 197: + case 200: case 163: case 134: case 133: case 136: case 137: case 135: - case 182: - case 181: - case 183: + case 185: + case 184: + case 186: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -33743,7 +34102,7 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 221) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 224) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -33755,7 +34114,7 @@ var ts; return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index 6046a83da13..972a63a67bf 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -196,59 +196,62 @@ declare module ts { TemplateExpression = 171, YieldExpression = 172, SpreadElementExpression = 173, - OmittedExpression = 174, - TemplateSpan = 175, - Block = 176, - VariableStatement = 177, - EmptyStatement = 178, - ExpressionStatement = 179, - IfStatement = 180, - DoStatement = 181, - WhileStatement = 182, - ForStatement = 183, - ForInStatement = 184, - ForOfStatement = 185, - ContinueStatement = 186, - BreakStatement = 187, - ReturnStatement = 188, - WithStatement = 189, - SwitchStatement = 190, - LabeledStatement = 191, - ThrowStatement = 192, - TryStatement = 193, - DebuggerStatement = 194, - VariableDeclaration = 195, - VariableDeclarationList = 196, - FunctionDeclaration = 197, - ClassDeclaration = 198, - InterfaceDeclaration = 199, - TypeAliasDeclaration = 200, - EnumDeclaration = 201, - ModuleDeclaration = 202, - ModuleBlock = 203, - CaseBlock = 204, - ImportEqualsDeclaration = 205, - ImportDeclaration = 206, - ImportClause = 207, - NamespaceImport = 208, - NamedImports = 209, - ImportSpecifier = 210, - ExportAssignment = 211, - ExportDeclaration = 212, - NamedExports = 213, - ExportSpecifier = 214, - MissingDeclaration = 215, - ExternalModuleReference = 216, - CaseClause = 217, - DefaultClause = 218, - HeritageClause = 219, - CatchClause = 220, - PropertyAssignment = 221, - ShorthandPropertyAssignment = 222, - EnumMember = 223, - SourceFile = 224, - SyntaxList = 225, - Count = 226, + ClassExpression = 174, + OmittedExpression = 175, + TemplateSpan = 176, + HeritageClauseElement = 177, + SemicolonClassElement = 178, + Block = 179, + VariableStatement = 180, + EmptyStatement = 181, + ExpressionStatement = 182, + IfStatement = 183, + DoStatement = 184, + WhileStatement = 185, + ForStatement = 186, + ForInStatement = 187, + ForOfStatement = 188, + ContinueStatement = 189, + BreakStatement = 190, + ReturnStatement = 191, + WithStatement = 192, + SwitchStatement = 193, + LabeledStatement = 194, + ThrowStatement = 195, + TryStatement = 196, + DebuggerStatement = 197, + VariableDeclaration = 198, + VariableDeclarationList = 199, + FunctionDeclaration = 200, + ClassDeclaration = 201, + InterfaceDeclaration = 202, + TypeAliasDeclaration = 203, + EnumDeclaration = 204, + ModuleDeclaration = 205, + ModuleBlock = 206, + CaseBlock = 207, + ImportEqualsDeclaration = 208, + ImportDeclaration = 209, + ImportClause = 210, + NamespaceImport = 211, + NamedImports = 212, + ImportSpecifier = 213, + ExportAssignment = 214, + ExportDeclaration = 215, + NamedExports = 216, + ExportSpecifier = 217, + MissingDeclaration = 218, + ExternalModuleReference = 219, + CaseClause = 220, + DefaultClause = 221, + HeritageClause = 222, + CatchClause = 223, + PropertyAssignment = 224, + ShorthandPropertyAssignment = 225, + EnumMember = 226, + SourceFile = 227, + SyntaxList = 228, + Count = 229, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -432,6 +435,9 @@ declare module ts { interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { body?: Block; } + interface SemicolonClassElement extends ClassElement { + _semicolonClassElementBrand: any; + } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; body: Block; @@ -570,6 +576,10 @@ declare module ts { typeArguments?: NodeArray; arguments: NodeArray; } + interface HeritageClauseElement extends Node { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + } interface NewExpression extends CallExpression, PrimaryExpression { } interface TaggedTemplateExpression extends MemberExpression { @@ -664,12 +674,16 @@ declare module ts { interface ModuleElement extends Node { _moduleElementBrand: any; } - interface ClassDeclaration extends Declaration, ModuleElement { + interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + } interface ClassElement extends Declaration { _classElementBrand: any; } @@ -681,7 +695,7 @@ declare module ts { } interface HeritageClause extends Node { token: SyntaxKind; - types?: NodeArray; + types?: NodeArray; } interface TypeAliasDeclaration extends Declaration, ModuleElement { name: Identifier; @@ -923,7 +937,7 @@ declare module ts { writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; @@ -1179,7 +1193,6 @@ declare module ts { interface CompilerOptions { allowNonTsExtensions?: boolean; charset?: string; - codepage?: number; declaration?: boolean; diagnostics?: boolean; emitBOM?: boolean; @@ -1193,7 +1206,6 @@ declare module ts { noErrorTruncation?: boolean; noImplicitAny?: boolean; noLib?: boolean; - noLibCheck?: boolean; noResolve?: boolean; out?: string; outDir?: string; @@ -1206,6 +1218,7 @@ declare module ts { target?: ScriptTarget; version?: boolean; watch?: boolean; + separateCompilation?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { @@ -1454,6 +1467,20 @@ declare module ts { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module ts { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module ts { /** The version of the language service API */ let servicesVersion: string; @@ -1947,6 +1974,7 @@ declare module ts { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 2a8a4725b29..0ea54239508 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -190,59 +190,62 @@ var ts; SyntaxKind[SyntaxKind["TemplateExpression"] = 171] = "TemplateExpression"; SyntaxKind[SyntaxKind["YieldExpression"] = 172] = "YieldExpression"; SyntaxKind[SyntaxKind["SpreadElementExpression"] = 173] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 174] = "OmittedExpression"; - SyntaxKind[SyntaxKind["TemplateSpan"] = 175] = "TemplateSpan"; - SyntaxKind[SyntaxKind["Block"] = 176] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 177] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 178] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 179] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 180] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 181] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 182] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 183] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 184] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 185] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 186] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 187] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 188] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 189] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 190] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 191] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 192] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 193] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 194] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 195] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 196] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 197] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 198] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 199] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 200] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 201] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 202] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 203] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 204] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 205] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 206] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 207] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 208] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 209] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 210] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 211] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 212] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 213] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 214] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 215] = "MissingDeclaration"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 216] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["CaseClause"] = 217] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 218] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 219] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 220] = "CatchClause"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 221] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 222] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 223] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 224] = "SourceFile"; - SyntaxKind[SyntaxKind["SyntaxList"] = 225] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 226] = "Count"; + SyntaxKind[SyntaxKind["ClassExpression"] = 174] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 175] = "OmittedExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 176] = "TemplateSpan"; + SyntaxKind[SyntaxKind["HeritageClauseElement"] = 177] = "HeritageClauseElement"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 178] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["Block"] = 179] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 180] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 181] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 182] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 183] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 184] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 185] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 186] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 187] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 188] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 189] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 190] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 191] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 192] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 193] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 194] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 195] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 196] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 197] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 198] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 199] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 200] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 201] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 202] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 203] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 204] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 205] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 206] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 207] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 208] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 209] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 210] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 211] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 212] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 213] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 214] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 215] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 216] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 217] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 218] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 219] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["CaseClause"] = 220] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 221] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 222] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 223] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 224] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 225] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 226] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 227] = "SourceFile"; + SyntaxKind[SyntaxKind["SyntaxList"] = 228] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 229] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 53] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 64] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 66] = "FirstReservedWord"; @@ -632,7 +635,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (v === value) { return true; @@ -656,7 +659,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -670,7 +673,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_1 = array[_i]; if (f(item_1)) { result.push(item_1); @@ -684,7 +687,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result.push(f(v)); } @@ -704,7 +707,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_2 = array[_i]; if (!contains(result, item_2)) { result.push(item_2); @@ -716,7 +719,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result += v[prop]; } @@ -725,7 +728,7 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0, _n = from.length; _i < _n; _i++) { + for (var _i = 0; _i < from.length; _i++) { var v = from[_i]; to.push(v); } @@ -1014,7 +1017,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _n = parts.length; _i < _n; _i++) { + for (var _i = 0; _i < parts.length; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -1159,7 +1162,7 @@ var ts; ts.fileExtensionIs = fileExtensionIs; var supportedExtensions = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { + for (var _i = 0; _i < supportedExtensions.length; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -1319,14 +1322,14 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var name_1 = files[_i]; if (!extension || ts.fileExtensionIs(name_1, extension)) { result.push(ts.combinePaths(path, name_1)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + for (var _a = 0; _a < subfolders.length; _a++) { var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } @@ -1413,7 +1416,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -1426,7 +1429,7 @@ var ts; directories.push(name); } } - for (var _a = 0, _b = directories.length; _a < _b; _a++) { + for (var _a = 0; _a < directories.length; _a++) { var current = directories[_a]; visitDirectory(current); } @@ -1664,6 +1667,8 @@ var ts; Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, + Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, + Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -1850,6 +1855,8 @@ var ts; The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1933,6 +1940,11 @@ var ts; Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, + Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { code: 5043, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." }, + Option_declaration_cannot_be_specified_with_option_separateCompilation: { code: 5044, category: ts.DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'separateCompilation'." }, + Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, + Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, + Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1996,7 +2008,10 @@ var ts; You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." }, yield_expressions_are_not_currently_supported: { code: 9000, category: ts.DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." } + Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "'class' expressions are not currently supported." }, + class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: ts.DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." } }; })(ts || (ts = {})); /// @@ -3242,16 +3257,16 @@ var ts; })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); var ModuleInstanceState = ts.ModuleInstanceState; function getModuleInstanceState(node) { - if (node.kind === 199 || node.kind === 200) { + if (node.kind === 202 || node.kind === 203) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 206 || node.kind === 205) && !(node.flags & 1)) { + else if ((node.kind === 209 || node.kind === 208) && !(node.flags & 1)) { return 0; } - else if (node.kind === 203) { + else if (node.kind === 206) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -3267,7 +3282,7 @@ var ts; }); return state; } - else if (node.kind === 202) { + else if (node.kind === 205) { return getModuleInstanceState(node.body); } else { @@ -3320,7 +3335,7 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 202 && node.name.kind === 8) { + if (node.kind === 205 && node.name.kind === 8) { return '"' + node.name.text + '"'; } if (node.name.kind === 127) { @@ -3341,12 +3356,12 @@ var ts; return "__new"; case 140: return "__index"; - case 212: + case 215: return "__export"; - case 211: + case 214: return node.isExportEquals ? "export=" : "default"; - case 197: - case 198: + case 200: + case 201: return node.flags & 256 ? "default" : undefined; } } @@ -3378,7 +3393,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 198 && symbol.exports) { + if ((node.kind === 201 || node.kind === 174) && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -3394,7 +3409,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 214 || (node.kind === 205 && hasExportModifier)) { + if (node.kind === 217 || (node.kind === 208 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -3431,7 +3446,7 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 224); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227); } ts.forEachChild(node, bind); container = saveContainer; @@ -3440,10 +3455,10 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 202: + case 205: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -3458,22 +3473,23 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 198: + case 174: + case 201: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } case 145: case 154: - case 199: + case 202: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 201: + case 204: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -3488,11 +3504,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 224 ? node : node.body; - if (body.kind === 224 || body.kind === 203) { - for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { + var body = node.kind === 227 ? node : node.body; + if (body.kind === 227 || body.kind === 206) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 212 || stat.kind === 211) { + if (stat.kind === 215 || stat.kind === 214) { return true; } } @@ -3554,10 +3570,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 202: + case 205: declareModuleMember(node, 2, 107455); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -3582,7 +3598,7 @@ var ts; case 129: bindParameter(node); break; - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); @@ -3598,11 +3614,11 @@ var ts; case 131: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 221: - case 222: + case 224: + case 225: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 223: + case 226: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 138: @@ -3614,7 +3630,7 @@ var ts; case 133: bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; - case 197: + case 200: bindDeclaration(node, 16, 106927, true); break; case 135: @@ -3640,19 +3656,22 @@ var ts; case 163: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 220: + case 174: + bindAnonymousDeclaration(node, 32, "__class", false); + break; + case 223: bindCatchVariableDeclaration(node); break; - case 198: + case 201: bindDeclaration(node, 32, 899583, false); break; - case 199: + case 202: bindDeclaration(node, 64, 792992, false); break; - case 200: + case 203: bindDeclaration(node, 524288, 793056, false); break; - case 201: + case 204: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -3660,16 +3679,16 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 202: + case 205: bindModuleDeclaration(node); break; - case 205: case 208: - case 210: - case 214: + case 211: + case 213: + case 217: bindDeclaration(node, 8388608, 8388608, false); break; - case 207: + case 210: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -3677,13 +3696,13 @@ var ts; bindChildren(node, 0, false); } break; - case 212: + case 215: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 211: + case 214: if (node.expression && node.expression.kind === 65) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } @@ -3692,20 +3711,20 @@ var ts; } bindChildren(node, 0, false); break; - case 224: + case 227: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 176: + case 179: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 220: - case 183: - case 184: - case 185: - case 204: + case 223: + case 186: + case 187: + case 188: + case 207: bindChildren(node, 0, true); break; default: @@ -3724,7 +3743,7 @@ var ts; } if (node.flags & 112 && node.parent.kind === 135 && - node.parent.parent.kind === 198) { + (node.parent.parent.kind === 201 || node.parent.parent.kind === 174)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -3744,7 +3763,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -3802,7 +3821,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 224) { + while (node && node.kind !== 227) { node = node.parent; } return node; @@ -3884,15 +3903,15 @@ var ts; return current; } switch (current.kind) { - case 224: - case 204: - case 220: - case 202: - case 183: - case 184: - case 185: + case 227: + case 207: + case 223: + case 205: + case 186: + case 187: + case 188: return current; - case 176: + case 179: if (!isFunctionLike(current.parent)) { return current; } @@ -3903,9 +3922,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 195 && + declaration.kind === 198 && declaration.parent && - declaration.parent.kind === 220; + declaration.parent.kind === 223; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3942,14 +3961,21 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 195: - case 152: + case 227: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + if (pos_1 === sourceFile.text.length) { + return createTextSpan(0, 0); + } + return getSpanOfTokenAtPosition(sourceFile, pos_1); case 198: - case 199: - case 202: + case 152: case 201: - case 223: - case 197: + case 174: + case 202: + case 205: + case 204: + case 226: + case 200: case 162: errorNode = node.name; break; @@ -3972,7 +3998,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 201 && isConst(node); + return node.kind === 204 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { @@ -3984,14 +4010,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 195) { + if (node.kind === 198) { node = node.parent; } - if (node && node.kind === 196) { + if (node && node.kind === 199) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 177) { + if (node && node.kind === 180) { flags |= node.flags; } return flags; @@ -4006,7 +4032,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 179 && node.expression.kind === 8; + return node.kind === 182 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -4032,23 +4058,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188: + case 191: return visitor(node); - case 204: - case 176: - case 180: - case 181: - case 182: + case 207: + case 179: case 183: case 184: case 185: - case 189: - case 190: - case 217: - case 218: - case 191: + case 186: + case 187: + case 188: + case 192: case 193: case 220: + case 221: + case 194: + case 196: + case 223: return ts.forEachChild(node, traverse); } } @@ -4058,13 +4084,13 @@ var ts; if (node) { switch (node.kind) { case 152: - case 223: + case 226: case 129: - case 221: + case 224: case 132: case 131: - case 222: - case 195: + case 225: + case 198: return true; } } @@ -4076,7 +4102,7 @@ var ts; switch (node.kind) { case 135: case 162: - case 197: + case 200: case 163: case 134: case 133: @@ -4089,7 +4115,7 @@ var ts; case 143: case 162: case 163: - case 197: + case 200: return true; } } @@ -4097,7 +4123,7 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 176 && isFunctionLike(node.parent); + return node && node.kind === 179 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -4121,7 +4147,7 @@ var ts; } switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; @@ -4130,9 +4156,9 @@ var ts; if (!includeArrowFunctions) { continue; } - case 197: + case 200: case 162: - case 202: + case 205: case 132: case 131: case 134: @@ -4140,8 +4166,8 @@ var ts; case 135: case 136: case 137: - case 201: - case 224: + case 204: + case 227: return node; } } @@ -4154,12 +4180,12 @@ var ts; return node; switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; break; - case 197: + case 200: case 162: case 163: if (!includeFunctions) { @@ -4186,23 +4212,23 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 198: + case 201: return true; case 132: - return node.parent.kind === 198; + return node.parent.kind === 201; case 129: - return node.parent.body && node.parent.parent.kind === 198; + return node.parent.body && node.parent.parent.kind === 201; case 136: case 137: case 134: - return node.body && node.parent.kind === 198; + return node.body && node.parent.kind === 201; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 198: + case 201: if (node.decorators) { return true; } @@ -4230,7 +4256,7 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 198: + case 201: return ts.forEach(node.members, nodeOrChildIsDecorated); case 134: case 137: @@ -4261,6 +4287,7 @@ var ts; case 160: case 161: case 162: + case 174: case 163: case 166: case 164: @@ -4272,7 +4299,7 @@ var ts; case 173: case 171: case 10: - case 174: + case 175: return true; case 126: while (node.parent.kind === 126) { @@ -4287,38 +4314,38 @@ var ts; case 8: var parent_1 = node.parent; switch (parent_1.kind) { - case 195: + case 198: case 129: case 132: case 131: - case 223: - case 221: + case 226: + case 224: case 152: return parent_1.initializer === node; - case 179: - case 180: - case 181: case 182: - case 188: - case 189: - case 190: - case 217: - case 192: - case 190: - return parent_1.expression === node; case 183: - var forStatement = parent_1; - return (forStatement.initializer === node && forStatement.initializer.kind !== 196) || - forStatement.condition === node || - forStatement.iterator === node; case 184: case 185: + case 191: + case 192: + case 193: + case 220: + case 195: + case 193: + return parent_1.expression === node; + case 186: + var forStatement = parent_1; + return (forStatement.initializer === node && forStatement.initializer.kind !== 199) || + forStatement.condition === node || + forStatement.iterator === node; + case 187: + case 188: var forInStatement = parent_1; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 196) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199) || forInStatement.expression === node; case 160: return node === parent_1.expression; - case 175: + case 176: return node === parent_1.expression; case 127: return node === parent_1.expression; @@ -4338,7 +4365,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind === 216; + return node.kind === 208 && node.moduleReference.kind === 219; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4347,20 +4374,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind !== 216; + return node.kind === 208 && node.moduleReference.kind !== 219; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 206) { + if (node.kind === 209) { return node.moduleSpecifier; } - if (node.kind === 205) { + if (node.kind === 208) { var reference = node.moduleReference; - if (reference.kind === 216) { + if (reference.kind === 219) { return reference.expression; } } - if (node.kind === 212) { + if (node.kind === 215) { return node.moduleSpecifier; } } @@ -4377,8 +4404,8 @@ var ts; case 134: case 133: return node.questionToken !== undefined; - case 222: - case 221: + case 225: + case 224: case 132: case 131: return node.questionToken !== undefined; @@ -4421,31 +4448,31 @@ var ts; switch (node.kind) { case 163: case 152: - case 198: - case 135: case 201: - case 223: - case 214: - case 197: + case 135: + case 204: + case 226: + case 217: + case 200: case 162: case 136: - case 207: - case 205: case 210: - case 199: + case 208: + case 213: + case 202: case 134: case 133: - case 202: - case 208: + case 205: + case 211: case 129: - case 221: + case 224: case 132: case 131: case 137: - case 222: - case 200: + case 225: + case 203: case 128: - case 195: + case 198: return true; } return false; @@ -4453,25 +4480,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 187: - case 186: - case 194: - case 181: - case 179: - case 178: - case 184: - case 185: - case 183: - case 180: - case 191: - case 188: case 190: - case 94: - case 193: - case 177: - case 182: case 189: - case 211: + case 197: + case 184: + case 182: + case 181: + case 187: + case 188: + case 186: + case 183: + case 194: + case 191: + case 193: + case 94: + case 196: + case 180: + case 185: + case 192: + case 214: return true; default: return false; @@ -4497,7 +4524,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 210 || parent.kind === 214) { + if (parent.kind === 213 || parent.kind === 217) { if (parent.propertyName) { return true; } @@ -4509,24 +4536,24 @@ var ts; } ts.isDeclarationName = isDeclarationName; function isAliasSymbolDeclaration(node) { - return node.kind === 205 || - node.kind === 207 && !!node.name || - node.kind === 208 || - node.kind === 210 || - node.kind === 214 || - node.kind === 211 && node.expression.kind === 65; + return node.kind === 208 || + node.kind === 210 && !!node.name || + node.kind === 211 || + node.kind === 213 || + node.kind === 217 || + node.kind === 214 && node.expression.kind === 65; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; - function getClassBaseTypeNode(node) { + function getClassExtendsHeritageClauseElement(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } - ts.getClassBaseTypeNode = getClassBaseTypeNode; - function getClassImplementedTypeNodes(node) { + ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; + function getClassImplementsHeritageClauseElements(node) { var heritageClause = getHeritageClause(node.heritageClauses, 103); return heritageClause ? heritageClause.types : undefined; } - ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause ? heritageClause.types : undefined; @@ -4534,7 +4561,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _n = clauses.length; _i < _n; _i++) { + for (var _i = 0; _i < clauses.length; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -4761,7 +4788,7 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 202 || n.kind === 224; + return isFunctionLike(n) || n.kind === 205 || n.kind === 227; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -5131,12 +5158,36 @@ var ts; } } ts.writeCommentRange = writeCommentRange; + function isSupportedHeritageClauseElement(node) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; + function isSupportedHeritageClauseElementExpression(node) { + if (node.kind === 65) { + return true; + } + else if (node.kind === 155) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + else { + return false; + } + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 126 && node.parent.right === node) || + (node.parent.kind === 155 && node.parent.name === node); + } + ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function getLocalSymbolForExportDefault(symbol) { + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256) ? symbol.valueDeclaration.localSymbol : undefined; + } + ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; })(ts || (ts = {})); /// /// var ts; (function (ts) { - var nodeConstructors = new Array(226); + var nodeConstructors = new Array(229); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -5158,7 +5209,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -5184,9 +5235,9 @@ var ts; case 129: case 132: case 131: - case 221: - case 222: - case 195: + case 224: + case 225: + case 198: case 152: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -5212,7 +5263,7 @@ var ts; case 136: case 137: case 162: - case 197: + case 200: case 163: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -5291,150 +5342,154 @@ var ts; visitNode(cbNode, node.whenFalse); case 173: return visitNode(cbNode, node.expression); - case 176: - case 203: + case 179: + case 206: return visitNodes(cbNodes, node.statements); - case 224: + case 227: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 177: + case 180: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 196: + case 199: return visitNodes(cbNodes, node.declarations); - case 179: + case 182: return visitNode(cbNode, node.expression); - case 180: + case 183: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 181: + case 184: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 182: + case 185: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 183: + case 186: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); - case 184: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 185: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 186: case 187: - return visitNode(cbNode, node.label); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 189: + case 190: + return visitNode(cbNode, node.label); + case 191: + return visitNode(cbNode, node.expression); + case 192: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 190: + case 193: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 204: + case 207: return visitNodes(cbNodes, node.clauses); - case 217: + case 220: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 218: + case 221: return visitNodes(cbNodes, node.statements); - case 191: + case 194: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 192: + case 195: return visitNode(cbNode, node.expression); - case 193: + case 196: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 220: + case 223: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 130: return visitNode(cbNode, node.expression); - 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 199: - 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 200: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); case 201: + case 174: 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 223: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); case 202: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 203: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 204: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 226: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); case 205: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 208: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 206: + case 209: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 207: + case 210: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 208: + case 211: return visitNode(cbNode, node.name); - case 209: - case 213: - return visitNodes(cbNodes, node.elements); case 212: + case 216: + return visitNodes(cbNodes, node.elements); + case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 210: - case 214: + case 213: + case 217: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 211: + case 214: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); case 171: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 175: + case 176: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 127: return visitNode(cbNode, node.expression); - case 219: + case 222: return visitNodes(cbNodes, node.types); - case 216: + case 177: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments); + case 219: return visitNode(cbNode, node.expression); - case 215: + case 218: return visitNodes(cbNodes, node.decorators); } } @@ -5449,7 +5504,7 @@ var ts; ParsingContext[ParsingContext["TypeMembers"] = 5] = "TypeMembers"; ParsingContext[ParsingContext["ClassMembers"] = 6] = "ClassMembers"; ParsingContext[ParsingContext["EnumMembers"] = 7] = "EnumMembers"; - ParsingContext[ParsingContext["TypeReferences"] = 8] = "TypeReferences"; + ParsingContext[ParsingContext["HeritageClauseElement"] = 8] = "HeritageClauseElement"; ParsingContext[ParsingContext["VariableDeclarations"] = 9] = "VariableDeclarations"; ParsingContext[ParsingContext["ObjectBindingElements"] = 10] = "ObjectBindingElements"; ParsingContext[ParsingContext["ArrayBindingElements"] = 11] = "ArrayBindingElements"; @@ -5480,7 +5535,7 @@ var ts; case 5: return ts.Diagnostics.Property_or_signature_expected; case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; + case 8: return ts.Diagnostics.Expression_expected; case 9: return ts.Diagnostics.Variable_declaration_expected; case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; @@ -5562,7 +5617,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5626,7 +5681,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5830,7 +5885,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(224, 0); + var sourceFile = createNode(227, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -6203,7 +6258,7 @@ var ts; case 5: return isStartOfTypeMember(); case 6: - return lookAhead(isClassMemberStart); + return lookAhead(isClassMemberStart) || (token === 22 && !inErrorRecovery); case 7: return token === 18 || isLiteralPropertyName(); case 13: @@ -6211,7 +6266,15 @@ var ts; case 10: return isLiteralPropertyName(); case 8: - return isIdentifier() && !isNotHeritageClauseTypeName(); + if (token === 14) { + return lookAhead(isValidHeritageClauseObjectLiteral); + } + if (!inErrorRecovery) { + return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + else { + return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); + } case 9: return isIdentifierOrPattern(); case 11: @@ -6233,17 +6296,29 @@ var ts; } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } + function isValidHeritageClauseObjectLiteral() { + ts.Debug.assert(token === 14); + if (nextToken() === 15) { + var next = nextToken(); + return next === 23 || next === 14 || next === 79 || next === 103; + } + return true; + } function nextTokenIsIdentifier() { nextToken(); return isIdentifier(); } - function isNotHeritageClauseTypeName() { + function isHeritageClauseExtendsOrImplementsKeyword() { if (token === 103 || token === 79) { - return lookAhead(nextTokenIsIdentifier); + return lookAhead(nextTokenIsStartOfExpression); } return false; } + function nextTokenIsStartOfExpression() { + nextToken(); + return isStartOfExpression(); + } function isListTerminator(kind) { if (token === 1) { return true; @@ -6393,26 +6468,26 @@ var ts; case 15: return isReusableParameter(node); case 19: - case 8: case 16: case 18: case 17: case 12: case 13: + case 8: } return false; } function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 206: - case 205: - case 212: - case 211: - case 198: - case 199: - case 202: + case 209: + case 208: + case 215: + case 214: case 201: + case 202: + case 205: + case 204: return true; } return isReusableStatement(node); @@ -6428,6 +6503,7 @@ var ts; case 136: case 137: case 132: + case 178: return true; } } @@ -6436,8 +6512,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 217: - case 218: + case 220: + case 221: return true; } } @@ -6446,33 +6522,33 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 197: - case 177: - case 176: + case 200: case 180: case 179: - case 192: - case 188: - case 190: - case 187: - case 186: - case 184: - case 185: case 183: case 182: - case 189: - case 178: - case 193: + case 195: case 191: + case 193: + case 190: + case 189: + case 187: + case 188: + case 186: + case 185: + case 192: case 181: + case 196: case 194: + case 184: + case 197: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 223; + return node.kind === 226; } function isReusableTypeMember(node) { if (node) { @@ -6488,7 +6564,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 195) { + if (node.kind !== 198) { return false; } var variableDeclarator = node; @@ -6594,7 +6670,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(175); + var span = createNode(176); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -7029,7 +7105,7 @@ var ts; function parseTypeAnnotation() { return parseOptional(51) ? parseType() : undefined; } - function isStartOfExpression() { + function isStartOfLeftHandSideExpression() { switch (token) { case 93: case 91: @@ -7044,9 +7120,21 @@ var ts; case 18: case 14: case 83: + case 69: case 88: case 36: case 57: + case 65: + return true; + default: + return isIdentifier(); + } + } + function isStartOfExpression() { + if (isStartOfLeftHandSideExpression()) { + return true; + } + switch (token) { case 33: case 34: case 47: @@ -7057,7 +7145,6 @@ var ts; case 38: case 39: case 24: - case 65: case 111: return true; default: @@ -7068,7 +7155,11 @@ var ts; } } function isStartOfExpressionStatement() { - return token !== 14 && token !== 83 && token !== 52 && isStartOfExpression(); + return token !== 14 && + token !== 83 && + token !== 69 && + token !== 52 && + isStartOfExpression(); } function parseExpression() { // Expression[in]: @@ -7249,7 +7340,10 @@ var ts; if (token === 14) { return parseFunctionBlock(false, false); } - if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 83) { + if (isStartOfStatement(true) && + !isStartOfExpressionStatement() && + token !== 83 && + token !== 69) { return parseFunctionBlock(false, true); } return parseAssignmentExpressionOrHigher(); @@ -7514,7 +7608,6 @@ var ts; case 19: case 51: case 22: - case 23: case 50: case 28: case 30: @@ -7528,6 +7621,8 @@ var ts; case 15: case 1: return true; + case 23: + case 14: default: return false; } @@ -7550,6 +7645,8 @@ var ts; return parseArrayLiteralExpression(); case 14: return parseObjectLiteralExpression(); + case 69: + return parseClassExpression(); case 83: return parseFunctionExpression(); case 88: @@ -7580,7 +7677,7 @@ var ts; } function parseArgumentOrArrayLiteralElement() { return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(174) : + token === 23 ? createNode(175) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { @@ -7621,13 +7718,13 @@ var ts; return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(222, fullStart); + var shorthandDeclaration = createNode(225, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(221, fullStart); + var propertyAssignment = createNode(224, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -7675,7 +7772,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(176); + var node = createNode(179); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -7700,12 +7797,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(178); + var node = createNode(181); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(180); + var node = createNode(183); parseExpected(84); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7715,7 +7812,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(181); + var node = createNode(184); parseExpected(75); node.statement = parseStatement(); parseExpected(100); @@ -7726,7 +7823,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(182); + var node = createNode(185); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7749,21 +7846,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86)) { - var forInStatement = createNode(184, pos); + var forInStatement = createNode(187, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(125)) { - var forOfStatement = createNode(185, pos); + var forOfStatement = createNode(188, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(183, pos); + var forStatement = createNode(186, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -7781,7 +7878,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 187 ? 66 : 71); + parseExpected(kind === 190 ? 66 : 71); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -7789,7 +7886,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(188); + var node = createNode(191); parseExpected(90); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -7798,7 +7895,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(189); + var node = createNode(192); parseExpected(101); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7807,7 +7904,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(217); + var node = createNode(220); parseExpected(67); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -7815,7 +7912,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(218); + var node = createNode(221); parseExpected(73); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -7825,12 +7922,12 @@ var ts; return token === 67 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(190); + var node = createNode(193); parseExpected(92); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); - var caseBlock = createNode(204, scanner.getStartPos()); + var caseBlock = createNode(207, scanner.getStartPos()); parseExpected(14); caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); @@ -7840,14 +7937,14 @@ var ts; function parseThrowStatement() { // ThrowStatement[Yield] : // throw [no LineTerminator here]Expression[In, ?Yield]; - var node = createNode(192); + var node = createNode(195); parseExpected(94); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(193); + var node = createNode(196); parseExpected(96); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 ? parseCatchClause() : undefined; @@ -7858,7 +7955,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(220); + var result = createNode(223); parseExpected(68); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7868,7 +7965,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(194); + var node = createNode(197); parseExpected(72); parseSemicolon(); return finishNode(node); @@ -7877,13 +7974,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 && parseOptional(51)) { - var labeledStatement = createNode(191, fullStart); + var labeledStatement = createNode(194, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(179, fullStart); + var expressionStatement = createNode(182, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -7891,7 +7988,7 @@ var ts; } function isStartOfStatement(inErrorRecovery) { if (ts.isModifier(token)) { - var result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return true; } @@ -7903,6 +8000,7 @@ var ts; case 98: case 105: case 83: + case 69: case 84: case 75: case 100: @@ -7922,7 +8020,6 @@ var ts; var isConstEnum = lookAhead(nextTokenIsEnumKeyword); return !isConstEnum; case 104: - case 69: case 117: case 77: case 123: @@ -7957,6 +8054,8 @@ var ts; return parseVariableStatement(scanner.getStartPos(), undefined, undefined); case 83: return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 69: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); case 22: return parseEmptyStatement(); case 84: @@ -7968,9 +8067,9 @@ var ts; case 82: return parseForOrForInOrForOfStatement(); case 71: - return parseBreakOrContinueStatement(186); + return parseBreakOrContinueStatement(189); case 66: - return parseBreakOrContinueStatement(187); + return parseBreakOrContinueStatement(190); case 90: return parseReturnStatement(); case 101: @@ -7991,7 +8090,7 @@ var ts; } default: if (ts.isModifier(token) || token === 52) { - var result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return result; } @@ -7999,7 +8098,7 @@ var ts; return parseExpressionOrLabeledStatement(); } } - function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers() { + function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers() { var start = scanner.getStartPos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -8019,6 +8118,8 @@ var ts; return parseVariableStatement(start, decorators, modifiers); case 83: return parseFunctionDeclaration(start, decorators, modifiers); + case 69: + return parseClassDeclaration(start, decorators, modifiers); } return undefined; } @@ -8031,7 +8132,7 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(174); + return createNode(175); } var node = createNode(152); node.dotDotDotToken = parseOptionalToken(21); @@ -8080,7 +8181,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(195); + var node = createNode(198); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -8089,7 +8190,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(196); + var node = createNode(199); switch (token) { case 98: break; @@ -8118,7 +8219,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(177, fullStart); + var node = createNode(180, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -8126,7 +8227,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(200, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83); @@ -8269,6 +8370,11 @@ var ts; return modifiers; } function parseClassElement() { + if (token === 22) { + var result = createNode(178); + nextToken(); + return finishNode(result); + } var fullStart = getNodePos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -8295,12 +8401,18 @@ var ts; } ts.Debug.fail("Should not have attempted to parse class member declaration."); } + function parseClassExpression() { + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 174); + } function parseClassDeclaration(fullStart, decorators, modifiers) { + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201); + } + function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var savedStrictModeContext = inStrictModeContext(); if (languageVersion >= 2) { setStrictModeContext(true); } - var node = createNode(198, fullStart); + var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(69); @@ -8336,14 +8448,22 @@ var ts; } function parseHeritageClause() { if (token === 79 || token === 103) { - var node = createNode(219); + var node = createNode(222); node.token = token; nextToken(); - node.types = parseDelimitedList(8, parseTypeReference); + node.types = parseDelimitedList(8, parseHeritageClauseElement); return finishNode(node); } return undefined; } + function parseHeritageClauseElement() { + var node = createNode(177); + node.expression = parseLeftHandSideExpressionOrHigher(); + if (token === 24) { + node.typeArguments = parseBracketedList(17, parseType, 24, 25); + } + return finishNode(node); + } function isHeritageClause() { return token === 79 || token === 103; } @@ -8351,7 +8471,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(199, fullStart); + var node = createNode(202, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(104); @@ -8362,7 +8482,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200, fullStart); + var node = createNode(203, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(123); @@ -8373,13 +8493,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(223, scanner.getStartPos()); + var node = createNode(226, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(201, fullStart); + var node = createNode(204, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77); @@ -8394,7 +8514,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(203, scanner.getStartPos()); + var node = createNode(206, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -8405,7 +8525,7 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; @@ -8416,7 +8536,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -8448,7 +8568,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 124) { - var importEqualsDeclaration = createNode(205, fullStart); + var importEqualsDeclaration = createNode(208, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -8458,7 +8578,7 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(206, fullStart); + var importDeclaration = createNode(209, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || @@ -8478,13 +8598,13 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(207, fullStart); + var importClause = createNode(210, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(209); + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(212); } return finishNode(importClause); } @@ -8494,7 +8614,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(216); + var node = createNode(219); parseExpected(118); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -8509,7 +8629,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(208); + var namespaceImport = createNode(211); parseExpected(35); parseExpected(102); namespaceImport.name = parseIdentifier(); @@ -8517,14 +8637,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 209 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 212 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(214); + return parseImportOrExportSpecifier(217); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(210); + return parseImportOrExportSpecifier(213); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -8543,13 +8663,13 @@ var ts; else { node.name = identifierName; } - if (kind === 210 && checkIdentifierIsKeyword) { + if (kind === 213 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35)) { @@ -8557,7 +8677,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(213); + node.exportClause = parseNamedImportsOrExports(216); if (parseOptional(124)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -8566,7 +8686,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(211, fullStart); + var node = createNode(214, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53)) { @@ -8679,7 +8799,7 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); default: if (decorators) { - var node = createMissingNode(215, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(218, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8759,10 +8879,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 205 && node.moduleReference.kind === 216 - || node.kind === 206 - || node.kind === 211 - || node.kind === 212 + || node.kind === 208 && node.moduleReference.kind === 219 + || node.kind === 209 + || node.kind === 214 + || node.kind === 215 ? node : undefined; }); @@ -8779,6 +8899,7 @@ var ts; case 153: case 161: case 154: + case 174: case 162: case 65: case 9: @@ -9073,10 +9194,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 224); + return ts.getAncestor(node, 227); } function isGlobalSourceFile(node) { - return node.kind === 224 && !ts.isExternalModule(node); + return node.kind === 227 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -9118,25 +9239,33 @@ var ts; } } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 214)) { + if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 217)) { + break loop; + } + result = undefined; + } + else if (location.kind === 227) { + result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { break loop; } result = undefined; } break; - case 201: + case 204: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; case 132: case 131: - if (location.parent.kind === 198 && !(location.flags & 128)) { + if (location.parent.kind === 201 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -9145,8 +9274,8 @@ var ts; } } break; - case 198: - case 199: + case 201: + case 202: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -9157,7 +9286,7 @@ var ts; break; case 127: grandparent = location.parent.parent; - if (grandparent.kind === 198 || grandparent.kind === 199) { + if (grandparent.kind === 201 || grandparent.kind === 202) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -9169,7 +9298,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 163: if (name === "arguments") { result = argumentsSymbol; @@ -9181,8 +9310,15 @@ var ts; result = argumentsSymbol; break loop; } - var id = location.name; - if (id && name === id.text) { + var functionName = location.name; + if (functionName && name === functionName.text) { + result = location.symbol; + break loop; + } + break; + case 174: + var className = location.name; + if (className && name === className.text) { result = location.symbol; break loop; } @@ -9226,14 +9362,14 @@ var ts; ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 195); + var variableDeclaration = ts.getAncestor(declaration, 198); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 177 || - variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 180 || + variableDeclaration.parent.parent.kind === 186) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 185 || - variableDeclaration.parent.parent.kind === 184) { + else if (variableDeclaration.parent.parent.kind === 188 || + variableDeclaration.parent.parent.kind === 187) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -9255,10 +9391,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } - while (node && node.kind !== 206) { + while (node && node.kind !== 209) { node = node.parent; } return node; @@ -9268,7 +9404,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 216) { + if (node.moduleReference.kind === 219) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -9291,7 +9427,7 @@ var ts; if (moduleSymbol.flags & 3) { var typeAnnotation = moduleSymbol.valueDeclaration.type; if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); + return getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name); } } } @@ -9322,7 +9458,7 @@ var ts; if (symbol.flags & 3) { var typeAnnotation = symbol.valueDeclaration.type; if (typeAnnotation) { - return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); + return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name)); } } } @@ -9357,17 +9493,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 205: - return getTargetOfImportEqualsDeclaration(node); - case 207: - return getTargetOfImportClause(node); case 208: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node); case 210: - return getTargetOfImportSpecifier(node); - case 214: - return getTargetOfExportSpecifier(node); + return getTargetOfImportClause(node); case 211: + return getTargetOfNamespaceImport(node); + case 213: + return getTargetOfImportSpecifier(node); + case 217: + return getTargetOfExportSpecifier(node); + case 214: return getTargetOfExportAssignment(node); } } @@ -9396,8 +9532,12 @@ var ts; function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); - if (target && target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target)) { - markAliasSymbolAsReferenced(symbol); + if (target) { + var markAlias = (target === unknownSymbol && compilerOptions.separateCompilation) || + (target !== unknownSymbol && (target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); + if (markAlias) { + markAliasSymbolAsReferenced(symbol); + } } } function markAliasSymbolAsReferenced(symbol) { @@ -9405,10 +9545,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 211 && node.expression) { + if (node.kind === 214 && node.expression) { checkExpressionCached(node.expression); } - else if (node.kind === 214) { + else if (node.kind === 217) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -9418,17 +9558,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 205); + importDeclaration = ts.getAncestor(entityName, 208); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 65 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 65 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (entityName.kind === 65 || entityName.parent.kind === 126) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 205); + ts.Debug.assert(entityName.parent.kind === 208); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -9436,7 +9576,7 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(name, meaning) { - if (ts.getFullWidth(name) === 0) { + if (ts.nodeIsMissing(name)) { return undefined; } var symbol; @@ -9446,18 +9586,22 @@ var ts; return undefined; } } - else if (name.kind === 126) { - var namespace = resolveEntityName(name.left, 1536); - if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) { + else if (name.kind === 126 || name.kind === 155) { + var left = name.kind === 126 ? name.left : name.expression; + var right = name.kind === 126 ? name.right : name.name; + var namespace = resolveEntityName(left, 1536); + if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; } - var right = name.right; symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; } } + else { + ts.Debug.fail("Unknown entity name kind."); + } ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } @@ -9546,7 +9690,7 @@ var ts; } var exportStars = symbol.exports["__export"]; if (exportStars) { - for (var _i = 0, _a = exportStars.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; visit(resolveExternalModuleName(node, node.moduleSpecifier)); } @@ -9583,7 +9727,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _n = members.length; _i < _n; _i++) { + for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; if (member.kind === 135 && ts.nodeIsPresent(member.body)) { return member; @@ -9650,17 +9794,17 @@ var ts; } } switch (location_1.kind) { - case 224: + case 227: if (!ts.isExternalModule(location_1)) { break; } - case 202: + case 205: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 198: - case 199: + case 201: + case 202: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -9691,7 +9835,7 @@ var ts; return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608) { + if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=") { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -9775,8 +9919,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 202 && declaration.name.kind === 8) || - (declaration.kind === 224 && ts.isExternalModule(declaration)); + return (declaration.kind === 205 && declaration.name.kind === 8) || + (declaration.kind === 227 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9811,8 +9955,8 @@ var ts; if (entityName.parent.kind === 144) { meaning = 107455 | 1048576; } - else if (entityName.kind === 126 || - entityName.parent.kind === 205) { + else if (entityName.kind === 126 || entityName.kind === 155 || + entityName.parent.kind === 208) { meaning = 1536; } else { @@ -9859,7 +10003,7 @@ var ts; while (node.kind === 149) { node = node.parent; } - if (node.kind === 200) { + if (node.kind === 203) { return getSymbolOfNode(node); } } @@ -9903,7 +10047,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -10031,7 +10175,7 @@ var ts; var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 224 || declaration.parent.kind === 203; + return declaration.parent.kind === 227 || declaration.parent.kind === 206; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -10087,13 +10231,13 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; writeKeyword(writer, 88); writeSpace(writer); @@ -10127,13 +10271,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { - var p = _f[_e]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _h = 0, _j = signatures.length; _h < _j; _h++) { - var signature = signatures[_h]; + for (var _f = 0; _f < signatures.length; _f++) { + var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -10263,12 +10407,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 202) { + if (node.kind === 205) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 224) { + else if (node.kind === 227) { return ts.isExternalModule(node) ? node : undefined; } } @@ -10313,21 +10457,21 @@ var ts; switch (node.kind) { case 152: return isDeclarationVisible(node.parent.parent); - case 195: + case 198: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 202: - case 198: - case 199: - case 200: - case 197: - case 201: case 205: + case 201: + case 202: + case 203: + case 200: + case 204: + case 208: var parent_2 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 205 && parent_2.kind !== 224 && ts.isInAmbientContext(parent_2))) { + !(node.kind !== 208 && parent_2.kind !== 227 && ts.isInAmbientContext(parent_2))) { return isGlobalSourceFile(parent_2); } return isDeclarationVisible(parent_2); @@ -10345,7 +10489,7 @@ var ts; case 138: case 140: case 129: - case 203: + case 206: case 142: case 143: case 145: @@ -10355,13 +10499,15 @@ var ts; case 148: case 149: return isDeclarationVisible(node.parent); - case 207: - case 208: case 210: + case 211: + case 213: return false; case 128: - case 224: + case 227: return true; + case 214: + return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } @@ -10376,10 +10522,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 211) { + if (node.parent && node.parent.kind === 214) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 217) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -10411,7 +10557,7 @@ var ts; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 195 ? node.parent.parent.parent : node.parent; + return node.kind === 198 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -10469,17 +10615,17 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 184) { + if (declaration.parent.parent.kind === 187) { return anyType; } - if (declaration.parent.parent.kind === 185) { + if (declaration.parent.parent.kind === 188) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var func = declaration.parent; @@ -10497,7 +10643,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 222) { + if (declaration.kind === 225) { return checkIdentifier(declaration.name); } return undefined; @@ -10526,7 +10672,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 174 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 175 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -10544,7 +10690,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 221 ? getWidenedType(type) : type; + return declaration.kind !== 224 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -10565,16 +10711,16 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 220) { + if (declaration.parent.kind === 223) { return links.type = anyType; } - if (declaration.kind === 211) { + if (declaration.kind === 214) { var exportAssignment = declaration; if (exportAssignment.expression) { return links.type = checkExpression(exportAssignment.expression); } else if (exportAssignment.type) { - return links.type = getTypeFromTypeNode(exportAssignment.type); + return links.type = getTypeFromTypeNodeOrHeritageClauseElement(exportAssignment.type); } else { return links.type = anyType; @@ -10603,11 +10749,11 @@ var ts; function getAnnotatedAccessorType(accessor) { if (accessor) { if (accessor.kind === 136) { - return accessor.type && getTypeFromTypeNode(accessor.type); + return accessor.type && getTypeFromTypeNodeOrHeritageClauseElement(accessor.type); } else { var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation && getTypeFromTypeNodeOrHeritageClauseElement(setterTypeAnnotation); } } return undefined; @@ -10719,7 +10865,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 199 || node.kind === 198) { + if (node.kind === 202 || node.kind === 201) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10750,10 +10896,10 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(symbol, 198); - var baseTypeNode = ts.getClassBaseTypeNode(declaration); + var declaration = ts.getDeclarationOfKind(symbol, 201); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + var baseType = getTypeFromHeritageClauseElement(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10791,9 +10937,9 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 199 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 202 && ts.getInterfaceBaseTypeNodes(declaration)) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { - var baseType = getTypeFromTypeReferenceNode(node); + var baseType = getTypeFromHeritageClauseElement(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10822,15 +10968,15 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 200); - var type = getTypeFromTypeNode(declaration.type); + var declaration = ts.getDeclarationOfKind(symbol, 203); + var type = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 200); + var declaration = ts.getDeclarationOfKind(symbol, 203); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -10887,7 +11033,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -10895,14 +11041,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSymbols.length; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -10911,7 +11057,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSignatures.length; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -11010,7 +11156,7 @@ var ts; function getUnionSignatures(types, kind) { var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -11031,7 +11177,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -11167,7 +11313,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -11185,7 +11331,7 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0, _b = props.length; _a < _b; _a++) { + for (var _a = 0; _a < props.length; _a++) { var prop = props[_a]; if (prop.declarations) { declarations.push.apply(declarations, prop.declarations); @@ -11310,7 +11456,7 @@ var ts; returnType = classType; } else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); + returnType = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } else { if (declaration.kind === 136 && !ts.hasDynamicName(declaration)) { @@ -11334,7 +11480,7 @@ var ts; switch (node.kind) { case 142: case 143: - case 197: + case 200: case 134: case 133: case 135: @@ -11432,7 +11578,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -11448,7 +11594,7 @@ var ts; function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType + ? declaration.type ? getTypeFromTypeNodeOrHeritageClauseElement(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { @@ -11458,7 +11604,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128).constraint); + type.constraint = getTypeFromTypeNodeOrHeritageClauseElement(ts.getDeclarationOfKind(type.symbol, 128).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -11482,7 +11628,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } @@ -11533,31 +11679,42 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReferenceNode(node) { + function getTypeFromTypeReference(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromHeritageClauseElement(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromTypeReferenceOrHeritageClauseElement(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var symbol = resolveEntityName(node.typeName, 793056); var type; - if (symbol) { - if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - type = unknownType; - } - else { - type = getDeclaredTypeOfSymbol(symbol); - if (type.flags & (1024 | 2048) && type.flags & 4096) { - var typeParameters = type.typeParameters; - if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); - } - else { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); - type = undefined; - } + if (node.kind !== 177 || ts.isSupportedHeritageClauseElement(node)) { + var typeNameOrExpression = node.kind === 141 + ? node.typeName + : node.expression; + var symbol = resolveEntityName(typeNameOrExpression, 793056); + if (symbol) { + if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; } else { - if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); - type = undefined; + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 | 2048) && type.flags & 4096) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNodeOrHeritageClauseElement)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } } } } @@ -11576,12 +11733,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 198: - case 199: case 201: + case 202: + case 204: return declaration; } } @@ -11623,7 +11780,7 @@ var ts; function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + links.resolvedType = createArrayType(getTypeFromTypeNodeOrHeritageClauseElement(node.elementType)); } return links.resolvedType; } @@ -11639,7 +11796,7 @@ var ts; function getTypeFromTupleTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNodeOrHeritageClauseElement)); } return links.resolvedType; } @@ -11659,13 +11816,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -11683,7 +11840,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -11730,7 +11887,7 @@ var ts; function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNodeOrHeritageClauseElement), true); } return links.resolvedType; } @@ -11756,7 +11913,7 @@ var ts; } return links.resolvedType; } - function getTypeFromTypeNode(node) { + function getTypeFromTypeNodeOrHeritageClauseElement(node) { switch (node.kind) { case 112: return anyType; @@ -11773,7 +11930,9 @@ var ts; case 8: return getTypeFromStringLiteral(node); case 141: - return getTypeFromTypeReferenceNode(node); + return getTypeFromTypeReference(node); + case 177: + return getTypeFromHeritageClauseElement(node); case 144: return getTypeFromTypeQueryNode(node); case 146: @@ -11783,7 +11942,7 @@ var ts; case 148: return getTypeFromUnionTypeNode(node); case 149: - return getTypeFromTypeNode(node.type); + return getTypeFromTypeNodeOrHeritageClauseElement(node.type); case 142: case 143: case 145: @@ -11799,7 +11958,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _n = items.length; _i < _n; _i++) { + for (var _i = 0; _i < items.length; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -11839,7 +11998,7 @@ var ts; case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _n = sources.length; _i < _n; _i++) { + for (var _i = 0; _i < sources.length; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -11955,7 +12114,7 @@ var ts; case 169: return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 221: + case 224: return isContextSensitive(node.initializer); case 134: case 133: @@ -12127,7 +12286,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -12150,7 +12309,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -12287,7 +12446,7 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -12358,7 +12517,7 @@ var ts; return 0; } var result = -1; - for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceProperties.length; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -12383,11 +12542,11 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceSignatures.length; _a++) { var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); @@ -12605,7 +12764,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -12738,7 +12897,7 @@ var ts; ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 197: + case 200: case 134: case 133: case 136: @@ -12791,7 +12950,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { + for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); } @@ -12862,7 +13021,7 @@ var ts; var targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _i = 0, _n = targetTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < targetTypes.length; _i++) { var t = targetTypes[_i]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -12880,7 +13039,7 @@ var ts; } else if (source.flags & 16384) { var sourceTypes = source.types; - for (var _a = 0, _b = sourceTypes.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceTypes.length; _a++) { var sourceType = sourceTypes[_a]; inferFromTypes(sourceType, target); } @@ -12907,7 +13066,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -12980,7 +13139,7 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; } return links.resolvedSymbol; } @@ -13051,7 +13210,7 @@ var ts; switch (node.kind) { case 169: return isAssignedInBinaryExpression(node); - case 195: + case 198: case 152: return isAssignedInVariableDeclaration(node); case 150: @@ -13071,24 +13230,24 @@ var ts; case 168: case 170: case 173: - case 176: - case 177: case 179: case 180: - case 181: case 182: case 183: case 184: case 185: + case 186: + case 187: case 188: - case 189: - case 190: - case 217: - case 218: case 191: case 192: case 193: case 220: + case 221: + case 194: + case 195: + case 196: + case 223: return ts.forEachChild(node, isAssignedIn); } return false; @@ -13124,7 +13283,7 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 180: + case 183: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } @@ -13144,9 +13303,9 @@ var ts; } } break; - case 224: - case 202: - case 197: + case 227: + case 205: + case 200: case 134: case 133: case 136: @@ -13289,15 +13448,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 220) { + symbol.valueDeclaration.parent.kind === 223) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 196) { + while (container.kind !== 199) { container = container.parent; } container = container.parent; - if (container.kind === 177) { + if (container.kind === 180) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -13314,7 +13473,7 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; getNodeLinks(node).flags |= 2; if (container.kind === 132 || container.kind === 135) { getNodeLinks(classNode).flags |= 4; @@ -13331,10 +13490,10 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 202: + case 205: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 201: + case 204: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 135: @@ -13355,7 +13514,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -13372,9 +13531,9 @@ var ts; } function checkSuperExpression(node) { var isCallExpression = node.parent.kind === 157 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); var baseClass; - if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); baseClass = classType.baseTypes.length && classType.baseTypes[0]; } @@ -13395,7 +13554,7 @@ var ts; container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 198) { + if (container && container.parent && container.parent.kind === 201) { if (container.flags & 128) { canUseSuperExpression = container.kind === 134 || @@ -13471,7 +13630,7 @@ var ts; var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var type = getContextuallyTypedParameterType(declaration); @@ -13537,7 +13696,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -13616,29 +13775,29 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 195: + case 198: case 129: case 132: case 131: case 152: return getContextualTypeForInitializerExpression(node); case 163: - case 188: + case 191: return getContextualTypeForReturnExpression(node); case 157: case 158: return getContextualTypeForArgument(parent, node); case 160: - return getTypeFromTypeNode(parent.type); + return getTypeFromTypeNodeOrHeritageClauseElement(parent.type); case 169: return getContextualTypeForBinaryOperand(node); - case 221: + case 224: return getContextualTypeForObjectLiteralElement(parent); case 153: return getContextualTypeForElementExpression(node); case 170: return getContextualTypeForConditionalOperand(node); - case 175: + case 176: ts.Debug.assert(parent.parent.kind === 171); return getContextualTypeForSubstitutionExpression(parent.parent, node); case 161: @@ -13674,7 +13833,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { @@ -13709,7 +13868,7 @@ var ts; if (parent.kind === 169 && parent.operatorToken.kind === 53 && parent.left === node) { return true; } - if (parent.kind === 221) { + if (parent.kind === 224) { return isAssignmentTarget(parent.parent); } if (parent.kind === 153) { @@ -13778,21 +13937,21 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 221 || - memberDecl.kind === 222 || + if (memberDecl.kind === 224 || + memberDecl.kind === 225 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 221) { + if (memberDecl.kind === 224) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 134) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 222); + ts.Debug.assert(memberDecl.kind === 225); type = memberDecl.name.kind === 127 ? unknownType : checkExpression(memberDecl.name, contextualMapper); @@ -13852,7 +14011,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 198); + var enclosingClassDeclaration = ts.getAncestor(node, 201); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -14051,7 +14210,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var parent_4 = signature.declaration && signature.declaration.parent; @@ -14100,7 +14259,7 @@ var ts; var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); - callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } else { var templateLiteral = tagExpression.template; @@ -14163,7 +14322,7 @@ var ts; } for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = void 0; if (i === 0 && args[i].parent.kind === 159) { @@ -14192,7 +14351,7 @@ var ts; var typeArgumentsAreAssignable = true; for (var i = 0; i < typeParameters.length; i++) { var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); + var typeArgument = getTypeFromTypeNodeOrHeritageClauseElement(typeArgNode); typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); @@ -14206,7 +14365,7 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = i === 0 && node.kind === 159 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : @@ -14236,8 +14395,8 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91) { - var containingClass = ts.getAncestor(callExpression, 198); - var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + var containingClass = ts.getAncestor(callExpression, 201); + var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } else { @@ -14304,7 +14463,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -14313,7 +14472,7 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var originalCandidate = candidates[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; @@ -14495,7 +14654,7 @@ var ts; } function checkTypeAssertion(node) { var exprType = checkExpression(node.expression); - var targetType = getTypeFromTypeNode(node.type); + var targetType = getTypeFromTypeNodeOrHeritageClauseElement(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { @@ -14533,7 +14692,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 176) { + if (func.body.kind !== 179) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -14571,7 +14730,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 192); + return (body.statements.length === 1) && (body.statements[0].kind === 195); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -14580,7 +14739,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 176) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 179) { return; } var bodyBlock = func.body; @@ -14632,16 +14791,16 @@ var ts; function checkFunctionExpressionOrObjectLiteralMethodBody(node) { ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); if (node.type) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (node.body) { - if (node.body.kind === 176) { + if (node.body.kind === 179) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); if (node.type) { - checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrHeritageClauseElement(node.type), node.body, undefined); } checkFunctionExpressionBodies(node.body); } @@ -14700,19 +14859,6 @@ var ts; return false; } } - function isImportedNameFromExternalModule(n) { - switch (n.kind) { - case 156: - case 155: { - var symbol = findSymbol(n.expression); - return symbol && symbol.flags & 8388608 && isExternalModuleSymbol(resolveAlias(symbol)); - } - case 161: - return isImportedNameFromExternalModule(n.expression); - default: - return false; - } - } if (!isReferenceOrErrorExpression(n)) { error(n, invalidReferenceMessage); return false; @@ -14721,9 +14867,6 @@ var ts; error(n, constantVariableMessage); return false; } - if (isImportedNameFromExternalModule(n)) { - error(n, invalidReferenceMessage); - } return true; } function checkDeleteExpression(node) { @@ -14781,7 +14924,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -14797,7 +14940,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -14833,9 +14976,9 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var name_8 = p.name; var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name_8.text) || @@ -14862,7 +15005,7 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { var propName = "" + i; var type = sourceType.flags & 1 ? sourceType : @@ -15184,6 +15327,8 @@ var ts; return checkTypeAssertion(node); case 161: return checkExpression(node.expression, contextualMapper); + case 174: + return checkClassExpression(node); case 162: case 163: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -15203,7 +15348,7 @@ var ts; return checkConditionalExpression(node, contextualMapper); case 173: return checkSpreadElementExpression(node, contextualMapper); - case 174: + case 175: return undefinedType; case 172: checkYieldExpression(node); @@ -15250,7 +15395,7 @@ var ts; if (node.kind === 140) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 || node.kind === 197 || node.kind === 143 || + else if (node.kind === 142 || node.kind === 200 || node.kind === 143 || node.kind === 138 || node.kind === 135 || node.kind === 139) { checkGrammarFunctionLikeDeclaration(node); @@ -15276,7 +15421,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 199) { + if (node.kind === 202) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -15286,7 +15431,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -15344,7 +15489,7 @@ var ts; } switch (n.kind) { case 162: - case 197: + case 200: case 163: case 154: return false; default: return ts.forEachChild(n, containsSuperCall); @@ -15354,7 +15499,7 @@ var ts; if (n.kind === 93) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 && n.kind !== 197) { + else if (n.kind !== 162 && n.kind !== 200) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -15363,13 +15508,13 @@ var ts; !(n.flags & 128) && !!n.initializer; } - if (ts.getClassBaseTypeNode(node.parent)) { + if (ts.getClassExtendsHeritageClauseElement(node.parent)) { if (containsSuperCall(node.body)) { var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 179 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 182 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -15413,9 +15558,15 @@ var ts; function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeReference(node) { + function checkTypeReferenceNode(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkHeritageClauseElement(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkTypeReferenceOrHeritageClauseElement(node) { checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceNode(node); + var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); if (type !== unknownType && node.typeArguments) { var len = node.typeArguments.length; for (var i = 0; i < len; i++) { @@ -15468,7 +15619,7 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 199) { + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202) { ts.Debug.assert(signatureDeclarationNode.kind === 138 || signatureDeclarationNode.kind === 139); var signatureKind = signatureDeclarationNode.kind === 138 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); @@ -15478,7 +15629,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { + for (var _i = 0; _i < signaturesToCheck.length; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -15488,7 +15639,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 199 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 202 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -15545,7 +15696,7 @@ var ts; var declarations = symbol.declarations; var isConstructor = (symbol.flags & 16384) !== 0; function reportImplementationExpectedError(node) { - if (node.name && ts.getFullWidth(node.name) === 0) { + if (node.name && ts.nodeIsMissing(node.name)) { return; } var seen = false; @@ -15584,15 +15735,15 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 199 || node.parent.kind === 145 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 202 || node.parent.kind === 145 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 197 || node.kind === 134 || node.kind === 133 || node.kind === 135) { + if (node.kind === 200 || node.kind === 134 || node.kind === 133 || node.kind === 135) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -15643,7 +15794,7 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + for (var _a = 0; _a < signatures.length; _a++) { var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); @@ -15689,16 +15840,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 199: - return 2097152; case 202: + return 2097152; + case 205: return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 198: case 201: + case 204: return 2097152 | 1048576; - case 205: + case 208: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -15712,7 +15863,7 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 198: + case 201: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]); @@ -15738,7 +15889,7 @@ var ts; return; } switch (node.kind) { - case 198: + case 201: case 134: case 136: case 137: @@ -15783,18 +15934,18 @@ var ts; } checkSourceElement(node.body); if (node.type && !isAccessor(node.kind)) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !node.type && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } } function checkBlock(node) { - if (node.kind === 176) { + if (node.kind === 179) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 203) { + if (ts.isFunctionBlock(node) || node.kind === 206) { checkFunctionExpressionBodies(node); } } @@ -15854,11 +16005,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } - if (ts.getClassBaseTypeNode(enclosingClass)) { + if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var isDeclaration_2 = node.kind !== 65; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); @@ -15872,11 +16023,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 202 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 205 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 224 && ts.isExternalModule(parent)) { + if (parent.kind === 227 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -15887,7 +16038,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { return; } - if (node.kind === 195 && !node.initializer) { + if (node.kind === 198 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -15897,15 +16048,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 196); - var container = varDeclList.parent.kind === 177 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199); + var container = varDeclList.parent.kind === 180 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 176 && ts.isFunctionLike(container.parent) || - container.kind === 203 || - container.kind === 202 || - container.kind === 224); + (container.kind === 179 && ts.isFunctionLike(container.parent) || + container.kind === 206 || + container.kind === 205 || + container.kind === 227); if (!namesShareScope) { var name_9 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_9, name_9); @@ -15989,7 +16140,7 @@ var ts; } if (node.kind !== 132 && node.kind !== 131) { checkExportsOnMergedDeclarations(node); - if (node.kind === 195 || node.kind === 152) { + if (node.kind === 198 || node.kind === 152) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -16018,7 +16169,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 176 || node.kind === 154) { + if (node.kind === 179 || node.kind === 154) { return true; } node = node.parent; @@ -16046,12 +16197,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 196) { + if (node.initializer && node.initializer.kind == 199) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -16066,7 +16217,7 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { checkForInOrForOfVariableDeclaration(node); } else { @@ -16087,7 +16238,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { 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); @@ -16286,7 +16437,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 218 && !hasDuplicateDefaultClause) { + if (clause.kind === 221 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -16298,7 +16449,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 217) { + if (produceDiagnostics && clause.kind === 220) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -16315,7 +16466,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 191 && current.label.text === node.label.text) { + if (current.kind === 194 && 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; @@ -16379,9 +16530,9 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 198) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 201) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -16454,7 +16605,15 @@ var ts; } } } + function checkClassExpression(node) { + grammarErrorOnNode(node, ts.Diagnostics.class_expressions_are_not_currently_supported); + ts.forEach(node.members, checkSourceElement); + return unknownType; + } function checkClassDeclaration(node) { + if (node.parent.kind !== 206 && node.parent.kind !== 227) { + grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + } checkGrammarClassDeclarationHeritageClauses(node); checkDecorators(node); if (node.name) { @@ -16467,10 +16626,13 @@ var ts; var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); var staticType = getTypeOfSymbol(symbol); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); + } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkTypeReference(baseTypeNode); + checkHeritageClauseElement(baseTypeNode); } if (type.baseTypes.length) { if (produceDiagnostics) { @@ -16478,19 +16640,24 @@ var ts; checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); var staticBaseType = getTypeOfSymbol(baseType.symbol); checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType.symbol !== resolveEntityName(baseTypeNode.typeName, 107455)) { + if (baseType.symbol !== resolveEntityName(baseTypeNode.expression, 107455)) { error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); } checkKindsOfPropertyMemberOverrides(type, baseType); } - checkExpressionOrQualifiedName(baseTypeNode.typeName); } - var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (type.baseTypes.length || (baseTypeNode && compilerOptions.separateCompilation)) { + checkExpressionOrQualifiedName(baseTypeNode.expression); + } + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - checkTypeReference(typeRefNode); + if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromTypeReferenceNode(typeRefNode); + var t = getTypeFromHeritageClauseElement(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { @@ -16527,7 +16694,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. var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < baseProperties.length; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -16591,7 +16758,7 @@ var ts; if (!tp1.constraint || !tp2.constraint) { return false; } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + if (!isTypeIdenticalTo(getTypeFromTypeNodeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrHeritageClauseElement(tp2.constraint))) { return false; } } @@ -16604,10 +16771,10 @@ var ts; var seen = {}; ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0, _c = properties.length; _b < _c; _b++) { + for (var _b = 0; _b < properties.length; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; @@ -16635,7 +16802,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 199); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -16651,7 +16818,12 @@ var ts; } } } - ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { + if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(heritageElement); + }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { checkTypeForDuplicateIndexSignatures(node); @@ -16816,11 +16988,14 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); + var enumIsConst = ts.isConst(node); + if (compilerOptions.separateCompilation && enumIsConst && ts.isInAmbientContext(node)) { + error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided); + } var enumSymbol = getSymbolOfNode(node); var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { if (enumSymbol.declarations.length > 1) { - var enumIsConst = ts.isConst(node); ts.forEach(enumSymbol.declarations, function (decl) { if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); @@ -16829,7 +17004,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 201) { + if (declaration.kind !== 204) { return false; } var enumDeclaration = declaration; @@ -16850,9 +17025,9 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 198 || (declaration.kind === 197 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 201 || (declaration.kind === 200 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -16872,7 +17047,7 @@ var ts; if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -16895,20 +17070,29 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 126) { - node = node.left; + while (true) { + if (node.kind === 126) { + node = node.left; + } + else if (node.kind === 155) { + node = node.expression; + } + else { + break; + } } + ts.Debug.assert(node.kind === 65); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (ts.getFullWidth(moduleName) !== 0 && moduleName.kind !== 8) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { - error(moduleName, node.kind === 212 ? + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { + error(moduleName, node.kind === 215 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; @@ -16927,7 +17111,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 214 ? + var message = node.kind === 217 ? 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)); @@ -16950,7 +17134,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { checkImportBinding(importClause.namedBindings); } else { @@ -16995,8 +17179,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); } } @@ -17015,8 +17199,8 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 224 ? node.parent : node.parent.parent; - if (container.kind === 202 && container.name.kind === 65) { + var container = node.parent.kind === 227 ? node.parent : node.parent.parent; + if (container.kind === 205 && container.name.kind === 65) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; } @@ -17043,10 +17227,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 224) { + if (node.kind === 227) { return node.statements; } - if (node.kind === 202 && node.body.kind === 203) { + if (node.kind === 205 && node.body.kind === 206) { return node.body.statements; } return emptyArray; @@ -17098,7 +17282,7 @@ var ts; case 137: return checkAccessorDeclaration(node); case 141: - return checkTypeReference(node); + return checkTypeReferenceNode(node); case 144: return checkTypeQuery(node); case 145: @@ -17111,71 +17295,71 @@ var ts; return checkUnionType(node); case 149: return checkSourceElement(node.type); - case 197: + case 200: return checkFunctionDeclaration(node); - case 176: - case 203: - return checkBlock(node); - case 177: - return checkVariableStatement(node); case 179: - return checkExpressionStatement(node); + case 206: + return checkBlock(node); case 180: - return checkIfStatement(node); - case 181: - return checkDoStatement(node); + return checkVariableStatement(node); case 182: - return checkWhileStatement(node); + return checkExpressionStatement(node); case 183: - return checkForStatement(node); + return checkIfStatement(node); case 184: - return checkForInStatement(node); + return checkDoStatement(node); case 185: - return checkForOfStatement(node); + return checkWhileStatement(node); case 186: + return checkForStatement(node); case 187: - return checkBreakOrContinueStatement(node); + return checkForInStatement(node); case 188: - return checkReturnStatement(node); + return checkForOfStatement(node); case 189: - return checkWithStatement(node); case 190: - return checkSwitchStatement(node); + return checkBreakOrContinueStatement(node); case 191: - return checkLabeledStatement(node); + return checkReturnStatement(node); case 192: - return checkThrowStatement(node); + return checkWithStatement(node); case 193: - return checkTryStatement(node); + return checkSwitchStatement(node); + case 194: + return checkLabeledStatement(node); case 195: + return checkThrowStatement(node); + case 196: + return checkTryStatement(node); + case 198: return checkVariableDeclaration(node); case 152: return checkBindingElement(node); - case 198: - return checkClassDeclaration(node); - case 199: - return checkInterfaceDeclaration(node); - case 200: - return checkTypeAliasDeclaration(node); case 201: - return checkEnumDeclaration(node); + return checkClassDeclaration(node); case 202: - return checkModuleDeclaration(node); - case 206: - return checkImportDeclaration(node); + return checkInterfaceDeclaration(node); + case 203: + return checkTypeAliasDeclaration(node); + case 204: + return checkEnumDeclaration(node); case 205: + return checkModuleDeclaration(node); + case 209: + return checkImportDeclaration(node); + case 208: return checkImportEqualsDeclaration(node); - case 212: - return checkExportDeclaration(node); - case 211: - return checkExportAssignment(node); - case 178: - checkGrammarStatementInAmbientContext(node); - return; - case 194: - checkGrammarStatementInAmbientContext(node); - return; case 215: + return checkExportDeclaration(node); + case 214: + return checkExportAssignment(node); + case 181: + checkGrammarStatementInAmbientContext(node); + return; + case 197: + checkGrammarStatementInAmbientContext(node); + return; + case 218: return checkMissingDeclaration(node); } } @@ -17196,10 +17380,10 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 189: + case 192: checkFunctionExpressionBodies(node.expression); break; case 129: @@ -17210,14 +17394,14 @@ var ts; case 152: case 153: case 154: - case 221: + case 224: case 155: case 156: case 157: case 158: case 159: case 171: - case 175: + case 176: case 160: case 161: case 165: @@ -17228,12 +17412,9 @@ var ts; case 169: case 170: case 173: - case 176: - case 203: - case 177: case 179: + case 206: case 180: - case 181: case 182: case 183: case 184: @@ -17241,21 +17422,24 @@ var ts; case 186: case 187: case 188: + case 189: case 190: - case 204: - case 217: - case 218: case 191: - case 192: case 193: + case 207: case 220: + case 221: + case 194: case 195: case 196: - case 198: - case 201: case 223: - case 211: - case 224: + case 198: + case 199: + case 201: + case 204: + case 226: + case 214: + case 227: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -17310,7 +17494,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 189 && node.parent.statement === node) { + if (node.parent.kind === 192 && node.parent.statement === node) { return true; } node = node.parent; @@ -17332,18 +17516,18 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) { break; } - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17384,17 +17568,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17419,20 +17603,28 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 128: - case 198: - case 199: - case 200: case 201: + case 202: + case 203: + case 204: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126) + while (node.parent && node.parent.kind === 126) { node = node.parent; + } return node.parent && node.parent.kind === 141; } - function isTypeNode(node) { + function isHeritageClauseElementIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 155) { + node = node.parent; + } + return node.parent && node.parent.kind === 177; + } + function isTypeNodeOrHeritageClauseElement(node) { if (141 <= node.kind && node.kind <= 149) { return true; } @@ -17447,12 +17639,18 @@ var ts; return node.parent.kind !== 166; case 8: return node.parent.kind === 129; + case 177: + return true; case 65: if (node.parent.kind === 126 && node.parent.right === node) { node = node.parent; } + else if (node.parent.kind === 155 && node.parent.name === node) { + node = node.parent; + } case 126: - ts.Debug.assert(node.kind === 65 || node.kind === 126, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 155: + ts.Debug.assert(node.kind === 65 || node.kind === 126 || node.kind === 155, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_5 = node.parent; if (parent_5.kind === 144) { return false; @@ -17461,14 +17659,16 @@ var ts; return true; } switch (parent_5.kind) { + case 177: + return true; case 128: return node === parent_5.constraint; case 132: case 131: case 129: - case 195: + case 198: return node === parent_5.type; - case 197: + case 200: case 162: case 163: case 135: @@ -17496,10 +17696,10 @@ var ts; while (nodeOnRightSide.parent.kind === 126) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 205) { + if (nodeOnRightSide.parent.kind === 208) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 211) { + if (nodeOnRightSide.parent.kind === 214) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -17507,15 +17707,11 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } - function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 && node.parent.right === node) || - (node.parent.kind === 155 && node.parent.name === node); - } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 211) { + if (entityName.parent.kind === 214) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 155) { @@ -17523,11 +17719,16 @@ var ts; return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } } - if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (ts.isExpression(entityName)) { - if (ts.getFullWidth(entityName) === 0) { + if (isHeritageClauseElementIdentifier(entityName)) { + var meaning = entityName.parent.kind === 177 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, meaning); + } + else if (ts.isExpression(entityName)) { + if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 65) { @@ -17564,7 +17765,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 211 + return node.parent.kind === 214 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } @@ -17587,7 +17788,7 @@ var ts; var moduleName; if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 206 || node.parent.kind === 212) && + ((node.parent.kind === 209 || node.parent.kind === 215) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -17606,7 +17807,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 222) { + if (location && location.kind === 225) { return resolveEntityName(location.name, 107455); } return undefined; @@ -17615,12 +17816,12 @@ var ts; if (isInsideWithStatementBody(node)) { return unknownType; } + if (isTypeNodeOrHeritageClauseElement(node)) { + return getTypeFromTypeNodeOrHeritageClauseElement(node); + } if (ts.isExpression(node)) { return getTypeOfExpression(node); } - if (isTypeNode(node)) { - return getTypeFromTypeNode(node); - } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -17645,7 +17846,7 @@ var ts; return unknownType; } function getTypeOfExpression(expr) { - if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } return checkExpression(expr); @@ -17680,7 +17881,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 224; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { if (languageVersion >= 2) { @@ -17688,10 +17889,10 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 207) { + if (node.kind === 210) { return getGeneratedNameForNode(node.parent) + ".default"; } - if (node.kind === 210) { + if (node.kind === 213) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -17708,7 +17909,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 202 || node.kind === 201) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 205 || node.kind === 204) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -17731,29 +17932,33 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 205: - case 207: case 208: case 210: - case 214: + case 211: + case 213: + case 217: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 212: + case 215: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 211: + case 214: return node.expression && node.expression.kind === 65 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 224 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 227 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } - return isAliasResolvedToValue(getSymbolOfNode(node)); + var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); + return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - return target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + if (target === unknownSymbol && compilerOptions.separateCompilation) { + return true; + } + return target !== unknownSymbol && target && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -17787,7 +17992,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 223) { + if (node.kind === 226) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -17822,13 +18027,13 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 195 && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 198 && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 220; + symbol.valueDeclaration.parent.kind !== 223; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -17934,17 +18139,17 @@ var ts; case 134: case 133: case 140: - case 198: - case 199: - case 202: case 201: - case 177: - case 197: - case 200: - case 206: + case 202: case 205: - case 212: - case 211: + case 204: + case 180: + case 200: + case 203: + case 209: + case 208: + case 215: + case 214: case 129: break; default: @@ -17955,7 +18160,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 109: @@ -17979,7 +18184,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -17988,7 +18193,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 129) { @@ -18004,7 +18209,7 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 129) { @@ -18016,13 +18221,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 129) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 203) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -18041,10 +18246,10 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 206 || node.kind === 205) && flags & 2) { + else if ((node.kind === 209 || node.kind === 208) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 199 && flags & 2) { + else if (node.kind === 202 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } else if (node.kind === 129 && (flags & 112) && ts.isBindingPattern(node.name)) { @@ -18172,9 +18377,9 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _n = arguments.length; _i < _n; _i++) { + for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 174) { + if (arg.kind === 175) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -18199,7 +18404,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -18227,7 +18432,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -18273,16 +18478,16 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_11 = prop.name; - if (prop.kind === 174 || + if (prop.kind === 175 || name_11.kind === 127) { checkGrammarComputedPropertyName(name_11); continue; } var currentKind = void 0; - if (prop.kind === 221 || prop.kind === 222) { + if (prop.kind === 224 || prop.kind === 225) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_11.kind === 7) { checkGrammarNumbericLiteral(name_11); @@ -18329,24 +18534,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 196) { + if (forInOrOfStatement.initializer.kind === 199) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? 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 === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? 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); @@ -18415,7 +18620,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -18426,7 +18631,7 @@ 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 === 199) { + else if (node.parent.kind === 202) { 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 === 145) { @@ -18435,13 +18640,13 @@ var ts; } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return true; - case 191: + case 194: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -18453,9 +18658,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 191: + case 194: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 186 + var isMisplacedContinueLabel = node.kind === 189 && !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); @@ -18463,8 +18668,8 @@ var ts; return false; } break; - case 190: - if (node.kind === 187 && !node.label) { + case 193: + if (node.kind === 190 && !node.label) { return false; } break; @@ -18477,13 +18682,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 187 + var message = node.kind === 190 ? 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 === 187 + var message = node.kind === 190 ? 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); @@ -18502,11 +18707,8 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 184 && node.parent.parent.kind !== 185) { + if (node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { if (ts.isInAmbientContext(node)) { - if (ts.isBindingPattern(node.name)) { - return grammarErrorOnNode(node, ts.Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); - } if (node.initializer) { var equalsTokenLength = "=".length; return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); @@ -18533,7 +18735,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _n = elements.length; _i < _n; _i++) { + for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -18550,15 +18752,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 180: - case 181: - case 182: - case 189: case 183: case 184: case 185: + case 192: + case 186: + case 187: + case 188: return false; - case 191: + case 194: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -18591,7 +18793,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; if (node.name.kind === 127) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -18655,13 +18857,13 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -18676,11 +18878,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 199 || - node.kind === 206 || - node.kind === 205 || - node.kind === 212 || - node.kind === 211 || + if (node.kind === 202 || + node.kind === 209 || + node.kind === 208 || + node.kind === 215 || + node.kind === 214 || (node.flags & 2) || (node.flags & (1 | 256))) { return false; @@ -18688,9 +18890,9 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 177) { + if (ts.isDeclaration(decl) || decl.kind === 180) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -18709,7 +18911,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 === 176 || node.parent.kind === 203 || node.parent.kind === 224) { + if (node.parent.kind === 179 || node.parent.kind === 206 || node.parent.kind === 227) { 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); @@ -18790,7 +18992,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 206); + ts.Debug.assert(aliasEmitInfo.node.kind === 209); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -18863,10 +19065,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 195) { + if (declaration.kind === 198) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 209 || declaration.kind === 210 || declaration.kind === 207) { + else if (declaration.kind === 212 || declaration.kind === 213 || declaration.kind === 210) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -18877,7 +19079,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 206) { + if (moduleElementEmitInfo.node.kind === 209) { moduleElementEmitInfo.isVisible = true; } else { @@ -18885,12 +19087,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -18943,14 +19145,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { @@ -18985,6 +19187,8 @@ var ts; case 99: case 8: return writeTextOfNode(currentSourceFile, type); + case 177: + return emitHeritageClauseElement(type); case 141: return emitTypeReference(type); case 144: @@ -19006,11 +19210,9 @@ var ts; return emitEntityName(type); case 126: return emitEntityName(type); - default: - ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 205 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 208 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -19018,10 +19220,22 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var qualifiedName = entityName; - writeEntityName(qualifiedName.left); + var left = entityName.kind === 126 ? entityName.left : entityName.expression; + var right = entityName.kind === 126 ? entityName.right : entityName.name; + writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, qualifiedName.right); + writeTextOfNode(currentSourceFile, right); + } + } + } + function emitHeritageClauseElement(node) { + if (ts.isSupportedHeritageClauseElement(node)) { + ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 155); + emitEntityName(node.expression); + if (node.typeArguments) { + write("<"); + emitCommaList(node.typeArguments, emitType); + write(">"); } } } @@ -19105,10 +19319,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 205 || - (node.parent.kind === 224 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 208 || + (node.parent.kind === 227 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 224) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -19117,7 +19331,7 @@ var ts; }); } else { - if (node.kind === 206) { + if (node.kind === 209) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -19135,23 +19349,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 197: - return writeFunctionDeclaration(node); - case 177: - return writeVariableStatement(node); - case 199: - return writeInterfaceDeclaration(node); - case 198: - return writeClassDeclaration(node); case 200: - return writeTypeAliasDeclaration(node); - case 201: - return writeEnumDeclaration(node); + return writeFunctionDeclaration(node); + case 180: + return writeVariableStatement(node); case 202: - return writeModuleDeclaration(node); + return writeInterfaceDeclaration(node); + case 201: + return writeClassDeclaration(node); + case 203: + return writeTypeAliasDeclaration(node); + case 204: + return writeEnumDeclaration(node); case 205: + return writeModuleDeclaration(node); + case 208: return writeImportEqualsDeclaration(node); - case 206: + case 209: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -19165,7 +19379,7 @@ var ts; if (node.flags & 256) { write("default "); } - else if (node.kind !== 199) { + else if (node.kind !== 202) { write("declare "); } } @@ -19209,7 +19423,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 208) { + if (namedBindings.kind === 211) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -19235,7 +19449,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -19286,7 +19500,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 203) { + while (node.body.kind !== 206) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -19375,10 +19589,10 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 198: + case 201: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 199: + case 202: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 139: @@ -19392,14 +19606,14 @@ var ts; if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { + else if (node.parent.parent.kind === 201) { 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 197: + case 200: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -19424,10 +19638,12 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + if (ts.isSupportedHeritageClauseElement(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { 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; @@ -19460,11 +19676,11 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { emitHeritageClause([baseTypeNode], false); } - emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); write(" {"); writeLine(); increaseIndent(); @@ -19504,7 +19720,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 195 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 198 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -19522,7 +19738,7 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 195) { + if (node.kind === 198) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19537,7 +19753,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 === 198) { + else if (node.parent.kind === 201) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19560,7 +19776,14 @@ var ts; } : undefined; } function emitBindingPattern(bindingPattern) { - emitCommaList(bindingPattern.elements, emitBindingElement); + var elements = []; + for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 175) { + elements.push(element); + } + } + emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { @@ -19690,13 +19913,13 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 197) { + if (node.kind === 200) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 134) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 197) { + if (node.kind === 200) { write("function "); writeTextOfNode(currentSourceFile, node.name); } @@ -19778,7 +20001,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 === 198) { + else if (node.parent.kind === 201) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19791,7 +20014,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 197: + case 200: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19814,7 +20037,7 @@ var ts; write("..."); } if (ts.isBindingPattern(node.name)) { - write("_" + ts.indexOf(node.parent.parameters, node)); + emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); @@ -19832,79 +20055,124 @@ var ts; writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage; + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { case 135: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - break; case 139: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 134: case 133: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + else if (node.parent.parent.kind === 201) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - break; - case 197: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 200: + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); } - return { - diagnosticMessage: diagnosticMessage, - errorNode: node, - typeName: node.name - }; + } + function emitBindingPattern(bindingPattern) { + if (bindingPattern.kind === 150) { + write("{"); + emitCommaList(bindingPattern.elements, emitBindingElement); + write("}"); + } + else if (bindingPattern.kind === 151) { + write("["); + var elements = bindingPattern.elements; + emitCommaList(elements, emitBindingElement); + if (elements && elements.hasTrailingComma) { + write(", "); + } + write("]"); + } + } + function emitBindingElement(bindingElement) { + function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: bindingElement, + typeName: bindingElement.name + } : undefined; + } + if (bindingElement.kind === 175) { + write(" "); + } + else if (bindingElement.kind === 152) { + if (bindingElement.propertyName) { + writeTextOfNode(currentSourceFile, bindingElement.propertyName); + write(": "); + emitBindingPattern(bindingElement.name); + } + else if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + emitBindingPattern(bindingElement.name); + } + else { + ts.Debug.assert(bindingElement.name.kind === 65); + if (bindingElement.dotDotDotToken) { + write("..."); + } + writeTextOfNode(currentSourceFile, bindingElement.name); + } + } + } } } function emitNode(node) { switch (node.kind) { - case 197: - case 202: - case 205: - case 199: - case 198: case 200: + case 205: + case 208: + case 202: case 201: + case 203: + case 204: return emitModuleElement(node, isModuleElementVisible(node)); - case 177: + case 180: return emitModuleElement(node, isVariableStatementVisible(node)); - case 206: + case 209: return emitModuleElement(node, !node.importClause); - case 212: + case 215: return emitExportDeclaration(node); case 135: case 134: @@ -19920,11 +20188,11 @@ var ts; case 132: case 131: return emitPropertyDeclaration(node); - case 223: + case 226: return emitEnumMemberDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFile(node); } } @@ -20033,7 +20301,6 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; - var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var generatedNameSet = {}; var nodeToGeneratedName = []; @@ -20152,24 +20419,24 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 197: - case 198: + case 200: + case 201: generateNameForFunctionOrClassDeclaration(node); break; - case 202: + case 205: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 201: + case 204: generateNameForModuleOrEnum(node); break; - case 206: + case 209: generateNameForImportDeclaration(node); break; - case 212: + case 215: generateNameForExportDeclaration(node); break; - case 211: + case 214: generateNameForExportAssignment(node); break; } @@ -20323,15 +20590,15 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 197 || + else if (node.kind === 200 || node.kind === 162 || node.kind === 134 || node.kind === 133 || node.kind === 136 || node.kind === 137 || - node.kind === 202 || - node.kind === 198 || - node.kind === 201) { + node.kind === 205 || + node.kind === 201 || + node.kind === 204) { if (node.name) { var name_15 = node.name; scopeName = name_15.kind === 127 @@ -20419,7 +20686,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 224) { + if (node.kind != 227) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -20504,7 +20771,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -20514,7 +20781,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -20528,7 +20795,7 @@ var ts; write(","); } decreaseIndent(); - if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -20793,35 +21060,35 @@ var ts; var parent = node.parent; switch (parent.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: - case 197: + case 200: case 136: case 137: case 162: - case 198: - case 199: case 201: case 202: + case 204: case 205: - case 207: case 208: - return parent.name === node; case 210: - case 214: - return parent.name === node || parent.propertyName === node; - case 187: - case 186: case 211: + return parent.name === node; + case 213: + case 217: + return parent.name === node || parent.propertyName === node; + case 190: + case 189: + case 214: return false; - case 191: + case 194: return node.parent.label === node; } } @@ -21015,9 +21282,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 221: + case 224: return property.initializer; - case 222: + case 225: return createIdentifier(resolver.getExpressionNameSubstitution(property.name, getGeneratedNameForNode)); case 134: return createFunctionExpression(property.parameters, property.body); @@ -21072,7 +21339,7 @@ var ts; return result; } function createExpressionStatement(expression) { - var result = ts.createSynthesizedNode(179); + var result = ts.createSynthesizedNode(182); result.expression = expression; return result; } @@ -21091,7 +21358,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(221); + var result = ts.createSynthesizedNode(224); result.name = name; result.initializer = initializer; return result; @@ -21184,6 +21451,9 @@ var ts; } } function tryEmitConstantValue(node) { + if (compilerOptions.separateCompilation) { + return false; + } var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { write(constantValue.toString()); @@ -21196,7 +21466,7 @@ var ts; return false; } function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); @@ -21401,7 +21671,7 @@ var ts; function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 53 && (node.left.kind === 154 || node.left.kind === 153)) { - emitDestructuring(node, node.parent.kind === 179); + emitDestructuring(node, node.parent.kind === 182); } else { emit(node.left); @@ -21437,13 +21707,13 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 176) { + if (node && node.kind === 179) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { - if (preserveNewLines && isSingleLineEmptyBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -21452,12 +21722,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 203) { - ts.Debug.assert(node.parent.kind === 202); + if (node.kind === 206) { + ts.Debug.assert(node.parent.kind === 205); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 203) { + if (node.kind === 206) { emitTempDeclarations(true); } decreaseIndent(); @@ -21466,7 +21736,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 176) { + if (node.kind === 179) { write(" "); emit(node); } @@ -21491,7 +21761,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76, node.thenStatement.end); - if (node.elseStatement.kind === 180) { + if (node.elseStatement.kind === 183) { write(" "); emit(node.elseStatement); } @@ -21503,7 +21773,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { write(" "); } else { @@ -21547,7 +21817,7 @@ var ts; var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 196) { + if (node.initializer && node.initializer.kind === 199) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; emitStartOfVariableDeclarationList(declarations[0], endPos); @@ -21565,13 +21835,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 185) { + if (languageVersion < 2 && node.kind === 188) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; @@ -21583,7 +21853,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 184) { + if (node.kind === 187) { write(" in "); } else { @@ -21620,7 +21890,6 @@ var ts; var rhsIsIdentifier = node.expression.kind === 65; var counter = createTempVariable(268435456); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(536870912) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -21634,24 +21903,12 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } - if (cachedLength) { - write(", "); - emitNodeWithoutSourceMap(cachedLength); - write(" = "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - if (cachedLength) { - emitNodeWithoutSourceMap(cachedLength); - } - else { - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } + emitNodeWithoutSourceMap(rhsReference); + write(".length"); emitEnd(node.initializer); write("; "); emitStart(node.initializer); @@ -21664,7 +21921,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -21695,7 +21952,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { emitLines(node.statement.statements); } else { @@ -21707,7 +21964,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 187 ? 66 : 71, node.pos); + emitToken(node.kind === 190 ? 66 : 71, node.pos); emitOptional(" ", node.label); write(";"); } @@ -21752,7 +22009,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 217) { + if (node.kind === 220) { write("case "); emit(node.expression); write(":"); @@ -21760,7 +22017,7 @@ var ts; else { write("default:"); } - if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -21807,7 +22064,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 202); + } while (node && node.kind !== 205); return node; } function emitContainingModuleName(node) { @@ -21840,11 +22097,11 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (node.name) { - emitModuleMemberName(node); + if (node.flags & 256) { + write("exports.default"); } else { - write("exports.default"); + emitModuleMemberName(node); } write(" = "); emitDeclarationName(node); @@ -21854,7 +22111,7 @@ var ts; } function emitExportMemberAssignments(name) { if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _a = 0, _b = exportSpecifiers[name.text], _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); emitStart(specifier.name); @@ -21870,7 +22127,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var isDeclaration = (root.kind === 195 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; + var isDeclaration = (root.kind === 198 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; if (root.kind === 169) { emitAssignmentExpression(root); } @@ -21883,7 +22140,7 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 195 || name.parent.kind === 152)) { + if (name.parent && (name.parent.kind === 198 || name.parent.kind === 152)) { emitModuleMemberName(name.parent); } else { @@ -21950,9 +22207,9 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _a = 0, _b = properties.length; _a < _b; _a++) { + for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -21965,7 +22222,7 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } @@ -22032,7 +22289,7 @@ var ts; var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 174) { + else if (element.kind !== 175) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -22069,8 +22326,8 @@ var ts; var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); if (isUninitializedLet && - node.parent.parent.kind !== 184 && - node.parent.parent.kind !== 185) { + node.parent.parent.kind !== 187 && + node.parent.parent.kind !== 188) { initializer = createVoidZero(); } } @@ -22078,7 +22335,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 174) { + if (node.kind === 175) { return; } var name = node.name; @@ -22090,7 +22347,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 195 && node.parent.kind !== 152)) { + if (!node.parent || (node.parent.kind !== 198 && node.parent.kind !== 152)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -22099,24 +22356,24 @@ var ts; if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 65 || - (node.parent.kind !== 195 && node.parent.kind !== 152)) { + (node.parent.kind !== 198 && node.parent.kind !== 152)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); if (((combinedFlags & 12288) === 0) || combinedFlags & 1) { return; } - var list = ts.getAncestor(node, 196); - if (list.parent.kind === 177) { - var isSourceFileLevelBinding = list.parent.parent.kind === 224; - var isModuleLevelBinding = list.parent.parent.kind === 203; - var isFunctionLevelBinding = list.parent.parent.kind === 176 && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 199); + if (list.parent.kind === 180) { + var isSourceFileLevelBinding = list.parent.parent.kind === 227; + var isModuleLevelBinding = list.parent.parent.kind === 206; + var isFunctionLevelBinding = list.parent.parent.kind === 179 && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 224 + var parent = blockScopeContainer.kind === 227 ? blockScopeContainer : blockScopeContainer.parent; if (resolver.resolvesToSomeValue(parent, node.text)) { @@ -22131,7 +22388,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && languageVersion >= 2 && - node.parent.kind === 224; + node.parent.kind === 227; } function emitVariableStatement(node) { if (!(node.flags & 1)) { @@ -22256,8 +22513,8 @@ var ts; if (node.kind === 162) { return !!node.name; } - else if (node.kind === 197) { - return !!node.name || (languageVersion >= 2 && !(node.flags & 256)); + if (node.kind === 200) { + return !!node.name || languageVersion < 2; } } function emitFunctionDeclaration(node) { @@ -22280,7 +22537,7 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 197 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 200 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } if (node.kind !== 134 && node.kind !== 133) { @@ -22330,7 +22587,7 @@ var ts; if (!node.body) { write(" { }"); } - else if (node.body.kind === 176) { + else if (node.body.kind === 179) { emitBlockFunctionBody(node, node.body); } else { @@ -22369,7 +22626,7 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); @@ -22406,8 +22663,8 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements, _c = _b.length; _a < _c; _a++) { + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { var statement = _b[_a]; write(" "); emit(statement); @@ -22430,7 +22687,7 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 179) { + if (statement && statement.kind === 182) { var expr = statement.expression; if (expr && expr.kind === 157) { var func = expr.expression; @@ -22496,7 +22753,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 134 || node.kind === 133) { + if (member.kind === 178) { + writeLine(); + write(";"); + } + else if (member.kind === 134 || node.kind === 133) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -22563,12 +22824,14 @@ var ts; }); } function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; if ((member.kind === 134 || node.kind === 133) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 || node.kind === 133 || member.kind === 136 || member.kind === 137) { + else if (member.kind === 134 || + member.kind === 136 || + member.kind === 137) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -22586,9 +22849,13 @@ var ts; emitEnd(member); emitTrailingComments(member); } + else if (member.kind === 178) { + writeLine(); + write(";"); + } } } - function emitConstructor(node, baseTypeNode) { + function emitConstructor(node, baseTypeElement) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; @@ -22623,7 +22890,7 @@ var ts; emitSignatureParameters(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { write("(...args)"); } else { @@ -22641,7 +22908,7 @@ var ts; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); - if (baseTypeNode) { + if (baseTypeElement) { var superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); @@ -22651,16 +22918,16 @@ var ts; emitParameterPropertyAssignments(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { writeLine(); - emitStart(baseTypeNode); + emitStart(baseTypeElement); if (languageVersion < 2) { write("_super.apply(this, arguments);"); } else { write("super(...args);"); } - emitEnd(baseTypeNode); + emitEnd(baseTypeElement); } } emitMemberAssignments(node, 0); @@ -22687,28 +22954,36 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { if (languageVersion < 2) { - emitClassDeclarationBelowES6(node); + emitClassLikeDeclarationBelowES6(node); } else { - emitClassDeclarationForES6AndHigher(node); + emitClassLikeDeclarationForES6AndHigher(node); } } - function emitClassDeclarationForES6AndHigher(node) { + function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { - write("export "); + if (node.kind === 201) { + if (thisNodeIsDecorated) { + if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 256) { - write("default "); + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 256) { + write("default "); + } } } write("class"); @@ -22716,10 +22991,10 @@ var ts; write(" "); emitDeclarationName(node); } - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write(" extends "); - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); } write(" {"); increaseIndent(); @@ -22762,11 +23037,14 @@ var ts; write(";"); } } - function emitClassDeclarationBelowES6(node) { - write("var "); - emitDeclarationName(node); - write(" = (function ("); - var baseTypeNode = ts.getClassBaseTypeNode(node); + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 201) { + write("var "); + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write("_super"); } @@ -22813,11 +23091,16 @@ var ts; emitStart(node); write(")("); if (baseTypeNode) { - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 201) { + write(";"); } - write(");"); emitEnd(node); - emitExportMemberAssignment(node); + if (node.kind === 201) { + emitExportMemberAssignment(node); + } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } @@ -22961,7 +23244,7 @@ var ts; } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums; + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.separateCompilation; } function emitEnumDeclaration(node) { if (!shouldEmitEnumDeclaration(node)) { @@ -23040,13 +23323,13 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 202) { + if (moduleDeclaration.body.kind === 205) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } } function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation); } function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); @@ -23068,7 +23351,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 203) { + if (node.body.kind === 206) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -23117,16 +23400,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 208) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 206 && node.importClause && !!node.importClause.name; + return node.kind === 209 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -23153,7 +23436,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -23179,7 +23462,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 205 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 208 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -23191,7 +23474,7 @@ var ts; write(" = "); } else { - var isNakedImport = 206 && !node.importClause; + var isNakedImport = 209 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -23266,7 +23549,7 @@ var ts; emitRequire(ts.getExternalModuleName(node)); write(";"); } - for (var _a = 0, _b = node.exportClause.elements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { var specifier = _b[_a]; if (resolver.isValueAliasDeclaration(specifier)) { writeLine(); @@ -23321,7 +23604,7 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(languageVersion >= 2); var needsComma = false; - for (var _a = 0, _b = specifiers.length; _a < _b; _a++) { + for (var _a = 0; _a < specifiers.length; _a++) { var specifier = specifiers[_a]; if (shouldEmit(specifier)) { if (needsComma) { @@ -23346,8 +23629,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 197 && - expression.kind !== 198) { + if (expression.kind !== 200 && + expression.kind !== 201) { write(";"); } emitEnd(node); @@ -23368,21 +23651,21 @@ var ts; exportSpecifiers = {}; exportEquals = undefined; hasExportStars = false; - for (var _a = 0, _b = sourceFile.statements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 206: + case 209: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 205: - if (node.moduleReference.kind === 216 && resolver.isReferencedAliasDeclaration(node)) { + case 208: + if (node.moduleReference.kind === 219 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 212: + case 215: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -23393,14 +23676,14 @@ var ts; } } else { - for (var _d = 0, _e = node.exportClause.elements, _f = _e.length; _d < _f; _d++) { - var specifier = _e[_d]; + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; var name_17 = (specifier.propertyName || specifier.name).text; (exportSpecifiers[name_17] || (exportSpecifiers[name_17] = [])).push(specifier); } } break; - case 211: + case 214: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -23442,7 +23725,7 @@ var ts; write("\"" + node.amdModuleName + "\", "); } write("[\"require\", \"exports\""); - for (var _a = 0, _b = externalImports.length; _a < _b; _a++) { + for (var _a = 0; _a < externalImports.length; _a++) { var importNode = externalImports[_a]; write(", "); var moduleName = ts.getExternalModuleName(importNode); @@ -23453,15 +23736,15 @@ var ts; write("\"\""); } } - for (var _c = 0, _d = node.amdDependencies, _e = _d.length; _c < _e; _c++) { - var amdDependency = _d[_c]; + for (var _b = 0, _c = node.amdDependencies; _b < _c.length; _b++) { + var amdDependency = _c[_b]; var text = "\"" + amdDependency.path + "\""; write(", "); write(text); } write("], function (require, exports"); - for (var _f = 0, _g = externalImports.length; _f < _g; _f++) { - var importNode = externalImports[_f]; + for (var _d = 0; _d < externalImports.length; _d++) { + var importNode = externalImports[_d]; write(", "); var namespaceDeclaration = getNamespaceDeclarationNode(importNode); if (namespaceDeclaration && !isDefaultImport(importNode)) { @@ -23471,8 +23754,8 @@ var ts; write(getGeneratedNameForNode(importNode)); } } - for (var _h = 0, _j = node.amdDependencies, _k = _j.length; _h < _k; _h++) { - var amdDependency = _j[_h]; + for (var _e = 0, _f = node.amdDependencies; _e < _f.length; _e++) { + var amdDependency = _f[_e]; if (amdDependency.name) { write(", "); write(amdDependency.name); @@ -23605,19 +23888,19 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 199: - case 197: - case 206: - case 205: - case 200: - case 211: - return false; case 202: + case 200: + case 209: + case 208: + case 203: + case 214: + return false; + case 205: return shouldEmitModuleDeclaration(node); - case 201: + case 204: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 176 && + if (node.kind !== 179 && node.parent && node.parent.kind === 163 && node.parent.body === node && @@ -23659,7 +23942,7 @@ var ts; return emitLiteral(node); case 171: return emitTemplateExpression(node); - case 175: + case 176: return emitTemplateSpan(node); case 126: return emitQualifiedName(node); @@ -23673,9 +23956,9 @@ var ts; return emitArrayLiteral(node); case 154: return emitObjectLiteral(node); - case 221: + case 224: return emitPropertyAssignment(node); - case 222: + case 225: return emitShorthandPropertyAssignment(node); case 127: return emitComputedPropertyName(node); @@ -23693,7 +23976,7 @@ var ts; return emit(node.expression); case 161: return emitParenExpression(node); - case 197: + case 200: case 162: case 163: return emitFunctionDeclaration(node); @@ -23713,71 +23996,73 @@ var ts; return emitConditionalExpression(node); case 173: return emitSpreadElementExpression(node); - case 174: + case 175: return; - case 176: - case 203: - return emitBlock(node); - case 177: - return emitVariableStatement(node); - case 178: - return write(";"); case 179: - return emitExpressionStatement(node); - case 180: - return emitIfStatement(node); - case 181: - return emitDoStatement(node); - case 182: - return emitWhileStatement(node); - case 183: - return emitForStatement(node); - case 185: - case 184: - return emitForInOrForOfStatement(node); - case 186: - case 187: - return emitBreakOrContinueStatement(node); - case 188: - return emitReturnStatement(node); - case 189: - return emitWithStatement(node); - case 190: - return emitSwitchStatement(node); - case 217: - case 218: - return emitCaseOrDefaultClause(node); - case 191: - return emitLabelledStatement(node); - case 192: - return emitThrowStatement(node); - case 193: - return emitTryStatement(node); - case 220: - return emitCatchClause(node); - case 194: - return emitDebuggerStatement(node); - case 195: - return emitVariableDeclaration(node); - case 198: - return emitClassDeclaration(node); - case 199: - return emitInterfaceDeclaration(node); - case 201: - return emitEnumDeclaration(node); - case 223: - return emitEnumMember(node); - case 202: - return emitModuleDeclaration(node); case 206: - return emitImportDeclaration(node); + return emitBlock(node); + case 180: + return emitVariableStatement(node); + case 181: + return write(";"); + case 182: + return emitExpressionStatement(node); + case 183: + return emitIfStatement(node); + case 184: + return emitDoStatement(node); + case 185: + return emitWhileStatement(node); + case 186: + return emitForStatement(node); + case 188: + case 187: + return emitForInOrForOfStatement(node); + case 189: + case 190: + return emitBreakOrContinueStatement(node); + case 191: + return emitReturnStatement(node); + case 192: + return emitWithStatement(node); + case 193: + return emitSwitchStatement(node); + case 220: + case 221: + return emitCaseOrDefaultClause(node); + case 194: + return emitLabelledStatement(node); + case 195: + return emitThrowStatement(node); + case 196: + return emitTryStatement(node); + case 223: + return emitCatchClause(node); + case 197: + return emitDebuggerStatement(node); + case 198: + return emitVariableDeclaration(node); + case 174: + return emitClassExpression(node); + case 201: + return emitClassDeclaration(node); + case 202: + return emitInterfaceDeclaration(node); + case 204: + return emitEnumDeclaration(node); + case 226: + return emitEnumMember(node); case 205: + return emitModuleDeclaration(node); + case 209: + return emitImportDeclaration(node); + case 208: return emitImportEqualsDeclaration(node); - case 212: + case 215: return emitExportDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFileNode(node); } } @@ -23805,7 +24090,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.pos !== node.parent.pos) { + if (node.parent.kind === 227 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -23817,7 +24102,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.end !== node.parent.end) { + if (node.parent.kind === 227 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -23911,7 +24196,7 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0.0"; + ts.version = "1.5.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -24234,7 +24519,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 206 || node.kind === 205 || node.kind === 212) { + if (node.kind === 209 || node.kind === 208 || node.kind === 215) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -24254,7 +24539,7 @@ var ts; } } } - else if (node.kind === 202 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 205 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { @@ -24276,6 +24561,20 @@ var ts; } } function verifyCompilerOptions() { + if (options.separateCompilation) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation)); + } + if (options.declaration) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation)); + } + if (options.noEmitOnError) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation)); + } + if (options.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); + } + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); @@ -24287,11 +24586,19 @@ var ts; } var languageVersion = options.target || 0; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); - if (firstExternalModuleSourceFile && !options.module) { + if (options.separateCompilation) { if (!options.module && languageVersion < 2) { - var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } + var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); + if (firstNonExternalModuleSourceFile) { + var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + } + } + else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { + var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher)); @@ -24354,10 +24661,6 @@ var ts; name: "charset", type: "string" }, - { - name: "codepage", - type: "number" - }, { name: "declaration", shortName: "d", @@ -24423,10 +24726,6 @@ var ts; name: "noLib", type: "boolean" }, - { - name: "noLibCheck", - type: "boolean" - }, { name: "noResolve", type: "boolean" @@ -24462,6 +24761,10 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "separateCompilation", + type: "boolean" + }, { name: "sourceMap", type: "boolean", @@ -24485,18 +24788,6 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, - { - name: "preserveNewLines", - type: "boolean", - description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, - experimental: true - }, - { - name: "cacheDownlevelForOfLength", - type: "boolean", - description: "Cache length access when downlevel emitting for-of statements", - experimental: true - }, { name: "target", shortName: "t", @@ -24739,23 +25030,23 @@ var ts; return; } switch (n.kind) { - case 176: + case 179: if (!ts.isFunctionBlock(n)) { var parent_6 = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent_6.kind === 181 || - parent_6.kind === 184 || - parent_6.kind === 185 || + if (parent_6.kind === 184 || + parent_6.kind === 187 || + parent_6.kind === 188 || + parent_6.kind === 186 || parent_6.kind === 183 || - parent_6.kind === 180 || - parent_6.kind === 182 || - parent_6.kind === 189 || - parent_6.kind === 220) { + parent_6.kind === 185 || + parent_6.kind === 192 || + parent_6.kind === 223) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_6.kind === 193) { + if (parent_6.kind === 196) { var tryStatement = parent_6; if (tryStatement.tryBlock === n) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); @@ -24778,17 +25069,17 @@ var ts; }); break; } - case 203: { + case 206: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 198: - case 199: case 201: + case 202: + case 204: case 154: - case 204: { + case 207: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -24820,7 +25111,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -24852,7 +25143,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -24933,7 +25224,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < bestMatchKind) { @@ -24980,14 +25271,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 202: + case 205: do { current = current.parent; - } while (current.kind === 202); - case 198: + } while (current.kind === 205); case 201: - case 199: - case 197: + case 204: + case 202: + case 200: indent++; } current = current.parent; @@ -24998,26 +25289,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 177: + case 180: ts.forEach(node.declarationList.declarations, visit); break; case 150: case 151: ts.forEach(node.elements, visit); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { childNodes.push(importClause.namedBindings); } else { @@ -25027,19 +25318,19 @@ var ts; } break; case 152: - case 195: + case 198: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 198: case 201: - case 199: + case 204: case 202: - case 197: case 205: - case 210: - case 214: + case 200: + case 208: + case 213: + case 217: childNodes.push(node); break; } @@ -25071,20 +25362,20 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 198: case 201: - case 199: + case 204: + case 202: topLevelNodes.push(node); break; - case 202: + case 205: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 197: + case 200: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -25095,9 +25386,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 197) { - if (functionDeclaration.body && functionDeclaration.body.kind === 176) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 197 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 200) { + if (functionDeclaration.body && functionDeclaration.body.kind === 179) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 200 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -25110,7 +25401,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; var item_3 = createItem(child); if (item_3 !== undefined) { @@ -25135,9 +25426,9 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems, _n = _a.length; _i < _n; _i++) { + outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { var sourceChild = _a[_i]; - for (var _b = 0, _c = target.childItems, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); @@ -25167,7 +25458,7 @@ var ts; return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); case 140: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 223: + case 226: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); case 138: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); @@ -25176,16 +25467,16 @@ var ts; case 132: case 131: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 197: + case 200: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 195: + case 198: case 152: var variableDeclarationNode; var name_18; if (node.kind === 152) { name_18 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 195) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 198) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -25206,11 +25497,11 @@ var ts; } case 135: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 214: - case 210: - case 205: - case 207: + case 217: + case 213: case 208: + case 210: + case 211: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -25240,17 +25531,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 224: + case 227: return createSourceFileItem(node); - case 198: - return createClassItem(node); case 201: + return createClassItem(node); + case 204: return createEnumItem(node); - case 199: - return createIterfaceItem(node); case 202: + return createIterfaceItem(node); + case 205: return createModuleItem(node); - case 197: + case 200: return createFunctionItem(node); } return undefined; @@ -25260,7 +25551,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 202) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 205) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -25272,7 +25563,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if ((node.name || node.flags & 256) && node.body && node.body.kind === 176) { + if ((node.name || node.flags & 256) && node.body && node.body.kind === 179) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem((!node.name && node.flags & 256) ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -25320,13 +25611,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 202) { + while (node.body.kind === 205) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 224 + return node.kind === 227 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -25418,7 +25709,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0, _n = wordSpans.length; _i < _n; _i++) { + for (var _i = 0; _i < wordSpans.length; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -25471,7 +25762,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0, _n = subWordTextChunks.length; _i < _n; _i++) { + for (var _i = 0; _i < subWordTextChunks.length; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -25862,7 +26153,7 @@ var ts; var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 175 && node.parent.parent.parent.kind === 159) { + else if (node.parent.kind === 176 && node.parent.parent.parent.kind === 159) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; @@ -25879,7 +26170,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0, _n = listChildren.length; _i < _n; _i++) { + for (var _i = 0; _i < listChildren.length; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -25939,7 +26230,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 224; n = n.parent) { + for (var n = node; n.kind !== 227; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -26120,17 +26411,17 @@ var ts; return false; } switch (n.kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 154: case 150: case 145: - case 176: - case 203: - case 204: + case 179: + case 206: + case 207: return nodeEndsWith(n, 15, sourceFile); - case 220: + case 223: return isCompletedNode(n.block, sourceFile); case 158: if (!n.arguments) { @@ -26146,7 +26437,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 134: case 133: @@ -26160,14 +26451,14 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 17, sourceFile); - case 202: + case 205: return n.body && isCompletedNode(n.body, sourceFile); - case 180: + case 183: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 179: + case 182: return isCompletedNode(n.expression, sourceFile); case 153: case 151: @@ -26180,15 +26471,15 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19, sourceFile); - case 217: - case 218: + case 220: + case 221: return false; - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: return isCompletedNode(n.statement, sourceFile); - case 181: + case 184: var hasWhileKeyword = findChildOfKind(n, 100, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 17, sourceFile); @@ -26208,7 +26499,7 @@ var ts; case 171: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 175: + case 176: return ts.nodeIsPresent(n.literal); case 167: return isCompletedNode(n.operand, sourceFile); @@ -26257,7 +26548,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 225 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 228 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -26322,7 +26613,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); @@ -26363,7 +26654,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 224); + ts.Debug.assert(startNode !== undefined || n.kind === 227); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -26403,7 +26694,7 @@ var ts; if (node.kind === 141 || node.kind === 157) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 198 || node.kind === 199) { + if (ts.isFunctionLike(node) || node.kind === 201 || node.kind === 202) { return node.typeParameters; } return undefined; @@ -27145,7 +27436,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -27329,7 +27620,7 @@ var ts; throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 183; + return context.contextNode.kind === 186; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); @@ -27339,16 +27630,16 @@ var ts; case 169: case 170: return true; - case 205: - case 195: + case 208: + case 198: case 129: - case 223: + case 226: case 132: case 131: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; - case 184: + case 187: return context.currentTokenSpan.kind === 86 || context.nextTokenSpan.kind === 86; - case 185: + case 188: return context.currentTokenSpan.kind === 125 || context.nextTokenSpan.kind === 125; case 152: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; @@ -27400,17 +27691,17 @@ var ts; return true; } switch (node.kind) { - case 176: - case 204: + case 179: + case 207: case 154: - case 203: + case 206: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 197: + case 200: case 134: case 133: case 136: @@ -27419,7 +27710,7 @@ var ts; case 162: case 135: case 163: - case 199: + case 202: return true; } return false; @@ -27429,40 +27720,40 @@ var ts; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 198: - case 199: case 201: - case 145: case 202: + case 204: + case 145: + case 205: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 198: - case 202: case 201: - case 176: - case 220: - case 203: - case 190: + case 205: + case 204: + case 179: + case 223: + case 206: + case 193: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 180: - case 190: case 183: - case 184: - case 185: - case 182: case 193: - case 181: - case 189: - case 220: + case 186: + case 187: + case 188: + case 185: + case 196: + case 184: + case 192: + case 223: return true; default: return false; @@ -27487,14 +27778,14 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 196 && + return context.currentTokenParent.kind === 199 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 202; + return context.contextNode.kind === 205; }; Rules.IsObjectTypeContext = function (context) { return context.contextNode.kind === 145; @@ -27505,9 +27796,9 @@ var ts; } switch (parent.kind) { case 141: - case 198: - case 199: - case 197: + case 201: + case 202: + case 200: case 162: case 163: case 134: @@ -27598,7 +27889,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(), _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -28016,17 +28307,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 198: - case 199: - return ts.rangeContainsRange(parent.members, node); + case 201: case 202: + return ts.rangeContainsRange(parent.members, node); + case 205: var body = parent.body; - return body && body.kind === 176 && ts.rangeContainsRange(body.statements, node); - case 224: - case 176: - case 203: + return body && body.kind === 179 && ts.rangeContainsRange(body.statements, node); + case 227: + case 179: + case 206: return ts.rangeContainsRange(parent.statements, node); - case 220: + case 223: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -28145,9 +28436,9 @@ var ts; if (indentation === -1) { if (isSomeBlock(node.kind)) { if (isSomeBlock(parent.kind) || - parent.kind === 224 || - parent.kind === 217 || - parent.kind === 218) { + parent.kind === 227 || + parent.kind === 220 || + parent.kind === 221) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -28178,10 +28469,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 198: return 69; - case 199: return 104; - case 197: return 83; - case 201: return 201; + case 201: return 69; + case 202: return 104; + case 200: return 83; + case 204: return 204; case 136: return 116; case 137: return 120; case 134: @@ -28320,7 +28611,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, true); } @@ -28365,7 +28656,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -28400,7 +28691,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0, _n = trivia.length; _i < _n; _i++) { + for (var _i = 0; _i < trivia.length; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -28580,8 +28871,8 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 176: - case 203: + case 179: + case 206: return true; } return false; @@ -28589,7 +28880,7 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 135: - case 197: + case 200: case 162: case 134: case 133: @@ -28796,7 +29087,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 224 || !parentAndChildShareLine); + (parent.kind === 227 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -28820,7 +29111,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 180 && parent.elseStatement === child) { + if (parent.kind === 183 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 76, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -28842,7 +29133,7 @@ var ts; return node.parent.properties; case 153: return node.parent.elements; - case 197: + case 200: case 162: case 163: case 134: @@ -28929,25 +29220,25 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 153: - case 176: - case 203: + case 179: + case 206: case 154: case 145: case 147: - case 204: - case 218: - case 217: + case 207: + case 221: + case 220: case 161: case 157: case 158: - case 177: - case 195: - case 211: - case 188: + case 180: + case 198: + case 214: + case 191: case 170: case 151: case 150: @@ -28960,13 +29251,13 @@ var ts; return true; } switch (parent) { - case 181: - case 182: case 184: case 185: + case 187: + case 188: + case 186: case 183: - case 180: - case 197: + case 200: case 162: case 134: case 133: @@ -28975,7 +29266,7 @@ var ts; case 135: case 136: case 137: - return child !== 176; + return child !== 179; default: return false; } @@ -29077,10 +29368,10 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(225, nodes.pos, nodes.end, 1024, this); + var list = createNode(228, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -29139,7 +29430,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (child.kind < 126) { return child; @@ -29205,13 +29496,13 @@ var ts; } }); } - if (declaration.kind === 202 && declaration.body.kind === 202) { + if (declaration.kind === 205 && declaration.body.kind === 205) { return; } - while (declaration.kind === 202 && declaration.parent.kind === 202) { + while (declaration.kind === 205 && declaration.parent.kind === 205) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 195 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 198 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -29496,7 +29787,7 @@ var ts; var namedDeclarations = []; ts.forEachChild(sourceFile, function visit(node) { switch (node.kind) { - case 197: + case 200: case 134: case 133: var functionDeclaration = node; @@ -29515,17 +29806,17 @@ var ts; ts.forEachChild(node, visit); } break; - case 198: - case 199: - case 200: case 201: case 202: + case 203: + case 204: case 205: - case 214: - case 210: - case 205: - case 207: case 208: + case 217: + case 213: + case 208: + case 210: + case 211: case 136: case 137: case 145: @@ -29533,14 +29824,14 @@ var ts; namedDeclarations.push(node); } case 135: - case 177: - case 196: + case 180: + case 199: case 150: case 151: - case 203: + case 206: ts.forEachChild(node, visit); break; - case 176: + case 179: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } @@ -29549,30 +29840,30 @@ var ts; if (!(node.flags & 112)) { break; } - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 223: + case 226: case 132: case 131: namedDeclarations.push(node); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { namedDeclarations.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { namedDeclarations.push(importClause.namedBindings); } else { @@ -29730,11 +30021,11 @@ var ts; if (declaration.kind === 162) { return true; } - if (declaration.kind !== 195 && declaration.kind !== 197) { + if (declaration.kind !== 198 && declaration.kind !== 200) { return false; } for (var parent_7 = declaration.parent; !ts.isFunctionBlock(parent_7); parent_7 = parent_7.parent) { - if (parent_7.kind === 224 || parent_7.kind === 203) { + if (parent_7.kind === 227 || parent_7.kind === 206) { return false; } } @@ -29775,7 +30066,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -29859,6 +30150,37 @@ var ts; sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; } + function transpile(input, compilerOptions, fileName, diagnostics) { + var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions(); + options.separateCompilation = true; + options.allowNonTsExtensions = true; + var inputFileName = fileName || "module.ts"; + var sourceFile = ts.createSourceFile(inputFileName, input, options.target); + if (diagnostics && sourceFile.parseDiagnostics) { + diagnostics.push.apply(diagnostics, sourceFile.parseDiagnostics); + } + var outputText; + var compilerHost = { + getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, + writeFile: function (name, text, writeByteOrderMark) { + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + outputText = text; + }, + getDefaultLibFileName: function () { return "lib.d.ts"; }, + useCaseSensitiveFileNames: function () { return false; }, + getCanonicalFileName: function (fileName) { return fileName; }, + getCurrentDirectory: function () { return ""; }, + getNewLine: function () { return "\r\n"; } + }; + var program = ts.createProgram([inputFileName], options, compilerHost); + if (diagnostics) { + diagnostics.push.apply(diagnostics, program.getGlobalDiagnostics()); + } + program.emit(); + ts.Debug.assert(outputText !== undefined, "Output generation failed"); + return outputText; + } + ts.transpile = transpile; function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { var sourceFile = ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); setSourceFileFields(sourceFile, scriptSnapshot, version); @@ -30100,7 +30422,7 @@ var ts; ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 191 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 194 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -30109,16 +30431,16 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 65 && - (node.parent.kind === 187 || node.parent.kind === 186) && + (node.parent.kind === 190 || node.parent.kind === 189) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 65 && - node.parent.kind === 191 && + node.parent.kind === 194 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 191; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 194; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -30147,7 +30469,7 @@ var ts; return node && node.parent && node.parent.kind === 158 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 202 && node.parent.name === node; + return node.parent.kind === 205 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 65 && @@ -30155,20 +30477,20 @@ var ts; } function isNameOfPropertyAssignment(node) { return (node.kind === 65 || node.kind === 8 || node.kind === 7) && - (node.parent.kind === 221 || node.parent.kind === 222) && node.parent.name === node; + (node.parent.kind === 224 || node.parent.kind === 225) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { case 132: case 131: - case 221: - case 223: + case 224: + case 226: case 134: case 133: case 136: case 137: - case 202: + case 205: return node.parent.name === node; case 156: return node.parent.argumentExpression === node; @@ -30237,17 +30559,17 @@ var ts; return undefined; } switch (node.kind) { - case 224: + case 227: case 134: case 133: - case 197: + case 200: case 162: case 136: case 137: - case 198: - case 199: case 201: case 202: + case 204: + case 205: return node; } } @@ -30255,18 +30577,18 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 202: return ScriptElementKind.moduleElement; - case 198: return ScriptElementKind.classElement; - case 199: return ScriptElementKind.interfaceElement; - case 200: return ScriptElementKind.typeElement; - case 201: return ScriptElementKind.enumElement; - case 195: + case 205: return ScriptElementKind.moduleElement; + case 201: return ScriptElementKind.classElement; + case 202: return ScriptElementKind.interfaceElement; + case 203: return ScriptElementKind.typeElement; + case 204: return ScriptElementKind.enumElement; + case 198: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 197: return ScriptElementKind.functionElement; + case 200: return ScriptElementKind.functionElement; case 136: return ScriptElementKind.memberGetAccessorElement; case 137: return ScriptElementKind.memberSetAccessorElement; case 134: @@ -30280,13 +30602,13 @@ var ts; case 138: return ScriptElementKind.callSignatureElement; case 135: return ScriptElementKind.constructorImplementationElement; case 128: return ScriptElementKind.typeParameterElement; - case 223: return ScriptElementKind.variableElement; + case 226: return ScriptElementKind.variableElement; case 129: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 205: - case 210: - case 207: - case 214: case 208: + case 213: + case 210: + case 217: + case 211: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -30346,7 +30668,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0, _n = oldSourceFiles.length; _i < _n; _i++) { + for (var _i = 0; _i < oldSourceFiles.length; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -30381,7 +30703,7 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; if (!sourceFileUpToDate(program.getSourceFile(fileName))) { return false; @@ -30429,6 +30751,12 @@ var ts; if (!displayName) { return undefined; } + if (displayName === "default") { + var localSymbol = ts.getLocalSymbolForExportDefault(symbol); + if (localSymbol && localSymbol.name) { + displayName = symbol.valueDeclaration.localSymbol.name; + } + } var firstCharCode = displayName.charCodeAt(0); if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; @@ -30545,11 +30873,11 @@ var ts; symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); } } - else if (ts.getAncestor(contextToken, 207)) { + else if (ts.getAncestor(contextToken, 210)) { isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(contextToken)) { - var importDeclaration = ts.getAncestor(contextToken, 206); + var importDeclaration = ts.getAncestor(contextToken, 209); ts.Debug.assert(importDeclaration !== undefined); var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); symbols = filterModuleExports(exports, importDeclaration); @@ -30564,7 +30892,7 @@ var ts; var adjustedPosition = previousToken !== contextToken ? previousToken.getStart() : position; - var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile); + var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; var symbolMeanings = 793056 | 107455 | 1536 | 8388608; symbols = typeInfoResolver.getSymbolsInScope(scopeNode, symbolMeanings); } @@ -30589,7 +30917,7 @@ var ts; function showCompletionsInImportsClause(node) { if (node) { if (node.kind === 14 || node.kind === 23) { - return node.parent.kind === 209; + return node.parent.kind === 212; } } return false; @@ -30614,16 +30942,16 @@ var ts; case 117: return true; case 20: - return containingNodeKind === 202; + return containingNodeKind === 205; case 14: - return containingNodeKind === 198; + return containingNodeKind === 201; case 53: - return containingNodeKind === 195 + return containingNodeKind === 198 || containingNodeKind === 169; case 11: return containingNodeKind === 171; case 12: - return containingNodeKind === 175; + return containingNodeKind === 176; case 109: case 107: case 108: @@ -30672,7 +31000,7 @@ var ts; switch (kind) { case 162: case 163: - case 197: + case 200: case 134: case 133: case 136: @@ -30689,14 +31017,14 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 195 || - containingNodeKind === 196 || - containingNodeKind === 177 || - containingNodeKind === 201 || - isFunction(containingNodeKind) || - containingNodeKind === 198 || - containingNodeKind === 197 || + return containingNodeKind === 198 || containingNodeKind === 199 || + containingNodeKind === 180 || + containingNodeKind === 204 || + isFunction(containingNodeKind) || + containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || containingNodeKind === 151 || containingNodeKind === 150; case 20: @@ -30704,21 +31032,21 @@ var ts; case 18: return containingNodeKind === 151; case 16: - return containingNodeKind === 220 || + return containingNodeKind === 223 || isFunction(containingNodeKind); case 14: - return containingNodeKind === 201 || - containingNodeKind === 199 || + return containingNodeKind === 204 || + containingNodeKind === 202 || containingNodeKind === 145 || containingNodeKind === 150; case 22: return containingNodeKind === 131 && - (previousToken.parent.parent.kind === 199 || + (previousToken.parent.parent.kind === 202 || previousToken.parent.parent.kind === 145); case 24: - return containingNodeKind === 198 || - containingNodeKind === 197 || - containingNodeKind === 199 || + return containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || isFunction(containingNodeKind); case 110: return containingNodeKind === 132; @@ -30771,7 +31099,7 @@ var ts; return exports; } if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 209) { + importDeclaration.importClause.namedBindings.kind === 212) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -30788,7 +31116,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 221 && m.kind !== 222) { + if (m.kind !== 224 && m.kind !== 225) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -30824,7 +31152,7 @@ var ts; var start = new Date().getTime(); var entries = []; var nameToSymbol = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; var entry = createCompletionEntry(symbol, typeInfoResolver, location); if (entry) { @@ -31139,7 +31467,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 223) { + if (declaration.kind === 226) { var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -31155,7 +31483,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 205) { + if (declaration.kind === 208) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -31354,7 +31682,7 @@ var ts; symbol = typeInfoResolver.getAliasedSymbol(symbol); } } - if (node.parent.kind === 222) { + if (node.parent.kind === 225) { var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -31382,7 +31710,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 114) { if (symbol.flags & 32) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 198); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 201); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -31399,7 +31727,7 @@ var ts; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 135) || - (!selectConstructors && (d.kind === 197 || d.kind === 134 || d.kind === 133))) { + (!selectConstructors && (d.kind === 200 || d.kind === 134 || d.kind === 133))) { declarations.push(d); if (d.body) definition = d; @@ -31417,6 +31745,17 @@ var ts; } } function getOccurrencesAtPosition(fileName, position) { + var results = getOccurrencesAtPositionCore(fileName, position); + if (results) { + var sourceFile = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results.forEach(function (value) { + var targetFile = getCanonicalFileName(ts.normalizeSlashes(value.fileName)); + ts.Debug.assert(sourceFile == targetFile, "Unexpected file in results. Found results in " + targetFile + " expected only results in " + sourceFile + "."); + }); + } + return results; + } + function getOccurrencesAtPositionCore(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingWord(sourceFile, position); @@ -31430,58 +31769,58 @@ var ts; switch (node.kind) { case 84: case 76: - if (hasKind(node.parent, 180)) { + if (hasKind(node.parent, 183)) { return getIfElseOccurrences(node.parent); } break; case 90: - if (hasKind(node.parent, 188)) { + if (hasKind(node.parent, 191)) { return getReturnOccurrences(node.parent); } break; case 94: - if (hasKind(node.parent, 192)) { + if (hasKind(node.parent, 195)) { return getThrowOccurrences(node.parent); } break; case 68: - if (hasKind(parent(parent(node)), 193)) { + if (hasKind(parent(parent(node)), 196)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 96: case 81: - if (hasKind(parent(node), 193)) { + if (hasKind(parent(node), 196)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 92: - if (hasKind(node.parent, 190)) { + if (hasKind(node.parent, 193)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 67: case 73: - if (hasKind(parent(parent(parent(node))), 190)) { + if (hasKind(parent(parent(parent(node))), 193)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 66: case 71: - if (hasKind(node.parent, 187) || hasKind(node.parent, 186)) { + if (hasKind(node.parent, 190) || hasKind(node.parent, 189)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 82: - if (hasKind(node.parent, 183) || - hasKind(node.parent, 184) || - hasKind(node.parent, 185)) { + if (hasKind(node.parent, 186) || + hasKind(node.parent, 187) || + hasKind(node.parent, 188)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 100: case 75: - if (hasKind(node.parent, 182) || hasKind(node.parent, 181)) { + if (hasKind(node.parent, 185) || hasKind(node.parent, 184)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -31497,14 +31836,14 @@ var ts; } default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 177)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 180)) { return getModifierOccurrences(node.kind, node.parent); } } return undefined; function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 180) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 183) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -31515,7 +31854,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 180)) { + if (!hasKind(ifStatement.elseStatement, 183)) { break; } ifStatement = ifStatement.elseStatement; @@ -31548,7 +31887,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 176))) { + if (!(func && hasKind(func.body, 179))) { return undefined; } var keywords = []; @@ -31581,10 +31920,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 192) { + if (node.kind === 195) { statementAccumulator.push(node); } - else if (node.kind === 193) { + else if (node.kind === 196) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -31606,10 +31945,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent_9 = child.parent; - if (ts.isFunctionBlock(parent_9) || parent_9.kind === 224) { + if (ts.isFunctionBlock(parent_9) || parent_9.kind === 227) { return parent_9; } - if (parent_9.kind === 193) { + if (parent_9.kind === 196) { var tryStatement = parent_9; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -31634,7 +31973,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 82, 100, 75)) { - if (loopNode.kind === 181) { + if (loopNode.kind === 184) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 100)) { @@ -31669,13 +32008,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return getLoopBreakContinueOccurrences(owner); - case 190: + case 193: return getSwitchCaseDefaultOccurrences(owner); } } @@ -31686,7 +32025,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 187 || node.kind === 186) { + if (node.kind === 190 || node.kind === 189) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -31702,15 +32041,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { switch (node_1.kind) { - case 190: - if (statement.kind === 186) { + case 193: + if (statement.kind === 189) { continue; } - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: - case 181: + case 184: if (!statement.label || isLabeledBy(node_1, statement.label.text)) { return node_1; } @@ -31749,18 +32088,18 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 198 || + if (!(container.kind === 201 || (declaration.kind === 129 && hasKind(container, 135)))) { return undefined; } } else if (modifier === 110) { - if (container.kind !== 198) { + if (container.kind !== 201) { return undefined; } } else if (modifier === 78 || modifier === 115) { - if (!(container.kind === 203 || container.kind === 224)) { + if (!(container.kind === 206 || container.kind === 227)) { return undefined; } } @@ -31771,14 +32110,14 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 203: - case 224: + case 206: + case 227: nodes = container.statements; break; case 135: nodes = container.parameters.concat(container.parent.members); break; - case 198: + case 201: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { @@ -31840,7 +32179,7 @@ var ts; return undefined; } var referenceEntries = []; - for (var _i = 0, _n = referenceSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < referenceSymbols.length; _i++) { var referenceSymbol = referenceSymbols[_i]; ts.addRange(referenceEntries, referenceSymbol.references); } @@ -31943,12 +32282,12 @@ var ts; } function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 210 || location.parent.kind === 214) && + (location.parent.kind === 213 || location.parent.kind === 217) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 210 || declaration.kind === 214; + return declaration.kind === 213 || declaration.kind === 217; }); } function getDeclaredName(symbol, location) { @@ -31985,7 +32324,7 @@ var ts; if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 198); + return ts.getAncestor(privateDeclaration, 201); } } if (symbol.flags & 8388608) { @@ -31997,7 +32336,7 @@ var ts; var scope = undefined; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -32006,7 +32345,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 224 && !ts.isExternalModule(container)) { + if (container.kind === 227 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -32212,11 +32551,11 @@ var ts; staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 224: + case 227: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 197: + case 200: case 162: break; default: @@ -32224,7 +32563,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 224) { + if (searchSpaceNode.kind === 227) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -32256,7 +32595,7 @@ var ts; var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { case 162: - case 197: + case 200: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } @@ -32267,13 +32606,13 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; - case 198: + case 201: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 224: - if (container.kind === 224 && !ts.isExternalModule(container)) { + case 227: + if (container.kind === 227 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -32308,11 +32647,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 198) { - getPropertySymbolFromTypeReference(ts.getClassBaseTypeNode(declaration)); - ts.forEach(ts.getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); + if (declaration.kind === 201) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 199) { + else if (declaration.kind === 202) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -32395,7 +32734,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -32463,32 +32802,32 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: - case 220: + case 223: return 1; case 128: - case 199: - case 200: + case 202: + case 203: case 145: return 2; - case 198: case 201: + case 204: return 1 | 2; - case 202: + case 205: if (node.name.kind === 8) { return 4 | 1; } @@ -32498,31 +32837,51 @@ var ts; else { return 4; } - case 209: - case 210: - case 205: - case 206: - case 211: case 212: + case 213: + case 208: + case 209: + case 214: + case 215: return 1 | 2 | 4; - case 224: + case 227: return 4 | 1; } return 1 | 2 | 4; ts.Debug.fail("Unknown declaration type"); } function isTypeReference(node) { - if (isRightSideOfQualifiedName(node)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 141; + return node.parent.kind === 141 || node.parent.kind === 177; } function isNamespaceReference(node) { + return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); + } + function isPropertyAccessNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 155) { + while (root.parent && root.parent.kind === 155) { + root = root.parent; + } + isLastClause = root.name === node; + } + if (!isLastClause && root.parent.kind === 177 && root.parent.parent.kind === 222) { + var decl = root.parent.parent.parent; + return (decl.kind === 201 && root.parent.parent.token === 103) || + (decl.kind === 202 && root.parent.parent.token === 79); + } + return false; + } + function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; if (root.parent.kind === 126) { - while (root.parent && root.parent.kind === 126) + while (root.parent && root.parent.kind === 126) { root = root.parent; + } isLastClause = root.right === node; } return root.parent.kind === 141 && !isLastClause; @@ -32537,13 +32896,13 @@ var ts; ts.Debug.assert(node.kind === 65); if (node.parent.kind === 126 && node.parent.right === node && - node.parent.parent.kind === 205) { + node.parent.parent.kind === 208) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 211) { + if (node.parent.kind === 214) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -32596,7 +32955,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 202 && + if (nodeForStartPos.parent.parent.kind === 205 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -32652,7 +33011,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 202 && ts.getModuleInstanceState(declaration) == 1; + return declaration.kind === 205 && ts.getModuleInstanceState(declaration) == 1; }); } } @@ -32770,7 +33129,7 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 53) { - if (token.parent.kind === 195 || + if (token.parent.kind === 198 || token.parent.kind === 132 || token.parent.kind === 129) { return ClassificationTypeNames.operator; @@ -32800,7 +33159,7 @@ var ts; else if (tokenKind === 65) { if (token) { switch (token.parent.kind) { - case 198: + case 201: if (token.parent.name === token) { return ClassificationTypeNames.className; } @@ -32810,17 +33169,17 @@ var ts; return ClassificationTypeNames.typeParameterName; } return; - case 199: + case 202: if (token.parent.name === token) { return ClassificationTypeNames.interfaceName; } return; - case 201: + case 204: if (token.parent.name === token) { return ClassificationTypeNames.enumName; } return; - case 202: + case 205: if (token.parent.name === token) { return ClassificationTypeNames.moduleName; } @@ -32833,7 +33192,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -32858,7 +33217,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0, _n = childNodes.length; _i < _n; _i++) { + for (var _i = 0; _i < childNodes.length; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -32991,7 +33350,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var sourceFile_1 = current.getSourceFile(); if (sourceFile_1 && getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { @@ -33081,7 +33440,7 @@ var ts; case 8: case 7: if (ts.isDeclarationName(node) || - node.parent.kind === 216 || + node.parent.kind === 219 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -33382,7 +33741,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 224 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 227 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -33439,10 +33798,10 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } - if (node.parent.kind === 183) { + if (node.parent.kind === 186) { return textSpan(node); } if (node.parent.kind === 169 && node.parent.operatorToken.kind === 23) { @@ -33453,15 +33812,15 @@ var ts; } } switch (node.kind) { - case 177: + case 180: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 195: + case 198: case 132: case 131: return spanInVariableDeclaration(node); case 129: return spanInParameterDeclaration(node); - case 197: + case 200: case 134: case 133: case 136: @@ -33470,70 +33829,70 @@ var ts; case 162: case 163: return spanInFunctionDeclaration(node); - case 176: + case 179: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 203: + case 206: return spanInBlock(node); - case 220: + case 223: return spanInBlock(node.block); - case 179: - return textSpan(node.expression); - case 188: - return textSpan(node.getChildAt(0), node.expression); case 182: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 181: - return spanInNode(node.statement); - case 194: - return textSpan(node.getChildAt(0)); - case 180: - return textSpan(node, ts.findNextToken(node.expression, node)); + return textSpan(node.expression); case 191: - return spanInNode(node.statement); - case 187: - case 186: - return textSpan(node.getChildAt(0), node.label); - case 183: - return spanInForStatement(node); - case 184: + return textSpan(node.getChildAt(0), node.expression); case 185: return textSpan(node, ts.findNextToken(node.expression, node)); - case 190: + case 184: + return spanInNode(node.statement); + case 197: + return textSpan(node.getChildAt(0)); + case 183: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 194: + return spanInNode(node.statement); + case 190: + case 189: + return textSpan(node.getChildAt(0), node.label); + case 186: + return spanInForStatement(node); + case 187: + case 188: return textSpan(node, ts.findNextToken(node.expression, node)); - case 217: - case 218: - return spanInNode(node.statements[0]); case 193: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 220: + case 221: + return spanInNode(node.statements[0]); + case 196: return spanInBlock(node.tryBlock); - case 192: + case 195: return textSpan(node, node.expression); - case 211: + case 214: if (!node.expression) { return undefined; } return textSpan(node, node.expression); - case 205: + case 208: return textSpan(node, node.moduleReference); - case 206: + case 209: return textSpan(node, node.moduleSpecifier); - case 212: + case 215: return textSpan(node, node.moduleSpecifier); - case 202: + case 205: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 198: case 201: - case 223: + case 204: + case 226: case 157: case 158: return textSpan(node); - case 189: + case 192: return spanInNode(node.statement); - case 199: - case 200: + case 202: + case 203: return undefined; case 22: case 1: @@ -33560,7 +33919,7 @@ var ts; case 81: return spanInNextNode(node); default: - if (node.parent.kind === 221 && node.parent.name === node) { + if (node.parent.kind === 224 && node.parent.name === node) { return spanInNode(node.parent.initializer); } if (node.parent.kind === 160 && node.parent.type === node) { @@ -33573,12 +33932,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 184 || - variableDeclaration.parent.parent.kind === 185) { + if (variableDeclaration.parent.parent.kind === 187 || + variableDeclaration.parent.parent.kind === 188) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 177; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 183 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 180; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 186 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -33624,7 +33983,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 198 && functionDeclaration.kind !== 135); + (functionDeclaration.parent.kind === 201 && functionDeclaration.kind !== 135); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -33644,23 +34003,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 202: + case 205: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 182: - case 180: - case 184: case 185: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 183: + case 187: + case 188: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 186: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 196) { + if (forStatement.initializer.kind === 199) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -33679,34 +34038,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 201: + case 204: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 198: + case 201: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 204: + case 207: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 203: + case 206: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } + case 204: case 201: - case 198: return textSpan(node); - case 176: + case 179: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 220: + case 223: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 204: + case 207: var caseBlock = node.parent; var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { @@ -33718,7 +34077,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -33726,16 +34085,16 @@ var ts; function spanInCloseParenToken(node) { switch (node.parent.kind) { case 162: - case 197: + case 200: case 163: case 134: case 133: case 136: case 137: case 135: - case 182: - case 181: - case 183: + case 185: + case 184: + case 186: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -33743,7 +34102,7 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 221) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 224) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -33755,7 +34114,7 @@ var ts; return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); diff --git a/bin/typescriptServices_internal.d.ts b/bin/typescriptServices_internal.d.ts index 692c34786ec..f0f86ebfe02 100644 --- a/bin/typescriptServices_internal.d.ts +++ b/bin/typescriptServices_internal.d.ts @@ -221,9 +221,9 @@ declare module ts { function isClassElement(n: Node): boolean; function isDeclarationName(name: Node): boolean; function isAliasSymbolDeclaration(node: Node): boolean; - function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode; - function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray; - function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; + function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration): HeritageClauseElement; + function getClassImplementsHeritageClauseElements(node: ClassDeclaration): NodeArray; + function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; function getHeritageClause(clauses: NodeArray, kind: SyntaxKind): HeritageClause; function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile; function getAncestor(node: Node, kind: SyntaxKind): Node; @@ -307,7 +307,7 @@ declare module ts { function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string; function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean): void; function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number; - function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration; + function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration; function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean; function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration): { firstAccessor: AccessorDeclaration; @@ -318,11 +318,22 @@ declare module ts { function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void; function emitComments(currentSourceFile: SourceFile, writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void): void; function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string): void; + function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean; + function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean; + function getLocalSymbolForExportDefault(symbol: Symbol): Symbol; } declare module ts { - var optionDeclarations: CommandLineOption[]; - function parseCommandLine(commandLine: string[]): ParsedCommandLine; + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; } declare module ts { diff --git a/bin/typescript_internal.d.ts b/bin/typescript_internal.d.ts index 845f01eb360..6fc997c62d5 100644 --- a/bin/typescript_internal.d.ts +++ b/bin/typescript_internal.d.ts @@ -221,9 +221,9 @@ declare module "typescript" { function isClassElement(n: Node): boolean; function isDeclarationName(name: Node): boolean; function isAliasSymbolDeclaration(node: Node): boolean; - function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode; - function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray; - function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; + function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration): HeritageClauseElement; + function getClassImplementsHeritageClauseElements(node: ClassDeclaration): NodeArray; + function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; function getHeritageClause(clauses: NodeArray, kind: SyntaxKind): HeritageClause; function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile; function getAncestor(node: Node, kind: SyntaxKind): Node; @@ -307,7 +307,7 @@ declare module "typescript" { function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string; function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean): void; function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number; - function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration; + function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration; function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean; function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration): { firstAccessor: AccessorDeclaration; @@ -318,11 +318,22 @@ declare module "typescript" { function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void; function emitComments(currentSourceFile: SourceFile, writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void): void; function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string): void; + function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean; + function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean; + function getLocalSymbolForExportDefault(symbol: Symbol): Symbol; } declare module "typescript" { - var optionDeclarations: CommandLineOption[]; - function parseCommandLine(commandLine: string[]): ParsedCommandLine; + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; } declare module "typescript" {