diff --git a/Jakefile.js b/Jakefile.js
index 301dc574eb634..cda7e2ca882ce 100644
--- a/Jakefile.js
+++ b/Jakefile.js
@@ -448,7 +448,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
options += " --stripInternal";
}
- options += " --target es5";
+ options += " --target es5 --noUnusedLocals --noUnusedParameters";
var cmd = host + " " + compilerPath + " " + options + " ";
cmd = cmd + sources.join(" ");
diff --git a/lib/cancellationToken.js b/lib/cancellationToken.js
index 8af21172df4a0..f5a28f8d52d7d 100644
--- a/lib/cancellationToken.js
+++ b/lib/cancellationToken.js
@@ -39,3 +39,5 @@ function createCancellationToken(args) {
};
}
module.exports = createCancellationToken;
+
+//# sourceMappingURL=cancellationToken.js.map
diff --git a/lib/lib.d.ts b/lib/lib.d.ts
index 922820b5d90a5..969bf70448c9a 100644
--- a/lib/lib.d.ts
+++ b/lib/lib.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
/////////////////////////////
/// ECMAScript APIs
/////////////////////////////
@@ -4149,6 +4153,8 @@ interface Date {
*/
toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
}
+
+
/////////////////////////////
/// IE DOM APIs
@@ -18774,12 +18780,16 @@ type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
type IDBValidKey = number | string | Date | IDBArrayKey;
type BufferSource = ArrayBuffer | ArrayBufferView;
type MouseWheelEvent = WheelEvent;
-type ScrollRestoration = "auto" | "manual";
+type ScrollRestoration = "auto" | "manual";
+
+
/////////////////////////////
/// WorkerGlobalScope APIs
/////////////////////////////
// These are only available in a Web Worker
declare function importScripts(...urls: string[]): void;
+
+
/////////////////////////////
diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts
index 4c19c878064a5..b80f167b7a8be 100644
--- a/lib/lib.dom.d.ts
+++ b/lib/lib.dom.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
/////////////////////////////
/// IE DOM APIs
diff --git a/lib/lib.dom.iterable.d.ts b/lib/lib.dom.iterable.d.ts
index 397e0ab111ea2..2b62054765b15 100644
--- a/lib/lib.dom.iterable.d.ts
+++ b/lib/lib.dom.iterable.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
///
interface DOMTokenList {
diff --git a/lib/lib.es2015.collection.d.ts b/lib/lib.es2015.collection.d.ts
index 24c737df74b5f..eabd6319de6c7 100644
--- a/lib/lib.es2015.collection.d.ts
+++ b/lib/lib.es2015.collection.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
interface Map {
clear(): void;
delete(key: K): boolean;
diff --git a/lib/lib.es2015.core.d.ts b/lib/lib.es2015.core.d.ts
index 669c80944ecfb..499d0de52db94 100644
--- a/lib/lib.es2015.core.d.ts
+++ b/lib/lib.es2015.core.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
declare type PropertyKey = string | number | symbol;
interface Array {
diff --git a/lib/lib.es2015.d.ts b/lib/lib.es2015.d.ts
index 973d518098985..ff5c555bfee88 100644
--- a/lib/lib.es2015.d.ts
+++ b/lib/lib.es2015.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
///
///
///
diff --git a/lib/lib.es2015.generator.d.ts b/lib/lib.es2015.generator.d.ts
index 003f325e4e03d..20d6725f66b1c 100644
--- a/lib/lib.es2015.generator.d.ts
+++ b/lib/lib.es2015.generator.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
interface GeneratorFunction extends Function { }
interface GeneratorFunctionConstructor {
diff --git a/lib/lib.es2015.iterable.d.ts b/lib/lib.es2015.iterable.d.ts
index 1c27525d4326f..cb92cb4b8aac7 100644
--- a/lib/lib.es2015.iterable.d.ts
+++ b/lib/lib.es2015.iterable.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
///
interface SymbolConstructor {
diff --git a/lib/lib.es2015.promise.d.ts b/lib/lib.es2015.promise.d.ts
index 36fe9e7777f22..02352da40611b 100644
--- a/lib/lib.es2015.promise.d.ts
+++ b/lib/lib.es2015.promise.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
/**
* Represents the completion of an asynchronous operation
*/
diff --git a/lib/lib.es2015.proxy.d.ts b/lib/lib.es2015.proxy.d.ts
index 3908e97c17c87..03996c6ad9fba 100644
--- a/lib/lib.es2015.proxy.d.ts
+++ b/lib/lib.es2015.proxy.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
interface ProxyHandler {
getPrototypeOf? (target: T): any;
setPrototypeOf? (target: T, v: any): boolean;
diff --git a/lib/lib.es2015.reflect.d.ts b/lib/lib.es2015.reflect.d.ts
index 0f1a491ebcf2e..b6a6853457a90 100644
--- a/lib/lib.es2015.reflect.d.ts
+++ b/lib/lib.es2015.reflect.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
declare namespace Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any;
function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any;
diff --git a/lib/lib.es2015.symbol.d.ts b/lib/lib.es2015.symbol.d.ts
index 4ab7b4374f126..c0474aec0118a 100644
--- a/lib/lib.es2015.symbol.d.ts
+++ b/lib/lib.es2015.symbol.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
interface Symbol {
/** Returns a string representation of an object. */
toString(): string;
diff --git a/lib/lib.es2015.symbol.wellknown.d.ts b/lib/lib.es2015.symbol.wellknown.d.ts
index 2d122d1284e3e..42299fe7d0969 100644
--- a/lib/lib.es2015.symbol.wellknown.d.ts
+++ b/lib/lib.es2015.symbol.wellknown.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
///
interface SymbolConstructor {
diff --git a/lib/lib.es2016.array.include.d.ts b/lib/lib.es2016.array.include.d.ts
index a4677e7cf1e16..42b95c478d059 100644
--- a/lib/lib.es2016.array.include.d.ts
+++ b/lib/lib.es2016.array.include.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
interface Array {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
diff --git a/lib/lib.es2016.d.ts b/lib/lib.es2016.d.ts
index 04a2337967663..5921e060d0fe6 100644
--- a/lib/lib.es2016.d.ts
+++ b/lib/lib.es2016.d.ts
@@ -13,6 +13,10 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
///
///
\ No newline at end of file
diff --git a/lib/lib.es2017.d.ts b/lib/lib.es2017.d.ts
index 24d23994d962f..8354de37f7fd0 100644
--- a/lib/lib.es2017.d.ts
+++ b/lib/lib.es2017.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
///
///
///
\ No newline at end of file
diff --git a/lib/lib.es2017.object.d.ts b/lib/lib.es2017.object.d.ts
index ac3a16ab37059..996147a974616 100644
--- a/lib/lib.es2017.object.d.ts
+++ b/lib/lib.es2017.object.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
interface ObjectConstructor {
/**
* Returns an array of values of the enumerable properties of an object
diff --git a/lib/lib.es2017.sharedmemory.d.ts b/lib/lib.es2017.sharedmemory.d.ts
index 639ca7530e4cc..c59e1255519e1 100644
--- a/lib/lib.es2017.sharedmemory.d.ts
+++ b/lib/lib.es2017.sharedmemory.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
///
///
diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts
index a13ffc92d0407..2cf3f742522aa 100644
--- a/lib/lib.es5.d.ts
+++ b/lib/lib.es5.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
/////////////////////////////
/// ECMAScript APIs
/////////////////////////////
diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts
index 4c8806dd7dd48..1ace5f499b182 100644
--- a/lib/lib.es6.d.ts
+++ b/lib/lib.es6.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
/////////////////////////////
/// ECMAScript APIs
/////////////////////////////
@@ -4149,6 +4153,8 @@ interface Date {
*/
toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
}
+
+
declare type PropertyKey = string | number | symbol;
interface Array {
@@ -4673,6 +4679,8 @@ interface StringConstructor {
*/
raw(template: TemplateStringsArray, ...substitutions: any[]): string;
}
+
+
interface Map {
clear(): void;
delete(key: K): boolean;
@@ -4745,6 +4753,8 @@ interface WeakSetConstructor {
readonly prototype: WeakSet;
}
declare var WeakSet: WeakSetConstructor;
+
+
interface GeneratorFunction extends Function { }
interface GeneratorFunctionConstructor {
@@ -4757,6 +4767,8 @@ interface GeneratorFunctionConstructor {
readonly prototype: GeneratorFunction;
}
declare var GeneratorFunction: GeneratorFunctionConstructor;
+
+
///
interface SymbolConstructor {
@@ -5201,7 +5213,9 @@ interface Float64ArrayConstructor {
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;
-}/**
+}
+
+/**
* Represents the completion of an asynchronous operation
*/
interface Promise {
@@ -5454,7 +5468,9 @@ interface PromiseConstructor {
resolve(): Promise;
}
-declare var Promise: PromiseConstructor;interface ProxyHandler {
+declare var Promise: PromiseConstructor;
+
+interface ProxyHandler {
getPrototypeOf? (target: T): any;
setPrototypeOf? (target: T, v: any): boolean;
isExtensible? (target: T): boolean;
@@ -5475,7 +5491,9 @@ interface ProxyConstructor {
revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; };
new (target: T, handler: ProxyHandler): T
}
-declare var Proxy: ProxyConstructor;declare namespace Reflect {
+declare var Proxy: ProxyConstructor;
+
+declare namespace Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any;
function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any;
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
@@ -5489,7 +5507,9 @@ declare var Proxy: ProxyConstructor;declare namespace Reflect {
function preventExtensions(target: any): boolean;
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
function setPrototypeOf(target: any, proto: any): boolean;
-}interface Symbol {
+}
+
+interface Symbol {
/** Returns a string representation of an object. */
toString(): string;
@@ -5524,7 +5544,9 @@ interface SymbolConstructor {
keyFor(sym: symbol): string | undefined;
}
-declare var Symbol: SymbolConstructor;///
+declare var Symbol: SymbolConstructor;
+
+///
interface SymbolConstructor {
/**
@@ -5850,7 +5872,9 @@ interface Float32Array {
*/
interface Float64Array {
readonly [Symbol.toStringTag]: "Float64Array";
-}
+}
+
+
/////////////////////////////
/// IE DOM APIs
/////////////////////////////
@@ -20475,12 +20499,16 @@ type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
type IDBValidKey = number | string | Date | IDBArrayKey;
type BufferSource = ArrayBuffer | ArrayBufferView;
type MouseWheelEvent = WheelEvent;
-type ScrollRestoration = "auto" | "manual";
+type ScrollRestoration = "auto" | "manual";
+
+
/////////////////////////////
/// WorkerGlobalScope APIs
/////////////////////////////
// These are only available in a Web Worker
declare function importScripts(...urls: string[]): void;
+
+
/////////////////////////////
@@ -20772,6 +20800,8 @@ interface DateConstructor {
interface Date {
getVarDate: () => VarDate;
}
+
+
///
interface DOMTokenList {
diff --git a/lib/lib.scripthost.d.ts b/lib/lib.scripthost.d.ts
index b4e52a342f1ad..2d2f4df3b7080 100644
--- a/lib/lib.scripthost.d.ts
+++ b/lib/lib.scripthost.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
/////////////////////////////
diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts
index 6cb14c5b184a9..531295672563e 100644
--- a/lib/lib.webworker.d.ts
+++ b/lib/lib.webworker.d.ts
@@ -13,7 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
+
+
///
+
+
/////////////////////////////
/// IE Worker APIs
diff --git a/lib/tsc.js b/lib/tsc.js
index b1fac7955d0a1..fbfe07a4588d2 100644
--- a/lib/tsc.js
+++ b/lib/tsc.js
@@ -15,6 +15,418 @@ and limitations under the License.
var ts;
(function (ts) {
+ (function (SyntaxKind) {
+ SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown";
+ SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken";
+ SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia";
+ SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia";
+ SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia";
+ SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia";
+ SyntaxKind[SyntaxKind["ShebangTrivia"] = 6] = "ShebangTrivia";
+ SyntaxKind[SyntaxKind["ConflictMarkerTrivia"] = 7] = "ConflictMarkerTrivia";
+ SyntaxKind[SyntaxKind["NumericLiteral"] = 8] = "NumericLiteral";
+ SyntaxKind[SyntaxKind["StringLiteral"] = 9] = "StringLiteral";
+ SyntaxKind[SyntaxKind["JsxText"] = 10] = "JsxText";
+ SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 11] = "RegularExpressionLiteral";
+ SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 12] = "NoSubstitutionTemplateLiteral";
+ SyntaxKind[SyntaxKind["TemplateHead"] = 13] = "TemplateHead";
+ SyntaxKind[SyntaxKind["TemplateMiddle"] = 14] = "TemplateMiddle";
+ SyntaxKind[SyntaxKind["TemplateTail"] = 15] = "TemplateTail";
+ SyntaxKind[SyntaxKind["OpenBraceToken"] = 16] = "OpenBraceToken";
+ SyntaxKind[SyntaxKind["CloseBraceToken"] = 17] = "CloseBraceToken";
+ SyntaxKind[SyntaxKind["OpenParenToken"] = 18] = "OpenParenToken";
+ SyntaxKind[SyntaxKind["CloseParenToken"] = 19] = "CloseParenToken";
+ SyntaxKind[SyntaxKind["OpenBracketToken"] = 20] = "OpenBracketToken";
+ SyntaxKind[SyntaxKind["CloseBracketToken"] = 21] = "CloseBracketToken";
+ SyntaxKind[SyntaxKind["DotToken"] = 22] = "DotToken";
+ SyntaxKind[SyntaxKind["DotDotDotToken"] = 23] = "DotDotDotToken";
+ SyntaxKind[SyntaxKind["SemicolonToken"] = 24] = "SemicolonToken";
+ SyntaxKind[SyntaxKind["CommaToken"] = 25] = "CommaToken";
+ SyntaxKind[SyntaxKind["LessThanToken"] = 26] = "LessThanToken";
+ SyntaxKind[SyntaxKind["LessThanSlashToken"] = 27] = "LessThanSlashToken";
+ SyntaxKind[SyntaxKind["GreaterThanToken"] = 28] = "GreaterThanToken";
+ SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 29] = "LessThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 30] = "GreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 31] = "EqualsEqualsToken";
+ SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 32] = "ExclamationEqualsToken";
+ SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 33] = "EqualsEqualsEqualsToken";
+ SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 34] = "ExclamationEqualsEqualsToken";
+ SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 35] = "EqualsGreaterThanToken";
+ SyntaxKind[SyntaxKind["PlusToken"] = 36] = "PlusToken";
+ SyntaxKind[SyntaxKind["MinusToken"] = 37] = "MinusToken";
+ SyntaxKind[SyntaxKind["AsteriskToken"] = 38] = "AsteriskToken";
+ SyntaxKind[SyntaxKind["AsteriskAsteriskToken"] = 39] = "AsteriskAsteriskToken";
+ SyntaxKind[SyntaxKind["SlashToken"] = 40] = "SlashToken";
+ SyntaxKind[SyntaxKind["PercentToken"] = 41] = "PercentToken";
+ SyntaxKind[SyntaxKind["PlusPlusToken"] = 42] = "PlusPlusToken";
+ SyntaxKind[SyntaxKind["MinusMinusToken"] = 43] = "MinusMinusToken";
+ SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 44] = "LessThanLessThanToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 45] = "GreaterThanGreaterThanToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 46] = "GreaterThanGreaterThanGreaterThanToken";
+ SyntaxKind[SyntaxKind["AmpersandToken"] = 47] = "AmpersandToken";
+ SyntaxKind[SyntaxKind["BarToken"] = 48] = "BarToken";
+ SyntaxKind[SyntaxKind["CaretToken"] = 49] = "CaretToken";
+ SyntaxKind[SyntaxKind["ExclamationToken"] = 50] = "ExclamationToken";
+ SyntaxKind[SyntaxKind["TildeToken"] = 51] = "TildeToken";
+ SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 52] = "AmpersandAmpersandToken";
+ SyntaxKind[SyntaxKind["BarBarToken"] = 53] = "BarBarToken";
+ SyntaxKind[SyntaxKind["QuestionToken"] = 54] = "QuestionToken";
+ SyntaxKind[SyntaxKind["ColonToken"] = 55] = "ColonToken";
+ SyntaxKind[SyntaxKind["AtToken"] = 56] = "AtToken";
+ SyntaxKind[SyntaxKind["EqualsToken"] = 57] = "EqualsToken";
+ SyntaxKind[SyntaxKind["PlusEqualsToken"] = 58] = "PlusEqualsToken";
+ SyntaxKind[SyntaxKind["MinusEqualsToken"] = 59] = "MinusEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 60] = "AsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 61] = "AsteriskAsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["SlashEqualsToken"] = 62] = "SlashEqualsToken";
+ SyntaxKind[SyntaxKind["PercentEqualsToken"] = 63] = "PercentEqualsToken";
+ SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 64] = "LessThanLessThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 65] = "GreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 66] = "GreaterThanGreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 67] = "AmpersandEqualsToken";
+ SyntaxKind[SyntaxKind["BarEqualsToken"] = 68] = "BarEqualsToken";
+ SyntaxKind[SyntaxKind["CaretEqualsToken"] = 69] = "CaretEqualsToken";
+ SyntaxKind[SyntaxKind["Identifier"] = 70] = "Identifier";
+ SyntaxKind[SyntaxKind["BreakKeyword"] = 71] = "BreakKeyword";
+ SyntaxKind[SyntaxKind["CaseKeyword"] = 72] = "CaseKeyword";
+ SyntaxKind[SyntaxKind["CatchKeyword"] = 73] = "CatchKeyword";
+ SyntaxKind[SyntaxKind["ClassKeyword"] = 74] = "ClassKeyword";
+ SyntaxKind[SyntaxKind["ConstKeyword"] = 75] = "ConstKeyword";
+ SyntaxKind[SyntaxKind["ContinueKeyword"] = 76] = "ContinueKeyword";
+ SyntaxKind[SyntaxKind["DebuggerKeyword"] = 77] = "DebuggerKeyword";
+ SyntaxKind[SyntaxKind["DefaultKeyword"] = 78] = "DefaultKeyword";
+ SyntaxKind[SyntaxKind["DeleteKeyword"] = 79] = "DeleteKeyword";
+ SyntaxKind[SyntaxKind["DoKeyword"] = 80] = "DoKeyword";
+ SyntaxKind[SyntaxKind["ElseKeyword"] = 81] = "ElseKeyword";
+ SyntaxKind[SyntaxKind["EnumKeyword"] = 82] = "EnumKeyword";
+ SyntaxKind[SyntaxKind["ExportKeyword"] = 83] = "ExportKeyword";
+ SyntaxKind[SyntaxKind["ExtendsKeyword"] = 84] = "ExtendsKeyword";
+ SyntaxKind[SyntaxKind["FalseKeyword"] = 85] = "FalseKeyword";
+ SyntaxKind[SyntaxKind["FinallyKeyword"] = 86] = "FinallyKeyword";
+ SyntaxKind[SyntaxKind["ForKeyword"] = 87] = "ForKeyword";
+ SyntaxKind[SyntaxKind["FunctionKeyword"] = 88] = "FunctionKeyword";
+ SyntaxKind[SyntaxKind["IfKeyword"] = 89] = "IfKeyword";
+ SyntaxKind[SyntaxKind["ImportKeyword"] = 90] = "ImportKeyword";
+ SyntaxKind[SyntaxKind["InKeyword"] = 91] = "InKeyword";
+ SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 92] = "InstanceOfKeyword";
+ SyntaxKind[SyntaxKind["NewKeyword"] = 93] = "NewKeyword";
+ SyntaxKind[SyntaxKind["NullKeyword"] = 94] = "NullKeyword";
+ SyntaxKind[SyntaxKind["ReturnKeyword"] = 95] = "ReturnKeyword";
+ SyntaxKind[SyntaxKind["SuperKeyword"] = 96] = "SuperKeyword";
+ SyntaxKind[SyntaxKind["SwitchKeyword"] = 97] = "SwitchKeyword";
+ SyntaxKind[SyntaxKind["ThisKeyword"] = 98] = "ThisKeyword";
+ SyntaxKind[SyntaxKind["ThrowKeyword"] = 99] = "ThrowKeyword";
+ SyntaxKind[SyntaxKind["TrueKeyword"] = 100] = "TrueKeyword";
+ SyntaxKind[SyntaxKind["TryKeyword"] = 101] = "TryKeyword";
+ SyntaxKind[SyntaxKind["TypeOfKeyword"] = 102] = "TypeOfKeyword";
+ SyntaxKind[SyntaxKind["VarKeyword"] = 103] = "VarKeyword";
+ SyntaxKind[SyntaxKind["VoidKeyword"] = 104] = "VoidKeyword";
+ SyntaxKind[SyntaxKind["WhileKeyword"] = 105] = "WhileKeyword";
+ SyntaxKind[SyntaxKind["WithKeyword"] = 106] = "WithKeyword";
+ SyntaxKind[SyntaxKind["ImplementsKeyword"] = 107] = "ImplementsKeyword";
+ SyntaxKind[SyntaxKind["InterfaceKeyword"] = 108] = "InterfaceKeyword";
+ SyntaxKind[SyntaxKind["LetKeyword"] = 109] = "LetKeyword";
+ SyntaxKind[SyntaxKind["PackageKeyword"] = 110] = "PackageKeyword";
+ SyntaxKind[SyntaxKind["PrivateKeyword"] = 111] = "PrivateKeyword";
+ SyntaxKind[SyntaxKind["ProtectedKeyword"] = 112] = "ProtectedKeyword";
+ SyntaxKind[SyntaxKind["PublicKeyword"] = 113] = "PublicKeyword";
+ SyntaxKind[SyntaxKind["StaticKeyword"] = 114] = "StaticKeyword";
+ SyntaxKind[SyntaxKind["YieldKeyword"] = 115] = "YieldKeyword";
+ SyntaxKind[SyntaxKind["AbstractKeyword"] = 116] = "AbstractKeyword";
+ SyntaxKind[SyntaxKind["AsKeyword"] = 117] = "AsKeyword";
+ SyntaxKind[SyntaxKind["AnyKeyword"] = 118] = "AnyKeyword";
+ SyntaxKind[SyntaxKind["AsyncKeyword"] = 119] = "AsyncKeyword";
+ SyntaxKind[SyntaxKind["AwaitKeyword"] = 120] = "AwaitKeyword";
+ SyntaxKind[SyntaxKind["BooleanKeyword"] = 121] = "BooleanKeyword";
+ SyntaxKind[SyntaxKind["ConstructorKeyword"] = 122] = "ConstructorKeyword";
+ SyntaxKind[SyntaxKind["DeclareKeyword"] = 123] = "DeclareKeyword";
+ SyntaxKind[SyntaxKind["GetKeyword"] = 124] = "GetKeyword";
+ SyntaxKind[SyntaxKind["IsKeyword"] = 125] = "IsKeyword";
+ SyntaxKind[SyntaxKind["ModuleKeyword"] = 126] = "ModuleKeyword";
+ SyntaxKind[SyntaxKind["NamespaceKeyword"] = 127] = "NamespaceKeyword";
+ SyntaxKind[SyntaxKind["NeverKeyword"] = 128] = "NeverKeyword";
+ SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 129] = "ReadonlyKeyword";
+ SyntaxKind[SyntaxKind["RequireKeyword"] = 130] = "RequireKeyword";
+ SyntaxKind[SyntaxKind["NumberKeyword"] = 131] = "NumberKeyword";
+ SyntaxKind[SyntaxKind["SetKeyword"] = 132] = "SetKeyword";
+ SyntaxKind[SyntaxKind["StringKeyword"] = 133] = "StringKeyword";
+ SyntaxKind[SyntaxKind["SymbolKeyword"] = 134] = "SymbolKeyword";
+ SyntaxKind[SyntaxKind["TypeKeyword"] = 135] = "TypeKeyword";
+ SyntaxKind[SyntaxKind["UndefinedKeyword"] = 136] = "UndefinedKeyword";
+ SyntaxKind[SyntaxKind["FromKeyword"] = 137] = "FromKeyword";
+ SyntaxKind[SyntaxKind["GlobalKeyword"] = 138] = "GlobalKeyword";
+ SyntaxKind[SyntaxKind["OfKeyword"] = 139] = "OfKeyword";
+ SyntaxKind[SyntaxKind["QualifiedName"] = 140] = "QualifiedName";
+ SyntaxKind[SyntaxKind["ComputedPropertyName"] = 141] = "ComputedPropertyName";
+ SyntaxKind[SyntaxKind["TypeParameter"] = 142] = "TypeParameter";
+ SyntaxKind[SyntaxKind["Parameter"] = 143] = "Parameter";
+ SyntaxKind[SyntaxKind["Decorator"] = 144] = "Decorator";
+ SyntaxKind[SyntaxKind["PropertySignature"] = 145] = "PropertySignature";
+ SyntaxKind[SyntaxKind["PropertyDeclaration"] = 146] = "PropertyDeclaration";
+ SyntaxKind[SyntaxKind["MethodSignature"] = 147] = "MethodSignature";
+ SyntaxKind[SyntaxKind["MethodDeclaration"] = 148] = "MethodDeclaration";
+ SyntaxKind[SyntaxKind["Constructor"] = 149] = "Constructor";
+ SyntaxKind[SyntaxKind["GetAccessor"] = 150] = "GetAccessor";
+ SyntaxKind[SyntaxKind["SetAccessor"] = 151] = "SetAccessor";
+ SyntaxKind[SyntaxKind["CallSignature"] = 152] = "CallSignature";
+ SyntaxKind[SyntaxKind["ConstructSignature"] = 153] = "ConstructSignature";
+ SyntaxKind[SyntaxKind["IndexSignature"] = 154] = "IndexSignature";
+ SyntaxKind[SyntaxKind["TypePredicate"] = 155] = "TypePredicate";
+ SyntaxKind[SyntaxKind["TypeReference"] = 156] = "TypeReference";
+ SyntaxKind[SyntaxKind["FunctionType"] = 157] = "FunctionType";
+ SyntaxKind[SyntaxKind["ConstructorType"] = 158] = "ConstructorType";
+ SyntaxKind[SyntaxKind["TypeQuery"] = 159] = "TypeQuery";
+ SyntaxKind[SyntaxKind["TypeLiteral"] = 160] = "TypeLiteral";
+ SyntaxKind[SyntaxKind["ArrayType"] = 161] = "ArrayType";
+ SyntaxKind[SyntaxKind["TupleType"] = 162] = "TupleType";
+ SyntaxKind[SyntaxKind["UnionType"] = 163] = "UnionType";
+ SyntaxKind[SyntaxKind["IntersectionType"] = 164] = "IntersectionType";
+ SyntaxKind[SyntaxKind["ParenthesizedType"] = 165] = "ParenthesizedType";
+ SyntaxKind[SyntaxKind["ThisType"] = 166] = "ThisType";
+ SyntaxKind[SyntaxKind["LiteralType"] = 167] = "LiteralType";
+ SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 168] = "ObjectBindingPattern";
+ SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 169] = "ArrayBindingPattern";
+ SyntaxKind[SyntaxKind["BindingElement"] = 170] = "BindingElement";
+ SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 171] = "ArrayLiteralExpression";
+ SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 172] = "ObjectLiteralExpression";
+ SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 173] = "PropertyAccessExpression";
+ SyntaxKind[SyntaxKind["ElementAccessExpression"] = 174] = "ElementAccessExpression";
+ SyntaxKind[SyntaxKind["CallExpression"] = 175] = "CallExpression";
+ SyntaxKind[SyntaxKind["NewExpression"] = 176] = "NewExpression";
+ SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 177] = "TaggedTemplateExpression";
+ SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 178] = "TypeAssertionExpression";
+ SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 179] = "ParenthesizedExpression";
+ SyntaxKind[SyntaxKind["FunctionExpression"] = 180] = "FunctionExpression";
+ SyntaxKind[SyntaxKind["ArrowFunction"] = 181] = "ArrowFunction";
+ SyntaxKind[SyntaxKind["DeleteExpression"] = 182] = "DeleteExpression";
+ SyntaxKind[SyntaxKind["TypeOfExpression"] = 183] = "TypeOfExpression";
+ SyntaxKind[SyntaxKind["VoidExpression"] = 184] = "VoidExpression";
+ SyntaxKind[SyntaxKind["AwaitExpression"] = 185] = "AwaitExpression";
+ SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 186] = "PrefixUnaryExpression";
+ SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 187] = "PostfixUnaryExpression";
+ SyntaxKind[SyntaxKind["BinaryExpression"] = 188] = "BinaryExpression";
+ SyntaxKind[SyntaxKind["ConditionalExpression"] = 189] = "ConditionalExpression";
+ SyntaxKind[SyntaxKind["TemplateExpression"] = 190] = "TemplateExpression";
+ SyntaxKind[SyntaxKind["YieldExpression"] = 191] = "YieldExpression";
+ SyntaxKind[SyntaxKind["SpreadElementExpression"] = 192] = "SpreadElementExpression";
+ SyntaxKind[SyntaxKind["ClassExpression"] = 193] = "ClassExpression";
+ SyntaxKind[SyntaxKind["OmittedExpression"] = 194] = "OmittedExpression";
+ SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 195] = "ExpressionWithTypeArguments";
+ SyntaxKind[SyntaxKind["AsExpression"] = 196] = "AsExpression";
+ SyntaxKind[SyntaxKind["NonNullExpression"] = 197] = "NonNullExpression";
+ SyntaxKind[SyntaxKind["TemplateSpan"] = 198] = "TemplateSpan";
+ SyntaxKind[SyntaxKind["SemicolonClassElement"] = 199] = "SemicolonClassElement";
+ SyntaxKind[SyntaxKind["Block"] = 200] = "Block";
+ SyntaxKind[SyntaxKind["VariableStatement"] = 201] = "VariableStatement";
+ SyntaxKind[SyntaxKind["EmptyStatement"] = 202] = "EmptyStatement";
+ SyntaxKind[SyntaxKind["ExpressionStatement"] = 203] = "ExpressionStatement";
+ SyntaxKind[SyntaxKind["IfStatement"] = 204] = "IfStatement";
+ SyntaxKind[SyntaxKind["DoStatement"] = 205] = "DoStatement";
+ SyntaxKind[SyntaxKind["WhileStatement"] = 206] = "WhileStatement";
+ SyntaxKind[SyntaxKind["ForStatement"] = 207] = "ForStatement";
+ SyntaxKind[SyntaxKind["ForInStatement"] = 208] = "ForInStatement";
+ SyntaxKind[SyntaxKind["ForOfStatement"] = 209] = "ForOfStatement";
+ SyntaxKind[SyntaxKind["ContinueStatement"] = 210] = "ContinueStatement";
+ SyntaxKind[SyntaxKind["BreakStatement"] = 211] = "BreakStatement";
+ SyntaxKind[SyntaxKind["ReturnStatement"] = 212] = "ReturnStatement";
+ SyntaxKind[SyntaxKind["WithStatement"] = 213] = "WithStatement";
+ SyntaxKind[SyntaxKind["SwitchStatement"] = 214] = "SwitchStatement";
+ SyntaxKind[SyntaxKind["LabeledStatement"] = 215] = "LabeledStatement";
+ SyntaxKind[SyntaxKind["ThrowStatement"] = 216] = "ThrowStatement";
+ SyntaxKind[SyntaxKind["TryStatement"] = 217] = "TryStatement";
+ SyntaxKind[SyntaxKind["DebuggerStatement"] = 218] = "DebuggerStatement";
+ SyntaxKind[SyntaxKind["VariableDeclaration"] = 219] = "VariableDeclaration";
+ SyntaxKind[SyntaxKind["VariableDeclarationList"] = 220] = "VariableDeclarationList";
+ SyntaxKind[SyntaxKind["FunctionDeclaration"] = 221] = "FunctionDeclaration";
+ SyntaxKind[SyntaxKind["ClassDeclaration"] = 222] = "ClassDeclaration";
+ SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 223] = "InterfaceDeclaration";
+ SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 224] = "TypeAliasDeclaration";
+ SyntaxKind[SyntaxKind["EnumDeclaration"] = 225] = "EnumDeclaration";
+ SyntaxKind[SyntaxKind["ModuleDeclaration"] = 226] = "ModuleDeclaration";
+ SyntaxKind[SyntaxKind["ModuleBlock"] = 227] = "ModuleBlock";
+ SyntaxKind[SyntaxKind["CaseBlock"] = 228] = "CaseBlock";
+ SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 229] = "NamespaceExportDeclaration";
+ SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 230] = "ImportEqualsDeclaration";
+ SyntaxKind[SyntaxKind["ImportDeclaration"] = 231] = "ImportDeclaration";
+ SyntaxKind[SyntaxKind["ImportClause"] = 232] = "ImportClause";
+ SyntaxKind[SyntaxKind["NamespaceImport"] = 233] = "NamespaceImport";
+ SyntaxKind[SyntaxKind["NamedImports"] = 234] = "NamedImports";
+ SyntaxKind[SyntaxKind["ImportSpecifier"] = 235] = "ImportSpecifier";
+ SyntaxKind[SyntaxKind["ExportAssignment"] = 236] = "ExportAssignment";
+ SyntaxKind[SyntaxKind["ExportDeclaration"] = 237] = "ExportDeclaration";
+ SyntaxKind[SyntaxKind["NamedExports"] = 238] = "NamedExports";
+ SyntaxKind[SyntaxKind["ExportSpecifier"] = 239] = "ExportSpecifier";
+ SyntaxKind[SyntaxKind["MissingDeclaration"] = 240] = "MissingDeclaration";
+ SyntaxKind[SyntaxKind["ExternalModuleReference"] = 241] = "ExternalModuleReference";
+ SyntaxKind[SyntaxKind["JsxElement"] = 242] = "JsxElement";
+ SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 243] = "JsxSelfClosingElement";
+ SyntaxKind[SyntaxKind["JsxOpeningElement"] = 244] = "JsxOpeningElement";
+ SyntaxKind[SyntaxKind["JsxClosingElement"] = 245] = "JsxClosingElement";
+ SyntaxKind[SyntaxKind["JsxAttribute"] = 246] = "JsxAttribute";
+ SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 247] = "JsxSpreadAttribute";
+ SyntaxKind[SyntaxKind["JsxExpression"] = 248] = "JsxExpression";
+ SyntaxKind[SyntaxKind["CaseClause"] = 249] = "CaseClause";
+ SyntaxKind[SyntaxKind["DefaultClause"] = 250] = "DefaultClause";
+ SyntaxKind[SyntaxKind["HeritageClause"] = 251] = "HeritageClause";
+ SyntaxKind[SyntaxKind["CatchClause"] = 252] = "CatchClause";
+ SyntaxKind[SyntaxKind["PropertyAssignment"] = 253] = "PropertyAssignment";
+ SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 254] = "ShorthandPropertyAssignment";
+ SyntaxKind[SyntaxKind["EnumMember"] = 255] = "EnumMember";
+ SyntaxKind[SyntaxKind["SourceFile"] = 256] = "SourceFile";
+ SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 257] = "JSDocTypeExpression";
+ SyntaxKind[SyntaxKind["JSDocAllType"] = 258] = "JSDocAllType";
+ SyntaxKind[SyntaxKind["JSDocUnknownType"] = 259] = "JSDocUnknownType";
+ SyntaxKind[SyntaxKind["JSDocArrayType"] = 260] = "JSDocArrayType";
+ SyntaxKind[SyntaxKind["JSDocUnionType"] = 261] = "JSDocUnionType";
+ SyntaxKind[SyntaxKind["JSDocTupleType"] = 262] = "JSDocTupleType";
+ SyntaxKind[SyntaxKind["JSDocNullableType"] = 263] = "JSDocNullableType";
+ SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 264] = "JSDocNonNullableType";
+ SyntaxKind[SyntaxKind["JSDocRecordType"] = 265] = "JSDocRecordType";
+ SyntaxKind[SyntaxKind["JSDocRecordMember"] = 266] = "JSDocRecordMember";
+ SyntaxKind[SyntaxKind["JSDocTypeReference"] = 267] = "JSDocTypeReference";
+ SyntaxKind[SyntaxKind["JSDocOptionalType"] = 268] = "JSDocOptionalType";
+ SyntaxKind[SyntaxKind["JSDocFunctionType"] = 269] = "JSDocFunctionType";
+ SyntaxKind[SyntaxKind["JSDocVariadicType"] = 270] = "JSDocVariadicType";
+ SyntaxKind[SyntaxKind["JSDocConstructorType"] = 271] = "JSDocConstructorType";
+ SyntaxKind[SyntaxKind["JSDocThisType"] = 272] = "JSDocThisType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 273] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 274] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 275] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 276] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 277] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 278] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 279] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 280] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 281] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocLiteralType"] = 282] = "JSDocLiteralType";
+ SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 283] = "JSDocNullKeyword";
+ SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 284] = "JSDocUndefinedKeyword";
+ SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 285] = "JSDocNeverKeyword";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 286] = "SyntaxList";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 287] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 288] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["Count"] = 289] = "Count";
+ SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment";
+ SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment";
+ SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 58] = "FirstCompoundAssignment";
+ SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 69] = "LastCompoundAssignment";
+ SyntaxKind[SyntaxKind["FirstReservedWord"] = 71] = "FirstReservedWord";
+ SyntaxKind[SyntaxKind["LastReservedWord"] = 106] = "LastReservedWord";
+ SyntaxKind[SyntaxKind["FirstKeyword"] = 71] = "FirstKeyword";
+ SyntaxKind[SyntaxKind["LastKeyword"] = 139] = "LastKeyword";
+ SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 107] = "FirstFutureReservedWord";
+ SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 115] = "LastFutureReservedWord";
+ SyntaxKind[SyntaxKind["FirstTypeNode"] = 155] = "FirstTypeNode";
+ SyntaxKind[SyntaxKind["LastTypeNode"] = 167] = "LastTypeNode";
+ SyntaxKind[SyntaxKind["FirstPunctuation"] = 16] = "FirstPunctuation";
+ SyntaxKind[SyntaxKind["LastPunctuation"] = 69] = "LastPunctuation";
+ SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken";
+ SyntaxKind[SyntaxKind["LastToken"] = 139] = "LastToken";
+ SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken";
+ SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken";
+ SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken";
+ SyntaxKind[SyntaxKind["LastLiteralToken"] = 12] = "LastLiteralToken";
+ SyntaxKind[SyntaxKind["FirstTemplateToken"] = 12] = "FirstTemplateToken";
+ SyntaxKind[SyntaxKind["LastTemplateToken"] = 15] = "LastTemplateToken";
+ SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator";
+ SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator";
+ SyntaxKind[SyntaxKind["FirstNode"] = 140] = "FirstNode";
+ SyntaxKind[SyntaxKind["FirstJSDocNode"] = 257] = "FirstJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 282] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 273] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 285] = "LastJSDocTagNode";
+ })(ts.SyntaxKind || (ts.SyntaxKind = {}));
+ var SyntaxKind = ts.SyntaxKind;
+ (function (NodeFlags) {
+ NodeFlags[NodeFlags["None"] = 0] = "None";
+ NodeFlags[NodeFlags["Let"] = 1] = "Let";
+ NodeFlags[NodeFlags["Const"] = 2] = "Const";
+ NodeFlags[NodeFlags["NestedNamespace"] = 4] = "NestedNamespace";
+ NodeFlags[NodeFlags["Synthesized"] = 8] = "Synthesized";
+ NodeFlags[NodeFlags["Namespace"] = 16] = "Namespace";
+ NodeFlags[NodeFlags["ExportContext"] = 32] = "ExportContext";
+ NodeFlags[NodeFlags["ContainsThis"] = 64] = "ContainsThis";
+ NodeFlags[NodeFlags["HasImplicitReturn"] = 128] = "HasImplicitReturn";
+ NodeFlags[NodeFlags["HasExplicitReturn"] = 256] = "HasExplicitReturn";
+ NodeFlags[NodeFlags["GlobalAugmentation"] = 512] = "GlobalAugmentation";
+ NodeFlags[NodeFlags["HasClassExtends"] = 1024] = "HasClassExtends";
+ NodeFlags[NodeFlags["HasDecorators"] = 2048] = "HasDecorators";
+ NodeFlags[NodeFlags["HasParamDecorators"] = 4096] = "HasParamDecorators";
+ NodeFlags[NodeFlags["HasAsyncFunctions"] = 8192] = "HasAsyncFunctions";
+ NodeFlags[NodeFlags["HasJsxSpreadAttributes"] = 16384] = "HasJsxSpreadAttributes";
+ NodeFlags[NodeFlags["DisallowInContext"] = 32768] = "DisallowInContext";
+ NodeFlags[NodeFlags["YieldContext"] = 65536] = "YieldContext";
+ NodeFlags[NodeFlags["DecoratorContext"] = 131072] = "DecoratorContext";
+ NodeFlags[NodeFlags["AwaitContext"] = 262144] = "AwaitContext";
+ NodeFlags[NodeFlags["ThisNodeHasError"] = 524288] = "ThisNodeHasError";
+ NodeFlags[NodeFlags["JavaScriptFile"] = 1048576] = "JavaScriptFile";
+ NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 2097152] = "ThisNodeOrAnySubNodesHasError";
+ NodeFlags[NodeFlags["HasAggregatedChildData"] = 4194304] = "HasAggregatedChildData";
+ NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped";
+ NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags";
+ NodeFlags[NodeFlags["EmitHelperFlags"] = 31744] = "EmitHelperFlags";
+ NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 32128] = "ReachabilityAndEmitFlags";
+ NodeFlags[NodeFlags["ContextFlags"] = 1540096] = "ContextFlags";
+ NodeFlags[NodeFlags["TypeExcludesFlags"] = 327680] = "TypeExcludesFlags";
+ })(ts.NodeFlags || (ts.NodeFlags = {}));
+ var NodeFlags = ts.NodeFlags;
+ (function (ModifierFlags) {
+ ModifierFlags[ModifierFlags["None"] = 0] = "None";
+ ModifierFlags[ModifierFlags["Export"] = 1] = "Export";
+ ModifierFlags[ModifierFlags["Ambient"] = 2] = "Ambient";
+ ModifierFlags[ModifierFlags["Public"] = 4] = "Public";
+ ModifierFlags[ModifierFlags["Private"] = 8] = "Private";
+ ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected";
+ ModifierFlags[ModifierFlags["Static"] = 32] = "Static";
+ ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly";
+ ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract";
+ ModifierFlags[ModifierFlags["Async"] = 256] = "Async";
+ ModifierFlags[ModifierFlags["Default"] = 512] = "Default";
+ ModifierFlags[ModifierFlags["Const"] = 2048] = "Const";
+ ModifierFlags[ModifierFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
+ ModifierFlags[ModifierFlags["AccessibilityModifier"] = 28] = "AccessibilityModifier";
+ ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 92] = "ParameterPropertyModifier";
+ ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier";
+ ModifierFlags[ModifierFlags["TypeScriptModifier"] = 2270] = "TypeScriptModifier";
+ })(ts.ModifierFlags || (ts.ModifierFlags = {}));
+ var ModifierFlags = ts.ModifierFlags;
+ (function (JsxFlags) {
+ JsxFlags[JsxFlags["None"] = 0] = "None";
+ JsxFlags[JsxFlags["IntrinsicNamedElement"] = 1] = "IntrinsicNamedElement";
+ JsxFlags[JsxFlags["IntrinsicIndexedElement"] = 2] = "IntrinsicIndexedElement";
+ JsxFlags[JsxFlags["IntrinsicElement"] = 3] = "IntrinsicElement";
+ })(ts.JsxFlags || (ts.JsxFlags = {}));
+ var JsxFlags = ts.JsxFlags;
+ (function (RelationComparisonResult) {
+ RelationComparisonResult[RelationComparisonResult["Succeeded"] = 1] = "Succeeded";
+ RelationComparisonResult[RelationComparisonResult["Failed"] = 2] = "Failed";
+ RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported";
+ })(ts.RelationComparisonResult || (ts.RelationComparisonResult = {}));
+ var RelationComparisonResult = ts.RelationComparisonResult;
+ (function (GeneratedIdentifierKind) {
+ GeneratedIdentifierKind[GeneratedIdentifierKind["None"] = 0] = "None";
+ GeneratedIdentifierKind[GeneratedIdentifierKind["Auto"] = 1] = "Auto";
+ GeneratedIdentifierKind[GeneratedIdentifierKind["Loop"] = 2] = "Loop";
+ GeneratedIdentifierKind[GeneratedIdentifierKind["Unique"] = 3] = "Unique";
+ GeneratedIdentifierKind[GeneratedIdentifierKind["Node"] = 4] = "Node";
+ })(ts.GeneratedIdentifierKind || (ts.GeneratedIdentifierKind = {}));
+ var GeneratedIdentifierKind = ts.GeneratedIdentifierKind;
+ (function (FlowFlags) {
+ FlowFlags[FlowFlags["Unreachable"] = 1] = "Unreachable";
+ FlowFlags[FlowFlags["Start"] = 2] = "Start";
+ FlowFlags[FlowFlags["BranchLabel"] = 4] = "BranchLabel";
+ FlowFlags[FlowFlags["LoopLabel"] = 8] = "LoopLabel";
+ FlowFlags[FlowFlags["Assignment"] = 16] = "Assignment";
+ FlowFlags[FlowFlags["TrueCondition"] = 32] = "TrueCondition";
+ FlowFlags[FlowFlags["FalseCondition"] = 64] = "FalseCondition";
+ FlowFlags[FlowFlags["SwitchClause"] = 128] = "SwitchClause";
+ FlowFlags[FlowFlags["ArrayMutation"] = 256] = "ArrayMutation";
+ FlowFlags[FlowFlags["Referenced"] = 512] = "Referenced";
+ FlowFlags[FlowFlags["Shared"] = 1024] = "Shared";
+ FlowFlags[FlowFlags["Label"] = 12] = "Label";
+ FlowFlags[FlowFlags["Condition"] = 96] = "Condition";
+ })(ts.FlowFlags || (ts.FlowFlags = {}));
+ var FlowFlags = ts.FlowFlags;
var OperationCanceledException = (function () {
function OperationCanceledException() {
}
@@ -27,6 +439,38 @@ var ts;
ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated";
})(ts.ExitStatus || (ts.ExitStatus = {}));
var ExitStatus = ts.ExitStatus;
+ (function (TypeFormatFlags) {
+ TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None";
+ TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 1] = "WriteArrayAsGenericType";
+ TypeFormatFlags[TypeFormatFlags["UseTypeOfFunction"] = 2] = "UseTypeOfFunction";
+ TypeFormatFlags[TypeFormatFlags["NoTruncation"] = 4] = "NoTruncation";
+ TypeFormatFlags[TypeFormatFlags["WriteArrowStyleSignature"] = 8] = "WriteArrowStyleSignature";
+ TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 16] = "WriteOwnNameForAnyLike";
+ TypeFormatFlags[TypeFormatFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature";
+ TypeFormatFlags[TypeFormatFlags["InElementType"] = 64] = "InElementType";
+ TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType";
+ TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument";
+ TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias";
+ TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue";
+ })(ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));
+ var TypeFormatFlags = ts.TypeFormatFlags;
+ (function (SymbolFormatFlags) {
+ SymbolFormatFlags[SymbolFormatFlags["None"] = 0] = "None";
+ SymbolFormatFlags[SymbolFormatFlags["WriteTypeParametersOrArguments"] = 1] = "WriteTypeParametersOrArguments";
+ SymbolFormatFlags[SymbolFormatFlags["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing";
+ })(ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {}));
+ var SymbolFormatFlags = ts.SymbolFormatFlags;
+ (function (SymbolAccessibility) {
+ SymbolAccessibility[SymbolAccessibility["Accessible"] = 0] = "Accessible";
+ SymbolAccessibility[SymbolAccessibility["NotAccessible"] = 1] = "NotAccessible";
+ SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed";
+ })(ts.SymbolAccessibility || (ts.SymbolAccessibility = {}));
+ var SymbolAccessibility = ts.SymbolAccessibility;
+ (function (TypePredicateKind) {
+ TypePredicateKind[TypePredicateKind["This"] = 0] = "This";
+ TypePredicateKind[TypePredicateKind["Identifier"] = 1] = "Identifier";
+ })(ts.TypePredicateKind || (ts.TypePredicateKind = {}));
+ var TypePredicateKind = ts.TypePredicateKind;
(function (TypeReferenceSerializationKind) {
TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithConstructSignatureAndValue"] = 1] = "TypeWithConstructSignatureAndValue";
@@ -41,6 +485,166 @@ var ts;
TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 10] = "ObjectType";
})(ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));
var TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind;
+ (function (SymbolFlags) {
+ SymbolFlags[SymbolFlags["None"] = 0] = "None";
+ SymbolFlags[SymbolFlags["FunctionScopedVariable"] = 1] = "FunctionScopedVariable";
+ SymbolFlags[SymbolFlags["BlockScopedVariable"] = 2] = "BlockScopedVariable";
+ SymbolFlags[SymbolFlags["Property"] = 4] = "Property";
+ SymbolFlags[SymbolFlags["EnumMember"] = 8] = "EnumMember";
+ SymbolFlags[SymbolFlags["Function"] = 16] = "Function";
+ SymbolFlags[SymbolFlags["Class"] = 32] = "Class";
+ SymbolFlags[SymbolFlags["Interface"] = 64] = "Interface";
+ SymbolFlags[SymbolFlags["ConstEnum"] = 128] = "ConstEnum";
+ SymbolFlags[SymbolFlags["RegularEnum"] = 256] = "RegularEnum";
+ SymbolFlags[SymbolFlags["ValueModule"] = 512] = "ValueModule";
+ SymbolFlags[SymbolFlags["NamespaceModule"] = 1024] = "NamespaceModule";
+ SymbolFlags[SymbolFlags["TypeLiteral"] = 2048] = "TypeLiteral";
+ SymbolFlags[SymbolFlags["ObjectLiteral"] = 4096] = "ObjectLiteral";
+ SymbolFlags[SymbolFlags["Method"] = 8192] = "Method";
+ SymbolFlags[SymbolFlags["Constructor"] = 16384] = "Constructor";
+ SymbolFlags[SymbolFlags["GetAccessor"] = 32768] = "GetAccessor";
+ SymbolFlags[SymbolFlags["SetAccessor"] = 65536] = "SetAccessor";
+ SymbolFlags[SymbolFlags["Signature"] = 131072] = "Signature";
+ SymbolFlags[SymbolFlags["TypeParameter"] = 262144] = "TypeParameter";
+ SymbolFlags[SymbolFlags["TypeAlias"] = 524288] = "TypeAlias";
+ SymbolFlags[SymbolFlags["ExportValue"] = 1048576] = "ExportValue";
+ SymbolFlags[SymbolFlags["ExportType"] = 2097152] = "ExportType";
+ SymbolFlags[SymbolFlags["ExportNamespace"] = 4194304] = "ExportNamespace";
+ SymbolFlags[SymbolFlags["Alias"] = 8388608] = "Alias";
+ SymbolFlags[SymbolFlags["Instantiated"] = 16777216] = "Instantiated";
+ SymbolFlags[SymbolFlags["Merged"] = 33554432] = "Merged";
+ SymbolFlags[SymbolFlags["Transient"] = 67108864] = "Transient";
+ SymbolFlags[SymbolFlags["Prototype"] = 134217728] = "Prototype";
+ SymbolFlags[SymbolFlags["SyntheticProperty"] = 268435456] = "SyntheticProperty";
+ SymbolFlags[SymbolFlags["Optional"] = 536870912] = "Optional";
+ SymbolFlags[SymbolFlags["ExportStar"] = 1073741824] = "ExportStar";
+ SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum";
+ SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable";
+ SymbolFlags[SymbolFlags["Value"] = 107455] = "Value";
+ SymbolFlags[SymbolFlags["Type"] = 793064] = "Type";
+ SymbolFlags[SymbolFlags["Namespace"] = 1920] = "Namespace";
+ SymbolFlags[SymbolFlags["Module"] = 1536] = "Module";
+ SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor";
+ SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 107454] = "FunctionScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 107455] = "BlockScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["ParameterExcludes"] = 107455] = "ParameterExcludes";
+ SymbolFlags[SymbolFlags["PropertyExcludes"] = 0] = "PropertyExcludes";
+ SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 900095] = "EnumMemberExcludes";
+ SymbolFlags[SymbolFlags["FunctionExcludes"] = 106927] = "FunctionExcludes";
+ SymbolFlags[SymbolFlags["ClassExcludes"] = 899519] = "ClassExcludes";
+ SymbolFlags[SymbolFlags["InterfaceExcludes"] = 792968] = "InterfaceExcludes";
+ SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes";
+ SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes";
+ SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 106639] = "ValueModuleExcludes";
+ SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes";
+ SymbolFlags[SymbolFlags["MethodExcludes"] = 99263] = "MethodExcludes";
+ SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 41919] = "GetAccessorExcludes";
+ SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 74687] = "SetAccessorExcludes";
+ SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 530920] = "TypeParameterExcludes";
+ SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 793064] = "TypeAliasExcludes";
+ SymbolFlags[SymbolFlags["AliasExcludes"] = 8388608] = "AliasExcludes";
+ SymbolFlags[SymbolFlags["ModuleMember"] = 8914931] = "ModuleMember";
+ SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal";
+ SymbolFlags[SymbolFlags["HasExports"] = 1952] = "HasExports";
+ SymbolFlags[SymbolFlags["HasMembers"] = 6240] = "HasMembers";
+ SymbolFlags[SymbolFlags["BlockScoped"] = 418] = "BlockScoped";
+ SymbolFlags[SymbolFlags["PropertyOrAccessor"] = 98308] = "PropertyOrAccessor";
+ SymbolFlags[SymbolFlags["Export"] = 7340032] = "Export";
+ SymbolFlags[SymbolFlags["ClassMember"] = 106500] = "ClassMember";
+ SymbolFlags[SymbolFlags["Classifiable"] = 788448] = "Classifiable";
+ })(ts.SymbolFlags || (ts.SymbolFlags = {}));
+ var SymbolFlags = ts.SymbolFlags;
+ (function (NodeCheckFlags) {
+ NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked";
+ NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis";
+ NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis";
+ NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance";
+ NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic";
+ NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked";
+ NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper";
+ NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding";
+ NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments";
+ NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed";
+ NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass";
+ NodeCheckFlags[NodeCheckFlags["LoopWithCapturedBlockScopedBinding"] = 65536] = "LoopWithCapturedBlockScopedBinding";
+ NodeCheckFlags[NodeCheckFlags["CapturedBlockScopedBinding"] = 131072] = "CapturedBlockScopedBinding";
+ NodeCheckFlags[NodeCheckFlags["BlockScopedBindingInLoop"] = 262144] = "BlockScopedBindingInLoop";
+ NodeCheckFlags[NodeCheckFlags["ClassWithBodyScopedClassBinding"] = 524288] = "ClassWithBodyScopedClassBinding";
+ NodeCheckFlags[NodeCheckFlags["BodyScopedClassBinding"] = 1048576] = "BodyScopedClassBinding";
+ NodeCheckFlags[NodeCheckFlags["NeedsLoopOutParameter"] = 2097152] = "NeedsLoopOutParameter";
+ NodeCheckFlags[NodeCheckFlags["AssignmentsMarked"] = 4194304] = "AssignmentsMarked";
+ NodeCheckFlags[NodeCheckFlags["ClassWithConstructorReference"] = 8388608] = "ClassWithConstructorReference";
+ NodeCheckFlags[NodeCheckFlags["ConstructorReferenceInClass"] = 16777216] = "ConstructorReferenceInClass";
+ })(ts.NodeCheckFlags || (ts.NodeCheckFlags = {}));
+ var NodeCheckFlags = ts.NodeCheckFlags;
+ (function (TypeFlags) {
+ TypeFlags[TypeFlags["Any"] = 1] = "Any";
+ TypeFlags[TypeFlags["String"] = 2] = "String";
+ TypeFlags[TypeFlags["Number"] = 4] = "Number";
+ TypeFlags[TypeFlags["Boolean"] = 8] = "Boolean";
+ TypeFlags[TypeFlags["Enum"] = 16] = "Enum";
+ TypeFlags[TypeFlags["StringLiteral"] = 32] = "StringLiteral";
+ TypeFlags[TypeFlags["NumberLiteral"] = 64] = "NumberLiteral";
+ TypeFlags[TypeFlags["BooleanLiteral"] = 128] = "BooleanLiteral";
+ TypeFlags[TypeFlags["EnumLiteral"] = 256] = "EnumLiteral";
+ TypeFlags[TypeFlags["ESSymbol"] = 512] = "ESSymbol";
+ TypeFlags[TypeFlags["Void"] = 1024] = "Void";
+ TypeFlags[TypeFlags["Undefined"] = 2048] = "Undefined";
+ TypeFlags[TypeFlags["Null"] = 4096] = "Null";
+ TypeFlags[TypeFlags["Never"] = 8192] = "Never";
+ TypeFlags[TypeFlags["TypeParameter"] = 16384] = "TypeParameter";
+ TypeFlags[TypeFlags["Class"] = 32768] = "Class";
+ TypeFlags[TypeFlags["Interface"] = 65536] = "Interface";
+ TypeFlags[TypeFlags["Reference"] = 131072] = "Reference";
+ TypeFlags[TypeFlags["Tuple"] = 262144] = "Tuple";
+ TypeFlags[TypeFlags["Union"] = 524288] = "Union";
+ TypeFlags[TypeFlags["Intersection"] = 1048576] = "Intersection";
+ TypeFlags[TypeFlags["Anonymous"] = 2097152] = "Anonymous";
+ TypeFlags[TypeFlags["Instantiated"] = 4194304] = "Instantiated";
+ TypeFlags[TypeFlags["ObjectLiteral"] = 8388608] = "ObjectLiteral";
+ TypeFlags[TypeFlags["FreshLiteral"] = 16777216] = "FreshLiteral";
+ TypeFlags[TypeFlags["ContainsWideningType"] = 33554432] = "ContainsWideningType";
+ TypeFlags[TypeFlags["ContainsObjectLiteral"] = 67108864] = "ContainsObjectLiteral";
+ TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 134217728] = "ContainsAnyFunctionType";
+ TypeFlags[TypeFlags["Nullable"] = 6144] = "Nullable";
+ TypeFlags[TypeFlags["Literal"] = 480] = "Literal";
+ TypeFlags[TypeFlags["StringOrNumberLiteral"] = 96] = "StringOrNumberLiteral";
+ TypeFlags[TypeFlags["DefinitelyFalsy"] = 7392] = "DefinitelyFalsy";
+ TypeFlags[TypeFlags["PossiblyFalsy"] = 7406] = "PossiblyFalsy";
+ TypeFlags[TypeFlags["Intrinsic"] = 16015] = "Intrinsic";
+ TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive";
+ TypeFlags[TypeFlags["StringLike"] = 34] = "StringLike";
+ TypeFlags[TypeFlags["NumberLike"] = 340] = "NumberLike";
+ TypeFlags[TypeFlags["BooleanLike"] = 136] = "BooleanLike";
+ TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike";
+ TypeFlags[TypeFlags["ObjectType"] = 2588672] = "ObjectType";
+ TypeFlags[TypeFlags["UnionOrIntersection"] = 1572864] = "UnionOrIntersection";
+ TypeFlags[TypeFlags["StructuredType"] = 4161536] = "StructuredType";
+ TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 4177920] = "StructuredOrTypeParameter";
+ TypeFlags[TypeFlags["Narrowable"] = 4178943] = "Narrowable";
+ TypeFlags[TypeFlags["NotUnionOrUnit"] = 2589185] = "NotUnionOrUnit";
+ TypeFlags[TypeFlags["RequiresWidening"] = 100663296] = "RequiresWidening";
+ TypeFlags[TypeFlags["PropagatingFlags"] = 234881024] = "PropagatingFlags";
+ })(ts.TypeFlags || (ts.TypeFlags = {}));
+ var TypeFlags = ts.TypeFlags;
+ (function (SignatureKind) {
+ SignatureKind[SignatureKind["Call"] = 0] = "Call";
+ SignatureKind[SignatureKind["Construct"] = 1] = "Construct";
+ })(ts.SignatureKind || (ts.SignatureKind = {}));
+ var SignatureKind = ts.SignatureKind;
+ (function (IndexKind) {
+ IndexKind[IndexKind["String"] = 0] = "String";
+ IndexKind[IndexKind["Number"] = 1] = "Number";
+ })(ts.IndexKind || (ts.IndexKind = {}));
+ var IndexKind = ts.IndexKind;
+ (function (SpecialPropertyAssignmentKind) {
+ SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["None"] = 0] = "None";
+ SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ExportsProperty"] = 1] = "ExportsProperty";
+ SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ModuleExports"] = 2] = "ModuleExports";
+ SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["PrototypeProperty"] = 3] = "PrototypeProperty";
+ SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ThisProperty"] = 4] = "ThisProperty";
+ })(ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {}));
+ var SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind;
(function (DiagnosticCategory) {
DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
@@ -58,10 +662,267 @@ var ts;
ModuleKind[ModuleKind["AMD"] = 2] = "AMD";
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
ModuleKind[ModuleKind["System"] = 4] = "System";
- ModuleKind[ModuleKind["ES6"] = 5] = "ES6";
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
})(ts.ModuleKind || (ts.ModuleKind = {}));
var ModuleKind = ts.ModuleKind;
+ (function (JsxEmit) {
+ JsxEmit[JsxEmit["None"] = 0] = "None";
+ JsxEmit[JsxEmit["Preserve"] = 1] = "Preserve";
+ JsxEmit[JsxEmit["React"] = 2] = "React";
+ })(ts.JsxEmit || (ts.JsxEmit = {}));
+ var JsxEmit = ts.JsxEmit;
+ (function (NewLineKind) {
+ NewLineKind[NewLineKind["CarriageReturnLineFeed"] = 0] = "CarriageReturnLineFeed";
+ NewLineKind[NewLineKind["LineFeed"] = 1] = "LineFeed";
+ })(ts.NewLineKind || (ts.NewLineKind = {}));
+ var NewLineKind = ts.NewLineKind;
+ (function (ScriptKind) {
+ ScriptKind[ScriptKind["Unknown"] = 0] = "Unknown";
+ ScriptKind[ScriptKind["JS"] = 1] = "JS";
+ ScriptKind[ScriptKind["JSX"] = 2] = "JSX";
+ ScriptKind[ScriptKind["TS"] = 3] = "TS";
+ ScriptKind[ScriptKind["TSX"] = 4] = "TSX";
+ })(ts.ScriptKind || (ts.ScriptKind = {}));
+ var ScriptKind = ts.ScriptKind;
+ (function (ScriptTarget) {
+ ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3";
+ ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5";
+ ScriptTarget[ScriptTarget["ES2015"] = 2] = "ES2015";
+ ScriptTarget[ScriptTarget["ES2016"] = 3] = "ES2016";
+ ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017";
+ ScriptTarget[ScriptTarget["Latest"] = 4] = "Latest";
+ })(ts.ScriptTarget || (ts.ScriptTarget = {}));
+ var ScriptTarget = ts.ScriptTarget;
+ (function (LanguageVariant) {
+ LanguageVariant[LanguageVariant["Standard"] = 0] = "Standard";
+ LanguageVariant[LanguageVariant["JSX"] = 1] = "JSX";
+ })(ts.LanguageVariant || (ts.LanguageVariant = {}));
+ var LanguageVariant = ts.LanguageVariant;
+ (function (DiagnosticStyle) {
+ DiagnosticStyle[DiagnosticStyle["Simple"] = 0] = "Simple";
+ DiagnosticStyle[DiagnosticStyle["Pretty"] = 1] = "Pretty";
+ })(ts.DiagnosticStyle || (ts.DiagnosticStyle = {}));
+ var DiagnosticStyle = ts.DiagnosticStyle;
+ (function (WatchDirectoryFlags) {
+ WatchDirectoryFlags[WatchDirectoryFlags["None"] = 0] = "None";
+ WatchDirectoryFlags[WatchDirectoryFlags["Recursive"] = 1] = "Recursive";
+ })(ts.WatchDirectoryFlags || (ts.WatchDirectoryFlags = {}));
+ var WatchDirectoryFlags = ts.WatchDirectoryFlags;
+ (function (CharacterCodes) {
+ CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter";
+ CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter";
+ CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed";
+ CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn";
+ CharacterCodes[CharacterCodes["lineSeparator"] = 8232] = "lineSeparator";
+ CharacterCodes[CharacterCodes["paragraphSeparator"] = 8233] = "paragraphSeparator";
+ CharacterCodes[CharacterCodes["nextLine"] = 133] = "nextLine";
+ CharacterCodes[CharacterCodes["space"] = 32] = "space";
+ CharacterCodes[CharacterCodes["nonBreakingSpace"] = 160] = "nonBreakingSpace";
+ CharacterCodes[CharacterCodes["enQuad"] = 8192] = "enQuad";
+ CharacterCodes[CharacterCodes["emQuad"] = 8193] = "emQuad";
+ CharacterCodes[CharacterCodes["enSpace"] = 8194] = "enSpace";
+ CharacterCodes[CharacterCodes["emSpace"] = 8195] = "emSpace";
+ CharacterCodes[CharacterCodes["threePerEmSpace"] = 8196] = "threePerEmSpace";
+ CharacterCodes[CharacterCodes["fourPerEmSpace"] = 8197] = "fourPerEmSpace";
+ CharacterCodes[CharacterCodes["sixPerEmSpace"] = 8198] = "sixPerEmSpace";
+ CharacterCodes[CharacterCodes["figureSpace"] = 8199] = "figureSpace";
+ CharacterCodes[CharacterCodes["punctuationSpace"] = 8200] = "punctuationSpace";
+ CharacterCodes[CharacterCodes["thinSpace"] = 8201] = "thinSpace";
+ CharacterCodes[CharacterCodes["hairSpace"] = 8202] = "hairSpace";
+ CharacterCodes[CharacterCodes["zeroWidthSpace"] = 8203] = "zeroWidthSpace";
+ CharacterCodes[CharacterCodes["narrowNoBreakSpace"] = 8239] = "narrowNoBreakSpace";
+ CharacterCodes[CharacterCodes["ideographicSpace"] = 12288] = "ideographicSpace";
+ CharacterCodes[CharacterCodes["mathematicalSpace"] = 8287] = "mathematicalSpace";
+ CharacterCodes[CharacterCodes["ogham"] = 5760] = "ogham";
+ CharacterCodes[CharacterCodes["_"] = 95] = "_";
+ CharacterCodes[CharacterCodes["$"] = 36] = "$";
+ CharacterCodes[CharacterCodes["_0"] = 48] = "_0";
+ CharacterCodes[CharacterCodes["_1"] = 49] = "_1";
+ CharacterCodes[CharacterCodes["_2"] = 50] = "_2";
+ CharacterCodes[CharacterCodes["_3"] = 51] = "_3";
+ CharacterCodes[CharacterCodes["_4"] = 52] = "_4";
+ CharacterCodes[CharacterCodes["_5"] = 53] = "_5";
+ CharacterCodes[CharacterCodes["_6"] = 54] = "_6";
+ CharacterCodes[CharacterCodes["_7"] = 55] = "_7";
+ CharacterCodes[CharacterCodes["_8"] = 56] = "_8";
+ CharacterCodes[CharacterCodes["_9"] = 57] = "_9";
+ CharacterCodes[CharacterCodes["a"] = 97] = "a";
+ CharacterCodes[CharacterCodes["b"] = 98] = "b";
+ CharacterCodes[CharacterCodes["c"] = 99] = "c";
+ CharacterCodes[CharacterCodes["d"] = 100] = "d";
+ CharacterCodes[CharacterCodes["e"] = 101] = "e";
+ CharacterCodes[CharacterCodes["f"] = 102] = "f";
+ CharacterCodes[CharacterCodes["g"] = 103] = "g";
+ CharacterCodes[CharacterCodes["h"] = 104] = "h";
+ CharacterCodes[CharacterCodes["i"] = 105] = "i";
+ CharacterCodes[CharacterCodes["j"] = 106] = "j";
+ CharacterCodes[CharacterCodes["k"] = 107] = "k";
+ CharacterCodes[CharacterCodes["l"] = 108] = "l";
+ CharacterCodes[CharacterCodes["m"] = 109] = "m";
+ CharacterCodes[CharacterCodes["n"] = 110] = "n";
+ CharacterCodes[CharacterCodes["o"] = 111] = "o";
+ CharacterCodes[CharacterCodes["p"] = 112] = "p";
+ CharacterCodes[CharacterCodes["q"] = 113] = "q";
+ CharacterCodes[CharacterCodes["r"] = 114] = "r";
+ CharacterCodes[CharacterCodes["s"] = 115] = "s";
+ CharacterCodes[CharacterCodes["t"] = 116] = "t";
+ CharacterCodes[CharacterCodes["u"] = 117] = "u";
+ CharacterCodes[CharacterCodes["v"] = 118] = "v";
+ CharacterCodes[CharacterCodes["w"] = 119] = "w";
+ CharacterCodes[CharacterCodes["x"] = 120] = "x";
+ CharacterCodes[CharacterCodes["y"] = 121] = "y";
+ CharacterCodes[CharacterCodes["z"] = 122] = "z";
+ CharacterCodes[CharacterCodes["A"] = 65] = "A";
+ CharacterCodes[CharacterCodes["B"] = 66] = "B";
+ CharacterCodes[CharacterCodes["C"] = 67] = "C";
+ CharacterCodes[CharacterCodes["D"] = 68] = "D";
+ CharacterCodes[CharacterCodes["E"] = 69] = "E";
+ CharacterCodes[CharacterCodes["F"] = 70] = "F";
+ CharacterCodes[CharacterCodes["G"] = 71] = "G";
+ CharacterCodes[CharacterCodes["H"] = 72] = "H";
+ CharacterCodes[CharacterCodes["I"] = 73] = "I";
+ CharacterCodes[CharacterCodes["J"] = 74] = "J";
+ CharacterCodes[CharacterCodes["K"] = 75] = "K";
+ CharacterCodes[CharacterCodes["L"] = 76] = "L";
+ CharacterCodes[CharacterCodes["M"] = 77] = "M";
+ CharacterCodes[CharacterCodes["N"] = 78] = "N";
+ CharacterCodes[CharacterCodes["O"] = 79] = "O";
+ CharacterCodes[CharacterCodes["P"] = 80] = "P";
+ CharacterCodes[CharacterCodes["Q"] = 81] = "Q";
+ CharacterCodes[CharacterCodes["R"] = 82] = "R";
+ CharacterCodes[CharacterCodes["S"] = 83] = "S";
+ CharacterCodes[CharacterCodes["T"] = 84] = "T";
+ CharacterCodes[CharacterCodes["U"] = 85] = "U";
+ CharacterCodes[CharacterCodes["V"] = 86] = "V";
+ CharacterCodes[CharacterCodes["W"] = 87] = "W";
+ CharacterCodes[CharacterCodes["X"] = 88] = "X";
+ CharacterCodes[CharacterCodes["Y"] = 89] = "Y";
+ CharacterCodes[CharacterCodes["Z"] = 90] = "Z";
+ CharacterCodes[CharacterCodes["ampersand"] = 38] = "ampersand";
+ CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk";
+ CharacterCodes[CharacterCodes["at"] = 64] = "at";
+ CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash";
+ CharacterCodes[CharacterCodes["backtick"] = 96] = "backtick";
+ CharacterCodes[CharacterCodes["bar"] = 124] = "bar";
+ CharacterCodes[CharacterCodes["caret"] = 94] = "caret";
+ CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace";
+ CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket";
+ CharacterCodes[CharacterCodes["closeParen"] = 41] = "closeParen";
+ CharacterCodes[CharacterCodes["colon"] = 58] = "colon";
+ CharacterCodes[CharacterCodes["comma"] = 44] = "comma";
+ CharacterCodes[CharacterCodes["dot"] = 46] = "dot";
+ CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote";
+ CharacterCodes[CharacterCodes["equals"] = 61] = "equals";
+ CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation";
+ CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan";
+ CharacterCodes[CharacterCodes["hash"] = 35] = "hash";
+ CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan";
+ CharacterCodes[CharacterCodes["minus"] = 45] = "minus";
+ CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace";
+ CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket";
+ CharacterCodes[CharacterCodes["openParen"] = 40] = "openParen";
+ CharacterCodes[CharacterCodes["percent"] = 37] = "percent";
+ CharacterCodes[CharacterCodes["plus"] = 43] = "plus";
+ CharacterCodes[CharacterCodes["question"] = 63] = "question";
+ CharacterCodes[CharacterCodes["semicolon"] = 59] = "semicolon";
+ CharacterCodes[CharacterCodes["singleQuote"] = 39] = "singleQuote";
+ CharacterCodes[CharacterCodes["slash"] = 47] = "slash";
+ CharacterCodes[CharacterCodes["tilde"] = 126] = "tilde";
+ CharacterCodes[CharacterCodes["backspace"] = 8] = "backspace";
+ CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed";
+ CharacterCodes[CharacterCodes["byteOrderMark"] = 65279] = "byteOrderMark";
+ CharacterCodes[CharacterCodes["tab"] = 9] = "tab";
+ CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab";
+ })(ts.CharacterCodes || (ts.CharacterCodes = {}));
+ var CharacterCodes = ts.CharacterCodes;
+ (function (TransformFlags) {
+ TransformFlags[TransformFlags["None"] = 0] = "None";
+ TransformFlags[TransformFlags["TypeScript"] = 1] = "TypeScript";
+ TransformFlags[TransformFlags["ContainsTypeScript"] = 2] = "ContainsTypeScript";
+ TransformFlags[TransformFlags["Jsx"] = 4] = "Jsx";
+ TransformFlags[TransformFlags["ContainsJsx"] = 8] = "ContainsJsx";
+ TransformFlags[TransformFlags["ES2017"] = 16] = "ES2017";
+ TransformFlags[TransformFlags["ContainsES2017"] = 32] = "ContainsES2017";
+ TransformFlags[TransformFlags["ES2016"] = 64] = "ES2016";
+ TransformFlags[TransformFlags["ContainsES2016"] = 128] = "ContainsES2016";
+ TransformFlags[TransformFlags["ES2015"] = 256] = "ES2015";
+ TransformFlags[TransformFlags["ContainsES2015"] = 512] = "ContainsES2015";
+ TransformFlags[TransformFlags["DestructuringAssignment"] = 1024] = "DestructuringAssignment";
+ TransformFlags[TransformFlags["Generator"] = 2048] = "Generator";
+ TransformFlags[TransformFlags["ContainsGenerator"] = 4096] = "ContainsGenerator";
+ TransformFlags[TransformFlags["ContainsDecorators"] = 8192] = "ContainsDecorators";
+ TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 16384] = "ContainsPropertyInitializer";
+ TransformFlags[TransformFlags["ContainsLexicalThis"] = 32768] = "ContainsLexicalThis";
+ TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 65536] = "ContainsCapturedLexicalThis";
+ TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 131072] = "ContainsLexicalThisInComputedPropertyName";
+ TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 262144] = "ContainsDefaultValueAssignments";
+ TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 524288] = "ContainsParameterPropertyAssignments";
+ TransformFlags[TransformFlags["ContainsSpreadElementExpression"] = 1048576] = "ContainsSpreadElementExpression";
+ TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 2097152] = "ContainsComputedPropertyName";
+ TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 4194304] = "ContainsBlockScopedBinding";
+ TransformFlags[TransformFlags["ContainsBindingPattern"] = 8388608] = "ContainsBindingPattern";
+ TransformFlags[TransformFlags["ContainsYield"] = 16777216] = "ContainsYield";
+ TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 33554432] = "ContainsHoistedDeclarationOrCompletion";
+ TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
+ TransformFlags[TransformFlags["AssertTypeScript"] = 3] = "AssertTypeScript";
+ TransformFlags[TransformFlags["AssertJsx"] = 12] = "AssertJsx";
+ TransformFlags[TransformFlags["AssertES2017"] = 48] = "AssertES2017";
+ TransformFlags[TransformFlags["AssertES2016"] = 192] = "AssertES2016";
+ TransformFlags[TransformFlags["AssertES2015"] = 768] = "AssertES2015";
+ TransformFlags[TransformFlags["AssertGenerator"] = 6144] = "AssertGenerator";
+ TransformFlags[TransformFlags["NodeExcludes"] = 536874325] = "NodeExcludes";
+ TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 592227669] = "ArrowFunctionExcludes";
+ TransformFlags[TransformFlags["FunctionExcludes"] = 592293205] = "FunctionExcludes";
+ TransformFlags[TransformFlags["ConstructorExcludes"] = 591760725] = "ConstructorExcludes";
+ TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 591760725] = "MethodOrAccessorExcludes";
+ TransformFlags[TransformFlags["ClassExcludes"] = 539749717] = "ClassExcludes";
+ TransformFlags[TransformFlags["ModuleExcludes"] = 574729557] = "ModuleExcludes";
+ TransformFlags[TransformFlags["TypeExcludes"] = -3] = "TypeExcludes";
+ TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 539110741] = "ObjectLiteralExcludes";
+ TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 537922901] = "ArrayLiteralOrCallOrNewExcludes";
+ TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 545262933] = "VariableDeclarationListExcludes";
+ TransformFlags[TransformFlags["ParameterExcludes"] = 545262933] = "ParameterExcludes";
+ TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 548864] = "TypeScriptClassSyntaxMask";
+ TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 327680] = "ES2015FunctionSyntaxMask";
+ })(ts.TransformFlags || (ts.TransformFlags = {}));
+ var TransformFlags = ts.TransformFlags;
+ (function (EmitFlags) {
+ EmitFlags[EmitFlags["EmitEmitHelpers"] = 1] = "EmitEmitHelpers";
+ EmitFlags[EmitFlags["EmitExportStar"] = 2] = "EmitExportStar";
+ EmitFlags[EmitFlags["EmitSuperHelper"] = 4] = "EmitSuperHelper";
+ EmitFlags[EmitFlags["EmitAdvancedSuperHelper"] = 8] = "EmitAdvancedSuperHelper";
+ EmitFlags[EmitFlags["UMDDefine"] = 16] = "UMDDefine";
+ EmitFlags[EmitFlags["SingleLine"] = 32] = "SingleLine";
+ EmitFlags[EmitFlags["AdviseOnEmitNode"] = 64] = "AdviseOnEmitNode";
+ EmitFlags[EmitFlags["NoSubstitution"] = 128] = "NoSubstitution";
+ EmitFlags[EmitFlags["CapturesThis"] = 256] = "CapturesThis";
+ EmitFlags[EmitFlags["NoLeadingSourceMap"] = 512] = "NoLeadingSourceMap";
+ EmitFlags[EmitFlags["NoTrailingSourceMap"] = 1024] = "NoTrailingSourceMap";
+ EmitFlags[EmitFlags["NoSourceMap"] = 1536] = "NoSourceMap";
+ EmitFlags[EmitFlags["NoNestedSourceMaps"] = 2048] = "NoNestedSourceMaps";
+ EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 4096] = "NoTokenLeadingSourceMaps";
+ EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 8192] = "NoTokenTrailingSourceMaps";
+ EmitFlags[EmitFlags["NoTokenSourceMaps"] = 12288] = "NoTokenSourceMaps";
+ EmitFlags[EmitFlags["NoLeadingComments"] = 16384] = "NoLeadingComments";
+ EmitFlags[EmitFlags["NoTrailingComments"] = 32768] = "NoTrailingComments";
+ EmitFlags[EmitFlags["NoComments"] = 49152] = "NoComments";
+ EmitFlags[EmitFlags["NoNestedComments"] = 65536] = "NoNestedComments";
+ EmitFlags[EmitFlags["ExportName"] = 131072] = "ExportName";
+ EmitFlags[EmitFlags["LocalName"] = 262144] = "LocalName";
+ EmitFlags[EmitFlags["Indented"] = 524288] = "Indented";
+ EmitFlags[EmitFlags["NoIndentation"] = 1048576] = "NoIndentation";
+ EmitFlags[EmitFlags["AsyncFunctionBody"] = 2097152] = "AsyncFunctionBody";
+ EmitFlags[EmitFlags["ReuseTempVariableScope"] = 4194304] = "ReuseTempVariableScope";
+ EmitFlags[EmitFlags["CustomPrologue"] = 8388608] = "CustomPrologue";
+ })(ts.EmitFlags || (ts.EmitFlags = {}));
+ var EmitFlags = ts.EmitFlags;
+ (function (EmitContext) {
+ EmitContext[EmitContext["SourceFile"] = 0] = "SourceFile";
+ EmitContext[EmitContext["Expression"] = 1] = "Expression";
+ EmitContext[EmitContext["IdentifierName"] = 2] = "IdentifierName";
+ EmitContext[EmitContext["Unspecified"] = 3] = "Unspecified";
+ })(ts.EmitContext || (ts.EmitContext = {}));
+ var EmitContext = ts.EmitContext;
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -72,7 +933,7 @@ var ts;
(function (performance) {
var profilerEvent = typeof onProfilerEvent === "function" && onProfilerEvent.profiler === true
? onProfilerEvent
- : function (markName) { };
+ : function (_markName) { };
var enabled = false;
var profilerStart = 0;
var counts;
@@ -124,7 +985,14 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ (function (Ternary) {
+ Ternary[Ternary["False"] = 0] = "False";
+ Ternary[Ternary["Maybe"] = 1] = "Maybe";
+ Ternary[Ternary["True"] = -1] = "True";
+ })(ts.Ternary || (ts.Ternary = {}));
+ var Ternary = ts.Ternary;
var createObject = Object.create;
+ ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
function createMap(template) {
var map = createObject(null);
map["__"] = undefined;
@@ -145,7 +1013,7 @@ var ts;
remove: remove,
forEachValue: forEachValueInMap,
getKeys: getKeys,
- clear: clear
+ clear: clear,
};
function forEachValueInMap(f) {
for (var key in files) {
@@ -187,6 +1055,12 @@ var ts;
return getCanonicalFileName(nonCanonicalizedPath);
}
ts.toPath = toPath;
+ (function (Comparison) {
+ Comparison[Comparison["LessThan"] = -1] = "LessThan";
+ Comparison[Comparison["EqualTo"] = 0] = "EqualTo";
+ Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan";
+ })(ts.Comparison || (ts.Comparison = {}));
+ var Comparison = ts.Comparison;
function forEach(array, callback) {
if (array) {
for (var i = 0, len = array.length; i < len; i++) {
@@ -330,13 +1204,32 @@ var ts;
if (array) {
result = [];
for (var i = 0; i < array.length; i++) {
- var v = array[i];
- result.push(f(v, i));
+ result.push(f(array[i], i));
}
}
return result;
}
ts.map = map;
+ function sameMap(array, f) {
+ var result;
+ if (array) {
+ for (var i = 0; i < array.length; i++) {
+ if (result) {
+ result.push(f(array[i], i));
+ }
+ else {
+ var item = array[i];
+ var mapped = f(item, i);
+ if (item !== mapped) {
+ result = array.slice(0, i);
+ result.push(mapped);
+ }
+ }
+ }
+ }
+ return result || array;
+ }
+ ts.sameMap = sameMap;
function flatten(array) {
var result;
if (array) {
@@ -437,6 +1330,18 @@ var ts;
return result;
}
ts.mapObject = mapObject;
+ function some(array, predicate) {
+ if (array) {
+ for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {
+ var v = array_5[_i];
+ if (!predicate || predicate(v)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ ts.some = some;
function concatenate(array1, array2) {
if (!array2 || !array2.length)
return array1;
@@ -449,8 +1354,8 @@ var ts;
var result;
if (array) {
result = [];
- loop: for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {
- var item = array_5[_i];
+ loop: for (var _i = 0, array_6 = array; _i < array_6.length; _i++) {
+ var item = array_6[_i];
for (var _a = 0, result_1 = result; _a < result_1.length; _a++) {
var res = result_1[_a];
if (areEqual ? areEqual(res, item) : res === item) {
@@ -483,8 +1388,8 @@ var ts;
ts.compact = compact;
function sum(array, prop) {
var result = 0;
- for (var _i = 0, array_6 = array; _i < array_6.length; _i++) {
- var v = array_6[_i];
+ for (var _i = 0, array_7 = array; _i < array_7.length; _i++) {
+ var v = array_7[_i];
result += v[prop];
}
return result;
@@ -703,8 +1608,8 @@ var ts;
ts.equalOwnProperties = equalOwnProperties;
function arrayToMap(array, makeKey, makeValue) {
var result = createMap();
- for (var _i = 0, array_7 = array; _i < array_7.length; _i++) {
- var value = array_7[_i];
+ for (var _i = 0, array_8 = array; _i < array_8.length; _i++) {
+ var value = array_8[_i];
result[makeKey(value)] = makeValue ? makeValue(value) : value;
}
return result;
@@ -805,7 +1710,7 @@ var ts;
return function (t) { return compose(a(t)); };
}
else {
- return function (t) { return function (u) { return u; }; };
+ return function (_) { return function (u) { return u; }; };
}
}
ts.chain = chain;
@@ -836,7 +1741,7 @@ var ts;
ts.compose = compose;
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) {
@@ -861,11 +1766,11 @@ var ts;
length: length,
messageText: text,
category: message.category,
- code: message.code
+ code: message.code,
};
}
ts.createFileDiagnostic = createFileDiagnostic;
- function formatMessage(dummy, message) {
+ function formatMessage(_dummy, message) {
var text = getLocaleSpecificMessage(message);
if (arguments.length > 2) {
text = formatStringFromArgs(text, arguments, 2);
@@ -928,7 +1833,7 @@ var ts;
if (b === undefined)
return 1;
if (ignoreCase) {
- if (String.prototype.localeCompare) {
+ if (ts.collator && String.prototype.localeCompare) {
var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" });
return result < 0 ? -1 : result > 0 ? 1 : 0;
}
@@ -1081,7 +1986,7 @@ var ts;
function getEmitModuleKind(compilerOptions) {
return typeof compilerOptions.module === "number" ?
compilerOptions.module :
- getEmitScriptTarget(compilerOptions) === 2 ? ts.ModuleKind.ES6 : ts.ModuleKind.CommonJS;
+ getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
}
ts.getEmitModuleKind = getEmitModuleKind;
function hasZeroOrOneAsteriskCharacter(str) {
@@ -1378,7 +2283,7 @@ var ts;
function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {
return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
}
- function getFileMatcherPatterns(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {
+ function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {
path = normalizePath(path);
currentDirectory = normalizePath(currentDirectory);
var absolutePath = combinePaths(currentDirectory, path);
@@ -1393,7 +2298,7 @@ var ts;
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, getFileSystemEntries) {
path = normalizePath(path);
currentDirectory = normalizePath(currentDirectory);
- var patterns = getFileMatcherPatterns(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
+ var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
var regexFlag = useCaseSensitiveFileNames ? "" : "i";
var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag);
var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag);
@@ -1503,6 +2408,14 @@ var ts;
return false;
}
ts.isSupportedSourceFileName = isSupportedSourceFileName;
+ (function (ExtensionPriority) {
+ ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles";
+ ExtensionPriority[ExtensionPriority["DeclarationAndJavaScriptFiles"] = 2] = "DeclarationAndJavaScriptFiles";
+ ExtensionPriority[ExtensionPriority["Limit"] = 5] = "Limit";
+ ExtensionPriority[ExtensionPriority["Highest"] = 0] = "Highest";
+ ExtensionPriority[ExtensionPriority["Lowest"] = 2] = "Lowest";
+ })(ts.ExtensionPriority || (ts.ExtensionPriority = {}));
+ var ExtensionPriority = ts.ExtensionPriority;
function getExtensionPriority(path, supportedExtensions) {
for (var i = supportedExtensions.length - 1; i >= 0; i--) {
if (fileExtensionIs(path, supportedExtensions[i])) {
@@ -1566,10 +2479,10 @@ var ts;
this.name = name;
this.declarations = undefined;
}
- function Type(checker, flags) {
+ function Type(_checker, flags) {
this.flags = flags;
}
- function Signature(checker) {
+ function Signature() {
}
function Node(kind, pos, end) {
this.id = 0;
@@ -1591,6 +2504,13 @@ var ts;
getTypeConstructor: function () { return Type; },
getSignatureConstructor: function () { return Signature; }
};
+ (function (AssertionLevel) {
+ AssertionLevel[AssertionLevel["None"] = 0] = "None";
+ AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal";
+ AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive";
+ AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive";
+ })(ts.AssertionLevel || (ts.AssertionLevel = {}));
+ var AssertionLevel = ts.AssertionLevel;
var Debug;
(function (Debug) {
Debug.currentAssertionLevel = 0;
@@ -1903,7 +2823,7 @@ var ts;
}
var platform = _os.platform();
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
- function readFile(fileName, encoding) {
+ function readFile(fileName, _encoding) {
if (!fileExists(fileName)) {
return undefined;
}
@@ -1975,6 +2895,11 @@ var ts;
function readDirectory(path, extensions, excludes, includes) {
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), getAccessibleFileSystemEntries);
}
+ var FileSystemEntryKind;
+ (function (FileSystemEntryKind) {
+ FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File";
+ FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory";
+ })(FileSystemEntryKind || (FileSystemEntryKind = {}));
function fileSystemEntryExists(path, entryKind) {
try {
var stat = _fs.statSync(path);
@@ -2116,7 +3041,7 @@ var ts;
args: ChakraHost.args,
useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames,
write: ChakraHost.echo,
- readFile: function (path, encoding) {
+ readFile: function (path, _encoding) {
return ChakraHost.readFile(path);
},
writeFile: function (path, data, writeByteOrderMark) {
@@ -2132,9 +3057,9 @@ var ts;
getExecutingFilePath: function () { return ChakraHost.executingFile; },
getCurrentDirectory: function () { return ChakraHost.currentDirectory; },
getDirectories: ChakraHost.getDirectories,
- getEnvironmentVariable: ChakraHost.getEnvironmentVariable || (function (name) { return ""; }),
+ getEnvironmentVariable: ChakraHost.getEnvironmentVariable || (function () { return ""; }),
readDirectory: function (path, extensions, excludes, includes) {
- var pattern = ts.getFileMatcherPatterns(path, extensions, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory);
+ var pattern = ts.getFileMatcherPatterns(path, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory);
return ChakraHost.readDirectory(path, extensions, pattern.basePaths, pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern);
},
exit: ChakraHost.quit,
@@ -2922,7 +3847,7 @@ var ts;
Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: "Binding_element_0_implicitly_has_an_1_type_7031", message: "Binding element '{0}' implicitly has an '{1}' type." },
Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: { code: 7032, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032", message: "Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation." },
Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: { code: 7033, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033", message: "Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation." },
- Variable_0_implicitly_has_type_any_in_some_locations_where_its_type_cannot_be_determined: { code: 7034, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_type_any_in_some_locations_where_its_type_cannot_be_determined_7034", message: "Variable '{0}' implicitly has type 'any' in some locations where its type cannot be determined." },
+ Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: { code: 7034, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034", message: "Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined." },
You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "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_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." },
import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." },
@@ -2959,139 +3884,139 @@ var ts;
Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" },
Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" },
Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" },
- Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }
+ Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
};
})(ts || (ts = {}));
var ts;
(function (ts) {
function tokenIsIdentifierOrKeyword(token) {
- return token >= 69;
+ return token >= 70;
}
ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;
var textToToken = ts.createMap({
- "abstract": 115,
- "any": 117,
- "as": 116,
- "boolean": 120,
- "break": 70,
- "case": 71,
- "catch": 72,
- "class": 73,
- "continue": 75,
- "const": 74,
- "constructor": 121,
- "debugger": 76,
- "declare": 122,
- "default": 77,
- "delete": 78,
- "do": 79,
- "else": 80,
- "enum": 81,
- "export": 82,
- "extends": 83,
- "false": 84,
- "finally": 85,
- "for": 86,
- "from": 136,
- "function": 87,
- "get": 123,
- "if": 88,
- "implements": 106,
- "import": 89,
- "in": 90,
- "instanceof": 91,
- "interface": 107,
- "is": 124,
- "let": 108,
- "module": 125,
- "namespace": 126,
- "never": 127,
- "new": 92,
- "null": 93,
- "number": 130,
- "package": 109,
- "private": 110,
- "protected": 111,
- "public": 112,
- "readonly": 128,
- "require": 129,
- "global": 137,
- "return": 94,
- "set": 131,
- "static": 113,
- "string": 132,
- "super": 95,
- "switch": 96,
- "symbol": 133,
- "this": 97,
- "throw": 98,
- "true": 99,
- "try": 100,
- "type": 134,
- "typeof": 101,
- "undefined": 135,
- "var": 102,
- "void": 103,
- "while": 104,
- "with": 105,
- "yield": 114,
- "async": 118,
- "await": 119,
- "of": 138,
- "{": 15,
- "}": 16,
- "(": 17,
- ")": 18,
- "[": 19,
- "]": 20,
- ".": 21,
- "...": 22,
- ";": 23,
- ",": 24,
- "<": 25,
- ">": 27,
- "<=": 28,
- ">=": 29,
- "==": 30,
- "!=": 31,
- "===": 32,
- "!==": 33,
- "=>": 34,
- "+": 35,
- "-": 36,
- "**": 38,
- "*": 37,
- "/": 39,
- "%": 40,
- "++": 41,
- "--": 42,
- "<<": 43,
- "": 26,
- ">>": 44,
- ">>>": 45,
- "&": 46,
- "|": 47,
- "^": 48,
- "!": 49,
- "~": 50,
- "&&": 51,
- "||": 52,
- "?": 53,
- ":": 54,
- "=": 56,
- "+=": 57,
- "-=": 58,
- "*=": 59,
- "**=": 60,
- "/=": 61,
- "%=": 62,
- "<<=": 63,
- ">>=": 64,
- ">>>=": 65,
- "&=": 66,
- "|=": 67,
- "^=": 68,
- "@": 55
+ "abstract": 116,
+ "any": 118,
+ "as": 117,
+ "boolean": 121,
+ "break": 71,
+ "case": 72,
+ "catch": 73,
+ "class": 74,
+ "continue": 76,
+ "const": 75,
+ "constructor": 122,
+ "debugger": 77,
+ "declare": 123,
+ "default": 78,
+ "delete": 79,
+ "do": 80,
+ "else": 81,
+ "enum": 82,
+ "export": 83,
+ "extends": 84,
+ "false": 85,
+ "finally": 86,
+ "for": 87,
+ "from": 137,
+ "function": 88,
+ "get": 124,
+ "if": 89,
+ "implements": 107,
+ "import": 90,
+ "in": 91,
+ "instanceof": 92,
+ "interface": 108,
+ "is": 125,
+ "let": 109,
+ "module": 126,
+ "namespace": 127,
+ "never": 128,
+ "new": 93,
+ "null": 94,
+ "number": 131,
+ "package": 110,
+ "private": 111,
+ "protected": 112,
+ "public": 113,
+ "readonly": 129,
+ "require": 130,
+ "global": 138,
+ "return": 95,
+ "set": 132,
+ "static": 114,
+ "string": 133,
+ "super": 96,
+ "switch": 97,
+ "symbol": 134,
+ "this": 98,
+ "throw": 99,
+ "true": 100,
+ "try": 101,
+ "type": 135,
+ "typeof": 102,
+ "undefined": 136,
+ "var": 103,
+ "void": 104,
+ "while": 105,
+ "with": 106,
+ "yield": 115,
+ "async": 119,
+ "await": 120,
+ "of": 139,
+ "{": 16,
+ "}": 17,
+ "(": 18,
+ ")": 19,
+ "[": 20,
+ "]": 21,
+ ".": 22,
+ "...": 23,
+ ";": 24,
+ ",": 25,
+ "<": 26,
+ ">": 28,
+ "<=": 29,
+ ">=": 30,
+ "==": 31,
+ "!=": 32,
+ "===": 33,
+ "!==": 34,
+ "=>": 35,
+ "+": 36,
+ "-": 37,
+ "**": 39,
+ "*": 38,
+ "/": 40,
+ "%": 41,
+ "++": 42,
+ "--": 43,
+ "<<": 44,
+ "": 27,
+ ">>": 45,
+ ">>>": 46,
+ "&": 47,
+ "|": 48,
+ "^": 49,
+ "!": 50,
+ "~": 51,
+ "&&": 52,
+ "||": 53,
+ "?": 54,
+ ":": 55,
+ "=": 57,
+ "+=": 58,
+ "-=": 59,
+ "*=": 60,
+ "**=": 61,
+ "/=": 62,
+ "%=": 63,
+ "<<=": 64,
+ ">>=": 65,
+ ">>>=": 66,
+ "&=": 67,
+ "|=": 68,
+ "^=": 69,
+ "@": 56,
});
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,];
@@ -3488,7 +4413,7 @@ var ts;
return iterateCommentRanges(true, text, pos, true, cb, state, initial);
}
ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange;
- function appendCommentRange(pos, end, kind, hasTrailingNewLine, state, comments) {
+ function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) {
if (!comments) {
comments = [];
}
@@ -3554,8 +4479,8 @@ var ts;
getTokenValue: function () { return tokenValue; },
hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; },
hasPrecedingLineBreak: function () { return precedingLineBreak; },
- isIdentifier: function () { return token === 69 || token > 105; },
- isReservedWord: function () { return token >= 70 && token <= 105; },
+ isIdentifier: function () { return token === 70 || token > 106; },
+ isReservedWord: function () { return token >= 71 && token <= 106; },
isUnterminated: function () { return tokenIsUnterminated; },
reScanGreaterToken: reScanGreaterToken,
reScanSlashToken: reScanSlashToken,
@@ -3574,7 +4499,7 @@ var ts;
setTextPos: setTextPos,
tryScan: tryScan,
lookAhead: lookAhead,
- scanRange: scanRange
+ scanRange: scanRange,
};
function error(message, length) {
if (onError) {
@@ -3691,20 +4616,20 @@ var ts;
contents += text.substring(start, pos);
tokenIsUnterminated = true;
error(ts.Diagnostics.Unterminated_template_literal);
- resultingToken = startedWithBacktick ? 11 : 14;
+ resultingToken = startedWithBacktick ? 12 : 15;
break;
}
var currChar = text.charCodeAt(pos);
if (currChar === 96) {
contents += text.substring(start, pos);
pos++;
- resultingToken = startedWithBacktick ? 11 : 14;
+ resultingToken = startedWithBacktick ? 12 : 15;
break;
}
if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) {
contents += text.substring(start, pos);
pos += 2;
- resultingToken = startedWithBacktick ? 12 : 13;
+ resultingToken = startedWithBacktick ? 13 : 14;
break;
}
if (currChar === 92) {
@@ -3866,7 +4791,7 @@ var ts;
return token = textToToken[tokenValue];
}
}
- return token = 69;
+ return token = 70;
}
function scanBinaryOrOctalDigits(base) {
ts.Debug.assert(base === 2 || base === 8, "Expected either base 2 or base 8");
@@ -3941,12 +4866,12 @@ var ts;
case 33:
if (text.charCodeAt(pos + 1) === 61) {
if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 33;
+ return pos += 3, token = 34;
}
- return pos += 2, token = 31;
+ return pos += 2, token = 32;
}
pos++;
- return token = 49;
+ return token = 50;
case 34:
case 39:
tokenValue = scanString();
@@ -3955,68 +4880,68 @@ var ts;
return token = scanTemplateAndSetTokenValue();
case 37:
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 62;
+ return pos += 2, token = 63;
}
pos++;
- return token = 40;
+ return token = 41;
case 38:
if (text.charCodeAt(pos + 1) === 38) {
- return pos += 2, token = 51;
+ return pos += 2, token = 52;
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 66;
+ return pos += 2, token = 67;
}
pos++;
- return token = 46;
+ return token = 47;
case 40:
pos++;
- return token = 17;
+ return token = 18;
case 41:
pos++;
- return token = 18;
+ return token = 19;
case 42:
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 59;
+ return pos += 2, token = 60;
}
if (text.charCodeAt(pos + 1) === 42) {
if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 60;
+ return pos += 3, token = 61;
}
- return pos += 2, token = 38;
+ return pos += 2, token = 39;
}
pos++;
- return token = 37;
+ return token = 38;
case 43:
if (text.charCodeAt(pos + 1) === 43) {
- return pos += 2, token = 41;
+ return pos += 2, token = 42;
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 57;
+ return pos += 2, token = 58;
}
pos++;
- return token = 35;
+ return token = 36;
case 44:
pos++;
- return token = 24;
+ return token = 25;
case 45:
if (text.charCodeAt(pos + 1) === 45) {
- return pos += 2, token = 42;
+ return pos += 2, token = 43;
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 58;
+ return pos += 2, token = 59;
}
pos++;
- return token = 36;
+ return token = 37;
case 46:
if (isDigit(text.charCodeAt(pos + 1))) {
tokenValue = scanNumber();
return token = 8;
}
if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) {
- return pos += 3, token = 22;
+ return pos += 3, token = 23;
}
pos++;
- return token = 21;
+ return token = 22;
case 47:
if (text.charCodeAt(pos + 1) === 47) {
pos += 2;
@@ -4060,10 +4985,10 @@ var ts;
}
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 61;
+ return pos += 2, token = 62;
}
pos++;
- return token = 39;
+ return token = 40;
case 48:
if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) {
pos += 2;
@@ -4112,10 +5037,10 @@ var ts;
return token = 8;
case 58:
pos++;
- return token = 54;
+ return token = 55;
case 59:
pos++;
- return token = 23;
+ return token = 24;
case 60:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
@@ -4128,20 +5053,20 @@ var ts;
}
if (text.charCodeAt(pos + 1) === 60) {
if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 63;
+ return pos += 3, token = 64;
}
- return pos += 2, token = 43;
+ return pos += 2, token = 44;
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 28;
+ return pos += 2, token = 29;
}
if (languageVariant === 1 &&
text.charCodeAt(pos + 1) === 47 &&
text.charCodeAt(pos + 2) !== 42) {
- return pos += 2, token = 26;
+ return pos += 2, token = 27;
}
pos++;
- return token = 25;
+ return token = 26;
case 61:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
@@ -4154,15 +5079,15 @@ var ts;
}
if (text.charCodeAt(pos + 1) === 61) {
if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 32;
+ return pos += 3, token = 33;
}
- return pos += 2, token = 30;
+ return pos += 2, token = 31;
}
if (text.charCodeAt(pos + 1) === 62) {
- return pos += 2, token = 34;
+ return pos += 2, token = 35;
}
pos++;
- return token = 56;
+ return token = 57;
case 62:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
@@ -4174,43 +5099,43 @@ var ts;
}
}
pos++;
- return token = 27;
+ return token = 28;
case 63:
pos++;
- return token = 53;
+ return token = 54;
case 91:
pos++;
- return token = 19;
+ return token = 20;
case 93:
pos++;
- return token = 20;
+ return token = 21;
case 94:
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 68;
+ return pos += 2, token = 69;
}
pos++;
- return token = 48;
+ return token = 49;
case 123:
pos++;
- return token = 15;
+ return token = 16;
case 124:
if (text.charCodeAt(pos + 1) === 124) {
- return pos += 2, token = 52;
+ return pos += 2, token = 53;
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 67;
+ return pos += 2, token = 68;
}
pos++;
- return token = 47;
+ return token = 48;
case 125:
pos++;
- return token = 16;
+ return token = 17;
case 126:
pos++;
- return token = 50;
+ return token = 51;
case 64:
pos++;
- return token = 55;
+ return token = 56;
case 92:
var cookedChar = peekUnicodeEscape();
if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
@@ -4248,29 +5173,29 @@ var ts;
}
}
function reScanGreaterToken() {
- if (token === 27) {
+ if (token === 28) {
if (text.charCodeAt(pos) === 62) {
if (text.charCodeAt(pos + 1) === 62) {
if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 65;
+ return pos += 3, token = 66;
}
- return pos += 2, token = 45;
+ return pos += 2, token = 46;
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 64;
+ return pos += 2, token = 65;
}
pos++;
- return token = 44;
+ return token = 45;
}
if (text.charCodeAt(pos) === 61) {
pos++;
- return token = 29;
+ return token = 30;
}
}
return token;
}
function reScanSlashToken() {
- if (token === 39 || token === 61) {
+ if (token === 40 || token === 62) {
var p = tokenPos + 1;
var inEscape = false;
var inCharacterClass = false;
@@ -4309,12 +5234,12 @@ var ts;
}
pos = p;
tokenValue = text.substring(tokenPos, pos);
- token = 10;
+ token = 11;
}
return token;
}
function reScanTemplateToken() {
- ts.Debug.assert(token === 16, "'reScanTemplateToken' should only be called on a '}'");
+ ts.Debug.assert(token === 17, "'reScanTemplateToken' should only be called on a '}'");
pos = tokenPos;
return token = scanTemplateAndSetTokenValue();
}
@@ -4331,14 +5256,14 @@ var ts;
if (char === 60) {
if (text.charCodeAt(pos + 1) === 47) {
pos += 2;
- return token = 26;
+ return token = 27;
}
pos++;
- return token = 25;
+ return token = 26;
}
if (char === 123) {
pos++;
- return token = 15;
+ return token = 16;
}
while (pos < end) {
pos++;
@@ -4347,7 +5272,7 @@ var ts;
break;
}
}
- return token = 244;
+ return token = 10;
}
function scanJsxIdentifier() {
if (tokenIsIdentifierOrKeyword(token)) {
@@ -4394,39 +5319,39 @@ var ts;
return token = 5;
case 64:
pos++;
- return token = 55;
+ return token = 56;
case 10:
case 13:
pos++;
return token = 4;
case 42:
pos++;
- return token = 37;
+ return token = 38;
case 123:
pos++;
- return token = 15;
+ return token = 16;
case 125:
pos++;
- return token = 16;
+ return token = 17;
case 91:
pos++;
- return token = 19;
+ return token = 20;
case 93:
pos++;
- return token = 20;
+ return token = 21;
case 61:
pos++;
- return token = 56;
+ return token = 57;
case 44:
pos++;
- return token = 24;
+ return token = 25;
}
- if (isIdentifierStart(ch, 2)) {
+ if (isIdentifierStart(ch, 4)) {
pos++;
- while (isIdentifierPart(text.charCodeAt(pos), 2) && pos < end) {
+ while (isIdentifierPart(text.charCodeAt(pos), 4) && pos < end) {
pos++;
}
- return token = 69;
+ return token = 70;
}
else {
return pos += 1, token = 0;
@@ -4647,11 +5572,11 @@ var ts;
ts.getSourceFileOfNode = getSourceFileOfNode;
function isStatementWithLocals(node) {
switch (node.kind) {
- case 199:
- case 227:
- case 206:
+ case 200:
+ case 228:
case 207:
case 208:
+ case 209:
return true;
}
return false;
@@ -4772,13 +5697,13 @@ var ts;
switch (node.kind) {
case 9:
return getQuotedEscapedLiteralText('"', node.text, '"');
- case 11:
- return getQuotedEscapedLiteralText("`", node.text, "`");
case 12:
- return getQuotedEscapedLiteralText("`", node.text, "${");
+ return getQuotedEscapedLiteralText("`", node.text, "`");
case 13:
- return getQuotedEscapedLiteralText("}", node.text, "${");
+ return getQuotedEscapedLiteralText("`", node.text, "${");
case 14:
+ return getQuotedEscapedLiteralText("}", node.text, "${");
+ case 15:
return getQuotedEscapedLiteralText("}", node.text, "`");
case 8:
return node.text;
@@ -4820,7 +5745,7 @@ var ts;
}
ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
function isAmbientModule(node) {
- return node && node.kind === 225 &&
+ return node && node.kind === 226 &&
(node.name.kind === 9 || isGlobalScopeAugmentation(node));
}
ts.isAmbientModule = isAmbientModule;
@@ -4829,11 +5754,11 @@ var ts;
}
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
function isShorthandAmbientModule(node) {
- return node.kind === 225 && (!node.body);
+ return node.kind === 226 && (!node.body);
}
function isBlockScopedContainerTopLevel(node) {
return node.kind === 256 ||
- node.kind === 225 ||
+ node.kind === 226 ||
isFunctionLike(node);
}
ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
@@ -4848,7 +5773,7 @@ var ts;
switch (node.parent.kind) {
case 256:
return ts.isExternalModule(node.parent);
- case 226:
+ case 227:
return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
}
return false;
@@ -4857,21 +5782,21 @@ var ts;
function isBlockScope(node, parentNode) {
switch (node.kind) {
case 256:
- case 227:
+ case 228:
case 252:
- case 225:
- case 206:
+ case 226:
case 207:
case 208:
- case 148:
- case 147:
+ case 209:
case 149:
+ case 148:
case 150:
- case 220:
- case 179:
+ case 151:
+ case 221:
case 180:
+ case 181:
return true;
- case 199:
+ case 200:
return parentNode && !isFunctionLike(parentNode);
}
return false;
@@ -4889,7 +5814,7 @@ var ts;
ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer;
function isCatchClauseVariableDeclaration(declaration) {
return declaration &&
- declaration.kind === 218 &&
+ declaration.kind === 219 &&
declaration.parent &&
declaration.parent.kind === 252;
}
@@ -4926,7 +5851,7 @@ var ts;
ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
function getErrorSpanForArrowFunction(sourceFile, node) {
var pos = ts.skipTrivia(sourceFile.text, node.pos);
- if (node.body && node.body.kind === 199) {
+ if (node.body && node.body.kind === 200) {
var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
if (startLine < endLine) {
@@ -4944,23 +5869,23 @@ var ts;
return ts.createTextSpan(0, 0);
}
return getSpanOfTokenAtPosition(sourceFile, pos_1);
- case 218:
- case 169:
- case 221:
- case 192:
+ case 219:
+ case 170:
case 222:
+ case 193:
+ case 223:
+ case 226:
case 225:
- case 224:
case 255:
- case 220:
- case 179:
- case 147:
- case 149:
+ case 221:
+ case 180:
+ case 148:
case 150:
- case 223:
+ case 151:
+ case 224:
errorNode = node.name;
break;
- case 180:
+ case 181:
return getErrorSpanForArrowFunction(sourceFile, node);
}
if (errorNode === undefined) {
@@ -4981,7 +5906,7 @@ var ts;
}
ts.isDeclarationFile = isDeclarationFile;
function isConstEnumDeclaration(node) {
- return node.kind === 224 && isConst(node);
+ return node.kind === 225 && isConst(node);
}
ts.isConstEnumDeclaration = isConstEnumDeclaration;
function isConst(node) {
@@ -4994,11 +5919,11 @@ var ts;
}
ts.isLet = isLet;
function isSuperCall(n) {
- return n.kind === 174 && n.expression.kind === 95;
+ return n.kind === 175 && n.expression.kind === 96;
}
ts.isSuperCall = isSuperCall;
function isPrologueDirective(node) {
- return node.kind === 202 && node.expression.kind === 9;
+ return node.kind === 203 && node.expression.kind === 9;
}
ts.isPrologueDirective = isPrologueDirective;
function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
@@ -5014,10 +5939,10 @@ var ts;
}
ts.getJsDocComments = getJsDocComments;
function getJsDocCommentsFromText(node, text) {
- var commentRanges = (node.kind === 142 ||
- node.kind === 141 ||
- node.kind === 179 ||
- node.kind === 180) ?
+ var commentRanges = (node.kind === 143 ||
+ node.kind === 142 ||
+ node.kind === 180 ||
+ node.kind === 181) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
getLeadingCommentRangesOfNodeFromText(node, text);
return ts.filter(commentRanges, isJsDocComment);
@@ -5032,69 +5957,69 @@ var ts;
ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/;
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/;
function isPartOfTypeNode(node) {
- if (154 <= node.kind && node.kind <= 166) {
+ if (155 <= node.kind && node.kind <= 167) {
return true;
}
switch (node.kind) {
- case 117:
- case 130:
- case 132:
- case 120:
+ case 118:
+ case 131:
case 133:
- case 135:
- case 127:
+ case 121:
+ case 134:
+ case 136:
+ case 128:
return true;
- case 103:
- return node.parent.kind !== 183;
- case 194:
+ case 104:
+ return node.parent.kind !== 184;
+ case 195:
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
- case 69:
- if (node.parent.kind === 139 && node.parent.right === node) {
+ case 70:
+ if (node.parent.kind === 140 && node.parent.right === node) {
node = node.parent;
}
- else if (node.parent.kind === 172 && node.parent.name === node) {
+ else if (node.parent.kind === 173 && node.parent.name === node) {
node = node.parent;
}
- ts.Debug.assert(node.kind === 69 || node.kind === 139 || node.kind === 172, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
- case 139:
- case 172:
- case 97:
+ ts.Debug.assert(node.kind === 70 || node.kind === 140 || node.kind === 173, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
+ case 140:
+ case 173:
+ case 98:
var parent_1 = node.parent;
- if (parent_1.kind === 158) {
+ if (parent_1.kind === 159) {
return false;
}
- if (154 <= parent_1.kind && parent_1.kind <= 166) {
+ if (155 <= parent_1.kind && parent_1.kind <= 167) {
return true;
}
switch (parent_1.kind) {
- case 194:
+ case 195:
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1);
- case 141:
+ case 142:
return node === parent_1.constraint;
+ case 146:
case 145:
- case 144:
- case 142:
- case 218:
+ case 143:
+ case 219:
return node === parent_1.type;
- case 220:
- case 179:
+ case 221:
case 180:
+ case 181:
+ case 149:
case 148:
case 147:
- case 146:
- case 149:
case 150:
- return node === parent_1.type;
case 151:
+ return node === parent_1.type;
case 152:
case 153:
+ case 154:
return node === parent_1.type;
- case 177:
+ case 178:
return node === parent_1.type;
- case 174:
case 175:
- return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0;
case 176:
+ return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0;
+ case 177:
return false;
}
}
@@ -5105,22 +6030,22 @@ var ts;
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 211:
+ case 212:
return visitor(node);
- case 227:
- case 199:
- case 203:
+ case 228:
+ case 200:
case 204:
case 205:
case 206:
case 207:
case 208:
- case 212:
+ case 209:
case 213:
+ case 214:
case 249:
case 250:
- case 214:
- case 216:
+ case 215:
+ case 217:
case 252:
return ts.forEachChild(node, traverse);
}
@@ -5131,23 +6056,23 @@ var ts;
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 190:
+ case 191:
visitor(node);
var operand = node.expression;
if (operand) {
traverse(operand);
}
- case 224:
- case 222:
case 225:
case 223:
- case 221:
- case 192:
+ case 226:
+ case 224:
+ case 222:
+ case 193:
return;
default:
if (isFunctionLike(node)) {
var name_5 = node.name;
- if (name_5 && name_5.kind === 140) {
+ if (name_5 && name_5.kind === 141) {
traverse(name_5.expression);
return;
}
@@ -5162,14 +6087,14 @@ var ts;
function isVariableLike(node) {
if (node) {
switch (node.kind) {
- case 169:
+ case 170:
case 255:
- case 142:
+ case 143:
case 253:
+ case 146:
case 145:
- case 144:
case 254:
- case 218:
+ case 219:
return true;
}
}
@@ -5177,11 +6102,11 @@ var ts;
}
ts.isVariableLike = isVariableLike;
function isAccessor(node) {
- return node && (node.kind === 149 || node.kind === 150);
+ return node && (node.kind === 150 || node.kind === 151);
}
ts.isAccessor = isAccessor;
function isClassLike(node) {
- return node && (node.kind === 221 || node.kind === 192);
+ return node && (node.kind === 222 || node.kind === 193);
}
ts.isClassLike = isClassLike;
function isFunctionLike(node) {
@@ -5190,19 +6115,19 @@ var ts;
ts.isFunctionLike = isFunctionLike;
function isFunctionLikeKind(kind) {
switch (kind) {
- case 148:
- case 179:
- case 220:
+ case 149:
case 180:
+ case 221:
+ case 181:
+ case 148:
case 147:
- case 146:
- case 149:
case 150:
case 151:
case 152:
case 153:
- case 156:
+ case 154:
case 157:
+ case 158:
return true;
}
return false;
@@ -5210,13 +6135,13 @@ var ts;
ts.isFunctionLikeKind = isFunctionLikeKind;
function introducesArgumentsExoticObject(node) {
switch (node.kind) {
- case 147:
- case 146:
case 148:
+ case 147:
case 149:
case 150:
- case 220:
- case 179:
+ case 151:
+ case 221:
+ case 180:
return true;
}
return false;
@@ -5224,30 +6149,30 @@ var ts;
ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject;
function isIterationStatement(node, lookInLabeledStatements) {
switch (node.kind) {
- case 206:
case 207:
case 208:
- case 204:
+ case 209:
case 205:
+ case 206:
return true;
- case 214:
+ case 215:
return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
}
return false;
}
ts.isIterationStatement = isIterationStatement;
function isFunctionBlock(node) {
- return node && node.kind === 199 && isFunctionLike(node.parent);
+ return node && node.kind === 200 && isFunctionLike(node.parent);
}
ts.isFunctionBlock = isFunctionBlock;
function isObjectLiteralMethod(node) {
- return node && node.kind === 147 && node.parent.kind === 171;
+ return node && node.kind === 148 && node.parent.kind === 172;
}
ts.isObjectLiteralMethod = isObjectLiteralMethod;
function isObjectLiteralOrClassExpressionMethod(node) {
- return node.kind === 147 &&
- (node.parent.kind === 171 ||
- node.parent.kind === 192);
+ return node.kind === 148 &&
+ (node.parent.kind === 172 ||
+ node.parent.kind === 193);
}
ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;
function isIdentifierTypePredicate(predicate) {
@@ -5283,38 +6208,38 @@ var ts;
return undefined;
}
switch (node.kind) {
- case 140:
+ case 141:
if (isClassLike(node.parent.parent)) {
return node;
}
node = node.parent;
break;
- case 143:
- if (node.parent.kind === 142 && isClassElement(node.parent.parent)) {
+ case 144:
+ if (node.parent.kind === 143 && isClassElement(node.parent.parent)) {
node = node.parent.parent;
}
else if (isClassElement(node.parent)) {
node = node.parent;
}
break;
- case 180:
+ case 181:
if (!includeArrowFunctions) {
continue;
}
- case 220:
- case 179:
- case 225:
- case 145:
- case 144:
- case 147:
+ case 221:
+ case 180:
+ case 226:
case 146:
+ case 145:
case 148:
+ case 147:
case 149:
case 150:
case 151:
case 152:
case 153:
- case 224:
+ case 154:
+ case 225:
case 256:
return node;
}
@@ -5328,25 +6253,25 @@ var ts;
return node;
}
switch (node.kind) {
- case 140:
+ case 141:
node = node.parent;
break;
- case 220:
- case 179:
+ case 221:
case 180:
+ case 181:
if (!stopOnFunctions) {
continue;
}
- case 145:
- case 144:
- case 147:
case 146:
+ case 145:
case 148:
+ case 147:
case 149:
case 150:
+ case 151:
return node;
- case 143:
- if (node.parent.kind === 142 && isClassElement(node.parent.parent)) {
+ case 144:
+ if (node.parent.kind === 143 && isClassElement(node.parent.parent)) {
node = node.parent.parent;
}
else if (isClassElement(node.parent)) {
@@ -5358,14 +6283,14 @@ var ts;
}
ts.getSuperContainer = getSuperContainer;
function getImmediatelyInvokedFunctionExpression(func) {
- if (func.kind === 179 || func.kind === 180) {
+ if (func.kind === 180 || func.kind === 181) {
var prev = func;
var parent_2 = func.parent;
- while (parent_2.kind === 178) {
+ while (parent_2.kind === 179) {
prev = parent_2;
parent_2 = parent_2.parent;
}
- if (parent_2.kind === 174 && parent_2.expression === prev) {
+ if (parent_2.kind === 175 && parent_2.expression === prev) {
return parent_2;
}
}
@@ -5373,20 +6298,20 @@ var ts;
ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;
function isSuperProperty(node) {
var kind = node.kind;
- return (kind === 172 || kind === 173)
- && node.expression.kind === 95;
+ return (kind === 173 || kind === 174)
+ && node.expression.kind === 96;
}
ts.isSuperProperty = isSuperProperty;
function getEntityNameFromTypeNode(node) {
if (node) {
switch (node.kind) {
- case 155:
+ case 156:
return node.typeName;
- case 194:
+ case 195:
ts.Debug.assert(isEntityNameExpression(node.expression));
return node.expression;
- case 69:
- case 139:
+ case 70:
+ case 140:
return node;
}
}
@@ -5395,10 +6320,10 @@ var ts;
ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
function isCallLikeExpression(node) {
switch (node.kind) {
- case 174:
case 175:
case 176:
- case 143:
+ case 177:
+ case 144:
return true;
default:
return false;
@@ -5406,7 +6331,7 @@ var ts;
}
ts.isCallLikeExpression = isCallLikeExpression;
function getInvokedExpression(node) {
- if (node.kind === 176) {
+ if (node.kind === 177) {
return node.tag;
}
return node.expression;
@@ -5414,21 +6339,21 @@ var ts;
ts.getInvokedExpression = getInvokedExpression;
function nodeCanBeDecorated(node) {
switch (node.kind) {
- case 221:
+ case 222:
return true;
- case 145:
- return node.parent.kind === 221;
- case 149:
+ case 146:
+ return node.parent.kind === 222;
case 150:
- case 147:
+ case 151:
+ case 148:
return node.body !== undefined
- && node.parent.kind === 221;
- case 142:
+ && node.parent.kind === 222;
+ case 143:
return node.parent.body !== undefined
- && (node.parent.kind === 148
- || node.parent.kind === 147
- || node.parent.kind === 150)
- && node.parent.parent.kind === 221;
+ && (node.parent.kind === 149
+ || node.parent.kind === 148
+ || node.parent.kind === 151)
+ && node.parent.parent.kind === 222;
}
return false;
}
@@ -5444,18 +6369,18 @@ var ts;
ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
function childIsDecorated(node) {
switch (node.kind) {
- case 221:
+ case 222:
return ts.forEach(node.members, nodeOrChildIsDecorated);
- case 147:
- case 150:
+ case 148:
+ case 151:
return ts.forEach(node.parameters, nodeIsDecorated);
}
}
ts.childIsDecorated = childIsDecorated;
function isJSXTagName(node) {
var parent = node.parent;
- if (parent.kind === 243 ||
- parent.kind === 242 ||
+ if (parent.kind === 244 ||
+ parent.kind === 243 ||
parent.kind === 245) {
return parent.tagName === node;
}
@@ -5464,97 +6389,97 @@ var ts;
ts.isJSXTagName = isJSXTagName;
function isPartOfExpression(node) {
switch (node.kind) {
- case 97:
- case 95:
- case 93:
- case 99:
- case 84:
- case 10:
- case 170:
+ case 98:
+ case 96:
+ case 94:
+ case 100:
+ case 85:
+ case 11:
case 171:
case 172:
case 173:
case 174:
case 175:
case 176:
- case 195:
case 177:
case 196:
case 178:
+ case 197:
case 179:
- case 192:
case 180:
- case 183:
+ case 193:
case 181:
+ case 184:
case 182:
- case 185:
+ case 183:
case 186:
case 187:
case 188:
- case 191:
case 189:
- case 11:
- case 193:
- case 241:
- case 242:
+ case 192:
case 190:
- case 184:
+ case 12:
+ case 194:
+ case 242:
+ case 243:
+ case 191:
+ case 185:
return true;
- case 139:
- while (node.parent.kind === 139) {
+ case 140:
+ while (node.parent.kind === 140) {
node = node.parent;
}
- return node.parent.kind === 158 || isJSXTagName(node);
- case 69:
- if (node.parent.kind === 158 || isJSXTagName(node)) {
+ return node.parent.kind === 159 || isJSXTagName(node);
+ case 70:
+ if (node.parent.kind === 159 || isJSXTagName(node)) {
return true;
}
case 8:
case 9:
- case 97:
+ case 98:
var parent_3 = node.parent;
switch (parent_3.kind) {
- case 218:
- case 142:
+ case 219:
+ case 143:
+ case 146:
case 145:
- case 144:
case 255:
case 253:
- case 169:
+ case 170:
return parent_3.initializer === node;
- case 202:
case 203:
case 204:
case 205:
- case 211:
+ case 206:
case 212:
case 213:
+ case 214:
case 249:
- case 215:
- case 213:
+ case 216:
+ case 214:
return parent_3.expression === node;
- case 206:
+ case 207:
var forStatement = parent_3;
- return (forStatement.initializer === node && forStatement.initializer.kind !== 219) ||
+ return (forStatement.initializer === node && forStatement.initializer.kind !== 220) ||
forStatement.condition === node ||
forStatement.incrementor === node;
- case 207:
case 208:
+ case 209:
var forInStatement = parent_3;
- return (forInStatement.initializer === node && forInStatement.initializer.kind !== 219) ||
+ return (forInStatement.initializer === node && forInStatement.initializer.kind !== 220) ||
forInStatement.expression === node;
- case 177:
- case 195:
+ case 178:
+ case 196:
return node === parent_3.expression;
- case 197:
+ case 198:
return node === parent_3.expression;
- case 140:
+ case 141:
return node === parent_3.expression;
- case 143:
+ case 144:
case 248:
case 247:
return true;
- case 194:
+ case 195:
return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3);
default:
if (isPartOfExpression(parent_3)) {
@@ -5572,7 +6497,7 @@ var ts;
}
ts.isInstantiatedModule = isInstantiatedModule;
function isExternalModuleImportEqualsDeclaration(node) {
- return node.kind === 229 && node.moduleReference.kind === 240;
+ return node.kind === 230 && node.moduleReference.kind === 241;
}
ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
function getExternalModuleImportEqualsDeclarationExpression(node) {
@@ -5581,7 +6506,7 @@ var ts;
}
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
function isInternalModuleImportEqualsDeclaration(node) {
- return node.kind === 229 && node.moduleReference.kind !== 240;
+ return node.kind === 230 && node.moduleReference.kind !== 241;
}
ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
function isSourceFileJavaScript(file) {
@@ -5593,8 +6518,8 @@ var ts;
}
ts.isInJavaScriptFile = isInJavaScriptFile;
function isRequireCall(expression, checkArgumentIsStringLiteral) {
- var isRequire = expression.kind === 174 &&
- expression.expression.kind === 69 &&
+ var isRequire = expression.kind === 175 &&
+ expression.expression.kind === 70 &&
expression.expression.text === "require" &&
expression.arguments.length === 1;
return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9);
@@ -5605,9 +6530,9 @@ var ts;
}
ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote;
function isDeclarationOfFunctionExpression(s) {
- if (s.valueDeclaration && s.valueDeclaration.kind === 218) {
+ if (s.valueDeclaration && s.valueDeclaration.kind === 219) {
var declaration = s.valueDeclaration;
- return declaration.initializer && declaration.initializer.kind === 179;
+ return declaration.initializer && declaration.initializer.kind === 180;
}
return false;
}
@@ -5616,15 +6541,15 @@ var ts;
if (!isInJavaScriptFile(expression)) {
return 0;
}
- if (expression.kind !== 187) {
+ if (expression.kind !== 188) {
return 0;
}
var expr = expression;
- if (expr.operatorToken.kind !== 56 || expr.left.kind !== 172) {
+ if (expr.operatorToken.kind !== 57 || expr.left.kind !== 173) {
return 0;
}
var lhs = expr.left;
- if (lhs.expression.kind === 69) {
+ if (lhs.expression.kind === 70) {
var lhsId = lhs.expression;
if (lhsId.text === "exports") {
return 1;
@@ -5633,12 +6558,12 @@ var ts;
return 2;
}
}
- else if (lhs.expression.kind === 97) {
+ else if (lhs.expression.kind === 98) {
return 4;
}
- else if (lhs.expression.kind === 172) {
+ else if (lhs.expression.kind === 173) {
var innerPropertyAccess = lhs.expression;
- if (innerPropertyAccess.expression.kind === 69) {
+ if (innerPropertyAccess.expression.kind === 70) {
var innerPropertyAccessIdentifier = innerPropertyAccess.expression;
if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") {
return 1;
@@ -5652,35 +6577,35 @@ var ts;
}
ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind;
function getExternalModuleName(node) {
- if (node.kind === 230) {
+ if (node.kind === 231) {
return node.moduleSpecifier;
}
- if (node.kind === 229) {
+ if (node.kind === 230) {
var reference = node.moduleReference;
- if (reference.kind === 240) {
+ if (reference.kind === 241) {
return reference.expression;
}
}
- if (node.kind === 236) {
+ if (node.kind === 237) {
return node.moduleSpecifier;
}
- if (node.kind === 225 && node.name.kind === 9) {
+ if (node.kind === 226 && node.name.kind === 9) {
return node.name;
}
}
ts.getExternalModuleName = getExternalModuleName;
function getNamespaceDeclarationNode(node) {
- if (node.kind === 229) {
+ if (node.kind === 230) {
return node;
}
var importClause = node.importClause;
- if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 232) {
+ if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 233) {
return importClause.namedBindings;
}
}
ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
function isDefaultImport(node) {
- return node.kind === 230
+ return node.kind === 231
&& node.importClause
&& !!node.importClause.name;
}
@@ -5688,13 +6613,13 @@ var ts;
function hasQuestionToken(node) {
if (node) {
switch (node.kind) {
- case 142:
+ case 143:
+ case 148:
case 147:
- case 146:
case 254:
case 253:
+ case 146:
case 145:
- case 144:
return node.questionToken !== undefined;
}
}
@@ -5755,24 +6680,24 @@ var ts;
if (checkParentVariableStatement) {
var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) &&
(node.parent).initializer === node &&
- node.parent.parent.parent.kind === 200;
+ node.parent.parent.parent.kind === 201;
var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&
- node.parent.parent.kind === 200;
+ node.parent.parent.kind === 201;
var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent :
isVariableOfVariableDeclarationStatement ? node.parent.parent :
undefined;
if (variableStatementNode) {
result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags));
}
- if (node.kind === 225 &&
- node.parent && node.parent.kind === 225) {
+ if (node.kind === 226 &&
+ node.parent && node.parent.kind === 226) {
result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags));
}
var parent_4 = node.parent;
var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent &&
- parent_4.kind === 187 &&
- parent_4.operatorToken.kind === 56 &&
- parent_4.parent.kind === 202;
+ parent_4.kind === 188 &&
+ parent_4.operatorToken.kind === 57 &&
+ parent_4.parent.kind === 203;
if (isSourceOfAssignmentExpressionStatement) {
result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags));
}
@@ -5780,7 +6705,7 @@ var ts;
if (isPropertyAssignmentExpression) {
result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags));
}
- if (node.kind === 142) {
+ if (node.kind === 143) {
var paramTags = getJSDocParameterTag(node, checkParentVariableStatement);
if (paramTags) {
result = append(result, getTags(paramTags));
@@ -5810,7 +6735,7 @@ var ts;
return [paramTags[i]];
}
}
- else if (param.name.kind === 69) {
+ else if (param.name.kind === 70) {
var name_6 = param.name.text;
var paramTags = ts.filter(tags, function (tag) { return tag.kind === 275 && tag.parameterName.text === name_6; });
if (paramTags) {
@@ -5834,7 +6759,7 @@ var ts;
}
ts.getJSDocTemplateTag = getJSDocTemplateTag;
function getCorrespondingJSDocParameterTag(parameter) {
- if (parameter.name && parameter.name.kind === 69) {
+ if (parameter.name && parameter.name.kind === 70) {
var parameterName = parameter.name.text;
var jsDocTags = getJSDocTags(parameter.parent, true);
if (!jsDocTags) {
@@ -5879,12 +6804,12 @@ var ts;
}
ts.isDeclaredRestParam = isDeclaredRestParam;
function isAssignmentTarget(node) {
- while (node.parent.kind === 178) {
+ while (node.parent.kind === 179) {
node = node.parent;
}
while (true) {
var parent_5 = node.parent;
- if (parent_5.kind === 170 || parent_5.kind === 191) {
+ if (parent_5.kind === 171 || parent_5.kind === 192) {
node = parent_5;
continue;
}
@@ -5892,10 +6817,10 @@ var ts;
node = parent_5.parent;
continue;
}
- return parent_5.kind === 187 &&
+ return parent_5.kind === 188 &&
isAssignmentOperator(parent_5.operatorToken.kind) &&
parent_5.left === node ||
- (parent_5.kind === 207 || parent_5.kind === 208) &&
+ (parent_5.kind === 208 || parent_5.kind === 209) &&
parent_5.initializer === node;
}
}
@@ -5920,11 +6845,11 @@ var ts;
}
ts.isInAmbientContext = isInAmbientContext;
function isDeclarationName(name) {
- if (name.kind !== 69 && name.kind !== 9 && name.kind !== 8) {
+ if (name.kind !== 70 && name.kind !== 9 && name.kind !== 8) {
return false;
}
var parent = name.parent;
- if (parent.kind === 234 || parent.kind === 238) {
+ if (parent.kind === 235 || parent.kind === 239) {
if (parent.propertyName) {
return true;
}
@@ -5937,48 +6862,48 @@ var ts;
ts.isDeclarationName = isDeclarationName;
function isLiteralComputedPropertyDeclarationName(node) {
return (node.kind === 9 || node.kind === 8) &&
- node.parent.kind === 140 &&
+ node.parent.kind === 141 &&
isDeclaration(node.parent.parent);
}
ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
function isIdentifierName(node) {
var parent = node.parent;
switch (parent.kind) {
+ case 146:
case 145:
- case 144:
+ case 148:
case 147:
- case 146:
- case 149:
case 150:
+ case 151:
case 255:
case 253:
- case 172:
+ case 173:
return parent.name === node;
- case 139:
+ case 140:
if (parent.right === node) {
- while (parent.kind === 139) {
+ while (parent.kind === 140) {
parent = parent.parent;
}
- return parent.kind === 158;
+ return parent.kind === 159;
}
return false;
- case 169:
- case 234:
+ case 170:
+ case 235:
return parent.propertyName === node;
- case 238:
+ case 239:
return true;
}
return false;
}
ts.isIdentifierName = isIdentifierName;
function isAliasSymbolDeclaration(node) {
- return node.kind === 229 ||
- node.kind === 228 ||
- node.kind === 231 && !!node.name ||
- node.kind === 232 ||
- node.kind === 234 ||
- node.kind === 238 ||
- node.kind === 235 && exportAssignmentIsAlias(node);
+ return node.kind === 230 ||
+ node.kind === 229 ||
+ node.kind === 232 && !!node.name ||
+ node.kind === 233 ||
+ node.kind === 235 ||
+ node.kind === 239 ||
+ node.kind === 236 && exportAssignmentIsAlias(node);
}
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
function exportAssignmentIsAlias(node) {
@@ -5986,17 +6911,17 @@ var ts;
}
ts.exportAssignmentIsAlias = exportAssignmentIsAlias;
function getClassExtendsHeritageClauseElement(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 83);
+ var heritageClause = getHeritageClause(node.heritageClauses, 84);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement;
function getClassImplementsHeritageClauseElements(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 106);
+ var heritageClause = getHeritageClause(node.heritageClauses, 107);
return heritageClause ? heritageClause.types : undefined;
}
ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;
function getInterfaceBaseTypeNodes(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 83);
+ var heritageClause = getHeritageClause(node.heritageClauses, 84);
return heritageClause ? heritageClause.types : undefined;
}
ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;
@@ -6064,7 +6989,7 @@ var ts;
}
ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath;
function isKeyword(token) {
- return 70 <= token && token <= 138;
+ return 71 <= token && token <= 139;
}
ts.isKeyword = isKeyword;
function isTrivia(token) {
@@ -6084,7 +7009,7 @@ var ts;
}
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
- return name.kind === 140 &&
+ return name.kind === 141 &&
!isStringOrNumericLiteral(name.expression.kind) &&
!isWellKnownSymbolSyntactically(name.expression);
}
@@ -6094,10 +7019,10 @@ var ts;
}
ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;
function getPropertyNameForPropertyNameNode(name) {
- if (name.kind === 69 || name.kind === 9 || name.kind === 8 || name.kind === 142) {
+ if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 143) {
return name.text;
}
- if (name.kind === 140) {
+ if (name.kind === 141) {
var nameExpression = name.expression;
if (isWellKnownSymbolSyntactically(nameExpression)) {
var rightHandSideName = nameExpression.name.text;
@@ -6115,22 +7040,26 @@ var ts;
}
ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName;
function isESSymbolIdentifier(node) {
- return node.kind === 69 && node.text === "Symbol";
+ return node.kind === 70 && node.text === "Symbol";
}
ts.isESSymbolIdentifier = isESSymbolIdentifier;
+ function isPushOrUnshiftIdentifier(node) {
+ return node.text === "push" || node.text === "unshift";
+ }
+ ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;
function isModifierKind(token) {
switch (token) {
- case 115:
- case 118:
- case 74:
- case 122:
- case 77:
- case 82:
- case 112:
- case 110:
- case 111:
- case 128:
+ case 116:
+ case 119:
+ case 75:
+ case 123:
+ case 78:
+ case 83:
case 113:
+ case 111:
+ case 112:
+ case 129:
+ case 114:
return true;
}
return false;
@@ -6138,11 +7067,11 @@ var ts;
ts.isModifierKind = isModifierKind;
function isParameterDeclaration(node) {
var root = getRootDeclaration(node);
- return root.kind === 142;
+ return root.kind === 143;
}
ts.isParameterDeclaration = isParameterDeclaration;
function getRootDeclaration(node) {
- while (node.kind === 169) {
+ while (node.kind === 170) {
node = node.parent.parent;
}
return node;
@@ -6150,14 +7079,14 @@ var ts;
ts.getRootDeclaration = getRootDeclaration;
function nodeStartsNewLexicalEnvironment(node) {
var kind = node.kind;
- return kind === 148
- || kind === 179
- || kind === 220
+ return kind === 149
|| kind === 180
- || kind === 147
- || kind === 149
+ || kind === 221
+ || kind === 181
+ || kind === 148
|| kind === 150
- || kind === 225
+ || kind === 151
+ || kind === 226
|| kind === 256;
}
ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
@@ -6207,40 +7136,45 @@ var ts;
return node ? ts.getNodeId(node) : 0;
}
ts.getOriginalNodeId = getOriginalNodeId;
+ (function (Associativity) {
+ Associativity[Associativity["Left"] = 0] = "Left";
+ Associativity[Associativity["Right"] = 1] = "Right";
+ })(ts.Associativity || (ts.Associativity = {}));
+ var Associativity = ts.Associativity;
function getExpressionAssociativity(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 175 && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 176 && expression.arguments !== undefined;
return getOperatorAssociativity(expression.kind, operator, hasArguments);
}
ts.getExpressionAssociativity = getExpressionAssociativity;
function getOperatorAssociativity(kind, operator, hasArguments) {
switch (kind) {
- case 175:
+ case 176:
return hasArguments ? 0 : 1;
- case 185:
- case 182:
+ case 186:
case 183:
- case 181:
case 184:
- case 188:
- case 190:
+ case 182:
+ case 185:
+ case 189:
+ case 191:
return 1;
- case 187:
+ case 188:
switch (operator) {
- case 38:
- case 56:
+ case 39:
case 57:
case 58:
- case 60:
case 59:
case 61:
+ case 60:
case 62:
case 63:
case 64:
case 65:
case 66:
- case 68:
case 67:
+ case 69:
+ case 68:
return 1;
}
}
@@ -6249,15 +7183,15 @@ var ts;
ts.getOperatorAssociativity = getOperatorAssociativity;
function getExpressionPrecedence(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 175 && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 176 && expression.arguments !== undefined;
return getOperatorPrecedence(expression.kind, operator, hasArguments);
}
ts.getExpressionPrecedence = getExpressionPrecedence;
function getOperator(expression) {
- if (expression.kind === 187) {
+ if (expression.kind === 188) {
return expression.operatorToken.kind;
}
- else if (expression.kind === 185 || expression.kind === 186) {
+ else if (expression.kind === 186 || expression.kind === 187) {
return expression.operator;
}
else {
@@ -6267,106 +7201,106 @@ var ts;
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 97:
- case 95:
- case 69:
- case 93:
- case 99:
- case 84:
+ case 98:
+ case 96:
+ case 70:
+ case 94:
+ case 100:
+ case 85:
case 8:
case 9:
- case 170:
case 171:
- case 179:
+ case 172:
case 180:
- case 192:
- case 241:
+ case 181:
+ case 193:
case 242:
- case 10:
+ case 243:
case 11:
- case 189:
- case 178:
- case 193:
+ case 12:
+ case 190:
+ case 179:
+ case 194:
return 19;
- case 176:
- case 172:
+ case 177:
case 173:
+ case 174:
return 18;
- case 175:
+ case 176:
return hasArguments ? 18 : 17;
- case 174:
+ case 175:
return 17;
- case 186:
+ case 187:
return 16;
- case 185:
- case 182:
+ case 186:
case 183:
- case 181:
case 184:
+ case 182:
+ case 185:
return 15;
- case 187:
+ case 188:
switch (operatorKind) {
- case 49:
case 50:
+ case 51:
return 15;
- case 38:
- case 37:
case 39:
+ case 38:
case 40:
+ case 41:
return 14;
- case 35:
case 36:
+ case 37:
return 13;
- case 43:
case 44:
case 45:
+ case 46:
return 12;
- case 25:
- case 28:
- case 27:
+ case 26:
case 29:
- case 90:
+ case 28:
+ case 30:
case 91:
+ case 92:
return 11;
- case 30:
- case 32:
case 31:
case 33:
+ case 32:
+ case 34:
return 10;
- case 46:
+ case 47:
return 9;
- case 48:
+ case 49:
return 8;
- case 47:
+ case 48:
return 7;
- case 51:
- return 6;
case 52:
+ return 6;
+ case 53:
return 5;
- case 56:
case 57:
case 58:
- case 60:
case 59:
case 61:
+ case 60:
case 62:
case 63:
case 64:
case 65:
case 66:
- case 68:
case 67:
+ case 69:
+ case 68:
return 3;
- case 24:
+ case 25:
return 0;
default:
return -1;
}
- case 188:
+ case 189:
return 4;
- case 190:
- return 2;
case 191:
+ return 2;
+ case 192:
return 1;
default:
return -1;
@@ -6630,7 +7564,7 @@ var ts;
function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) {
var options = host.getCompilerOptions();
if (options.outFile || options.out) {
- onBundledEmit(host, sourceFiles);
+ onBundledEmit(sourceFiles);
}
else {
for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) {
@@ -6657,7 +7591,7 @@ var ts;
var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;
action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], false);
}
- function onBundledEmit(host, sourceFiles) {
+ function onBundledEmit(sourceFiles) {
if (sourceFiles.length) {
var jsFilePath = options.outFile || options.out;
var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);
@@ -6746,7 +7680,7 @@ var ts;
ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap;
function getFirstConstructorWithBody(node) {
return ts.forEach(node.members, function (member) {
- if (member.kind === 148 && nodeIsPresent(member.body)) {
+ if (member.kind === 149 && nodeIsPresent(member.body)) {
return member;
}
});
@@ -6773,11 +7707,11 @@ var ts;
}
ts.parameterIsThisKeyword = parameterIsThisKeyword;
function isThisIdentifier(node) {
- return node && node.kind === 69 && identifierIsThisKeyword(node);
+ return node && node.kind === 70 && identifierIsThisKeyword(node);
}
ts.isThisIdentifier = isThisIdentifier;
function identifierIsThisKeyword(id) {
- return id.originalKeywordKind === 97;
+ return id.originalKeywordKind === 98;
}
ts.identifierIsThisKeyword = identifierIsThisKeyword;
function getAllAccessorDeclarations(declarations, accessor) {
@@ -6787,10 +7721,10 @@ var ts;
var setAccessor;
if (hasDynamicName(accessor)) {
firstAccessor = accessor;
- if (accessor.kind === 149) {
+ if (accessor.kind === 150) {
getAccessor = accessor;
}
- else if (accessor.kind === 150) {
+ else if (accessor.kind === 151) {
setAccessor = accessor;
}
else {
@@ -6799,7 +7733,7 @@ var ts;
}
else {
ts.forEach(declarations, function (member) {
- if ((member.kind === 149 || member.kind === 150)
+ if ((member.kind === 150 || member.kind === 151)
&& hasModifier(member, 32) === hasModifier(accessor, 32)) {
var memberName = getPropertyNameForPropertyNameNode(member.name);
var accessorName = getPropertyNameForPropertyNameNode(accessor.name);
@@ -6810,10 +7744,10 @@ var ts;
else if (!secondAccessor) {
secondAccessor = member;
}
- if (member.kind === 149 && !getAccessor) {
+ if (member.kind === 150 && !getAccessor) {
getAccessor = member;
}
- if (member.kind === 150 && !setAccessor) {
+ if (member.kind === 151 && !setAccessor) {
setAccessor = member;
}
}
@@ -7005,34 +7939,34 @@ var ts;
ts.getModifierFlags = getModifierFlags;
function modifierToFlag(token) {
switch (token) {
- case 113: return 32;
- case 112: return 4;
- case 111: return 16;
- case 110: return 8;
- case 115: return 128;
- case 82: return 1;
- case 122: return 2;
- case 74: return 2048;
- case 77: return 512;
- case 118: return 256;
- case 128: return 64;
+ case 114: return 32;
+ case 113: return 4;
+ case 112: return 16;
+ case 111: return 8;
+ case 116: return 128;
+ case 83: return 1;
+ case 123: return 2;
+ case 75: return 2048;
+ case 78: return 512;
+ case 119: return 256;
+ case 129: return 64;
}
return 0;
}
ts.modifierToFlag = modifierToFlag;
function isLogicalOperator(token) {
- return token === 52
- || token === 51
- || token === 49;
+ return token === 53
+ || token === 52
+ || token === 50;
}
ts.isLogicalOperator = isLogicalOperator;
function isAssignmentOperator(token) {
- return token >= 56 && token <= 68;
+ return token >= 57 && token <= 69;
}
ts.isAssignmentOperator = isAssignmentOperator;
function tryGetClassExtendingExpressionWithTypeArguments(node) {
- if (node.kind === 194 &&
- node.parent.token === 83 &&
+ if (node.kind === 195 &&
+ node.parent.token === 84 &&
isClassLike(node.parent.parent)) {
return node.parent.parent;
}
@@ -7040,10 +7974,10 @@ var ts;
ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;
function isDestructuringAssignment(node) {
if (isBinaryExpression(node)) {
- if (node.operatorToken.kind === 56) {
+ if (node.operatorToken.kind === 57) {
var kind = node.left.kind;
- return kind === 171
- || kind === 170;
+ return kind === 172
+ || kind === 171;
}
}
return false;
@@ -7054,7 +7988,7 @@ var ts;
}
ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments;
function isSupportedExpressionWithTypeArgumentsRest(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
return true;
}
else if (isPropertyAccessExpression(node)) {
@@ -7069,21 +8003,21 @@ var ts;
}
ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
function isEntityNameExpression(node) {
- return node.kind === 69 ||
- node.kind === 172 && isEntityNameExpression(node.expression);
+ return node.kind === 70 ||
+ node.kind === 173 && isEntityNameExpression(node.expression);
}
ts.isEntityNameExpression = isEntityNameExpression;
function isRightSideOfQualifiedNameOrPropertyAccess(node) {
- return (node.parent.kind === 139 && node.parent.right === node) ||
- (node.parent.kind === 172 && node.parent.name === node);
+ return (node.parent.kind === 140 && node.parent.right === node) ||
+ (node.parent.kind === 173 && node.parent.name === node);
}
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
function isEmptyObjectLiteralOrArrayLiteral(expression) {
var kind = expression.kind;
- if (kind === 171) {
+ if (kind === 172) {
return expression.properties.length === 0;
}
- if (kind === 170) {
+ if (kind === 171) {
return expression.elements.length === 0;
}
return false;
@@ -7207,49 +8141,49 @@ var ts;
var kind = node.kind;
if (kind === 9
|| kind === 8
- || kind === 10
|| kind === 11
- || kind === 69
- || kind === 97
- || kind === 95
- || kind === 99
- || kind === 84
- || kind === 93) {
+ || kind === 12
+ || kind === 70
+ || kind === 98
+ || kind === 96
+ || kind === 100
+ || kind === 85
+ || kind === 94) {
return true;
}
- else if (kind === 172) {
+ else if (kind === 173) {
return isSimpleExpressionWorker(node.expression, depth + 1);
}
- else if (kind === 173) {
+ else if (kind === 174) {
return isSimpleExpressionWorker(node.expression, depth + 1)
&& isSimpleExpressionWorker(node.argumentExpression, depth + 1);
}
- else if (kind === 185
- || kind === 186) {
+ else if (kind === 186
+ || kind === 187) {
return isSimpleExpressionWorker(node.operand, depth + 1);
}
- else if (kind === 187) {
- return node.operatorToken.kind !== 38
+ else if (kind === 188) {
+ return node.operatorToken.kind !== 39
&& isSimpleExpressionWorker(node.left, depth + 1)
&& isSimpleExpressionWorker(node.right, depth + 1);
}
- else if (kind === 188) {
+ else if (kind === 189) {
return isSimpleExpressionWorker(node.condition, depth + 1)
&& isSimpleExpressionWorker(node.whenTrue, depth + 1)
&& isSimpleExpressionWorker(node.whenFalse, depth + 1);
}
- else if (kind === 183
- || kind === 182
- || kind === 181) {
+ else if (kind === 184
+ || kind === 183
+ || kind === 182) {
return isSimpleExpressionWorker(node.expression, depth + 1);
}
- else if (kind === 170) {
+ else if (kind === 171) {
return node.elements.length === 0;
}
- else if (kind === 171) {
+ else if (kind === 172) {
return node.properties.length === 0;
}
- else if (kind === 174) {
+ else if (kind === 175) {
if (!isSimpleExpressionWorker(node.expression, depth + 1)) {
return false;
}
@@ -7355,7 +8289,7 @@ var ts;
return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);
}
ts.getStartPositionOfRange = getStartPositionOfRange;
- function collectExternalModuleInfo(sourceFile, resolver) {
+ function collectExternalModuleInfo(sourceFile) {
var externalImports = [];
var exportSpecifiers = ts.createMap();
var exportEquals = undefined;
@@ -7363,26 +8297,21 @@ var ts;
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
- case 230:
- if (!node.importClause ||
- resolver.isReferencedAliasDeclaration(node.importClause, true)) {
- externalImports.push(node);
- }
+ case 231:
+ externalImports.push(node);
break;
- case 229:
- if (node.moduleReference.kind === 240 && resolver.isReferencedAliasDeclaration(node)) {
+ case 230:
+ if (node.moduleReference.kind === 241) {
externalImports.push(node);
}
break;
- case 236:
+ case 237:
if (node.moduleSpecifier) {
if (!node.exportClause) {
- if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) {
- externalImports.push(node);
- hasExportStarsToExportValues = true;
- }
+ externalImports.push(node);
+ hasExportStarsToExportValues = true;
}
- else if (resolver.isValueAliasDeclaration(node)) {
+ else {
externalImports.push(node);
}
}
@@ -7394,7 +8323,7 @@ var ts;
}
}
break;
- case 235:
+ case 236:
if (node.isExportEquals && !exportEquals) {
exportEquals = node;
}
@@ -7415,7 +8344,7 @@ var ts;
if (node.symbol) {
for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 221 && declaration !== node) {
+ if (declaration.kind === 222 && declaration !== node) {
return true;
}
}
@@ -7433,15 +8362,15 @@ var ts;
}
ts.isNodeArray = isNodeArray;
function isNoSubstitutionTemplateLiteral(node) {
- return node.kind === 11;
+ return node.kind === 12;
}
ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral;
function isLiteralKind(kind) {
- return 8 <= kind && kind <= 11;
+ return 8 <= kind && kind <= 12;
}
ts.isLiteralKind = isLiteralKind;
function isTextualLiteralKind(kind) {
- return kind === 9 || kind === 11;
+ return kind === 9 || kind === 12;
}
ts.isTextualLiteralKind = isTextualLiteralKind;
function isLiteralExpression(node) {
@@ -7449,21 +8378,21 @@ var ts;
}
ts.isLiteralExpression = isLiteralExpression;
function isTemplateLiteralKind(kind) {
- return 11 <= kind && kind <= 14;
+ return 12 <= kind && kind <= 15;
}
ts.isTemplateLiteralKind = isTemplateLiteralKind;
function isTemplateHead(node) {
- return node.kind === 12;
+ return node.kind === 13;
}
ts.isTemplateHead = isTemplateHead;
function isTemplateMiddleOrTemplateTail(node) {
var kind = node.kind;
- return kind === 13
- || kind === 14;
+ return kind === 14
+ || kind === 15;
}
ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail;
function isIdentifier(node) {
- return node.kind === 69;
+ return node.kind === 70;
}
ts.isIdentifier = isIdentifier;
function isGeneratedIdentifier(node) {
@@ -7475,87 +8404,87 @@ var ts;
}
ts.isModifier = isModifier;
function isQualifiedName(node) {
- return node.kind === 139;
+ return node.kind === 140;
}
ts.isQualifiedName = isQualifiedName;
function isComputedPropertyName(node) {
- return node.kind === 140;
+ return node.kind === 141;
}
ts.isComputedPropertyName = isComputedPropertyName;
function isEntityName(node) {
var kind = node.kind;
- return kind === 139
- || kind === 69;
+ return kind === 140
+ || kind === 70;
}
ts.isEntityName = isEntityName;
function isPropertyName(node) {
var kind = node.kind;
- return kind === 69
+ return kind === 70
|| kind === 9
|| kind === 8
- || kind === 140;
+ || kind === 141;
}
ts.isPropertyName = isPropertyName;
function isModuleName(node) {
var kind = node.kind;
- return kind === 69
+ return kind === 70
|| kind === 9;
}
ts.isModuleName = isModuleName;
function isBindingName(node) {
var kind = node.kind;
- return kind === 69
- || kind === 167
- || kind === 168;
+ return kind === 70
+ || kind === 168
+ || kind === 169;
}
ts.isBindingName = isBindingName;
function isTypeParameter(node) {
- return node.kind === 141;
+ return node.kind === 142;
}
ts.isTypeParameter = isTypeParameter;
function isParameter(node) {
- return node.kind === 142;
+ return node.kind === 143;
}
ts.isParameter = isParameter;
function isDecorator(node) {
- return node.kind === 143;
+ return node.kind === 144;
}
ts.isDecorator = isDecorator;
function isMethodDeclaration(node) {
- return node.kind === 147;
+ return node.kind === 148;
}
ts.isMethodDeclaration = isMethodDeclaration;
function isClassElement(node) {
var kind = node.kind;
- return kind === 148
- || kind === 145
- || kind === 147
- || kind === 149
+ return kind === 149
+ || kind === 146
+ || kind === 148
|| kind === 150
- || kind === 153
- || kind === 198;
+ || kind === 151
+ || kind === 154
+ || kind === 199;
}
ts.isClassElement = isClassElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
return kind === 253
|| kind === 254
- || kind === 147
- || kind === 149
+ || kind === 148
|| kind === 150
- || kind === 239;
+ || kind === 151
+ || kind === 240;
}
ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
function isTypeNodeKind(kind) {
- return (kind >= 154 && kind <= 166)
- || kind === 117
- || kind === 130
- || kind === 120
- || kind === 132
+ return (kind >= 155 && kind <= 167)
+ || kind === 118
+ || kind === 131
+ || kind === 121
|| kind === 133
- || kind === 103
- || kind === 127
- || kind === 194;
+ || kind === 134
+ || kind === 104
+ || kind === 128
+ || kind === 195;
}
function isTypeNode(node) {
return isTypeNodeKind(node.kind);
@@ -7564,94 +8493,94 @@ var ts;
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
- return kind === 168
- || kind === 167;
+ return kind === 169
+ || kind === 168;
}
return false;
}
ts.isBindingPattern = isBindingPattern;
function isBindingElement(node) {
- return node.kind === 169;
+ return node.kind === 170;
}
ts.isBindingElement = isBindingElement;
function isArrayBindingElement(node) {
var kind = node.kind;
- return kind === 169
- || kind === 193;
+ return kind === 170
+ || kind === 194;
}
ts.isArrayBindingElement = isArrayBindingElement;
function isPropertyAccessExpression(node) {
- return node.kind === 172;
+ return node.kind === 173;
}
ts.isPropertyAccessExpression = isPropertyAccessExpression;
function isElementAccessExpression(node) {
- return node.kind === 173;
+ return node.kind === 174;
}
ts.isElementAccessExpression = isElementAccessExpression;
function isBinaryExpression(node) {
- return node.kind === 187;
+ return node.kind === 188;
}
ts.isBinaryExpression = isBinaryExpression;
function isConditionalExpression(node) {
- return node.kind === 188;
+ return node.kind === 189;
}
ts.isConditionalExpression = isConditionalExpression;
function isCallExpression(node) {
- return node.kind === 174;
+ return node.kind === 175;
}
ts.isCallExpression = isCallExpression;
function isTemplateLiteral(node) {
var kind = node.kind;
- return kind === 189
- || kind === 11;
+ return kind === 190
+ || kind === 12;
}
ts.isTemplateLiteral = isTemplateLiteral;
function isSpreadElementExpression(node) {
- return node.kind === 191;
+ return node.kind === 192;
}
ts.isSpreadElementExpression = isSpreadElementExpression;
function isExpressionWithTypeArguments(node) {
- return node.kind === 194;
+ return node.kind === 195;
}
ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
function isLeftHandSideExpressionKind(kind) {
- return kind === 172
- || kind === 173
- || kind === 175
+ return kind === 173
|| kind === 174
- || kind === 241
- || kind === 242
|| kind === 176
- || kind === 170
- || kind === 178
+ || kind === 175
+ || kind === 242
+ || kind === 243
+ || kind === 177
|| kind === 171
- || kind === 192
|| kind === 179
- || kind === 69
- || kind === 10
+ || kind === 172
+ || kind === 193
+ || kind === 180
+ || kind === 70
+ || kind === 11
|| kind === 8
|| kind === 9
- || kind === 11
- || kind === 189
- || kind === 84
- || kind === 93
- || kind === 97
- || kind === 99
- || kind === 95
- || kind === 196;
+ || kind === 12
+ || kind === 190
+ || kind === 85
+ || kind === 94
+ || kind === 98
+ || kind === 100
+ || kind === 96
+ || kind === 197;
}
function isLeftHandSideExpression(node) {
return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
}
ts.isLeftHandSideExpression = isLeftHandSideExpression;
function isUnaryExpressionKind(kind) {
- return kind === 185
- || kind === 186
- || kind === 181
+ return kind === 186
+ || kind === 187
|| kind === 182
|| kind === 183
|| kind === 184
- || kind === 177
+ || kind === 185
+ || kind === 178
|| isLeftHandSideExpressionKind(kind);
}
function isUnaryExpression(node) {
@@ -7659,13 +8588,13 @@ var ts;
}
ts.isUnaryExpression = isUnaryExpression;
function isExpressionKind(kind) {
- return kind === 188
- || kind === 190
- || kind === 180
- || kind === 187
+ return kind === 189
|| kind === 191
- || kind === 195
- || kind === 193
+ || kind === 181
+ || kind === 188
+ || kind === 192
+ || kind === 196
+ || kind === 194
|| isUnaryExpressionKind(kind);
}
function isExpression(node) {
@@ -7674,8 +8603,8 @@ var ts;
ts.isExpression = isExpression;
function isAssertionExpression(node) {
var kind = node.kind;
- return kind === 177
- || kind === 195;
+ return kind === 178
+ || kind === 196;
}
ts.isAssertionExpression = isAssertionExpression;
function isPartiallyEmittedExpression(node) {
@@ -7692,15 +8621,15 @@ var ts;
}
ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
function isOmittedExpression(node) {
- return node.kind === 193;
+ return node.kind === 194;
}
ts.isOmittedExpression = isOmittedExpression;
function isTemplateSpan(node) {
- return node.kind === 197;
+ return node.kind === 198;
}
ts.isTemplateSpan = isTemplateSpan;
function isBlock(node) {
- return node.kind === 199;
+ return node.kind === 200;
}
ts.isBlock = isBlock;
function isConciseBody(node) {
@@ -7718,118 +8647,118 @@ var ts;
}
ts.isForInitializer = isForInitializer;
function isVariableDeclaration(node) {
- return node.kind === 218;
+ return node.kind === 219;
}
ts.isVariableDeclaration = isVariableDeclaration;
function isVariableDeclarationList(node) {
- return node.kind === 219;
+ return node.kind === 220;
}
ts.isVariableDeclarationList = isVariableDeclarationList;
function isCaseBlock(node) {
- return node.kind === 227;
+ return node.kind === 228;
}
ts.isCaseBlock = isCaseBlock;
function isModuleBody(node) {
var kind = node.kind;
- return kind === 226
- || kind === 225;
+ return kind === 227
+ || kind === 226;
}
ts.isModuleBody = isModuleBody;
function isImportEqualsDeclaration(node) {
- return node.kind === 229;
+ return node.kind === 230;
}
ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
function isImportClause(node) {
- return node.kind === 231;
+ return node.kind === 232;
}
ts.isImportClause = isImportClause;
function isNamedImportBindings(node) {
var kind = node.kind;
- return kind === 233
- || kind === 232;
+ return kind === 234
+ || kind === 233;
}
ts.isNamedImportBindings = isNamedImportBindings;
function isImportSpecifier(node) {
- return node.kind === 234;
+ return node.kind === 235;
}
ts.isImportSpecifier = isImportSpecifier;
function isNamedExports(node) {
- return node.kind === 237;
+ return node.kind === 238;
}
ts.isNamedExports = isNamedExports;
function isExportSpecifier(node) {
- return node.kind === 238;
+ return node.kind === 239;
}
ts.isExportSpecifier = isExportSpecifier;
function isModuleOrEnumDeclaration(node) {
- return node.kind === 225 || node.kind === 224;
+ return node.kind === 226 || node.kind === 225;
}
ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
function isDeclarationKind(kind) {
- return kind === 180
- || kind === 169
- || kind === 221
- || kind === 192
- || kind === 148
- || kind === 224
- || kind === 255
- || kind === 238
- || kind === 220
- || kind === 179
- || kind === 149
- || kind === 231
- || kind === 229
- || kind === 234
+ return kind === 181
+ || kind === 170
|| kind === 222
- || kind === 147
- || kind === 146
+ || kind === 193
+ || kind === 149
|| kind === 225
- || kind === 228
+ || kind === 255
+ || kind === 239
+ || kind === 221
+ || kind === 180
+ || kind === 150
|| kind === 232
- || kind === 142
+ || kind === 230
+ || kind === 235
+ || kind === 223
+ || kind === 148
+ || kind === 147
+ || kind === 226
+ || kind === 229
+ || kind === 233
+ || kind === 143
|| kind === 253
+ || kind === 146
|| kind === 145
- || kind === 144
- || kind === 150
+ || kind === 151
|| kind === 254
- || kind === 223
- || kind === 141
- || kind === 218
+ || kind === 224
+ || kind === 142
+ || kind === 219
|| kind === 279;
}
function isDeclarationStatementKind(kind) {
- return kind === 220
- || kind === 239
- || kind === 221
+ return kind === 221
+ || kind === 240
|| kind === 222
|| kind === 223
|| kind === 224
|| kind === 225
+ || kind === 226
+ || kind === 231
|| kind === 230
- || kind === 229
+ || kind === 237
|| kind === 236
- || kind === 235
- || kind === 228;
+ || kind === 229;
}
function isStatementKindButNotDeclarationKind(kind) {
- return kind === 210
+ return kind === 211
+ || kind === 210
+ || kind === 218
+ || kind === 205
+ || kind === 203
+ || kind === 202
+ || kind === 208
|| kind === 209
- || kind === 217
+ || kind === 207
|| kind === 204
- || kind === 202
+ || kind === 215
+ || kind === 212
+ || kind === 214
+ || kind === 216
+ || kind === 217
|| kind === 201
- || kind === 207
- || kind === 208
|| kind === 206
- || kind === 203
- || kind === 214
- || kind === 211
|| kind === 213
- || kind === 215
- || kind === 216
- || kind === 200
- || kind === 205
- || kind === 212
|| kind === 287;
}
function isDeclaration(node) {
@@ -7848,18 +8777,18 @@ var ts;
var kind = node.kind;
return isStatementKindButNotDeclarationKind(kind)
|| isDeclarationStatementKind(kind)
- || kind === 199;
+ || kind === 200;
}
ts.isStatement = isStatement;
function isModuleReference(node) {
var kind = node.kind;
- return kind === 240
- || kind === 139
- || kind === 69;
+ return kind === 241
+ || kind === 140
+ || kind === 70;
}
ts.isModuleReference = isModuleReference;
function isJsxOpeningElement(node) {
- return node.kind === 243;
+ return node.kind === 244;
}
ts.isJsxOpeningElement = isJsxOpeningElement;
function isJsxClosingElement(node) {
@@ -7868,17 +8797,17 @@ var ts;
ts.isJsxClosingElement = isJsxClosingElement;
function isJsxTagNameExpression(node) {
var kind = node.kind;
- return kind === 97
- || kind === 69
- || kind === 172;
+ return kind === 98
+ || kind === 70
+ || kind === 173;
}
ts.isJsxTagNameExpression = isJsxTagNameExpression;
function isJsxChild(node) {
var kind = node.kind;
- return kind === 241
+ return kind === 242
|| kind === 248
- || kind === 242
- || kind === 244;
+ || kind === 243
+ || kind === 10;
}
ts.isJsxChild = isJsxChild;
function isJsxAttributeLike(node) {
@@ -7938,7 +8867,16 @@ var ts;
})(ts || (ts = {}));
(function (ts) {
function getDefaultLibFileName(options) {
- return options.target === 2 ? "lib.es6.d.ts" : "lib.d.ts";
+ switch (options.target) {
+ case 4:
+ return "lib.es2017.d.ts";
+ case 3:
+ return "lib.es2016.d.ts";
+ case 2:
+ return "lib.es6.d.ts";
+ default:
+ return "lib.d.ts";
+ }
}
ts.getDefaultLibFileName = getDefaultLibFileName;
function textSpanEnd(span) {
@@ -8057,9 +8995,9 @@ var ts;
}
ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
function getTypeParameterOwner(d) {
- if (d && d.kind === 141) {
+ if (d && d.kind === 142) {
for (var current = d; current; current = current.parent) {
- if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 222) {
+ if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 223) {
return current;
}
}
@@ -8067,11 +9005,11 @@ var ts;
}
ts.getTypeParameterOwner = getTypeParameterOwner;
function isParameterPropertyDeclaration(node) {
- return ts.hasModifier(node, 92) && node.parent.kind === 148 && ts.isClassLike(node.parent.parent);
+ return ts.hasModifier(node, 92) && node.parent.kind === 149 && ts.isClassLike(node.parent.parent);
}
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
function walkUpBindingElementsAndPatterns(node) {
- while (node && (node.kind === 169 || ts.isBindingPattern(node))) {
+ while (node && (node.kind === 170 || ts.isBindingPattern(node))) {
node = node.parent;
}
return node;
@@ -8079,14 +9017,14 @@ var ts;
function getCombinedModifierFlags(node) {
node = walkUpBindingElementsAndPatterns(node);
var flags = ts.getModifierFlags(node);
- if (node.kind === 218) {
+ if (node.kind === 219) {
node = node.parent;
}
- if (node && node.kind === 219) {
+ if (node && node.kind === 220) {
flags |= ts.getModifierFlags(node);
node = node.parent;
}
- if (node && node.kind === 200) {
+ if (node && node.kind === 201) {
flags |= ts.getModifierFlags(node);
}
return flags;
@@ -8095,14 +9033,14 @@ var ts;
function getCombinedNodeFlags(node) {
node = walkUpBindingElementsAndPatterns(node);
var flags = node.flags;
- if (node.kind === 218) {
+ if (node.kind === 219) {
node = node.parent;
}
- if (node && node.kind === 219) {
+ if (node && node.kind === 220) {
flags |= node.flags;
node = node.parent;
}
- if (node && node.kind === 200) {
+ if (node && node.kind === 201) {
flags |= node.flags;
}
return flags;
@@ -8195,7 +9133,7 @@ var ts;
return node;
}
else if (typeof value === "boolean") {
- return createNode(value ? 99 : 84, location, undefined);
+ return createNode(value ? 100 : 85, location, undefined);
}
else if (typeof value === "string") {
var node = createNode(9, location, undefined);
@@ -8212,7 +9150,7 @@ var ts;
ts.createLiteral = createLiteral;
var nextAutoGenerateId = 0;
function createIdentifier(text, location) {
- var node = createNode(69, location);
+ var node = createNode(70, location);
node.text = ts.escapeIdentifier(text);
node.originalKeywordKind = ts.stringToToken(text);
node.autoGenerateKind = 0;
@@ -8221,7 +9159,7 @@ var ts;
}
ts.createIdentifier = createIdentifier;
function createTempVariable(recordTempVariable, location) {
- var name = createNode(69, location);
+ var name = createNode(70, location);
name.text = "";
name.originalKeywordKind = 0;
name.autoGenerateKind = 1;
@@ -8234,7 +9172,7 @@ var ts;
}
ts.createTempVariable = createTempVariable;
function createLoopVariable(location) {
- var name = createNode(69, location);
+ var name = createNode(70, location);
name.text = "";
name.originalKeywordKind = 0;
name.autoGenerateKind = 2;
@@ -8244,7 +9182,7 @@ var ts;
}
ts.createLoopVariable = createLoopVariable;
function createUniqueName(text, location) {
- var name = createNode(69, location);
+ var name = createNode(70, location);
name.text = text;
name.originalKeywordKind = 0;
name.autoGenerateKind = 3;
@@ -8254,7 +9192,7 @@ var ts;
}
ts.createUniqueName = createUniqueName;
function getGeneratedNameForNode(node, location) {
- var name = createNode(69, location);
+ var name = createNode(70, location);
name.original = node;
name.text = "";
name.originalKeywordKind = 0;
@@ -8269,22 +9207,22 @@ var ts;
}
ts.createToken = createToken;
function createSuper() {
- var node = createNode(95);
+ var node = createNode(96);
return node;
}
ts.createSuper = createSuper;
function createThis(location) {
- var node = createNode(97, location);
+ var node = createNode(98, location);
return node;
}
ts.createThis = createThis;
function createNull() {
- var node = createNode(93);
+ var node = createNode(94);
return node;
}
ts.createNull = createNull;
function createComputedPropertyName(expression, location) {
- var node = createNode(140, location);
+ var node = createNode(141, location);
node.expression = expression;
return node;
}
@@ -8301,7 +9239,7 @@ var ts;
}
ts.createParameter = createParameter;
function createParameterDeclaration(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) {
- var node = createNode(142, location, flags);
+ var node = createNode(143, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.dotDotDotToken = dotDotDotToken;
@@ -8320,7 +9258,7 @@ var ts;
}
ts.updateParameterDeclaration = updateParameterDeclaration;
function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) {
- var node = createNode(145, location);
+ var node = createNode(146, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.name = typeof name === "string" ? createIdentifier(name) : name;
@@ -8338,7 +9276,7 @@ var ts;
}
ts.updateProperty = updateProperty;
function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
- var node = createNode(147, location, flags);
+ var node = createNode(148, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.asteriskToken = asteriskToken;
@@ -8358,7 +9296,7 @@ var ts;
}
ts.updateMethod = updateMethod;
function createConstructor(decorators, modifiers, parameters, body, location, flags) {
- var node = createNode(148, location, flags);
+ var node = createNode(149, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.typeParameters = undefined;
@@ -8376,7 +9314,7 @@ var ts;
}
ts.updateConstructor = updateConstructor;
function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) {
- var node = createNode(149, location, flags);
+ var node = createNode(150, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.name = typeof name === "string" ? createIdentifier(name) : name;
@@ -8395,7 +9333,7 @@ var ts;
}
ts.updateGetAccessor = updateGetAccessor;
function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) {
- var node = createNode(150, location, flags);
+ var node = createNode(151, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.name = typeof name === "string" ? createIdentifier(name) : name;
@@ -8413,7 +9351,7 @@ var ts;
}
ts.updateSetAccessor = updateSetAccessor;
function createObjectBindingPattern(elements, location) {
- var node = createNode(167, location);
+ var node = createNode(168, location);
node.elements = createNodeArray(elements);
return node;
}
@@ -8426,7 +9364,7 @@ var ts;
}
ts.updateObjectBindingPattern = updateObjectBindingPattern;
function createArrayBindingPattern(elements, location) {
- var node = createNode(168, location);
+ var node = createNode(169, location);
node.elements = createNodeArray(elements);
return node;
}
@@ -8439,7 +9377,7 @@ var ts;
}
ts.updateArrayBindingPattern = updateArrayBindingPattern;
function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) {
- var node = createNode(169, location);
+ var node = createNode(170, location);
node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName;
node.dotDotDotToken = dotDotDotToken;
node.name = typeof name === "string" ? createIdentifier(name) : name;
@@ -8455,7 +9393,7 @@ var ts;
}
ts.updateBindingElement = updateBindingElement;
function createArrayLiteral(elements, location, multiLine) {
- var node = createNode(170, location);
+ var node = createNode(171, location);
node.elements = parenthesizeListElements(createNodeArray(elements));
if (multiLine) {
node.multiLine = true;
@@ -8471,7 +9409,7 @@ var ts;
}
ts.updateArrayLiteral = updateArrayLiteral;
function createObjectLiteral(properties, location, multiLine) {
- var node = createNode(171, location);
+ var node = createNode(172, location);
node.properties = createNodeArray(properties);
if (multiLine) {
node.multiLine = true;
@@ -8487,7 +9425,7 @@ var ts;
}
ts.updateObjectLiteral = updateObjectLiteral;
function createPropertyAccess(expression, name, location, flags) {
- var node = createNode(172, location, flags);
+ var node = createNode(173, location, flags);
node.expression = parenthesizeForAccess(expression);
(node.emitNode || (node.emitNode = {})).flags |= 1048576;
node.name = typeof name === "string" ? createIdentifier(name) : name;
@@ -8504,7 +9442,7 @@ var ts;
}
ts.updatePropertyAccess = updatePropertyAccess;
function createElementAccess(expression, index, location) {
- var node = createNode(173, location);
+ var node = createNode(174, location);
node.expression = parenthesizeForAccess(expression);
node.argumentExpression = typeof index === "number" ? createLiteral(index) : index;
return node;
@@ -8518,7 +9456,7 @@ var ts;
}
ts.updateElementAccess = updateElementAccess;
function createCall(expression, typeArguments, argumentsArray, location, flags) {
- var node = createNode(174, location, flags);
+ var node = createNode(175, location, flags);
node.expression = parenthesizeForAccess(expression);
if (typeArguments) {
node.typeArguments = createNodeArray(typeArguments);
@@ -8535,7 +9473,7 @@ var ts;
}
ts.updateCall = updateCall;
function createNew(expression, typeArguments, argumentsArray, location, flags) {
- var node = createNode(175, location, flags);
+ var node = createNode(176, location, flags);
node.expression = parenthesizeForNew(expression);
node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;
node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;
@@ -8550,7 +9488,7 @@ var ts;
}
ts.updateNew = updateNew;
function createTaggedTemplate(tag, template, location) {
- var node = createNode(176, location);
+ var node = createNode(177, location);
node.tag = parenthesizeForAccess(tag);
node.template = template;
return node;
@@ -8564,7 +9502,7 @@ var ts;
}
ts.updateTaggedTemplate = updateTaggedTemplate;
function createParen(expression, location) {
- var node = createNode(178, location);
+ var node = createNode(179, location);
node.expression = expression;
return node;
}
@@ -8576,9 +9514,9 @@ var ts;
return node;
}
ts.updateParen = updateParen;
- function createFunctionExpression(asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
- var node = createNode(179, location, flags);
- node.modifiers = undefined;
+ function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
+ var node = createNode(180, location, flags);
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.asteriskToken = asteriskToken;
node.name = typeof name === "string" ? createIdentifier(name) : name;
node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
@@ -8588,20 +9526,20 @@ var ts;
return node;
}
ts.createFunctionExpression = createFunctionExpression;
- function updateFunctionExpression(node, name, typeParameters, parameters, type, body) {
- if (node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {
- return updateNode(createFunctionExpression(node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);
+ function updateFunctionExpression(node, modifiers, name, typeParameters, parameters, type, body) {
+ if (node.name !== name || node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {
+ return updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);
}
return node;
}
ts.updateFunctionExpression = updateFunctionExpression;
function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) {
- var node = createNode(180, location, flags);
+ var node = createNode(181, location, flags);
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
node.parameters = createNodeArray(parameters);
node.type = type;
- node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(34);
+ node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(35);
node.body = parenthesizeConciseBody(body);
return node;
}
@@ -8614,7 +9552,7 @@ var ts;
}
ts.updateArrowFunction = updateArrowFunction;
function createDelete(expression, location) {
- var node = createNode(181, location);
+ var node = createNode(182, location);
node.expression = parenthesizePrefixOperand(expression);
return node;
}
@@ -8627,7 +9565,7 @@ var ts;
}
ts.updateDelete = updateDelete;
function createTypeOf(expression, location) {
- var node = createNode(182, location);
+ var node = createNode(183, location);
node.expression = parenthesizePrefixOperand(expression);
return node;
}
@@ -8640,7 +9578,7 @@ var ts;
}
ts.updateTypeOf = updateTypeOf;
function createVoid(expression, location) {
- var node = createNode(183, location);
+ var node = createNode(184, location);
node.expression = parenthesizePrefixOperand(expression);
return node;
}
@@ -8653,7 +9591,7 @@ var ts;
}
ts.updateVoid = updateVoid;
function createAwait(expression, location) {
- var node = createNode(184, location);
+ var node = createNode(185, location);
node.expression = parenthesizePrefixOperand(expression);
return node;
}
@@ -8666,7 +9604,7 @@ var ts;
}
ts.updateAwait = updateAwait;
function createPrefix(operator, operand, location) {
- var node = createNode(185, location);
+ var node = createNode(186, location);
node.operator = operator;
node.operand = parenthesizePrefixOperand(operand);
return node;
@@ -8680,7 +9618,7 @@ var ts;
}
ts.updatePrefix = updatePrefix;
function createPostfix(operand, operator, location) {
- var node = createNode(186, location);
+ var node = createNode(187, location);
node.operand = parenthesizePostfixOperand(operand);
node.operator = operator;
return node;
@@ -8696,7 +9634,7 @@ var ts;
function createBinary(left, operator, right, location) {
var operatorToken = typeof operator === "number" ? createToken(operator) : operator;
var operatorKind = operatorToken.kind;
- var node = createNode(187, location);
+ var node = createNode(188, location);
node.left = parenthesizeBinaryOperand(operatorKind, left, true, undefined);
node.operatorToken = operatorToken;
node.right = parenthesizeBinaryOperand(operatorKind, right, false, node.left);
@@ -8711,7 +9649,7 @@ var ts;
}
ts.updateBinary = updateBinary;
function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) {
- var node = createNode(188, location);
+ var node = createNode(189, location);
node.condition = condition;
node.questionToken = questionToken;
node.whenTrue = whenTrue;
@@ -8728,7 +9666,7 @@ var ts;
}
ts.updateConditional = updateConditional;
function createTemplateExpression(head, templateSpans, location) {
- var node = createNode(189, location);
+ var node = createNode(190, location);
node.head = head;
node.templateSpans = createNodeArray(templateSpans);
return node;
@@ -8742,7 +9680,7 @@ var ts;
}
ts.updateTemplateExpression = updateTemplateExpression;
function createYield(asteriskToken, expression, location) {
- var node = createNode(190, location);
+ var node = createNode(191, location);
node.asteriskToken = asteriskToken;
node.expression = expression;
return node;
@@ -8756,7 +9694,7 @@ var ts;
}
ts.updateYield = updateYield;
function createSpread(expression, location) {
- var node = createNode(191, location);
+ var node = createNode(192, location);
node.expression = parenthesizeExpressionForList(expression);
return node;
}
@@ -8769,7 +9707,7 @@ var ts;
}
ts.updateSpread = updateSpread;
function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) {
- var node = createNode(192, location);
+ var node = createNode(193, location);
node.decorators = undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.name = name;
@@ -8787,12 +9725,12 @@ var ts;
}
ts.updateClassExpression = updateClassExpression;
function createOmittedExpression(location) {
- var node = createNode(193, location);
+ var node = createNode(194, location);
return node;
}
ts.createOmittedExpression = createOmittedExpression;
function createExpressionWithTypeArguments(typeArguments, expression, location) {
- var node = createNode(194, location);
+ var node = createNode(195, location);
node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;
node.expression = parenthesizeForAccess(expression);
return node;
@@ -8806,7 +9744,7 @@ var ts;
}
ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;
function createTemplateSpan(expression, literal, location) {
- var node = createNode(197, location);
+ var node = createNode(198, location);
node.expression = expression;
node.literal = literal;
return node;
@@ -8820,7 +9758,7 @@ var ts;
}
ts.updateTemplateSpan = updateTemplateSpan;
function createBlock(statements, location, multiLine, flags) {
- var block = createNode(199, location, flags);
+ var block = createNode(200, location, flags);
block.statements = createNodeArray(statements);
if (multiLine) {
block.multiLine = true;
@@ -8836,7 +9774,7 @@ var ts;
}
ts.updateBlock = updateBlock;
function createVariableStatement(modifiers, declarationList, location, flags) {
- var node = createNode(200, location, flags);
+ var node = createNode(201, location, flags);
node.decorators = undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
@@ -8851,7 +9789,7 @@ var ts;
}
ts.updateVariableStatement = updateVariableStatement;
function createVariableDeclarationList(declarations, location, flags) {
- var node = createNode(219, location, flags);
+ var node = createNode(220, location, flags);
node.declarations = createNodeArray(declarations);
return node;
}
@@ -8864,7 +9802,7 @@ var ts;
}
ts.updateVariableDeclarationList = updateVariableDeclarationList;
function createVariableDeclaration(name, type, initializer, location, flags) {
- var node = createNode(218, location, flags);
+ var node = createNode(219, location, flags);
node.name = typeof name === "string" ? createIdentifier(name) : name;
node.type = type;
node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;
@@ -8879,11 +9817,11 @@ var ts;
}
ts.updateVariableDeclaration = updateVariableDeclaration;
function createEmptyStatement(location) {
- return createNode(201, location);
+ return createNode(202, location);
}
ts.createEmptyStatement = createEmptyStatement;
function createStatement(expression, location, flags) {
- var node = createNode(202, location, flags);
+ var node = createNode(203, location, flags);
node.expression = parenthesizeExpressionForExpressionStatement(expression);
return node;
}
@@ -8896,7 +9834,7 @@ var ts;
}
ts.updateStatement = updateStatement;
function createIf(expression, thenStatement, elseStatement, location) {
- var node = createNode(203, location);
+ var node = createNode(204, location);
node.expression = expression;
node.thenStatement = thenStatement;
node.elseStatement = elseStatement;
@@ -8911,7 +9849,7 @@ var ts;
}
ts.updateIf = updateIf;
function createDo(statement, expression, location) {
- var node = createNode(204, location);
+ var node = createNode(205, location);
node.statement = statement;
node.expression = expression;
return node;
@@ -8925,7 +9863,7 @@ var ts;
}
ts.updateDo = updateDo;
function createWhile(expression, statement, location) {
- var node = createNode(205, location);
+ var node = createNode(206, location);
node.expression = expression;
node.statement = statement;
return node;
@@ -8939,7 +9877,7 @@ var ts;
}
ts.updateWhile = updateWhile;
function createFor(initializer, condition, incrementor, statement, location) {
- var node = createNode(206, location, undefined);
+ var node = createNode(207, location, undefined);
node.initializer = initializer;
node.condition = condition;
node.incrementor = incrementor;
@@ -8955,7 +9893,7 @@ var ts;
}
ts.updateFor = updateFor;
function createForIn(initializer, expression, statement, location) {
- var node = createNode(207, location);
+ var node = createNode(208, location);
node.initializer = initializer;
node.expression = expression;
node.statement = statement;
@@ -8970,7 +9908,7 @@ var ts;
}
ts.updateForIn = updateForIn;
function createForOf(initializer, expression, statement, location) {
- var node = createNode(208, location);
+ var node = createNode(209, location);
node.initializer = initializer;
node.expression = expression;
node.statement = statement;
@@ -8985,7 +9923,7 @@ var ts;
}
ts.updateForOf = updateForOf;
function createContinue(label, location) {
- var node = createNode(209, location);
+ var node = createNode(210, location);
if (label) {
node.label = label;
}
@@ -9000,7 +9938,7 @@ var ts;
}
ts.updateContinue = updateContinue;
function createBreak(label, location) {
- var node = createNode(210, location);
+ var node = createNode(211, location);
if (label) {
node.label = label;
}
@@ -9015,7 +9953,7 @@ var ts;
}
ts.updateBreak = updateBreak;
function createReturn(expression, location) {
- var node = createNode(211, location);
+ var node = createNode(212, location);
node.expression = expression;
return node;
}
@@ -9028,7 +9966,7 @@ var ts;
}
ts.updateReturn = updateReturn;
function createWith(expression, statement, location) {
- var node = createNode(212, location);
+ var node = createNode(213, location);
node.expression = expression;
node.statement = statement;
return node;
@@ -9042,7 +9980,7 @@ var ts;
}
ts.updateWith = updateWith;
function createSwitch(expression, caseBlock, location) {
- var node = createNode(213, location);
+ var node = createNode(214, location);
node.expression = parenthesizeExpressionForList(expression);
node.caseBlock = caseBlock;
return node;
@@ -9056,7 +9994,7 @@ var ts;
}
ts.updateSwitch = updateSwitch;
function createLabel(label, statement, location) {
- var node = createNode(214, location);
+ var node = createNode(215, location);
node.label = typeof label === "string" ? createIdentifier(label) : label;
node.statement = statement;
return node;
@@ -9070,7 +10008,7 @@ var ts;
}
ts.updateLabel = updateLabel;
function createThrow(expression, location) {
- var node = createNode(215, location);
+ var node = createNode(216, location);
node.expression = expression;
return node;
}
@@ -9083,7 +10021,7 @@ var ts;
}
ts.updateThrow = updateThrow;
function createTry(tryBlock, catchClause, finallyBlock, location) {
- var node = createNode(216, location);
+ var node = createNode(217, location);
node.tryBlock = tryBlock;
node.catchClause = catchClause;
node.finallyBlock = finallyBlock;
@@ -9098,7 +10036,7 @@ var ts;
}
ts.updateTry = updateTry;
function createCaseBlock(clauses, location) {
- var node = createNode(227, location);
+ var node = createNode(228, location);
node.clauses = createNodeArray(clauses);
return node;
}
@@ -9111,7 +10049,7 @@ var ts;
}
ts.updateCaseBlock = updateCaseBlock;
function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
- var node = createNode(220, location, flags);
+ var node = createNode(221, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.asteriskToken = asteriskToken;
@@ -9131,7 +10069,7 @@ var ts;
}
ts.updateFunctionDeclaration = updateFunctionDeclaration;
function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) {
- var node = createNode(221, location);
+ var node = createNode(222, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.name = name;
@@ -9149,7 +10087,7 @@ var ts;
}
ts.updateClassDeclaration = updateClassDeclaration;
function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) {
- var node = createNode(230, location);
+ var node = createNode(231, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.importClause = importClause;
@@ -9165,7 +10103,7 @@ var ts;
}
ts.updateImportDeclaration = updateImportDeclaration;
function createImportClause(name, namedBindings, location) {
- var node = createNode(231, location);
+ var node = createNode(232, location);
node.name = name;
node.namedBindings = namedBindings;
return node;
@@ -9179,7 +10117,7 @@ var ts;
}
ts.updateImportClause = updateImportClause;
function createNamespaceImport(name, location) {
- var node = createNode(232, location);
+ var node = createNode(233, location);
node.name = name;
return node;
}
@@ -9192,7 +10130,7 @@ var ts;
}
ts.updateNamespaceImport = updateNamespaceImport;
function createNamedImports(elements, location) {
- var node = createNode(233, location);
+ var node = createNode(234, location);
node.elements = createNodeArray(elements);
return node;
}
@@ -9205,7 +10143,7 @@ var ts;
}
ts.updateNamedImports = updateNamedImports;
function createImportSpecifier(propertyName, name, location) {
- var node = createNode(234, location);
+ var node = createNode(235, location);
node.propertyName = propertyName;
node.name = name;
return node;
@@ -9219,7 +10157,7 @@ var ts;
}
ts.updateImportSpecifier = updateImportSpecifier;
function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) {
- var node = createNode(235, location);
+ var node = createNode(236, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.isExportEquals = isExportEquals;
@@ -9235,7 +10173,7 @@ var ts;
}
ts.updateExportAssignment = updateExportAssignment;
function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) {
- var node = createNode(236, location);
+ var node = createNode(237, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.exportClause = exportClause;
@@ -9251,7 +10189,7 @@ var ts;
}
ts.updateExportDeclaration = updateExportDeclaration;
function createNamedExports(elements, location) {
- var node = createNode(237, location);
+ var node = createNode(238, location);
node.elements = createNodeArray(elements);
return node;
}
@@ -9264,7 +10202,7 @@ var ts;
}
ts.updateNamedExports = updateNamedExports;
function createExportSpecifier(name, propertyName, location) {
- var node = createNode(238, location);
+ var node = createNode(239, location);
node.name = typeof name === "string" ? createIdentifier(name) : name;
node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName;
return node;
@@ -9278,7 +10216,7 @@ var ts;
}
ts.updateExportSpecifier = updateExportSpecifier;
function createJsxElement(openingElement, children, closingElement, location) {
- var node = createNode(241, location);
+ var node = createNode(242, location);
node.openingElement = openingElement;
node.children = createNodeArray(children);
node.closingElement = closingElement;
@@ -9293,7 +10231,7 @@ var ts;
}
ts.updateJsxElement = updateJsxElement;
function createJsxSelfClosingElement(tagName, attributes, location) {
- var node = createNode(242, location);
+ var node = createNode(243, location);
node.tagName = tagName;
node.attributes = createNodeArray(attributes);
return node;
@@ -9307,7 +10245,7 @@ var ts;
}
ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;
function createJsxOpeningElement(tagName, attributes, location) {
- var node = createNode(243, location);
+ var node = createNode(244, location);
node.tagName = tagName;
node.attributes = createNodeArray(attributes);
return node;
@@ -9541,47 +10479,47 @@ var ts;
}
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function createComma(left, right) {
- return createBinary(left, 24, right);
+ return createBinary(left, 25, right);
}
ts.createComma = createComma;
function createLessThan(left, right, location) {
- return createBinary(left, 25, right, location);
+ return createBinary(left, 26, right, location);
}
ts.createLessThan = createLessThan;
function createAssignment(left, right, location) {
- return createBinary(left, 56, right, location);
+ return createBinary(left, 57, right, location);
}
ts.createAssignment = createAssignment;
function createStrictEquality(left, right) {
- return createBinary(left, 32, right);
+ return createBinary(left, 33, right);
}
ts.createStrictEquality = createStrictEquality;
function createStrictInequality(left, right) {
- return createBinary(left, 33, right);
+ return createBinary(left, 34, right);
}
ts.createStrictInequality = createStrictInequality;
function createAdd(left, right) {
- return createBinary(left, 35, right);
+ return createBinary(left, 36, right);
}
ts.createAdd = createAdd;
function createSubtract(left, right) {
- return createBinary(left, 36, right);
+ return createBinary(left, 37, right);
}
ts.createSubtract = createSubtract;
function createPostfixIncrement(operand, location) {
- return createPostfix(operand, 41, location);
+ return createPostfix(operand, 42, location);
}
ts.createPostfixIncrement = createPostfixIncrement;
function createLogicalAnd(left, right) {
- return createBinary(left, 51, right);
+ return createBinary(left, 52, right);
}
ts.createLogicalAnd = createLogicalAnd;
function createLogicalOr(left, right) {
- return createBinary(left, 52, right);
+ return createBinary(left, 53, right);
}
ts.createLogicalOr = createLogicalOr;
function createLogicalNot(operand) {
- return createPrefix(49, operand);
+ return createPrefix(50, operand);
}
ts.createLogicalNot = createLogicalNot;
function createVoidZero() {
@@ -9600,7 +10538,7 @@ var ts;
}
ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName;
function createRestParameter(name) {
- return createParameterDeclaration(undefined, undefined, createToken(22), name, undefined, undefined, undefined);
+ return createParameterDeclaration(undefined, undefined, createToken(23), name, undefined, undefined, undefined);
}
ts.createRestParameter = createRestParameter;
function createFunctionCall(func, thisArg, argumentsList, location) {
@@ -9714,7 +10652,7 @@ var ts;
}
ts.createDecorateHelper = createDecorateHelper;
function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) {
- var generatorFunc = createFunctionExpression(createToken(37), undefined, undefined, [], undefined, body);
+ var generatorFunc = createFunctionExpression(undefined, createToken(38), undefined, undefined, [], undefined, body);
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152;
return createCall(createHelperName(externalHelpersModuleName, "__awaiter"), undefined, [
createThis(),
@@ -9758,7 +10696,7 @@ var ts;
setter
]))))));
return createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("_super", undefined, createCall(createParen(createFunctionExpression(undefined, undefined, undefined, [
+ createVariableDeclaration("_super", undefined, createCall(createParen(createFunctionExpression(undefined, undefined, undefined, undefined, [
createParameter("geti"),
createParameter("seti")
], undefined, createBlock([
@@ -9780,19 +10718,19 @@ var ts;
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = skipParentheses(node);
switch (target.kind) {
- case 69:
+ case 70:
return cacheIdentifiers;
- case 97:
+ case 98:
case 8:
case 9:
return false;
- case 170:
+ case 171:
var elements = target.elements;
if (elements.length === 0) {
return false;
}
return true;
- case 171:
+ case 172:
return target.properties.length > 0;
default:
return true;
@@ -9806,13 +10744,13 @@ var ts;
thisArg = createThis();
target = callee;
}
- else if (callee.kind === 95) {
+ else if (callee.kind === 96) {
thisArg = createThis();
target = languageVersion < 2 ? createIdentifier("_super", callee) : callee;
}
else {
switch (callee.kind) {
- case 172: {
+ case 173: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
thisArg = createTempVariable(recordTempVariable);
target = createPropertyAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.name, callee);
@@ -9823,7 +10761,7 @@ var ts;
}
break;
}
- case 173: {
+ case 174: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
thisArg = createTempVariable(recordTempVariable);
target = createElementAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.argumentExpression, callee);
@@ -9873,14 +10811,14 @@ var ts;
ts.createExpressionForPropertyName = createExpressionForPropertyName;
function createExpressionForObjectLiteralElementLike(node, property, receiver) {
switch (property.kind) {
- case 149:
case 150:
+ case 151:
return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine);
case 253:
return createExpressionForPropertyAssignment(property, receiver);
case 254:
return createExpressionForShorthandPropertyAssignment(property, receiver);
- case 147:
+ case 148:
return createExpressionForMethodDeclaration(property, receiver);
}
}
@@ -9890,13 +10828,13 @@ var ts;
if (property === firstAccessor) {
var properties_1 = [];
if (getAccessor) {
- var getterFunction = createFunctionExpression(undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body, getAccessor);
+ var getterFunction = createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body, getAccessor);
setOriginalNode(getterFunction, getAccessor);
var getter = createPropertyAssignment("get", getterFunction);
properties_1.push(getter);
}
if (setAccessor) {
- var setterFunction = createFunctionExpression(undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body, setAccessor);
+ var setterFunction = createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body, setAccessor);
setOriginalNode(setterFunction, setAccessor);
var setter = createPropertyAssignment("set", setterFunction);
properties_1.push(setter);
@@ -9919,13 +10857,13 @@ var ts;
return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), getSynthesizedClone(property.name), property), property));
}
function createExpressionForMethodDeclaration(method, receiver) {
- return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method));
+ return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method));
}
function isUseStrictPrologue(node) {
return node.expression.text === "use strict";
}
function addPrologueDirectives(target, source, ensureUseStrict, visitor) {
- ts.Debug.assert(target.length === 0, "PrologueDirectives should be at the first statement in the target statements array");
+ ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array");
var foundUseStrict = false;
var statementOffset = 0;
var numStatements = source.length;
@@ -9938,16 +10876,20 @@ var ts;
target.push(statement);
}
else {
- if (ensureUseStrict && !foundUseStrict) {
- target.push(startOnNewLine(createStatement(createLiteral("use strict"))));
- foundUseStrict = true;
- }
- if (getEmitFlags(statement) & 8388608) {
- target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);
- }
- else {
- break;
- }
+ break;
+ }
+ statementOffset++;
+ }
+ if (ensureUseStrict && !foundUseStrict) {
+ target.push(startOnNewLine(createStatement(createLiteral("use strict"))));
+ }
+ while (statementOffset < numStatements) {
+ var statement = source[statementOffset];
+ if (getEmitFlags(statement) & 8388608) {
+ target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);
+ }
+ else {
+ break;
}
statementOffset++;
}
@@ -9978,7 +10920,7 @@ var ts;
ts.ensureUseStrict = ensureUseStrict;
function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
var skipped = skipPartiallyEmittedExpressions(operand);
- if (skipped.kind === 178) {
+ if (skipped.kind === 179) {
return operand;
}
return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)
@@ -9987,15 +10929,15 @@ var ts;
}
ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand;
function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
- var binaryOperatorPrecedence = ts.getOperatorPrecedence(187, binaryOperator);
- var binaryOperatorAssociativity = ts.getOperatorAssociativity(187, binaryOperator);
+ var binaryOperatorPrecedence = ts.getOperatorPrecedence(188, binaryOperator);
+ var binaryOperatorAssociativity = ts.getOperatorAssociativity(188, binaryOperator);
var emittedOperand = skipPartiallyEmittedExpressions(operand);
var operandPrecedence = ts.getExpressionPrecedence(emittedOperand);
switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) {
case -1:
if (!isLeftSideOfBinary
&& binaryOperatorAssociativity === 1
- && operand.kind === 190) {
+ && operand.kind === 191) {
return false;
}
return true;
@@ -10011,7 +10953,7 @@ var ts;
if (operatorHasAssociativeProperty(binaryOperator)) {
return false;
}
- if (binaryOperator === 35) {
+ if (binaryOperator === 36) {
var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0;
if (ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) {
return false;
@@ -10024,17 +10966,17 @@ var ts;
}
}
function operatorHasAssociativeProperty(binaryOperator) {
- return binaryOperator === 37
+ return binaryOperator === 38
+ || binaryOperator === 48
|| binaryOperator === 47
- || binaryOperator === 46
- || binaryOperator === 48;
+ || binaryOperator === 49;
}
function getLiteralKindOfBinaryPlusOperand(node) {
node = skipPartiallyEmittedExpressions(node);
if (ts.isLiteralKind(node.kind)) {
return node.kind;
}
- if (node.kind === 187 && node.operatorToken.kind === 35) {
+ if (node.kind === 188 && node.operatorToken.kind === 36) {
if (node.cachedLiteralKind !== undefined) {
return node.cachedLiteralKind;
}
@@ -10051,9 +10993,9 @@ var ts;
function parenthesizeForNew(expression) {
var emittedExpression = skipPartiallyEmittedExpressions(expression);
switch (emittedExpression.kind) {
- case 174:
- return createParen(expression);
case 175:
+ return createParen(expression);
+ case 176:
return emittedExpression.arguments
? expression
: createParen(expression);
@@ -10064,7 +11006,7 @@ var ts;
function parenthesizeForAccess(expression) {
var emittedExpression = skipPartiallyEmittedExpressions(expression);
if (ts.isLeftHandSideExpression(emittedExpression)
- && (emittedExpression.kind !== 175 || emittedExpression.arguments)
+ && (emittedExpression.kind !== 176 || emittedExpression.arguments)
&& emittedExpression.kind !== 8) {
return expression;
}
@@ -10102,7 +11044,7 @@ var ts;
function parenthesizeExpressionForList(expression) {
var emittedExpression = skipPartiallyEmittedExpressions(expression);
var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);
- var commaPrecedence = ts.getOperatorPrecedence(187, 24);
+ var commaPrecedence = ts.getOperatorPrecedence(188, 25);
return expressionPrecedence > commaPrecedence
? expression
: createParen(expression, expression);
@@ -10113,7 +11055,7 @@ var ts;
if (ts.isCallExpression(emittedExpression)) {
var callee = emittedExpression.expression;
var kind = skipPartiallyEmittedExpressions(callee).kind;
- if (kind === 179 || kind === 180) {
+ if (kind === 180 || kind === 181) {
var mutableCall = getMutableClone(emittedExpression);
mutableCall.expression = createParen(callee, callee);
return recreatePartiallyEmittedExpressions(expression, mutableCall);
@@ -10121,7 +11063,7 @@ var ts;
}
else {
var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind;
- if (leftmostExpressionKind === 171 || leftmostExpressionKind === 179) {
+ if (leftmostExpressionKind === 172 || leftmostExpressionKind === 180) {
return createParen(expression, expression);
}
}
@@ -10139,18 +11081,18 @@ var ts;
function getLeftmostExpression(node) {
while (true) {
switch (node.kind) {
- case 186:
+ case 187:
node = node.operand;
continue;
- case 187:
+ case 188:
node = node.left;
continue;
- case 188:
+ case 189:
node = node.condition;
continue;
+ case 175:
case 174:
case 173:
- case 172:
node = node.expression;
continue;
case 288:
@@ -10162,12 +11104,19 @@ var ts;
}
function parenthesizeConciseBody(body) {
var emittedBody = skipPartiallyEmittedExpressions(body);
- if (emittedBody.kind === 171) {
+ if (emittedBody.kind === 172) {
return createParen(body, body);
}
return body;
}
ts.parenthesizeConciseBody = parenthesizeConciseBody;
+ (function (OuterExpressionKinds) {
+ OuterExpressionKinds[OuterExpressionKinds["Parentheses"] = 1] = "Parentheses";
+ OuterExpressionKinds[OuterExpressionKinds["Assertions"] = 2] = "Assertions";
+ OuterExpressionKinds[OuterExpressionKinds["PartiallyEmittedExpressions"] = 4] = "PartiallyEmittedExpressions";
+ OuterExpressionKinds[OuterExpressionKinds["All"] = 7] = "All";
+ })(ts.OuterExpressionKinds || (ts.OuterExpressionKinds = {}));
+ var OuterExpressionKinds = ts.OuterExpressionKinds;
function skipOuterExpressions(node, kinds) {
if (kinds === void 0) { kinds = 7; }
var previousNode;
@@ -10187,7 +11136,7 @@ var ts;
}
ts.skipOuterExpressions = skipOuterExpressions;
function skipParentheses(node) {
- while (node.kind === 178) {
+ while (node.kind === 179) {
node = node.expression;
}
return node;
@@ -10350,10 +11299,10 @@ var ts;
var name_9 = namespaceDeclaration.name;
return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
}
- if (node.kind === 230 && node.importClause) {
+ if (node.kind === 231 && node.importClause) {
return getGeneratedNameForNode(node);
}
- if (node.kind === 236 && node.moduleSpecifier) {
+ if (node.kind === 237 && node.moduleSpecifier) {
return getGeneratedNameForNode(node);
}
return undefined;
@@ -10402,10 +11351,10 @@ var ts;
if (kind === 256) {
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
}
- else if (kind === 69) {
+ else if (kind === 70) {
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
}
- else if (kind < 139) {
+ else if (kind < 140) {
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
}
else {
@@ -10441,10 +11390,10 @@ var ts;
var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode;
var cbNodes = cbNodeArray || cbNode;
switch (node.kind) {
- case 139:
+ case 140:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.right);
- case 141:
+ case 142:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.constraint) ||
visitNode(cbNode, node.expression);
@@ -10455,12 +11404,12 @@ var ts;
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.equalsToken) ||
visitNode(cbNode, node.objectAssignmentInitializer);
- case 142:
+ case 143:
+ case 146:
case 145:
- case 144:
case 253:
- case 218:
- case 169:
+ case 219:
+ case 170:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.propertyName) ||
@@ -10469,24 +11418,24 @@ var ts;
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 156:
case 157:
- case 151:
+ case 158:
case 152:
case 153:
+ case 154:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNodes(cbNodes, node.typeParameters) ||
visitNodes(cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 147:
- case 146:
case 148:
+ case 147:
case 149:
case 150:
- case 179:
- case 220:
+ case 151:
case 180:
+ case 221:
+ case 181:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.asteriskToken) ||
@@ -10497,176 +11446,176 @@ var ts;
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.equalsGreaterThanToken) ||
visitNode(cbNode, node.body);
- case 155:
+ case 156:
return visitNode(cbNode, node.typeName) ||
visitNodes(cbNodes, node.typeArguments);
- case 154:
+ case 155:
return visitNode(cbNode, node.parameterName) ||
visitNode(cbNode, node.type);
- case 158:
- return visitNode(cbNode, node.exprName);
case 159:
- return visitNodes(cbNodes, node.members);
+ return visitNode(cbNode, node.exprName);
case 160:
- return visitNode(cbNode, node.elementType);
+ return visitNodes(cbNodes, node.members);
case 161:
- return visitNodes(cbNodes, node.elementTypes);
+ return visitNode(cbNode, node.elementType);
case 162:
+ return visitNodes(cbNodes, node.elementTypes);
case 163:
- return visitNodes(cbNodes, node.types);
case 164:
+ return visitNodes(cbNodes, node.types);
+ case 165:
return visitNode(cbNode, node.type);
- case 166:
- return visitNode(cbNode, node.literal);
case 167:
+ return visitNode(cbNode, node.literal);
case 168:
- return visitNodes(cbNodes, node.elements);
- case 170:
+ case 169:
return visitNodes(cbNodes, node.elements);
case 171:
- return visitNodes(cbNodes, node.properties);
+ return visitNodes(cbNodes, node.elements);
case 172:
+ return visitNodes(cbNodes, node.properties);
+ case 173:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.name);
- case 173:
+ case 174:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.argumentExpression);
- case 174:
case 175:
+ case 176:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNodes, node.typeArguments) ||
visitNodes(cbNodes, node.arguments);
- case 176:
+ case 177:
return visitNode(cbNode, node.tag) ||
visitNode(cbNode, node.template);
- case 177:
+ case 178:
return visitNode(cbNode, node.type) ||
visitNode(cbNode, node.expression);
- case 178:
- return visitNode(cbNode, node.expression);
- case 181:
+ case 179:
return visitNode(cbNode, node.expression);
case 182:
return visitNode(cbNode, node.expression);
case 183:
return visitNode(cbNode, node.expression);
- case 185:
- return visitNode(cbNode, node.operand);
- case 190:
- return visitNode(cbNode, node.asteriskToken) ||
- visitNode(cbNode, node.expression);
case 184:
return visitNode(cbNode, node.expression);
case 186:
return visitNode(cbNode, node.operand);
+ case 191:
+ return visitNode(cbNode, node.asteriskToken) ||
+ visitNode(cbNode, node.expression);
+ case 185:
+ return visitNode(cbNode, node.expression);
case 187:
+ return visitNode(cbNode, node.operand);
+ case 188:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.operatorToken) ||
visitNode(cbNode, node.right);
- case 195:
+ case 196:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.type);
- case 196:
+ case 197:
return visitNode(cbNode, node.expression);
- case 188:
+ case 189:
return visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.whenTrue) ||
visitNode(cbNode, node.colonToken) ||
visitNode(cbNode, node.whenFalse);
- case 191:
+ case 192:
return visitNode(cbNode, node.expression);
- case 199:
- case 226:
+ case 200:
+ case 227:
return visitNodes(cbNodes, node.statements);
case 256:
return visitNodes(cbNodes, node.statements) ||
visitNode(cbNode, node.endOfFileToken);
- case 200:
+ case 201:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.declarationList);
- case 219:
+ case 220:
return visitNodes(cbNodes, node.declarations);
- case 202:
- return visitNode(cbNode, node.expression);
case 203:
+ return visitNode(cbNode, node.expression);
+ case 204:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.thenStatement) ||
visitNode(cbNode, node.elseStatement);
- case 204:
+ case 205:
return visitNode(cbNode, node.statement) ||
visitNode(cbNode, node.expression);
- case 205:
+ case 206:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 206:
+ case 207:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.incrementor) ||
visitNode(cbNode, node.statement);
- case 207:
+ case 208:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 208:
+ case 209:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 209:
case 210:
- return visitNode(cbNode, node.label);
case 211:
- return visitNode(cbNode, node.expression);
+ return visitNode(cbNode, node.label);
case 212:
+ return visitNode(cbNode, node.expression);
+ case 213:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 213:
+ case 214:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.caseBlock);
- case 227:
+ case 228:
return visitNodes(cbNodes, node.clauses);
case 249:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNodes, node.statements);
case 250:
return visitNodes(cbNodes, node.statements);
- case 214:
+ case 215:
return visitNode(cbNode, node.label) ||
visitNode(cbNode, node.statement);
- case 215:
- return visitNode(cbNode, node.expression);
case 216:
+ return visitNode(cbNode, node.expression);
+ case 217:
return visitNode(cbNode, node.tryBlock) ||
visitNode(cbNode, node.catchClause) ||
visitNode(cbNode, node.finallyBlock);
case 252:
return visitNode(cbNode, node.variableDeclaration) ||
visitNode(cbNode, node.block);
- case 143:
+ case 144:
return visitNode(cbNode, node.expression);
- case 221:
- case 192:
+ case 222:
+ case 193:
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 222:
+ case 223:
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:
+ case 224:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNodes, node.typeParameters) ||
visitNode(cbNode, node.type);
- case 224:
+ case 225:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -10674,65 +11623,65 @@ var ts;
case 255:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 225:
+ case 226:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.body);
- case 229:
+ case 230:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.moduleReference);
- case 230:
+ case 231:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.importClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 231:
+ case 232:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.namedBindings);
- case 228:
- return visitNode(cbNode, node.name);
- case 232:
+ case 229:
return visitNode(cbNode, node.name);
case 233:
- case 237:
+ return visitNode(cbNode, node.name);
+ case 234:
+ case 238:
return visitNodes(cbNodes, node.elements);
- case 236:
+ case 237:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.exportClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 234:
- case 238:
+ case 235:
+ case 239:
return visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name);
- case 235:
+ case 236:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.expression);
- case 189:
+ case 190:
return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans);
- case 197:
+ case 198:
return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
- case 140:
+ case 141:
return visitNode(cbNode, node.expression);
case 251:
return visitNodes(cbNodes, node.types);
- case 194:
+ case 195:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNodes, node.typeArguments);
- case 240:
+ case 241:
return visitNode(cbNode, node.expression);
- case 239:
+ case 240:
return visitNodes(cbNodes, node.decorators);
- case 241:
+ case 242:
return visitNode(cbNode, node.openingElement) ||
visitNodes(cbNodes, node.children) ||
visitNode(cbNode, node.closingElement);
- case 242:
case 243:
+ case 244:
return visitNode(cbNode, node.tagName) ||
visitNodes(cbNodes, node.attributes);
case 246:
@@ -10834,7 +11783,7 @@ var ts;
ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
var Parser;
(function (Parser) {
- var scanner = ts.createScanner(2, true);
+ var scanner = ts.createScanner(4, true);
var disallowInAndDecoratorContext = 32768 | 131072;
var NodeConstructor;
var TokenConstructor;
@@ -10851,9 +11800,9 @@ var ts;
var parsingContext;
var contextFlags;
var parseErrorBeforeNextFinishedNode = false;
- function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) {
+ function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) {
scriptKind = ts.ensureScriptKind(fileName, scriptKind);
- initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind);
+ initializeState(sourceText, languageVersion, syntaxCursor, scriptKind);
var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind);
clearState();
return result;
@@ -10862,7 +11811,7 @@ var ts;
function getLanguageVariant(scriptKind) {
return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 ? 1 : 0;
}
- function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
+ function initializeState(_sourceText, languageVersion, _syntaxCursor, scriptKind) {
NodeConstructor = ts.objectAllocator.getNodeConstructor();
TokenConstructor = ts.objectAllocator.getTokenConstructor();
IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
@@ -11105,16 +12054,16 @@ var ts;
return speculationHelper(callback, false);
}
function isIdentifier() {
- if (token() === 69) {
+ if (token() === 70) {
return true;
}
- if (token() === 114 && inYieldContext()) {
+ if (token() === 115 && inYieldContext()) {
return false;
}
- if (token() === 119 && inAwaitContext()) {
+ if (token() === 120 && inAwaitContext()) {
return false;
}
- return token() > 105;
+ return token() > 106;
}
function parseExpected(kind, diagnosticMessage, shouldAdvance) {
if (shouldAdvance === void 0) { shouldAdvance = true; }
@@ -11155,20 +12104,20 @@ var ts;
return finishNode(node);
}
function canParseSemicolon() {
- if (token() === 23) {
+ if (token() === 24) {
return true;
}
- return token() === 16 || token() === 1 || scanner.hasPrecedingLineBreak();
+ return token() === 17 || token() === 1 || scanner.hasPrecedingLineBreak();
}
function parseSemicolon() {
if (canParseSemicolon()) {
- if (token() === 23) {
+ if (token() === 24) {
nextToken();
}
return true;
}
else {
- return parseExpected(23);
+ return parseExpected(24);
}
}
function createNode(kind, pos) {
@@ -11176,8 +12125,8 @@ var ts;
if (!(pos >= 0)) {
pos = scanner.getStartPos();
}
- return kind >= 139 ? new NodeConstructor(kind, pos, pos) :
- kind === 69 ? new IdentifierConstructor(kind, pos, pos) :
+ return kind >= 140 ? new NodeConstructor(kind, pos, pos) :
+ kind === 70 ? new IdentifierConstructor(kind, pos, pos) :
new TokenConstructor(kind, pos, pos);
}
function createNodeArray(elements, pos) {
@@ -11218,15 +12167,15 @@ var ts;
function createIdentifier(isIdentifier, diagnosticMessage) {
identifierCount++;
if (isIdentifier) {
- var node = createNode(69);
- if (token() !== 69) {
+ var node = createNode(70);
+ if (token() !== 70) {
node.originalKeywordKind = token();
}
node.text = internIdentifier(scanner.getTokenValue());
nextToken();
return finishNode(node);
}
- return createMissingNode(69, false, diagnosticMessage || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(70, false, diagnosticMessage || ts.Diagnostics.Identifier_expected);
}
function parseIdentifier(diagnosticMessage) {
return createIdentifier(isIdentifier(), diagnosticMessage);
@@ -11243,7 +12192,7 @@ var ts;
if (token() === 9 || token() === 8) {
return parseLiteralNode(true);
}
- if (allowComputedPropertyNames && token() === 19) {
+ if (allowComputedPropertyNames && token() === 20) {
return parseComputedPropertyName();
}
return parseIdentifierName();
@@ -11258,10 +12207,10 @@ var ts;
return token() === 9 || token() === 8 || ts.tokenIsIdentifierOrKeyword(token());
}
function parseComputedPropertyName() {
- var node = createNode(140);
- parseExpected(19);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(141);
parseExpected(20);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(21);
return finishNode(node);
}
function parseContextualModifier(t) {
@@ -11275,20 +12224,20 @@ var ts;
return canFollowModifier();
}
function nextTokenCanFollowModifier() {
- if (token() === 74) {
- return nextToken() === 81;
+ if (token() === 75) {
+ return nextToken() === 82;
}
- if (token() === 82) {
+ if (token() === 83) {
nextToken();
- if (token() === 77) {
+ if (token() === 78) {
return lookAhead(nextTokenIsClassOrFunctionOrAsync);
}
- return token() !== 37 && token() !== 116 && token() !== 15 && canFollowModifier();
+ return token() !== 38 && token() !== 117 && token() !== 16 && canFollowModifier();
}
- if (token() === 77) {
+ if (token() === 78) {
return nextTokenIsClassOrFunctionOrAsync();
}
- if (token() === 113) {
+ if (token() === 114) {
nextToken();
return canFollowModifier();
}
@@ -11298,16 +12247,16 @@ var ts;
return ts.isModifierKind(token()) && tryParse(nextTokenCanFollowModifier);
}
function canFollowModifier() {
- return token() === 19
- || token() === 15
- || token() === 37
- || token() === 22
+ return token() === 20
+ || token() === 16
+ || token() === 38
+ || token() === 23
|| isLiteralPropertyName();
}
function nextTokenIsClassOrFunctionOrAsync() {
nextToken();
- return token() === 73 || token() === 87 ||
- (token() === 118 && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
+ return token() === 74 || token() === 88 ||
+ (token() === 119 && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
}
function isListElement(parsingContext, inErrorRecovery) {
var node = currentNode(parsingContext);
@@ -11318,21 +12267,21 @@ var ts;
case 0:
case 1:
case 3:
- return !(token() === 23 && inErrorRecovery) && isStartOfStatement();
+ return !(token() === 24 && inErrorRecovery) && isStartOfStatement();
case 2:
- return token() === 71 || token() === 77;
+ return token() === 72 || token() === 78;
case 4:
return lookAhead(isTypeMemberStart);
case 5:
- return lookAhead(isClassMemberStart) || (token() === 23 && !inErrorRecovery);
+ return lookAhead(isClassMemberStart) || (token() === 24 && !inErrorRecovery);
case 6:
- return token() === 19 || isLiteralPropertyName();
+ return token() === 20 || isLiteralPropertyName();
case 12:
- return token() === 19 || token() === 37 || isLiteralPropertyName();
+ return token() === 20 || token() === 38 || isLiteralPropertyName();
case 9:
- return token() === 19 || isLiteralPropertyName();
+ return token() === 20 || isLiteralPropertyName();
case 7:
- if (token() === 15) {
+ if (token() === 16) {
return lookAhead(isValidHeritageClauseObjectLiteral);
}
if (!inErrorRecovery) {
@@ -11344,23 +12293,23 @@ var ts;
case 8:
return isIdentifierOrPattern();
case 10:
- return token() === 24 || token() === 22 || isIdentifierOrPattern();
+ return token() === 25 || token() === 23 || isIdentifierOrPattern();
case 17:
return isIdentifier();
case 11:
case 15:
- return token() === 24 || token() === 22 || isStartOfExpression();
+ return token() === 25 || token() === 23 || isStartOfExpression();
case 16:
return isStartOfParameter();
case 18:
case 19:
- return token() === 24 || isStartOfType();
+ return token() === 25 || isStartOfType();
case 20:
return isHeritageClause();
case 21:
return ts.tokenIsIdentifierOrKeyword(token());
case 13:
- return ts.tokenIsIdentifierOrKeyword(token()) || token() === 15;
+ return ts.tokenIsIdentifierOrKeyword(token()) || token() === 16;
case 14:
return true;
case 22:
@@ -11373,10 +12322,10 @@ var ts;
ts.Debug.fail("Non-exhaustive case in 'isListElement'.");
}
function isValidHeritageClauseObjectLiteral() {
- ts.Debug.assert(token() === 15);
- if (nextToken() === 16) {
+ ts.Debug.assert(token() === 16);
+ if (nextToken() === 17) {
var next = nextToken();
- return next === 24 || next === 15 || next === 83 || next === 106;
+ return next === 25 || next === 16 || next === 84 || next === 107;
}
return true;
}
@@ -11389,8 +12338,8 @@ var ts;
return ts.tokenIsIdentifierOrKeyword(token());
}
function isHeritageClauseExtendsOrImplementsKeyword() {
- if (token() === 106 ||
- token() === 83) {
+ if (token() === 107 ||
+ token() === 84) {
return lookAhead(nextTokenIsStartOfExpression);
}
return false;
@@ -11412,39 +12361,39 @@ var ts;
case 12:
case 9:
case 21:
- return token() === 16;
+ return token() === 17;
case 3:
- return token() === 16 || token() === 71 || token() === 77;
+ return token() === 17 || token() === 72 || token() === 78;
case 7:
- return token() === 15 || token() === 83 || token() === 106;
+ return token() === 16 || token() === 84 || token() === 107;
case 8:
return isVariableDeclaratorListTerminator();
case 17:
- return token() === 27 || token() === 17 || token() === 15 || token() === 83 || token() === 106;
+ return token() === 28 || token() === 18 || token() === 16 || token() === 84 || token() === 107;
case 11:
- return token() === 18 || token() === 23;
+ return token() === 19 || token() === 24;
case 15:
case 19:
case 10:
- return token() === 20;
+ return token() === 21;
case 16:
- return token() === 18 || token() === 20;
+ return token() === 19 || token() === 21;
case 18:
- return token() !== 24;
+ return token() !== 25;
case 20:
- return token() === 15 || token() === 16;
+ return token() === 16 || token() === 17;
case 13:
- return token() === 27 || token() === 39;
+ return token() === 28 || token() === 40;
case 14:
- return token() === 25 && lookAhead(nextTokenIsSlash);
+ return token() === 26 && lookAhead(nextTokenIsSlash);
case 22:
- return token() === 18 || token() === 54 || token() === 16;
+ return token() === 19 || token() === 55 || token() === 17;
case 23:
- return token() === 27 || token() === 16;
+ return token() === 28 || token() === 17;
case 25:
- return token() === 20 || token() === 16;
+ return token() === 21 || token() === 17;
case 24:
- return token() === 16;
+ return token() === 17;
}
}
function isVariableDeclaratorListTerminator() {
@@ -11454,7 +12403,7 @@ var ts;
if (isInOrOfKeyword(token())) {
return true;
}
- if (token() === 34) {
+ if (token() === 35) {
return true;
}
return false;
@@ -11558,17 +12507,17 @@ var ts;
function isReusableClassMember(node) {
if (node) {
switch (node.kind) {
- case 148:
- case 153:
case 149:
+ case 154:
case 150:
- case 145:
- case 198:
+ case 151:
+ case 146:
+ case 199:
return true;
- case 147:
+ case 148:
var methodDeclaration = node;
- var nameIsConstructor = methodDeclaration.name.kind === 69 &&
- methodDeclaration.name.originalKeywordKind === 121;
+ var nameIsConstructor = methodDeclaration.name.kind === 70 &&
+ methodDeclaration.name.originalKeywordKind === 122;
return !nameIsConstructor;
}
}
@@ -11587,35 +12536,35 @@ var ts;
function isReusableStatement(node) {
if (node) {
switch (node.kind) {
- case 220:
+ case 221:
+ case 201:
case 200:
- case 199:
+ case 204:
case 203:
- case 202:
- case 215:
+ case 216:
+ case 212:
+ case 214:
case 211:
- case 213:
case 210:
+ case 208:
case 209:
case 207:
- case 208:
case 206:
- case 205:
- case 212:
- case 201:
- case 216:
- case 214:
- case 204:
+ case 213:
+ case 202:
case 217:
+ case 215:
+ case 205:
+ case 218:
+ case 231:
case 230:
- case 229:
+ case 237:
case 236:
- case 235:
- case 225:
- case 221:
+ case 226:
case 222:
- case 224:
case 223:
+ case 225:
+ case 224:
return true;
}
}
@@ -11627,25 +12576,25 @@ var ts;
function isReusableTypeMember(node) {
if (node) {
switch (node.kind) {
- case 152:
- case 146:
case 153:
- case 144:
- case 151:
+ case 147:
+ case 154:
+ case 145:
+ case 152:
return true;
}
}
return false;
}
function isReusableVariableDeclaration(node) {
- if (node.kind !== 218) {
+ if (node.kind !== 219) {
return false;
}
var variableDeclarator = node;
return variableDeclarator.initializer === undefined;
}
function isReusableParameter(node) {
- if (node.kind !== 142) {
+ if (node.kind !== 143) {
return false;
}
var parameter = node;
@@ -11699,15 +12648,15 @@ var ts;
if (isListElement(kind, false)) {
result.push(parseListElement(kind, parseElement));
commaStart = scanner.getTokenPos();
- if (parseOptional(24)) {
+ if (parseOptional(25)) {
continue;
}
commaStart = -1;
if (isListTerminator(kind)) {
break;
}
- parseExpected(24);
- if (considerSemicolonAsDelimiter && token() === 23 && !scanner.hasPrecedingLineBreak()) {
+ parseExpected(25);
+ if (considerSemicolonAsDelimiter && token() === 24 && !scanner.hasPrecedingLineBreak()) {
nextToken();
}
continue;
@@ -11739,8 +12688,8 @@ var ts;
}
function parseEntityName(allowReservedWords, diagnosticMessage) {
var entity = parseIdentifier(diagnosticMessage);
- while (parseOptional(21)) {
- var node = createNode(139, entity.pos);
+ while (parseOptional(22)) {
+ var node = createNode(140, entity.pos);
node.left = entity;
node.right = parseRightSideOfDot(allowReservedWords);
entity = finishNode(node);
@@ -11751,33 +12700,33 @@ var ts;
if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token())) {
var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
if (matchesPattern) {
- return createMissingNode(69, true, ts.Diagnostics.Identifier_expected);
+ return createMissingNode(70, true, ts.Diagnostics.Identifier_expected);
}
}
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTemplateExpression() {
- var template = createNode(189);
+ var template = createNode(190);
template.head = parseTemplateHead();
- ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind");
+ ts.Debug.assert(template.head.kind === 13, "Template head has wrong token kind");
var templateSpans = createNodeArray();
do {
templateSpans.push(parseTemplateSpan());
- } while (ts.lastOrUndefined(templateSpans).literal.kind === 13);
+ } while (ts.lastOrUndefined(templateSpans).literal.kind === 14);
templateSpans.end = getNodeEnd();
template.templateSpans = templateSpans;
return finishNode(template);
}
function parseTemplateSpan() {
- var span = createNode(197);
+ var span = createNode(198);
span.expression = allowInAnd(parseExpression);
var literal;
- if (token() === 16) {
+ if (token() === 17) {
reScanTemplateToken();
literal = parseTemplateMiddleOrTemplateTail();
}
else {
- literal = parseExpectedToken(14, false, ts.Diagnostics._0_expected, ts.tokenToString(16));
+ literal = parseExpectedToken(15, false, ts.Diagnostics._0_expected, ts.tokenToString(17));
}
span.literal = literal;
return finishNode(span);
@@ -11787,12 +12736,12 @@ var ts;
}
function parseTemplateHead() {
var fragment = parseLiteralLikeNode(token(), false);
- ts.Debug.assert(fragment.kind === 12, "Template head has wrong token kind");
+ ts.Debug.assert(fragment.kind === 13, "Template head has wrong token kind");
return fragment;
}
function parseTemplateMiddleOrTemplateTail() {
var fragment = parseLiteralLikeNode(token(), false);
- ts.Debug.assert(fragment.kind === 13 || fragment.kind === 14, "Template fragment has wrong token kind");
+ ts.Debug.assert(fragment.kind === 14 || fragment.kind === 15, "Template fragment has wrong token kind");
return fragment;
}
function parseLiteralLikeNode(kind, internName) {
@@ -11817,35 +12766,35 @@ var ts;
}
function parseTypeReference() {
var typeName = parseEntityName(false, ts.Diagnostics.Type_expected);
- var node = createNode(155, typeName.pos);
+ var node = createNode(156, typeName.pos);
node.typeName = typeName;
- if (!scanner.hasPrecedingLineBreak() && token() === 25) {
- node.typeArguments = parseBracketedList(18, parseType, 25, 27);
+ if (!scanner.hasPrecedingLineBreak() && token() === 26) {
+ node.typeArguments = parseBracketedList(18, parseType, 26, 28);
}
return finishNode(node);
}
function parseThisTypePredicate(lhs) {
nextToken();
- var node = createNode(154, lhs.pos);
+ var node = createNode(155, lhs.pos);
node.parameterName = lhs;
node.type = parseType();
return finishNode(node);
}
function parseThisTypeNode() {
- var node = createNode(165);
+ var node = createNode(166);
nextToken();
return finishNode(node);
}
function parseTypeQuery() {
- var node = createNode(158);
- parseExpected(101);
+ var node = createNode(159);
+ parseExpected(102);
node.exprName = parseEntityName(true);
return finishNode(node);
}
function parseTypeParameter() {
- var node = createNode(141);
+ var node = createNode(142);
node.name = parseIdentifier();
- if (parseOptional(83)) {
+ if (parseOptional(84)) {
if (isStartOfType() || !isStartOfExpression()) {
node.constraint = parseType();
}
@@ -11856,34 +12805,34 @@ var ts;
return finishNode(node);
}
function parseTypeParameters() {
- if (token() === 25) {
- return parseBracketedList(17, parseTypeParameter, 25, 27);
+ if (token() === 26) {
+ return parseBracketedList(17, parseTypeParameter, 26, 28);
}
}
function parseParameterType() {
- if (parseOptional(54)) {
+ if (parseOptional(55)) {
return parseType();
}
return undefined;
}
function isStartOfParameter() {
- return token() === 22 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 55 || token() === 97;
+ return token() === 23 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 || token() === 98;
}
function parseParameter() {
- var node = createNode(142);
- if (token() === 97) {
+ var node = createNode(143);
+ if (token() === 98) {
node.name = createIdentifier(true, undefined);
node.type = parseParameterType();
return finishNode(node);
}
node.decorators = parseDecorators();
node.modifiers = parseModifiers();
- node.dotDotDotToken = parseOptionalToken(22);
+ node.dotDotDotToken = parseOptionalToken(23);
node.name = parseIdentifierOrPattern();
if (ts.getFullWidth(node.name) === 0 && !ts.hasModifiers(node) && ts.isModifierKind(token())) {
nextToken();
}
- node.questionToken = parseOptionalToken(53);
+ node.questionToken = parseOptionalToken(54);
node.type = parseParameterType();
node.initializer = parseBindingElementInitializer(true);
return addJSDocComment(finishNode(node));
@@ -11895,7 +12844,7 @@ var ts;
return parseInitializer(true);
}
function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) {
- var returnTokenRequired = returnToken === 34;
+ var returnTokenRequired = returnToken === 35;
signature.typeParameters = parseTypeParameters();
signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList);
if (returnTokenRequired) {
@@ -11907,7 +12856,7 @@ var ts;
}
}
function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) {
- if (parseExpected(17)) {
+ if (parseExpected(18)) {
var savedYieldContext = inYieldContext();
var savedAwaitContext = inAwaitContext();
setYieldContext(yieldContext);
@@ -11915,7 +12864,7 @@ var ts;
var result = parseDelimitedList(16, parseParameter);
setYieldContext(savedYieldContext);
setAwaitContext(savedAwaitContext);
- if (!parseExpected(18) && requireCompleteParameterList) {
+ if (!parseExpected(19) && requireCompleteParameterList) {
return undefined;
}
return result;
@@ -11923,29 +12872,29 @@ var ts;
return requireCompleteParameterList ? undefined : createMissingList();
}
function parseTypeMemberSemicolon() {
- if (parseOptional(24)) {
+ if (parseOptional(25)) {
return;
}
parseSemicolon();
}
function parseSignatureMember(kind) {
var node = createNode(kind);
- if (kind === 152) {
- parseExpected(92);
+ if (kind === 153) {
+ parseExpected(93);
}
- fillSignature(54, false, false, false, node);
+ fillSignature(55, false, false, false, node);
parseTypeMemberSemicolon();
return addJSDocComment(finishNode(node));
}
function isIndexSignature() {
- if (token() !== 19) {
+ if (token() !== 20) {
return false;
}
return lookAhead(isUnambiguouslyIndexSignature);
}
function isUnambiguouslyIndexSignature() {
nextToken();
- if (token() === 22 || token() === 20) {
+ if (token() === 23 || token() === 21) {
return true;
}
if (ts.isModifierKind(token())) {
@@ -11960,43 +12909,43 @@ var ts;
else {
nextToken();
}
- if (token() === 54 || token() === 24) {
+ if (token() === 55 || token() === 25) {
return true;
}
- if (token() !== 53) {
+ if (token() !== 54) {
return false;
}
nextToken();
- return token() === 54 || token() === 24 || token() === 20;
+ return token() === 55 || token() === 25 || token() === 21;
}
function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(153, fullStart);
+ var node = createNode(154, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- node.parameters = parseBracketedList(16, parseParameter, 19, 20);
+ node.parameters = parseBracketedList(16, parseParameter, 20, 21);
node.type = parseTypeAnnotation();
parseTypeMemberSemicolon();
return finishNode(node);
}
function parsePropertyOrMethodSignature(fullStart, modifiers) {
var name = parsePropertyName();
- var questionToken = parseOptionalToken(53);
- if (token() === 17 || token() === 25) {
- var method = createNode(146, fullStart);
+ var questionToken = parseOptionalToken(54);
+ if (token() === 18 || token() === 26) {
+ var method = createNode(147, fullStart);
method.modifiers = modifiers;
method.name = name;
method.questionToken = questionToken;
- fillSignature(54, false, false, false, method);
+ fillSignature(55, false, false, false, method);
parseTypeMemberSemicolon();
return addJSDocComment(finishNode(method));
}
else {
- var property = createNode(144, fullStart);
+ var property = createNode(145, fullStart);
property.modifiers = modifiers;
property.name = name;
property.questionToken = questionToken;
property.type = parseTypeAnnotation();
- if (token() === 56) {
+ if (token() === 57) {
property.initializer = parseNonParameterInitializer();
}
parseTypeMemberSemicolon();
@@ -12005,14 +12954,14 @@ var ts;
}
function isTypeMemberStart() {
var idToken;
- if (token() === 17 || token() === 25) {
+ if (token() === 18 || token() === 26) {
return true;
}
while (ts.isModifierKind(token())) {
idToken = token();
nextToken();
}
- if (token() === 19) {
+ if (token() === 20) {
return true;
}
if (isLiteralPropertyName()) {
@@ -12020,22 +12969,22 @@ var ts;
nextToken();
}
if (idToken) {
- return token() === 17 ||
- token() === 25 ||
- token() === 53 ||
+ return token() === 18 ||
+ token() === 26 ||
token() === 54 ||
- token() === 24 ||
+ token() === 55 ||
+ token() === 25 ||
canParseSemicolon();
}
return false;
}
function parseTypeMember() {
- if (token() === 17 || token() === 25) {
- return parseSignatureMember(151);
- }
- if (token() === 92 && lookAhead(isStartOfConstructSignature)) {
+ if (token() === 18 || token() === 26) {
return parseSignatureMember(152);
}
+ if (token() === 93 && lookAhead(isStartOfConstructSignature)) {
+ return parseSignatureMember(153);
+ }
var fullStart = getNodePos();
var modifiers = parseModifiers();
if (isIndexSignature()) {
@@ -12045,18 +12994,18 @@ var ts;
}
function isStartOfConstructSignature() {
nextToken();
- return token() === 17 || token() === 25;
+ return token() === 18 || token() === 26;
}
function parseTypeLiteral() {
- var node = createNode(159);
+ var node = createNode(160);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
function parseObjectTypeMembers() {
var members;
- if (parseExpected(15)) {
+ if (parseExpected(16)) {
members = parseList(4, parseTypeMember);
- parseExpected(16);
+ parseExpected(17);
}
else {
members = createMissingList();
@@ -12064,31 +13013,31 @@ var ts;
return members;
}
function parseTupleType() {
- var node = createNode(161);
- node.elementTypes = parseBracketedList(19, parseType, 19, 20);
+ var node = createNode(162);
+ node.elementTypes = parseBracketedList(19, parseType, 20, 21);
return finishNode(node);
}
function parseParenthesizedType() {
- var node = createNode(164);
- parseExpected(17);
- node.type = parseType();
+ var node = createNode(165);
parseExpected(18);
+ node.type = parseType();
+ parseExpected(19);
return finishNode(node);
}
function parseFunctionOrConstructorType(kind) {
var node = createNode(kind);
- if (kind === 157) {
- parseExpected(92);
+ if (kind === 158) {
+ parseExpected(93);
}
- fillSignature(34, false, false, false, node);
+ fillSignature(35, false, false, false, node);
return finishNode(node);
}
function parseKeywordAndNoDot() {
var node = parseTokenNode();
- return token() === 21 ? undefined : node;
+ return token() === 22 ? undefined : node;
}
function parseLiteralTypeNode() {
- var node = createNode(166);
+ var node = createNode(167);
node.literal = parseSimpleUnaryExpression();
finishNode(node);
return node;
@@ -12098,41 +13047,41 @@ var ts;
}
function parseNonArrayType() {
switch (token()) {
- case 117:
- case 132:
- case 130:
- case 120:
+ case 118:
case 133:
- case 135:
- case 127:
+ case 131:
+ case 121:
+ case 134:
+ case 136:
+ case 128:
var node = tryParse(parseKeywordAndNoDot);
return node || parseTypeReference();
case 9:
case 8:
- case 99:
- case 84:
+ case 100:
+ case 85:
return parseLiteralTypeNode();
- case 36:
+ case 37:
return lookAhead(nextTokenIsNumericLiteral) ? parseLiteralTypeNode() : parseTypeReference();
- case 103:
- case 93:
+ case 104:
+ case 94:
return parseTokenNode();
- case 97: {
+ case 98: {
var thisKeyword = parseThisTypeNode();
- if (token() === 124 && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 125 && !scanner.hasPrecedingLineBreak()) {
return parseThisTypePredicate(thisKeyword);
}
else {
return thisKeyword;
}
}
- case 101:
+ case 102:
return parseTypeQuery();
- case 15:
+ case 16:
return parseTypeLiteral();
- case 19:
+ case 20:
return parseTupleType();
- case 17:
+ case 18:
return parseParenthesizedType();
default:
return parseTypeReference();
@@ -12140,29 +13089,29 @@ var ts;
}
function isStartOfType() {
switch (token()) {
- case 117:
- case 132:
- case 130:
- case 120:
+ case 118:
case 133:
- case 103:
- case 135:
+ case 131:
+ case 121:
+ case 134:
+ case 104:
+ case 136:
+ case 94:
+ case 98:
+ case 102:
+ case 128:
+ case 16:
+ case 20:
+ case 26:
case 93:
- case 97:
- case 101:
- case 127:
- case 15:
- case 19:
- case 25:
- case 92:
case 9:
case 8:
- case 99:
- case 84:
+ case 100:
+ case 85:
return true;
- case 36:
+ case 37:
return lookAhead(nextTokenIsNumericLiteral);
- case 17:
+ case 18:
return lookAhead(isStartOfParenthesizedOrFunctionType);
default:
return isIdentifier();
@@ -12170,13 +13119,13 @@ var ts;
}
function isStartOfParenthesizedOrFunctionType() {
nextToken();
- return token() === 18 || isStartOfParameter() || isStartOfType();
+ return token() === 19 || isStartOfParameter() || isStartOfType();
}
function parseArrayTypeOrHigher() {
var type = parseNonArrayType();
- while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) {
- parseExpected(20);
- var node = createNode(160, type.pos);
+ while (!scanner.hasPrecedingLineBreak() && parseOptional(20)) {
+ parseExpected(21);
+ var node = createNode(161, type.pos);
node.elementType = type;
type = finishNode(node);
}
@@ -12197,26 +13146,26 @@ var ts;
return type;
}
function parseIntersectionTypeOrHigher() {
- return parseUnionOrIntersectionType(163, parseArrayTypeOrHigher, 46);
+ return parseUnionOrIntersectionType(164, parseArrayTypeOrHigher, 47);
}
function parseUnionTypeOrHigher() {
- return parseUnionOrIntersectionType(162, parseIntersectionTypeOrHigher, 47);
+ return parseUnionOrIntersectionType(163, parseIntersectionTypeOrHigher, 48);
}
function isStartOfFunctionType() {
- if (token() === 25) {
+ if (token() === 26) {
return true;
}
- return token() === 17 && lookAhead(isUnambiguouslyStartOfFunctionType);
+ return token() === 18 && lookAhead(isUnambiguouslyStartOfFunctionType);
}
function skipParameterStart() {
if (ts.isModifierKind(token())) {
parseModifiers();
}
- if (isIdentifier() || token() === 97) {
+ if (isIdentifier() || token() === 98) {
nextToken();
return true;
}
- if (token() === 19 || token() === 15) {
+ if (token() === 20 || token() === 16) {
var previousErrorCount = parseDiagnostics.length;
parseIdentifierOrPattern();
return previousErrorCount === parseDiagnostics.length;
@@ -12225,17 +13174,17 @@ var ts;
}
function isUnambiguouslyStartOfFunctionType() {
nextToken();
- if (token() === 18 || token() === 22) {
+ if (token() === 19 || token() === 23) {
return true;
}
if (skipParameterStart()) {
- if (token() === 54 || token() === 24 ||
- token() === 53 || token() === 56) {
+ if (token() === 55 || token() === 25 ||
+ token() === 54 || token() === 57) {
return true;
}
- if (token() === 18) {
+ if (token() === 19) {
nextToken();
- if (token() === 34) {
+ if (token() === 35) {
return true;
}
}
@@ -12246,7 +13195,7 @@ var ts;
var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
var type = parseType();
if (typePredicateVariable) {
- var node = createNode(154, typePredicateVariable.pos);
+ var node = createNode(155, typePredicateVariable.pos);
node.parameterName = typePredicateVariable;
node.type = type;
return finishNode(node);
@@ -12257,7 +13206,7 @@ var ts;
}
function parseTypePredicatePrefix() {
var id = parseIdentifier();
- if (token() === 124 && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 125 && !scanner.hasPrecedingLineBreak()) {
nextToken();
return id;
}
@@ -12267,36 +13216,36 @@ var ts;
}
function parseTypeWorker() {
if (isStartOfFunctionType()) {
- return parseFunctionOrConstructorType(156);
- }
- if (token() === 92) {
return parseFunctionOrConstructorType(157);
}
+ if (token() === 93) {
+ return parseFunctionOrConstructorType(158);
+ }
return parseUnionTypeOrHigher();
}
function parseTypeAnnotation() {
- return parseOptional(54) ? parseType() : undefined;
+ return parseOptional(55) ? parseType() : undefined;
}
function isStartOfLeftHandSideExpression() {
switch (token()) {
- case 97:
- case 95:
- case 93:
- case 99:
- case 84:
+ case 98:
+ case 96:
+ case 94:
+ case 100:
+ case 85:
case 8:
case 9:
- case 11:
case 12:
- case 17:
- case 19:
- case 15:
- case 87:
- case 73:
- case 92:
- case 39:
- case 61:
- case 69:
+ case 13:
+ case 18:
+ case 20:
+ case 16:
+ case 88:
+ case 74:
+ case 93:
+ case 40:
+ case 62:
+ case 70:
return true;
default:
return isIdentifier();
@@ -12307,18 +13256,18 @@ var ts;
return true;
}
switch (token()) {
- case 35:
case 36:
+ case 37:
+ case 51:
case 50:
- case 49:
- case 78:
- case 101:
- case 103:
- case 41:
+ case 79:
+ case 102:
+ case 104:
case 42:
- case 25:
- case 119:
- case 114:
+ case 43:
+ case 26:
+ case 120:
+ case 115:
return true;
default:
if (isBinaryOperator()) {
@@ -12328,10 +13277,10 @@ var ts;
}
}
function isStartOfExpressionStatement() {
- return token() !== 15 &&
- token() !== 87 &&
- token() !== 73 &&
- token() !== 55 &&
+ return token() !== 16 &&
+ token() !== 88 &&
+ token() !== 74 &&
+ token() !== 56 &&
isStartOfExpression();
}
function parseExpression() {
@@ -12341,7 +13290,7 @@ var ts;
}
var expr = parseAssignmentExpressionOrHigher();
var operatorToken;
- while ((operatorToken = parseOptionalToken(24))) {
+ while ((operatorToken = parseOptionalToken(25))) {
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher());
}
if (saveDecoratorContext) {
@@ -12350,12 +13299,12 @@ var ts;
return expr;
}
function parseInitializer(inParameter) {
- if (token() !== 56) {
- if (scanner.hasPrecedingLineBreak() || (inParameter && token() === 15) || !isStartOfExpression()) {
+ if (token() !== 57) {
+ if (scanner.hasPrecedingLineBreak() || (inParameter && token() === 16) || !isStartOfExpression()) {
return undefined;
}
}
- parseExpected(56);
+ parseExpected(57);
return parseAssignmentExpressionOrHigher();
}
function parseAssignmentExpressionOrHigher() {
@@ -12367,7 +13316,7 @@ var ts;
return arrowExpression;
}
var expr = parseBinaryExpressionOrHigher(0);
- if (expr.kind === 69 && token() === 34) {
+ if (expr.kind === 70 && token() === 35) {
return parseSimpleArrowFunctionExpression(expr);
}
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
@@ -12376,7 +13325,7 @@ var ts;
return parseConditionalExpressionRest(expr);
}
function isYieldExpression() {
- if (token() === 114) {
+ if (token() === 115) {
if (inYieldContext()) {
return true;
}
@@ -12389,11 +13338,11 @@ var ts;
return !scanner.hasPrecedingLineBreak() && isIdentifier();
}
function parseYieldExpression() {
- var node = createNode(190);
+ var node = createNode(191);
nextToken();
if (!scanner.hasPrecedingLineBreak() &&
- (token() === 37 || isStartOfExpression())) {
- node.asteriskToken = parseOptionalToken(37);
+ (token() === 38 || isStartOfExpression())) {
+ node.asteriskToken = parseOptionalToken(38);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
@@ -12402,21 +13351,21 @@ var ts;
}
}
function parseSimpleArrowFunctionExpression(identifier, asyncModifier) {
- ts.Debug.assert(token() === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
+ ts.Debug.assert(token() === 35, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
var node;
if (asyncModifier) {
- node = createNode(180, asyncModifier.pos);
+ node = createNode(181, asyncModifier.pos);
node.modifiers = asyncModifier;
}
else {
- node = createNode(180, identifier.pos);
+ node = createNode(181, identifier.pos);
}
- var parameter = createNode(142, identifier.pos);
+ var parameter = createNode(143, identifier.pos);
parameter.name = identifier;
finishNode(parameter);
node.parameters = createNodeArray([parameter], parameter.pos);
node.parameters.end = parameter.end;
- node.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>");
+ node.equalsGreaterThanToken = parseExpectedToken(35, false, ts.Diagnostics._0_expected, "=>");
node.body = parseArrowFunctionExpressionBody(!!asyncModifier);
return addJSDocComment(finishNode(node));
}
@@ -12433,78 +13382,78 @@ var ts;
}
var isAsync = !!(ts.getModifierFlags(arrowFunction) & 256);
var lastToken = token();
- arrowFunction.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>");
- arrowFunction.body = (lastToken === 34 || lastToken === 15)
+ arrowFunction.equalsGreaterThanToken = parseExpectedToken(35, false, ts.Diagnostics._0_expected, "=>");
+ arrowFunction.body = (lastToken === 35 || lastToken === 16)
? parseArrowFunctionExpressionBody(isAsync)
: parseIdentifier();
return addJSDocComment(finishNode(arrowFunction));
}
function isParenthesizedArrowFunctionExpression() {
- if (token() === 17 || token() === 25 || token() === 118) {
+ if (token() === 18 || token() === 26 || token() === 119) {
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
- if (token() === 34) {
+ if (token() === 35) {
return 1;
}
return 0;
}
function isParenthesizedArrowFunctionExpressionWorker() {
- if (token() === 118) {
+ if (token() === 119) {
nextToken();
if (scanner.hasPrecedingLineBreak()) {
return 0;
}
- if (token() !== 17 && token() !== 25) {
+ if (token() !== 18 && token() !== 26) {
return 0;
}
}
var first = token();
var second = nextToken();
- if (first === 17) {
- if (second === 18) {
+ if (first === 18) {
+ if (second === 19) {
var third = nextToken();
switch (third) {
- case 34:
- case 54:
- case 15:
+ case 35:
+ case 55:
+ case 16:
return 1;
default:
return 0;
}
}
- if (second === 19 || second === 15) {
+ if (second === 20 || second === 16) {
return 2;
}
- if (second === 22) {
+ if (second === 23) {
return 1;
}
if (!isIdentifier()) {
return 0;
}
- if (nextToken() === 54) {
+ if (nextToken() === 55) {
return 1;
}
return 2;
}
else {
- ts.Debug.assert(first === 25);
+ ts.Debug.assert(first === 26);
if (!isIdentifier()) {
return 0;
}
if (sourceFile.languageVariant === 1) {
var isArrowFunctionInJsx = lookAhead(function () {
var third = nextToken();
- if (third === 83) {
+ if (third === 84) {
var fourth = nextToken();
switch (fourth) {
- case 56:
- case 27:
+ case 57:
+ case 28:
return false;
default:
return true;
}
}
- else if (third === 24) {
+ else if (third === 25) {
return true;
}
return false;
@@ -12521,7 +13470,7 @@ var ts;
return parseParenthesizedArrowFunctionExpressionHead(false);
}
function tryParseAsyncSimpleArrowFunctionExpression() {
- if (token() === 118) {
+ if (token() === 119) {
var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker);
if (isUnParenthesizedAsyncArrowFunction === 1) {
var asyncModifier = parseModifiersForArrowFunction();
@@ -12532,38 +13481,38 @@ var ts;
return undefined;
}
function isUnParenthesizedAsyncArrowFunctionWorker() {
- if (token() === 118) {
+ if (token() === 119) {
nextToken();
- if (scanner.hasPrecedingLineBreak() || token() === 34) {
+ if (scanner.hasPrecedingLineBreak() || token() === 35) {
return 0;
}
var expr = parseBinaryExpressionOrHigher(0);
- if (!scanner.hasPrecedingLineBreak() && expr.kind === 69 && token() === 34) {
+ if (!scanner.hasPrecedingLineBreak() && expr.kind === 70 && token() === 35) {
return 1;
}
}
return 0;
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {
- var node = createNode(180);
+ var node = createNode(181);
node.modifiers = parseModifiersForArrowFunction();
var isAsync = !!(ts.getModifierFlags(node) & 256);
- fillSignature(54, false, isAsync, !allowAmbiguity, node);
+ fillSignature(55, false, isAsync, !allowAmbiguity, node);
if (!node.parameters) {
return undefined;
}
- if (!allowAmbiguity && token() !== 34 && token() !== 15) {
+ if (!allowAmbiguity && token() !== 35 && token() !== 16) {
return undefined;
}
return node;
}
function parseArrowFunctionExpressionBody(isAsync) {
- if (token() === 15) {
+ if (token() === 16) {
return parseFunctionBlock(false, isAsync, false);
}
- if (token() !== 23 &&
- token() !== 87 &&
- token() !== 73 &&
+ if (token() !== 24 &&
+ token() !== 88 &&
+ token() !== 74 &&
isStartOfStatement() &&
!isStartOfExpressionStatement()) {
return parseFunctionBlock(false, isAsync, true);
@@ -12573,15 +13522,15 @@ var ts;
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
}
function parseConditionalExpressionRest(leftOperand) {
- var questionToken = parseOptionalToken(53);
+ var questionToken = parseOptionalToken(54);
if (!questionToken) {
return leftOperand;
}
- var node = createNode(188, leftOperand.pos);
+ var node = createNode(189, leftOperand.pos);
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
- node.colonToken = parseExpectedToken(54, false, ts.Diagnostics._0_expected, ts.tokenToString(54));
+ node.colonToken = parseExpectedToken(55, false, ts.Diagnostics._0_expected, ts.tokenToString(55));
node.whenFalse = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
@@ -12590,22 +13539,22 @@ var ts;
return parseBinaryExpressionRest(precedence, leftOperand);
}
function isInOrOfKeyword(t) {
- return t === 90 || t === 138;
+ return t === 91 || t === 139;
}
function parseBinaryExpressionRest(precedence, leftOperand) {
while (true) {
reScanGreaterToken();
var newPrecedence = getBinaryOperatorPrecedence();
- var consumeCurrentOperator = token() === 38 ?
+ var consumeCurrentOperator = token() === 39 ?
newPrecedence >= precedence :
newPrecedence > precedence;
if (!consumeCurrentOperator) {
break;
}
- if (token() === 90 && inDisallowInContext()) {
+ if (token() === 91 && inDisallowInContext()) {
break;
}
- if (token() === 116) {
+ if (token() === 117) {
if (scanner.hasPrecedingLineBreak()) {
break;
}
@@ -12621,92 +13570,92 @@ var ts;
return leftOperand;
}
function isBinaryOperator() {
- if (inDisallowInContext() && token() === 90) {
+ if (inDisallowInContext() && token() === 91) {
return false;
}
return getBinaryOperatorPrecedence() > 0;
}
function getBinaryOperatorPrecedence() {
switch (token()) {
- case 52:
+ case 53:
return 1;
- case 51:
+ case 52:
return 2;
- case 47:
- return 3;
case 48:
+ return 3;
+ case 49:
return 4;
- case 46:
+ case 47:
return 5;
- case 30:
case 31:
case 32:
case 33:
+ case 34:
return 6;
- case 25:
- case 27:
+ case 26:
case 28:
case 29:
+ case 30:
+ case 92:
case 91:
- case 90:
- case 116:
+ case 117:
return 7;
- case 43:
case 44:
case 45:
+ case 46:
return 8;
- case 35:
case 36:
- return 9;
case 37:
- case 39:
+ return 9;
+ case 38:
case 40:
+ case 41:
return 10;
- case 38:
+ case 39:
return 11;
}
return -1;
}
function makeBinaryExpression(left, operatorToken, right) {
- var node = createNode(187, left.pos);
+ var node = createNode(188, left.pos);
node.left = left;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
function makeAsExpression(left, right) {
- var node = createNode(195, left.pos);
+ var node = createNode(196, left.pos);
node.expression = left;
node.type = right;
return finishNode(node);
}
function parsePrefixUnaryExpression() {
- var node = createNode(185);
+ var node = createNode(186);
node.operator = token();
nextToken();
node.operand = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseDeleteExpression() {
- var node = createNode(181);
+ var node = createNode(182);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseTypeOfExpression() {
- var node = createNode(182);
+ var node = createNode(183);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseVoidExpression() {
- var node = createNode(183);
+ var node = createNode(184);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function isAwaitExpression() {
- if (token() === 119) {
+ if (token() === 120) {
if (inAwaitContext()) {
return true;
}
@@ -12715,7 +13664,7 @@ var ts;
return false;
}
function parseAwaitExpression() {
- var node = createNode(184);
+ var node = createNode(185);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
@@ -12723,15 +13672,15 @@ var ts;
function parseUnaryExpressionOrHigher() {
if (isUpdateExpression()) {
var incrementExpression = parseIncrementExpression();
- return token() === 38 ?
+ return token() === 39 ?
parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) :
incrementExpression;
}
var unaryOperator = token();
var simpleUnaryExpression = parseSimpleUnaryExpression();
- if (token() === 38) {
+ if (token() === 39) {
var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);
- if (simpleUnaryExpression.kind === 177) {
+ if (simpleUnaryExpression.kind === 178) {
parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
}
else {
@@ -12742,20 +13691,20 @@ var ts;
}
function parseSimpleUnaryExpression() {
switch (token()) {
- case 35:
case 36:
+ case 37:
+ case 51:
case 50:
- case 49:
return parsePrefixUnaryExpression();
- case 78:
+ case 79:
return parseDeleteExpression();
- case 101:
+ case 102:
return parseTypeOfExpression();
- case 103:
+ case 104:
return parseVoidExpression();
- case 25:
+ case 26:
return parseTypeAssertion();
- case 119:
+ case 120:
if (isAwaitExpression()) {
return parseAwaitExpression();
}
@@ -12765,16 +13714,16 @@ var ts;
}
function isUpdateExpression() {
switch (token()) {
- case 35:
case 36:
+ case 37:
+ case 51:
case 50:
- case 49:
- case 78:
- case 101:
- case 103:
- case 119:
+ case 79:
+ case 102:
+ case 104:
+ case 120:
return false;
- case 25:
+ case 26:
if (sourceFile.languageVariant !== 1) {
return false;
}
@@ -12783,20 +13732,20 @@ var ts;
}
}
function parseIncrementExpression() {
- if (token() === 41 || token() === 42) {
- var node = createNode(185);
+ if (token() === 42 || token() === 43) {
+ var node = createNode(186);
node.operator = token();
nextToken();
node.operand = parseLeftHandSideExpressionOrHigher();
return finishNode(node);
}
- else if (sourceFile.languageVariant === 1 && token() === 25 && lookAhead(nextTokenIsIdentifierOrKeyword)) {
+ else if (sourceFile.languageVariant === 1 && token() === 26 && lookAhead(nextTokenIsIdentifierOrKeyword)) {
return parseJsxElementOrSelfClosingElement(true);
}
var expression = parseLeftHandSideExpressionOrHigher();
ts.Debug.assert(ts.isLeftHandSideExpression(expression));
- if ((token() === 41 || token() === 42) && !scanner.hasPrecedingLineBreak()) {
- var node = createNode(186, expression.pos);
+ if ((token() === 42 || token() === 43) && !scanner.hasPrecedingLineBreak()) {
+ var node = createNode(187, expression.pos);
node.operand = expression;
node.operator = token();
nextToken();
@@ -12805,7 +13754,7 @@ var ts;
return expression;
}
function parseLeftHandSideExpressionOrHigher() {
- var expression = token() === 95
+ var expression = token() === 96
? parseSuperExpression()
: parseMemberExpressionOrHigher();
return parseCallExpressionRest(expression);
@@ -12816,12 +13765,12 @@ var ts;
}
function parseSuperExpression() {
var expression = parseTokenNode();
- if (token() === 17 || token() === 21 || token() === 19) {
+ if (token() === 18 || token() === 22 || token() === 20) {
return expression;
}
- var node = createNode(172, expression.pos);
+ var node = createNode(173, expression.pos);
node.expression = expression;
- parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
+ parseExpectedToken(22, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(true);
return finishNode(node);
}
@@ -12829,10 +13778,10 @@ var ts;
if (lhs.kind !== rhs.kind) {
return false;
}
- if (lhs.kind === 69) {
+ if (lhs.kind === 70) {
return lhs.text === rhs.text;
}
- if (lhs.kind === 97) {
+ if (lhs.kind === 98) {
return true;
}
return lhs.name.text === rhs.name.text &&
@@ -12841,8 +13790,8 @@ var ts;
function parseJsxElementOrSelfClosingElement(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext);
var result;
- if (opening.kind === 243) {
- var node = createNode(241, opening.pos);
+ if (opening.kind === 244) {
+ var node = createNode(242, opening.pos);
node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement.tagName);
node.closingElement = parseJsxClosingElement(inExpressionContext);
@@ -12852,18 +13801,18 @@ var ts;
result = finishNode(node);
}
else {
- ts.Debug.assert(opening.kind === 242);
+ ts.Debug.assert(opening.kind === 243);
result = opening;
}
- if (inExpressionContext && token() === 25) {
+ if (inExpressionContext && token() === 26) {
var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
- var badNode = createNode(187, result.pos);
+ var badNode = createNode(188, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
- badNode.operatorToken = createMissingNode(24, false, undefined);
+ badNode.operatorToken = createMissingNode(25, false, undefined);
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
return badNode;
}
@@ -12871,17 +13820,17 @@ var ts;
return result;
}
function parseJsxText() {
- var node = createNode(244, scanner.getStartPos());
+ var node = createNode(10, scanner.getStartPos());
currentToken = scanner.scanJsxToken();
return finishNode(node);
}
function parseJsxChild() {
switch (token()) {
- case 244:
+ case 10:
return parseJsxText();
- case 15:
+ case 16:
return parseJsxExpression(false);
- case 25:
+ case 26:
return parseJsxElementOrSelfClosingElement(false);
}
ts.Debug.fail("Unknown JSX child kind " + token());
@@ -12892,7 +13841,7 @@ var ts;
parsingContext |= 1 << 14;
while (true) {
currentToken = scanner.reScanJsxToken();
- if (token() === 26) {
+ if (token() === 27) {
break;
}
else if (token() === 1) {
@@ -12907,24 +13856,24 @@ var ts;
}
function parseJsxOpeningOrSelfClosingElement(inExpressionContext) {
var fullStart = scanner.getStartPos();
- parseExpected(25);
+ parseExpected(26);
var tagName = parseJsxElementName();
var attributes = parseList(13, parseJsxAttribute);
var node;
- if (token() === 27) {
- node = createNode(243, fullStart);
+ if (token() === 28) {
+ node = createNode(244, fullStart);
scanJsxText();
}
else {
- parseExpected(39);
+ parseExpected(40);
if (inExpressionContext) {
- parseExpected(27);
+ parseExpected(28);
}
else {
- parseExpected(27, undefined, false);
+ parseExpected(28, undefined, false);
scanJsxText();
}
- node = createNode(242, fullStart);
+ node = createNode(243, fullStart);
}
node.tagName = tagName;
node.attributes = attributes;
@@ -12932,10 +13881,10 @@ var ts;
}
function parseJsxElementName() {
scanJsxIdentifier();
- var expression = token() === 97 ?
+ var expression = token() === 98 ?
parseTokenNode() : parseIdentifierName();
- while (parseOptional(21)) {
- var propertyAccess = createNode(172, expression.pos);
+ while (parseOptional(22)) {
+ var propertyAccess = createNode(173, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(true);
expression = finishNode(propertyAccess);
@@ -12944,27 +13893,27 @@ var ts;
}
function parseJsxExpression(inExpressionContext) {
var node = createNode(248);
- parseExpected(15);
- if (token() !== 16) {
+ parseExpected(16);
+ if (token() !== 17) {
node.expression = parseAssignmentExpressionOrHigher();
}
if (inExpressionContext) {
- parseExpected(16);
+ parseExpected(17);
}
else {
- parseExpected(16, undefined, false);
+ parseExpected(17, undefined, false);
scanJsxText();
}
return finishNode(node);
}
function parseJsxAttribute() {
- if (token() === 15) {
+ if (token() === 16) {
return parseJsxSpreadAttribute();
}
scanJsxIdentifier();
var node = createNode(246);
node.name = parseIdentifierName();
- if (token() === 56) {
+ if (token() === 57) {
switch (scanJsxAttributeValue()) {
case 9:
node.initializer = parseLiteralNode();
@@ -12978,68 +13927,68 @@ var ts;
}
function parseJsxSpreadAttribute() {
var node = createNode(247);
- parseExpected(15);
- parseExpected(22);
- node.expression = parseExpression();
parseExpected(16);
+ parseExpected(23);
+ node.expression = parseExpression();
+ parseExpected(17);
return finishNode(node);
}
function parseJsxClosingElement(inExpressionContext) {
var node = createNode(245);
- parseExpected(26);
+ parseExpected(27);
node.tagName = parseJsxElementName();
if (inExpressionContext) {
- parseExpected(27);
+ parseExpected(28);
}
else {
- parseExpected(27, undefined, false);
+ parseExpected(28, undefined, false);
scanJsxText();
}
return finishNode(node);
}
function parseTypeAssertion() {
- var node = createNode(177);
- parseExpected(25);
+ var node = createNode(178);
+ parseExpected(26);
node.type = parseType();
- parseExpected(27);
+ parseExpected(28);
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseMemberExpressionRest(expression) {
while (true) {
- var dotToken = parseOptionalToken(21);
+ var dotToken = parseOptionalToken(22);
if (dotToken) {
- var propertyAccess = createNode(172, expression.pos);
+ var propertyAccess = createNode(173, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(true);
expression = finishNode(propertyAccess);
continue;
}
- if (token() === 49 && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 50 && !scanner.hasPrecedingLineBreak()) {
nextToken();
- var nonNullExpression = createNode(196, expression.pos);
+ var nonNullExpression = createNode(197, expression.pos);
nonNullExpression.expression = expression;
expression = finishNode(nonNullExpression);
continue;
}
- if (!inDecoratorContext() && parseOptional(19)) {
- var indexedAccess = createNode(173, expression.pos);
+ if (!inDecoratorContext() && parseOptional(20)) {
+ var indexedAccess = createNode(174, expression.pos);
indexedAccess.expression = expression;
- if (token() !== 20) {
+ if (token() !== 21) {
indexedAccess.argumentExpression = allowInAnd(parseExpression);
if (indexedAccess.argumentExpression.kind === 9 || indexedAccess.argumentExpression.kind === 8) {
var literal = indexedAccess.argumentExpression;
literal.text = internIdentifier(literal.text);
}
}
- parseExpected(20);
+ parseExpected(21);
expression = finishNode(indexedAccess);
continue;
}
- if (token() === 11 || token() === 12) {
- var tagExpression = createNode(176, expression.pos);
+ if (token() === 12 || token() === 13) {
+ var tagExpression = createNode(177, expression.pos);
tagExpression.tag = expression;
- tagExpression.template = token() === 11
+ tagExpression.template = token() === 12
? parseLiteralNode()
: parseTemplateExpression();
expression = finishNode(tagExpression);
@@ -13051,20 +14000,20 @@ var ts;
function parseCallExpressionRest(expression) {
while (true) {
expression = parseMemberExpressionRest(expression);
- if (token() === 25) {
+ if (token() === 26) {
var typeArguments = tryParse(parseTypeArgumentsInExpression);
if (!typeArguments) {
return expression;
}
- var callExpr = createNode(174, expression.pos);
+ var callExpr = createNode(175, expression.pos);
callExpr.expression = expression;
callExpr.typeArguments = typeArguments;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
continue;
}
- else if (token() === 17) {
- var callExpr = createNode(174, expression.pos);
+ else if (token() === 18) {
+ var callExpr = createNode(175, expression.pos);
callExpr.expression = expression;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
@@ -13074,17 +14023,17 @@ var ts;
}
}
function parseArgumentList() {
- parseExpected(17);
- var result = parseDelimitedList(11, parseArgumentExpression);
parseExpected(18);
+ var result = parseDelimitedList(11, parseArgumentExpression);
+ parseExpected(19);
return result;
}
function parseTypeArgumentsInExpression() {
- if (!parseOptional(25)) {
+ if (!parseOptional(26)) {
return undefined;
}
var typeArguments = parseDelimitedList(18, parseType);
- if (!parseExpected(27)) {
+ if (!parseExpected(28)) {
return undefined;
}
return typeArguments && canFollowTypeArgumentsInExpression()
@@ -13093,27 +14042,27 @@ var ts;
}
function canFollowTypeArgumentsInExpression() {
switch (token()) {
- case 17:
- case 21:
case 18:
- case 20:
+ case 22:
+ case 19:
+ case 21:
+ case 55:
+ case 24:
case 54:
- case 23:
- case 53:
- case 30:
- case 32:
case 31:
case 33:
- case 51:
+ case 32:
+ case 34:
case 52:
- case 48:
- case 46:
+ case 53:
+ case 49:
case 47:
- case 16:
+ case 48:
+ case 17:
case 1:
return true;
- case 24:
- case 15:
+ case 25:
+ case 16:
default:
return false;
}
@@ -13122,80 +14071,80 @@ var ts;
switch (token()) {
case 8:
case 9:
- case 11:
+ case 12:
return parseLiteralNode();
- case 97:
- case 95:
- case 93:
- case 99:
- case 84:
+ case 98:
+ case 96:
+ case 94:
+ case 100:
+ case 85:
return parseTokenNode();
- case 17:
+ case 18:
return parseParenthesizedExpression();
- case 19:
+ case 20:
return parseArrayLiteralExpression();
- case 15:
+ case 16:
return parseObjectLiteralExpression();
- case 118:
+ case 119:
if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) {
break;
}
return parseFunctionExpression();
- case 73:
+ case 74:
return parseClassExpression();
- case 87:
+ case 88:
return parseFunctionExpression();
- case 92:
+ case 93:
return parseNewExpression();
- case 39:
- case 61:
- if (reScanSlashToken() === 10) {
+ case 40:
+ case 62:
+ if (reScanSlashToken() === 11) {
return parseLiteralNode();
}
break;
- case 12:
+ case 13:
return parseTemplateExpression();
}
return parseIdentifier(ts.Diagnostics.Expression_expected);
}
function parseParenthesizedExpression() {
- var node = createNode(178);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(179);
parseExpected(18);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
return finishNode(node);
}
function parseSpreadElement() {
- var node = createNode(191);
- parseExpected(22);
+ var node = createNode(192);
+ parseExpected(23);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
function parseArgumentOrArrayLiteralElement() {
- return token() === 22 ? parseSpreadElement() :
- token() === 24 ? createNode(193) :
+ return token() === 23 ? parseSpreadElement() :
+ token() === 25 ? createNode(194) :
parseAssignmentExpressionOrHigher();
}
function parseArgumentExpression() {
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
}
function parseArrayLiteralExpression() {
- var node = createNode(170);
- parseExpected(19);
+ var node = createNode(171);
+ parseExpected(20);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
}
node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement);
- parseExpected(20);
+ parseExpected(21);
return finishNode(node);
}
function tryParseAccessorDeclaration(fullStart, decorators, modifiers) {
- if (parseContextualModifier(123)) {
- return parseAccessorDeclaration(149, fullStart, decorators, modifiers);
- }
- else if (parseContextualModifier(131)) {
+ if (parseContextualModifier(124)) {
return parseAccessorDeclaration(150, fullStart, decorators, modifiers);
}
+ else if (parseContextualModifier(132)) {
+ return parseAccessorDeclaration(151, fullStart, decorators, modifiers);
+ }
return undefined;
}
function parseObjectLiteralElement() {
@@ -13206,19 +14155,19 @@ var ts;
if (accessor) {
return accessor;
}
- var asteriskToken = parseOptionalToken(37);
+ var asteriskToken = parseOptionalToken(38);
var tokenIsIdentifier = isIdentifier();
var propertyName = parsePropertyName();
- var questionToken = parseOptionalToken(53);
- if (asteriskToken || token() === 17 || token() === 25) {
+ var questionToken = parseOptionalToken(54);
+ if (asteriskToken || token() === 18 || token() === 26) {
return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken);
}
- var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 24 || token() === 16 || token() === 56);
+ var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57);
if (isShorthandPropertyAssignment) {
var shorthandDeclaration = createNode(254, fullStart);
shorthandDeclaration.name = propertyName;
shorthandDeclaration.questionToken = questionToken;
- var equalsToken = parseOptionalToken(56);
+ var equalsToken = parseOptionalToken(57);
if (equalsToken) {
shorthandDeclaration.equalsToken = equalsToken;
shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
@@ -13230,19 +14179,19 @@ var ts;
propertyAssignment.modifiers = modifiers;
propertyAssignment.name = propertyName;
propertyAssignment.questionToken = questionToken;
- parseExpected(54);
+ parseExpected(55);
propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
return addJSDocComment(finishNode(propertyAssignment));
}
}
function parseObjectLiteralExpression() {
- var node = createNode(171);
- parseExpected(15);
+ var node = createNode(172);
+ parseExpected(16);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
}
node.properties = parseDelimitedList(12, parseObjectLiteralElement, true);
- parseExpected(16);
+ parseExpected(17);
return finishNode(node);
}
function parseFunctionExpression() {
@@ -13250,10 +14199,10 @@ var ts;
if (saveDecoratorContext) {
setDecoratorContext(false);
}
- var node = createNode(179);
+ var node = createNode(180);
node.modifiers = parseModifiers();
- parseExpected(87);
- node.asteriskToken = parseOptionalToken(37);
+ parseExpected(88);
+ node.asteriskToken = parseOptionalToken(38);
var isGenerator = !!node.asteriskToken;
var isAsync = !!(ts.getModifierFlags(node) & 256);
node.name =
@@ -13261,7 +14210,7 @@ var ts;
isGenerator ? doInYieldContext(parseOptionalIdentifier) :
isAsync ? doInAwaitContext(parseOptionalIdentifier) :
parseOptionalIdentifier();
- fillSignature(54, isGenerator, isAsync, false, node);
+ fillSignature(55, isGenerator, isAsync, false, node);
node.body = parseFunctionBlock(isGenerator, isAsync, false);
if (saveDecoratorContext) {
setDecoratorContext(true);
@@ -13272,23 +14221,23 @@ var ts;
return isIdentifier() ? parseIdentifier() : undefined;
}
function parseNewExpression() {
- var node = createNode(175);
- parseExpected(92);
+ var node = createNode(176);
+ parseExpected(93);
node.expression = parseMemberExpressionOrHigher();
node.typeArguments = tryParse(parseTypeArgumentsInExpression);
- if (node.typeArguments || token() === 17) {
+ if (node.typeArguments || token() === 18) {
node.arguments = parseArgumentList();
}
return finishNode(node);
}
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
- var node = createNode(199);
- if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) {
+ var node = createNode(200);
+ if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) {
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
}
node.statements = parseList(1, parseStatement);
- parseExpected(16);
+ parseExpected(17);
}
else {
node.statements = createMissingList();
@@ -13313,47 +14262,47 @@ var ts;
return block;
}
function parseEmptyStatement() {
- var node = createNode(201);
- parseExpected(23);
+ var node = createNode(202);
+ parseExpected(24);
return finishNode(node);
}
function parseIfStatement() {
- var node = createNode(203);
- parseExpected(88);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(204);
+ parseExpected(89);
parseExpected(18);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
node.thenStatement = parseStatement();
- node.elseStatement = parseOptional(80) ? parseStatement() : undefined;
+ node.elseStatement = parseOptional(81) ? parseStatement() : undefined;
return finishNode(node);
}
function parseDoStatement() {
- var node = createNode(204);
- parseExpected(79);
+ var node = createNode(205);
+ parseExpected(80);
node.statement = parseStatement();
- parseExpected(104);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ parseExpected(105);
parseExpected(18);
- parseOptional(23);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
+ parseOptional(24);
return finishNode(node);
}
function parseWhileStatement() {
- var node = createNode(205);
- parseExpected(104);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(206);
+ parseExpected(105);
parseExpected(18);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
node.statement = parseStatement();
return finishNode(node);
}
function parseForOrForInOrForOfStatement() {
var pos = getNodePos();
- parseExpected(86);
- parseExpected(17);
+ parseExpected(87);
+ parseExpected(18);
var initializer = undefined;
- if (token() !== 23) {
- if (token() === 102 || token() === 108 || token() === 74) {
+ if (token() !== 24) {
+ if (token() === 103 || token() === 109 || token() === 75) {
initializer = parseVariableDeclarationList(true);
}
else {
@@ -13361,32 +14310,32 @@ var ts;
}
}
var forOrForInOrForOfStatement;
- if (parseOptional(90)) {
- var forInStatement = createNode(207, pos);
+ if (parseOptional(91)) {
+ var forInStatement = createNode(208, pos);
forInStatement.initializer = initializer;
forInStatement.expression = allowInAnd(parseExpression);
- parseExpected(18);
+ parseExpected(19);
forOrForInOrForOfStatement = forInStatement;
}
- else if (parseOptional(138)) {
- var forOfStatement = createNode(208, pos);
+ else if (parseOptional(139)) {
+ var forOfStatement = createNode(209, pos);
forOfStatement.initializer = initializer;
forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);
- parseExpected(18);
+ parseExpected(19);
forOrForInOrForOfStatement = forOfStatement;
}
else {
- var forStatement = createNode(206, pos);
+ var forStatement = createNode(207, pos);
forStatement.initializer = initializer;
- parseExpected(23);
- if (token() !== 23 && token() !== 18) {
+ parseExpected(24);
+ if (token() !== 24 && token() !== 19) {
forStatement.condition = allowInAnd(parseExpression);
}
- parseExpected(23);
- if (token() !== 18) {
+ parseExpected(24);
+ if (token() !== 19) {
forStatement.incrementor = allowInAnd(parseExpression);
}
- parseExpected(18);
+ parseExpected(19);
forOrForInOrForOfStatement = forStatement;
}
forOrForInOrForOfStatement.statement = parseStatement();
@@ -13394,7 +14343,7 @@ var ts;
}
function parseBreakOrContinueStatement(kind) {
var node = createNode(kind);
- parseExpected(kind === 210 ? 70 : 75);
+ parseExpected(kind === 211 ? 71 : 76);
if (!canParseSemicolon()) {
node.label = parseIdentifier();
}
@@ -13402,8 +14351,8 @@ var ts;
return finishNode(node);
}
function parseReturnStatement() {
- var node = createNode(211);
- parseExpected(94);
+ var node = createNode(212);
+ parseExpected(95);
if (!canParseSemicolon()) {
node.expression = allowInAnd(parseExpression);
}
@@ -13411,90 +14360,90 @@ var ts;
return finishNode(node);
}
function parseWithStatement() {
- var node = createNode(212);
- parseExpected(105);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(213);
+ parseExpected(106);
parseExpected(18);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
node.statement = parseStatement();
return finishNode(node);
}
function parseCaseClause() {
var node = createNode(249);
- parseExpected(71);
+ parseExpected(72);
node.expression = allowInAnd(parseExpression);
- parseExpected(54);
+ parseExpected(55);
node.statements = parseList(3, parseStatement);
return finishNode(node);
}
function parseDefaultClause() {
var node = createNode(250);
- parseExpected(77);
- parseExpected(54);
+ parseExpected(78);
+ parseExpected(55);
node.statements = parseList(3, parseStatement);
return finishNode(node);
}
function parseCaseOrDefaultClause() {
- return token() === 71 ? parseCaseClause() : parseDefaultClause();
+ return token() === 72 ? parseCaseClause() : parseDefaultClause();
}
function parseSwitchStatement() {
- var node = createNode(213);
- parseExpected(96);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(214);
+ parseExpected(97);
parseExpected(18);
- var caseBlock = createNode(227, scanner.getStartPos());
- parseExpected(15);
- caseBlock.clauses = parseList(2, parseCaseOrDefaultClause);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
+ var caseBlock = createNode(228, scanner.getStartPos());
parseExpected(16);
+ caseBlock.clauses = parseList(2, parseCaseOrDefaultClause);
+ parseExpected(17);
node.caseBlock = finishNode(caseBlock);
return finishNode(node);
}
function parseThrowStatement() {
- var node = createNode(215);
- parseExpected(98);
+ var node = createNode(216);
+ parseExpected(99);
node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);
parseSemicolon();
return finishNode(node);
}
function parseTryStatement() {
- var node = createNode(216);
- parseExpected(100);
+ var node = createNode(217);
+ parseExpected(101);
node.tryBlock = parseBlock(false);
- node.catchClause = token() === 72 ? parseCatchClause() : undefined;
- if (!node.catchClause || token() === 85) {
- parseExpected(85);
+ node.catchClause = token() === 73 ? parseCatchClause() : undefined;
+ if (!node.catchClause || token() === 86) {
+ parseExpected(86);
node.finallyBlock = parseBlock(false);
}
return finishNode(node);
}
function parseCatchClause() {
var result = createNode(252);
- parseExpected(72);
- if (parseExpected(17)) {
+ parseExpected(73);
+ if (parseExpected(18)) {
result.variableDeclaration = parseVariableDeclaration();
}
- parseExpected(18);
+ parseExpected(19);
result.block = parseBlock(false);
return finishNode(result);
}
function parseDebuggerStatement() {
- var node = createNode(217);
- parseExpected(76);
+ var node = createNode(218);
+ parseExpected(77);
parseSemicolon();
return finishNode(node);
}
function parseExpressionOrLabeledStatement() {
var fullStart = scanner.getStartPos();
var expression = allowInAnd(parseExpression);
- if (expression.kind === 69 && parseOptional(54)) {
- var labeledStatement = createNode(214, fullStart);
+ if (expression.kind === 70 && parseOptional(55)) {
+ var labeledStatement = createNode(215, fullStart);
labeledStatement.label = expression;
labeledStatement.statement = parseStatement();
return addJSDocComment(finishNode(labeledStatement));
}
else {
- var expressionStatement = createNode(202, fullStart);
+ var expressionStatement = createNode(203, fullStart);
expressionStatement.expression = expression;
parseSemicolon();
return addJSDocComment(finishNode(expressionStatement));
@@ -13506,7 +14455,7 @@ var ts;
}
function nextTokenIsFunctionKeywordOnSameLine() {
nextToken();
- return token() === 87 && !scanner.hasPrecedingLineBreak();
+ return token() === 88 && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() {
nextToken();
@@ -13515,47 +14464,47 @@ var ts;
function isDeclaration() {
while (true) {
switch (token()) {
- case 102:
- case 108:
+ case 103:
+ case 109:
+ case 75:
+ case 88:
case 74:
- case 87:
- case 73:
- case 81:
+ case 82:
return true;
- case 107:
- case 134:
+ case 108:
+ case 135:
return nextTokenIsIdentifierOnSameLine();
- case 125:
case 126:
+ case 127:
return nextTokenIsIdentifierOrStringLiteralOnSameLine();
- case 115:
- case 118:
- case 122:
- case 110:
+ case 116:
+ case 119:
+ case 123:
case 111:
case 112:
- case 128:
+ case 113:
+ case 129:
nextToken();
if (scanner.hasPrecedingLineBreak()) {
return false;
}
continue;
- case 137:
+ case 138:
nextToken();
- return token() === 15 || token() === 69 || token() === 82;
- case 89:
+ return token() === 16 || token() === 70 || token() === 83;
+ case 90:
nextToken();
- return token() === 9 || token() === 37 ||
- token() === 15 || ts.tokenIsIdentifierOrKeyword(token());
- case 82:
+ return token() === 9 || token() === 38 ||
+ token() === 16 || ts.tokenIsIdentifierOrKeyword(token());
+ case 83:
nextToken();
- if (token() === 56 || token() === 37 ||
- token() === 15 || token() === 77 ||
- token() === 116) {
+ if (token() === 57 || token() === 38 ||
+ token() === 16 || token() === 78 ||
+ token() === 117) {
return true;
}
continue;
- case 113:
+ case 114:
nextToken();
continue;
default:
@@ -13568,46 +14517,46 @@ var ts;
}
function isStartOfStatement() {
switch (token()) {
- case 55:
- case 23:
- case 15:
- case 102:
- case 108:
- case 87:
- case 73:
- case 81:
+ case 56:
+ case 24:
+ case 16:
+ case 103:
+ case 109:
case 88:
- case 79:
- case 104:
- case 86:
- case 75:
- case 70:
- case 94:
- case 105:
- case 96:
- case 98:
- case 100:
- case 76:
- case 72:
- case 85:
- return true;
case 74:
case 82:
case 89:
+ case 80:
+ case 105:
+ case 87:
+ case 76:
+ case 71:
+ case 95:
+ case 106:
+ case 97:
+ case 99:
+ case 101:
+ case 77:
+ case 73:
+ case 86:
+ return true;
+ case 75:
+ case 83:
+ case 90:
return isStartOfDeclaration();
- case 118:
- case 122:
- case 107:
- case 125:
+ case 119:
+ case 123:
+ case 108:
case 126:
- case 134:
- case 137:
+ case 127:
+ case 135:
+ case 138:
return true;
- case 112:
- case 110:
- case 111:
case 113:
- case 128:
+ case 111:
+ case 112:
+ case 114:
+ case 129:
return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
default:
return isStartOfExpression();
@@ -13615,73 +14564,73 @@ var ts;
}
function nextTokenIsIdentifierOrStartOfDestructuring() {
nextToken();
- return isIdentifier() || token() === 15 || token() === 19;
+ return isIdentifier() || token() === 16 || token() === 20;
}
function isLetDeclaration() {
return lookAhead(nextTokenIsIdentifierOrStartOfDestructuring);
}
function parseStatement() {
switch (token()) {
- case 23:
+ case 24:
return parseEmptyStatement();
- case 15:
+ case 16:
return parseBlock(false);
- case 102:
+ case 103:
return parseVariableStatement(scanner.getStartPos(), undefined, undefined);
- case 108:
+ case 109:
if (isLetDeclaration()) {
return parseVariableStatement(scanner.getStartPos(), undefined, undefined);
}
break;
- case 87:
+ case 88:
return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined);
- case 73:
+ case 74:
return parseClassDeclaration(scanner.getStartPos(), undefined, undefined);
- case 88:
+ case 89:
return parseIfStatement();
- case 79:
+ case 80:
return parseDoStatement();
- case 104:
+ case 105:
return parseWhileStatement();
- case 86:
+ case 87:
return parseForOrForInOrForOfStatement();
- case 75:
- return parseBreakOrContinueStatement(209);
- case 70:
+ case 76:
return parseBreakOrContinueStatement(210);
- case 94:
+ case 71:
+ return parseBreakOrContinueStatement(211);
+ case 95:
return parseReturnStatement();
- case 105:
+ case 106:
return parseWithStatement();
- case 96:
+ case 97:
return parseSwitchStatement();
- case 98:
+ case 99:
return parseThrowStatement();
- case 100:
- case 72:
- case 85:
+ case 101:
+ case 73:
+ case 86:
return parseTryStatement();
- case 76:
+ case 77:
return parseDebuggerStatement();
- case 55:
+ case 56:
return parseDeclaration();
- case 118:
- case 107:
- case 134:
- case 125:
+ case 119:
+ case 108:
+ case 135:
case 126:
- case 122:
- case 74:
- case 81:
+ case 127:
+ case 123:
+ case 75:
case 82:
- case 89:
- case 110:
+ case 83:
+ case 90:
case 111:
case 112:
- case 115:
case 113:
- case 128:
- case 137:
+ case 116:
+ case 114:
+ case 129:
+ case 138:
if (isStartOfDeclaration()) {
return parseDeclaration();
}
@@ -13694,40 +14643,40 @@ var ts;
var decorators = parseDecorators();
var modifiers = parseModifiers();
switch (token()) {
- case 102:
- case 108:
- case 74:
+ case 103:
+ case 109:
+ case 75:
return parseVariableStatement(fullStart, decorators, modifiers);
- case 87:
+ case 88:
return parseFunctionDeclaration(fullStart, decorators, modifiers);
- case 73:
+ case 74:
return parseClassDeclaration(fullStart, decorators, modifiers);
- case 107:
+ case 108:
return parseInterfaceDeclaration(fullStart, decorators, modifiers);
- case 134:
+ case 135:
return parseTypeAliasDeclaration(fullStart, decorators, modifiers);
- case 81:
+ case 82:
return parseEnumDeclaration(fullStart, decorators, modifiers);
- case 137:
- case 125:
+ case 138:
case 126:
+ case 127:
return parseModuleDeclaration(fullStart, decorators, modifiers);
- case 89:
+ case 90:
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
- case 82:
+ case 83:
nextToken();
switch (token()) {
- case 77:
- case 56:
+ case 78:
+ case 57:
return parseExportAssignment(fullStart, decorators, modifiers);
- case 116:
+ case 117:
return parseNamespaceExportDeclaration(fullStart, decorators, modifiers);
default:
return parseExportDeclaration(fullStart, decorators, modifiers);
}
default:
if (decorators || modifiers) {
- var node = createMissingNode(239, true, ts.Diagnostics.Declaration_expected);
+ var node = createMissingNode(240, true, ts.Diagnostics.Declaration_expected);
node.pos = fullStart;
node.decorators = decorators;
node.modifiers = modifiers;
@@ -13740,31 +14689,31 @@ var ts;
return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 9);
}
function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) {
- if (token() !== 15 && canParseSemicolon()) {
+ if (token() !== 16 && canParseSemicolon()) {
parseSemicolon();
return;
}
return parseFunctionBlock(isGenerator, isAsync, false, diagnosticMessage);
}
function parseArrayBindingElement() {
- if (token() === 24) {
- return createNode(193);
+ if (token() === 25) {
+ return createNode(194);
}
- var node = createNode(169);
- node.dotDotDotToken = parseOptionalToken(22);
+ var node = createNode(170);
+ node.dotDotDotToken = parseOptionalToken(23);
node.name = parseIdentifierOrPattern();
node.initializer = parseBindingElementInitializer(false);
return finishNode(node);
}
function parseObjectBindingElement() {
- var node = createNode(169);
+ var node = createNode(170);
var tokenIsIdentifier = isIdentifier();
var propertyName = parsePropertyName();
- if (tokenIsIdentifier && token() !== 54) {
+ if (tokenIsIdentifier && token() !== 55) {
node.name = propertyName;
}
else {
- parseExpected(54);
+ parseExpected(55);
node.propertyName = propertyName;
node.name = parseIdentifierOrPattern();
}
@@ -13772,33 +14721,33 @@ var ts;
return finishNode(node);
}
function parseObjectBindingPattern() {
- var node = createNode(167);
- parseExpected(15);
- node.elements = parseDelimitedList(9, parseObjectBindingElement);
+ var node = createNode(168);
parseExpected(16);
+ node.elements = parseDelimitedList(9, parseObjectBindingElement);
+ parseExpected(17);
return finishNode(node);
}
function parseArrayBindingPattern() {
- var node = createNode(168);
- parseExpected(19);
- node.elements = parseDelimitedList(10, parseArrayBindingElement);
+ var node = createNode(169);
parseExpected(20);
+ node.elements = parseDelimitedList(10, parseArrayBindingElement);
+ parseExpected(21);
return finishNode(node);
}
function isIdentifierOrPattern() {
- return token() === 15 || token() === 19 || isIdentifier();
+ return token() === 16 || token() === 20 || isIdentifier();
}
function parseIdentifierOrPattern() {
- if (token() === 19) {
+ if (token() === 20) {
return parseArrayBindingPattern();
}
- if (token() === 15) {
+ if (token() === 16) {
return parseObjectBindingPattern();
}
return parseIdentifier();
}
function parseVariableDeclaration() {
- var node = createNode(218);
+ var node = createNode(219);
node.name = parseIdentifierOrPattern();
node.type = parseTypeAnnotation();
if (!isInOrOfKeyword(token())) {
@@ -13807,21 +14756,21 @@ var ts;
return finishNode(node);
}
function parseVariableDeclarationList(inForStatementInitializer) {
- var node = createNode(219);
+ var node = createNode(220);
switch (token()) {
- case 102:
+ case 103:
break;
- case 108:
+ case 109:
node.flags |= 1;
break;
- case 74:
+ case 75:
node.flags |= 2;
break;
default:
ts.Debug.fail();
}
nextToken();
- if (token() === 138 && lookAhead(canFollowContextualOfKeyword)) {
+ if (token() === 139 && lookAhead(canFollowContextualOfKeyword)) {
node.declarations = createMissingList();
}
else {
@@ -13833,10 +14782,10 @@ var ts;
return finishNode(node);
}
function canFollowContextualOfKeyword() {
- return nextTokenIsIdentifier() && nextToken() === 18;
+ return nextTokenIsIdentifier() && nextToken() === 19;
}
function parseVariableStatement(fullStart, decorators, modifiers) {
- var node = createNode(200, fullStart);
+ var node = createNode(201, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
node.declarationList = parseVariableDeclarationList(false);
@@ -13844,29 +14793,29 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseFunctionDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(220, fullStart);
+ var node = createNode(221, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(87);
- node.asteriskToken = parseOptionalToken(37);
+ parseExpected(88);
+ node.asteriskToken = parseOptionalToken(38);
node.name = ts.hasModifier(node, 512) ? parseOptionalIdentifier() : parseIdentifier();
var isGenerator = !!node.asteriskToken;
var isAsync = ts.hasModifier(node, 256);
- fillSignature(54, isGenerator, isAsync, false, node);
+ fillSignature(55, isGenerator, isAsync, false, node);
node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected);
return addJSDocComment(finishNode(node));
}
function parseConstructorDeclaration(pos, decorators, modifiers) {
- var node = createNode(148, pos);
+ var node = createNode(149, pos);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(121);
- fillSignature(54, false, false, false, node);
+ parseExpected(122);
+ fillSignature(55, false, false, false, node);
node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected);
return addJSDocComment(finishNode(node));
}
function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) {
- var method = createNode(147, fullStart);
+ var method = createNode(148, fullStart);
method.decorators = decorators;
method.modifiers = modifiers;
method.asteriskToken = asteriskToken;
@@ -13874,12 +14823,12 @@ var ts;
method.questionToken = questionToken;
var isGenerator = !!asteriskToken;
var isAsync = ts.hasModifier(method, 256);
- fillSignature(54, isGenerator, isAsync, false, method);
+ fillSignature(55, isGenerator, isAsync, false, method);
method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage);
return addJSDocComment(finishNode(method));
}
function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) {
- var property = createNode(145, fullStart);
+ var property = createNode(146, fullStart);
property.decorators = decorators;
property.modifiers = modifiers;
property.name = name;
@@ -13892,10 +14841,10 @@ var ts;
return addJSDocComment(finishNode(property));
}
function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) {
- var asteriskToken = parseOptionalToken(37);
+ var asteriskToken = parseOptionalToken(38);
var name = parsePropertyName();
- var questionToken = parseOptionalToken(53);
- if (asteriskToken || token() === 17 || token() === 25) {
+ var questionToken = parseOptionalToken(54);
+ if (asteriskToken || token() === 18 || token() === 26) {
return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected);
}
else {
@@ -13910,17 +14859,17 @@ var ts;
node.decorators = decorators;
node.modifiers = modifiers;
node.name = parsePropertyName();
- fillSignature(54, false, false, false, node);
+ fillSignature(55, false, false, false, node);
node.body = parseFunctionBlockOrSemicolon(false, false);
return addJSDocComment(finishNode(node));
}
function isClassMemberModifier(idToken) {
switch (idToken) {
- case 112:
- case 110:
- case 111:
case 113:
- case 128:
+ case 111:
+ case 112:
+ case 114:
+ case 129:
return true;
default:
return false;
@@ -13928,7 +14877,7 @@ var ts;
}
function isClassMemberStart() {
var idToken;
- if (token() === 55) {
+ if (token() === 56) {
return true;
}
while (ts.isModifierKind(token())) {
@@ -13938,26 +14887,26 @@ var ts;
}
nextToken();
}
- if (token() === 37) {
+ if (token() === 38) {
return true;
}
if (isLiteralPropertyName()) {
idToken = token();
nextToken();
}
- if (token() === 19) {
+ if (token() === 20) {
return true;
}
if (idToken !== undefined) {
- if (!ts.isKeyword(idToken) || idToken === 131 || idToken === 123) {
+ if (!ts.isKeyword(idToken) || idToken === 132 || idToken === 124) {
return true;
}
switch (token()) {
- case 17:
- case 25:
+ case 18:
+ case 26:
+ case 55:
+ case 57:
case 54:
- case 56:
- case 53:
return true;
default:
return canParseSemicolon();
@@ -13969,10 +14918,10 @@ var ts;
var decorators;
while (true) {
var decoratorStart = getNodePos();
- if (!parseOptional(55)) {
+ if (!parseOptional(56)) {
break;
}
- var decorator = createNode(143, decoratorStart);
+ var decorator = createNode(144, decoratorStart);
decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);
finishNode(decorator);
if (!decorators) {
@@ -13992,7 +14941,7 @@ var ts;
while (true) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
- if (token() === 74 && permitInvalidConstAsModifier) {
+ if (token() === 75 && permitInvalidConstAsModifier) {
if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {
break;
}
@@ -14017,7 +14966,7 @@ var ts;
}
function parseModifiersForArrowFunction() {
var modifiers;
- if (token() === 118) {
+ if (token() === 119) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
nextToken();
@@ -14028,8 +14977,8 @@ var ts;
return modifiers;
}
function parseClassElement() {
- if (token() === 23) {
- var result = createNode(198);
+ if (token() === 24) {
+ var result = createNode(199);
nextToken();
return finishNode(result);
}
@@ -14040,7 +14989,7 @@ var ts;
if (accessor) {
return accessor;
}
- if (token() === 121) {
+ if (token() === 122) {
return parseConstructorDeclaration(fullStart, decorators, modifiers);
}
if (isIndexSignature()) {
@@ -14049,33 +14998,33 @@ var ts;
if (ts.tokenIsIdentifierOrKeyword(token()) ||
token() === 9 ||
token() === 8 ||
- token() === 37 ||
- token() === 19) {
+ token() === 38 ||
+ token() === 20) {
return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);
}
if (decorators || modifiers) {
- var name_10 = createMissingNode(69, true, ts.Diagnostics.Declaration_expected);
+ var name_10 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected);
return parsePropertyDeclaration(fullStart, decorators, modifiers, name_10, undefined);
}
ts.Debug.fail("Should not have attempted to parse class member declaration.");
}
function parseClassExpression() {
- return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 192);
+ return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 193);
}
function parseClassDeclaration(fullStart, decorators, modifiers) {
- return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 221);
+ return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 222);
}
function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) {
var node = createNode(kind, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(73);
+ parseExpected(74);
node.name = parseNameOfClassDeclarationOrExpression();
node.typeParameters = parseTypeParameters();
- node.heritageClauses = parseHeritageClauses(true);
- if (parseExpected(15)) {
+ node.heritageClauses = parseHeritageClauses();
+ if (parseExpected(16)) {
node.members = parseClassMembers();
- parseExpected(16);
+ parseExpected(17);
}
else {
node.members = createMissingList();
@@ -14088,16 +15037,16 @@ var ts;
: undefined;
}
function isImplementsClause() {
- return token() === 106 && lookAhead(nextTokenIsIdentifierOrKeyword);
+ return token() === 107 && lookAhead(nextTokenIsIdentifierOrKeyword);
}
- function parseHeritageClauses(isClassHeritageClause) {
+ function parseHeritageClauses() {
if (isHeritageClause()) {
return parseList(20, parseHeritageClause);
}
return undefined;
}
function parseHeritageClause() {
- if (token() === 83 || token() === 106) {
+ if (token() === 84 || token() === 107) {
var node = createNode(251);
node.token = token();
nextToken();
@@ -14107,38 +15056,38 @@ var ts;
return undefined;
}
function parseExpressionWithTypeArguments() {
- var node = createNode(194);
+ var node = createNode(195);
node.expression = parseLeftHandSideExpressionOrHigher();
- if (token() === 25) {
- node.typeArguments = parseBracketedList(18, parseType, 25, 27);
+ if (token() === 26) {
+ node.typeArguments = parseBracketedList(18, parseType, 26, 28);
}
return finishNode(node);
}
function isHeritageClause() {
- return token() === 83 || token() === 106;
+ return token() === 84 || token() === 107;
}
function parseClassMembers() {
return parseList(5, parseClassElement);
}
function parseInterfaceDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(222, fullStart);
+ var node = createNode(223, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(107);
+ parseExpected(108);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
- node.heritageClauses = parseHeritageClauses(false);
+ node.heritageClauses = parseHeritageClauses();
node.members = parseObjectTypeMembers();
return addJSDocComment(finishNode(node));
}
function parseTypeAliasDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(223, fullStart);
+ var node = createNode(224, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(134);
+ parseExpected(135);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
- parseExpected(56);
+ parseExpected(57);
node.type = parseType();
parseSemicolon();
return addJSDocComment(finishNode(node));
@@ -14150,14 +15099,14 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseEnumDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(224, fullStart);
+ var node = createNode(225, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(81);
+ parseExpected(82);
node.name = parseIdentifier();
- if (parseExpected(15)) {
+ if (parseExpected(16)) {
node.members = parseDelimitedList(6, parseEnumMember);
- parseExpected(16);
+ parseExpected(17);
}
else {
node.members = createMissingList();
@@ -14165,10 +15114,10 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseModuleBlock() {
- var node = createNode(226, scanner.getStartPos());
- if (parseExpected(15)) {
+ var node = createNode(227, scanner.getStartPos());
+ if (parseExpected(16)) {
node.statements = parseList(1, parseStatement);
- parseExpected(16);
+ parseExpected(17);
}
else {
node.statements = createMissingList();
@@ -14176,29 +15125,29 @@ var ts;
return finishNode(node);
}
function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) {
- var node = createNode(225, fullStart);
+ var node = createNode(226, fullStart);
var namespaceFlag = flags & 16;
node.decorators = decorators;
node.modifiers = modifiers;
node.flags |= flags;
node.name = parseIdentifier();
- node.body = parseOptional(21)
+ node.body = parseOptional(22)
? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 4 | namespaceFlag)
: parseModuleBlock();
return addJSDocComment(finishNode(node));
}
function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(225, fullStart);
+ var node = createNode(226, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- if (token() === 137) {
+ if (token() === 138) {
node.name = parseIdentifier();
node.flags |= 512;
}
else {
node.name = parseLiteralNode(true);
}
- if (token() === 15) {
+ if (token() === 16) {
node.body = parseModuleBlock();
}
else {
@@ -14208,14 +15157,14 @@ var ts;
}
function parseModuleDeclaration(fullStart, decorators, modifiers) {
var flags = 0;
- if (token() === 137) {
+ if (token() === 138) {
return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);
}
- else if (parseOptional(126)) {
+ else if (parseOptional(127)) {
flags |= 16;
}
else {
- parseExpected(125);
+ parseExpected(126);
if (token() === 9) {
return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);
}
@@ -14223,63 +15172,63 @@ var ts;
return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags);
}
function isExternalModuleReference() {
- return token() === 129 &&
+ return token() === 130 &&
lookAhead(nextTokenIsOpenParen);
}
function nextTokenIsOpenParen() {
- return nextToken() === 17;
+ return nextToken() === 18;
}
function nextTokenIsSlash() {
- return nextToken() === 39;
+ return nextToken() === 40;
}
function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) {
- var exportDeclaration = createNode(228, fullStart);
+ var exportDeclaration = createNode(229, fullStart);
exportDeclaration.decorators = decorators;
exportDeclaration.modifiers = modifiers;
- parseExpected(116);
- parseExpected(126);
+ parseExpected(117);
+ parseExpected(127);
exportDeclaration.name = parseIdentifier();
- parseExpected(23);
+ parseExpected(24);
return finishNode(exportDeclaration);
}
function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) {
- parseExpected(89);
+ parseExpected(90);
var afterImportPos = scanner.getStartPos();
var identifier;
if (isIdentifier()) {
identifier = parseIdentifier();
- if (token() !== 24 && token() !== 136) {
- var importEqualsDeclaration = createNode(229, fullStart);
+ if (token() !== 25 && token() !== 137) {
+ var importEqualsDeclaration = createNode(230, fullStart);
importEqualsDeclaration.decorators = decorators;
importEqualsDeclaration.modifiers = modifiers;
importEqualsDeclaration.name = identifier;
- parseExpected(56);
+ parseExpected(57);
importEqualsDeclaration.moduleReference = parseModuleReference();
parseSemicolon();
return addJSDocComment(finishNode(importEqualsDeclaration));
}
}
- var importDeclaration = createNode(230, fullStart);
+ var importDeclaration = createNode(231, fullStart);
importDeclaration.decorators = decorators;
importDeclaration.modifiers = modifiers;
if (identifier ||
- token() === 37 ||
- token() === 15) {
+ token() === 38 ||
+ token() === 16) {
importDeclaration.importClause = parseImportClause(identifier, afterImportPos);
- parseExpected(136);
+ parseExpected(137);
}
importDeclaration.moduleSpecifier = parseModuleSpecifier();
parseSemicolon();
return finishNode(importDeclaration);
}
function parseImportClause(identifier, fullStart) {
- var importClause = createNode(231, fullStart);
+ var importClause = createNode(232, fullStart);
if (identifier) {
importClause.name = identifier;
}
if (!importClause.name ||
- parseOptional(24)) {
- importClause.namedBindings = token() === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(233);
+ parseOptional(25)) {
+ importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(234);
}
return finishNode(importClause);
}
@@ -14289,11 +15238,11 @@ var ts;
: parseEntityName(false);
}
function parseExternalModuleReference() {
- var node = createNode(240);
- parseExpected(129);
- parseExpected(17);
- node.expression = parseModuleSpecifier();
+ var node = createNode(241);
+ parseExpected(130);
parseExpected(18);
+ node.expression = parseModuleSpecifier();
+ parseExpected(19);
return finishNode(node);
}
function parseModuleSpecifier() {
@@ -14307,22 +15256,22 @@ var ts;
}
}
function parseNamespaceImport() {
- var namespaceImport = createNode(232);
- parseExpected(37);
- parseExpected(116);
+ var namespaceImport = createNode(233);
+ parseExpected(38);
+ parseExpected(117);
namespaceImport.name = parseIdentifier();
return finishNode(namespaceImport);
}
function parseNamedImportsOrExports(kind) {
var node = createNode(kind);
- node.elements = parseBracketedList(21, kind === 233 ? parseImportSpecifier : parseExportSpecifier, 15, 16);
+ node.elements = parseBracketedList(21, kind === 234 ? parseImportSpecifier : parseExportSpecifier, 16, 17);
return finishNode(node);
}
function parseExportSpecifier() {
- return parseImportOrExportSpecifier(238);
+ return parseImportOrExportSpecifier(239);
}
function parseImportSpecifier() {
- return parseImportOrExportSpecifier(234);
+ return parseImportOrExportSpecifier(235);
}
function parseImportOrExportSpecifier(kind) {
var node = createNode(kind);
@@ -14330,9 +15279,9 @@ var ts;
var checkIdentifierStart = scanner.getTokenPos();
var checkIdentifierEnd = scanner.getTextPos();
var identifierName = parseIdentifierName();
- if (token() === 116) {
+ if (token() === 117) {
node.propertyName = identifierName;
- parseExpected(116);
+ parseExpected(117);
checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
checkIdentifierStart = scanner.getTokenPos();
checkIdentifierEnd = scanner.getTextPos();
@@ -14341,23 +15290,23 @@ var ts;
else {
node.name = identifierName;
}
- if (kind === 234 && checkIdentifierIsKeyword) {
+ if (kind === 235 && checkIdentifierIsKeyword) {
parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected);
}
return finishNode(node);
}
function parseExportDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(236, fullStart);
+ var node = createNode(237, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- if (parseOptional(37)) {
- parseExpected(136);
+ if (parseOptional(38)) {
+ parseExpected(137);
node.moduleSpecifier = parseModuleSpecifier();
}
else {
- node.exportClause = parseNamedImportsOrExports(237);
- if (token() === 136 || (token() === 9 && !scanner.hasPrecedingLineBreak())) {
- parseExpected(136);
+ node.exportClause = parseNamedImportsOrExports(238);
+ if (token() === 137 || (token() === 9 && !scanner.hasPrecedingLineBreak())) {
+ parseExpected(137);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -14365,14 +15314,14 @@ var ts;
return finishNode(node);
}
function parseExportAssignment(fullStart, decorators, modifiers) {
- var node = createNode(235, fullStart);
+ var node = createNode(236, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- if (parseOptional(56)) {
+ if (parseOptional(57)) {
node.isExportEquals = true;
}
else {
- parseExpected(77);
+ parseExpected(78);
}
node.expression = parseAssignmentExpressionOrHigher();
parseSemicolon();
@@ -14444,36 +15393,72 @@ var ts;
function setExternalModuleIndicator(sourceFile) {
sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) {
return ts.hasModifier(node, 1)
- || node.kind === 229 && node.moduleReference.kind === 240
- || node.kind === 230
- || node.kind === 235
+ || node.kind === 230 && node.moduleReference.kind === 241
+ || node.kind === 231
|| node.kind === 236
+ || node.kind === 237
? node
: undefined;
});
}
+ var ParsingContext;
+ (function (ParsingContext) {
+ ParsingContext[ParsingContext["SourceElements"] = 0] = "SourceElements";
+ ParsingContext[ParsingContext["BlockStatements"] = 1] = "BlockStatements";
+ ParsingContext[ParsingContext["SwitchClauses"] = 2] = "SwitchClauses";
+ ParsingContext[ParsingContext["SwitchClauseStatements"] = 3] = "SwitchClauseStatements";
+ ParsingContext[ParsingContext["TypeMembers"] = 4] = "TypeMembers";
+ ParsingContext[ParsingContext["ClassMembers"] = 5] = "ClassMembers";
+ ParsingContext[ParsingContext["EnumMembers"] = 6] = "EnumMembers";
+ ParsingContext[ParsingContext["HeritageClauseElement"] = 7] = "HeritageClauseElement";
+ ParsingContext[ParsingContext["VariableDeclarations"] = 8] = "VariableDeclarations";
+ ParsingContext[ParsingContext["ObjectBindingElements"] = 9] = "ObjectBindingElements";
+ ParsingContext[ParsingContext["ArrayBindingElements"] = 10] = "ArrayBindingElements";
+ ParsingContext[ParsingContext["ArgumentExpressions"] = 11] = "ArgumentExpressions";
+ ParsingContext[ParsingContext["ObjectLiteralMembers"] = 12] = "ObjectLiteralMembers";
+ ParsingContext[ParsingContext["JsxAttributes"] = 13] = "JsxAttributes";
+ ParsingContext[ParsingContext["JsxChildren"] = 14] = "JsxChildren";
+ ParsingContext[ParsingContext["ArrayLiteralMembers"] = 15] = "ArrayLiteralMembers";
+ ParsingContext[ParsingContext["Parameters"] = 16] = "Parameters";
+ ParsingContext[ParsingContext["TypeParameters"] = 17] = "TypeParameters";
+ ParsingContext[ParsingContext["TypeArguments"] = 18] = "TypeArguments";
+ ParsingContext[ParsingContext["TupleElementTypes"] = 19] = "TupleElementTypes";
+ ParsingContext[ParsingContext["HeritageClauses"] = 20] = "HeritageClauses";
+ ParsingContext[ParsingContext["ImportOrExportSpecifiers"] = 21] = "ImportOrExportSpecifiers";
+ ParsingContext[ParsingContext["JSDocFunctionParameters"] = 22] = "JSDocFunctionParameters";
+ ParsingContext[ParsingContext["JSDocTypeArguments"] = 23] = "JSDocTypeArguments";
+ ParsingContext[ParsingContext["JSDocRecordMembers"] = 24] = "JSDocRecordMembers";
+ ParsingContext[ParsingContext["JSDocTupleTypes"] = 25] = "JSDocTupleTypes";
+ ParsingContext[ParsingContext["Count"] = 26] = "Count";
+ })(ParsingContext || (ParsingContext = {}));
+ var Tristate;
+ (function (Tristate) {
+ Tristate[Tristate["False"] = 0] = "False";
+ Tristate[Tristate["True"] = 1] = "True";
+ Tristate[Tristate["Unknown"] = 2] = "Unknown";
+ })(Tristate || (Tristate = {}));
var JSDocParser;
(function (JSDocParser) {
function isJSDocType() {
switch (token()) {
- case 37:
- case 53:
- case 17:
- case 19:
- case 49:
- case 15:
- case 87:
- case 22:
- case 92:
- case 97:
+ case 38:
+ case 54:
+ case 18:
+ case 20:
+ case 50:
+ case 16:
+ case 88:
+ case 23:
+ case 93:
+ case 98:
return true;
}
return ts.tokenIsIdentifierOrKeyword(token());
}
JSDocParser.isJSDocType = isJSDocType;
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState("file.js", content, 2, undefined, 1);
- sourceFile = createSourceFile("file.js", 2, 1);
+ initializeState(content, 4, undefined, 1);
+ sourceFile = createSourceFile("file.js", 4, 1);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -14484,21 +15469,21 @@ var ts;
JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
function parseJSDocTypeExpression() {
var result = createNode(257, scanner.getTokenPos());
- parseExpected(15);
- result.type = parseJSDocTopLevelType();
parseExpected(16);
+ result.type = parseJSDocTopLevelType();
+ parseExpected(17);
fixupParentReferences(result);
return finishNode(result);
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseJSDocTopLevelType() {
var type = parseJSDocType();
- if (token() === 47) {
+ if (token() === 48) {
var unionType = createNode(261, type.pos);
unionType.types = parseJSDocTypeList(type);
type = finishNode(unionType);
}
- if (token() === 56) {
+ if (token() === 57) {
var optionalType = createNode(268, type.pos);
nextToken();
optionalType.type = type;
@@ -14509,20 +15494,20 @@ var ts;
function parseJSDocType() {
var type = parseBasicTypeExpression();
while (true) {
- if (token() === 19) {
+ if (token() === 20) {
var arrayType = createNode(260, type.pos);
arrayType.elementType = type;
nextToken();
- parseExpected(20);
+ parseExpected(21);
type = finishNode(arrayType);
}
- else if (token() === 53) {
+ else if (token() === 54) {
var nullableType = createNode(263, type.pos);
nullableType.type = type;
nextToken();
type = finishNode(nullableType);
}
- else if (token() === 49) {
+ else if (token() === 50) {
var nonNullableType = createNode(264, type.pos);
nonNullableType.type = type;
nextToken();
@@ -14536,40 +15521,40 @@ var ts;
}
function parseBasicTypeExpression() {
switch (token()) {
- case 37:
+ case 38:
return parseJSDocAllType();
- case 53:
+ case 54:
return parseJSDocUnknownOrNullableType();
- case 17:
+ case 18:
return parseJSDocUnionType();
- case 19:
+ case 20:
return parseJSDocTupleType();
- case 49:
+ case 50:
return parseJSDocNonNullableType();
- case 15:
+ case 16:
return parseJSDocRecordType();
- case 87:
+ case 88:
return parseJSDocFunctionType();
- case 22:
+ case 23:
return parseJSDocVariadicType();
- case 92:
+ case 93:
return parseJSDocConstructorType();
- case 97:
+ case 98:
return parseJSDocThisType();
- case 117:
- case 132:
- case 130:
- case 120:
+ case 118:
case 133:
- case 103:
- case 93:
- case 135:
- case 127:
+ case 131:
+ case 121:
+ case 134:
+ case 104:
+ case 94:
+ case 136:
+ case 128:
return parseTokenNode();
case 9:
case 8:
- case 99:
- case 84:
+ case 100:
+ case 85:
return parseJSDocLiteralType();
}
return parseJSDocTypeReference();
@@ -14577,14 +15562,14 @@ var ts;
function parseJSDocThisType() {
var result = createNode(272);
nextToken();
- parseExpected(54);
+ parseExpected(55);
result.type = parseJSDocType();
return finishNode(result);
}
function parseJSDocConstructorType() {
var result = createNode(271);
nextToken();
- parseExpected(54);
+ parseExpected(55);
result.type = parseJSDocType();
return finishNode(result);
}
@@ -14597,33 +15582,33 @@ var ts;
function parseJSDocFunctionType() {
var result = createNode(269);
nextToken();
- parseExpected(17);
+ parseExpected(18);
result.parameters = parseDelimitedList(22, parseJSDocParameter);
checkForTrailingComma(result.parameters);
- parseExpected(18);
- if (token() === 54) {
+ parseExpected(19);
+ if (token() === 55) {
nextToken();
result.type = parseJSDocType();
}
return finishNode(result);
}
function parseJSDocParameter() {
- var parameter = createNode(142);
+ var parameter = createNode(143);
parameter.type = parseJSDocType();
- if (parseOptional(56)) {
- parameter.questionToken = createNode(56);
+ if (parseOptional(57)) {
+ parameter.questionToken = createNode(57);
}
return finishNode(parameter);
}
function parseJSDocTypeReference() {
var result = createNode(267);
result.name = parseSimplePropertyName();
- if (token() === 25) {
+ if (token() === 26) {
result.typeArguments = parseTypeArguments();
}
else {
- while (parseOptional(21)) {
- if (token() === 25) {
+ while (parseOptional(22)) {
+ if (token() === 26) {
result.typeArguments = parseTypeArguments();
break;
}
@@ -14639,7 +15624,7 @@ var ts;
var typeArguments = parseDelimitedList(23, parseJSDocType);
checkForTrailingComma(typeArguments);
checkForEmptyTypeArgumentList(typeArguments);
- parseExpected(27);
+ parseExpected(28);
return typeArguments;
}
function checkForEmptyTypeArgumentList(typeArguments) {
@@ -14650,7 +15635,7 @@ var ts;
}
}
function parseQualifiedName(left) {
- var result = createNode(139, left.pos);
+ var result = createNode(140, left.pos);
result.left = left;
result.right = parseIdentifierName();
return finishNode(result);
@@ -14671,7 +15656,7 @@ var ts;
nextToken();
result.types = parseDelimitedList(25, parseJSDocType);
checkForTrailingComma(result.types);
- parseExpected(20);
+ parseExpected(21);
return finishNode(result);
}
function checkForTrailingComma(list) {
@@ -14684,13 +15669,13 @@ var ts;
var result = createNode(261);
nextToken();
result.types = parseJSDocTypeList(parseJSDocType());
- parseExpected(18);
+ parseExpected(19);
return finishNode(result);
}
function parseJSDocTypeList(firstType) {
ts.Debug.assert(!!firstType);
var types = createNodeArray([firstType], firstType.pos);
- while (parseOptional(47)) {
+ while (parseOptional(48)) {
types.push(parseJSDocType());
}
types.end = scanner.getStartPos();
@@ -14709,12 +15694,12 @@ var ts;
function parseJSDocUnknownOrNullableType() {
var pos = scanner.getStartPos();
nextToken();
- if (token() === 24 ||
- token() === 16 ||
- token() === 18 ||
- token() === 27 ||
- token() === 56 ||
- token() === 47) {
+ if (token() === 25 ||
+ token() === 17 ||
+ token() === 19 ||
+ token() === 28 ||
+ token() === 57 ||
+ token() === 48) {
var result = createNode(259, pos);
return finishNode(result);
}
@@ -14725,7 +15710,7 @@ var ts;
}
}
function parseIsolatedJSDocComment(content, start, length) {
- initializeState("file.js", content, 2, undefined, 1);
+ initializeState(content, 4, undefined, 1);
sourceFile = { languageVariant: 0, text: content };
var jsDoc = parseJSDocCommentWorker(start, length);
var diagnostics = parseDiagnostics;
@@ -14747,6 +15732,12 @@ var ts;
return comment;
}
JSDocParser.parseJSDocComment = parseJSDocComment;
+ var JSDocState;
+ (function (JSDocState) {
+ JSDocState[JSDocState["BeginningOfLine"] = 0] = "BeginningOfLine";
+ JSDocState[JSDocState["SawAsterisk"] = 1] = "SawAsterisk";
+ JSDocState[JSDocState["SavingComments"] = 2] = "SavingComments";
+ })(JSDocState || (JSDocState = {}));
function parseJSDocCommentWorker(start, length) {
var content = sourceText;
start = start || 0;
@@ -14783,7 +15774,7 @@ var ts;
}
while (token() !== 1) {
switch (token()) {
- case 55:
+ case 56:
if (state === 0 || state === 1) {
removeTrailingNewlines(comments);
parseTag(indent);
@@ -14801,7 +15792,7 @@ var ts;
state = 0;
indent = 0;
break;
- case 37:
+ case 38:
var asterisk = scanner.getTokenText();
if (state === 1) {
state = 2;
@@ -14812,7 +15803,7 @@ var ts;
indent += asterisk.length;
}
break;
- case 69:
+ case 70:
pushComment(scanner.getTokenText());
state = 2;
break;
@@ -14869,8 +15860,8 @@ var ts;
}
}
function parseTag(indent) {
- ts.Debug.assert(token() === 55);
- var atToken = createNode(55, scanner.getTokenPos());
+ ts.Debug.assert(token() === 56);
+ var atToken = createNode(56, scanner.getTokenPos());
atToken.end = scanner.getTextPos();
nextJSDocToken();
var tagName = parseJSDocIdentifierName();
@@ -14921,7 +15912,7 @@ var ts;
comments.push(text);
indent += text.length;
}
- while (token() !== 55 && token() !== 1) {
+ while (token() !== 56 && token() !== 1) {
switch (token()) {
case 4:
if (state >= 1) {
@@ -14930,7 +15921,7 @@ var ts;
}
indent = 0;
break;
- case 55:
+ case 56:
break;
case 5:
if (state === 2) {
@@ -14944,7 +15935,7 @@ var ts;
indent += whitespace.length;
}
break;
- case 37:
+ case 38:
if (state === 0) {
state = 1;
indent += scanner.getTokenText().length;
@@ -14955,7 +15946,7 @@ var ts;
pushComment(scanner.getTokenText());
break;
}
- if (token() === 55) {
+ if (token() === 56) {
break;
}
nextJSDocToken();
@@ -14983,7 +15974,7 @@ var ts;
function tryParseTypeExpression() {
return tryParse(function () {
skipWhitespace();
- if (token() !== 15) {
+ if (token() !== 16) {
return undefined;
}
return parseJSDocTypeExpression();
@@ -14994,14 +15985,14 @@ var ts;
skipWhitespace();
var name;
var isBracketed;
- if (parseOptionalToken(19)) {
+ if (parseOptionalToken(20)) {
name = parseJSDocIdentifierName();
skipWhitespace();
isBracketed = true;
- if (parseOptionalToken(56)) {
+ if (parseOptionalToken(57)) {
parseExpression();
}
- parseExpected(20);
+ parseExpected(21);
}
else if (ts.tokenIsIdentifierOrKeyword(token())) {
name = parseJSDocIdentifierName();
@@ -15078,7 +16069,7 @@ var ts;
if (typeExpression) {
if (typeExpression.type.kind === 267) {
var jsDocTypeReference = typeExpression.type;
- if (jsDocTypeReference.name.kind === 69) {
+ if (jsDocTypeReference.name.kind === 70) {
var name_11 = jsDocTypeReference.name;
if (name_11.text === "Object") {
typedefTag.jsDocTypeLiteral = scanChildTags();
@@ -15102,7 +16093,7 @@ var ts;
while (token() !== 1 && !parentTagTerminated) {
nextJSDocToken();
switch (token()) {
- case 55:
+ case 56:
if (canParseTag) {
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
if (!parentTagTerminated) {
@@ -15116,13 +16107,13 @@ var ts;
canParseTag = true;
seenAsterisk = false;
break;
- case 37:
+ case 38:
if (seenAsterisk) {
canParseTag = false;
}
seenAsterisk = true;
break;
- case 69:
+ case 70:
canParseTag = false;
case 1:
break;
@@ -15133,8 +16124,8 @@ var ts;
}
}
function tryParseChildTag(parentTag) {
- ts.Debug.assert(token() === 55);
- var atToken = createNode(55, scanner.getStartPos());
+ ts.Debug.assert(token() === 56);
+ var atToken = createNode(56, scanner.getStartPos());
atToken.end = scanner.getTextPos();
nextJSDocToken();
var tagName = parseJSDocIdentifierName();
@@ -15172,11 +16163,11 @@ var ts;
parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var typeParameter = createNode(141, name_12.pos);
+ var typeParameter = createNode(142, name_12.pos);
typeParameter.name = name_12;
finishNode(typeParameter);
typeParameters.push(typeParameter);
- if (token() === 24) {
+ if (token() === 25) {
nextJSDocToken();
skipWhitespace();
}
@@ -15205,7 +16196,7 @@ var ts;
}
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
- var result = createNode(69, pos);
+ var result = createNode(70, pos);
result.text = content.substring(pos, end);
finishNode(result, end);
nextJSDocToken();
@@ -15276,8 +16267,8 @@ var ts;
array._children = undefined;
array.pos += delta;
array.end += delta;
- for (var _i = 0, array_8 = array; _i < array_8.length; _i++) {
- var node = array_8[_i];
+ for (var _i = 0, array_9 = array; _i < array_9.length; _i++) {
+ var node = array_9[_i];
visitNode(node);
}
}
@@ -15286,7 +16277,7 @@ var ts;
switch (node.kind) {
case 9:
case 8:
- case 69:
+ case 70:
return true;
}
return false;
@@ -15349,8 +16340,8 @@ var ts;
array.intersectsChange = true;
array._children = undefined;
adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
- for (var _i = 0, array_9 = array; _i < array_9.length; _i++) {
- var node = array_9[_i];
+ for (var _i = 0, array_10 = array; _i < array_10.length; _i++) {
+ var node = array_10[_i];
visitNode(node);
}
return;
@@ -15498,21 +16489,31 @@ var ts;
}
}
}
+ var InvalidPosition;
+ (function (InvalidPosition) {
+ InvalidPosition[InvalidPosition["Value"] = -1] = "Value";
+ })(InvalidPosition || (InvalidPosition = {}));
})(IncrementalParser || (IncrementalParser = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
+ (function (ModuleInstanceState) {
+ ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated";
+ ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated";
+ ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly";
+ })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {}));
+ var ModuleInstanceState = ts.ModuleInstanceState;
function getModuleInstanceState(node) {
- if (node.kind === 222 || node.kind === 223) {
+ if (node.kind === 223 || node.kind === 224) {
return 0;
}
else if (ts.isConstEnumDeclaration(node)) {
return 2;
}
- else if ((node.kind === 230 || node.kind === 229) && !(ts.hasModifier(node, 1))) {
+ else if ((node.kind === 231 || node.kind === 230) && !(ts.hasModifier(node, 1))) {
return 0;
}
- else if (node.kind === 226) {
+ else if (node.kind === 227) {
var state_1 = 0;
ts.forEachChild(node, function (n) {
switch (getModuleInstanceState(n)) {
@@ -15528,7 +16529,7 @@ var ts;
});
return state_1;
}
- else if (node.kind === 225) {
+ else if (node.kind === 226) {
var body = node.body;
return body ? getModuleInstanceState(body) : 1;
}
@@ -15537,6 +16538,18 @@ var ts;
}
}
ts.getModuleInstanceState = getModuleInstanceState;
+ var ContainerFlags;
+ (function (ContainerFlags) {
+ ContainerFlags[ContainerFlags["None"] = 0] = "None";
+ ContainerFlags[ContainerFlags["IsContainer"] = 1] = "IsContainer";
+ ContainerFlags[ContainerFlags["IsBlockScopedContainer"] = 2] = "IsBlockScopedContainer";
+ ContainerFlags[ContainerFlags["IsControlFlowContainer"] = 4] = "IsControlFlowContainer";
+ ContainerFlags[ContainerFlags["IsFunctionLike"] = 8] = "IsFunctionLike";
+ ContainerFlags[ContainerFlags["IsFunctionExpression"] = 16] = "IsFunctionExpression";
+ ContainerFlags[ContainerFlags["HasLocals"] = 32] = "HasLocals";
+ ContainerFlags[ContainerFlags["IsInterface"] = 64] = "IsInterface";
+ ContainerFlags[ContainerFlags["IsObjectLiteralOrClassExpressionMethod"] = 128] = "IsObjectLiteralOrClassExpressionMethod";
+ })(ContainerFlags || (ContainerFlags = {}));
var binder = createBinder();
function bindSourceFile(file, options) {
ts.performance.mark("beforeBind");
@@ -15634,7 +16647,7 @@ var ts;
if (symbolFlags & 107455) {
var valueDeclaration = symbol.valueDeclaration;
if (!valueDeclaration ||
- (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 225)) {
+ (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 226)) {
symbol.valueDeclaration = node;
}
}
@@ -15644,7 +16657,7 @@ var ts;
if (ts.isAmbientModule(node)) {
return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\"";
}
- if (node.name.kind === 140) {
+ if (node.name.kind === 141) {
var nameExpression = node.name.expression;
if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
return nameExpression.text;
@@ -15655,21 +16668,21 @@ var ts;
return node.name.text;
}
switch (node.kind) {
- case 148:
+ case 149:
return "__constructor";
- case 156:
- case 151:
- return "__call";
case 157:
case 152:
- return "__new";
+ return "__call";
+ case 158:
case 153:
+ return "__new";
+ case 154:
return "__index";
- case 236:
+ case 237:
return "__export";
- case 235:
+ case 236:
return node.isExportEquals ? "export=" : "default";
- case 187:
+ case 188:
switch (ts.getSpecialPropertyAssignmentKind(node)) {
case 2:
return "export=";
@@ -15681,12 +16694,12 @@ var ts;
}
ts.Debug.fail("Unknown binary declaration kind");
break;
- case 220:
case 221:
+ case 222:
return ts.hasModifier(node, 512) ? "default" : undefined;
case 269:
return ts.isJSDocConstructSignature(node) ? "__new" : "__call";
- case 142:
+ case 143:
ts.Debug.assert(node.parent.kind === 269);
var functionType = node.parent;
var index = ts.indexOf(functionType.parameters, node);
@@ -15694,10 +16707,10 @@ var ts;
case 279:
var parentNode = node.parent && node.parent.parent;
var nameFromParentNode = void 0;
- if (parentNode && parentNode.kind === 200) {
+ if (parentNode && parentNode.kind === 201) {
if (parentNode.declarationList.declarations.length > 0) {
var nameIdentifier = parentNode.declarationList.declarations[0].name;
- if (nameIdentifier.kind === 69) {
+ if (nameIdentifier.kind === 70) {
nameFromParentNode = nameIdentifier.text;
}
}
@@ -15738,7 +16751,7 @@ var ts;
}
else {
if (symbol.declarations && symbol.declarations.length &&
- (isDefaultExport || (node.kind === 235 && !node.isExportEquals))) {
+ (isDefaultExport || (node.kind === 236 && !node.isExportEquals))) {
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
}
}
@@ -15758,7 +16771,7 @@ var ts;
function declareModuleMember(node, symbolFlags, symbolExcludes) {
var hasExportModifier = ts.getCombinedModifierFlags(node) & 1;
if (symbolFlags & 8388608) {
- if (node.kind === 238 || (node.kind === 229 && hasExportModifier)) {
+ if (node.kind === 239 || (node.kind === 230 && hasExportModifier)) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
}
else {
@@ -15875,64 +16888,64 @@ var ts;
return;
}
switch (node.kind) {
- case 205:
+ case 206:
bindWhileStatement(node);
break;
- case 204:
+ case 205:
bindDoStatement(node);
break;
- case 206:
+ case 207:
bindForStatement(node);
break;
- case 207:
case 208:
+ case 209:
bindForInOrForOfStatement(node);
break;
- case 203:
+ case 204:
bindIfStatement(node);
break;
- case 211:
- case 215:
+ case 212:
+ case 216:
bindReturnOrThrow(node);
break;
+ case 211:
case 210:
- case 209:
bindBreakOrContinueStatement(node);
break;
- case 216:
+ case 217:
bindTryStatement(node);
break;
- case 213:
+ case 214:
bindSwitchStatement(node);
break;
- case 227:
+ case 228:
bindCaseBlock(node);
break;
case 249:
bindCaseClause(node);
break;
- case 214:
+ case 215:
bindLabeledStatement(node);
break;
- case 185:
+ case 186:
bindPrefixUnaryExpressionFlow(node);
break;
- case 186:
+ case 187:
bindPostfixUnaryExpressionFlow(node);
break;
- case 187:
+ case 188:
bindBinaryExpressionFlow(node);
break;
- case 181:
+ case 182:
bindDeleteExpressionFlow(node);
break;
- case 188:
+ case 189:
bindConditionalExpressionFlow(node);
break;
- case 218:
+ case 219:
bindVariableDeclarationFlow(node);
break;
- case 174:
+ case 175:
bindCallExpressionFlow(node);
break;
default:
@@ -15942,25 +16955,25 @@ var ts;
}
function isNarrowingExpression(expr) {
switch (expr.kind) {
- case 69:
- case 97:
- case 172:
+ case 70:
+ case 98:
+ case 173:
return isNarrowableReference(expr);
- case 174:
+ case 175:
return hasNarrowableArgument(expr);
- case 178:
+ case 179:
return isNarrowingExpression(expr.expression);
- case 187:
+ case 188:
return isNarrowingBinaryExpression(expr);
- case 185:
- return expr.operator === 49 && isNarrowingExpression(expr.operand);
+ case 186:
+ return expr.operator === 50 && isNarrowingExpression(expr.operand);
}
return false;
}
function isNarrowableReference(expr) {
- return expr.kind === 69 ||
- expr.kind === 97 ||
- expr.kind === 172 && isNarrowableReference(expr.expression);
+ return expr.kind === 70 ||
+ expr.kind === 98 ||
+ expr.kind === 173 && isNarrowableReference(expr.expression);
}
function hasNarrowableArgument(expr) {
if (expr.arguments) {
@@ -15971,41 +16984,41 @@ var ts;
}
}
}
- if (expr.expression.kind === 172 &&
+ if (expr.expression.kind === 173 &&
isNarrowableReference(expr.expression.expression)) {
return true;
}
return false;
}
function isNarrowingTypeofOperands(expr1, expr2) {
- return expr1.kind === 182 && isNarrowableOperand(expr1.expression) && expr2.kind === 9;
+ return expr1.kind === 183 && isNarrowableOperand(expr1.expression) && expr2.kind === 9;
}
function isNarrowingBinaryExpression(expr) {
switch (expr.operatorToken.kind) {
- case 56:
+ case 57:
return isNarrowableReference(expr.left);
- case 30:
case 31:
case 32:
case 33:
+ case 34:
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
- case 91:
+ case 92:
return isNarrowableOperand(expr.left);
- case 24:
+ case 25:
return isNarrowingExpression(expr.right);
}
return false;
}
function isNarrowableOperand(expr) {
switch (expr.kind) {
- case 178:
+ case 179:
return isNarrowableOperand(expr.expression);
- case 187:
+ case 188:
switch (expr.operatorToken.kind) {
- case 56:
+ case 57:
return isNarrowableOperand(expr.left);
- case 24:
+ case 25:
return isNarrowableOperand(expr.right);
}
}
@@ -16024,7 +17037,7 @@ var ts;
};
}
function setFlowNodeReferenced(flow) {
- flow.flags |= flow.flags & 256 ? 512 : 256;
+ flow.flags |= flow.flags & 512 ? 1024 : 512;
}
function addAntecedent(label, antecedent) {
if (!(antecedent.flags & 1) && !ts.contains(label.antecedents, antecedent)) {
@@ -16039,8 +17052,8 @@ var ts;
if (!expression) {
return flags & 32 ? antecedent : unreachableFlow;
}
- if (expression.kind === 99 && flags & 64 ||
- expression.kind === 84 && flags & 32) {
+ if (expression.kind === 100 && flags & 64 ||
+ expression.kind === 85 && flags & 32) {
return unreachableFlow;
}
if (!isNarrowingExpression(expression)) {
@@ -16074,6 +17087,14 @@ var ts;
node: node
};
}
+ function createFlowArrayMutation(antecedent, node) {
+ setFlowNodeReferenced(antecedent);
+ return {
+ flags: 256,
+ antecedent: antecedent,
+ node: node
+ };
+ }
function finishFlowLabel(flow) {
var antecedents = flow.antecedents;
if (!antecedents) {
@@ -16087,34 +17108,34 @@ var ts;
function isStatementCondition(node) {
var parent = node.parent;
switch (parent.kind) {
- case 203:
- case 205:
case 204:
- return parent.expression === node;
case 206:
- case 188:
+ case 205:
+ return parent.expression === node;
+ case 207:
+ case 189:
return parent.condition === node;
}
return false;
}
function isLogicalExpression(node) {
while (true) {
- if (node.kind === 178) {
+ if (node.kind === 179) {
node = node.expression;
}
- else if (node.kind === 185 && node.operator === 49) {
+ else if (node.kind === 186 && node.operator === 50) {
node = node.operand;
}
else {
- return node.kind === 187 && (node.operatorToken.kind === 51 ||
- node.operatorToken.kind === 52);
+ return node.kind === 188 && (node.operatorToken.kind === 52 ||
+ node.operatorToken.kind === 53);
}
}
}
function isTopLevelLogicalExpression(node) {
- while (node.parent.kind === 178 ||
- node.parent.kind === 185 &&
- node.parent.operator === 49) {
+ while (node.parent.kind === 179 ||
+ node.parent.kind === 186 &&
+ node.parent.operator === 50) {
node = node.parent;
}
return !isStatementCondition(node) && !isLogicalExpression(node.parent);
@@ -16187,7 +17208,7 @@ var ts;
bind(node.expression);
addAntecedent(postLoopLabel, currentFlow);
bind(node.initializer);
- if (node.initializer.kind !== 219) {
+ if (node.initializer.kind !== 220) {
bindAssignmentTargetFlow(node.initializer);
}
bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
@@ -16209,7 +17230,7 @@ var ts;
}
function bindReturnOrThrow(node) {
bind(node.expression);
- if (node.kind === 211) {
+ if (node.kind === 212) {
hasExplicitReturn = true;
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
@@ -16229,7 +17250,7 @@ var ts;
return undefined;
}
function bindbreakOrContinueFlow(node, breakTarget, continueTarget) {
- var flowLabel = node.kind === 210 ? breakTarget : continueTarget;
+ var flowLabel = node.kind === 211 ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
currentFlow = unreachableFlow;
@@ -16249,21 +17270,32 @@ var ts;
}
}
function bindTryStatement(node) {
- var postFinallyLabel = createBranchLabel();
+ var preFinallyLabel = createBranchLabel();
var preTryFlow = currentFlow;
bind(node.tryBlock);
- addAntecedent(postFinallyLabel, currentFlow);
+ addAntecedent(preFinallyLabel, currentFlow);
+ var flowAfterTry = currentFlow;
+ var flowAfterCatch = unreachableFlow;
if (node.catchClause) {
currentFlow = preTryFlow;
bind(node.catchClause);
- addAntecedent(postFinallyLabel, currentFlow);
+ addAntecedent(preFinallyLabel, currentFlow);
+ flowAfterCatch = currentFlow;
}
if (node.finallyBlock) {
- currentFlow = preTryFlow;
+ addAntecedent(preFinallyLabel, preTryFlow);
+ currentFlow = finishFlowLabel(preFinallyLabel);
bind(node.finallyBlock);
+ if (!(currentFlow.flags & 1)) {
+ if ((flowAfterTry.flags & 1) && (flowAfterCatch.flags & 1)) {
+ currentFlow = flowAfterTry === reportedUnreachableFlow || flowAfterCatch === reportedUnreachableFlow
+ ? reportedUnreachableFlow
+ : unreachableFlow;
+ }
+ }
}
- if (!node.finallyBlock || !(currentFlow.flags & 1)) {
- currentFlow = finishFlowLabel(postFinallyLabel);
+ else {
+ currentFlow = finishFlowLabel(preFinallyLabel);
}
}
function bindSwitchStatement(node) {
@@ -16340,7 +17372,7 @@ var ts;
currentFlow = finishFlowLabel(postStatementLabel);
}
function bindDestructuringTargetFlow(node) {
- if (node.kind === 187 && node.operatorToken.kind === 56) {
+ if (node.kind === 188 && node.operatorToken.kind === 57) {
bindAssignmentTargetFlow(node.left);
}
else {
@@ -16351,10 +17383,10 @@ var ts;
if (isNarrowableReference(node)) {
currentFlow = createFlowAssignment(currentFlow, node);
}
- else if (node.kind === 170) {
+ else if (node.kind === 171) {
for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
var e = _a[_i];
- if (e.kind === 191) {
+ if (e.kind === 192) {
bindAssignmentTargetFlow(e.expression);
}
else {
@@ -16362,7 +17394,7 @@ var ts;
}
}
}
- else if (node.kind === 171) {
+ else if (node.kind === 172) {
for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
var p = _c[_b];
if (p.kind === 253) {
@@ -16376,7 +17408,7 @@ var ts;
}
function bindLogicalExpression(node, trueTarget, falseTarget) {
var preRightLabel = createBranchLabel();
- if (node.operatorToken.kind === 51) {
+ if (node.operatorToken.kind === 52) {
bindCondition(node.left, preRightLabel, falseTarget);
}
else {
@@ -16387,7 +17419,7 @@ var ts;
bindCondition(node.right, trueTarget, falseTarget);
}
function bindPrefixUnaryExpressionFlow(node) {
- if (node.operator === 49) {
+ if (node.operator === 50) {
var saveTrueTarget = currentTrueTarget;
currentTrueTarget = currentFalseTarget;
currentFalseTarget = saveTrueTarget;
@@ -16397,20 +17429,20 @@ var ts;
}
else {
ts.forEachChild(node, bind);
- if (node.operator === 41 || node.operator === 42) {
+ if (node.operator === 42 || node.operator === 43) {
bindAssignmentTargetFlow(node.operand);
}
}
}
function bindPostfixUnaryExpressionFlow(node) {
ts.forEachChild(node, bind);
- if (node.operator === 41 || node.operator === 42) {
+ if (node.operator === 42 || node.operator === 43) {
bindAssignmentTargetFlow(node.operand);
}
}
function bindBinaryExpressionFlow(node) {
var operator = node.operatorToken.kind;
- if (operator === 51 || operator === 52) {
+ if (operator === 52 || operator === 53) {
if (isTopLevelLogicalExpression(node)) {
var postExpressionLabel = createBranchLabel();
bindLogicalExpression(node, postExpressionLabel, postExpressionLabel);
@@ -16422,14 +17454,20 @@ var ts;
}
else {
ts.forEachChild(node, bind);
- if (operator === 56 && !ts.isAssignmentTarget(node)) {
+ if (operator === 57 && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
+ if (node.left.kind === 174) {
+ var elementAccess = node.left;
+ if (isNarrowableOperand(elementAccess.expression)) {
+ currentFlow = createFlowArrayMutation(currentFlow, node);
+ }
+ }
}
}
}
function bindDeleteExpressionFlow(node) {
ts.forEachChild(node, bind);
- if (node.expression.kind === 172) {
+ if (node.expression.kind === 173) {
bindAssignmentTargetFlow(node.expression);
}
}
@@ -16460,16 +17498,16 @@ var ts;
}
function bindVariableDeclarationFlow(node) {
ts.forEachChild(node, bind);
- if (node.initializer || node.parent.parent.kind === 207 || node.parent.parent.kind === 208) {
+ if (node.initializer || node.parent.parent.kind === 208 || node.parent.parent.kind === 209) {
bindInitializedVariableFlow(node);
}
}
function bindCallExpressionFlow(node) {
var expr = node.expression;
- while (expr.kind === 178) {
+ while (expr.kind === 179) {
expr = expr.expression;
}
- if (expr.kind === 179 || expr.kind === 180) {
+ if (expr.kind === 180 || expr.kind === 181) {
ts.forEach(node.typeArguments, bind);
ts.forEach(node.arguments, bind);
bind(node.expression);
@@ -16477,54 +17515,60 @@ var ts;
else {
ts.forEachChild(node, bind);
}
+ if (node.expression.kind === 173) {
+ var propertyAccess = node.expression;
+ if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {
+ currentFlow = createFlowArrayMutation(currentFlow, node);
+ }
+ }
}
function getContainerFlags(node) {
switch (node.kind) {
- case 192:
- case 221:
- case 224:
- case 171:
- case 159:
+ case 193:
+ case 222:
+ case 225:
+ case 172:
+ case 160:
case 281:
case 265:
return 1;
- case 222:
+ case 223:
return 1 | 64;
case 269:
- case 225:
- case 223:
+ case 226:
+ case 224:
return 1 | 32;
case 256:
return 1 | 4 | 32;
- case 147:
+ case 148:
if (ts.isObjectLiteralOrClassExpressionMethod(node)) {
return 1 | 4 | 32 | 8 | 128;
}
- case 148:
- case 220:
- case 146:
case 149:
+ case 221:
+ case 147:
case 150:
case 151:
case 152:
case 153:
- case 156:
+ case 154:
case 157:
+ case 158:
return 1 | 4 | 32 | 8;
- case 179:
case 180:
+ case 181:
return 1 | 4 | 32 | 8 | 16;
- case 226:
+ case 227:
return 4;
- case 145:
+ case 146:
return node.initializer ? 4 : 0;
case 252:
- case 206:
case 207:
case 208:
- case 227:
+ case 209:
+ case 228:
return 2;
- case 199:
+ case 200:
return ts.isFunctionLike(node.parent) ? 0 : 2;
}
return 0;
@@ -16540,36 +17584,36 @@ var ts;
}
function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) {
switch (container.kind) {
- case 225:
+ case 226:
return declareModuleMember(node, symbolFlags, symbolExcludes);
case 256:
return declareSourceFileMember(node, symbolFlags, symbolExcludes);
- case 192:
- case 221:
+ case 193:
+ case 222:
return declareClassMember(node, symbolFlags, symbolExcludes);
- case 224:
+ case 225:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
- case 159:
- case 171:
- case 222:
+ case 160:
+ case 172:
+ case 223:
case 265:
case 281:
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
- case 156:
case 157:
- case 151:
+ case 158:
case 152:
case 153:
- case 147:
- case 146:
+ case 154:
case 148:
+ case 147:
case 149:
case 150:
- case 220:
- case 179:
+ case 151:
+ case 221:
case 180:
+ case 181:
case 269:
- case 223:
+ case 224:
return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);
}
}
@@ -16585,10 +17629,10 @@ var ts;
}
function hasExportDeclarations(node) {
var body = node.kind === 256 ? node : node.body;
- if (body && (body.kind === 256 || body.kind === 226)) {
+ if (body && (body.kind === 256 || body.kind === 227)) {
for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {
var stat = _a[_i];
- if (stat.kind === 236 || stat.kind === 235) {
+ if (stat.kind === 237 || stat.kind === 236) {
return true;
}
}
@@ -16660,15 +17704,20 @@ var ts;
typeLiteralSymbol.members[symbol.name] = symbol;
}
function bindObjectLiteralExpression(node) {
+ var ElementKind;
+ (function (ElementKind) {
+ ElementKind[ElementKind["Property"] = 1] = "Property";
+ ElementKind[ElementKind["Accessor"] = 2] = "Accessor";
+ })(ElementKind || (ElementKind = {}));
if (inStrictMode) {
var seen = ts.createMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.name.kind !== 69) {
+ if (prop.name.kind !== 70) {
continue;
}
var identifier = prop.name;
- var currentKind = prop.kind === 253 || prop.kind === 254 || prop.kind === 147
+ var currentKind = prop.kind === 253 || prop.kind === 254 || prop.kind === 148
? 1
: 2;
var existingKind = seen[identifier.text];
@@ -16690,7 +17739,7 @@ var ts;
}
function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {
switch (blockScopeContainer.kind) {
- case 225:
+ case 226:
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
case 256:
@@ -16711,8 +17760,8 @@ var ts;
}
function checkStrictModeIdentifier(node) {
if (inStrictMode &&
- node.originalKeywordKind >= 106 &&
- node.originalKeywordKind <= 114 &&
+ node.originalKeywordKind >= 107 &&
+ node.originalKeywordKind <= 115 &&
!ts.isIdentifierName(node) &&
!ts.isInAmbientContext(node)) {
if (!file.parseDiagnostics.length) {
@@ -16740,17 +17789,17 @@ var ts;
}
}
function checkStrictModeDeleteExpression(node) {
- if (inStrictMode && node.expression.kind === 69) {
+ if (inStrictMode && node.expression.kind === 70) {
var span_2 = ts.getErrorSpanForNode(file, node.expression);
file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_2.start, span_2.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode));
}
}
function isEvalOrArgumentsIdentifier(node) {
- return node.kind === 69 &&
+ return node.kind === 70 &&
(node.text === "eval" || node.text === "arguments");
}
function checkStrictModeEvalOrArguments(contextNode, name) {
- if (name && name.kind === 69) {
+ if (name && name.kind === 70) {
var identifier = name;
if (isEvalOrArgumentsIdentifier(identifier)) {
var span_3 = ts.getErrorSpanForNode(file, name);
@@ -16784,7 +17833,7 @@ var ts;
function checkStrictModeFunctionDeclaration(node) {
if (languageVersion < 2) {
if (blockScopeContainer.kind !== 256 &&
- blockScopeContainer.kind !== 225 &&
+ blockScopeContainer.kind !== 226 &&
!ts.isFunctionLike(blockScopeContainer)) {
var errorSpan = ts.getErrorSpanForNode(file, node);
file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node)));
@@ -16803,7 +17852,7 @@ var ts;
}
function checkStrictModePrefixUnaryExpression(node) {
if (inStrictMode) {
- if (node.operator === 41 || node.operator === 42) {
+ if (node.operator === 42 || node.operator === 43) {
checkStrictModeEvalOrArguments(node, node.operand);
}
}
@@ -16827,7 +17876,7 @@ var ts;
node.parent = parent;
var saveInStrictMode = inStrictMode;
bindWorker(node);
- if (node.kind > 138) {
+ if (node.kind > 139) {
var saveParent = parent;
parent = node;
var containerFlags = getContainerFlags(node);
@@ -16864,18 +17913,18 @@ var ts;
}
function bindWorker(node) {
switch (node.kind) {
- case 69:
- case 97:
+ case 70:
+ case 98:
if (currentFlow && (ts.isExpression(node) || parent.kind === 254)) {
node.flowNode = currentFlow;
}
return checkStrictModeIdentifier(node);
- case 172:
+ case 173:
if (currentFlow && isNarrowableReference(node)) {
node.flowNode = currentFlow;
}
break;
- case 187:
+ case 188:
if (ts.isInJavaScriptFile(node)) {
var specialKind = ts.getSpecialPropertyAssignmentKind(node);
switch (specialKind) {
@@ -16900,30 +17949,30 @@ var ts;
return checkStrictModeBinaryExpression(node);
case 252:
return checkStrictModeCatchClause(node);
- case 181:
+ case 182:
return checkStrictModeDeleteExpression(node);
case 8:
return checkStrictModeNumericLiteral(node);
- case 186:
+ case 187:
return checkStrictModePostfixUnaryExpression(node);
- case 185:
+ case 186:
return checkStrictModePrefixUnaryExpression(node);
- case 212:
+ case 213:
return checkStrictModeWithStatement(node);
- case 165:
+ case 166:
seenThisKeyword = true;
return;
- case 154:
+ case 155:
return checkTypePredicate(node);
- case 141:
- return declareSymbolAndAddToSymbolTable(node, 262144, 530920);
case 142:
+ return declareSymbolAndAddToSymbolTable(node, 262144, 530920);
+ case 143:
return bindParameter(node);
- case 218:
- case 169:
+ case 219:
+ case 170:
return bindVariableDeclarationOrBindingElement(node);
+ case 146:
case 145:
- case 144:
case 266:
return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0);
case 280:
@@ -16936,82 +17985,82 @@ var ts;
case 247:
emitFlags |= 16384;
return;
- case 151:
case 152:
case 153:
+ case 154:
return declareSymbolAndAddToSymbolTable(node, 131072, 0);
+ case 148:
case 147:
- case 146:
return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263);
- case 220:
+ case 221:
return bindFunctionDeclaration(node);
- case 148:
- return declareSymbolAndAddToSymbolTable(node, 16384, 0);
case 149:
- return bindPropertyOrMethodOrAccessor(node, 32768, 41919);
+ return declareSymbolAndAddToSymbolTable(node, 16384, 0);
case 150:
+ return bindPropertyOrMethodOrAccessor(node, 32768, 41919);
+ case 151:
return bindPropertyOrMethodOrAccessor(node, 65536, 74687);
- case 156:
case 157:
+ case 158:
case 269:
return bindFunctionOrConstructorType(node);
- case 159:
+ case 160:
case 281:
case 265:
return bindAnonymousDeclaration(node, 2048, "__type");
- case 171:
+ case 172:
return bindObjectLiteralExpression(node);
- case 179:
case 180:
+ case 181:
return bindFunctionExpression(node);
- case 174:
+ case 175:
if (ts.isInJavaScriptFile(node)) {
bindCallExpression(node);
}
break;
- case 192:
- case 221:
+ case 193:
+ case 222:
inStrictMode = true;
return bindClassLikeDeclaration(node);
- case 222:
+ case 223:
return bindBlockScopedDeclaration(node, 64, 792968);
case 279:
- case 223:
- return bindBlockScopedDeclaration(node, 524288, 793064);
case 224:
- return bindEnumDeclaration(node);
+ return bindBlockScopedDeclaration(node, 524288, 793064);
case 225:
+ return bindEnumDeclaration(node);
+ case 226:
return bindModuleDeclaration(node);
- case 229:
- case 232:
- case 234:
- case 238:
+ case 230:
+ case 233:
+ case 235:
+ case 239:
return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608);
- case 228:
+ case 229:
return bindNamespaceExportDeclaration(node);
- case 231:
+ case 232:
return bindImportClause(node);
- case 236:
+ case 237:
return bindExportDeclaration(node);
- case 235:
+ case 236:
return bindExportAssignment(node);
case 256:
updateStrictModeStatementList(node.statements);
return bindSourceFileIfExternalModule();
- case 199:
+ case 200:
if (!ts.isFunctionLike(node.parent)) {
return;
}
- case 226:
+ case 227:
return updateStrictModeStatementList(node.statements);
}
}
function checkTypePredicate(node) {
var parameterName = node.parameterName, type = node.type;
- if (parameterName && parameterName.kind === 69) {
+ if (parameterName && parameterName.kind === 70) {
checkStrictModeIdentifier(parameterName);
}
- if (parameterName && parameterName.kind === 165) {
+ if (parameterName && parameterName.kind === 166) {
seenThisKeyword = true;
}
bind(type);
@@ -17030,7 +18079,7 @@ var ts;
bindAnonymousDeclaration(node, 8388608, getDeclarationName(node));
}
else {
- var flags = node.kind === 235 && ts.exportAssignmentIsAlias(node)
+ var flags = node.kind === 236 && ts.exportAssignmentIsAlias(node)
? 8388608
: 4;
declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16);
@@ -17074,7 +18123,9 @@ var ts;
function setCommonJsModuleIndicator(node) {
if (!file.commonJsModuleIndicator) {
file.commonJsModuleIndicator = node;
- bindSourceFileAsExternalModule();
+ if (!file.externalModuleIndicator) {
+ bindSourceFileAsExternalModule();
+ }
}
}
function bindExportsPropertyAssignment(node) {
@@ -17087,11 +18138,11 @@ var ts;
}
function bindThisPropertyAssignment(node) {
ts.Debug.assert(ts.isInJavaScriptFile(node));
- if (container.kind === 220 || container.kind === 179) {
+ if (container.kind === 221 || container.kind === 180) {
container.symbol.members = container.symbol.members || ts.createMap();
declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4);
}
- else if (container.kind === 148) {
+ else if (container.kind === 149) {
var saveContainer = container;
container = container.parent;
var symbol = bindPropertyOrMethodOrAccessor(node, 4, 0);
@@ -17131,7 +18182,7 @@ var ts;
emitFlags |= 2048;
}
}
- if (node.kind === 221) {
+ if (node.kind === 222) {
bindBlockScopedDeclaration(node, 32, 899519);
}
else {
@@ -17249,15 +18300,15 @@ var ts;
return false;
}
if (currentFlow === unreachableFlow) {
- var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 201) ||
- node.kind === 221 ||
- (node.kind === 225 && shouldReportErrorOnModuleDeclaration(node)) ||
- (node.kind === 224 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums));
+ var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 202) ||
+ node.kind === 222 ||
+ (node.kind === 226 && shouldReportErrorOnModuleDeclaration(node)) ||
+ (node.kind === 225 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums));
if (reportError) {
currentFlow = reportedUnreachableFlow;
var reportUnreachableCode = !options.allowUnreachableCode &&
!ts.isInAmbientContext(node) &&
- (node.kind !== 200 ||
+ (node.kind !== 201 ||
ts.getCombinedNodeFlags(node.declarationList) & 3 ||
ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; }));
if (reportUnreachableCode) {
@@ -17271,52 +18322,54 @@ var ts;
function computeTransformFlagsForNode(node, subtreeFlags) {
var kind = node.kind;
switch (kind) {
- case 174:
+ case 175:
return computeCallExpression(node, subtreeFlags);
- case 225:
+ case 176:
+ return computeNewExpression(node, subtreeFlags);
+ case 226:
return computeModuleDeclaration(node, subtreeFlags);
- case 178:
+ case 179:
return computeParenthesizedExpression(node, subtreeFlags);
- case 187:
+ case 188:
return computeBinaryExpression(node, subtreeFlags);
- case 202:
+ case 203:
return computeExpressionStatement(node, subtreeFlags);
- case 142:
+ case 143:
return computeParameter(node, subtreeFlags);
- case 180:
+ case 181:
return computeArrowFunction(node, subtreeFlags);
- case 179:
+ case 180:
return computeFunctionExpression(node, subtreeFlags);
- case 220:
+ case 221:
return computeFunctionDeclaration(node, subtreeFlags);
- case 218:
- return computeVariableDeclaration(node, subtreeFlags);
case 219:
+ return computeVariableDeclaration(node, subtreeFlags);
+ case 220:
return computeVariableDeclarationList(node, subtreeFlags);
- case 200:
+ case 201:
return computeVariableStatement(node, subtreeFlags);
- case 214:
+ case 215:
return computeLabeledStatement(node, subtreeFlags);
- case 221:
+ case 222:
return computeClassDeclaration(node, subtreeFlags);
- case 192:
+ case 193:
return computeClassExpression(node, subtreeFlags);
case 251:
return computeHeritageClause(node, subtreeFlags);
- case 194:
+ case 195:
return computeExpressionWithTypeArguments(node, subtreeFlags);
- case 148:
+ case 149:
return computeConstructor(node, subtreeFlags);
- case 145:
+ case 146:
return computePropertyDeclaration(node, subtreeFlags);
- case 147:
+ case 148:
return computeMethod(node, subtreeFlags);
- case 149:
case 150:
+ case 151:
return computeAccessor(node, subtreeFlags);
- case 229:
+ case 230:
return computeImportEquals(node, subtreeFlags);
- case 172:
+ case 173:
return computePropertyAccess(node, subtreeFlags);
default:
return computeOther(node, kind, subtreeFlags);
@@ -17327,40 +18380,54 @@ var ts;
var transformFlags = subtreeFlags;
var expression = node.expression;
var expressionKind = expression.kind;
- if (subtreeFlags & 262144
+ if (node.typeArguments) {
+ transformFlags |= 3;
+ }
+ if (subtreeFlags & 1048576
|| isSuperOrSuperProperty(expression, expressionKind)) {
- transformFlags |= 192;
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~537133909;
+ return transformFlags & ~537922901;
}
function isSuperOrSuperProperty(node, kind) {
switch (kind) {
- case 95:
+ case 96:
return true;
- case 172:
case 173:
+ case 174:
var expression = node.expression;
var expressionKind = expression.kind;
- return expressionKind === 95;
+ return expressionKind === 96;
}
return false;
}
+ function computeNewExpression(node, subtreeFlags) {
+ var transformFlags = subtreeFlags;
+ if (node.typeArguments) {
+ transformFlags |= 3;
+ }
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 768;
+ }
+ node.transformFlags = transformFlags | 536870912;
+ return transformFlags & ~537922901;
+ }
function computeBinaryExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
- if (operatorTokenKind === 56
- && (leftKind === 171
- || leftKind === 170)) {
- transformFlags |= 192 | 256;
+ if (operatorTokenKind === 57
+ && (leftKind === 172
+ || leftKind === 171)) {
+ transformFlags |= 768 | 1024;
}
- else if (operatorTokenKind === 38
- || operatorTokenKind === 60) {
- transformFlags |= 48;
+ else if (operatorTokenKind === 39
+ || operatorTokenKind === 61) {
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeParameter(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -17368,35 +18435,35 @@ var ts;
var name = node.name;
var initializer = node.initializer;
var dotDotDotToken = node.dotDotDotToken;
- if (node.questionToken) {
- transformFlags |= 3;
- }
- if (subtreeFlags & 2048 || ts.isThisIdentifier(name)) {
+ if (node.questionToken
+ || node.type
+ || subtreeFlags & 8192
+ || ts.isThisIdentifier(name)) {
transformFlags |= 3;
}
if (modifierFlags & 92) {
- transformFlags |= 3 | 131072;
+ transformFlags |= 3 | 524288;
}
- if (subtreeFlags & 2097152 || initializer || dotDotDotToken) {
- transformFlags |= 192 | 65536;
+ if (subtreeFlags & 8388608 || initializer || dotDotDotToken) {
+ transformFlags |= 768 | 262144;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~538968917;
+ return transformFlags & ~545262933;
}
function computeParenthesizedExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var expression = node.expression;
var expressionKind = expression.kind;
var expressionTransformFlags = expression.transformFlags;
- if (expressionKind === 195
- || expressionKind === 177) {
+ if (expressionKind === 196
+ || expressionKind === 178) {
transformFlags |= 3;
}
- if (expressionTransformFlags & 256) {
- transformFlags |= 256;
+ if (expressionTransformFlags & 1024) {
+ transformFlags |= 1024;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeClassDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -17405,36 +18472,38 @@ var ts;
transformFlags = 3;
}
else {
- transformFlags = subtreeFlags | 192;
- if ((subtreeFlags & 137216)
- || (modifierFlags & 1)) {
+ transformFlags = subtreeFlags | 768;
+ if ((subtreeFlags & 548864)
+ || (modifierFlags & 1)
+ || node.typeParameters) {
transformFlags |= 3;
}
- if (subtreeFlags & 32768) {
- transformFlags |= 8192;
+ if (subtreeFlags & 131072) {
+ transformFlags |= 32768;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~537590613;
+ return transformFlags & ~539749717;
}
function computeClassExpression(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 192;
- if (subtreeFlags & 137216) {
+ var transformFlags = subtreeFlags | 768;
+ if (subtreeFlags & 548864
+ || node.typeParameters) {
transformFlags |= 3;
}
- if (subtreeFlags & 32768) {
- transformFlags |= 8192;
+ if (subtreeFlags & 131072) {
+ transformFlags |= 32768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~537590613;
+ return transformFlags & ~539749717;
}
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
- case 83:
- transformFlags |= 192;
+ case 84:
+ transformFlags |= 768;
break;
- case 106:
+ case 107:
transformFlags |= 3;
break;
default:
@@ -17442,135 +18511,148 @@ var ts;
break;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeExpressionWithTypeArguments(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 192;
+ var transformFlags = subtreeFlags | 768;
if (node.typeArguments) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeConstructor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- var body = node.body;
- if (body === undefined) {
+ if (ts.hasModifier(node, 2270)
+ || !node.body) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550593365;
+ return transformFlags & ~591760725;
}
function computeMethod(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 192;
- var modifierFlags = ts.getModifierFlags(node);
- var body = node.body;
- var typeParameters = node.typeParameters;
- var asteriskToken = node.asteriskToken;
- if (!body
- || typeParameters
- || (modifierFlags & (256 | 128))
- || (subtreeFlags & 2048)) {
+ var transformFlags = subtreeFlags | 768;
+ if (node.decorators
+ || ts.hasModifier(node, 2270)
+ || node.typeParameters
+ || node.type
+ || !node.body) {
transformFlags |= 3;
}
- if (asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 1536;
+ if (ts.hasModifier(node, 256)) {
+ transformFlags |= 48;
+ }
+ if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
+ transformFlags |= 6144;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550593365;
+ return transformFlags & ~591760725;
}
function computeAccessor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- var modifierFlags = ts.getModifierFlags(node);
- var body = node.body;
- if (!body
- || (modifierFlags & (256 | 128))
- || (subtreeFlags & 2048)) {
+ if (node.decorators
+ || ts.hasModifier(node, 2270)
+ || node.type
+ || !node.body) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550593365;
+ return transformFlags & ~591760725;
}
function computePropertyDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags | 3;
if (node.initializer) {
- transformFlags |= 4096;
+ transformFlags |= 16384;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeFunctionDeclaration(node, subtreeFlags) {
var transformFlags;
var modifierFlags = ts.getModifierFlags(node);
var body = node.body;
- var asteriskToken = node.asteriskToken;
if (!body || (modifierFlags & 2)) {
transformFlags = 3;
}
else {
- transformFlags = subtreeFlags | 8388608;
+ transformFlags = subtreeFlags | 33554432;
if (modifierFlags & 1) {
- transformFlags |= 3 | 192;
+ transformFlags |= 3 | 768;
}
- if (modifierFlags & 256) {
+ if (modifierFlags & 2270
+ || node.typeParameters
+ || node.type) {
transformFlags |= 3;
}
- if (subtreeFlags & 81920) {
- transformFlags |= 192;
+ if (modifierFlags & 256) {
+ transformFlags |= 48;
}
- if (asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 1536;
+ if (subtreeFlags & 327680) {
+ transformFlags |= 768;
+ }
+ if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
+ transformFlags |= 6144;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550726485;
+ return transformFlags & ~592293205;
}
function computeFunctionExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- var modifierFlags = ts.getModifierFlags(node);
- var asteriskToken = node.asteriskToken;
- if (modifierFlags & 256) {
+ if (ts.hasModifier(node, 2270)
+ || node.typeParameters
+ || node.type) {
transformFlags |= 3;
}
- if (subtreeFlags & 81920) {
- transformFlags |= 192;
+ if (ts.hasModifier(node, 256)) {
+ transformFlags |= 48;
}
- if (asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 1536;
+ if (subtreeFlags & 327680) {
+ transformFlags |= 768;
+ }
+ if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
+ transformFlags |= 6144;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550726485;
+ return transformFlags & ~592293205;
}
function computeArrowFunction(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 192;
- var modifierFlags = ts.getModifierFlags(node);
- if (modifierFlags & 256) {
+ var transformFlags = subtreeFlags | 768;
+ if (ts.hasModifier(node, 2270)
+ || node.typeParameters
+ || node.type) {
transformFlags |= 3;
}
- if (subtreeFlags & 8192) {
- transformFlags |= 16384;
+ if (ts.hasModifier(node, 256)) {
+ transformFlags |= 48;
+ }
+ if (subtreeFlags & 32768) {
+ transformFlags |= 65536;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550710101;
+ return transformFlags & ~592227669;
}
function computePropertyAccess(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var expression = node.expression;
var expressionKind = expression.kind;
- if (expressionKind === 95) {
- transformFlags |= 8192;
+ if (expressionKind === 96) {
+ transformFlags |= 32768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeVariableDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var nameKind = node.name.kind;
- if (nameKind === 167 || nameKind === 168) {
- transformFlags |= 192 | 2097152;
+ if (nameKind === 168 || nameKind === 169) {
+ transformFlags |= 768 | 8388608;
+ }
+ if (node.type) {
+ transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeVariableStatement(node, subtreeFlags) {
var transformFlags;
@@ -17582,23 +18664,23 @@ var ts;
else {
transformFlags = subtreeFlags;
if (modifierFlags & 1) {
- transformFlags |= 192 | 3;
+ transformFlags |= 768 | 3;
}
- if (declarationListTransformFlags & 2097152) {
- transformFlags |= 192;
+ if (declarationListTransformFlags & 8388608) {
+ transformFlags |= 768;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeLabeledStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (subtreeFlags & 1048576
+ if (subtreeFlags & 4194304
&& ts.isIterationStatement(node, true)) {
- transformFlags |= 192;
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeImportEquals(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -17606,15 +18688,15 @@ var ts;
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeExpressionStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (node.expression.transformFlags & 256) {
- transformFlags |= 192;
+ if (node.expression.transformFlags & 1024) {
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeModuleDeclaration(node, subtreeFlags) {
var transformFlags = 3;
@@ -17623,77 +18705,78 @@ var ts;
transformFlags |= subtreeFlags;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~546335573;
+ return transformFlags & ~574729557;
}
function computeVariableDeclarationList(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 8388608;
- if (subtreeFlags & 2097152) {
- transformFlags |= 192;
+ var transformFlags = subtreeFlags | 33554432;
+ if (subtreeFlags & 8388608) {
+ transformFlags |= 768;
}
if (node.flags & 3) {
- transformFlags |= 192 | 1048576;
+ transformFlags |= 768 | 4194304;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~538968917;
+ return transformFlags & ~545262933;
}
function computeOther(node, kind, subtreeFlags) {
var transformFlags = subtreeFlags;
- var excludeFlags = 536871765;
+ var excludeFlags = 536874325;
switch (kind) {
- case 112:
- case 110:
+ case 119:
+ case 185:
+ transformFlags |= 48;
+ break;
+ case 113:
case 111:
- case 115:
- case 122:
- case 118:
- case 74:
- case 184:
- case 224:
+ case 112:
+ case 116:
+ case 123:
+ case 75:
+ case 225:
case 255:
- case 177:
- case 195:
+ case 178:
case 196:
- case 128:
+ case 197:
+ case 129:
transformFlags |= 3;
break;
- case 241:
case 242:
case 243:
case 244:
+ case 10:
case 245:
case 246:
case 247:
case 248:
transformFlags |= 12;
break;
- case 82:
- transformFlags |= 192 | 3;
+ case 83:
+ transformFlags |= 768 | 3;
break;
- case 77:
- case 11:
+ case 78:
case 12:
case 13:
case 14:
- case 189:
- case 176:
+ case 15:
+ case 190:
+ case 177:
case 254:
- case 208:
- transformFlags |= 192;
+ case 209:
+ transformFlags |= 768;
break;
- case 190:
- transformFlags |= 192 | 4194304;
+ case 191:
+ transformFlags |= 768 | 16777216;
break;
- case 117:
- case 130:
- case 127:
- case 132:
- case 120:
+ case 118:
+ case 131:
+ case 128:
case 133:
- case 103:
- case 141:
- case 144:
- case 146:
- case 151:
+ case 121:
+ case 134:
+ case 104:
+ case 142:
+ case 145:
+ case 147:
case 152:
case 153:
case 154:
@@ -17707,68 +18790,69 @@ var ts;
case 162:
case 163:
case 164:
- case 222:
- case 223:
case 165:
+ case 223:
+ case 224:
case 166:
+ case 167:
transformFlags = 3;
excludeFlags = -3;
break;
- case 140:
- transformFlags |= 524288;
- if (subtreeFlags & 8192) {
- transformFlags |= 32768;
+ case 141:
+ transformFlags |= 2097152;
+ if (subtreeFlags & 32768) {
+ transformFlags |= 131072;
}
break;
- case 191:
- transformFlags |= 262144;
+ case 192:
+ transformFlags |= 1048576;
break;
- case 95:
- transformFlags |= 192;
+ case 96:
+ transformFlags |= 768;
break;
- case 97:
- transformFlags |= 8192;
+ case 98:
+ transformFlags |= 32768;
break;
- case 167:
case 168:
- transformFlags |= 192 | 2097152;
+ case 169:
+ transformFlags |= 768 | 8388608;
break;
- case 143:
- transformFlags |= 3 | 2048;
+ case 144:
+ transformFlags |= 3 | 8192;
break;
- case 171:
- excludeFlags = 537430869;
- if (subtreeFlags & 524288) {
- transformFlags |= 192;
+ case 172:
+ excludeFlags = 539110741;
+ if (subtreeFlags & 2097152) {
+ transformFlags |= 768;
}
- if (subtreeFlags & 32768) {
- transformFlags |= 8192;
+ if (subtreeFlags & 131072) {
+ transformFlags |= 32768;
}
break;
- case 170:
- case 175:
- excludeFlags = 537133909;
- if (subtreeFlags & 262144) {
- transformFlags |= 192;
+ case 171:
+ case 176:
+ excludeFlags = 537922901;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 768;
}
break;
- case 204:
case 205:
case 206:
case 207:
- if (subtreeFlags & 1048576) {
- transformFlags |= 192;
+ case 208:
+ if (subtreeFlags & 4194304) {
+ transformFlags |= 768;
}
break;
case 256:
- if (subtreeFlags & 16384) {
- transformFlags |= 192;
+ if (subtreeFlags & 65536) {
+ transformFlags |= 768;
}
break;
- case 211:
- case 209:
+ case 212:
case 210:
- transformFlags |= 8388608;
+ case 211:
+ transformFlags |= 33554432;
break;
}
node.transformFlags = transformFlags | 536870912;
@@ -17777,7 +18861,7 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- function trace(host, message) {
+ function trace(host) {
host.trace(ts.formatMessage.apply(undefined, arguments));
}
ts.trace = trace;
@@ -18422,6 +19506,7 @@ var ts;
var intersectionTypes = ts.createMap();
var stringLiteralTypes = ts.createMap();
var numericLiteralTypes = ts.createMap();
+ var evolvingArrayTypes = [];
var unknownSymbol = createSymbol(4 | 67108864, "unknown");
var resolvingSymbol = createSymbol(67108864, "__resolving__");
var anyType = createIntrinsicType(1, "any");
@@ -18465,6 +19550,7 @@ var ts;
var globalBooleanType;
var globalRegExpType;
var anyArrayType;
+ var autoArrayType;
var anyReadonlyArrayType;
var getGlobalTemplateStringsArrayType;
var getGlobalESSymbolType;
@@ -18505,6 +19591,66 @@ var ts;
var potentialThisCollisions = [];
var awaitedTypeStack = [];
var diagnostics = ts.createDiagnosticCollection();
+ var TypeFacts;
+ (function (TypeFacts) {
+ TypeFacts[TypeFacts["None"] = 0] = "None";
+ TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
+ TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
+ TypeFacts[TypeFacts["TypeofEQBoolean"] = 4] = "TypeofEQBoolean";
+ TypeFacts[TypeFacts["TypeofEQSymbol"] = 8] = "TypeofEQSymbol";
+ TypeFacts[TypeFacts["TypeofEQObject"] = 16] = "TypeofEQObject";
+ TypeFacts[TypeFacts["TypeofEQFunction"] = 32] = "TypeofEQFunction";
+ TypeFacts[TypeFacts["TypeofEQHostObject"] = 64] = "TypeofEQHostObject";
+ TypeFacts[TypeFacts["TypeofNEString"] = 128] = "TypeofNEString";
+ TypeFacts[TypeFacts["TypeofNENumber"] = 256] = "TypeofNENumber";
+ TypeFacts[TypeFacts["TypeofNEBoolean"] = 512] = "TypeofNEBoolean";
+ TypeFacts[TypeFacts["TypeofNESymbol"] = 1024] = "TypeofNESymbol";
+ TypeFacts[TypeFacts["TypeofNEObject"] = 2048] = "TypeofNEObject";
+ TypeFacts[TypeFacts["TypeofNEFunction"] = 4096] = "TypeofNEFunction";
+ TypeFacts[TypeFacts["TypeofNEHostObject"] = 8192] = "TypeofNEHostObject";
+ TypeFacts[TypeFacts["EQUndefined"] = 16384] = "EQUndefined";
+ TypeFacts[TypeFacts["EQNull"] = 32768] = "EQNull";
+ TypeFacts[TypeFacts["EQUndefinedOrNull"] = 65536] = "EQUndefinedOrNull";
+ TypeFacts[TypeFacts["NEUndefined"] = 131072] = "NEUndefined";
+ TypeFacts[TypeFacts["NENull"] = 262144] = "NENull";
+ TypeFacts[TypeFacts["NEUndefinedOrNull"] = 524288] = "NEUndefinedOrNull";
+ TypeFacts[TypeFacts["Truthy"] = 1048576] = "Truthy";
+ TypeFacts[TypeFacts["Falsy"] = 2097152] = "Falsy";
+ TypeFacts[TypeFacts["Discriminatable"] = 4194304] = "Discriminatable";
+ TypeFacts[TypeFacts["All"] = 8388607] = "All";
+ TypeFacts[TypeFacts["BaseStringStrictFacts"] = 933633] = "BaseStringStrictFacts";
+ TypeFacts[TypeFacts["BaseStringFacts"] = 3145473] = "BaseStringFacts";
+ TypeFacts[TypeFacts["StringStrictFacts"] = 4079361] = "StringStrictFacts";
+ TypeFacts[TypeFacts["StringFacts"] = 4194049] = "StringFacts";
+ TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 3030785] = "EmptyStringStrictFacts";
+ TypeFacts[TypeFacts["EmptyStringFacts"] = 3145473] = "EmptyStringFacts";
+ TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 1982209] = "NonEmptyStringStrictFacts";
+ TypeFacts[TypeFacts["NonEmptyStringFacts"] = 4194049] = "NonEmptyStringFacts";
+ TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 933506] = "BaseNumberStrictFacts";
+ TypeFacts[TypeFacts["BaseNumberFacts"] = 3145346] = "BaseNumberFacts";
+ TypeFacts[TypeFacts["NumberStrictFacts"] = 4079234] = "NumberStrictFacts";
+ TypeFacts[TypeFacts["NumberFacts"] = 4193922] = "NumberFacts";
+ TypeFacts[TypeFacts["ZeroStrictFacts"] = 3030658] = "ZeroStrictFacts";
+ TypeFacts[TypeFacts["ZeroFacts"] = 3145346] = "ZeroFacts";
+ TypeFacts[TypeFacts["NonZeroStrictFacts"] = 1982082] = "NonZeroStrictFacts";
+ TypeFacts[TypeFacts["NonZeroFacts"] = 4193922] = "NonZeroFacts";
+ TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 933252] = "BaseBooleanStrictFacts";
+ TypeFacts[TypeFacts["BaseBooleanFacts"] = 3145092] = "BaseBooleanFacts";
+ TypeFacts[TypeFacts["BooleanStrictFacts"] = 4078980] = "BooleanStrictFacts";
+ TypeFacts[TypeFacts["BooleanFacts"] = 4193668] = "BooleanFacts";
+ TypeFacts[TypeFacts["FalseStrictFacts"] = 3030404] = "FalseStrictFacts";
+ TypeFacts[TypeFacts["FalseFacts"] = 3145092] = "FalseFacts";
+ TypeFacts[TypeFacts["TrueStrictFacts"] = 1981828] = "TrueStrictFacts";
+ TypeFacts[TypeFacts["TrueFacts"] = 4193668] = "TrueFacts";
+ TypeFacts[TypeFacts["SymbolStrictFacts"] = 1981320] = "SymbolStrictFacts";
+ TypeFacts[TypeFacts["SymbolFacts"] = 4193160] = "SymbolFacts";
+ TypeFacts[TypeFacts["ObjectStrictFacts"] = 6166480] = "ObjectStrictFacts";
+ TypeFacts[TypeFacts["ObjectFacts"] = 8378320] = "ObjectFacts";
+ TypeFacts[TypeFacts["FunctionStrictFacts"] = 6164448] = "FunctionStrictFacts";
+ TypeFacts[TypeFacts["FunctionFacts"] = 8376288] = "FunctionFacts";
+ TypeFacts[TypeFacts["UndefinedFacts"] = 2457472] = "UndefinedFacts";
+ TypeFacts[TypeFacts["NullFacts"] = 2340752] = "NullFacts";
+ })(TypeFacts || (TypeFacts = {}));
var typeofEQFacts = ts.createMap({
"string": 1,
"number": 2,
@@ -18547,6 +19693,13 @@ var ts;
var identityRelation = ts.createMap();
var enumRelation = ts.createMap();
var _displayBuilder;
+ var TypeSystemPropertyName;
+ (function (TypeSystemPropertyName) {
+ TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
+ TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
+ })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
var builtinGlobals = ts.createMap();
builtinGlobals[undefinedSymbol.name] = undefinedSymbol;
initializeTypeChecker();
@@ -18631,7 +19784,7 @@ var ts;
target.flags |= source.flags;
if (source.valueDeclaration &&
(!target.valueDeclaration ||
- (target.valueDeclaration.kind === 225 && source.valueDeclaration.kind !== 225))) {
+ (target.valueDeclaration.kind === 226 && source.valueDeclaration.kind !== 226))) {
target.valueDeclaration = source.valueDeclaration;
}
ts.forEach(source.declarations, function (node) {
@@ -18766,24 +19919,24 @@ var ts;
return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile);
}
if (declaration.pos <= usage.pos) {
- return declaration.kind !== 218 ||
+ return declaration.kind !== 219 ||
!isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
}
return isUsedInFunctionOrNonStaticProperty(declaration, usage);
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
var container = ts.getEnclosingBlockScopeContainer(declaration);
switch (declaration.parent.parent.kind) {
- case 200:
- case 206:
- case 208:
+ case 201:
+ case 207:
+ case 209:
if (isSameScopeDescendentOf(usage, declaration, container)) {
return true;
}
break;
}
switch (declaration.parent.parent.kind) {
- case 207:
case 208:
+ case 209:
if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) {
return true;
}
@@ -18801,7 +19954,7 @@ var ts;
return true;
}
var initializerOfNonStaticProperty = current.parent &&
- current.parent.kind === 145 &&
+ current.parent.kind === 146 &&
(ts.getModifierFlags(current.parent) & 32) === 0 &&
current.parent.initializer === current;
if (initializerOfNonStaticProperty) {
@@ -18827,15 +19980,15 @@ var ts;
if (meaning & result.flags & 793064 && lastLocation.kind !== 273) {
useResult = result.flags & 262144
? lastLocation === location.type ||
- lastLocation.kind === 142 ||
- lastLocation.kind === 141
+ lastLocation.kind === 143 ||
+ lastLocation.kind === 142
: false;
}
if (meaning & 107455 && result.flags & 1) {
useResult =
- lastLocation.kind === 142 ||
+ lastLocation.kind === 143 ||
(lastLocation === location.type &&
- result.valueDeclaration.kind === 142);
+ result.valueDeclaration.kind === 143);
}
}
if (useResult) {
@@ -18851,7 +20004,7 @@ var ts;
if (!ts.isExternalOrCommonJsModule(location))
break;
isInExternalModule = true;
- case 225:
+ case 226:
var moduleExports = getSymbolOfNode(location).exports;
if (location.kind === 256 || ts.isAmbientModule(location)) {
if (result = moduleExports["default"]) {
@@ -18863,7 +20016,7 @@ var ts;
}
if (moduleExports[name] &&
moduleExports[name].flags === 8388608 &&
- ts.getDeclarationOfKind(moduleExports[name], 238)) {
+ ts.getDeclarationOfKind(moduleExports[name], 239)) {
break;
}
}
@@ -18871,13 +20024,13 @@ var ts;
break loop;
}
break;
- case 224:
+ case 225:
if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) {
break loop;
}
break;
+ case 146:
case 145:
- case 144:
if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
@@ -18887,9 +20040,9 @@ var ts;
}
}
break;
- case 221:
- case 192:
case 222:
+ case 193:
+ case 223:
if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) {
if (lastLocation && ts.getModifierFlags(lastLocation) & 32) {
error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
@@ -18897,7 +20050,7 @@ var ts;
}
break loop;
}
- if (location.kind === 192 && meaning & 32) {
+ if (location.kind === 193 && meaning & 32) {
var className = location.name;
if (className && name === className.text) {
result = location.symbol;
@@ -18905,28 +20058,28 @@ var ts;
}
}
break;
- case 140:
+ case 141:
grandparent = location.parent.parent;
- if (ts.isClassLike(grandparent) || grandparent.kind === 222) {
+ if (ts.isClassLike(grandparent) || grandparent.kind === 223) {
if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
return undefined;
}
}
break;
- case 147:
- case 146:
case 148:
+ case 147:
case 149:
case 150:
- case 220:
- case 180:
+ case 151:
+ case 221:
+ case 181:
if (meaning & 3 && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
- case 179:
+ case 180:
if (meaning & 3 && name === "arguments") {
result = argumentsSymbol;
break loop;
@@ -18939,8 +20092,8 @@ var ts;
}
}
break;
- case 143:
- if (location.parent && location.parent.kind === 142) {
+ case 144:
+ if (location.parent && location.parent.kind === 143) {
location = location.parent;
}
if (location.parent && ts.isClassElement(location.parent)) {
@@ -18982,7 +20135,7 @@ var ts;
}
if (result && isInExternalModule && (meaning & 107455) === 107455) {
var decls = result.declarations;
- if (decls && decls.length === 1 && decls[0].kind === 228) {
+ if (decls && decls.length === 1 && decls[0].kind === 229) {
error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name);
}
}
@@ -18990,7 +20143,7 @@ var ts;
return result;
}
function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {
- if ((errorLocation.kind === 69 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) {
+ if ((errorLocation.kind === 70 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) {
return false;
}
var container = ts.getThisContainer(errorLocation, true);
@@ -19028,10 +20181,10 @@ var ts;
}
function getEntityNameForExtendingInterface(node) {
switch (node.kind) {
- case 69:
- case 172:
+ case 70:
+ case 173:
return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;
- case 194:
+ case 195:
ts.Debug.assert(ts.isEntityNameExpression(node.expression));
return node.expression;
default:
@@ -19052,7 +20205,7 @@ var ts;
ts.Debug.assert((result.flags & 2) !== 0);
var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; });
ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
- if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 218), errorLocation)) {
+ if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 219), errorLocation)) {
error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name));
}
}
@@ -19069,10 +20222,10 @@ var ts;
}
function getAnyImportSyntax(node) {
if (ts.isAliasSymbolDeclaration(node)) {
- if (node.kind === 229) {
+ if (node.kind === 230) {
return node;
}
- while (node && node.kind !== 230) {
+ while (node && node.kind !== 231) {
node = node.parent;
}
return node;
@@ -19082,10 +20235,10 @@ var ts;
return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });
}
function getTargetOfImportEqualsDeclaration(node) {
- if (node.moduleReference.kind === 240) {
+ if (node.moduleReference.kind === 241) {
return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));
}
- return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node);
+ return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference);
}
function getTargetOfImportClause(node) {
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
@@ -19186,19 +20339,19 @@ var ts;
}
function getTargetOfAliasDeclaration(node) {
switch (node.kind) {
- case 229:
+ case 230:
return getTargetOfImportEqualsDeclaration(node);
- case 231:
- return getTargetOfImportClause(node);
case 232:
+ return getTargetOfImportClause(node);
+ case 233:
return getTargetOfNamespaceImport(node);
- case 234:
+ case 235:
return getTargetOfImportSpecifier(node);
- case 238:
+ case 239:
return getTargetOfExportSpecifier(node);
- case 235:
+ case 236:
return getTargetOfExportAssignment(node);
- case 228:
+ case 229:
return getTargetOfNamespaceExportDeclaration(node);
}
}
@@ -19242,10 +20395,10 @@ var ts;
links.referenced = true;
var node = getDeclarationOfAliasSymbol(symbol);
ts.Debug.assert(!!node);
- if (node.kind === 235) {
+ if (node.kind === 236) {
checkExpressionCached(node.expression);
}
- else if (node.kind === 238) {
+ else if (node.kind === 239) {
checkExpressionCached(node.propertyName || node.name);
}
else if (ts.isInternalModuleImportEqualsDeclaration(node)) {
@@ -19253,15 +20406,15 @@ var ts;
}
}
}
- function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration, dontResolveAlias) {
- if (entityName.kind === 69 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
+ function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
+ if (entityName.kind === 70 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
- if (entityName.kind === 69 || entityName.parent.kind === 139) {
+ if (entityName.kind === 70 || entityName.parent.kind === 140) {
return resolveEntityName(entityName, 1920, false, dontResolveAlias);
}
else {
- ts.Debug.assert(entityName.parent.kind === 229);
+ ts.Debug.assert(entityName.parent.kind === 230);
return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias);
}
}
@@ -19273,16 +20426,16 @@ var ts;
return undefined;
}
var symbol;
- if (name.kind === 69) {
+ if (name.kind === 70) {
var message = meaning === 1920 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
symbol = resolveName(location || name, name.text, meaning, ignoreErrors ? undefined : message, name);
if (!symbol) {
return undefined;
}
}
- else if (name.kind === 139 || name.kind === 172) {
- var left = name.kind === 139 ? name.left : name.expression;
- var right = name.kind === 139 ? name.right : name.name;
+ else if (name.kind === 140 || name.kind === 173) {
+ var left = name.kind === 140 ? name.left : name.expression;
+ var right = name.kind === 140 ? name.right : name.name;
var namespace = resolveEntityName(left, 1920, ignoreErrors, false, location);
if (!namespace || ts.nodeIsMissing(right)) {
return undefined;
@@ -19465,7 +20618,7 @@ var ts;
var members = node.members;
for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
var member = members_1[_i];
- if (member.kind === 148 && ts.nodeIsPresent(member.body)) {
+ if (member.kind === 149 && ts.nodeIsPresent(member.body)) {
return member;
}
}
@@ -19539,7 +20692,7 @@ var ts;
if (!ts.isExternalOrCommonJsModule(location_1)) {
break;
}
- case 225:
+ case 226:
if (result = callback(getSymbolOfNode(location_1).exports)) {
return result;
}
@@ -19572,7 +20725,7 @@ var ts;
return ts.forEachProperty(symbols, function (symbolFromSymbolTable) {
if (symbolFromSymbolTable.flags & 8388608
&& symbolFromSymbolTable.name !== "export="
- && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238)) {
+ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 239)) {
if (!useOnlyExternalAliasing ||
ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) {
var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
@@ -19603,7 +20756,7 @@ var ts;
if (symbolFromSymbolTable === symbol) {
return true;
}
- symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
+ symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 239)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
if (symbolFromSymbolTable.flags & meaning) {
qualify = true;
return true;
@@ -19617,10 +20770,10 @@ var ts;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
switch (declaration.kind) {
- case 145:
- case 147:
- case 149:
+ case 146:
+ case 148:
case 150:
+ case 151:
continue;
default:
return false;
@@ -19642,7 +20795,7 @@ var ts;
return {
accessibility: 1,
errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),
- errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1920) : undefined
+ errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1920) : undefined,
};
}
return hasAccessibleDeclarations;
@@ -19663,7 +20816,7 @@ var ts;
}
return {
accessibility: 1,
- errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning)
+ errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),
};
}
return { accessibility: 0 };
@@ -19710,11 +20863,11 @@ var ts;
}
function isEntityNameVisible(entityName, enclosingDeclaration) {
var meaning;
- if (entityName.parent.kind === 158 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
+ if (entityName.parent.kind === 159 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
meaning = 107455 | 1048576;
}
- else if (entityName.kind === 139 || entityName.kind === 172 ||
- entityName.parent.kind === 229) {
+ else if (entityName.kind === 140 || entityName.kind === 173 ||
+ entityName.parent.kind === 230) {
meaning = 1920;
}
else {
@@ -19806,10 +20959,10 @@ var ts;
function getTypeAliasForTypeLiteral(type) {
if (type.symbol && type.symbol.flags & 2048) {
var node = type.symbol.declarations[0].parent;
- while (node.kind === 164) {
+ while (node.kind === 165) {
node = node.parent;
}
- if (node.kind === 223) {
+ if (node.kind === 224) {
return getSymbolOfNode(node);
}
}
@@ -19817,7 +20970,7 @@ var ts;
}
function isTopLevelInExternalModuleAugmentation(node) {
return node && node.parent &&
- node.parent.kind === 226 &&
+ node.parent.kind === 227 &&
ts.isExternalModuleAugmentation(node.parent.parent);
}
function literalTypeToString(type) {
@@ -19831,10 +20984,10 @@ var ts;
return ts.declarationNameToString(declaration.name);
}
switch (declaration.kind) {
- case 192:
+ case 193:
return "(Anonymous class)";
- case 179:
case 180:
+ case 181:
return "(Anonymous function)";
}
}
@@ -19848,17 +21001,17 @@ var ts;
var firstChar = symbolName.charCodeAt(0);
var needsElementAccess = !ts.isIdentifierStart(firstChar, languageVersion);
if (needsElementAccess) {
- writePunctuation(writer, 19);
+ writePunctuation(writer, 20);
if (ts.isSingleOrDoubleQuote(firstChar)) {
writer.writeStringLiteral(symbolName);
}
else {
writer.writeSymbol(symbolName, symbol);
}
- writePunctuation(writer, 20);
+ writePunctuation(writer, 21);
}
else {
- writePunctuation(writer, 21);
+ writePunctuation(writer, 22);
writer.writeSymbol(symbolName, symbol);
}
}
@@ -19934,7 +21087,7 @@ var ts;
}
else if (type.flags & 256) {
buildSymbolDisplay(getParentOfSymbol(type.symbol), writer, enclosingDeclaration, 793064, 0, nextFlags);
- writePunctuation(writer, 21);
+ writePunctuation(writer, 22);
appendSymbolNameOnly(type.symbol, writer);
}
else if (type.flags & (32768 | 65536 | 16 | 16384)) {
@@ -19955,23 +21108,23 @@ var ts;
writer.writeStringLiteral(literalTypeToString(type));
}
else {
- writePunctuation(writer, 15);
+ writePunctuation(writer, 16);
writeSpace(writer);
- writePunctuation(writer, 22);
+ writePunctuation(writer, 23);
writeSpace(writer);
- writePunctuation(writer, 16);
+ writePunctuation(writer, 17);
}
}
function writeTypeList(types, delimiter) {
for (var i = 0; i < types.length; i++) {
if (i > 0) {
- if (delimiter !== 24) {
+ if (delimiter !== 25) {
writeSpace(writer);
}
writePunctuation(writer, delimiter);
writeSpace(writer);
}
- writeType(types[i], delimiter === 24 ? 0 : 64);
+ writeType(types[i], delimiter === 25 ? 0 : 64);
}
}
function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) {
@@ -19979,29 +21132,29 @@ var ts;
buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793064, 0, flags);
}
if (pos < end) {
- writePunctuation(writer, 25);
+ writePunctuation(writer, 26);
writeType(typeArguments[pos], 256);
pos++;
while (pos < end) {
- writePunctuation(writer, 24);
+ writePunctuation(writer, 25);
writeSpace(writer);
writeType(typeArguments[pos], 0);
pos++;
}
- writePunctuation(writer, 27);
+ writePunctuation(writer, 28);
}
}
function writeTypeReference(type, flags) {
var typeArguments = type.typeArguments || emptyArray;
if (type.target === globalArrayType && !(flags & 1)) {
writeType(typeArguments[0], 64);
- writePunctuation(writer, 19);
writePunctuation(writer, 20);
+ writePunctuation(writer, 21);
}
else if (type.target.flags & 262144) {
- writePunctuation(writer, 19);
- writeTypeList(type.typeArguments.slice(0, getTypeReferenceArity(type)), 24);
writePunctuation(writer, 20);
+ writeTypeList(type.typeArguments.slice(0, getTypeReferenceArity(type)), 25);
+ writePunctuation(writer, 21);
}
else {
var outerTypeParameters = type.target.outerTypeParameters;
@@ -20016,7 +21169,7 @@ var ts;
} while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_9);
if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {
writeSymbolTypeReference(parent_9, typeArguments, start, i, flags);
- writePunctuation(writer, 21);
+ writePunctuation(writer, 22);
}
}
}
@@ -20026,16 +21179,16 @@ var ts;
}
function writeUnionOrIntersectionType(type, flags) {
if (flags & 64) {
- writePunctuation(writer, 17);
+ writePunctuation(writer, 18);
}
if (type.flags & 524288) {
- writeTypeList(formatUnionTypes(type.types), 47);
+ writeTypeList(formatUnionTypes(type.types), 48);
}
else {
- writeTypeList(type.types, 46);
+ writeTypeList(type.types, 47);
}
if (flags & 64) {
- writePunctuation(writer, 18);
+ writePunctuation(writer, 19);
}
}
function writeAnonymousType(type, flags) {
@@ -20053,7 +21206,7 @@ var ts;
buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793064, 0, flags);
}
else {
- writeKeyword(writer, 117);
+ writeKeyword(writer, 118);
}
}
else {
@@ -20074,7 +21227,7 @@ var ts;
var isNonLocalFunctionSymbol = !!(symbol.flags & 16) &&
(symbol.parent ||
ts.forEach(symbol.declarations, function (declaration) {
- return declaration.parent.kind === 256 || declaration.parent.kind === 226;
+ return declaration.parent.kind === 256 || declaration.parent.kind === 227;
}));
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
return !!(flags & 2) ||
@@ -20083,37 +21236,37 @@ var ts;
}
}
function writeTypeOfSymbol(type, typeFormatFlags) {
- writeKeyword(writer, 101);
+ writeKeyword(writer, 102);
writeSpace(writer);
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags);
}
function writeIndexSignature(info, keyword) {
if (info) {
if (info.isReadonly) {
- writeKeyword(writer, 128);
+ writeKeyword(writer, 129);
writeSpace(writer);
}
- writePunctuation(writer, 19);
+ writePunctuation(writer, 20);
writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x");
- writePunctuation(writer, 54);
+ writePunctuation(writer, 55);
writeSpace(writer);
writeKeyword(writer, keyword);
- writePunctuation(writer, 20);
- writePunctuation(writer, 54);
+ writePunctuation(writer, 21);
+ writePunctuation(writer, 55);
writeSpace(writer);
writeType(info.type, 0);
- writePunctuation(writer, 23);
+ writePunctuation(writer, 24);
writer.writeLine();
}
}
function writePropertyWithModifiers(prop) {
if (isReadonlySymbol(prop)) {
- writeKeyword(writer, 128);
+ writeKeyword(writer, 129);
writeSpace(writer);
}
buildSymbolDisplay(prop, writer);
if (prop.flags & 536870912) {
- writePunctuation(writer, 53);
+ writePunctuation(writer, 54);
}
}
function shouldAddParenthesisAroundFunctionType(callSignature, flags) {
@@ -20131,53 +21284,53 @@ var ts;
var resolved = resolveStructuredTypeMembers(type);
if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
if (!resolved.callSignatures.length && !resolved.constructSignatures.length) {
- writePunctuation(writer, 15);
writePunctuation(writer, 16);
+ writePunctuation(writer, 17);
return;
}
if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
var parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags);
if (parenthesizeSignature) {
- writePunctuation(writer, 17);
+ writePunctuation(writer, 18);
}
buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack);
if (parenthesizeSignature) {
- writePunctuation(writer, 18);
+ writePunctuation(writer, 19);
}
return;
}
if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
if (flags & 64) {
- writePunctuation(writer, 17);
+ writePunctuation(writer, 18);
}
- writeKeyword(writer, 92);
+ writeKeyword(writer, 93);
writeSpace(writer);
buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack);
if (flags & 64) {
- writePunctuation(writer, 18);
+ writePunctuation(writer, 19);
}
return;
}
}
var saveInObjectTypeLiteral = inObjectTypeLiteral;
inObjectTypeLiteral = true;
- writePunctuation(writer, 15);
+ writePunctuation(writer, 16);
writer.writeLine();
writer.increaseIndent();
for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) {
var signature = _a[_i];
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack);
- writePunctuation(writer, 23);
+ writePunctuation(writer, 24);
writer.writeLine();
}
for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) {
var signature = _c[_b];
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, 1, symbolStack);
- writePunctuation(writer, 23);
+ writePunctuation(writer, 24);
writer.writeLine();
}
- writeIndexSignature(resolved.stringIndexInfo, 132);
- writeIndexSignature(resolved.numberIndexInfo, 130);
+ writeIndexSignature(resolved.stringIndexInfo, 133);
+ writeIndexSignature(resolved.numberIndexInfo, 131);
for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) {
var p = _e[_d];
var t = getTypeOfSymbol(p);
@@ -20187,21 +21340,21 @@ var ts;
var signature = signatures_1[_f];
writePropertyWithModifiers(p);
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack);
- writePunctuation(writer, 23);
+ writePunctuation(writer, 24);
writer.writeLine();
}
}
else {
writePropertyWithModifiers(p);
- writePunctuation(writer, 54);
+ writePunctuation(writer, 55);
writeSpace(writer);
writeType(t, 0);
- writePunctuation(writer, 23);
+ writePunctuation(writer, 24);
writer.writeLine();
}
}
writer.decreaseIndent();
- writePunctuation(writer, 16);
+ writePunctuation(writer, 17);
inObjectTypeLiteral = saveInObjectTypeLiteral;
}
}
@@ -20216,7 +21369,7 @@ var ts;
var constraint = getConstraintOfTypeParameter(tp);
if (constraint) {
writeSpace(writer);
- writeKeyword(writer, 83);
+ writeKeyword(writer, 84);
writeSpace(writer);
buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack);
}
@@ -20224,7 +21377,7 @@ var ts;
function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) {
var parameterNode = p.valueDeclaration;
if (ts.isRestParameter(parameterNode)) {
- writePunctuation(writer, 22);
+ writePunctuation(writer, 23);
}
if (ts.isBindingPattern(parameterNode.name)) {
buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack);
@@ -20233,36 +21386,36 @@ var ts;
appendSymbolNameOnly(p, writer);
}
if (isOptionalParameter(parameterNode)) {
- writePunctuation(writer, 53);
+ writePunctuation(writer, 54);
}
- writePunctuation(writer, 54);
+ writePunctuation(writer, 55);
writeSpace(writer);
buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack);
}
function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) {
- if (bindingPattern.kind === 167) {
- writePunctuation(writer, 15);
- buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });
+ if (bindingPattern.kind === 168) {
writePunctuation(writer, 16);
+ buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });
+ writePunctuation(writer, 17);
}
- else if (bindingPattern.kind === 168) {
- writePunctuation(writer, 19);
+ else if (bindingPattern.kind === 169) {
+ writePunctuation(writer, 20);
var elements = bindingPattern.elements;
buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });
if (elements && elements.hasTrailingComma) {
- writePunctuation(writer, 24);
+ writePunctuation(writer, 25);
}
- writePunctuation(writer, 20);
+ writePunctuation(writer, 21);
}
}
function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) {
if (ts.isOmittedExpression(bindingElement)) {
return;
}
- ts.Debug.assert(bindingElement.kind === 169);
+ ts.Debug.assert(bindingElement.kind === 170);
if (bindingElement.propertyName) {
writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol);
- writePunctuation(writer, 54);
+ writePunctuation(writer, 55);
writeSpace(writer);
}
if (ts.isBindingPattern(bindingElement.name)) {
@@ -20270,75 +21423,75 @@ var ts;
}
else {
if (bindingElement.dotDotDotToken) {
- writePunctuation(writer, 22);
+ writePunctuation(writer, 23);
}
appendSymbolNameOnly(bindingElement.symbol, writer);
}
}
function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) {
if (typeParameters && typeParameters.length) {
- writePunctuation(writer, 25);
+ writePunctuation(writer, 26);
buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); });
- writePunctuation(writer, 27);
+ writePunctuation(writer, 28);
}
}
function buildDisplayForCommaSeparatedList(list, writer, action) {
for (var i = 0; i < list.length; i++) {
if (i > 0) {
- writePunctuation(writer, 24);
+ writePunctuation(writer, 25);
writeSpace(writer);
}
action(list[i]);
}
}
- function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) {
+ function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration) {
if (typeParameters && typeParameters.length) {
- writePunctuation(writer, 25);
- var flags_1 = 256;
+ writePunctuation(writer, 26);
+ var flags = 256;
for (var i = 0; i < typeParameters.length; i++) {
if (i > 0) {
- writePunctuation(writer, 24);
+ writePunctuation(writer, 25);
writeSpace(writer);
- flags_1 = 0;
+ flags = 0;
}
- buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags_1);
+ buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags);
}
- writePunctuation(writer, 27);
+ writePunctuation(writer, 28);
}
}
function buildDisplayForParametersAndDelimiters(thisParameter, parameters, writer, enclosingDeclaration, flags, symbolStack) {
- writePunctuation(writer, 17);
+ writePunctuation(writer, 18);
if (thisParameter) {
buildParameterDisplay(thisParameter, writer, enclosingDeclaration, flags, symbolStack);
}
for (var i = 0; i < parameters.length; i++) {
if (i > 0 || thisParameter) {
- writePunctuation(writer, 24);
+ writePunctuation(writer, 25);
writeSpace(writer);
}
buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, symbolStack);
}
- writePunctuation(writer, 18);
+ writePunctuation(writer, 19);
}
function buildTypePredicateDisplay(predicate, writer, enclosingDeclaration, flags, symbolStack) {
if (ts.isIdentifierTypePredicate(predicate)) {
writer.writeParameter(predicate.parameterName);
}
else {
- writeKeyword(writer, 97);
+ writeKeyword(writer, 98);
}
writeSpace(writer);
- writeKeyword(writer, 124);
+ writeKeyword(writer, 125);
writeSpace(writer);
buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack);
}
function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) {
if (flags & 8) {
writeSpace(writer);
- writePunctuation(writer, 34);
+ writePunctuation(writer, 35);
}
else {
- writePunctuation(writer, 54);
+ writePunctuation(writer, 55);
}
writeSpace(writer);
if (signature.typePredicate) {
@@ -20351,7 +21504,7 @@ var ts;
}
function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind, symbolStack) {
if (kind === 1) {
- writeKeyword(writer, 92);
+ writeKeyword(writer, 93);
writeSpace(writer);
}
if (signature.target && (flags & 32)) {
@@ -20387,63 +21540,63 @@ var ts;
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 169:
+ case 170:
return isDeclarationVisible(node.parent.parent);
- case 218:
+ case 219:
if (ts.isBindingPattern(node.name) &&
!node.name.elements.length) {
return false;
}
- case 225:
- case 221:
+ case 226:
case 222:
case 223:
- case 220:
case 224:
- case 229:
+ case 221:
+ case 225:
+ case 230:
if (ts.isExternalModuleAugmentation(node)) {
return true;
}
var parent_10 = getDeclarationContainer(node);
if (!(ts.getCombinedModifierFlags(node) & 1) &&
- !(node.kind !== 229 && parent_10.kind !== 256 && ts.isInAmbientContext(parent_10))) {
+ !(node.kind !== 230 && parent_10.kind !== 256 && ts.isInAmbientContext(parent_10))) {
return isGlobalSourceFile(parent_10);
}
return isDeclarationVisible(parent_10);
+ case 146:
case 145:
- case 144:
- case 149:
case 150:
+ case 151:
+ case 148:
case 147:
- case 146:
if (ts.getModifierFlags(node) & (8 | 16)) {
return false;
}
- case 148:
- case 152:
- case 151:
+ case 149:
case 153:
- case 142:
- case 226:
- case 156:
+ case 152:
+ case 154:
+ case 143:
+ case 227:
case 157:
- case 159:
- case 155:
+ case 158:
case 160:
+ case 156:
case 161:
case 162:
case 163:
case 164:
+ case 165:
return isDeclarationVisible(node.parent);
- case 231:
case 232:
- case 234:
+ case 233:
+ case 235:
return false;
- case 141:
+ case 142:
case 256:
- case 228:
+ case 229:
return true;
- case 235:
+ case 236:
return false;
default:
return false;
@@ -20452,10 +21605,10 @@ var ts;
}
function collectLinkedAliases(node) {
var exportSymbol;
- if (node.parent && node.parent.kind === 235) {
+ if (node.parent && node.parent.kind === 236) {
exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node);
}
- else if (node.parent.kind === 238) {
+ else if (node.parent.kind === 239) {
var exportSpecifier = node.parent;
exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ?
getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) :
@@ -20534,12 +21687,12 @@ var ts;
node = ts.getRootDeclaration(node);
while (node) {
switch (node.kind) {
- case 218:
case 219:
+ case 220:
+ case 235:
case 234:
case 233:
case 232:
- case 231:
node = node.parent;
break;
default:
@@ -20567,12 +21720,12 @@ var ts;
}
function getTextOfPropertyName(name) {
switch (name.kind) {
- case 69:
+ case 70:
return name.text;
case 9:
case 8:
return name.text;
- case 140:
+ case 141:
if (ts.isStringOrNumericLiteral(name.expression.kind)) {
return name.expression.text;
}
@@ -20580,7 +21733,7 @@ var ts;
return undefined;
}
function isComputedNonLiteralName(name) {
- return name.kind === 140 && !ts.isStringOrNumericLiteral(name.expression.kind);
+ return name.kind === 141 && !ts.isStringOrNumericLiteral(name.expression.kind);
}
function getTypeForBindingElement(declaration) {
var pattern = declaration.parent;
@@ -20595,7 +21748,7 @@ var ts;
return parentType;
}
var type;
- if (pattern.kind === 167) {
+ if (pattern.kind === 168) {
var name_14 = declaration.propertyName || declaration.name;
if (isComputedNonLiteralName(name_14)) {
return anyType;
@@ -20651,15 +21804,15 @@ var ts;
if (typeTag && typeTag.typeExpression) {
return typeTag.typeExpression.type;
}
- if (declaration.kind === 218 &&
- declaration.parent.kind === 219 &&
- declaration.parent.parent.kind === 200) {
+ if (declaration.kind === 219 &&
+ declaration.parent.kind === 220 &&
+ declaration.parent.parent.kind === 201) {
var annotation = ts.getJSDocTypeTag(declaration.parent.parent);
if (annotation && annotation.typeExpression) {
return annotation.typeExpression.type;
}
}
- else if (declaration.kind === 142) {
+ else if (declaration.kind === 143) {
var paramTag = ts.getCorrespondingJSDocParameterTag(declaration);
if (paramTag && paramTag.typeExpression) {
return paramTag.typeExpression.type;
@@ -20667,9 +21820,13 @@ var ts;
}
return undefined;
}
- function isAutoVariableInitializer(initializer) {
- var expr = initializer && ts.skipParentheses(initializer);
- return !expr || expr.kind === 93 || expr.kind === 69 && getResolvedSymbol(expr) === undefinedSymbol;
+ function isNullOrUndefined(node) {
+ var expr = ts.skipParentheses(node);
+ return expr.kind === 94 || expr.kind === 70 && getResolvedSymbol(expr) === undefinedSymbol;
+ }
+ function isEmptyArrayLiteral(node) {
+ var expr = ts.skipParentheses(node);
+ return expr.kind === 171 && expr.elements.length === 0;
}
function addOptionality(type, optional) {
return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type;
@@ -20681,10 +21838,10 @@ var ts;
return type;
}
}
- if (declaration.parent.parent.kind === 207) {
+ if (declaration.parent.parent.kind === 208) {
return stringType;
}
- if (declaration.parent.parent.kind === 208) {
+ if (declaration.parent.parent.kind === 209) {
return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType;
}
if (ts.isBindingPattern(declaration.parent)) {
@@ -20693,15 +21850,19 @@ var ts;
if (declaration.type) {
return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality);
}
- if (declaration.kind === 218 && !ts.isBindingPattern(declaration.name) &&
- !(ts.getCombinedNodeFlags(declaration) & 2) && !(ts.getCombinedModifierFlags(declaration) & 1) &&
- !ts.isInAmbientContext(declaration) && isAutoVariableInitializer(declaration.initializer)) {
- return autoType;
+ if (declaration.kind === 219 && !ts.isBindingPattern(declaration.name) &&
+ !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) {
+ if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
+ return autoType;
+ }
+ if (declaration.initializer && isEmptyArrayLiteral(declaration.initializer)) {
+ return autoArrayType;
+ }
}
- if (declaration.kind === 142) {
+ if (declaration.kind === 143) {
var func = declaration.parent;
- if (func.kind === 150 && !ts.hasDynamicName(func)) {
- var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 149);
+ if (func.kind === 151 && !ts.hasDynamicName(func)) {
+ var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 150);
if (getter) {
var getterSignature = getSignatureFromDeclaration(getter);
var thisParameter = getAccessorThisParameter(func);
@@ -20714,8 +21875,7 @@ var ts;
}
var type = void 0;
if (declaration.symbol.name === "this") {
- var thisParameter = getContextualThisParameter(func);
- type = thisParameter ? getTypeOfSymbol(thisParameter) : undefined;
+ type = getContextualThisParameterType(func);
}
else {
type = getContextuallyTypedParameterType(declaration);
@@ -20788,7 +21948,7 @@ var ts;
return result;
}
function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {
- return pattern.kind === 167
+ return pattern.kind === 168
? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
}
@@ -20813,7 +21973,7 @@ var ts;
}
function declarationBelongsToPrivateAmbientMember(declaration) {
var root = ts.getRootDeclaration(declaration);
- var memberDeclaration = root.kind === 142 ? root.parent : root;
+ var memberDeclaration = root.kind === 143 ? root.parent : root;
return isPrivateWithinAmbient(memberDeclaration);
}
function getTypeOfVariableOrParameterOrProperty(symbol) {
@@ -20826,7 +21986,7 @@ var ts;
if (declaration.parent.kind === 252) {
return links.type = anyType;
}
- if (declaration.kind === 235) {
+ if (declaration.kind === 236) {
return links.type = checkExpression(declaration.expression);
}
if (declaration.flags & 1048576 && declaration.kind === 280 && declaration.typeExpression) {
@@ -20836,15 +21996,15 @@ var ts;
return unknownType;
}
var type = void 0;
- if (declaration.kind === 187 ||
- declaration.kind === 172 && declaration.parent.kind === 187) {
+ if (declaration.kind === 188 ||
+ declaration.kind === 173 && declaration.parent.kind === 188) {
if (declaration.flags & 1048576) {
var typeTag = ts.getJSDocTypeTag(declaration.parent);
if (typeTag && typeTag.typeExpression) {
return links.type = getTypeFromTypeNode(typeTag.typeExpression.type);
}
}
- var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 187 ?
+ var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 188 ?
checkExpressionCached(decl.right) :
checkExpressionCached(decl.parent.right); });
type = getUnionType(declaredTypes, true);
@@ -20870,7 +22030,7 @@ var ts;
}
function getAnnotatedAccessorType(accessor) {
if (accessor) {
- if (accessor.kind === 149) {
+ if (accessor.kind === 150) {
return accessor.type && getTypeFromTypeNode(accessor.type);
}
else {
@@ -20890,8 +22050,8 @@ var ts;
function getTypeOfAccessors(symbol) {
var links = getSymbolLinks(symbol);
if (!links.type) {
- var getter = ts.getDeclarationOfKind(symbol, 149);
- var setter = ts.getDeclarationOfKind(symbol, 150);
+ var getter = ts.getDeclarationOfKind(symbol, 150);
+ var setter = ts.getDeclarationOfKind(symbol, 151);
if (getter && getter.flags & 1048576) {
var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter);
if (jsDocType) {
@@ -20932,7 +22092,7 @@ var ts;
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
- var getter_1 = ts.getDeclarationOfKind(symbol, 149);
+ var getter_1 = ts.getDeclarationOfKind(symbol, 150);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
@@ -20943,7 +22103,7 @@ var ts;
function getTypeOfFuncClassEnumModule(symbol) {
var links = getSymbolLinks(symbol);
if (!links.type) {
- if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModuleSymbol(symbol)) {
+ if (symbol.valueDeclaration.kind === 226 && ts.isShorthandAmbientModuleSymbol(symbol)) {
links.type = anyType;
}
else {
@@ -21028,9 +22188,9 @@ var ts;
if (!node) {
return typeParameters;
}
- if (node.kind === 221 || node.kind === 192 ||
- node.kind === 220 || node.kind === 179 ||
- node.kind === 147 || node.kind === 180) {
+ if (node.kind === 222 || node.kind === 193 ||
+ node.kind === 221 || node.kind === 180 ||
+ node.kind === 148 || node.kind === 181) {
var declarations = node.typeParameters;
if (declarations) {
return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations);
@@ -21039,15 +22199,15 @@ var ts;
}
}
function getOuterTypeParametersOfClassOrInterface(symbol) {
- var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 222);
+ var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 223);
return appendOuterTypeParameters(undefined, declaration);
}
function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) {
var result;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var node = _a[_i];
- if (node.kind === 222 || node.kind === 221 ||
- node.kind === 192 || node.kind === 223) {
+ if (node.kind === 223 || node.kind === 222 ||
+ node.kind === 193 || node.kind === 224) {
var declaration = node;
if (declaration.typeParameters) {
result = appendTypeParameters(result, declaration.typeParameters);
@@ -21173,7 +22333,7 @@ var ts;
type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;
for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 222 && ts.getInterfaceBaseTypeNodes(declaration)) {
+ if (declaration.kind === 223 && ts.getInterfaceBaseTypeNodes(declaration)) {
for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {
var node = _c[_b];
var baseType = getTypeFromTypeNode(node);
@@ -21202,7 +22362,7 @@ var ts;
function isIndependentInterface(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 222) {
+ if (declaration.kind === 223) {
if (declaration.flags & 64) {
return false;
}
@@ -21264,7 +22424,7 @@ var ts;
}
}
else {
- declaration = ts.getDeclarationOfKind(symbol, 223);
+ declaration = ts.getDeclarationOfKind(symbol, 224);
type = getTypeFromTypeNode(declaration.type, symbol, typeParameters);
}
if (popTypeResolution()) {
@@ -21288,14 +22448,14 @@ var ts;
return !ts.isInAmbientContext(member);
}
return expr.kind === 8 ||
- expr.kind === 185 && expr.operator === 36 &&
+ expr.kind === 186 && expr.operator === 37 &&
expr.operand.kind === 8 ||
- expr.kind === 69 && !!symbol.exports[expr.text];
+ expr.kind === 70 && !!symbol.exports[expr.text];
}
function enumHasLiteralMembers(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 224) {
+ if (declaration.kind === 225) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
if (!isLiteralEnumMember(symbol, member)) {
@@ -21323,7 +22483,7 @@ var ts;
var memberTypes = ts.createMap();
for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 224) {
+ if (declaration.kind === 225) {
computeEnumMemberValues(declaration);
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
@@ -21361,7 +22521,7 @@ var ts;
if (!links.declaredType) {
var type = createType(16384);
type.symbol = symbol;
- if (!ts.getDeclarationOfKind(symbol, 141).constraint) {
+ if (!ts.getDeclarationOfKind(symbol, 142).constraint) {
type.constraint = noConstraintType;
}
links.declaredType = type;
@@ -21410,20 +22570,20 @@ var ts;
}
function isIndependentType(node) {
switch (node.kind) {
- case 117:
- case 132:
- case 130:
- case 120:
+ case 118:
case 133:
- case 103:
- case 135:
- case 93:
- case 127:
- case 166:
+ case 131:
+ case 121:
+ case 134:
+ case 104:
+ case 136:
+ case 94:
+ case 128:
+ case 167:
return true;
- case 160:
+ case 161:
return isIndependentType(node.elementType);
- case 155:
+ case 156:
return isIndependentTypeReference(node);
}
return false;
@@ -21432,7 +22592,7 @@ var ts;
return node.type && isIndependentType(node.type) || !node.type && !node.initializer;
}
function isIndependentFunctionLikeDeclaration(node) {
- if (node.kind !== 148 && (!node.type || !isIndependentType(node.type))) {
+ if (node.kind !== 149 && (!node.type || !isIndependentType(node.type))) {
return false;
}
for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
@@ -21448,12 +22608,12 @@ var ts;
var declaration = symbol.declarations[0];
if (declaration) {
switch (declaration.kind) {
+ case 146:
case 145:
- case 144:
return isIndependentVariableLikeDeclaration(declaration);
- case 147:
- case 146:
case 148:
+ case 147:
+ case 149:
return isIndependentFunctionLikeDeclaration(declaration);
}
}
@@ -22019,7 +23179,7 @@ var ts;
return false;
}
function createTypePredicateFromTypePredicateNode(node) {
- if (node.parameterName.kind === 69) {
+ if (node.parameterName.kind === 70) {
var parameterName = node.parameterName;
return {
kind: 1,
@@ -22058,7 +23218,7 @@ var ts;
else {
parameters.push(paramSymbol);
}
- if (param.type && param.type.kind === 166) {
+ if (param.type && param.type.kind === 167) {
hasLiteralTypes = true;
}
if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) {
@@ -22070,10 +23230,10 @@ var ts;
minArgumentCount = -1;
}
}
- if ((declaration.kind === 149 || declaration.kind === 150) &&
+ if ((declaration.kind === 150 || declaration.kind === 151) &&
!ts.hasDynamicName(declaration) &&
(!hasThisParameter || !thisParameter)) {
- var otherKind = declaration.kind === 149 ? 150 : 149;
+ var otherKind = declaration.kind === 150 ? 151 : 150;
var other = ts.getDeclarationOfKind(declaration.symbol, otherKind);
if (other) {
thisParameter = getAnnotatedAccessorThisParameter(other);
@@ -22085,24 +23245,21 @@ var ts;
if (isJSConstructSignature) {
minArgumentCount--;
}
- if (!thisParameter && ts.isObjectLiteralMethod(declaration)) {
- thisParameter = getContextualThisParameter(declaration);
- }
- var classType = declaration.kind === 148 ?
+ var classType = declaration.kind === 149 ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
: undefined;
var typeParameters = classType ? classType.localTypeParameters :
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) :
getTypeParametersFromJSDocTemplate(declaration);
- var returnType = getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType);
- var typePredicate = declaration.type && declaration.type.kind === 154 ?
+ var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType);
+ var typePredicate = declaration.type && declaration.type.kind === 155 ?
createTypePredicateFromTypePredicateNode(declaration.type) :
undefined;
links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes);
}
return links.resolvedSignature;
}
- function getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType) {
+ function getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType) {
if (isJSConstructSignature) {
return getTypeFromTypeNode(declaration.parameters[0].type);
}
@@ -22118,8 +23275,8 @@ var ts;
return type;
}
}
- if (declaration.kind === 149 && !ts.hasDynamicName(declaration)) {
- var setter = ts.getDeclarationOfKind(declaration.symbol, 150);
+ if (declaration.kind === 150 && !ts.hasDynamicName(declaration)) {
+ var setter = ts.getDeclarationOfKind(declaration.symbol, 151);
return getAnnotatedAccessorType(setter);
}
if (ts.nodeIsMissing(declaration.body)) {
@@ -22133,19 +23290,19 @@ var ts;
for (var i = 0, len = symbol.declarations.length; i < len; i++) {
var node = symbol.declarations[i];
switch (node.kind) {
- case 156:
case 157:
- case 220:
- case 147:
- case 146:
+ case 158:
+ case 221:
case 148:
- case 151:
+ case 147:
+ case 149:
case 152:
case 153:
- case 149:
+ case 154:
case 150:
- case 179:
+ case 151:
case 180:
+ case 181:
case 269:
if (i > 0 && node.body) {
var previous = symbol.declarations[i - 1];
@@ -22226,7 +23383,7 @@ var ts;
}
function getOrCreateTypeFromSignature(signature) {
if (!signature.isolatedSignatureType) {
- var isConstructor = signature.declaration.kind === 148 || signature.declaration.kind === 152;
+ var isConstructor = signature.declaration.kind === 149 || signature.declaration.kind === 153;
var type = createObjectType(2097152);
type.members = emptySymbols;
type.properties = emptyArray;
@@ -22240,7 +23397,7 @@ var ts;
return symbol.members["__index"];
}
function getIndexDeclarationOfSymbol(symbol, kind) {
- var syntaxKind = kind === 1 ? 130 : 132;
+ var syntaxKind = kind === 1 ? 131 : 133;
var indexSymbol = getIndexSymbol(symbol);
if (indexSymbol) {
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
@@ -22267,7 +23424,7 @@ var ts;
return undefined;
}
function getConstraintDeclaration(type) {
- return ts.getDeclarationOfKind(type.symbol, 141).constraint;
+ return ts.getDeclarationOfKind(type.symbol, 142).constraint;
}
function hasConstraintReferenceTo(type, target) {
var checked;
@@ -22300,7 +23457,7 @@ var ts;
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
}
function getParentSymbolOfTypeParameter(typeParameter) {
- return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 141).parent);
+ return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 142).parent);
}
function getTypeListId(types) {
var result = "";
@@ -22400,11 +23557,11 @@ var ts;
}
function getTypeReferenceName(node) {
switch (node.kind) {
- case 155:
+ case 156:
return node.typeName;
case 267:
return node.name;
- case 194:
+ case 195:
var expr = node.expression;
if (ts.isEntityNameExpression(expr)) {
return expr;
@@ -22412,7 +23569,7 @@ var ts;
}
return undefined;
}
- function resolveTypeReferenceName(node, typeReferenceName) {
+ function resolveTypeReferenceName(typeReferenceName) {
if (!typeReferenceName) {
return unknownSymbol;
}
@@ -22440,11 +23597,11 @@ var ts;
var type = void 0;
if (node.kind === 267) {
var typeReferenceName = getTypeReferenceName(node);
- symbol = resolveTypeReferenceName(node, typeReferenceName);
+ symbol = resolveTypeReferenceName(typeReferenceName);
type = getTypeReferenceType(node, symbol);
}
else {
- var typeNameOrExpression = node.kind === 155
+ var typeNameOrExpression = node.kind === 156
? node.typeName
: ts.isEntityNameExpression(node.expression)
? node.expression
@@ -22473,9 +23630,9 @@ var ts;
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
switch (declaration.kind) {
- case 221:
case 222:
- case 224:
+ case 223:
+ case 225:
return declaration;
}
}
@@ -22850,9 +24007,9 @@ var ts;
function getThisType(node) {
var container = ts.getThisContainer(node, false);
var parent = container && container.parent;
- if (parent && (ts.isClassLike(parent) || parent.kind === 222)) {
+ if (parent && (ts.isClassLike(parent) || parent.kind === 223)) {
if (!(ts.getModifierFlags(container) & 32) &&
- (container.kind !== 148 || ts.isNodeDescendantOf(node, container.body))) {
+ (container.kind !== 149 || ts.isNodeDescendantOf(node, container.body))) {
return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
}
}
@@ -22871,25 +24028,25 @@ var ts;
}
function getTypeFromTypeNode(node, aliasSymbol, aliasTypeArguments) {
switch (node.kind) {
- case 117:
+ case 118:
case 258:
case 259:
return anyType;
- case 132:
+ case 133:
return stringType;
- case 130:
+ case 131:
return numberType;
- case 120:
+ case 121:
return booleanType;
- case 133:
+ case 134:
return esSymbolType;
- case 103:
+ case 104:
return voidType;
- case 135:
+ case 136:
return undefinedType;
- case 93:
+ case 94:
return nullType;
- case 127:
+ case 128:
return neverType;
case 283:
return nullType;
@@ -22897,33 +24054,33 @@ var ts;
return undefinedType;
case 285:
return neverType;
- case 165:
- case 97:
- return getTypeFromThisTypeNode(node);
case 166:
+ case 98:
+ return getTypeFromThisTypeNode(node);
+ case 167:
return getTypeFromLiteralTypeNode(node);
case 282:
return getTypeFromLiteralTypeNode(node.literal);
- case 155:
+ case 156:
case 267:
return getTypeFromTypeReference(node);
- case 154:
+ case 155:
return booleanType;
- case 194:
+ case 195:
return getTypeFromTypeReference(node);
- case 158:
+ case 159:
return getTypeFromTypeQueryNode(node);
- case 160:
+ case 161:
case 260:
return getTypeFromArrayTypeNode(node);
- case 161:
- return getTypeFromTupleTypeNode(node);
case 162:
+ return getTypeFromTupleTypeNode(node);
+ case 163:
case 261:
return getTypeFromUnionTypeNode(node, aliasSymbol, aliasTypeArguments);
- case 163:
- return getTypeFromIntersectionTypeNode(node, aliasSymbol, aliasTypeArguments);
case 164:
+ return getTypeFromIntersectionTypeNode(node, aliasSymbol, aliasTypeArguments);
+ case 165:
case 263:
case 264:
case 271:
@@ -22932,14 +24089,14 @@ var ts;
return getTypeFromTypeNode(node.type);
case 265:
return getTypeFromTypeNode(node.literal);
- case 156:
case 157:
- case 159:
+ case 158:
+ case 160:
case 281:
case 269:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node, aliasSymbol, aliasTypeArguments);
- case 69:
- case 139:
+ case 70:
+ case 140:
var symbol = getSymbolAtLocation(node);
return symbol && getDeclaredTypeOfSymbol(symbol);
case 262:
@@ -23095,23 +24252,23 @@ var ts;
var node = symbol.declarations[0].parent;
while (node) {
switch (node.kind) {
- case 156:
case 157:
- case 220:
- case 147:
- case 146:
+ case 158:
+ case 221:
case 148:
- case 151:
+ case 147:
+ case 149:
case 152:
case 153:
- case 149:
+ case 154:
case 150:
- case 179:
+ case 151:
case 180:
- case 221:
- case 192:
+ case 181:
case 222:
+ case 193:
case 223:
+ case 224:
var declaration = node;
if (declaration.typeParameters) {
for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) {
@@ -23121,14 +24278,14 @@ var ts;
}
}
}
- if (ts.isClassLike(node) || node.kind === 222) {
+ if (ts.isClassLike(node) || node.kind === 223) {
var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;
if (thisType && ts.contains(mappedTypes, thisType)) {
return true;
}
}
break;
- case 225:
+ case 226:
case 256:
return false;
}
@@ -23163,35 +24320,43 @@ var ts;
return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration);
}
function isContextSensitive(node) {
- ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 148 || ts.isObjectLiteralMethod(node));
switch (node.kind) {
- case 179:
case 180:
+ case 181:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 171:
+ case 172:
return ts.forEach(node.properties, isContextSensitive);
- case 170:
+ case 171:
return ts.forEach(node.elements, isContextSensitive);
- case 188:
+ case 189:
return isContextSensitive(node.whenTrue) ||
isContextSensitive(node.whenFalse);
- case 187:
- return node.operatorToken.kind === 52 &&
+ case 188:
+ return node.operatorToken.kind === 53 &&
(isContextSensitive(node.left) || isContextSensitive(node.right));
case 253:
return isContextSensitive(node.initializer);
+ case 148:
case 147:
- case 146:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 178:
+ case 179:
return isContextSensitive(node.expression);
}
return false;
}
function isContextSensitiveFunctionLikeDeclaration(node) {
- var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; });
- var isNullaryArrow = node.kind === 180 && !node.parameters.length;
- return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow;
+ if (node.typeParameters) {
+ return false;
+ }
+ if (ts.forEach(node.parameters, function (p) { return !p.type; })) {
+ return true;
+ }
+ if (node.kind === 181) {
+ return false;
+ }
+ var parameter = ts.firstOrUndefined(node.parameters);
+ return !(parameter && ts.parameterIsThisKeyword(parameter));
}
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
@@ -23611,8 +24776,8 @@ var ts;
}
if (source.flags & 524288 && target.flags & 524288 ||
source.flags & 1048576 && target.flags & 1048576) {
- if (result = eachTypeRelatedToSomeType(source, target, false)) {
- if (result &= eachTypeRelatedToSomeType(target, source, false)) {
+ if (result = eachTypeRelatedToSomeType(source, target)) {
+ if (result &= eachTypeRelatedToSomeType(target, source)) {
return result;
}
}
@@ -23663,7 +24828,7 @@ var ts;
}
return false;
}
- function eachTypeRelatedToSomeType(source, target, reportErrors) {
+ function eachTypeRelatedToSomeType(source, target) {
var result = -1;
var sourceTypes = source.types;
for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) {
@@ -24260,7 +25425,7 @@ var ts;
type.flags & 64 ? numberType :
type.flags & 128 ? booleanType :
type.flags & 256 ? type.baseType :
- type.flags & 524288 && !(type.flags & 16) ? getUnionType(ts.map(type.types, getBaseTypeOfLiteralType)) :
+ type.flags & 524288 && !(type.flags & 16) ? getUnionType(ts.sameMap(type.types, getBaseTypeOfLiteralType)) :
type;
}
function getWidenedLiteralType(type) {
@@ -24268,7 +25433,7 @@ var ts;
type.flags & 64 && type.flags & 16777216 ? numberType :
type.flags & 128 ? booleanType :
type.flags & 256 ? type.baseType :
- type.flags & 524288 && !(type.flags & 16) ? getUnionType(ts.map(type.types, getWidenedLiteralType)) :
+ type.flags & 524288 && !(type.flags & 16) ? getUnionType(ts.sameMap(type.types, getWidenedLiteralType)) :
type;
}
function isTupleType(type) {
@@ -24379,10 +25544,10 @@ var ts;
return getWidenedTypeOfObjectLiteral(type);
}
if (type.flags & 524288) {
- return getUnionType(ts.map(type.types, getWidenedConstituentType));
+ return getUnionType(ts.sameMap(type.types, getWidenedConstituentType));
}
if (isArrayType(type) || isTupleType(type)) {
- return createTypeReference(type.target, ts.map(type.typeArguments, getWidenedType));
+ return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
}
}
return type;
@@ -24423,25 +25588,25 @@ var ts;
var typeAsString = typeToString(getWidenedType(type));
var diagnostic;
switch (declaration.kind) {
+ case 146:
case 145:
- case 144:
diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type;
break;
- case 142:
+ case 143:
diagnostic = declaration.dotDotDotToken ?
ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type :
ts.Diagnostics.Parameter_0_implicitly_has_an_1_type;
break;
- case 169:
+ case 170:
diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;
break;
- case 220:
+ case 221:
+ case 148:
case 147:
- case 146:
- case 149:
case 150:
- case 179:
+ case 151:
case 180:
+ case 181:
if (!declaration.name) {
error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
@@ -24486,7 +25651,7 @@ var ts;
signature: signature,
inferUnionTypes: inferUnionTypes,
inferences: inferences,
- inferredTypes: new Array(signature.typeParameters.length)
+ inferredTypes: new Array(signature.typeParameters.length),
};
}
function createTypeInferencesObject() {
@@ -24494,7 +25659,7 @@ var ts;
primary: undefined,
secondary: undefined,
topLevel: true,
- isFixed: false
+ isFixed: false,
};
}
function couldContainTypeParameters(type) {
@@ -24735,7 +25900,7 @@ var ts;
var widenLiteralTypes = context.inferences[index].topLevel &&
!hasPrimitiveConstraint(signature.typeParameters[index]) &&
(context.inferences[index].isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), signature.typeParameters[index]));
- var baseInferences = widenLiteralTypes ? ts.map(inferences, getWidenedLiteralType) : inferences;
+ var baseInferences = widenLiteralTypes ? ts.sameMap(inferences, getWidenedLiteralType) : inferences;
var unionOrSuperType = context.inferUnionTypes ? getUnionType(baseInferences, true) : getCommonSupertype(baseInferences);
inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : unknownType;
inferenceSucceeded = !!unionOrSuperType;
@@ -24776,10 +25941,10 @@ var ts;
function isInTypeQuery(node) {
while (node) {
switch (node.kind) {
- case 158:
+ case 159:
return true;
- case 69:
- case 139:
+ case 70:
+ case 140:
node = node.parent;
continue;
default:
@@ -24789,14 +25954,14 @@ var ts;
ts.Debug.fail("should not get here");
}
function getFlowCacheKey(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
var symbol = getResolvedSymbol(node);
return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined;
}
- if (node.kind === 97) {
+ if (node.kind === 98) {
return "0";
}
- if (node.kind === 172) {
+ if (node.kind === 173) {
var key = getFlowCacheKey(node.expression);
return key && key + "." + node.name.text;
}
@@ -24804,31 +25969,31 @@ var ts;
}
function getLeftmostIdentifierOrThis(node) {
switch (node.kind) {
- case 69:
- case 97:
+ case 70:
+ case 98:
return node;
- case 172:
+ case 173:
return getLeftmostIdentifierOrThis(node.expression);
}
return undefined;
}
function isMatchingReference(source, target) {
switch (source.kind) {
- case 69:
- return target.kind === 69 && getResolvedSymbol(source) === getResolvedSymbol(target) ||
- (target.kind === 218 || target.kind === 169) &&
+ case 70:
+ return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) ||
+ (target.kind === 219 || target.kind === 170) &&
getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);
- case 97:
- return target.kind === 97;
- case 172:
- return target.kind === 172 &&
+ case 98:
+ return target.kind === 98;
+ case 173:
+ return target.kind === 173 &&
source.name.text === target.name.text &&
isMatchingReference(source.expression, target.expression);
}
return false;
}
function containsMatchingReference(source, target) {
- while (source.kind === 172) {
+ while (source.kind === 173) {
source = source.expression;
if (isMatchingReference(source, target)) {
return true;
@@ -24837,15 +26002,15 @@ var ts;
return false;
}
function containsMatchingReferenceDiscriminant(source, target) {
- return target.kind === 172 &&
+ return target.kind === 173 &&
containsMatchingReference(source, target.expression) &&
isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text);
}
function getDeclaredTypeOfReference(expr) {
- if (expr.kind === 69) {
+ if (expr.kind === 70) {
return getTypeOfSymbol(getResolvedSymbol(expr));
}
- if (expr.kind === 172) {
+ if (expr.kind === 173) {
var type = getDeclaredTypeOfReference(expr.expression);
return type && getTypeOfPropertyOfType(type, expr.name.text);
}
@@ -24875,7 +26040,7 @@ var ts;
}
}
}
- if (callExpression.expression.kind === 172 &&
+ if (callExpression.expression.kind === 173 &&
isOrContainsMatchingReference(reference, callExpression.expression.expression)) {
return true;
}
@@ -25001,7 +26166,7 @@ var ts;
return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType);
}
function getAssignedTypeOfBinaryExpression(node) {
- return node.parent.kind === 170 || node.parent.kind === 253 ?
+ return node.parent.kind === 171 || node.parent.kind === 253 ?
getTypeWithDefault(getAssignedType(node), node.right) :
checkExpression(node.right);
}
@@ -25020,17 +26185,17 @@ var ts;
function getAssignedType(node) {
var parent = node.parent;
switch (parent.kind) {
- case 207:
- return stringType;
case 208:
+ return stringType;
+ case 209:
return checkRightHandSideOfForOf(parent.expression) || unknownType;
- case 187:
+ case 188:
return getAssignedTypeOfBinaryExpression(parent);
- case 181:
+ case 182:
return undefinedType;
- case 170:
+ case 171:
return getAssignedTypeOfArrayLiteralElement(parent, node);
- case 191:
+ case 192:
return getAssignedTypeOfSpreadElement(parent);
case 253:
return getAssignedTypeOfPropertyAssignment(parent);
@@ -25042,7 +26207,7 @@ var ts;
function getInitialTypeOfBindingElement(node) {
var pattern = node.parent;
var parentType = getInitialType(pattern.parent);
- var type = pattern.kind === 167 ?
+ var type = pattern.kind === 168 ?
getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :
!node.dotDotDotToken ?
getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) :
@@ -25057,38 +26222,51 @@ var ts;
if (node.initializer) {
return getTypeOfInitializer(node.initializer);
}
- if (node.parent.parent.kind === 207) {
+ if (node.parent.parent.kind === 208) {
return stringType;
}
- if (node.parent.parent.kind === 208) {
+ if (node.parent.parent.kind === 209) {
return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType;
}
return unknownType;
}
function getInitialType(node) {
- return node.kind === 218 ?
+ return node.kind === 219 ?
getInitialTypeOfVariableDeclaration(node) :
getInitialTypeOfBindingElement(node);
}
function getInitialOrAssignedType(node) {
- return node.kind === 218 || node.kind === 169 ?
+ return node.kind === 219 || node.kind === 170 ?
getInitialType(node) :
getAssignedType(node);
}
+ function isEmptyArrayAssignment(node) {
+ return node.kind === 219 && node.initializer &&
+ isEmptyArrayLiteral(node.initializer) ||
+ node.kind !== 170 && node.parent.kind === 188 &&
+ isEmptyArrayLiteral(node.parent.right);
+ }
function getReferenceCandidate(node) {
switch (node.kind) {
- case 178:
+ case 179:
return getReferenceCandidate(node.expression);
- case 187:
+ case 188:
switch (node.operatorToken.kind) {
- case 56:
+ case 57:
return getReferenceCandidate(node.left);
- case 24:
+ case 25:
return getReferenceCandidate(node.right);
}
}
return node;
}
+ function getReferenceRoot(node) {
+ var parent = node.parent;
+ return parent.kind === 179 ||
+ parent.kind === 188 && parent.operatorToken.kind === 57 && parent.left === node ||
+ parent.kind === 188 && parent.operatorToken.kind === 25 && parent.right === node ?
+ getReferenceRoot(parent) : node;
+ }
function getTypeOfSwitchClause(clause) {
if (clause.kind === 249) {
var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression));
@@ -25159,24 +26337,88 @@ var ts;
function createFlowType(type, incomplete) {
return incomplete ? { flags: 0, type: type } : type;
}
+ function createEvolvingArrayType(elementType) {
+ var result = createObjectType(2097152);
+ result.elementType = elementType;
+ return result;
+ }
+ function getEvolvingArrayType(elementType) {
+ return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType));
+ }
+ function addEvolvingArrayElementType(evolvingArrayType, node) {
+ var elementType = getBaseTypeOfLiteralType(checkExpression(node));
+ return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
+ }
+ function isEvolvingArrayType(type) {
+ return !!(type.flags & 2097152 && type.elementType);
+ }
+ function createFinalArrayType(elementType) {
+ return elementType.flags & 8192 ?
+ autoArrayType :
+ createArrayType(elementType.flags & 524288 ?
+ getUnionType(elementType.types, true) :
+ elementType);
+ }
+ function getFinalArrayType(evolvingArrayType) {
+ return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType));
+ }
+ function finalizeEvolvingArrayType(type) {
+ return isEvolvingArrayType(type) ? getFinalArrayType(type) : type;
+ }
+ function getElementTypeOfEvolvingArrayType(type) {
+ return isEvolvingArrayType(type) ? type.elementType : neverType;
+ }
+ function isEvolvingArrayTypeList(types) {
+ var hasEvolvingArrayType = false;
+ for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
+ var t = types_12[_i];
+ if (!(t.flags & 8192)) {
+ if (!isEvolvingArrayType(t)) {
+ return false;
+ }
+ hasEvolvingArrayType = true;
+ }
+ }
+ return hasEvolvingArrayType;
+ }
+ function getUnionOrEvolvingArrayType(types, subtypeReduction) {
+ return isEvolvingArrayTypeList(types) ?
+ getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType))) :
+ getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
+ }
+ function isEvolvingArrayOperationTarget(node) {
+ var root = getReferenceRoot(node);
+ var parent = root.parent;
+ var isLengthPushOrUnshift = parent.kind === 173 && (parent.name.text === "length" ||
+ parent.parent.kind === 175 && ts.isPushOrUnshiftIdentifier(parent.name));
+ var isElementAssignment = parent.kind === 174 &&
+ parent.expression === root &&
+ parent.parent.kind === 188 &&
+ parent.parent.operatorToken.kind === 57 &&
+ parent.parent.left === parent &&
+ !ts.isAssignmentTarget(parent.parent) &&
+ isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 | 2048);
+ return isLengthPushOrUnshift || isElementAssignment;
+ }
function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) {
var key;
if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 4178943)) {
return declaredType;
}
var initialType = assumeInitialized ? declaredType :
- declaredType === autoType ? undefinedType :
+ declaredType === autoType || declaredType === autoArrayType ? undefinedType :
includeFalsyTypes(declaredType, 2048);
var visitedFlowStart = visitedFlowCount;
- var result = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode));
+ var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode));
visitedFlowCount = visitedFlowStart;
- if (reference.parent.kind === 196 && getTypeWithFacts(result, 524288).flags & 8192) {
+ var resultType = isEvolvingArrayType(evolvedType) && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType);
+ if (reference.parent.kind === 197 && getTypeWithFacts(resultType, 524288).flags & 8192) {
return declaredType;
}
- return result;
+ return resultType;
function getTypeAtFlowNode(flow) {
while (true) {
- if (flow.flags & 512) {
+ if (flow.flags & 1024) {
for (var i = visitedFlowStart; i < visitedFlowCount; i++) {
if (visitedFlowNodes[i] === flow) {
return visitedFlowTypes[i];
@@ -25206,18 +26448,25 @@ var ts;
getTypeAtFlowBranchLabel(flow) :
getTypeAtFlowLoopLabel(flow);
}
+ else if (flow.flags & 256) {
+ type = getTypeAtFlowArrayMutation(flow);
+ if (!type) {
+ flow = flow.antecedent;
+ continue;
+ }
+ }
else if (flow.flags & 2) {
var container = flow.container;
- if (container && container !== flowContainer && reference.kind !== 172) {
+ if (container && container !== flowContainer && reference.kind !== 173) {
flow = container.flowNode;
continue;
}
type = initialType;
}
else {
- type = declaredType;
+ type = convertAutoToAny(declaredType);
}
- if (flow.flags & 512) {
+ if (flow.flags & 1024) {
visitedFlowNodes[visitedFlowCount] = flow;
visitedFlowTypes[visitedFlowCount] = type;
visitedFlowCount++;
@@ -25228,30 +26477,70 @@ var ts;
function getTypeAtFlowAssignment(flow) {
var node = flow.node;
if (isMatchingReference(reference, node)) {
- if (node.parent.kind === 185 || node.parent.kind === 186) {
+ if (node.parent.kind === 186 || node.parent.kind === 187) {
var flowType = getTypeAtFlowNode(flow.antecedent);
return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType));
}
- return declaredType === autoType ? getBaseTypeOfLiteralType(getInitialOrAssignedType(node)) :
- declaredType.flags & 524288 ? getAssignmentReducedType(declaredType, getInitialOrAssignedType(node)) :
- declaredType;
+ if (declaredType === autoType || declaredType === autoArrayType) {
+ if (isEmptyArrayAssignment(node)) {
+ return getEvolvingArrayType(neverType);
+ }
+ var assignedType = getBaseTypeOfLiteralType(getInitialOrAssignedType(node));
+ return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
+ }
+ if (declaredType.flags & 524288) {
+ return getAssignmentReducedType(declaredType, getInitialOrAssignedType(node));
+ }
+ return declaredType;
}
if (containsMatchingReference(reference, node)) {
return declaredType;
}
return undefined;
}
+ function getTypeAtFlowArrayMutation(flow) {
+ var node = flow.node;
+ var expr = node.kind === 175 ?
+ node.expression.expression :
+ node.left.expression;
+ if (isMatchingReference(reference, getReferenceCandidate(expr))) {
+ var flowType = getTypeAtFlowNode(flow.antecedent);
+ var type = getTypeFromFlowType(flowType);
+ if (isEvolvingArrayType(type)) {
+ var evolvedType_1 = type;
+ if (node.kind === 175) {
+ for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
+ var arg = _a[_i];
+ evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);
+ }
+ }
+ else {
+ var indexType = checkExpression(node.left.argumentExpression);
+ if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 | 2048)) {
+ evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right);
+ }
+ }
+ return evolvedType_1 === type ? flowType : createFlowType(evolvedType_1, isIncomplete(flowType));
+ }
+ return flowType;
+ }
+ return undefined;
+ }
function getTypeAtFlowCondition(flow) {
var flowType = getTypeAtFlowNode(flow.antecedent);
var type = getTypeFromFlowType(flowType);
- if (!(type.flags & 8192)) {
- var assumeTrue = (flow.flags & 32) !== 0;
- type = narrowType(type, flow.expression, assumeTrue);
- if (type.flags & 8192 && isIncomplete(flowType)) {
- type = silentNeverType;
- }
+ if (type.flags & 8192) {
+ return flowType;
}
- return createFlowType(type, isIncomplete(flowType));
+ var assumeTrue = (flow.flags & 32) !== 0;
+ var nonEvolvingType = finalizeEvolvingArrayType(type);
+ var narrowedType = narrowType(nonEvolvingType, flow.expression, assumeTrue);
+ if (narrowedType === nonEvolvingType) {
+ return flowType;
+ }
+ var incomplete = isIncomplete(flowType);
+ var resultType = incomplete && narrowedType.flags & 8192 ? silentNeverType : narrowedType;
+ return createFlowType(resultType, incomplete);
}
function getTypeAtSwitchClause(flow) {
var flowType = getTypeAtFlowNode(flow.antecedent);
@@ -25286,7 +26575,7 @@ var ts;
seenIncomplete = true;
}
}
- return createFlowType(getUnionType(antecedentTypes, subtypeReduction), seenIncomplete);
+ return createFlowType(getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction), seenIncomplete);
}
function getTypeAtFlowLoopLabel(flow) {
var id = getFlowNodeId(flow);
@@ -25298,8 +26587,8 @@ var ts;
return cache[key];
}
for (var i = flowLoopStart; i < flowLoopCount; i++) {
- if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key) {
- return createFlowType(getUnionType(flowLoopTypes[i]), true);
+ if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) {
+ return createFlowType(getUnionOrEvolvingArrayType(flowLoopTypes[i], false), true);
}
}
var antecedentTypes = [];
@@ -25330,14 +26619,14 @@ var ts;
break;
}
}
- var result = getUnionType(antecedentTypes, subtypeReduction);
+ var result = getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction);
if (isIncomplete(firstAntecedentType)) {
return createFlowType(result, true);
}
return cache[key] = result;
}
function isMatchingReferenceDiscriminant(expr) {
- return expr.kind === 172 &&
+ return expr.kind === 173 &&
declaredType.flags & 524288 &&
isMatchingReference(reference, expr.expression) &&
isDiscriminantProperty(declaredType, expr.name.text);
@@ -25362,19 +26651,19 @@ var ts;
}
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
switch (expr.operatorToken.kind) {
- case 56:
+ case 57:
return narrowTypeByTruthiness(type, expr.left, assumeTrue);
- case 30:
case 31:
case 32:
case 33:
+ case 34:
var operator_1 = expr.operatorToken.kind;
var left_1 = getReferenceCandidate(expr.left);
var right_1 = getReferenceCandidate(expr.right);
- if (left_1.kind === 182 && right_1.kind === 9) {
+ if (left_1.kind === 183 && right_1.kind === 9) {
return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);
}
- if (right_1.kind === 182 && left_1.kind === 9) {
+ if (right_1.kind === 183 && left_1.kind === 9) {
return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);
}
if (isMatchingReference(reference, left_1)) {
@@ -25393,9 +26682,9 @@ var ts;
return declaredType;
}
break;
- case 91:
+ case 92:
return narrowTypeByInstanceof(type, expr, assumeTrue);
- case 24:
+ case 25:
return narrowType(type, expr.right, assumeTrue);
}
return type;
@@ -25404,7 +26693,7 @@ var ts;
if (type.flags & 1) {
return type;
}
- if (operator === 31 || operator === 33) {
+ if (operator === 32 || operator === 34) {
assumeTrue = !assumeTrue;
}
var valueType = checkExpression(value);
@@ -25412,10 +26701,10 @@ var ts;
if (!strictNullChecks) {
return type;
}
- var doubleEquals = operator === 30 || operator === 31;
+ var doubleEquals = operator === 31 || operator === 32;
var facts = doubleEquals ?
assumeTrue ? 65536 : 524288 :
- value.kind === 93 ?
+ value.kind === 94 ?
assumeTrue ? 32768 : 262144 :
assumeTrue ? 16384 : 131072;
return getTypeWithFacts(type, facts);
@@ -25441,7 +26730,7 @@ var ts;
}
return type;
}
- if (operator === 31 || operator === 33) {
+ if (operator === 32 || operator === 34) {
assumeTrue = !assumeTrue;
}
if (assumeTrue && !(type.flags & 524288)) {
@@ -25552,7 +26841,7 @@ var ts;
}
else {
var invokedExpression = skipParenthesizedNodes(callExpression.expression);
- if (invokedExpression.kind === 173 || invokedExpression.kind === 172) {
+ if (invokedExpression.kind === 174 || invokedExpression.kind === 173) {
var accessExpression = invokedExpression;
var possibleReference = skipParenthesizedNodes(accessExpression.expression);
if (isMatchingReference(reference, possibleReference)) {
@@ -25567,18 +26856,18 @@ var ts;
}
function narrowType(type, expr, assumeTrue) {
switch (expr.kind) {
- case 69:
- case 97:
- case 172:
+ case 70:
+ case 98:
+ case 173:
return narrowTypeByTruthiness(type, expr, assumeTrue);
- case 174:
+ case 175:
return narrowTypeByTypePredicate(type, expr, assumeTrue);
- case 178:
+ case 179:
return narrowType(type, expr.expression, assumeTrue);
- case 187:
+ case 188:
return narrowTypeByBinaryExpression(type, expr, assumeTrue);
- case 185:
- if (expr.operator === 49) {
+ case 186:
+ if (expr.operator === 50) {
return narrowType(type, expr.operand, !assumeTrue);
}
break;
@@ -25587,7 +26876,7 @@ var ts;
}
}
function getTypeOfSymbolAtLocation(symbol, location) {
- if (location.kind === 69) {
+ if (location.kind === 70) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
}
@@ -25601,7 +26890,7 @@ var ts;
return getTypeOfSymbol(symbol);
}
function skipParenthesizedNodes(expression) {
- while (expression.kind === 178) {
+ while (expression.kind === 179) {
expression = expression.expression;
}
return expression;
@@ -25610,9 +26899,9 @@ var ts;
while (true) {
node = node.parent;
if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||
- node.kind === 226 ||
+ node.kind === 227 ||
node.kind === 256 ||
- node.kind === 145) {
+ node.kind === 146) {
return node;
}
}
@@ -25640,10 +26929,10 @@ var ts;
}
}
function markParameterAssignments(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
if (ts.isAssignmentTarget(node)) {
var symbol = getResolvedSymbol(node);
- if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 142) {
+ if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 143) {
symbol.isAssigned = true;
}
}
@@ -25652,12 +26941,15 @@ var ts;
ts.forEachChild(node, markParameterAssignments);
}
}
+ function isConstVariable(symbol) {
+ return symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 && getTypeOfSymbol(symbol) !== autoArrayType;
+ }
function checkIdentifier(node) {
var symbol = getResolvedSymbol(node);
if (symbol === argumentsSymbol) {
var container = ts.getContainingFunction(node);
if (languageVersion < 2) {
- if (container.kind === 180) {
+ if (container.kind === 181) {
error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
}
else if (ts.hasModifier(container, 256)) {
@@ -25675,7 +26967,7 @@ var ts;
if (localOrExportSymbol.flags & 32) {
var declaration_1 = localOrExportSymbol.valueDeclaration;
if (languageVersion === 2
- && declaration_1.kind === 221
+ && declaration_1.kind === 222
&& ts.nodeIsDecorated(declaration_1)) {
var container = ts.getContainingClass(node);
while (container !== undefined) {
@@ -25687,11 +26979,11 @@ var ts;
container = ts.getContainingClass(container);
}
}
- else if (declaration_1.kind === 192) {
+ else if (declaration_1.kind === 193) {
var container = ts.getThisContainer(node, false);
while (container !== undefined) {
if (container.parent === declaration_1) {
- if (container.kind === 145 && ts.hasModifier(container, 32)) {
+ if (container.kind === 146 && ts.hasModifier(container, 32)) {
getNodeLinks(declaration_1).flags |= 8388608;
getNodeLinks(node).flags |= 16777216;
}
@@ -25709,28 +27001,26 @@ var ts;
if (!(localOrExportSymbol.flags & 3) || ts.isAssignmentTarget(node) || !declaration) {
return type;
}
- var isParameter = ts.getRootDeclaration(declaration).kind === 142;
+ var isParameter = ts.getRootDeclaration(declaration).kind === 143;
var declarationContainer = getControlFlowContainer(declaration);
var flowContainer = getControlFlowContainer(node);
var isOuterVariable = flowContainer !== declarationContainer;
- while (flowContainer !== declarationContainer &&
- (flowContainer.kind === 179 ||
- flowContainer.kind === 180 ||
- ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
- (isReadonlySymbol(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 180 ||
+ flowContainer.kind === 181 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
+ (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
var assumeInitialized = isParameter || isOuterVariable ||
- type !== autoType && (!strictNullChecks || (type.flags & 1) !== 0) ||
+ type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0) ||
ts.isInAmbientContext(declaration);
var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
- if (type === autoType) {
- if (flowType === autoType) {
+ if (type === autoType || type === autoArrayType) {
+ if (flowType === autoType || flowType === autoArrayType) {
if (compilerOptions.noImplicitAny) {
- error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_any_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol));
- error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(anyType));
+ error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType));
+ error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
}
- return anyType;
+ return convertAutoToAny(flowType);
}
}
else if (!assumeInitialized && !(getFalsyFlags(type) & 2048) && getFalsyFlags(flowType) & 2048) {
@@ -25770,8 +27060,8 @@ var ts;
if (usedInFunction) {
getNodeLinks(current).flags |= 65536;
}
- if (container.kind === 206 &&
- ts.getAncestor(symbol.valueDeclaration, 219).parent === container &&
+ if (container.kind === 207 &&
+ ts.getAncestor(symbol.valueDeclaration, 220).parent === container &&
isAssignedInBodyOfForStatement(node, container)) {
getNodeLinks(symbol.valueDeclaration).flags |= 2097152;
}
@@ -25783,16 +27073,16 @@ var ts;
}
function isAssignedInBodyOfForStatement(node, container) {
var current = node;
- while (current.parent.kind === 178) {
+ while (current.parent.kind === 179) {
current = current.parent;
}
var isAssigned = false;
if (ts.isAssignmentTarget(current)) {
isAssigned = true;
}
- else if ((current.parent.kind === 185 || current.parent.kind === 186)) {
+ else if ((current.parent.kind === 186 || current.parent.kind === 187)) {
var expr = current.parent;
- isAssigned = expr.operator === 41 || expr.operator === 42;
+ isAssigned = expr.operator === 42 || expr.operator === 43;
}
if (!isAssigned) {
return false;
@@ -25809,7 +27099,7 @@ var ts;
}
function captureLexicalThis(node, container) {
getNodeLinks(node).flags |= 2;
- if (container.kind === 145 || container.kind === 148) {
+ if (container.kind === 146 || container.kind === 149) {
var classNode = container.parent;
getNodeLinks(classNode).flags |= 4;
}
@@ -25843,7 +27133,7 @@ var ts;
function checkThisExpression(node) {
var container = ts.getThisContainer(node, true);
var needToCaptureLexicalThis = false;
- if (container.kind === 148) {
+ if (container.kind === 149) {
var containingClassDecl = container.parent;
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl);
if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) {
@@ -25853,29 +27143,29 @@ var ts;
}
}
}
- if (container.kind === 180) {
+ if (container.kind === 181) {
container = ts.getThisContainer(container, false);
needToCaptureLexicalThis = (languageVersion < 2);
}
switch (container.kind) {
- case 225:
+ case 226:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
break;
- case 224:
+ case 225:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
break;
- case 148:
+ case 149:
if (isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
}
break;
+ case 146:
case 145:
- case 144:
if (ts.getModifierFlags(container) & 32) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);
}
break;
- case 140:
+ case 141:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
break;
}
@@ -25884,7 +27174,7 @@ var ts;
}
if (ts.isFunctionLike(container) &&
(!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) {
- if (container.kind === 179 &&
+ if (container.kind === 180 &&
ts.isInJavaScriptFile(container.parent) &&
ts.getSpecialPropertyAssignmentKind(container.parent) === 3) {
var className = container.parent
@@ -25896,7 +27186,7 @@ var ts;
return getInferredClassType(classSymbol);
}
}
- var thisType = getThisTypeOfDeclaration(container);
+ var thisType = getThisTypeOfDeclaration(container) || getContextualThisParameterType(container);
if (thisType) {
return thisType;
}
@@ -25928,18 +27218,18 @@ var ts;
}
function isInConstructorArgumentInitializer(node, constructorDecl) {
for (var n = node; n && n !== constructorDecl; n = n.parent) {
- if (n.kind === 142) {
+ if (n.kind === 143) {
return true;
}
}
return false;
}
function checkSuperExpression(node) {
- var isCallExpression = node.parent.kind === 174 && node.parent.expression === node;
+ var isCallExpression = node.parent.kind === 175 && node.parent.expression === node;
var container = ts.getSuperContainer(node, true);
var needToCaptureLexicalThis = false;
if (!isCallExpression) {
- while (container && container.kind === 180) {
+ while (container && container.kind === 181) {
container = ts.getSuperContainer(container, true);
needToCaptureLexicalThis = languageVersion < 2;
}
@@ -25948,16 +27238,16 @@ var ts;
var nodeCheckFlag = 0;
if (!canUseSuperExpression) {
var current = node;
- while (current && current !== container && current.kind !== 140) {
+ while (current && current !== container && current.kind !== 141) {
current = current.parent;
}
- if (current && current.kind === 140) {
+ if (current && current.kind === 141) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
}
else if (isCallExpression) {
error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
}
- else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 171)) {
+ else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 172)) {
error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
}
else {
@@ -25972,7 +27262,7 @@ var ts;
nodeCheckFlag = 256;
}
getNodeLinks(node).flags |= nodeCheckFlag;
- if (container.kind === 147 && ts.getModifierFlags(container) & 256) {
+ if (container.kind === 148 && ts.getModifierFlags(container) & 256) {
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
getNodeLinks(container).flags |= 4096;
}
@@ -25983,7 +27273,7 @@ var ts;
if (needToCaptureLexicalThis) {
captureLexicalThis(node.parent, container);
}
- if (container.parent.kind === 171) {
+ if (container.parent.kind === 172) {
if (languageVersion < 2) {
error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
return unknownType;
@@ -26001,7 +27291,7 @@ var ts;
}
return unknownType;
}
- if (container.kind === 148 && isInConstructorArgumentInitializer(node, container)) {
+ if (container.kind === 149 && isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
return unknownType;
}
@@ -26013,35 +27303,38 @@ var ts;
return false;
}
if (isCallExpression) {
- return container.kind === 148;
+ return container.kind === 149;
}
else {
- if (ts.isClassLike(container.parent) || container.parent.kind === 171) {
+ if (ts.isClassLike(container.parent) || container.parent.kind === 172) {
if (ts.getModifierFlags(container) & 32) {
- return container.kind === 147 ||
- container.kind === 146 ||
- container.kind === 149 ||
- container.kind === 150;
+ return container.kind === 148 ||
+ container.kind === 147 ||
+ container.kind === 150 ||
+ container.kind === 151;
}
else {
- return container.kind === 147 ||
- container.kind === 146 ||
- container.kind === 149 ||
+ return container.kind === 148 ||
+ container.kind === 147 ||
container.kind === 150 ||
+ container.kind === 151 ||
+ container.kind === 146 ||
container.kind === 145 ||
- container.kind === 144 ||
- container.kind === 148;
+ container.kind === 149;
}
}
}
return false;
}
}
- function getContextualThisParameter(func) {
- if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 180) {
+ function getContextualThisParameterType(func) {
+ if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 181) {
var contextualSignature = getContextualSignature(func);
if (contextualSignature) {
- return contextualSignature.thisParameter;
+ var thisParameter = contextualSignature.thisParameter;
+ if (thisParameter) {
+ return getTypeOfSymbol(thisParameter);
+ }
}
}
return undefined;
@@ -26091,7 +27384,7 @@ var ts;
if (declaration.type) {
return getTypeFromTypeNode(declaration.type);
}
- if (declaration.kind === 142) {
+ if (declaration.kind === 143) {
var type = getContextuallyTypedParameterType(declaration);
if (type) {
return type;
@@ -26143,7 +27436,7 @@ var ts;
}
function isInParameterInitializerBeforeContainingFunction(node) {
while (node.parent && !ts.isFunctionLike(node.parent)) {
- if (node.parent.kind === 142 && node.parent.initializer === node) {
+ if (node.parent.kind === 143 && node.parent.initializer === node) {
return true;
}
node = node.parent;
@@ -26152,8 +27445,8 @@ var ts;
}
function getContextualReturnType(functionDecl) {
if (functionDecl.type ||
- functionDecl.kind === 148 ||
- functionDecl.kind === 149 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 150))) {
+ functionDecl.kind === 149 ||
+ functionDecl.kind === 150 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 151))) {
return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl));
}
var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
@@ -26172,7 +27465,7 @@ var ts;
return undefined;
}
function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
- if (template.parent.kind === 176) {
+ if (template.parent.kind === 177) {
return getContextualTypeForArgument(template.parent, substitutionExpression);
}
return undefined;
@@ -26180,7 +27473,7 @@ var ts;
function getContextualTypeForBinaryOperand(node) {
var binaryExpression = node.parent;
var operator = binaryExpression.operatorToken.kind;
- if (operator >= 56 && operator <= 68) {
+ if (operator >= 57 && operator <= 69) {
if (ts.getSpecialPropertyAssignmentKind(binaryExpression) !== 0) {
return undefined;
}
@@ -26188,14 +27481,14 @@ var ts;
return checkExpression(binaryExpression.left);
}
}
- else if (operator === 52) {
+ else if (operator === 53) {
var type = getContextualType(binaryExpression);
if (!type && node === binaryExpression.right) {
type = checkExpression(binaryExpression.left);
}
return type;
}
- else if (operator === 51 || operator === 24) {
+ else if (operator === 52 || operator === 25) {
if (node === binaryExpression.right) {
return getContextualType(binaryExpression);
}
@@ -26209,8 +27502,8 @@ var ts;
var types = type.types;
var mappedType;
var mappedTypes;
- for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
- var current = types_12[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var current = types_13[_i];
var t = mapper(current);
if (t) {
if (!mappedType) {
@@ -26304,36 +27597,36 @@ var ts;
}
var parent = node.parent;
switch (parent.kind) {
- case 218:
- case 142:
+ case 219:
+ case 143:
+ case 146:
case 145:
- case 144:
- case 169:
+ case 170:
return getContextualTypeForInitializerExpression(node);
- case 180:
- case 211:
+ case 181:
+ case 212:
return getContextualTypeForReturnExpression(node);
- case 190:
+ case 191:
return getContextualTypeForYieldOperand(parent);
- case 174:
case 175:
+ case 176:
return getContextualTypeForArgument(parent, node);
- case 177:
- case 195:
+ case 178:
+ case 196:
return getTypeFromTypeNode(parent.type);
- case 187:
+ case 188:
return getContextualTypeForBinaryOperand(node);
case 253:
case 254:
return getContextualTypeForObjectLiteralElement(parent);
- case 170:
+ case 171:
return getContextualTypeForElementExpression(node);
- case 188:
+ case 189:
return getContextualTypeForConditionalOperand(node);
- case 197:
- ts.Debug.assert(parent.parent.kind === 189);
+ case 198:
+ ts.Debug.assert(parent.parent.kind === 190);
return getContextualTypeForSubstitutionExpression(parent.parent, node);
- case 178:
+ case 179:
return getContextualType(parent);
case 248:
return getContextualType(parent);
@@ -26353,7 +27646,7 @@ var ts;
}
}
function isFunctionExpressionOrArrowFunction(node) {
- return node.kind === 179 || node.kind === 180;
+ return node.kind === 180 || node.kind === 181;
}
function getContextualSignatureForFunctionLikeDeclaration(node) {
return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node)
@@ -26366,7 +27659,7 @@ var ts;
getApparentTypeOfContextualType(node);
}
function getContextualSignature(node) {
- ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 148 || ts.isObjectLiteralMethod(node));
var type = getContextualTypeForFunctionLikeDeclaration(node);
if (!type) {
return undefined;
@@ -26376,8 +27669,8 @@ var ts;
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var current = types_13[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var current = types_14[_i];
var signature = getNonGenericSignature(current);
if (signature) {
if (!signatureList) {
@@ -26407,8 +27700,8 @@ var ts;
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false);
}
function hasDefaultValue(node) {
- return (node.kind === 169 && !!node.initializer) ||
- (node.kind === 187 && node.operatorToken.kind === 56);
+ return (node.kind === 170 && !!node.initializer) ||
+ (node.kind === 188 && node.operatorToken.kind === 57);
}
function checkArrayLiteral(node, contextualMapper) {
var elements = node.elements;
@@ -26417,7 +27710,7 @@ var ts;
var inDestructuringPattern = ts.isAssignmentTarget(node);
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
var e = elements_1[_i];
- if (inDestructuringPattern && e.kind === 191) {
+ if (inDestructuringPattern && e.kind === 192) {
var restArrayType = checkExpression(e.expression, contextualMapper);
var restElementType = getIndexTypeOfType(restArrayType, 1) ||
(languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined);
@@ -26429,7 +27722,7 @@ var ts;
var type = checkExpressionForMutableLocation(e, contextualMapper);
elementTypes.push(type);
}
- hasSpreadElement = hasSpreadElement || e.kind === 191;
+ hasSpreadElement = hasSpreadElement || e.kind === 192;
}
if (!hasSpreadElement) {
if (inDestructuringPattern && elementTypes.length) {
@@ -26440,7 +27733,7 @@ var ts;
var contextualType = getApparentTypeOfContextualType(node);
if (contextualType && contextualTypeIsTupleLikeType(contextualType)) {
var pattern = contextualType.pattern;
- if (pattern && (pattern.kind === 168 || pattern.kind === 170)) {
+ if (pattern && (pattern.kind === 169 || pattern.kind === 171)) {
var patternElements = pattern.elements;
for (var i = elementTypes.length; i < patternElements.length; i++) {
var patternElement = patternElements[i];
@@ -26448,7 +27741,7 @@ var ts;
elementTypes.push(contextualType.typeArguments[i]);
}
else {
- if (patternElement.kind !== 193) {
+ if (patternElement.kind !== 194) {
error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
elementTypes.push(unknownType);
@@ -26465,7 +27758,7 @@ var ts;
strictNullChecks ? neverType : undefinedWideningType);
}
function isNumericName(name) {
- return name.kind === 140 ? isNumericComputedName(name) : isNumericLiteralName(name.text);
+ return name.kind === 141 ? isNumericComputedName(name) : isNumericLiteralName(name.text);
}
function isNumericComputedName(name) {
return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 340);
@@ -26509,7 +27802,7 @@ var ts;
var propertiesArray = [];
var contextualType = getApparentTypeOfContextualType(node);
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
- (contextualType.pattern.kind === 167 || contextualType.pattern.kind === 171);
+ (contextualType.pattern.kind === 168 || contextualType.pattern.kind === 172);
var typeFlags = 0;
var patternWithComputedProperties = false;
var hasComputedStringProperty = false;
@@ -26524,7 +27817,7 @@ var ts;
if (memberDecl.kind === 253) {
type = checkPropertyAssignment(memberDecl, contextualMapper);
}
- else if (memberDecl.kind === 147) {
+ else if (memberDecl.kind === 148) {
type = checkObjectLiteralMethod(memberDecl, contextualMapper);
}
else {
@@ -26563,7 +27856,7 @@ var ts;
member = prop;
}
else {
- ts.Debug.assert(memberDecl.kind === 149 || memberDecl.kind === 150);
+ ts.Debug.assert(memberDecl.kind === 150 || memberDecl.kind === 151);
checkAccessorDeclaration(memberDecl);
}
if (ts.hasDynamicName(memberDecl)) {
@@ -26622,10 +27915,10 @@ var ts;
case 248:
checkJsxExpression(child);
break;
- case 241:
+ case 242:
checkJsxElement(child);
break;
- case 242:
+ case 243:
checkJsxSelfClosingElement(child);
break;
}
@@ -26636,7 +27929,7 @@ var ts;
return name.indexOf("-") < 0;
}
function isJsxIntrinsicIdentifier(tagName) {
- if (tagName.kind === 172 || tagName.kind === 97) {
+ if (tagName.kind === 173 || tagName.kind === 98) {
return false;
}
else {
@@ -26739,7 +28032,7 @@ var ts;
return unknownType;
}
}
- return getUnionType(signatures.map(getReturnTypeOfSignature), true);
+ return getUnionType(ts.map(signatures, getReturnTypeOfSignature), true);
}
function getJsxElementPropertiesName() {
var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1920, undefined);
@@ -26768,7 +28061,7 @@ var ts;
}
if (elemType.flags & 524288) {
var types = elemType.types;
- return getUnionType(types.map(function (type) {
+ return getUnionType(ts.map(types, function (type) {
return getResolvedJsxType(node, type, elemClassType);
}), true);
}
@@ -26944,7 +28237,7 @@ var ts;
}
}
function getDeclarationKindFromSymbol(s) {
- return s.valueDeclaration ? s.valueDeclaration.kind : 145;
+ return s.valueDeclaration ? s.valueDeclaration.kind : 146;
}
function getDeclarationModifierFlagsFromSymbol(s) {
return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0;
@@ -26955,11 +28248,11 @@ var ts;
function checkClassPropertyAccess(node, left, type, prop) {
var flags = getDeclarationModifierFlagsFromSymbol(prop);
var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop));
- var errorNode = node.kind === 172 || node.kind === 218 ?
+ var errorNode = node.kind === 173 || node.kind === 219 ?
node.name :
node.right;
- if (left.kind === 95) {
- if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 147) {
+ if (left.kind === 96) {
+ if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 148) {
error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);
return false;
}
@@ -26979,7 +28272,7 @@ var ts;
}
return true;
}
- if (left.kind === 95) {
+ if (left.kind === 96) {
return true;
}
var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) {
@@ -27053,7 +28346,7 @@ var ts;
checkClassPropertyAccess(node, left, apparentType, prop);
}
var propType = getTypeOfSymbol(prop);
- if (node.kind !== 172 || ts.isAssignmentTarget(node) ||
+ if (node.kind !== 173 || ts.isAssignmentTarget(node) ||
!(prop.flags & (3 | 4 | 98304)) &&
!(prop.flags & 8192 && propType.flags & 524288)) {
return propType;
@@ -27075,7 +28368,7 @@ var ts;
}
}
function isValidPropertyAccess(node, propertyName) {
- var left = node.kind === 172
+ var left = node.kind === 173
? node.expression
: node.left;
var type = checkExpression(left);
@@ -27089,13 +28382,13 @@ var ts;
}
function getForInVariableSymbol(node) {
var initializer = node.initializer;
- if (initializer.kind === 219) {
+ if (initializer.kind === 220) {
var variable = initializer.declarations[0];
if (variable && !ts.isBindingPattern(variable.name)) {
return getSymbolOfNode(variable);
}
}
- else if (initializer.kind === 69) {
+ else if (initializer.kind === 70) {
return getResolvedSymbol(initializer);
}
return undefined;
@@ -27105,13 +28398,13 @@ var ts;
}
function isForInVariableForNumericPropertyNames(expr) {
var e = skipParenthesizedNodes(expr);
- if (e.kind === 69) {
+ if (e.kind === 70) {
var symbol = getResolvedSymbol(e);
if (symbol.flags & 3) {
var child = expr;
var node = expr.parent;
while (node) {
- if (node.kind === 207 &&
+ if (node.kind === 208 &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
hasNumericPropertyNames(checkExpression(node.expression))) {
@@ -27127,7 +28420,7 @@ var ts;
function checkIndexedAccess(node) {
if (!node.argumentExpression) {
var sourceFile = ts.getSourceFileOfNode(node);
- if (node.parent.kind === 175 && node.parent.expression === node) {
+ if (node.parent.kind === 176 && node.parent.expression === node) {
var start = ts.skipTrivia(sourceFile.text, node.expression.end);
var end = node.end;
grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);
@@ -27191,7 +28484,7 @@ var ts;
if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) {
return indexArgumentExpression.text;
}
- if (indexArgumentExpression.kind === 173 || indexArgumentExpression.kind === 172) {
+ if (indexArgumentExpression.kind === 174 || indexArgumentExpression.kind === 173) {
var value = getConstantValue(indexArgumentExpression);
if (value !== undefined) {
return value.toString();
@@ -27234,10 +28527,10 @@ var ts;
return true;
}
function resolveUntypedCall(node) {
- if (node.kind === 176) {
+ if (node.kind === 177) {
checkExpression(node.template);
}
- else if (node.kind !== 143) {
+ else if (node.kind !== 144) {
ts.forEach(node.arguments, function (argument) {
checkExpression(argument);
});
@@ -27288,7 +28581,7 @@ var ts;
function getSpreadArgumentIndex(args) {
for (var i = 0; i < args.length; i++) {
var arg = args[i];
- if (arg && arg.kind === 191) {
+ if (arg && arg.kind === 192) {
return i;
}
}
@@ -27301,11 +28594,11 @@ var ts;
var callIsIncomplete;
var isDecorator;
var spreadArgIndex = -1;
- if (node.kind === 176) {
+ if (node.kind === 177) {
var tagExpression = node;
argCount = args.length;
typeArguments = undefined;
- if (tagExpression.template.kind === 189) {
+ if (tagExpression.template.kind === 190) {
var templateExpression = tagExpression.template;
var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans);
ts.Debug.assert(lastSpan !== undefined);
@@ -27313,11 +28606,11 @@ var ts;
}
else {
var templateLiteral = tagExpression.template;
- ts.Debug.assert(templateLiteral.kind === 11);
+ ts.Debug.assert(templateLiteral.kind === 12);
callIsIncomplete = !!templateLiteral.isUnterminated;
}
}
- else if (node.kind === 143) {
+ else if (node.kind === 144) {
isDecorator = true;
typeArguments = undefined;
argCount = getEffectiveArgumentCount(node, undefined, signature);
@@ -27325,7 +28618,7 @@ var ts;
else {
var callExpression = node;
if (!callExpression.arguments) {
- ts.Debug.assert(callExpression.kind === 175);
+ ts.Debug.assert(callExpression.kind === 176);
return signature.minArgumentCount === 0;
}
argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
@@ -27384,9 +28677,9 @@ var ts;
var argCount = getEffectiveArgumentCount(node, args, signature);
for (var i = 0; i < argCount; i++) {
var arg = getEffectiveArgument(node, args, i);
- if (arg === undefined || arg.kind !== 193) {
+ if (arg === undefined || arg.kind !== 194) {
var paramType = getTypeAtPosition(signature, i);
- var argType = getEffectiveArgumentType(node, i, arg);
+ var argType = getEffectiveArgumentType(node, i);
if (argType === undefined) {
var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper;
argType = checkExpressionWithContextualType(arg, paramType, mapper);
@@ -27431,7 +28724,7 @@ var ts;
}
function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) {
var thisType = getThisTypeOfSignature(signature);
- if (thisType && thisType !== voidType && node.kind !== 175) {
+ if (thisType && thisType !== voidType && node.kind !== 176) {
var thisArgumentNode = getThisArgumentOfCall(node);
var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;
var errorNode = reportErrors ? (thisArgumentNode || node) : undefined;
@@ -27444,9 +28737,9 @@ var ts;
var argCount = getEffectiveArgumentCount(node, args, signature);
for (var i = 0; i < argCount; i++) {
var arg = getEffectiveArgument(node, args, i);
- if (arg === undefined || arg.kind !== 193) {
+ if (arg === undefined || arg.kind !== 194) {
var paramType = getTypeAtPosition(signature, i);
- var argType = getEffectiveArgumentType(node, i, arg);
+ var argType = getEffectiveArgumentType(node, i);
if (argType === undefined) {
argType = checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);
}
@@ -27459,28 +28752,28 @@ var ts;
return true;
}
function getThisArgumentOfCall(node) {
- if (node.kind === 174) {
+ if (node.kind === 175) {
var callee = node.expression;
- if (callee.kind === 172) {
+ if (callee.kind === 173) {
return callee.expression;
}
- else if (callee.kind === 173) {
+ else if (callee.kind === 174) {
return callee.expression;
}
}
}
function getEffectiveCallArguments(node) {
var args;
- if (node.kind === 176) {
+ if (node.kind === 177) {
var template = node.template;
args = [undefined];
- if (template.kind === 189) {
+ if (template.kind === 190) {
ts.forEach(template.templateSpans, function (span) {
args.push(span.expression);
});
}
}
- else if (node.kind === 143) {
+ else if (node.kind === 144) {
return undefined;
}
else {
@@ -27489,21 +28782,21 @@ var ts;
return args;
}
function getEffectiveArgumentCount(node, args, signature) {
- if (node.kind === 143) {
+ if (node.kind === 144) {
switch (node.parent.kind) {
- case 221:
- case 192:
+ case 222:
+ case 193:
return 1;
- case 145:
+ case 146:
return 2;
- case 147:
- case 149:
+ case 148:
case 150:
+ case 151:
if (languageVersion === 0) {
return 2;
}
return signature.parameters.length >= 3 ? 3 : 2;
- case 142:
+ case 143:
return 3;
}
}
@@ -27512,48 +28805,48 @@ var ts;
}
}
function getEffectiveDecoratorFirstArgumentType(node) {
- if (node.kind === 221) {
+ if (node.kind === 222) {
var classSymbol = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol);
}
- if (node.kind === 142) {
+ if (node.kind === 143) {
node = node.parent;
- if (node.kind === 148) {
+ if (node.kind === 149) {
var classSymbol = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol);
}
}
- if (node.kind === 145 ||
- node.kind === 147 ||
- node.kind === 149 ||
- node.kind === 150) {
+ if (node.kind === 146 ||
+ node.kind === 148 ||
+ node.kind === 150 ||
+ node.kind === 151) {
return getParentTypeOfClassElement(node);
}
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
}
function getEffectiveDecoratorSecondArgumentType(node) {
- if (node.kind === 221) {
+ if (node.kind === 222) {
ts.Debug.fail("Class decorators should not have a second synthetic argument.");
return unknownType;
}
- if (node.kind === 142) {
+ if (node.kind === 143) {
node = node.parent;
- if (node.kind === 148) {
+ if (node.kind === 149) {
return anyType;
}
}
- if (node.kind === 145 ||
- node.kind === 147 ||
- node.kind === 149 ||
- node.kind === 150) {
+ if (node.kind === 146 ||
+ node.kind === 148 ||
+ node.kind === 150 ||
+ node.kind === 151) {
var element = node;
switch (element.name.kind) {
- case 69:
+ case 70:
case 8:
case 9:
return getLiteralTypeForText(32, element.name.text);
- case 140:
+ case 141:
var nameType = checkComputedPropertyName(element.name);
if (isTypeOfKind(nameType, 512)) {
return nameType;
@@ -27570,20 +28863,20 @@ var ts;
return unknownType;
}
function getEffectiveDecoratorThirdArgumentType(node) {
- if (node.kind === 221) {
+ if (node.kind === 222) {
ts.Debug.fail("Class decorators should not have a third synthetic argument.");
return unknownType;
}
- if (node.kind === 142) {
+ if (node.kind === 143) {
return numberType;
}
- if (node.kind === 145) {
+ if (node.kind === 146) {
ts.Debug.fail("Property decorators should not have a third synthetic argument.");
return unknownType;
}
- if (node.kind === 147 ||
- node.kind === 149 ||
- node.kind === 150) {
+ if (node.kind === 148 ||
+ node.kind === 150 ||
+ node.kind === 151) {
var propertyType = getTypeOfNode(node);
return createTypedPropertyDescriptorType(propertyType);
}
@@ -27603,27 +28896,27 @@ var ts;
ts.Debug.fail("Decorators should not have a fourth synthetic argument.");
return unknownType;
}
- function getEffectiveArgumentType(node, argIndex, arg) {
- if (node.kind === 143) {
+ function getEffectiveArgumentType(node, argIndex) {
+ if (node.kind === 144) {
return getEffectiveDecoratorArgumentType(node, argIndex);
}
- else if (argIndex === 0 && node.kind === 176) {
+ else if (argIndex === 0 && node.kind === 177) {
return getGlobalTemplateStringsArrayType();
}
return undefined;
}
function getEffectiveArgument(node, args, argIndex) {
- if (node.kind === 143 ||
- (argIndex === 0 && node.kind === 176)) {
+ if (node.kind === 144 ||
+ (argIndex === 0 && node.kind === 177)) {
return undefined;
}
return args[argIndex];
}
function getEffectiveArgumentErrorNode(node, argIndex, arg) {
- if (node.kind === 143) {
+ if (node.kind === 144) {
return node.expression;
}
- else if (argIndex === 0 && node.kind === 176) {
+ else if (argIndex === 0 && node.kind === 177) {
return node.template;
}
else {
@@ -27631,12 +28924,12 @@ var ts;
}
}
function resolveCall(node, signatures, candidatesOutArray, headMessage) {
- var isTaggedTemplate = node.kind === 176;
- var isDecorator = node.kind === 143;
+ var isTaggedTemplate = node.kind === 177;
+ var isDecorator = node.kind === 144;
var typeArguments;
if (!isTaggedTemplate && !isDecorator) {
typeArguments = node.typeArguments;
- if (node.expression.kind !== 95) {
+ if (node.expression.kind !== 96) {
ts.forEach(typeArguments, checkSourceElement);
}
}
@@ -27662,7 +28955,7 @@ var ts;
var candidateForTypeArgumentError;
var resultOfFailedInference;
var result;
- var signatureHelpTrailingComma = candidatesOutArray && node.kind === 174 && node.arguments.hasTrailingComma;
+ var signatureHelpTrailingComma = candidatesOutArray && node.kind === 175 && node.arguments.hasTrailingComma;
if (candidates.length > 1) {
result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma);
}
@@ -27777,7 +29070,7 @@ var ts;
}
}
function resolveCallExpression(node, candidatesOutArray) {
- if (node.expression.kind === 95) {
+ if (node.expression.kind === 96) {
var superType = checkSuperExpression(node.expression);
if (superType !== unknownType) {
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node));
@@ -27930,16 +29223,16 @@ var ts;
}
function getDiagnosticHeadMessageForDecoratorResolution(node) {
switch (node.parent.kind) {
- case 221:
- case 192:
+ case 222:
+ case 193:
return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;
- case 142:
+ case 143:
return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;
- case 145:
+ case 146:
return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;
- case 147:
- case 149:
+ case 148:
case 150:
+ case 151:
return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;
}
}
@@ -27966,13 +29259,13 @@ var ts;
}
function resolveSignature(node, candidatesOutArray) {
switch (node.kind) {
- case 174:
- return resolveCallExpression(node, candidatesOutArray);
case 175:
- return resolveNewExpression(node, candidatesOutArray);
+ return resolveCallExpression(node, candidatesOutArray);
case 176:
+ return resolveNewExpression(node, candidatesOutArray);
+ case 177:
return resolveTaggedTemplateExpression(node, candidatesOutArray);
- case 143:
+ case 144:
return resolveDecorator(node, candidatesOutArray);
}
ts.Debug.fail("Branch in 'resolveSignature' should be unreachable.");
@@ -28001,17 +29294,17 @@ var ts;
function checkCallExpression(node) {
checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments);
var signature = getResolvedSignature(node);
- if (node.expression.kind === 95) {
+ if (node.expression.kind === 96) {
return voidType;
}
- if (node.kind === 175) {
+ if (node.kind === 176) {
var declaration = signature.declaration;
if (declaration &&
- declaration.kind !== 148 &&
- declaration.kind !== 152 &&
- declaration.kind !== 157 &&
+ declaration.kind !== 149 &&
+ declaration.kind !== 153 &&
+ declaration.kind !== 158 &&
!ts.isJSDocConstructSignature(declaration)) {
- var funcSymbol = node.expression.kind === 69 ?
+ var funcSymbol = node.expression.kind === 70 ?
getResolvedSymbol(node.expression) :
checkExpression(node.expression).symbol;
if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) {
@@ -28023,7 +29316,9 @@ var ts;
return anyType;
}
}
- if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node, true)) {
+ if (ts.isInJavaScriptFile(node) &&
+ ts.isRequireCall(node, true) &&
+ !resolveName(node.expression, node.expression.text, 107455, undefined, undefined)) {
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
}
return getReturnTypeOfSignature(signature);
@@ -28063,21 +29358,36 @@ var ts;
}
function assignContextualParameterTypes(signature, context, mapper) {
var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0);
+ if (isInferentialContext(mapper)) {
+ for (var i = 0; i < len; i++) {
+ var declaration = signature.parameters[i].valueDeclaration;
+ if (declaration.type) {
+ inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i));
+ }
+ }
+ }
if (context.thisParameter) {
- if (!signature.thisParameter) {
- signature.thisParameter = createTransientSymbol(context.thisParameter, undefined);
+ var parameter = signature.thisParameter;
+ if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) {
+ if (!parameter) {
+ signature.thisParameter = createTransientSymbol(context.thisParameter, undefined);
+ }
+ assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper);
}
- assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper);
}
for (var i = 0; i < len; i++) {
var parameter = signature.parameters[i];
- var contextualParameterType = getTypeAtPosition(context, i);
- assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
+ if (!parameter.valueDeclaration.type) {
+ var contextualParameterType = getTypeAtPosition(context, i);
+ assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
+ }
}
if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) {
var parameter = ts.lastOrUndefined(signature.parameters);
- var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters));
- assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
+ if (!parameter.valueDeclaration.type) {
+ var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters));
+ assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
+ }
}
}
function assignBindingElementTypes(node) {
@@ -28085,7 +29395,7 @@ var ts;
for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (!ts.isOmittedExpression(element)) {
- if (element.name.kind === 69) {
+ if (element.name.kind === 70) {
getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
}
assignBindingElementTypes(element);
@@ -28098,8 +29408,8 @@ var ts;
if (!links.type) {
links.type = instantiateType(contextualType, mapper);
if (links.type === emptyObjectType &&
- (parameter.valueDeclaration.name.kind === 167 ||
- parameter.valueDeclaration.name.kind === 168)) {
+ (parameter.valueDeclaration.name.kind === 168 ||
+ parameter.valueDeclaration.name.kind === 169)) {
links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name);
}
assignBindingElementTypes(parameter.valueDeclaration);
@@ -28138,7 +29448,7 @@ var ts;
}
var isAsync = ts.isAsyncFunctionLike(func);
var type;
- if (func.body.kind !== 199) {
+ if (func.body.kind !== 200) {
type = checkExpressionCached(func.body, contextualMapper);
if (isAsync) {
type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);
@@ -28217,7 +29527,7 @@ var ts;
return false;
}
var lastStatement = ts.lastOrUndefined(func.body.statements);
- if (lastStatement && lastStatement.kind === 213 && isExhaustiveSwitchStatement(lastStatement)) {
+ if (lastStatement && lastStatement.kind === 214 && isExhaustiveSwitchStatement(lastStatement)) {
return false;
}
return true;
@@ -28246,7 +29556,7 @@ var ts;
}
});
if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever ||
- func.kind === 179 || func.kind === 180)) {
+ func.kind === 180 || func.kind === 181)) {
return undefined;
}
if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) {
@@ -28263,7 +29573,7 @@ var ts;
if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) {
return;
}
- if (ts.nodeIsMissing(func.body) || func.body.kind !== 199 || !functionHasImplicitReturn(func)) {
+ if (ts.nodeIsMissing(func.body) || func.body.kind !== 200 || !functionHasImplicitReturn(func)) {
return;
}
var hasExplicitReturn = func.flags & 256;
@@ -28290,9 +29600,9 @@ var ts;
}
}
function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) {
- ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 148 || ts.isObjectLiteralMethod(node));
var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
- if (!hasGrammarError && node.kind === 179) {
+ if (!hasGrammarError && node.kind === 180) {
checkGrammarForGenerator(node);
}
if (contextualMapper === identityMapper && isContextSensitive(node)) {
@@ -28326,14 +29636,14 @@ var ts;
}
}
}
- if (produceDiagnostics && node.kind !== 147) {
+ if (produceDiagnostics && node.kind !== 148) {
checkCollisionWithCapturedSuperVariable(node, node.name);
checkCollisionWithCapturedThisVariable(node, node.name);
}
return type;
}
function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {
- ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 148 || ts.isObjectLiteralMethod(node));
var isAsync = ts.isAsyncFunctionLike(node);
var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));
if (!node.asteriskToken) {
@@ -28343,7 +29653,7 @@ var ts;
if (!node.type) {
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
- if (node.body.kind === 199) {
+ if (node.body.kind === 200) {
checkSourceElement(node.body);
}
else {
@@ -28378,10 +29688,10 @@ var ts;
function isReferenceToReadonlyEntity(expr, symbol) {
if (isReadonlySymbol(symbol)) {
if (symbol.flags & 4 &&
- (expr.kind === 172 || expr.kind === 173) &&
- expr.expression.kind === 97) {
+ (expr.kind === 173 || expr.kind === 174) &&
+ expr.expression.kind === 98) {
var func = ts.getContainingFunction(expr);
- if (!(func && func.kind === 148))
+ if (!(func && func.kind === 149))
return true;
return !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent);
}
@@ -28390,13 +29700,13 @@ var ts;
return false;
}
function isReferenceThroughNamespaceImport(expr) {
- if (expr.kind === 172 || expr.kind === 173) {
+ if (expr.kind === 173 || expr.kind === 174) {
var node = skipParenthesizedNodes(expr.expression);
- if (node.kind === 69) {
+ if (node.kind === 70) {
var symbol = getNodeLinks(node).resolvedSymbol;
if (symbol.flags & 8388608) {
var declaration = getDeclarationOfAliasSymbol(symbol);
- return declaration && declaration.kind === 232;
+ return declaration && declaration.kind === 233;
}
}
}
@@ -28404,7 +29714,7 @@ var ts;
}
function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) {
var node = skipParenthesizedNodes(expr);
- if (node.kind !== 69 && node.kind !== 172 && node.kind !== 173) {
+ if (node.kind !== 70 && node.kind !== 173 && node.kind !== 174) {
error(expr, invalidReferenceMessage);
return false;
}
@@ -28412,7 +29722,7 @@ var ts;
var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
if (symbol) {
if (symbol !== unknownSymbol && symbol !== argumentsSymbol) {
- if (node.kind === 69 && !(symbol.flags & 3)) {
+ if (node.kind === 70 && !(symbol.flags & 3)) {
error(expr, invalidReferenceMessage);
return false;
}
@@ -28422,7 +29732,7 @@ var ts;
}
}
}
- else if (node.kind === 173) {
+ else if (node.kind === 174) {
if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) {
error(expr, constantVariableMessage);
return false;
@@ -28459,24 +29769,24 @@ var ts;
if (operandType === silentNeverType) {
return silentNeverType;
}
- if (node.operator === 36 && node.operand.kind === 8) {
+ if (node.operator === 37 && node.operand.kind === 8) {
return getFreshTypeOfLiteralType(getLiteralTypeForText(64, "" + -node.operand.text));
}
switch (node.operator) {
- case 35:
case 36:
- case 50:
+ case 37:
+ case 51:
if (maybeTypeOfKind(operandType, 512)) {
error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
}
return numberType;
- case 49:
+ case 50:
var facts = getTypeFacts(operandType) & (1048576 | 2097152);
return facts === 1048576 ? falseType :
facts === 2097152 ? trueType :
booleanType;
- case 41:
case 42:
+ case 43:
var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);
if (ok) {
checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property);
@@ -28502,8 +29812,8 @@ var ts;
}
if (type.flags & 1572864) {
var types = type.types;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var t = types_14[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -28517,8 +29827,8 @@ var ts;
}
if (type.flags & 524288) {
var types = type.types;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var t = types_15[_i];
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var t = types_16[_i];
if (!isTypeOfKind(t, kind)) {
return false;
}
@@ -28527,8 +29837,8 @@ var ts;
}
if (type.flags & 1048576) {
var types = type.types;
- for (var _a = 0, types_16 = types; _a < types_16.length; _a++) {
- var t = types_16[_a];
+ for (var _a = 0, types_17 = types; _a < types_17.length; _a++) {
+ var t = types_17[_a];
if (isTypeOfKind(t, kind)) {
return true;
}
@@ -28566,18 +29876,18 @@ var ts;
}
return booleanType;
}
- function checkObjectLiteralAssignment(node, sourceType, contextualMapper) {
+ function checkObjectLiteralAssignment(node, sourceType) {
var properties = node.properties;
for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
var p = properties_4[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, contextualMapper);
+ checkObjectLiteralDestructuringPropertyAssignment(sourceType, p);
}
return sourceType;
}
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, contextualMapper) {
+ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) {
if (property.kind === 253 || property.kind === 254) {
var name_17 = property.name;
- if (name_17.kind === 140) {
+ if (name_17.kind === 141) {
checkComputedPropertyName(name_17);
}
if (isComputedNonLiteralName(name_17)) {
@@ -28616,8 +29926,8 @@ var ts;
function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) {
var elements = node.elements;
var element = elements[elementIndex];
- if (element.kind !== 193) {
- if (element.kind !== 191) {
+ if (element.kind !== 194) {
+ if (element.kind !== 192) {
var propName = "" + elementIndex;
var type = isTypeAny(sourceType)
? sourceType
@@ -28643,7 +29953,7 @@ var ts;
}
else {
var restExpression = element.expression;
- if (restExpression.kind === 187 && restExpression.operatorToken.kind === 56) {
+ if (restExpression.kind === 188 && restExpression.operatorToken.kind === 57) {
error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
}
else {
@@ -28670,14 +29980,14 @@ var ts;
else {
target = exprOrAssignment;
}
- if (target.kind === 187 && target.operatorToken.kind === 56) {
+ if (target.kind === 188 && target.operatorToken.kind === 57) {
checkBinaryExpression(target, contextualMapper);
target = target.left;
}
- if (target.kind === 171) {
- return checkObjectLiteralAssignment(target, sourceType, contextualMapper);
+ if (target.kind === 172) {
+ return checkObjectLiteralAssignment(target, sourceType);
}
- if (target.kind === 170) {
+ if (target.kind === 171) {
return checkArrayLiteralAssignment(target, sourceType, contextualMapper);
}
return checkReferenceAssignment(target, sourceType, contextualMapper);
@@ -28692,49 +30002,49 @@ var ts;
function isSideEffectFree(node) {
node = ts.skipParentheses(node);
switch (node.kind) {
- case 69:
+ case 70:
case 9:
- case 10:
- case 176:
- case 189:
case 11:
+ case 177:
+ case 190:
+ case 12:
case 8:
- case 99:
- case 84:
- case 93:
- case 135:
- case 179:
- case 192:
+ case 100:
+ case 85:
+ case 94:
+ case 136:
case 180:
- case 170:
+ case 193:
+ case 181:
case 171:
- case 182:
- case 196:
+ case 172:
+ case 183:
+ case 197:
+ case 243:
case 242:
- case 241:
return true;
- case 188:
+ case 189:
return isSideEffectFree(node.whenTrue) &&
isSideEffectFree(node.whenFalse);
- case 187:
+ case 188:
if (ts.isAssignmentOperator(node.operatorToken.kind)) {
return false;
}
return isSideEffectFree(node.left) &&
isSideEffectFree(node.right);
- case 185:
case 186:
+ case 187:
switch (node.operator) {
- case 49:
- case 35:
- case 36:
case 50:
+ case 36:
+ case 37:
+ case 51:
return true;
}
return false;
- case 183:
- case 177:
- case 195:
+ case 184:
+ case 178:
+ case 196:
default:
return false;
}
@@ -28754,34 +30064,34 @@ var ts;
}
function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) {
var operator = operatorToken.kind;
- if (operator === 56 && (left.kind === 171 || left.kind === 170)) {
+ if (operator === 57 && (left.kind === 172 || left.kind === 171)) {
return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper);
}
var leftType = checkExpression(left, contextualMapper);
var rightType = checkExpression(right, contextualMapper);
switch (operator) {
- case 37:
case 38:
- case 59:
- case 60:
case 39:
+ case 60:
case 61:
case 40:
case 62:
- case 36:
- case 58:
- case 43:
+ case 41:
case 63:
+ case 37:
+ case 59:
case 44:
case 64:
case 45:
case 65:
- case 47:
- case 67:
- case 48:
- case 68:
case 46:
case 66:
+ case 48:
+ case 68:
+ case 49:
+ case 69:
+ case 47:
+ case 67:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -28805,8 +30115,8 @@ var ts;
}
}
return numberType;
- case 35:
- case 57:
+ case 36:
+ case 58:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -28835,24 +30145,24 @@ var ts;
reportOperatorError();
return anyType;
}
- if (operator === 57) {
+ if (operator === 58) {
checkAssignmentOperator(resultType);
}
return resultType;
- case 25:
- case 27:
+ case 26:
case 28:
case 29:
+ case 30:
if (checkForDisallowedESSymbolOperand(operator)) {
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
reportOperatorError();
}
}
return booleanType;
- case 30:
case 31:
case 32:
case 33:
+ case 34:
var leftIsLiteral = isLiteralType(leftType);
var rightIsLiteral = isLiteralType(rightType);
if (!leftIsLiteral || !rightIsLiteral) {
@@ -28863,22 +30173,22 @@ var ts;
reportOperatorError();
}
return booleanType;
- case 91:
+ case 92:
return checkInstanceOfExpression(left, right, leftType, rightType);
- case 90:
+ case 91:
return checkInExpression(left, right, leftType, rightType);
- case 51:
+ case 52:
return getTypeFacts(leftType) & 1048576 ?
includeFalsyTypes(rightType, getFalsyFlags(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType))) :
leftType;
- case 52:
+ case 53:
return getTypeFacts(leftType) & 2097152 ?
getBestChoiceType(removeDefinitelyFalsyTypes(leftType), rightType) :
leftType;
- case 56:
+ case 57:
checkAssignmentOperator(rightType);
return getRegularTypeOfObjectLiteral(rightType);
- case 24:
+ case 25:
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) {
error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
}
@@ -28896,21 +30206,21 @@ var ts;
}
function getSuggestedBooleanOperator(operator) {
switch (operator) {
+ case 48:
+ case 68:
+ return 53;
+ case 49:
+ case 69:
+ return 34;
case 47:
case 67:
return 52;
- case 48:
- case 68:
- return 33;
- case 46:
- case 66:
- return 51;
default:
return undefined;
}
}
function checkAssignmentOperator(valueType) {
- if (produceDiagnostics && operator >= 56 && operator <= 68) {
+ if (produceDiagnostics && operator >= 57 && operator <= 69) {
var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property);
if (ok) {
checkTypeAssignableTo(valueType, leftType, left, undefined);
@@ -28982,9 +30292,9 @@ var ts;
return getFreshTypeOfLiteralType(getLiteralTypeForText(32, node.text));
case 8:
return getFreshTypeOfLiteralType(getLiteralTypeForText(64, node.text));
- case 99:
+ case 100:
return trueType;
- case 84:
+ case 85:
return falseType;
}
}
@@ -29013,7 +30323,7 @@ var ts;
}
function isTypeAssertion(node) {
node = skipParenthesizedNodes(node);
- return node.kind === 177 || node.kind === 195;
+ return node.kind === 178 || node.kind === 196;
}
function checkDeclarationInitializer(declaration) {
var type = checkExpressionCached(declaration.initializer);
@@ -29039,14 +30349,14 @@ var ts;
return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type);
}
function checkPropertyAssignment(node, contextualMapper) {
- if (node.name.kind === 140) {
+ if (node.name.kind === 141) {
checkComputedPropertyName(node.name);
}
return checkExpressionForMutableLocation(node.initializer, contextualMapper);
}
function checkObjectLiteralMethod(node, contextualMapper) {
checkGrammarMethod(node);
- if (node.name.kind === 140) {
+ if (node.name.kind === 141) {
checkComputedPropertyName(node.name);
}
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);
@@ -29069,7 +30379,7 @@ var ts;
}
function checkExpression(node, contextualMapper) {
var type;
- if (node.kind === 139) {
+ if (node.kind === 140) {
type = checkQualifiedName(node);
}
else {
@@ -29077,9 +30387,9 @@ var ts;
type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);
}
if (isConstEnumObjectType(type)) {
- var ok = (node.parent.kind === 172 && node.parent.expression === node) ||
- (node.parent.kind === 173 && node.parent.expression === node) ||
- ((node.kind === 69 || node.kind === 139) && isInRightSideOfImportOrExportAssignment(node));
+ var ok = (node.parent.kind === 173 && node.parent.expression === node) ||
+ (node.parent.kind === 174 && node.parent.expression === node) ||
+ ((node.kind === 70 || node.kind === 140) && 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);
}
@@ -29088,79 +30398,79 @@ var ts;
}
function checkExpressionWorker(node, contextualMapper) {
switch (node.kind) {
- case 69:
+ case 70:
return checkIdentifier(node);
- case 97:
+ case 98:
return checkThisExpression(node);
- case 95:
+ case 96:
return checkSuperExpression(node);
- case 93:
+ case 94:
return nullWideningType;
case 9:
case 8:
- case 99:
- case 84:
+ case 100:
+ case 85:
return checkLiteralExpression(node);
- case 189:
+ case 190:
return checkTemplateExpression(node);
- case 11:
+ case 12:
return stringType;
- case 10:
+ case 11:
return globalRegExpType;
- case 170:
- return checkArrayLiteral(node, contextualMapper);
case 171:
- return checkObjectLiteral(node, contextualMapper);
+ return checkArrayLiteral(node, contextualMapper);
case 172:
- return checkPropertyAccessExpression(node);
+ return checkObjectLiteral(node, contextualMapper);
case 173:
- return checkIndexedAccess(node);
+ return checkPropertyAccessExpression(node);
case 174:
+ return checkIndexedAccess(node);
case 175:
- return checkCallExpression(node);
case 176:
+ return checkCallExpression(node);
+ case 177:
return checkTaggedTemplateExpression(node);
- case 178:
+ case 179:
return checkExpression(node.expression, contextualMapper);
- case 192:
+ case 193:
return checkClassExpression(node);
- case 179:
case 180:
+ case 181:
return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);
- case 182:
+ case 183:
return checkTypeOfExpression(node);
- case 177:
- case 195:
- return checkAssertion(node);
+ case 178:
case 196:
+ return checkAssertion(node);
+ case 197:
return checkNonNullAssertion(node);
- case 181:
+ case 182:
return checkDeleteExpression(node);
- case 183:
- return checkVoidExpression(node);
case 184:
- return checkAwaitExpression(node);
+ return checkVoidExpression(node);
case 185:
- return checkPrefixUnaryExpression(node);
+ return checkAwaitExpression(node);
case 186:
- return checkPostfixUnaryExpression(node);
+ return checkPrefixUnaryExpression(node);
case 187:
- return checkBinaryExpression(node, contextualMapper);
+ return checkPostfixUnaryExpression(node);
case 188:
+ return checkBinaryExpression(node, contextualMapper);
+ case 189:
return checkConditionalExpression(node, contextualMapper);
- case 191:
+ case 192:
return checkSpreadElementExpression(node, contextualMapper);
- case 193:
+ case 194:
return undefinedWideningType;
- case 190:
+ case 191:
return checkYieldExpression(node);
case 248:
return checkJsxExpression(node);
- case 241:
- return checkJsxElement(node);
case 242:
- return checkJsxSelfClosingElement(node);
+ return checkJsxElement(node);
case 243:
+ return checkJsxSelfClosingElement(node);
+ case 244:
ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement");
}
return unknownType;
@@ -29181,7 +30491,7 @@ var ts;
var func = ts.getContainingFunction(node);
if (ts.getModifierFlags(node) & 92) {
func = ts.getContainingFunction(node);
- if (!(func.kind === 148 && ts.nodeIsPresent(func.body))) {
+ if (!(func.kind === 149 && ts.nodeIsPresent(func.body))) {
error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
}
}
@@ -29192,7 +30502,7 @@ var ts;
if (ts.indexOf(func.parameters, node) !== 0) {
error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter);
}
- if (func.kind === 148 || func.kind === 152 || func.kind === 157) {
+ if (func.kind === 149 || func.kind === 153 || func.kind === 158) {
error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);
}
}
@@ -29204,15 +30514,15 @@ var ts;
if (!node.asteriskToken || !node.body) {
return false;
}
- return node.kind === 147 ||
- node.kind === 220 ||
- node.kind === 179;
+ return node.kind === 148 ||
+ node.kind === 221 ||
+ node.kind === 180;
}
function getTypePredicateParameterIndex(parameterList, parameter) {
if (parameterList) {
for (var i = 0; i < parameterList.length; i++) {
var param = parameterList[i];
- if (param.name.kind === 69 &&
+ if (param.name.kind === 70 &&
param.name.text === parameter.text) {
return i;
}
@@ -29262,13 +30572,13 @@ var ts;
}
function getTypePredicateParent(node) {
switch (node.parent.kind) {
+ case 181:
+ case 152:
+ case 221:
case 180:
- case 151:
- case 220:
- case 179:
- case 156:
+ case 157:
+ case 148:
case 147:
- case 146:
var parent_12 = node.parent;
if (node === parent_12.type) {
return parent_12;
@@ -29282,13 +30592,13 @@ var ts;
continue;
}
var name_19 = element.name;
- if (name_19.kind === 69 &&
+ if (name_19.kind === 70 &&
name_19.text === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name_19.kind === 168 ||
- name_19.kind === 167) {
+ else if (name_19.kind === 169 ||
+ name_19.kind === 168) {
if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_19, predicateVariableNode, predicateVariableName)) {
return true;
}
@@ -29296,12 +30606,12 @@ var ts;
}
}
function checkSignatureDeclaration(node) {
- if (node.kind === 153) {
+ if (node.kind === 154) {
checkGrammarIndexSignature(node);
}
- else if (node.kind === 156 || node.kind === 220 || node.kind === 157 ||
- node.kind === 151 || node.kind === 148 ||
- node.kind === 152) {
+ else if (node.kind === 157 || node.kind === 221 || node.kind === 158 ||
+ node.kind === 152 || node.kind === 149 ||
+ node.kind === 153) {
checkGrammarFunctionLikeDeclaration(node);
}
checkTypeParameters(node.typeParameters);
@@ -29313,10 +30623,10 @@ var ts;
checkCollisionWithArgumentsInGeneratedCode(node);
if (compilerOptions.noImplicitAny && !node.type) {
switch (node.kind) {
- case 152:
+ case 153:
error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
- case 151:
+ case 152:
error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
}
@@ -29343,11 +30653,17 @@ var ts;
}
}
function checkClassForDuplicateDeclarations(node) {
+ var Accessor;
+ (function (Accessor) {
+ Accessor[Accessor["Getter"] = 1] = "Getter";
+ Accessor[Accessor["Setter"] = 2] = "Setter";
+ Accessor[Accessor["Property"] = 3] = "Property";
+ })(Accessor || (Accessor = {}));
var instanceNames = ts.createMap();
var staticNames = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 148) {
+ if (member.kind === 149) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param)) {
@@ -29356,18 +30672,18 @@ var ts;
}
}
else {
- var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 113; });
+ var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114; });
var names = isStatic ? staticNames : instanceNames;
var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name);
if (memberName) {
switch (member.kind) {
- case 149:
+ case 150:
addName(names, member.name, memberName, 1);
break;
- case 150:
+ case 151:
addName(names, member.name, memberName, 2);
break;
- case 145:
+ case 146:
addName(names, member.name, memberName, 3);
break;
}
@@ -29393,12 +30709,12 @@ var ts;
var names = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind == 144) {
+ if (member.kind == 145) {
var memberName = void 0;
switch (member.name.kind) {
case 9:
case 8:
- case 69:
+ case 70:
memberName = member.name.text;
break;
default:
@@ -29415,7 +30731,7 @@ var ts;
}
}
function checkTypeForDuplicateIndexSignatures(node) {
- if (node.kind === 222) {
+ if (node.kind === 223) {
var nodeSymbol = getSymbolOfNode(node);
if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) {
return;
@@ -29430,7 +30746,7 @@ var ts;
var declaration = decl;
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
switch (declaration.parameters[0].type.kind) {
- case 132:
+ case 133:
if (!seenStringIndexer) {
seenStringIndexer = true;
}
@@ -29438,7 +30754,7 @@ var ts;
error(declaration, ts.Diagnostics.Duplicate_string_index_signature);
}
break;
- case 130:
+ case 131:
if (!seenNumericIndexer) {
seenNumericIndexer = true;
}
@@ -29494,15 +30810,15 @@ var ts;
return ts.forEachChild(n, containsSuperCall);
}
function markThisReferencesAsErrors(n) {
- if (n.kind === 97) {
+ if (n.kind === 98) {
error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
}
- else if (n.kind !== 179 && n.kind !== 220) {
+ else if (n.kind !== 180 && n.kind !== 221) {
ts.forEachChild(n, markThisReferencesAsErrors);
}
}
function isInstancePropertyWithInitializer(n) {
- return n.kind === 145 &&
+ return n.kind === 146 &&
!(ts.getModifierFlags(n) & 32) &&
!!n.initializer;
}
@@ -29522,7 +30838,7 @@ var ts;
var superCallStatement = void 0;
for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
var statement = statements_2[_i];
- if (statement.kind === 202 && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 203 && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
}
@@ -29545,18 +30861,18 @@ var ts;
checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name);
checkDecorators(node);
checkSignatureDeclaration(node);
- if (node.kind === 149) {
+ if (node.kind === 150) {
if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128)) {
if (!(node.flags & 256)) {
error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
}
}
}
- if (node.name.kind === 140) {
+ if (node.name.kind === 141) {
checkComputedPropertyName(node.name);
}
if (!ts.hasDynamicName(node)) {
- var otherKind = node.kind === 149 ? 150 : 149;
+ var otherKind = node.kind === 150 ? 151 : 150;
var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind);
if (otherAccessor) {
if ((ts.getModifierFlags(node) & 28) !== (ts.getModifierFlags(otherAccessor) & 28)) {
@@ -29570,11 +30886,11 @@ var ts;
}
}
var returnType = getTypeOfAccessors(getSymbolOfNode(node));
- if (node.kind === 149) {
+ if (node.kind === 150) {
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
}
}
- if (node.parent.kind !== 171) {
+ if (node.parent.kind !== 172) {
checkSourceElement(node.body);
registerForUnusedIdentifiersCheck(node);
}
@@ -29660,9 +30976,9 @@ var ts;
}
function getEffectiveDeclarationFlags(n, flagsToCheck) {
var flags = ts.getCombinedModifierFlags(n);
- if (n.parent.kind !== 222 &&
- n.parent.kind !== 221 &&
- n.parent.kind !== 192 &&
+ if (n.parent.kind !== 223 &&
+ n.parent.kind !== 222 &&
+ n.parent.kind !== 193 &&
ts.isInAmbientContext(n)) {
if (!(flags & 2)) {
flags |= 1;
@@ -29739,7 +31055,7 @@ var ts;
if (subsequentNode.kind === node.kind) {
var errorNode_1 = subsequentNode.name || subsequentNode;
if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) {
- var reportError = (node.kind === 147 || node.kind === 146) &&
+ var reportError = (node.kind === 148 || node.kind === 147) &&
(ts.getModifierFlags(node) & 32) !== (ts.getModifierFlags(subsequentNode) & 32);
if (reportError) {
var diagnostic = ts.getModifierFlags(node) & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static;
@@ -29772,11 +31088,11 @@ var ts;
var current = declarations_4[_i];
var node = current;
var inAmbientContext = ts.isInAmbientContext(node);
- var inAmbientContextOrInterface = node.parent.kind === 222 || node.parent.kind === 159 || inAmbientContext;
+ var inAmbientContextOrInterface = node.parent.kind === 223 || node.parent.kind === 160 || inAmbientContext;
if (inAmbientContextOrInterface) {
previousDeclaration = undefined;
}
- if (node.kind === 220 || node.kind === 147 || node.kind === 146 || node.kind === 148) {
+ if (node.kind === 221 || node.kind === 148 || node.kind === 147 || node.kind === 149) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
allNodeFlags &= currentNodeFlags;
@@ -29887,16 +31203,16 @@ var ts;
}
function getDeclarationSpaces(d) {
switch (d.kind) {
- case 222:
+ case 223:
return 2097152;
- case 225:
+ case 226:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0
? 4194304 | 1048576
: 4194304;
- case 221:
- case 224:
+ case 222:
+ case 225:
return 2097152 | 1048576;
- case 229:
+ case 230:
var result_2 = 0;
var target = resolveAlias(getSymbolOfNode(d));
ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); });
@@ -30044,22 +31360,22 @@ var ts;
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
var errorInfo;
switch (node.parent.kind) {
- case 221:
+ case 222:
var classSymbol = getSymbolOfNode(node.parent);
var classConstructorType = getTypeOfSymbol(classSymbol);
expectedReturnType = getUnionType([classConstructorType, voidType]);
break;
- case 142:
+ case 143:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
break;
- case 145:
+ case 146:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
break;
- case 147:
- case 149:
+ case 148:
case 150:
+ case 151:
var methodType = getTypeOfNode(node.parent);
var descriptorType = createTypedPropertyDescriptorType(methodType);
expectedReturnType = getUnionType([descriptorType, voidType]);
@@ -30068,9 +31384,9 @@ var ts;
checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo);
}
function checkTypeNodeAsExpression(node) {
- if (node && node.kind === 155) {
+ if (node && node.kind === 156) {
var root = getFirstIdentifier(node.typeName);
- var meaning = root.parent.kind === 155 ? 793064 : 1920;
+ var meaning = root.parent.kind === 156 ? 793064 : 1920;
var rootSymbol = resolveName(root, root.text, meaning | 8388608, undefined, undefined);
if (rootSymbol && rootSymbol.flags & 8388608) {
var aliasTarget = resolveAlias(rootSymbol);
@@ -30104,20 +31420,20 @@ var ts;
}
if (compilerOptions.emitDecoratorMetadata) {
switch (node.kind) {
- case 221:
+ case 222:
var constructor = ts.getFirstConstructorWithBody(node);
if (constructor) {
checkParameterTypeAnnotationsAsExpressions(constructor);
}
break;
- case 147:
- case 149:
+ case 148:
case 150:
+ case 151:
checkParameterTypeAnnotationsAsExpressions(node);
checkReturnTypeAnnotationAsExpression(node);
break;
- case 145:
- case 142:
+ case 146:
+ case 143:
checkTypeAnnotationAsExpression(node);
break;
}
@@ -30137,7 +31453,7 @@ var ts;
checkDecorators(node);
checkSignatureDeclaration(node);
var isAsync = ts.isAsyncFunctionLike(node);
- if (node.name && node.name.kind === 140) {
+ if (node.name && node.name.kind === 141) {
checkComputedPropertyName(node.name);
}
if (!ts.hasDynamicName(node)) {
@@ -30180,42 +31496,42 @@ var ts;
var node = deferredUnusedIdentifierNodes_1[_i];
switch (node.kind) {
case 256:
- case 225:
+ case 226:
checkUnusedModuleMembers(node);
break;
- case 221:
- case 192:
+ case 222:
+ case 193:
checkUnusedClassMembers(node);
checkUnusedTypeParameters(node);
break;
- case 222:
+ case 223:
checkUnusedTypeParameters(node);
break;
- case 199:
- case 227:
- case 206:
+ case 200:
+ case 228:
case 207:
case 208:
+ case 209:
checkUnusedLocalsAndParameters(node);
break;
- case 148:
- case 179:
- case 220:
- case 180:
- case 147:
case 149:
+ case 180:
+ case 221:
+ case 181:
+ case 148:
case 150:
+ case 151:
if (node.body) {
checkUnusedLocalsAndParameters(node);
}
checkUnusedTypeParameters(node);
break;
- case 146:
- case 151:
+ case 147:
case 152:
case 153:
- case 156:
+ case 154:
case 157:
+ case 158:
checkUnusedTypeParameters(node);
break;
}
@@ -30224,11 +31540,11 @@ var ts;
}
}
function checkUnusedLocalsAndParameters(node) {
- if (node.parent.kind !== 222 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) {
+ if (node.parent.kind !== 223 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) {
var _loop_1 = function (key) {
var local = node.locals[key];
if (!local.isReferenced) {
- if (local.valueDeclaration && local.valueDeclaration.kind === 142) {
+ if (local.valueDeclaration && local.valueDeclaration.kind === 143) {
var parameter = local.valueDeclaration;
if (compilerOptions.noUnusedParameters &&
!ts.isParameterPropertyDeclaration(parameter) &&
@@ -30248,19 +31564,19 @@ var ts;
}
}
function parameterNameStartsWithUnderscore(parameter) {
- return parameter.name && parameter.name.kind === 69 && parameter.name.text.charCodeAt(0) === 95;
+ return parameter.name && parameter.name.kind === 70 && parameter.name.text.charCodeAt(0) === 95;
}
function checkUnusedClassMembers(node) {
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
if (node.members) {
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 147 || member.kind === 145) {
+ if (member.kind === 148 || member.kind === 146) {
if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8) {
error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name);
}
}
- else if (member.kind === 148) {
+ else if (member.kind === 149) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8) {
@@ -30305,7 +31621,7 @@ var ts;
}
}
function checkBlock(node) {
- if (node.kind === 199) {
+ if (node.kind === 200) {
checkGrammarStatementInAmbientContext(node);
}
ts.forEach(node.statements, checkSourceElement);
@@ -30327,19 +31643,19 @@ var ts;
if (!(identifier && identifier.text === name)) {
return false;
}
- if (node.kind === 145 ||
- node.kind === 144 ||
+ if (node.kind === 146 ||
+ node.kind === 145 ||
+ node.kind === 148 ||
node.kind === 147 ||
- node.kind === 146 ||
- node.kind === 149 ||
- node.kind === 150) {
+ node.kind === 150 ||
+ node.kind === 151) {
return false;
}
if (ts.isInAmbientContext(node)) {
return false;
}
var root = ts.getRootDeclaration(node);
- if (root.kind === 142 && ts.nodeIsMissing(root.parent.body)) {
+ if (root.kind === 143 && ts.nodeIsMissing(root.parent.body)) {
return false;
}
return true;
@@ -30353,7 +31669,7 @@ var ts;
var current = node;
while (current) {
if (getNodeCheckFlags(current) & 4) {
- var isDeclaration_1 = node.kind !== 69;
+ var isDeclaration_1 = node.kind !== 70;
if (isDeclaration_1) {
error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
}
@@ -30374,7 +31690,7 @@ var ts;
return;
}
if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) {
- var isDeclaration_2 = node.kind !== 69;
+ var isDeclaration_2 = node.kind !== 70;
if (isDeclaration_2) {
error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference);
}
@@ -30384,13 +31700,13 @@ var ts;
}
}
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
- if (modulekind >= ts.ModuleKind.ES6) {
+ if (modulekind >= ts.ModuleKind.ES2015) {
return;
}
if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
return;
}
- if (node.kind === 225 && ts.getModuleInstanceState(node) !== 1) {
+ if (node.kind === 226 && ts.getModuleInstanceState(node) !== 1) {
return;
}
var parent = getDeclarationContainer(node);
@@ -30402,7 +31718,7 @@ var ts;
if (!needCollisionCheckForIdentifier(node, name, "Promise")) {
return;
}
- if (node.kind === 225 && ts.getModuleInstanceState(node) !== 1) {
+ if (node.kind === 226 && ts.getModuleInstanceState(node) !== 1) {
return;
}
var parent = getDeclarationContainer(node);
@@ -30414,7 +31730,7 @@ var ts;
if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) {
return;
}
- if (node.kind === 218 && !node.initializer) {
+ if (node.kind === 219 && !node.initializer) {
return;
}
var symbol = getSymbolOfNode(node);
@@ -30424,14 +31740,14 @@ var ts;
localDeclarationSymbol !== symbol &&
localDeclarationSymbol.flags & 2) {
if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) {
- var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 219);
- var container = varDeclList.parent.kind === 200 && varDeclList.parent.parent
+ var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 220);
+ var container = varDeclList.parent.kind === 201 && varDeclList.parent.parent
? varDeclList.parent.parent
: undefined;
var namesShareScope = container &&
- (container.kind === 199 && ts.isFunctionLike(container.parent) ||
+ (container.kind === 200 && ts.isFunctionLike(container.parent) ||
+ container.kind === 227 ||
container.kind === 226 ||
- container.kind === 225 ||
container.kind === 256);
if (!namesShareScope) {
var name_20 = symbolToString(localDeclarationSymbol);
@@ -30442,7 +31758,7 @@ var ts;
}
}
function checkParameterInitializer(node) {
- if (ts.getRootDeclaration(node).kind !== 142) {
+ if (ts.getRootDeclaration(node).kind !== 143) {
return;
}
var func = ts.getContainingFunction(node);
@@ -30451,10 +31767,10 @@ var ts;
if (ts.isTypeNode(n) || ts.isDeclarationName(n)) {
return;
}
- if (n.kind === 172) {
+ if (n.kind === 173) {
return visit(n.expression);
}
- else if (n.kind === 69) {
+ else if (n.kind === 70) {
var symbol = resolveName(n, n.text, 107455 | 8388608, undefined, undefined);
if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) {
return;
@@ -30465,7 +31781,7 @@ var ts;
}
var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
if (enclosingContainer === func) {
- if (symbol.valueDeclaration.kind === 142) {
+ if (symbol.valueDeclaration.kind === 143) {
if (symbol.valueDeclaration.pos < node.pos) {
return;
}
@@ -30474,7 +31790,7 @@ var ts;
if (ts.isFunctionLike(current.parent)) {
return;
}
- if (current.parent.kind === 145 &&
+ if (current.parent.kind === 146 &&
!(ts.hasModifier(current.parent, 32)) &&
ts.isClassLike(current.parent.parent)) {
return;
@@ -30491,19 +31807,19 @@ var ts;
}
}
function convertAutoToAny(type) {
- return type === autoType ? anyType : type;
+ return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
}
function checkVariableLikeDeclaration(node) {
checkDecorators(node);
checkSourceElement(node.type);
- if (node.name.kind === 140) {
+ if (node.name.kind === 141) {
checkComputedPropertyName(node.name);
if (node.initializer) {
checkExpressionCached(node.initializer);
}
}
- if (node.kind === 169) {
- if (node.propertyName && node.propertyName.kind === 140) {
+ if (node.kind === 170) {
+ if (node.propertyName && node.propertyName.kind === 141) {
checkComputedPropertyName(node.propertyName);
}
var parent_13 = node.parent.parent;
@@ -30517,12 +31833,12 @@ var ts;
if (ts.isBindingPattern(node.name)) {
ts.forEach(node.name.elements, checkSourceElement);
}
- if (node.initializer && ts.getRootDeclaration(node).kind === 142 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
+ if (node.initializer && ts.getRootDeclaration(node).kind === 143 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
return;
}
if (ts.isBindingPattern(node.name)) {
- if (node.initializer && node.parent.parent.kind !== 207) {
+ if (node.initializer && node.parent.parent.kind !== 208) {
checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined);
checkParameterInitializer(node);
}
@@ -30531,7 +31847,7 @@ var ts;
var symbol = getSymbolOfNode(node);
var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol));
if (node === symbol.valueDeclaration) {
- if (node.initializer && node.parent.parent.kind !== 207) {
+ if (node.initializer && node.parent.parent.kind !== 208) {
checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined);
checkParameterInitializer(node);
}
@@ -30549,9 +31865,9 @@ var ts;
error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));
}
}
- if (node.kind !== 145 && node.kind !== 144) {
+ if (node.kind !== 146 && node.kind !== 145) {
checkExportsOnMergedDeclarations(node);
- if (node.kind === 218 || node.kind === 169) {
+ if (node.kind === 219 || node.kind === 170) {
checkVarDeclaredNamesNotShadowed(node);
}
checkCollisionWithCapturedSuperVariable(node, node.name);
@@ -30561,8 +31877,8 @@ var ts;
}
}
function areDeclarationFlagsIdentical(left, right) {
- if ((left.kind === 142 && right.kind === 218) ||
- (left.kind === 218 && right.kind === 142)) {
+ if ((left.kind === 143 && right.kind === 219) ||
+ (left.kind === 219 && right.kind === 143)) {
return true;
}
if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) {
@@ -30589,7 +31905,7 @@ var ts;
ts.forEach(node.declarationList.declarations, checkSourceElement);
}
function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) {
- if (node.modifiers && node.parent.kind === 171) {
+ if (node.modifiers && node.parent.kind === 172) {
if (ts.isAsyncFunctionLike(node)) {
if (node.modifiers.length > 1) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);
@@ -30608,7 +31924,7 @@ var ts;
checkGrammarStatementInAmbientContext(node);
checkExpression(node.expression);
checkSourceElement(node.thenStatement);
- if (node.thenStatement.kind === 201) {
+ if (node.thenStatement.kind === 202) {
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
}
checkSourceElement(node.elseStatement);
@@ -30625,12 +31941,12 @@ var ts;
}
function checkForStatement(node) {
if (!checkGrammarStatementInAmbientContext(node)) {
- if (node.initializer && node.initializer.kind === 219) {
+ if (node.initializer && node.initializer.kind === 220) {
checkGrammarVariableDeclarationList(node.initializer);
}
}
if (node.initializer) {
- if (node.initializer.kind === 219) {
+ if (node.initializer.kind === 220) {
ts.forEach(node.initializer.declarations, checkVariableDeclaration);
}
else {
@@ -30648,13 +31964,13 @@ var ts;
}
function checkForOfStatement(node) {
checkGrammarForInOrForOfStatement(node);
- if (node.initializer.kind === 219) {
+ if (node.initializer.kind === 220) {
checkForInOrForOfVariableDeclaration(node);
}
else {
var varExpr = node.initializer;
var iteratedType = checkRightHandSideOfForOf(node.expression);
- if (varExpr.kind === 170 || varExpr.kind === 171) {
+ if (varExpr.kind === 171 || varExpr.kind === 172) {
checkDestructuringAssignment(varExpr, iteratedType || unknownType);
}
else {
@@ -30672,7 +31988,7 @@ var ts;
}
function checkForInStatement(node) {
checkGrammarForInOrForOfStatement(node);
- if (node.initializer.kind === 219) {
+ if (node.initializer.kind === 220) {
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);
@@ -30682,7 +31998,7 @@ var ts;
else {
var varExpr = node.initializer;
var leftType = checkExpression(varExpr);
- if (varExpr.kind === 170 || varExpr.kind === 171) {
+ if (varExpr.kind === 171 || varExpr.kind === 172) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34)) {
@@ -30855,7 +32171,7 @@ var ts;
checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node);
}
function isGetAccessorWithAnnotatedSetAccessor(node) {
- return !!(node.kind === 149 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 150)));
+ return !!(node.kind === 150 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 151)));
}
function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType;
@@ -30877,12 +32193,12 @@ var ts;
if (func.asteriskToken) {
return;
}
- if (func.kind === 150) {
+ if (func.kind === 151) {
if (node.expression) {
error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value);
}
}
- else if (func.kind === 148) {
+ else if (func.kind === 149) {
if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) {
error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
}
@@ -30900,7 +32216,7 @@ var ts;
}
}
}
- else if (func.kind !== 148 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) {
+ else if (func.kind !== 149 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) {
error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);
}
}
@@ -30957,7 +32273,7 @@ var ts;
if (ts.isFunctionLike(current)) {
break;
}
- if (current.kind === 214 && current.label.text === node.label.text) {
+ if (current.kind === 215 && 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;
@@ -30983,7 +32299,7 @@ var ts;
var catchClause = node.catchClause;
if (catchClause) {
if (catchClause.variableDeclaration) {
- if (catchClause.variableDeclaration.name.kind !== 69) {
+ if (catchClause.variableDeclaration.name.kind !== 70) {
grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier);
}
else if (catchClause.variableDeclaration.type) {
@@ -31051,7 +32367,7 @@ var ts;
return;
}
var errorNode;
- if (prop.valueDeclaration.name.kind === 140 || prop.parent === containingType.symbol) {
+ if (prop.valueDeclaration.name.kind === 141 || prop.parent === containingType.symbol) {
errorNode = prop.valueDeclaration;
}
else if (indexDeclaration) {
@@ -31102,7 +32418,7 @@ var ts;
var firstDecl;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 221 || declaration.kind === 222) {
+ if (declaration.kind === 222 || declaration.kind === 223) {
if (!firstDecl) {
firstDecl = declaration;
}
@@ -31239,7 +32555,7 @@ var ts;
if (derived === base) {
var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol);
if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128))) {
- if (derivedClassDecl.kind === 192) {
+ if (derivedClassDecl.kind === 193) {
error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
@@ -31283,7 +32599,7 @@ var ts;
}
}
function isAccessor(kind) {
- return kind === 149 || kind === 150;
+ return kind === 150 || kind === 151;
}
function areTypeParametersIdentical(list1, list2) {
if (!list1 && !list2) {
@@ -31350,7 +32666,7 @@ var ts;
checkExportsOnMergedDeclarations(node);
var symbol = getSymbolOfNode(node);
checkTypeParameterListsIdentical(node, symbol);
- var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 222);
+ var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 223);
if (node === firstInterfaceDecl) {
var type = getDeclaredTypeOfSymbol(symbol);
var typeWithThis = getTypeWithThisArgument(type);
@@ -31445,18 +32761,18 @@ var ts;
return value;
function evalConstant(e) {
switch (e.kind) {
- case 185:
+ case 186:
var value_1 = evalConstant(e.operand);
if (value_1 === undefined) {
return undefined;
}
switch (e.operator) {
- case 35: return value_1;
- case 36: return -value_1;
- case 50: return ~value_1;
+ case 36: return value_1;
+ case 37: return -value_1;
+ case 51: return ~value_1;
}
return undefined;
- case 187:
+ case 188:
var left = evalConstant(e.left);
if (left === undefined) {
return undefined;
@@ -31466,37 +32782,37 @@ var ts;
return undefined;
}
switch (e.operatorToken.kind) {
- case 47: return left | right;
- case 46: return left & right;
- case 44: return left >> right;
- case 45: return left >>> right;
- case 43: return left << right;
- case 48: return left ^ right;
- case 37: return left * right;
- case 39: return left / right;
- case 35: return left + right;
- case 36: return left - right;
- case 40: return left % right;
+ case 48: return left | right;
+ case 47: return left & right;
+ case 45: return left >> right;
+ case 46: return left >>> right;
+ case 44: return left << right;
+ case 49: return left ^ right;
+ case 38: return left * right;
+ case 40: return left / right;
+ case 36: return left + right;
+ case 37: return left - right;
+ case 41: return left % right;
}
return undefined;
case 8:
return +e.text;
- case 178:
+ case 179:
return evalConstant(e.expression);
- case 69:
+ case 70:
+ case 174:
case 173:
- case 172:
var member = initializer.parent;
var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent));
var enumType_1;
var propertyName = void 0;
- if (e.kind === 69) {
+ if (e.kind === 70) {
enumType_1 = currentType;
propertyName = e.text;
}
else {
var expression = void 0;
- if (e.kind === 173) {
+ if (e.kind === 174) {
if (e.argumentExpression === undefined ||
e.argumentExpression.kind !== 9) {
return undefined;
@@ -31510,10 +32826,10 @@ var ts;
}
var current = expression;
while (current) {
- if (current.kind === 69) {
+ if (current.kind === 70) {
break;
}
- else if (current.kind === 172) {
+ else if (current.kind === 173) {
current = current.expression;
}
else {
@@ -31573,7 +32889,7 @@ var ts;
}
var seenEnumMissingInitialInitializer_1 = false;
ts.forEach(enumSymbol.declarations, function (declaration) {
- if (declaration.kind !== 224) {
+ if (declaration.kind !== 225) {
return false;
}
var enumDeclaration = declaration;
@@ -31596,8 +32912,8 @@ var ts;
var declarations = symbol.declarations;
for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
var declaration = declarations_5[_i];
- if ((declaration.kind === 221 ||
- (declaration.kind === 220 && ts.nodeIsPresent(declaration.body))) &&
+ if ((declaration.kind === 222 ||
+ (declaration.kind === 221 && ts.nodeIsPresent(declaration.body))) &&
!ts.isInAmbientContext(declaration)) {
return declaration;
}
@@ -31656,7 +32972,7 @@ var ts;
error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
}
}
- var mergedClass = ts.getDeclarationOfKind(symbol, 221);
+ var mergedClass = ts.getDeclarationOfKind(symbol, 222);
if (mergedClass &&
inSameLexicalScope(node, mergedClass)) {
getNodeLinks(node).flags |= 32768;
@@ -31699,22 +33015,22 @@ var ts;
}
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
switch (node.kind) {
- case 200:
+ case 201:
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
checkModuleAugmentationElement(decl, isGlobalAugmentation);
}
break;
- case 235:
case 236:
+ case 237:
grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
- case 229:
case 230:
+ case 231:
grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
- case 169:
- case 218:
+ case 170:
+ case 219:
var name_22 = node.name;
if (ts.isBindingPattern(name_22)) {
for (var _b = 0, _c = name_22.elements; _b < _c.length; _b++) {
@@ -31723,12 +33039,12 @@ var ts;
}
break;
}
- case 221:
- case 224:
- case 220:
case 222:
case 225:
+ case 221:
case 223:
+ case 226:
+ case 224:
if (isGlobalAugmentation) {
return;
}
@@ -31744,17 +33060,17 @@ var ts;
}
function getFirstIdentifier(node) {
switch (node.kind) {
- case 69:
+ case 70:
return node;
- case 139:
+ case 140:
do {
node = node.left;
- } while (node.kind !== 69);
+ } while (node.kind !== 70);
return node;
- case 172:
+ case 173:
do {
node = node.expression;
- } while (node.kind !== 69);
+ } while (node.kind !== 70);
return node;
}
}
@@ -31764,9 +33080,9 @@ var ts;
error(moduleName, ts.Diagnostics.String_literal_expected);
return false;
}
- var inAmbientExternalModule = node.parent.kind === 226 && ts.isAmbientModule(node.parent.parent);
+ var inAmbientExternalModule = node.parent.kind === 227 && ts.isAmbientModule(node.parent.parent);
if (node.parent.kind !== 256 && !inAmbientExternalModule) {
- error(moduleName, node.kind === 236 ?
+ error(moduleName, node.kind === 237 ?
ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
return false;
@@ -31787,7 +33103,7 @@ var ts;
(symbol.flags & 793064 ? 793064 : 0) |
(symbol.flags & 1920 ? 1920 : 0);
if (target.flags & excludedMeanings) {
- var message = node.kind === 238 ?
+ var message = node.kind === 239 ?
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));
@@ -31814,7 +33130,7 @@ var ts;
checkImportBinding(importClause);
}
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 232) {
+ if (importClause.namedBindings.kind === 233) {
checkImportBinding(importClause.namedBindings);
}
else {
@@ -31849,7 +33165,7 @@ var ts;
}
}
else {
- if (modulekind === ts.ModuleKind.ES6 && !ts.isInAmbientContext(node)) {
+ if (modulekind === ts.ModuleKind.ES2015 && !ts.isInAmbientContext(node)) {
grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
}
}
@@ -31865,7 +33181,7 @@ var ts;
if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {
if (node.exportClause) {
ts.forEach(node.exportClause.elements, checkExportSpecifier);
- var inAmbientExternalModule = node.parent.kind === 226 && ts.isAmbientModule(node.parent.parent);
+ var inAmbientExternalModule = node.parent.kind === 227 && ts.isAmbientModule(node.parent.parent);
if (node.parent.kind !== 256 && !inAmbientExternalModule) {
error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
}
@@ -31879,7 +33195,7 @@ var ts;
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
- var isInAppropriateContext = node.parent.kind === 256 || node.parent.kind === 226 || node.parent.kind === 225;
+ var isInAppropriateContext = node.parent.kind === 256 || node.parent.kind === 227 || node.parent.kind === 226;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
@@ -31903,14 +33219,14 @@ var ts;
return;
}
var container = node.parent.kind === 256 ? node.parent : node.parent.parent;
- if (container.kind === 225 && !ts.isAmbientModule(container)) {
+ if (container.kind === 226 && !ts.isAmbientModule(container)) {
error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
return;
}
if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) {
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
- if (node.expression.kind === 69) {
+ if (node.expression.kind === 70) {
markExportAsReferenced(node);
}
else {
@@ -31918,7 +33234,7 @@ var ts;
}
checkExternalModuleExports(container);
if (node.isExportEquals && !ts.isInAmbientContext(node)) {
- if (modulekind === ts.ModuleKind.ES6) {
+ if (modulekind === ts.ModuleKind.ES2015) {
grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead);
}
else if (modulekind === ts.ModuleKind.System) {
@@ -31970,7 +33286,7 @@ var ts;
links.exportsChecked = true;
}
function isNotOverload(declaration) {
- return (declaration.kind !== 220 && declaration.kind !== 147) ||
+ return (declaration.kind !== 221 && declaration.kind !== 148) ||
!!declaration.body;
}
}
@@ -31981,118 +33297,118 @@ var ts;
var kind = node.kind;
if (cancellationToken) {
switch (kind) {
- case 225:
- case 221:
+ case 226:
case 222:
- case 220:
+ case 223:
+ case 221:
cancellationToken.throwIfCancellationRequested();
}
}
switch (kind) {
- case 141:
- return checkTypeParameter(node);
case 142:
+ return checkTypeParameter(node);
+ case 143:
return checkParameter(node);
+ case 146:
case 145:
- case 144:
return checkPropertyDeclaration(node);
- case 156:
case 157:
- case 151:
+ case 158:
case 152:
- return checkSignatureDeclaration(node);
case 153:
return checkSignatureDeclaration(node);
+ case 154:
+ return checkSignatureDeclaration(node);
+ case 148:
case 147:
- case 146:
return checkMethodDeclaration(node);
- case 148:
- return checkConstructorDeclaration(node);
case 149:
+ return checkConstructorDeclaration(node);
case 150:
+ case 151:
return checkAccessorDeclaration(node);
- case 155:
+ case 156:
return checkTypeReferenceNode(node);
- case 154:
+ case 155:
return checkTypePredicate(node);
- case 158:
- return checkTypeQuery(node);
case 159:
- return checkTypeLiteral(node);
+ return checkTypeQuery(node);
case 160:
- return checkArrayType(node);
+ return checkTypeLiteral(node);
case 161:
- return checkTupleType(node);
+ return checkArrayType(node);
case 162:
+ return checkTupleType(node);
case 163:
- return checkUnionOrIntersectionType(node);
case 164:
+ return checkUnionOrIntersectionType(node);
+ case 165:
return checkSourceElement(node.type);
- case 220:
+ case 221:
return checkFunctionDeclaration(node);
- case 199:
- case 226:
- return checkBlock(node);
case 200:
+ case 227:
+ return checkBlock(node);
+ case 201:
return checkVariableStatement(node);
- case 202:
- return checkExpressionStatement(node);
case 203:
- return checkIfStatement(node);
+ return checkExpressionStatement(node);
case 204:
- return checkDoStatement(node);
+ return checkIfStatement(node);
case 205:
- return checkWhileStatement(node);
+ return checkDoStatement(node);
case 206:
- return checkForStatement(node);
+ return checkWhileStatement(node);
case 207:
- return checkForInStatement(node);
+ return checkForStatement(node);
case 208:
- return checkForOfStatement(node);
+ return checkForInStatement(node);
case 209:
+ return checkForOfStatement(node);
case 210:
- return checkBreakOrContinueStatement(node);
case 211:
- return checkReturnStatement(node);
+ return checkBreakOrContinueStatement(node);
case 212:
- return checkWithStatement(node);
+ return checkReturnStatement(node);
case 213:
- return checkSwitchStatement(node);
+ return checkWithStatement(node);
case 214:
- return checkLabeledStatement(node);
+ return checkSwitchStatement(node);
case 215:
- return checkThrowStatement(node);
+ return checkLabeledStatement(node);
case 216:
+ return checkThrowStatement(node);
+ case 217:
return checkTryStatement(node);
- case 218:
+ case 219:
return checkVariableDeclaration(node);
- case 169:
+ case 170:
return checkBindingElement(node);
- case 221:
- return checkClassDeclaration(node);
case 222:
- return checkInterfaceDeclaration(node);
+ return checkClassDeclaration(node);
case 223:
- return checkTypeAliasDeclaration(node);
+ return checkInterfaceDeclaration(node);
case 224:
- return checkEnumDeclaration(node);
+ return checkTypeAliasDeclaration(node);
case 225:
+ return checkEnumDeclaration(node);
+ case 226:
return checkModuleDeclaration(node);
- case 230:
+ case 231:
return checkImportDeclaration(node);
- case 229:
+ case 230:
return checkImportEqualsDeclaration(node);
- case 236:
+ case 237:
return checkExportDeclaration(node);
- case 235:
+ case 236:
return checkExportAssignment(node);
- case 201:
+ case 202:
checkGrammarStatementInAmbientContext(node);
return;
- case 217:
+ case 218:
checkGrammarStatementInAmbientContext(node);
return;
- case 239:
+ case 240:
return checkMissingDeclaration(node);
}
}
@@ -32105,17 +33421,17 @@ var ts;
for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) {
var node = deferredNodes_1[_i];
switch (node.kind) {
- case 179:
case 180:
+ case 181:
+ case 148:
case 147:
- case 146:
checkFunctionExpressionOrObjectLiteralMethodDeferred(node);
break;
- case 149:
case 150:
+ case 151:
checkAccessorDeferred(node);
break;
- case 192:
+ case 193:
checkClassExpressionDeferred(node);
break;
}
@@ -32187,7 +33503,7 @@ var ts;
function isInsideWithStatementBody(node) {
if (node) {
while (node.parent) {
- if (node.parent.kind === 212 && node.parent.statement === node) {
+ if (node.parent.kind === 213 && node.parent.statement === node) {
return true;
}
node = node.parent;
@@ -32213,24 +33529,24 @@ var ts;
if (!ts.isExternalOrCommonJsModule(location)) {
break;
}
- case 225:
+ case 226:
copySymbols(getSymbolOfNode(location).exports, meaning & 8914931);
break;
- case 224:
+ case 225:
copySymbols(getSymbolOfNode(location).exports, meaning & 8);
break;
- case 192:
+ case 193:
var className = location.name;
if (className) {
copySymbol(location.symbol, meaning);
}
- case 221:
case 222:
+ case 223:
if (!(memberFlags & 32)) {
copySymbols(getSymbolOfNode(location).members, meaning & 793064);
}
break;
- case 179:
+ case 180:
var funcName = location.name;
if (funcName) {
copySymbol(location.symbol, meaning);
@@ -32263,33 +33579,33 @@ var ts;
}
}
function isTypeDeclarationName(name) {
- return name.kind === 69 &&
+ return name.kind === 70 &&
isTypeDeclaration(name.parent) &&
name.parent.name === name;
}
function isTypeDeclaration(node) {
switch (node.kind) {
- case 141:
- case 221:
+ case 142:
case 222:
case 223:
case 224:
+ case 225:
return true;
}
}
function isTypeReferenceIdentifier(entityName) {
var node = entityName;
- while (node.parent && node.parent.kind === 139) {
+ while (node.parent && node.parent.kind === 140) {
node = node.parent;
}
- return node.parent && (node.parent.kind === 155 || node.parent.kind === 267);
+ return node.parent && (node.parent.kind === 156 || node.parent.kind === 267);
}
function isHeritageClauseElementIdentifier(entityName) {
var node = entityName;
- while (node.parent && node.parent.kind === 172) {
+ while (node.parent && node.parent.kind === 173) {
node = node.parent;
}
- return node.parent && node.parent.kind === 194;
+ return node.parent && node.parent.kind === 195;
}
function forEachEnclosingClass(node, callback) {
var result;
@@ -32306,13 +33622,13 @@ var ts;
return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });
}
function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {
- while (nodeOnRightSide.parent.kind === 139) {
+ while (nodeOnRightSide.parent.kind === 140) {
nodeOnRightSide = nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 229) {
+ if (nodeOnRightSide.parent.kind === 230) {
return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 235) {
+ if (nodeOnRightSide.parent.kind === 236) {
return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent;
}
return undefined;
@@ -32324,7 +33640,7 @@ var ts;
if (ts.isDeclarationName(entityName)) {
return getSymbolOfNode(entityName.parent);
}
- if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 172) {
+ if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 173) {
var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent);
switch (specialPropertyAssignmentKind) {
case 1:
@@ -32336,20 +33652,20 @@ var ts;
default:
}
}
- if (entityName.parent.kind === 235 && ts.isEntityNameExpression(entityName)) {
+ if (entityName.parent.kind === 236 && ts.isEntityNameExpression(entityName)) {
return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608);
}
- if (entityName.kind !== 172 && isInRightSideOfImportOrExportAssignment(entityName)) {
- var importEqualsDeclaration = ts.getAncestor(entityName, 229);
+ if (entityName.kind !== 173 && isInRightSideOfImportOrExportAssignment(entityName)) {
+ var importEqualsDeclaration = ts.getAncestor(entityName, 230);
ts.Debug.assert(importEqualsDeclaration !== undefined);
- return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importEqualsDeclaration, true);
+ return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true);
}
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
if (isHeritageClauseElementIdentifier(entityName)) {
var meaning = 0;
- if (entityName.parent.kind === 194) {
+ if (entityName.parent.kind === 195) {
meaning = 793064;
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
meaning |= 107455;
@@ -32365,20 +33681,20 @@ var ts;
if (ts.nodeIsMissing(entityName)) {
return undefined;
}
- if (entityName.kind === 69) {
+ if (entityName.kind === 70) {
if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) {
return getIntrinsicTagSymbol(entityName.parent);
}
return resolveEntityName(entityName, 107455, false, true);
}
- else if (entityName.kind === 172) {
+ else if (entityName.kind === 173) {
var symbol = getNodeLinks(entityName).resolvedSymbol;
if (!symbol) {
checkPropertyAccessExpression(entityName);
}
return getNodeLinks(entityName).resolvedSymbol;
}
- else if (entityName.kind === 139) {
+ else if (entityName.kind === 140) {
var symbol = getNodeLinks(entityName).resolvedSymbol;
if (!symbol) {
checkQualifiedName(entityName);
@@ -32387,13 +33703,13 @@ var ts;
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = (entityName.parent.kind === 155 || entityName.parent.kind === 267) ? 793064 : 1920;
+ var meaning = (entityName.parent.kind === 156 || entityName.parent.kind === 267) ? 793064 : 1920;
return resolveEntityName(entityName, meaning, false, true);
}
else if (entityName.parent.kind === 246) {
return getJsxAttributePropertySymbol(entityName.parent);
}
- if (entityName.parent.kind === 154) {
+ if (entityName.parent.kind === 155) {
return resolveEntityName(entityName, 1);
}
return undefined;
@@ -32411,12 +33727,12 @@ var ts;
else if (ts.isLiteralComputedPropertyDeclarationName(node)) {
return getSymbolOfNode(node.parent.parent);
}
- if (node.kind === 69) {
+ if (node.kind === 70) {
if (isInRightSideOfImportOrExportAssignment(node)) {
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
}
- else if (node.parent.kind === 169 &&
- node.parent.parent.kind === 167 &&
+ else if (node.parent.kind === 170 &&
+ node.parent.parent.kind === 168 &&
node === node.parent.propertyName) {
var typeOfPattern = getTypeOfNode(node.parent.parent);
var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text);
@@ -32426,11 +33742,11 @@ var ts;
}
}
switch (node.kind) {
- case 69:
- case 172:
- case 139:
+ case 70:
+ case 173:
+ case 140:
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
- case 97:
+ case 98:
var container = ts.getThisContainer(node, false);
if (ts.isFunctionLike(container)) {
var sig = getSignatureFromDeclaration(container);
@@ -32438,21 +33754,21 @@ var ts;
return sig.thisParameter;
}
}
- case 95:
+ case 96:
var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node);
return type.symbol;
- case 165:
+ case 166:
return getTypeFromTypeNode(node).symbol;
- case 121:
+ case 122:
var constructorDeclaration = node.parent;
- if (constructorDeclaration && constructorDeclaration.kind === 148) {
+ if (constructorDeclaration && constructorDeclaration.kind === 149) {
return constructorDeclaration.parent.symbol;
}
return undefined;
case 9:
if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) &&
ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
- ((node.parent.kind === 230 || node.parent.kind === 236) &&
+ ((node.parent.kind === 231 || node.parent.kind === 237) &&
node.parent.moduleSpecifier === node)) {
return resolveExternalModuleName(node, node);
}
@@ -32460,7 +33776,7 @@ var ts;
return resolveExternalModuleName(node, node);
}
case 8:
- if (node.parent.kind === 173 && node.parent.argumentExpression === node) {
+ if (node.parent.kind === 174 && node.parent.argumentExpression === node) {
var objectType = checkExpression(node.parent.expression);
if (objectType === unknownType)
return undefined;
@@ -32524,12 +33840,12 @@ var ts;
return unknownType;
}
function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {
- ts.Debug.assert(expr.kind === 171 || expr.kind === 170);
- if (expr.parent.kind === 208) {
+ ts.Debug.assert(expr.kind === 172 || expr.kind === 171);
+ if (expr.parent.kind === 209) {
var iteratedType = checkRightHandSideOfForOf(expr.parent.expression);
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
- if (expr.parent.kind === 187) {
+ if (expr.parent.kind === 188) {
var iteratedType = checkExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
@@ -32537,7 +33853,7 @@ var ts;
var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);
return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent);
}
- ts.Debug.assert(expr.parent.kind === 170);
+ ts.Debug.assert(expr.parent.kind === 171);
var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);
var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType;
return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType);
@@ -32678,7 +33994,7 @@ var ts;
else if (nodeLinks_1.flags & 131072) {
var isDeclaredInLoop = nodeLinks_1.flags & 262144;
var inLoopInitializer = ts.isIterationStatement(container, false);
- var inLoopBodyBlock = container.kind === 199 && ts.isIterationStatement(container.parent, false);
+ var inLoopBodyBlock = container.kind === 200 && ts.isIterationStatement(container.parent, false);
links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));
}
else {
@@ -32718,18 +34034,18 @@ var ts;
return true;
}
switch (node.kind) {
- case 229:
- case 231:
+ case 230:
case 232:
- case 234:
- case 238:
+ case 233:
+ case 235:
+ case 239:
return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);
- case 236:
+ case 237:
var exportClause = node.exportClause;
return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration);
- case 235:
+ case 236:
return node.expression
- && node.expression.kind === 69
+ && node.expression.kind === 70
? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)
: true;
}
@@ -32961,7 +34277,7 @@ var ts;
if (!fileToDirective) {
return undefined;
}
- var meaning = (node.kind === 172) || (node.kind === 69 && isInTypeQuery(node))
+ var meaning = (node.kind === 173) || (node.kind === 70 && isInTypeQuery(node))
? 107455 | 1048576
: 793064 | 1920;
var symbol = resolveEntityName(node, meaning, true);
@@ -33108,6 +34424,7 @@ var ts;
getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; });
}
anyArrayType = createArrayType(anyType);
+ autoArrayType = createArrayType(autoType);
var symbol = getGlobalSymbol("ReadonlyArray", 793064, undefined);
globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1);
anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;
@@ -33167,14 +34484,14 @@ var ts;
return false;
}
if (!ts.nodeCanBeDecorated(node)) {
- if (node.kind === 147 && !ts.nodeIsPresent(node.body)) {
+ if (node.kind === 148 && !ts.nodeIsPresent(node.body)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);
}
else {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);
}
}
- else if (node.kind === 149 || node.kind === 150) {
+ else if (node.kind === 150 || node.kind === 151) {
var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
@@ -33191,28 +34508,28 @@ var ts;
var flags = 0;
for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 128) {
- if (node.kind === 144 || node.kind === 146) {
+ if (modifier.kind !== 129) {
+ if (node.kind === 145 || node.kind === 147) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));
}
- if (node.kind === 153) {
+ if (node.kind === 154) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));
}
}
switch (modifier.kind) {
- case 74:
- if (node.kind !== 224 && node.parent.kind === 221) {
- return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74));
+ case 75:
+ if (node.kind !== 225 && node.parent.kind === 222) {
+ return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75));
}
break;
+ case 113:
case 112:
case 111:
- case 110:
var text = visibilityToString(ts.modifierToFlag(modifier.kind));
- if (modifier.kind === 111) {
+ if (modifier.kind === 112) {
lastProtected = modifier;
}
- else if (modifier.kind === 110) {
+ else if (modifier.kind === 111) {
lastPrivate = modifier;
}
if (flags & 28) {
@@ -33227,11 +34544,11 @@ var ts;
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
}
- else if (node.parent.kind === 226 || node.parent.kind === 256) {
+ else if (node.parent.kind === 227 || node.parent.kind === 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
}
else if (flags & 128) {
- if (modifier.kind === 110) {
+ if (modifier.kind === 111) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract");
}
else {
@@ -33240,7 +34557,7 @@ var ts;
}
flags |= ts.modifierToFlag(modifier.kind);
break;
- case 113:
+ case 114:
if (flags & 32) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static");
}
@@ -33250,10 +34567,10 @@ var ts;
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
}
- else if (node.parent.kind === 226 || node.parent.kind === 256) {
+ else if (node.parent.kind === 227 || node.parent.kind === 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
}
- else if (node.kind === 142) {
+ else if (node.kind === 143) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
}
else if (flags & 128) {
@@ -33262,17 +34579,17 @@ var ts;
flags |= 32;
lastStatic = modifier;
break;
- case 128:
+ case 129:
if (flags & 64) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly");
}
- else if (node.kind !== 145 && node.kind !== 144 && node.kind !== 153 && node.kind !== 142) {
+ else if (node.kind !== 146 && node.kind !== 145 && node.kind !== 154 && node.kind !== 143) {
return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
}
flags |= 64;
lastReadonly = modifier;
break;
- case 82:
+ case 83:
if (flags & 1) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export");
}
@@ -33285,45 +34602,45 @@ var ts;
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
}
- else if (node.parent.kind === 221) {
+ else if (node.parent.kind === 222) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
}
- else if (node.kind === 142) {
+ else if (node.kind === 143) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
}
flags |= 1;
break;
- case 122:
+ case 123:
if (flags & 2) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare");
}
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.parent.kind === 221) {
+ else if (node.parent.kind === 222) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
}
- else if (node.kind === 142) {
+ else if (node.kind === 143) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
}
- else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 226) {
+ else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 227) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
}
flags |= 2;
lastDeclare = modifier;
break;
- case 115:
+ case 116:
if (flags & 128) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract");
}
- if (node.kind !== 221) {
- if (node.kind !== 147 &&
- node.kind !== 145 &&
- node.kind !== 149 &&
- node.kind !== 150) {
+ if (node.kind !== 222) {
+ if (node.kind !== 148 &&
+ node.kind !== 146 &&
+ node.kind !== 150 &&
+ node.kind !== 151) {
return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
}
- if (!(node.parent.kind === 221 && ts.getModifierFlags(node.parent) & 128)) {
+ if (!(node.parent.kind === 222 && ts.getModifierFlags(node.parent) & 128)) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
}
if (flags & 32) {
@@ -33335,14 +34652,14 @@ var ts;
}
flags |= 128;
break;
- case 118:
+ case 119:
if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
}
else if (flags & 2 || ts.isInAmbientContext(node.parent)) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.kind === 142) {
+ else if (node.kind === 143) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
}
flags |= 256;
@@ -33350,7 +34667,7 @@ var ts;
break;
}
}
- if (node.kind === 148) {
+ if (node.kind === 149) {
if (flags & 32) {
return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
}
@@ -33365,13 +34682,13 @@ var ts;
}
return;
}
- else if ((node.kind === 230 || node.kind === 229) && flags & 2) {
+ else if ((node.kind === 231 || node.kind === 230) && flags & 2) {
return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
}
- else if (node.kind === 142 && (flags & 92) && ts.isBindingPattern(node.name)) {
+ else if (node.kind === 143 && (flags & 92) && ts.isBindingPattern(node.name)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
}
- else if (node.kind === 142 && (flags & 92) && node.dotDotDotToken) {
+ else if (node.kind === 143 && (flags & 92) && node.dotDotDotToken) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
}
if (flags & 256) {
@@ -33387,38 +34704,38 @@ var ts;
}
function shouldReportBadModifier(node) {
switch (node.kind) {
- case 149:
case 150:
- case 148:
+ case 151:
+ case 149:
+ case 146:
case 145:
- case 144:
+ case 148:
case 147:
- case 146:
- case 153:
- case 225:
+ case 154:
+ case 226:
+ case 231:
case 230:
- case 229:
+ case 237:
case 236:
- case 235:
- case 179:
case 180:
- case 142:
+ case 181:
+ case 143:
return false;
default:
- if (node.parent.kind === 226 || node.parent.kind === 256) {
+ if (node.parent.kind === 227 || node.parent.kind === 256) {
return false;
}
switch (node.kind) {
- case 220:
- return nodeHasAnyModifiersExcept(node, 118);
case 221:
- return nodeHasAnyModifiersExcept(node, 115);
+ return nodeHasAnyModifiersExcept(node, 119);
case 222:
- case 200:
+ return nodeHasAnyModifiersExcept(node, 116);
case 223:
- return true;
+ case 201:
case 224:
- return nodeHasAnyModifiersExcept(node, 74);
+ return true;
+ case 225:
+ return nodeHasAnyModifiersExcept(node, 75);
default:
ts.Debug.fail();
return false;
@@ -33430,10 +34747,10 @@ var ts;
}
function checkGrammarAsyncModifier(node, asyncModifier) {
switch (node.kind) {
- case 147:
- case 220:
- case 179:
+ case 148:
+ case 221:
case 180:
+ case 181:
if (!node.asteriskToken) {
return false;
}
@@ -33449,7 +34766,7 @@ var ts;
return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Trailing_comma_not_allowed);
}
}
- function checkGrammarTypeParameterList(node, typeParameters, file) {
+ function checkGrammarTypeParameterList(typeParameters, file) {
if (checkGrammarForDisallowedTrailingComma(typeParameters)) {
return true;
}
@@ -33491,11 +34808,11 @@ var ts;
}
function checkGrammarFunctionLikeDeclaration(node) {
var file = ts.getSourceFileOfNode(node);
- return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) ||
+ return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) ||
checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);
}
function checkGrammarArrowFunction(node, file) {
- if (node.kind === 180) {
+ if (node.kind === 181) {
var arrowFunction = node;
var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line;
@@ -33530,7 +34847,7 @@ var ts;
if (!parameter.type) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
- if (parameter.type.kind !== 132 && parameter.type.kind !== 130) {
+ if (parameter.type.kind !== 133 && parameter.type.kind !== 131) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);
}
if (!node.type) {
@@ -33557,7 +34874,7 @@ var ts;
var sourceFile = ts.getSourceFileOfNode(node);
for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
var arg = args_4[_i];
- if (arg.kind === 193) {
+ if (arg.kind === 194) {
return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
}
}
@@ -33583,7 +34900,7 @@ var ts;
if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 83) {
+ if (heritageClause.token === 84) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
@@ -33596,7 +34913,7 @@ var ts;
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 106);
+ ts.Debug.assert(heritageClause.token === 107);
if (seenImplementsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);
}
@@ -33611,14 +34928,14 @@ var ts;
if (node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 83) {
+ if (heritageClause.token === 84) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 106);
+ ts.Debug.assert(heritageClause.token === 107);
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);
}
checkGrammarHeritageClause(heritageClause);
@@ -33627,19 +34944,19 @@ var ts;
return false;
}
function checkGrammarComputedPropertyName(node) {
- if (node.kind !== 140) {
+ if (node.kind !== 141) {
return false;
}
var computedPropertyName = node;
- if (computedPropertyName.expression.kind === 187 && computedPropertyName.expression.operatorToken.kind === 24) {
+ if (computedPropertyName.expression.kind === 188 && computedPropertyName.expression.operatorToken.kind === 25) {
return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
}
}
function checkGrammarForGenerator(node) {
if (node.asteriskToken) {
- ts.Debug.assert(node.kind === 220 ||
- node.kind === 179 ||
- node.kind === 147);
+ ts.Debug.assert(node.kind === 221 ||
+ node.kind === 180 ||
+ node.kind === 148);
if (ts.isInAmbientContext(node)) {
return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
}
@@ -33651,7 +34968,7 @@ var ts;
}
}
}
- function checkGrammarForInvalidQuestionMark(node, questionToken, message) {
+ function checkGrammarForInvalidQuestionMark(questionToken, message) {
if (questionToken) {
return grammarErrorOnNode(questionToken, message);
}
@@ -33665,7 +34982,7 @@ var ts;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
var name_24 = prop.name;
- if (name_24.kind === 140) {
+ if (name_24.kind === 141) {
checkGrammarComputedPropertyName(name_24);
}
if (prop.kind === 254 && !inDestructuring && prop.objectAssignmentInitializer) {
@@ -33674,26 +34991,26 @@ var ts;
if (prop.modifiers) {
for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) {
var mod = _c[_b];
- if (mod.kind !== 118 || prop.kind !== 147) {
+ if (mod.kind !== 119 || prop.kind !== 148) {
grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));
}
}
}
var currentKind = void 0;
if (prop.kind === 253 || prop.kind === 254) {
- checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
+ checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
if (name_24.kind === 8) {
checkGrammarNumericLiteral(name_24);
}
currentKind = Property;
}
- else if (prop.kind === 147) {
+ else if (prop.kind === 148) {
currentKind = Property;
}
- else if (prop.kind === 149) {
+ else if (prop.kind === 150) {
currentKind = GetAccessor;
}
- else if (prop.kind === 150) {
+ else if (prop.kind === 151) {
currentKind = SetAccessor;
}
else {
@@ -33750,7 +35067,7 @@ var ts;
if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {
return true;
}
- if (forInOrOfStatement.initializer.kind === 219) {
+ if (forInOrOfStatement.initializer.kind === 220) {
var variableList = forInOrOfStatement.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
var declarations = variableList.declarations;
@@ -33758,20 +35075,20 @@ var ts;
return false;
}
if (declarations.length > 1) {
- var diagnostic = forInOrOfStatement.kind === 207
+ var diagnostic = forInOrOfStatement.kind === 208
? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
: ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
}
var firstDeclaration = declarations[0];
if (firstDeclaration.initializer) {
- var diagnostic = forInOrOfStatement.kind === 207
+ var diagnostic = forInOrOfStatement.kind === 208
? 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 === 207
+ var diagnostic = forInOrOfStatement.kind === 208
? 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);
@@ -33795,11 +35112,11 @@ var ts;
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 149 ?
+ return grammarErrorOnNode(accessor.name, kind === 150 ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 150) {
+ else if (kind === 151) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
@@ -33818,10 +35135,10 @@ var ts;
}
}
function doesAccessorHaveCorrectParameterCount(accessor) {
- return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 149 ? 0 : 1);
+ return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 150 ? 0 : 1);
}
function getAccessorThisParameter(accessor) {
- if (accessor.parameters.length === (accessor.kind === 149 ? 1 : 2)) {
+ if (accessor.parameters.length === (accessor.kind === 150 ? 1 : 2)) {
return ts.getThisParameter(accessor);
}
}
@@ -33836,8 +35153,8 @@ var ts;
checkGrammarForGenerator(node)) {
return true;
}
- if (node.parent.kind === 171) {
- if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
+ if (node.parent.kind === 172) {
+ if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
return true;
}
else if (node.body === undefined) {
@@ -33852,10 +35169,10 @@ var ts;
return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol);
}
}
- else if (node.parent.kind === 222) {
+ else if (node.parent.kind === 223) {
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 === 159) {
+ else if (node.parent.kind === 160) {
return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol);
}
}
@@ -33866,9 +35183,9 @@ var ts;
return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);
}
switch (current.kind) {
- case 214:
+ case 215:
if (node.label && current.label.text === node.label.text) {
- var isMisplacedContinueLabel = node.kind === 209
+ var isMisplacedContinueLabel = node.kind === 210
&& !ts.isIterationStatement(current.statement, true);
if (isMisplacedContinueLabel) {
return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);
@@ -33876,8 +35193,8 @@ var ts;
return false;
}
break;
- case 213:
- if (node.kind === 210 && !node.label) {
+ case 214:
+ if (node.kind === 211 && !node.label) {
return false;
}
break;
@@ -33890,13 +35207,13 @@ var ts;
current = current.parent;
}
if (node.label) {
- var message = node.kind === 210
+ var message = node.kind === 211
? 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 === 210
+ var message = node.kind === 211
? 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);
@@ -33908,7 +35225,7 @@ var ts;
if (node !== ts.lastOrUndefined(elements)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);
}
- if (node.name.kind === 168 || node.name.kind === 167) {
+ if (node.name.kind === 169 || node.name.kind === 168) {
return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);
}
if (node.initializer) {
@@ -33918,11 +35235,11 @@ var ts;
}
function isStringOrNumberLiteralExpression(expr) {
return expr.kind === 9 || expr.kind === 8 ||
- expr.kind === 185 && expr.operator === 36 &&
+ expr.kind === 186 && expr.operator === 37 &&
expr.operand.kind === 8;
}
function checkGrammarVariableDeclaration(node) {
- if (node.parent.parent.kind !== 207 && node.parent.parent.kind !== 208) {
+ if (node.parent.parent.kind !== 208 && node.parent.parent.kind !== 209) {
if (ts.isInAmbientContext(node)) {
if (node.initializer) {
if (ts.isConst(node) && !node.type) {
@@ -33953,8 +35270,8 @@ var ts;
return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);
}
function checkGrammarNameInLetOrConstDeclarations(name) {
- if (name.kind === 69) {
- if (name.originalKeywordKind === 108) {
+ if (name.kind === 70) {
+ if (name.originalKeywordKind === 109) {
return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);
}
}
@@ -33979,15 +35296,15 @@ var ts;
}
function allowLetAndConstDeclarations(parent) {
switch (parent.kind) {
- case 203:
case 204:
case 205:
- case 212:
case 206:
+ case 213:
case 207:
case 208:
+ case 209:
return false;
- case 214:
+ case 215:
return allowLetAndConstDeclarations(parent.parent);
}
return true;
@@ -34042,7 +35359,7 @@ var ts;
return true;
}
}
- else if (node.parent.kind === 222) {
+ else if (node.parent.kind === 223) {
if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) {
return true;
}
@@ -34050,7 +35367,7 @@ var ts;
return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);
}
}
- else if (node.parent.kind === 159) {
+ else if (node.parent.kind === 160) {
if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) {
return true;
}
@@ -34063,13 +35380,13 @@ var ts;
}
}
function checkGrammarTopLevelElementForRequiredDeclareModifier(node) {
- if (node.kind === 222 ||
- node.kind === 223 ||
+ if (node.kind === 223 ||
+ node.kind === 224 ||
+ node.kind === 231 ||
node.kind === 230 ||
- node.kind === 229 ||
+ node.kind === 237 ||
node.kind === 236 ||
- node.kind === 235 ||
- node.kind === 228 ||
+ node.kind === 229 ||
ts.getModifierFlags(node) & (2 | 1 | 512)) {
return false;
}
@@ -34078,7 +35395,7 @@ var ts;
function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {
for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
var decl = _a[_i];
- if (ts.isDeclaration(decl) || decl.kind === 200) {
+ if (ts.isDeclaration(decl) || decl.kind === 201) {
if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {
return true;
}
@@ -34097,7 +35414,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 === 199 || node.parent.kind === 226 || node.parent.kind === 256) {
+ if (node.parent.kind === 200 || node.parent.kind === 227 || node.parent.kind === 256) {
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);
@@ -34136,46 +35453,46 @@ var ts;
(function (ts) {
;
var nodeEdgeTraversalMap = ts.createMap((_a = {},
- _a[139] = [
+ _a[140] = [
{ name: "left", test: ts.isEntityName },
{ name: "right", test: ts.isIdentifier }
],
- _a[143] = [
+ _a[144] = [
{ name: "expression", test: ts.isLeftHandSideExpression }
],
- _a[177] = [
+ _a[178] = [
{ name: "type", test: ts.isTypeNode },
{ name: "expression", test: ts.isUnaryExpression }
],
- _a[195] = [
+ _a[196] = [
{ name: "expression", test: ts.isExpression },
{ name: "type", test: ts.isTypeNode }
],
- _a[196] = [
+ _a[197] = [
{ name: "expression", test: ts.isLeftHandSideExpression }
],
- _a[224] = [
+ _a[225] = [
{ name: "decorators", test: ts.isDecorator },
{ name: "modifiers", test: ts.isModifier },
{ name: "name", test: ts.isIdentifier },
{ name: "members", test: ts.isEnumMember }
],
- _a[225] = [
+ _a[226] = [
{ name: "decorators", test: ts.isDecorator },
{ name: "modifiers", test: ts.isModifier },
{ name: "name", test: ts.isModuleName },
{ name: "body", test: ts.isModuleBody }
],
- _a[226] = [
+ _a[227] = [
{ name: "statements", test: ts.isStatement }
],
- _a[229] = [
+ _a[230] = [
{ name: "decorators", test: ts.isDecorator },
{ name: "modifiers", test: ts.isModifier },
{ name: "name", test: ts.isIdentifier },
{ name: "moduleReference", test: ts.isModuleReference }
],
- _a[240] = [
+ _a[241] = [
{ name: "expression", test: ts.isExpression, optional: true }
],
_a[255] = [
@@ -34191,41 +35508,41 @@ var ts;
return initial;
}
var kind = node.kind;
- if ((kind > 0 && kind <= 138)) {
+ if ((kind > 0 && kind <= 139)) {
return initial;
}
- if ((kind >= 154 && kind <= 166)) {
+ if ((kind >= 155 && kind <= 167)) {
return initial;
}
var result = initial;
switch (node.kind) {
- case 198:
- case 201:
- case 193:
- case 217:
+ case 199:
+ case 202:
+ case 194:
+ case 218:
case 287:
break;
- case 140:
+ case 141:
result = reduceNode(node.expression, f, result);
break;
- case 142:
+ case 143:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 143:
+ case 144:
result = reduceNode(node.expression, f, result);
break;
- case 145:
+ case 146:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 147:
+ case 148:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -34234,12 +35551,12 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 148:
+ case 149:
result = ts.reduceLeft(node.modifiers, f, result);
result = ts.reduceLeft(node.parameters, f, result);
result = reduceNode(node.body, f, result);
break;
- case 149:
+ case 150:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -34247,51 +35564,51 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 150:
+ case 151:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = ts.reduceLeft(node.parameters, f, result);
result = reduceNode(node.body, f, result);
break;
- case 167:
case 168:
+ case 169:
result = ts.reduceLeft(node.elements, f, result);
break;
- case 169:
+ case 170:
result = reduceNode(node.propertyName, f, result);
result = reduceNode(node.name, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 170:
+ case 171:
result = ts.reduceLeft(node.elements, f, result);
break;
- case 171:
+ case 172:
result = ts.reduceLeft(node.properties, f, result);
break;
- case 172:
+ case 173:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.name, f, result);
break;
- case 173:
+ case 174:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.argumentExpression, f, result);
break;
- case 174:
+ case 175:
result = reduceNode(node.expression, f, result);
result = ts.reduceLeft(node.typeArguments, f, result);
result = ts.reduceLeft(node.arguments, f, result);
break;
- case 175:
+ case 176:
result = reduceNode(node.expression, f, result);
result = ts.reduceLeft(node.typeArguments, f, result);
result = ts.reduceLeft(node.arguments, f, result);
break;
- case 176:
+ case 177:
result = reduceNode(node.tag, f, result);
result = reduceNode(node.template, f, result);
break;
- case 179:
+ case 180:
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = ts.reduceLeft(node.typeParameters, f, result);
@@ -34299,117 +35616,117 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 180:
+ case 181:
result = ts.reduceLeft(node.modifiers, f, result);
result = ts.reduceLeft(node.typeParameters, f, result);
result = ts.reduceLeft(node.parameters, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 178:
- case 181:
+ case 179:
case 182:
case 183:
case 184:
- case 190:
+ case 185:
case 191:
- case 196:
+ case 192:
+ case 197:
result = reduceNode(node.expression, f, result);
break;
- case 185:
case 186:
+ case 187:
result = reduceNode(node.operand, f, result);
break;
- case 187:
+ case 188:
result = reduceNode(node.left, f, result);
result = reduceNode(node.right, f, result);
break;
- case 188:
+ case 189:
result = reduceNode(node.condition, f, result);
result = reduceNode(node.whenTrue, f, result);
result = reduceNode(node.whenFalse, f, result);
break;
- case 189:
+ case 190:
result = reduceNode(node.head, f, result);
result = ts.reduceLeft(node.templateSpans, f, result);
break;
- case 192:
+ case 193:
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = ts.reduceLeft(node.typeParameters, f, result);
result = ts.reduceLeft(node.heritageClauses, f, result);
result = ts.reduceLeft(node.members, f, result);
break;
- case 194:
+ case 195:
result = reduceNode(node.expression, f, result);
result = ts.reduceLeft(node.typeArguments, f, result);
break;
- case 197:
+ case 198:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.literal, f, result);
break;
- case 199:
+ case 200:
result = ts.reduceLeft(node.statements, f, result);
break;
- case 200:
+ case 201:
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.declarationList, f, result);
break;
- case 202:
+ case 203:
result = reduceNode(node.expression, f, result);
break;
- case 203:
+ case 204:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.thenStatement, f, result);
result = reduceNode(node.elseStatement, f, result);
break;
- case 204:
+ case 205:
result = reduceNode(node.statement, f, result);
result = reduceNode(node.expression, f, result);
break;
- case 205:
- case 212:
+ case 206:
+ case 213:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 206:
+ case 207:
result = reduceNode(node.initializer, f, result);
result = reduceNode(node.condition, f, result);
result = reduceNode(node.incrementor, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 207:
case 208:
+ case 209:
result = reduceNode(node.initializer, f, result);
result = reduceNode(node.expression, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 211:
- case 215:
+ case 212:
+ case 216:
result = reduceNode(node.expression, f, result);
break;
- case 213:
+ case 214:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.caseBlock, f, result);
break;
- case 214:
+ case 215:
result = reduceNode(node.label, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 216:
+ case 217:
result = reduceNode(node.tryBlock, f, result);
result = reduceNode(node.catchClause, f, result);
result = reduceNode(node.finallyBlock, f, result);
break;
- case 218:
+ case 219:
result = reduceNode(node.name, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 219:
+ case 220:
result = ts.reduceLeft(node.declarations, f, result);
break;
- case 220:
+ case 221:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -34418,7 +35735,7 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 221:
+ case 222:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -34426,49 +35743,49 @@ var ts;
result = ts.reduceLeft(node.heritageClauses, f, result);
result = ts.reduceLeft(node.members, f, result);
break;
- case 227:
+ case 228:
result = ts.reduceLeft(node.clauses, f, result);
break;
- case 230:
+ case 231:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.importClause, f, result);
result = reduceNode(node.moduleSpecifier, f, result);
break;
- case 231:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.namedBindings, f, result);
- break;
case 232:
result = reduceNode(node.name, f, result);
+ result = reduceNode(node.namedBindings, f, result);
break;
case 233:
- case 237:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNode(node.name, f, result);
break;
case 234:
case 238:
+ result = ts.reduceLeft(node.elements, f, result);
+ break;
+ case 235:
+ case 239:
result = reduceNode(node.propertyName, f, result);
result = reduceNode(node.name, f, result);
break;
- case 235:
+ case 236:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.expression, f, result);
break;
- case 236:
+ case 237:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.exportClause, f, result);
result = reduceNode(node.moduleSpecifier, f, result);
break;
- case 241:
+ case 242:
result = reduceNode(node.openingElement, f, result);
result = ts.reduceLeft(node.children, f, result);
result = reduceNode(node.closingElement, f, result);
break;
- case 242:
case 243:
+ case 244:
result = reduceNode(node.tagName, f, result);
result = ts.reduceLeft(node.attributes, f, result);
break;
@@ -34611,153 +35928,153 @@ var ts;
return undefined;
}
var kind = node.kind;
- if ((kind > 0 && kind <= 138)) {
+ if ((kind > 0 && kind <= 139)) {
return node;
}
- if ((kind >= 154 && kind <= 166)) {
+ if ((kind >= 155 && kind <= 167)) {
return node;
}
switch (node.kind) {
- case 198:
- case 201:
- case 193:
- case 217:
+ case 199:
+ case 202:
+ case 194:
+ case 218:
return node;
- case 140:
+ case 141:
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
- case 142:
+ case 143:
return ts.updateParameterDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
- case 145:
+ case 146:
return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
- case 147:
- return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
case 148:
- return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
case 149:
- return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
case 150:
+ return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ case 151:
return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
- case 167:
- return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));
case 168:
- return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));
+ return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));
case 169:
- return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));
+ return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));
case 170:
- return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));
+ return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));
case 171:
- return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike));
+ return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));
case 172:
- return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
+ return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike));
case 173:
- return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
+ return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
case 174:
- return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));
+ return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
case 175:
- return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));
+ return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));
case 176:
+ return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));
+ case 177:
return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));
- case 178:
- return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
case 179:
- return ts.updateFunctionExpression(node, visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
case 180:
- return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, true), context.endLexicalEnvironment()));
+ return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
case 181:
- return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, true), context.endLexicalEnvironment()));
case 182:
- return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
case 183:
- return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
case 184:
+ return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 185:
return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));
- case 187:
+ case 188:
return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression));
- case 185:
- return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
case 186:
+ return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
+ case 187:
return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 188:
- return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression));
case 189:
- return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan));
+ return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression));
case 190:
- return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan));
case 191:
- return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression));
case 192:
+ return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 193:
return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));
- case 194:
+ case 195:
return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 197:
+ case 198:
return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));
- case 199:
- return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement));
case 200:
+ return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement));
+ case 201:
return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));
- case 202:
- return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression));
case 203:
- return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock));
+ return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression));
case 204:
- return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock));
case 205:
- return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
case 206:
- return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 207:
- return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 208:
- return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 209:
- return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true));
+ return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 210:
- return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true));
+ return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true));
case 211:
- return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true));
+ return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true));
case 212:
- return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true));
case 213:
- return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
+ return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 214:
- return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
case 215:
- return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 216:
+ return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 217:
return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true));
- case 218:
- return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
case 219:
- return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));
+ return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
case 220:
- return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));
case 221:
+ return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ case 222:
return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));
- case 227:
+ case 228:
return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause));
- case 230:
- return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
case 231:
- return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true));
+ return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
case 232:
- return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
+ return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true));
case 233:
- return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier));
+ return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
case 234:
- return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier));
+ return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier));
case 235:
- return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier));
case 236:
- return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true));
+ return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
case 237:
- return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier));
+ return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true));
case 238:
+ return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier));
+ case 239:
return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier));
- case 241:
- return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
case 242:
- return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));
+ return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
case 243:
+ return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));
+ case 244:
return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));
case 245:
return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));
@@ -34858,67 +36175,67 @@ var ts;
return transformFlags | aggregateTransformFlagsForNode(child);
}
function getTransformFlagsSubtreeExclusions(kind) {
- if (kind >= 154 && kind <= 166) {
+ if (kind >= 155 && kind <= 167) {
return -3;
}
switch (kind) {
- case 174:
case 175:
- case 170:
- return 537133909;
- case 225:
- return 546335573;
- case 142:
- return 538968917;
+ case 176:
+ case 171:
+ return 537922901;
+ case 226:
+ return 574729557;
+ case 143:
+ return 545262933;
+ case 181:
+ return 592227669;
case 180:
- return 550710101;
- case 179:
- case 220:
- return 550726485;
- case 219:
- return 538968917;
case 221:
- case 192:
- return 537590613;
- case 148:
- return 550593365;
- case 147:
+ return 592293205;
+ case 220:
+ return 545262933;
+ case 222:
+ case 193:
+ return 539749717;
case 149:
+ return 591760725;
+ case 148:
case 150:
- return 550593365;
- case 117:
- case 130:
- case 127:
- case 132:
- case 120:
- case 133:
- case 103:
- case 141:
- case 144:
- case 146:
case 151:
+ return 591760725;
+ case 118:
+ case 131:
+ case 128:
+ case 133:
+ case 121:
+ case 134:
+ case 104:
+ case 142:
+ case 145:
+ case 147:
case 152:
case 153:
- case 222:
+ case 154:
case 223:
+ case 224:
return -3;
- case 171:
- return 537430869;
+ case 172:
+ return 539110741;
default:
- return 536871765;
+ return 536874325;
}
}
var Debug;
(function (Debug) {
Debug.failNotOptional = Debug.shouldAssert(1)
? function (message) { return Debug.assert(false, message || "Node not optional."); }
- : function (message) { };
+ : function () { };
Debug.failBadSyntaxKind = Debug.shouldAssert(1)
? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); }
- : function (node, message) { };
+ : function () { };
Debug.assertNode = Debug.shouldAssert(1)
? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
- : function (node, test, message) { };
+ : function () { };
function getFunctionName(func) {
if (typeof func !== "function") {
return "";
@@ -34956,7 +36273,7 @@ var ts;
else if (ts.nodeIsSynthesized(node)) {
location = value;
}
- flattenDestructuring(context, node, value, location, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, visitor);
if (needsValue) {
expressions.push(value);
}
@@ -34976,9 +36293,9 @@ var ts;
}
}
ts.flattenDestructuringAssignment = flattenDestructuringAssignment;
- function flattenParameterDestructuring(context, node, value, visitor) {
+ function flattenParameterDestructuring(node, value, visitor) {
var declarations = [];
- flattenDestructuring(context, node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
return declarations;
function emitAssignment(name, value, location) {
var declaration = ts.createVariableDeclaration(name, undefined, value, location);
@@ -34993,10 +36310,10 @@ var ts;
}
}
ts.flattenParameterDestructuring = flattenParameterDestructuring;
- function flattenVariableDestructuring(context, node, value, visitor, recordTempVariable) {
+ function flattenVariableDestructuring(node, value, visitor, recordTempVariable) {
var declarations = [];
var pendingAssignments;
- flattenDestructuring(context, node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
return declarations;
function emitAssignment(name, value, location, original) {
if (pendingAssignments) {
@@ -35028,9 +36345,9 @@ var ts;
}
}
ts.flattenVariableDestructuring = flattenVariableDestructuring;
- function flattenVariableDestructuringToExpression(context, node, recordTempVariable, nameSubstitution, visitor) {
+ function flattenVariableDestructuringToExpression(node, recordTempVariable, nameSubstitution, visitor) {
var pendingAssignments = [];
- flattenDestructuring(context, node, undefined, node, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, undefined, node, emitAssignment, emitTempVariableAssignment, visitor);
var expression = ts.inlineExpressions(pendingAssignments);
ts.aggregateTransformFlags(expression);
return expression;
@@ -35052,7 +36369,7 @@ var ts;
}
}
ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression;
- function flattenDestructuring(context, root, value, location, emitAssignment, emitTempVariableAssignment, visitor) {
+ function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, visitor) {
if (value && visitor) {
value = ts.visitNode(value, visitor, ts.isExpression);
}
@@ -35073,7 +36390,7 @@ var ts;
}
target = bindingTarget.name;
}
- else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 56) {
+ else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57) {
var initializer = visitor
? ts.visitNode(bindingTarget.right, visitor, ts.isExpression)
: bindingTarget.right;
@@ -35083,10 +36400,10 @@ var ts;
else {
target = bindingTarget;
}
- if (target.kind === 171) {
+ if (target.kind === 172) {
emitObjectLiteralAssignment(target, value, location);
}
- else if (target.kind === 170) {
+ else if (target.kind === 171) {
emitArrayLiteralAssignment(target, value, location);
}
else {
@@ -35118,8 +36435,8 @@ var ts;
}
for (var i = 0; i < numElements; i++) {
var e = elements[i];
- if (e.kind !== 193) {
- if (e.kind !== 191) {
+ if (e.kind !== 194) {
+ if (e.kind !== 192) {
emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e);
}
else if (i === numElements - 1) {
@@ -35148,7 +36465,7 @@ var ts;
if (ts.isOmittedExpression(element)) {
continue;
}
- else if (name.kind === 167) {
+ else if (name.kind === 168) {
var propName = element.propertyName || element.name;
emitBindingElement(element, createDestructuringPropertyAccess(value, propName));
}
@@ -35168,7 +36485,7 @@ var ts;
}
function createDefaultValueCheck(value, defaultValue, location) {
value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(53), defaultValue, ts.createToken(54), value);
+ return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54), defaultValue, ts.createToken(55), value);
}
function createDestructuringPropertyAccess(expression, propertyName) {
if (ts.isComputedPropertyName(propertyName)) {
@@ -35206,6 +36523,12 @@ var ts;
var ts;
(function (ts) {
var USE_NEW_TYPE_METADATA_FORMAT = false;
+ var TypeScriptSubstitutionFlags;
+ (function (TypeScriptSubstitutionFlags) {
+ TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["ClassAliases"] = 1] = "ClassAliases";
+ TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NamespaceExports"] = 2] = "NamespaceExports";
+ TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NonQualifiedEnumMembers"] = 8] = "NonQualifiedEnumMembers";
+ })(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {}));
function transformTypeScript(context) {
var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
@@ -35216,8 +36539,8 @@ var ts;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableSubstitution(172);
context.enableSubstitution(173);
+ context.enableSubstitution(174);
var currentSourceFile;
var currentNamespace;
var currentNamespaceContainerName;
@@ -35227,7 +36550,6 @@ var ts;
var enabledSubstitutions;
var classAliases;
var applicableSubstitutions;
- var currentSuperContainer;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
@@ -35261,15 +36583,32 @@ var ts;
}
return node;
}
+ function sourceElementVisitor(node) {
+ return saveStateAndInvoke(node, sourceElementVisitorWorker);
+ }
+ function sourceElementVisitorWorker(node) {
+ switch (node.kind) {
+ case 231:
+ return visitImportDeclaration(node);
+ case 230:
+ return visitImportEqualsDeclaration(node);
+ case 236:
+ return visitExportAssignment(node);
+ case 237:
+ return visitExportDeclaration(node);
+ default:
+ return visitorWorker(node);
+ }
+ }
function namespaceElementVisitor(node) {
return saveStateAndInvoke(node, namespaceElementVisitorWorker);
}
function namespaceElementVisitorWorker(node) {
- if (node.kind === 236 ||
- node.kind === 230 ||
+ if (node.kind === 237 ||
node.kind === 231 ||
- (node.kind === 229 &&
- node.moduleReference.kind === 240)) {
+ node.kind === 232 ||
+ (node.kind === 230 &&
+ node.moduleReference.kind === 241)) {
return undefined;
}
else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) {
@@ -35285,15 +36624,15 @@ var ts;
}
function classElementVisitorWorker(node) {
switch (node.kind) {
- case 148:
- return undefined;
- case 145:
- case 153:
case 149:
+ return undefined;
+ case 146:
+ case 154:
case 150:
- case 147:
+ case 151:
+ case 148:
return visitorWorker(node);
- case 198:
+ case 199:
return node;
default:
ts.Debug.failBadSyntaxKind(node);
@@ -35305,84 +36644,87 @@ var ts;
return ts.createNotEmittedStatement(node);
}
switch (node.kind) {
- case 82:
- case 77:
+ case 83:
+ case 78:
return currentNamespace ? undefined : node;
- case 112:
- case 110:
+ case 113:
case 111:
- case 115:
- case 118:
- case 74:
- case 122:
- case 128:
- case 160:
+ case 112:
+ case 116:
+ case 75:
+ case 123:
+ case 129:
case 161:
- case 159:
- case 154:
- case 141:
- case 117:
- case 120:
- case 132:
- case 130:
- case 127:
- case 103:
+ case 162:
+ case 160:
+ case 155:
+ case 142:
+ case 118:
+ case 121:
case 133:
+ case 131:
+ case 128:
+ case 104:
+ case 134:
+ case 158:
case 157:
+ case 159:
case 156:
- case 158:
- case 155:
- case 162:
case 163:
case 164:
case 165:
case 166:
- case 153:
- case 143:
+ case 167:
+ case 154:
+ case 144:
+ case 224:
+ case 146:
+ case 149:
+ return visitConstructor(node);
case 223:
- case 145:
- case 148:
- return undefined;
- case 222:
return ts.createNotEmittedStatement(node);
- case 221:
+ case 222:
return visitClassDeclaration(node);
- case 192:
+ case 193:
return visitClassExpression(node);
case 251:
return visitHeritageClause(node);
- case 194:
+ case 195:
return visitExpressionWithTypeArguments(node);
- case 147:
+ case 148:
return visitMethodDeclaration(node);
- case 149:
- return visitGetAccessor(node);
case 150:
+ return visitGetAccessor(node);
+ case 151:
return visitSetAccessor(node);
- case 220:
+ case 221:
return visitFunctionDeclaration(node);
- case 179:
- return visitFunctionExpression(node);
case 180:
+ return visitFunctionExpression(node);
+ case 181:
return visitArrowFunction(node);
- case 142:
+ case 143:
return visitParameter(node);
- case 178:
+ case 179:
return visitParenthesizedExpression(node);
- case 177:
- case 195:
- return visitAssertionExpression(node);
+ case 178:
case 196:
+ return visitAssertionExpression(node);
+ case 175:
+ return visitCallExpression(node);
+ case 176:
+ return visitNewExpression(node);
+ case 197:
return visitNonNullExpression(node);
- case 224:
+ case 225:
return visitEnumDeclaration(node);
- case 184:
- return visitAwaitExpression(node);
- case 200:
+ case 201:
return visitVariableStatement(node);
- case 225:
+ case 219:
+ return visitVariableDeclaration(node);
+ case 226:
return visitModuleDeclaration(node);
- case 229:
+ case 230:
return visitImportEqualsDeclaration(node);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -35392,14 +36734,14 @@ var ts;
function onBeforeVisitNode(node) {
switch (node.kind) {
case 256:
+ case 228:
case 227:
- case 226:
- case 199:
+ case 200:
currentScope = node;
currentScopeFirstDeclarationsOfName = undefined;
break;
+ case 222:
case 221:
- case 220:
if (ts.hasModifier(node, 2)) {
break;
}
@@ -35424,14 +36766,14 @@ var ts;
externalHelpersModuleImport.flags &= ~8;
statements.push(externalHelpersModuleImport);
currentSourceFileExternalHelpersModuleName = externalHelpersModuleName;
- ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
currentSourceFileExternalHelpersModuleName = undefined;
node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
node.externalHelpersModuleName = externalHelpersModuleName;
}
else {
- node = ts.visitEachChild(node, visitor, context);
+ node = ts.visitEachChild(node, sourceElementVisitor, context);
}
ts.setEmitFlags(node, 1 | ts.getEmitFlags(node));
return node;
@@ -35471,7 +36813,7 @@ var ts;
classAlias = addClassDeclarationHeadWithDecorators(statements, node, name, hasExtendsClause);
}
if (staticProperties.length) {
- addInitializedPropertyStatements(statements, node, staticProperties, getLocalName(node, true));
+ addInitializedPropertyStatements(statements, staticProperties, getLocalName(node, true));
}
addClassElementDecorationStatements(statements, node, false);
addClassElementDecorationStatements(statements, node, true);
@@ -35517,7 +36859,7 @@ var ts;
function visitClassExpression(node) {
var staticProperties = getInitializedProperties(node, true);
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
- var members = transformClassMembers(node, heritageClauses !== undefined);
+ var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 84; }));
var classExpression = ts.setOriginalNode(ts.createClassExpression(undefined, node.name, undefined, heritageClauses, members, node), node);
if (staticProperties.length > 0) {
var expressions = [];
@@ -35528,7 +36870,7 @@ var ts;
}
ts.setEmitFlags(classExpression, 524288 | ts.getEmitFlags(classExpression));
expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression)));
- ts.addRange(expressions, generateInitializedPropertyExpressions(node, staticProperties, temp));
+ ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp));
expressions.push(ts.startOnNewLine(temp));
return ts.inlineExpressions(expressions);
}
@@ -35545,13 +36887,13 @@ var ts;
}
function transformConstructor(node, hasExtendsClause) {
var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty);
- var hasParameterPropertyAssignments = node.transformFlags & 131072;
+ var hasParameterPropertyAssignments = node.transformFlags & 524288;
var constructor = ts.getFirstConstructorWithBody(node);
if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) {
return ts.visitEachChild(constructor, visitor, context);
}
var parameters = transformConstructorParameters(constructor);
- var body = transformConstructorBody(node, constructor, hasExtendsClause, parameters);
+ var body = transformConstructorBody(node, constructor, hasExtendsClause);
return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor));
}
function transformConstructorParameters(constructor) {
@@ -35559,7 +36901,7 @@ var ts;
? ts.visitNodes(constructor.parameters, visitor, ts.isParameter)
: [];
}
- function transformConstructorBody(node, constructor, hasExtendsClause, parameters) {
+ function transformConstructorBody(node, constructor, hasExtendsClause) {
var statements = [];
var indexOfFirstStatement = 0;
startLexicalEnvironment();
@@ -35572,7 +36914,7 @@ var ts;
statements.push(ts.createStatement(ts.createCall(ts.createSuper(), undefined, [ts.createSpread(ts.createIdentifier("arguments"))])));
}
var properties = getInitializedProperties(node, false);
- addInitializedPropertyStatements(statements, node, properties, ts.createThis());
+ addInitializedPropertyStatements(statements, properties, ts.createThis());
if (constructor) {
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement));
}
@@ -35587,7 +36929,7 @@ var ts;
return index;
}
var statement = statements[index];
- if (statement.kind === 202 && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 203 && ts.isSuperCall(statement.expression)) {
result.push(ts.visitNode(statement, visitor, ts.isStatement));
return index + 1;
}
@@ -35621,24 +36963,24 @@ var ts;
return isInitializedProperty(member, false);
}
function isInitializedProperty(member, isStatic) {
- return member.kind === 145
+ return member.kind === 146
&& isStatic === ts.hasModifier(member, 32)
&& member.initializer !== undefined;
}
- function addInitializedPropertyStatements(statements, node, properties, receiver) {
+ function addInitializedPropertyStatements(statements, properties, receiver) {
for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
var property = properties_7[_i];
- var statement = ts.createStatement(transformInitializedProperty(node, property, receiver));
+ var statement = ts.createStatement(transformInitializedProperty(property, receiver));
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
ts.setCommentRange(statement, property);
statements.push(statement);
}
}
- function generateInitializedPropertyExpressions(node, properties, receiver) {
+ function generateInitializedPropertyExpressions(properties, receiver) {
var expressions = [];
for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {
var property = properties_8[_i];
- var expression = transformInitializedProperty(node, property, receiver);
+ var expression = transformInitializedProperty(property, receiver);
expression.startsOnNewLine = true;
ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));
ts.setCommentRange(expression, property);
@@ -35646,7 +36988,7 @@ var ts;
}
return expressions;
}
- function transformInitializedProperty(node, property, receiver) {
+ function transformInitializedProperty(property, receiver) {
var propertyName = visitPropertyNameOfClassElement(property);
var initializer = ts.visitNode(property.initializer, visitor, ts.isExpression);
var memberAccess = ts.createMemberAccessForPropertyName(receiver, propertyName, propertyName);
@@ -35694,12 +37036,12 @@ var ts;
}
function getAllDecoratorsOfClassElement(node, member) {
switch (member.kind) {
- case 149:
case 150:
+ case 151:
return getAllDecoratorsOfAccessors(node, member);
- case 147:
+ case 148:
return getAllDecoratorsOfMethod(member);
- case 145:
+ case 146:
return getAllDecoratorsOfProperty(member);
default:
return undefined;
@@ -35777,7 +37119,7 @@ var ts;
var prefix = getClassMemberPrefix(node, member);
var memberName = getExpressionForPropertyName(member, true);
var descriptor = languageVersion > 0
- ? member.kind === 145
+ ? member.kind === 146
? ts.createVoidZero()
: ts.createNull()
: undefined;
@@ -35865,43 +37207,43 @@ var ts;
}
function shouldAddTypeMetadata(node) {
var kind = node.kind;
- return kind === 147
- || kind === 149
+ return kind === 148
|| kind === 150
- || kind === 145;
+ || kind === 151
+ || kind === 146;
}
function shouldAddReturnTypeMetadata(node) {
- return node.kind === 147;
+ return node.kind === 148;
}
function shouldAddParamTypesMetadata(node) {
var kind = node.kind;
- return kind === 221
- || kind === 192
- || kind === 147
- || kind === 149
- || kind === 150;
+ return kind === 222
+ || kind === 193
+ || kind === 148
+ || kind === 150
+ || kind === 151;
}
function serializeTypeOfNode(node) {
switch (node.kind) {
- case 145:
- case 142:
- case 149:
- return serializeTypeNode(node.type);
+ case 146:
+ case 143:
case 150:
+ return serializeTypeNode(node.type);
+ case 151:
return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node));
- case 221:
- case 192:
- case 147:
+ case 222:
+ case 193:
+ case 148:
return ts.createIdentifier("Function");
default:
return ts.createVoidZero();
}
}
function getRestParameterElementType(node) {
- if (node && node.kind === 160) {
+ if (node && node.kind === 161) {
return node.elementType;
}
- else if (node && node.kind === 155) {
+ else if (node && node.kind === 156) {
return ts.singleOrUndefined(node.typeArguments);
}
else {
@@ -35947,52 +37289,52 @@ var ts;
return ts.createIdentifier("Object");
}
switch (node.kind) {
- case 103:
+ case 104:
return ts.createVoidZero();
- case 164:
+ case 165:
return serializeTypeNode(node.type);
- case 156:
case 157:
+ case 158:
return ts.createIdentifier("Function");
- case 160:
case 161:
+ case 162:
return ts.createIdentifier("Array");
- case 154:
- case 120:
+ case 155:
+ case 121:
return ts.createIdentifier("Boolean");
- case 132:
+ case 133:
return ts.createIdentifier("String");
- case 166:
+ case 167:
switch (node.literal.kind) {
case 9:
return ts.createIdentifier("String");
case 8:
return ts.createIdentifier("Number");
- case 99:
- case 84:
+ case 100:
+ case 85:
return ts.createIdentifier("Boolean");
default:
ts.Debug.failBadSyntaxKind(node.literal);
break;
}
break;
- case 130:
+ case 131:
return ts.createIdentifier("Number");
- case 133:
+ case 134:
return languageVersion < 2
? getGlobalSymbolNameWithFallback()
: ts.createIdentifier("Symbol");
- case 155:
+ case 156:
return serializeTypeReferenceNode(node);
+ case 164:
case 163:
- case 162:
{
var unionOrIntersection = node;
var serializedUnion = void 0;
for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) {
var typeNode = _a[_i];
var serializedIndividual = serializeTypeNode(typeNode);
- if (serializedIndividual.kind !== 69) {
+ if (serializedIndividual.kind !== 70) {
serializedUnion = undefined;
break;
}
@@ -36009,10 +37351,10 @@ var ts;
return serializedUnion;
}
}
- case 158:
case 159:
- case 117:
- case 165:
+ case 160:
+ case 118:
+ case 166:
break;
default:
ts.Debug.failBadSyntaxKind(node);
@@ -36053,7 +37395,7 @@ var ts;
}
function serializeEntityNameAsExpression(node, useFallback) {
switch (node.kind) {
- case 69:
+ case 70:
var name_27 = ts.getMutableClone(node);
name_27.flags &= ~8;
name_27.original = undefined;
@@ -36062,13 +37404,13 @@ var ts;
return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_27), ts.createLiteral("undefined")), name_27);
}
return name_27;
- case 139:
+ case 140:
return serializeQualifiedNameAsExpression(node, useFallback);
}
}
function serializeQualifiedNameAsExpression(node, useFallback) {
var left;
- if (node.left.kind === 69) {
+ if (node.left.kind === 70) {
left = serializeEntityNameAsExpression(node.left, useFallback);
}
else if (useFallback) {
@@ -36081,7 +37423,7 @@ var ts;
return ts.createPropertyAccess(left, node.right);
}
function getGlobalSymbolNameWithFallback() {
- return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(53), ts.createIdentifier("Symbol"), ts.createToken(54), ts.createIdentifier("Object"));
+ return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54), ts.createIdentifier("Symbol"), ts.createToken(55), ts.createIdentifier("Object"));
}
function getExpressionForPropertyName(member, generateNameForComputedPropertyName) {
var name = member.name;
@@ -36113,9 +37455,9 @@ var ts;
}
}
function visitHeritageClause(node) {
- if (node.token === 83) {
+ if (node.token === 84) {
var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1);
- return ts.createHeritageClause(83, types, node);
+ return ts.createHeritageClause(84, types, node);
}
return undefined;
}
@@ -36126,6 +37468,12 @@ var ts;
function shouldEmitFunctionLikeDeclaration(node) {
return !ts.nodeIsMissing(node.body);
}
+ function visitConstructor(node) {
+ if (!shouldEmitFunctionLikeDeclaration(node)) {
+ return undefined;
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitMethodDeclaration(node) {
if (!shouldEmitFunctionLikeDeclaration(node)) {
return undefined;
@@ -36176,36 +37524,33 @@ var ts;
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
+ var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
ts.setOriginalNode(func, node);
return func;
}
function visitArrowFunction(node) {
- var func = ts.createArrowFunction(undefined, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
+ var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
ts.setOriginalNode(func, node);
return func;
}
function transformFunctionBody(node) {
- if (ts.isAsyncFunctionLike(node)) {
- return transformAsyncFunctionBody(node);
- }
return transformFunctionBodyWorker(node.body);
}
function transformFunctionBodyWorker(body, start) {
if (start === void 0) { start = 0; }
var savedCurrentScope = currentScope;
+ var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
currentScope = body;
+ currentScopeFirstDeclarationsOfName = ts.createMap();
startLexicalEnvironment();
var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
var visited = ts.updateBlock(body, statements);
var declarations = endLexicalEnvironment();
currentScope = savedCurrentScope;
+ currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
}
function transformConciseBody(node) {
- if (ts.isAsyncFunctionLike(node)) {
- return transformAsyncFunctionBody(node);
- }
return transformConciseBodyWorker(node.body, false);
}
function transformConciseBodyWorker(body, forceBlockFunctionBody) {
@@ -36227,42 +37572,6 @@ var ts;
}
}
}
- function getPromiseConstructor(type) {
- var typeName = ts.getEntityNameFromTypeNode(type);
- if (typeName && ts.isEntityName(typeName)) {
- var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
- if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
- || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
- return typeName;
- }
- }
- return undefined;
- }
- function transformAsyncFunctionBody(node) {
- var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(node.type) : undefined;
- var isArrowFunction = node.kind === 180;
- var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0;
- if (!isArrowFunction) {
- var statements = [];
- var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor);
- statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
- var block = ts.createBlock(statements, node.body, true);
- if (languageVersion >= 2) {
- if (resolver.getNodeCheckFlags(node) & 4096) {
- enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 8);
- }
- else if (resolver.getNodeCheckFlags(node) & 2048) {
- enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 4);
- }
- }
- return block;
- }
- else {
- return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, true));
- }
- }
function visitParameter(node) {
if (ts.parameterIsThisKeyword(node)) {
return undefined;
@@ -36289,14 +37598,14 @@ var ts;
function transformInitializedVariable(node) {
var name = node.name;
if (ts.isBindingPattern(name)) {
- return ts.flattenVariableDestructuringToExpression(context, node, hoistVariableDeclaration, getNamespaceMemberNameWithSourceMapsAndWithoutComments, visitor);
+ return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, getNamespaceMemberNameWithSourceMapsAndWithoutComments, visitor);
}
else {
return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node);
}
}
- function visitAwaitExpression(node) {
- return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node);
+ function visitVariableDeclaration(node) {
+ return ts.updateVariableDeclaration(node, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
}
function visitParenthesizedExpression(node) {
var innerExpression = ts.skipOuterExpressions(node.expression, ~2);
@@ -36314,6 +37623,12 @@ var ts;
var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression);
return ts.createPartiallyEmittedExpression(expression, node);
}
+ function visitCallExpression(node) {
+ return ts.updateCall(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));
+ }
+ function visitNewExpression(node) {
+ return ts.updateNew(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));
+ }
function shouldEmitEnumDeclaration(node) {
return !ts.isConst(node)
|| compilerOptions.preserveConstEnums
@@ -36345,7 +37660,7 @@ var ts;
var parameterName = getNamespaceParameterName(node);
var containerName = getNamespaceContainerName(node);
var exportName = getExportName(node);
- var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()))]), node);
+ var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()))]), node);
ts.setOriginalNode(enumStatement, node);
ts.setEmitFlags(enumStatement, emitFlags);
statements.push(enumStatement);
@@ -36388,7 +37703,7 @@ var ts;
}
function isES6ExportedDeclaration(node) {
return isExternalModuleExport(node)
- && moduleKind === ts.ModuleKind.ES6;
+ && moduleKind === ts.ModuleKind.ES2015;
}
function recordEmittedDeclarationInScope(node) {
var name = node.symbol && node.symbol.name;
@@ -36420,7 +37735,7 @@ var ts;
ts.createVariableDeclaration(getDeclarationName(node, false, true))
]);
ts.setOriginalNode(statement, node);
- if (node.kind === 224) {
+ if (node.kind === 225) {
ts.setSourceMapRange(statement.declarationList, node);
}
else {
@@ -36453,7 +37768,7 @@ var ts;
var localName = getLocalName(node);
moduleArg = ts.createAssignment(localName, moduleArg);
}
- var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg]), node);
+ var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg]), node);
ts.setOriginalNode(moduleStatement, node);
ts.setEmitFlags(moduleStatement, emitFlags);
statements.push(moduleStatement);
@@ -36471,7 +37786,7 @@ var ts;
var statementsLocation;
var blockLocation;
var body = node.body;
- if (body.kind === 226) {
+ if (body.kind === 227) {
ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement));
statementsLocation = body.statements;
blockLocation = body;
@@ -36494,17 +37809,67 @@ var ts;
currentNamespace = savedCurrentNamespace;
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true);
- if (body.kind !== 226) {
+ if (body.kind !== 227) {
ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152);
}
return block;
}
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {
- if (moduleDeclaration.body.kind === 225) {
+ if (moduleDeclaration.body.kind === 226) {
var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);
return recursiveInnerModule || moduleDeclaration.body;
}
}
+ function visitImportDeclaration(node) {
+ if (!node.importClause) {
+ return node;
+ }
+ var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause, true);
+ return importClause
+ ? ts.updateImportDeclaration(node, undefined, undefined, importClause, node.moduleSpecifier)
+ : undefined;
+ }
+ function visitImportClause(node) {
+ var name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined;
+ var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings, true);
+ return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined;
+ }
+ function visitNamedImportBindings(node) {
+ if (node.kind === 233) {
+ return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
+ }
+ else {
+ var elements = ts.visitNodes(node.elements, visitImportSpecifier, ts.isImportSpecifier);
+ return ts.some(elements) ? ts.updateNamedImports(node, elements) : undefined;
+ }
+ }
+ function visitImportSpecifier(node) {
+ return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
+ }
+ function visitExportAssignment(node) {
+ return resolver.isValueAliasDeclaration(node)
+ ? ts.visitEachChild(node, visitor, context)
+ : undefined;
+ }
+ function visitExportDeclaration(node) {
+ if (!node.exportClause) {
+ return resolver.moduleExportsSomeValue(node.moduleSpecifier) ? node : undefined;
+ }
+ if (!resolver.isValueAliasDeclaration(node)) {
+ return undefined;
+ }
+ var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports, true);
+ return exportClause
+ ? ts.updateExportDeclaration(node, undefined, undefined, exportClause, node.moduleSpecifier)
+ : undefined;
+ }
+ function visitNamedExports(node) {
+ var elements = ts.visitNodes(node.elements, visitExportSpecifier, ts.isExportSpecifier);
+ return ts.some(elements) ? ts.updateNamedExports(node, elements) : undefined;
+ }
+ function visitExportSpecifier(node) {
+ return resolver.isValueAliasDeclaration(node) ? node : undefined;
+ }
function shouldEmitImportEqualsDeclaration(node) {
return resolver.isReferencedAliasDeclaration(node)
|| (!ts.isExternalModule(currentSourceFile)
@@ -36512,7 +37877,9 @@ var ts;
}
function visitImportEqualsDeclaration(node) {
if (ts.isExternalModuleImportEqualsDeclaration(node)) {
- return ts.visitEachChild(node, visitor, context);
+ return resolver.isReferencedAliasDeclaration(node)
+ ? ts.visitEachChild(node, visitor, context)
+ : undefined;
}
if (!shouldEmitImportEqualsDeclaration(node)) {
return undefined;
@@ -36624,57 +37991,32 @@ var ts;
function enableSubstitutionForNonQualifiedEnumMembers() {
if ((enabledSubstitutions & 8) === 0) {
enabledSubstitutions |= 8;
- context.enableSubstitution(69);
- }
- }
- function enableSubstitutionForAsyncMethodsWithSuper() {
- if ((enabledSubstitutions & 4) === 0) {
- enabledSubstitutions |= 4;
- context.enableSubstitution(174);
- context.enableSubstitution(172);
- context.enableSubstitution(173);
- context.enableEmitNotification(221);
- context.enableEmitNotification(147);
- context.enableEmitNotification(149);
- context.enableEmitNotification(150);
- context.enableEmitNotification(148);
+ context.enableSubstitution(70);
}
}
function enableSubstitutionForClassAliases() {
if ((enabledSubstitutions & 1) === 0) {
enabledSubstitutions |= 1;
- context.enableSubstitution(69);
+ context.enableSubstitution(70);
classAliases = ts.createMap();
}
}
function enableSubstitutionForNamespaceExports() {
if ((enabledSubstitutions & 2) === 0) {
enabledSubstitutions |= 2;
- context.enableSubstitution(69);
+ context.enableSubstitution(70);
context.enableSubstitution(254);
- context.enableEmitNotification(225);
+ context.enableEmitNotification(226);
}
}
- function isSuperContainer(node) {
- var kind = node.kind;
- return kind === 221
- || kind === 148
- || kind === 147
- || kind === 149
- || kind === 150;
- }
function isTransformedModuleDeclaration(node) {
- return ts.getOriginalNode(node).kind === 225;
+ return ts.getOriginalNode(node).kind === 226;
}
function isTransformedEnumDeclaration(node) {
- return ts.getOriginalNode(node).kind === 224;
+ return ts.getOriginalNode(node).kind === 225;
}
function onEmitNode(emitContext, node, emitCallback) {
var savedApplicableSubstitutions = applicableSubstitutions;
- var savedCurrentSuperContainer = currentSuperContainer;
- if (enabledSubstitutions & 4 && isSuperContainer(node)) {
- currentSuperContainer = node;
- }
if (enabledSubstitutions & 2 && isTransformedModuleDeclaration(node)) {
applicableSubstitutions |= 2;
}
@@ -36683,7 +38025,6 @@ var ts;
}
previousOnEmitNode(emitContext, node, emitCallback);
applicableSubstitutions = savedApplicableSubstitutions;
- currentSuperContainer = savedCurrentSuperContainer;
}
function onSubstituteNode(emitContext, node) {
node = previousOnSubstituteNode(emitContext, node);
@@ -36711,17 +38052,12 @@ var ts;
}
function substituteExpression(node) {
switch (node.kind) {
- case 69:
+ case 70:
return substituteExpressionIdentifier(node);
- case 172:
- return substitutePropertyAccessExpression(node);
case 173:
- return substituteElementAccessExpression(node);
+ return substitutePropertyAccessExpression(node);
case 174:
- if (enabledSubstitutions & 4) {
- return substituteCallExpression(node);
- }
- break;
+ return substituteElementAccessExpression(node);
}
return node;
}
@@ -36751,8 +38087,8 @@ var ts;
if (enabledSubstitutions & applicableSubstitutions && (ts.getEmitFlags(node) & 262144) === 0) {
var container = resolver.getReferencedExportContainer(node, false);
if (container) {
- var substitute = (applicableSubstitutions & 2 && container.kind === 225) ||
- (applicableSubstitutions & 8 && container.kind === 224);
+ var substitute = (applicableSubstitutions & 2 && container.kind === 226) ||
+ (applicableSubstitutions & 8 && container.kind === 225);
if (substitute) {
return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node);
}
@@ -36760,37 +38096,10 @@ var ts;
}
return undefined;
}
- function substituteCallExpression(node) {
- var expression = node.expression;
- if (ts.isSuperProperty(expression)) {
- var flags = getSuperContainerAsyncMethodFlags();
- if (flags) {
- var argumentExpression = ts.isPropertyAccessExpression(expression)
- ? substitutePropertyAccessExpression(expression)
- : substituteElementAccessExpression(expression);
- return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [
- ts.createThis()
- ].concat(node.arguments));
- }
- }
- return node;
- }
function substitutePropertyAccessExpression(node) {
- if (enabledSubstitutions & 4 && node.expression.kind === 95) {
- var flags = getSuperContainerAsyncMethodFlags();
- if (flags) {
- return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node);
- }
- }
return substituteConstantValue(node);
}
function substituteElementAccessExpression(node) {
- if (enabledSubstitutions & 4 && node.expression.kind === 95) {
- var flags = getSuperContainerAsyncMethodFlags();
- if (flags) {
- return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node);
- }
- }
return substituteConstantValue(node);
}
function substituteConstantValue(node) {
@@ -36818,2040 +38127,2429 @@ var ts;
? resolver.getConstantValue(node)
: undefined;
}
- function createSuperAccessInAsyncMethod(argumentExpression, flags, location) {
- if (flags & 4096) {
- return ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value", location);
- }
- else {
- return ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression], location);
- }
- }
- function getSuperContainerAsyncMethodFlags() {
- return currentSuperContainer !== undefined
- && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 | 4096);
- }
}
ts.transformTypeScript = transformTypeScript;
})(ts || (ts = {}));
var ts;
(function (ts) {
- function transformES6Module(context) {
+ var entities = createEntitiesMap();
+ function transformJsx(context) {
var compilerOptions = context.getCompilerOptions();
- var resolver = context.getEmitResolver();
var currentSourceFile;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
- if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- currentSourceFile = node;
- return ts.visitEachChild(node, visitor, context);
- }
+ currentSourceFile = node;
+ node = ts.visitEachChild(node, visitor, context);
+ currentSourceFile = undefined;
return node;
}
function visitor(node) {
- switch (node.kind) {
- case 230:
- return visitImportDeclaration(node);
- case 229:
- return visitImportEqualsDeclaration(node);
- case 231:
- return visitImportClause(node);
- case 233:
- case 232:
- return visitNamedBindings(node);
- case 234:
- return visitImportSpecifier(node);
- case 235:
- return visitExportAssignment(node);
- case 236:
- return visitExportDeclaration(node);
- case 237:
- return visitNamedExports(node);
- case 238:
- return visitExportSpecifier(node);
- }
- return node;
- }
- function visitExportAssignment(node) {
- if (node.isExportEquals) {
- return undefined;
- }
- var original = ts.getOriginalNode(node);
- return ts.nodeIsSynthesized(original) || resolver.isValueAliasDeclaration(original) ? node : undefined;
- }
- function visitExportDeclaration(node) {
- if (!node.exportClause) {
- return resolver.moduleExportsSomeValue(node.moduleSpecifier) ? node : undefined;
+ if (node.transformFlags & 4) {
+ return visitorWorker(node);
}
- if (!resolver.isValueAliasDeclaration(node)) {
- return undefined;
+ else if (node.transformFlags & 8) {
+ return ts.visitEachChild(node, visitor, context);
}
- var newExportClause = ts.visitNode(node.exportClause, visitor, ts.isNamedExports, true);
- if (node.exportClause === newExportClause) {
+ else {
return node;
}
- return newExportClause
- ? ts.createExportDeclaration(undefined, undefined, newExportClause, node.moduleSpecifier)
- : undefined;
}
- function visitNamedExports(node) {
- var newExports = ts.visitNodes(node.elements, visitor, ts.isExportSpecifier);
- if (node.elements === newExports) {
- return node;
+ function visitorWorker(node) {
+ switch (node.kind) {
+ case 242:
+ return visitJsxElement(node, false);
+ case 243:
+ return visitJsxSelfClosingElement(node, false);
+ case 248:
+ return visitJsxExpression(node);
+ default:
+ ts.Debug.failBadSyntaxKind(node);
+ return undefined;
}
- return newExports.length ? ts.createNamedExports(newExports) : undefined;
- }
- function visitExportSpecifier(node) {
- return resolver.isValueAliasDeclaration(node) ? node : undefined;
- }
- function visitImportEqualsDeclaration(node) {
- return !ts.isExternalModuleImportEqualsDeclaration(node) || resolver.isReferencedAliasDeclaration(node) ? node : undefined;
}
- function visitImportDeclaration(node) {
- if (node.importClause) {
- var newImportClause = ts.visitNode(node.importClause, visitor, ts.isImportClause);
- if (!newImportClause.name && !newImportClause.namedBindings) {
+ function transformJsxChildToExpression(node) {
+ switch (node.kind) {
+ case 10:
+ return visitJsxText(node);
+ case 248:
+ return visitJsxExpression(node);
+ case 242:
+ return visitJsxElement(node, true);
+ case 243:
+ return visitJsxSelfClosingElement(node, true);
+ default:
+ ts.Debug.failBadSyntaxKind(node);
return undefined;
- }
- else if (newImportClause !== node.importClause) {
- return ts.createImportDeclaration(undefined, undefined, newImportClause, node.moduleSpecifier);
- }
}
- return node;
}
- function visitImportClause(node) {
- var newDefaultImport = node.name;
- if (!resolver.isReferencedAliasDeclaration(node)) {
- newDefaultImport = undefined;
- }
- var newNamedBindings = ts.visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true);
- return newDefaultImport !== node.name || newNamedBindings !== node.namedBindings
- ? ts.createImportClause(newDefaultImport, newNamedBindings)
- : node;
+ function visitJsxElement(node, isChild) {
+ return visitJsxOpeningLikeElement(node.openingElement, node.children, isChild, node);
}
- function visitNamedBindings(node) {
- if (node.kind === 232) {
- return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
+ function visitJsxSelfClosingElement(node, isChild) {
+ return visitJsxOpeningLikeElement(node, undefined, isChild, node);
+ }
+ function visitJsxOpeningLikeElement(node, children, isChild, location) {
+ var tagName = getTagName(node);
+ var objectProperties;
+ var attrs = node.attributes;
+ if (attrs.length === 0) {
+ objectProperties = ts.createNull();
}
else {
- var newNamedImportElements = ts.visitNodes(node.elements, visitor, ts.isImportSpecifier);
- if (!newNamedImportElements || newNamedImportElements.length == 0) {
- return undefined;
- }
- if (newNamedImportElements === node.elements) {
- return node;
+ var segments = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { return isSpread
+ ? ts.map(attrs, transformJsxSpreadAttributeToExpression)
+ : ts.createObjectLiteral(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)); }));
+ if (ts.isJsxSpreadAttribute(attrs[0])) {
+ segments.unshift(ts.createObjectLiteral());
}
- return ts.createNamedImports(newNamedImportElements);
- }
- }
- function visitImportSpecifier(node) {
- return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
- }
- }
- ts.transformES6Module = transformES6Module;
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function transformSystemModule(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration, hoistFunctionDeclaration = context.hoistFunctionDeclaration;
- var compilerOptions = context.getCompilerOptions();
- var resolver = context.getEmitResolver();
- var host = context.getEmitHost();
- var languageVersion = ts.getEmitScriptTarget(compilerOptions);
- var previousOnSubstituteNode = context.onSubstituteNode;
- var previousOnEmitNode = context.onEmitNode;
- context.onSubstituteNode = onSubstituteNode;
- context.onEmitNode = onEmitNode;
- context.enableSubstitution(69);
- context.enableSubstitution(187);
- context.enableSubstitution(185);
- context.enableSubstitution(186);
- context.enableEmitNotification(256);
- var exportFunctionForFileMap = [];
- var currentSourceFile;
- var externalImports;
- var exportSpecifiers;
- var exportEquals;
- var hasExportStarsToExportValues;
- var exportFunctionForFile;
- var contextObjectForFile;
- var exportedLocalNames;
- var exportedFunctionDeclarations;
- var enclosingBlockScopedContainer;
- var currentParent;
- var currentNode;
- return transformSourceFile;
- function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
- return node;
+ objectProperties = ts.singleOrUndefined(segments)
+ || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments);
}
- if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- currentSourceFile = node;
- currentNode = node;
- var updated = transformSystemModuleWorker(node);
- ts.aggregateTransformFlags(updated);
- currentSourceFile = undefined;
- externalImports = undefined;
- exportSpecifiers = undefined;
- exportEquals = undefined;
- hasExportStarsToExportValues = false;
- exportFunctionForFile = undefined;
- contextObjectForFile = undefined;
- exportedLocalNames = undefined;
- exportedFunctionDeclarations = undefined;
- return updated;
+ var element = ts.createReactCreateElement(compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);
+ if (isChild) {
+ ts.startOnNewLine(element);
}
- return node;
+ return element;
}
- function transformSystemModuleWorker(node) {
- ts.Debug.assert(!exportFunctionForFile);
- (_a = ts.collectExternalModuleInfo(node, resolver), externalImports = _a.externalImports, exportSpecifiers = _a.exportSpecifiers, exportEquals = _a.exportEquals, hasExportStarsToExportValues = _a.hasExportStarsToExportValues, _a);
- exportFunctionForFile = ts.createUniqueName("exports");
- contextObjectForFile = ts.createUniqueName("context");
- exportFunctionForFileMap[ts.getOriginalNodeId(node)] = exportFunctionForFile;
- var dependencyGroups = collectDependencyGroups(externalImports);
- var statements = [];
- addSystemModuleBody(statements, node, dependencyGroups);
- var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
- var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, getNameOfDependencyGroup));
- var body = ts.createFunctionExpression(undefined, undefined, undefined, [
- ts.createParameter(exportFunctionForFile),
- ts.createParameter(contextObjectForFile)
- ], undefined, ts.setEmitFlags(ts.createBlock(statements, undefined, true), 1));
- return updateSourceFile(node, [
- ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), undefined, moduleName
- ? [moduleName, dependencies, body]
- : [dependencies, body]))
- ], ~1 & ts.getEmitFlags(node));
- var _a;
+ function transformJsxSpreadAttributeToExpression(node) {
+ return ts.visitNode(node.expression, visitor, ts.isExpression);
}
- function addSystemModuleBody(statements, node, dependencyGroups) {
- startLexicalEnvironment();
- var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, visitSourceElement);
- statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObjectForFile, ts.createPropertyAccess(contextObjectForFile, "id")))
- ])));
- var executeStatements = ts.visitNodes(node.statements, visitSourceElement, ts.isStatement, statementOffset);
- ts.addRange(statements, endLexicalEnvironment());
- ts.addRange(statements, exportedFunctionDeclarations);
- var exportStarFunction = addExportStarIfNeeded(statements);
- statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([
- ts.createPropertyAssignment("setters", generateSetters(exportStarFunction, dependencyGroups)),
- ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true)))
- ]), true)));
+ function transformJsxAttributeToObjectLiteralElement(node) {
+ var name = getAttributeName(node);
+ var expression = transformJsxAttributeInitializer(node.initializer);
+ return ts.createPropertyAssignment(name, expression);
}
- function addExportStarIfNeeded(statements) {
- if (!hasExportStarsToExportValues) {
- return;
+ function transformJsxAttributeInitializer(node) {
+ if (node === undefined) {
+ return ts.createLiteral(true);
}
- if (!exportedLocalNames && ts.isEmpty(exportSpecifiers)) {
- var hasExportDeclarationWithExportClause = false;
- for (var _i = 0, externalImports_1 = externalImports; _i < externalImports_1.length; _i++) {
- var externalImport = externalImports_1[_i];
- if (externalImport.kind === 236 && externalImport.exportClause) {
- hasExportDeclarationWithExportClause = true;
- break;
+ else if (node.kind === 9) {
+ var decoded = tryDecodeEntities(node.text);
+ return decoded ? ts.createLiteral(decoded, node) : node;
+ }
+ else if (node.kind === 248) {
+ return visitJsxExpression(node);
+ }
+ else {
+ ts.Debug.failBadSyntaxKind(node);
+ }
+ }
+ function visitJsxText(node) {
+ var text = ts.getTextOfNode(node, true);
+ var parts;
+ var firstNonWhitespace = 0;
+ var lastNonWhitespace = -1;
+ for (var i = 0; i < text.length; i++) {
+ var c = text.charCodeAt(i);
+ if (ts.isLineBreak(c)) {
+ if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) {
+ var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1);
+ if (!parts) {
+ parts = [];
+ }
+ parts.push(ts.createLiteral(decodeEntities(part)));
}
+ firstNonWhitespace = -1;
}
- if (!hasExportDeclarationWithExportClause) {
- return addExportStarFunction(statements, undefined);
+ else if (!ts.isWhiteSpace(c)) {
+ lastNonWhitespace = i;
+ if (firstNonWhitespace === -1) {
+ firstNonWhitespace = i;
+ }
}
}
- var exportedNames = [];
- if (exportedLocalNames) {
- for (var _a = 0, exportedLocalNames_1 = exportedLocalNames; _a < exportedLocalNames_1.length; _a++) {
- var exportedLocalName = exportedLocalNames_1[_a];
- exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName.text), ts.createLiteral(true)));
+ if (firstNonWhitespace !== -1) {
+ var part = text.substr(firstNonWhitespace);
+ if (!parts) {
+ parts = [];
}
+ parts.push(ts.createLiteral(decodeEntities(part)));
}
- for (var _b = 0, externalImports_2 = externalImports; _b < externalImports_2.length; _b++) {
- var externalImport = externalImports_2[_b];
- if (externalImport.kind !== 236) {
- continue;
+ if (parts) {
+ return ts.reduceLeft(parts, aggregateJsxTextParts);
+ }
+ return undefined;
+ }
+ function aggregateJsxTextParts(left, right) {
+ return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right);
+ }
+ function decodeEntities(text) {
+ return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) {
+ if (decimal) {
+ return String.fromCharCode(parseInt(decimal, 10));
}
- var exportDecl = externalImport;
- if (!exportDecl.exportClause) {
- continue;
+ else if (hex) {
+ return String.fromCharCode(parseInt(hex, 16));
}
- for (var _c = 0, _d = exportDecl.exportClause.elements; _c < _d.length; _c++) {
- var element = _d[_c];
- exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true)));
+ else {
+ var ch = entities[word];
+ return ch ? String.fromCharCode(ch) : match;
}
- }
- var exportedNamesStorageRef = ts.createUniqueName("exportedNames");
- statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(exportedNamesStorageRef, undefined, ts.createObjectLiteral(exportedNames, undefined, true))
- ])));
- return addExportStarFunction(statements, exportedNamesStorageRef);
+ });
}
- function generateSetters(exportStarFunction, dependencyGroups) {
- var setters = [];
- for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) {
- var group = dependencyGroups_1[_i];
- var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); });
- var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName("");
- var statements = [];
- for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) {
- var entry = _b[_a];
- var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile);
- switch (entry.kind) {
- case 230:
- if (!entry.importClause) {
- break;
- }
- case 229:
- ts.Debug.assert(importVariableName !== undefined);
- statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName)));
- break;
- case 236:
- ts.Debug.assert(importVariableName !== undefined);
- if (entry.exportClause) {
- var properties = [];
- for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) {
- var e = _d[_c];
- properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text))));
- }
- statements.push(ts.createStatement(ts.createCall(exportFunctionForFile, undefined, [ts.createObjectLiteral(properties, undefined, true)])));
- }
- else {
- statements.push(ts.createStatement(ts.createCall(exportStarFunction, undefined, [parameterName])));
- }
- break;
- }
- }
- setters.push(ts.createFunctionExpression(undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, ts.createBlock(statements, undefined, true)));
- }
- return ts.createArrayLiteral(setters, undefined, true);
+ function tryDecodeEntities(text) {
+ var decoded = decodeEntities(text);
+ return decoded === text ? undefined : decoded;
}
- function visitSourceElement(node) {
- switch (node.kind) {
- case 230:
- return visitImportDeclaration(node);
- case 229:
- return visitImportEqualsDeclaration(node);
- case 236:
- return visitExportDeclaration(node);
- case 235:
- return visitExportAssignment(node);
- default:
- return visitNestedNode(node);
+ function getTagName(node) {
+ if (node.kind === 242) {
+ return getTagName(node.openingElement);
}
- }
- function visitNestedNode(node) {
- var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
- var savedCurrentParent = currentParent;
- var savedCurrentNode = currentNode;
- var currentGrandparent = currentParent;
- currentParent = currentNode;
- currentNode = node;
- if (currentParent && ts.isBlockScope(currentParent, currentGrandparent)) {
- enclosingBlockScopedContainer = currentParent;
+ else {
+ var name_31 = node.tagName;
+ if (ts.isIdentifier(name_31) && ts.isIntrinsicJsxName(name_31.text)) {
+ return ts.createLiteral(name_31.text);
+ }
+ else {
+ return ts.createExpressionFromEntityName(name_31);
+ }
}
- var result = visitNestedNodeWorker(node);
- enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
- currentParent = savedCurrentParent;
- currentNode = savedCurrentNode;
- return result;
}
- function visitNestedNodeWorker(node) {
- switch (node.kind) {
- case 200:
- return visitVariableStatement(node);
- case 220:
- return visitFunctionDeclaration(node);
- case 221:
- return visitClassDeclaration(node);
- case 206:
- return visitForStatement(node);
- case 207:
- return visitForInStatement(node);
- case 208:
- return visitForOfStatement(node);
- case 204:
- return visitDoStatement(node);
- case 205:
- return visitWhileStatement(node);
- case 214:
- return visitLabeledStatement(node);
- case 212:
- return visitWithStatement(node);
- case 213:
- return visitSwitchStatement(node);
- case 227:
- return visitCaseBlock(node);
- case 249:
- return visitCaseClause(node);
- case 250:
- return visitDefaultClause(node);
- case 216:
- return visitTryStatement(node);
- case 252:
- return visitCatchClause(node);
- case 199:
- return visitBlock(node);
- case 202:
- return visitExpressionStatement(node);
- default:
- return node;
+ function getAttributeName(node) {
+ var name = node.name;
+ if (/^[A-Za-z_]\w*$/.test(name.text)) {
+ return name;
+ }
+ else {
+ return ts.createLiteral(name.text);
}
}
- function visitImportDeclaration(node) {
- if (node.importClause && ts.contains(externalImports, node)) {
- hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));
+ function visitJsxExpression(node) {
+ return ts.visitNode(node.expression, visitor, ts.isExpression);
+ }
+ }
+ ts.transformJsx = transformJsx;
+ function createEntitiesMap() {
+ return ts.createMap({
+ "quot": 0x0022,
+ "amp": 0x0026,
+ "apos": 0x0027,
+ "lt": 0x003C,
+ "gt": 0x003E,
+ "nbsp": 0x00A0,
+ "iexcl": 0x00A1,
+ "cent": 0x00A2,
+ "pound": 0x00A3,
+ "curren": 0x00A4,
+ "yen": 0x00A5,
+ "brvbar": 0x00A6,
+ "sect": 0x00A7,
+ "uml": 0x00A8,
+ "copy": 0x00A9,
+ "ordf": 0x00AA,
+ "laquo": 0x00AB,
+ "not": 0x00AC,
+ "shy": 0x00AD,
+ "reg": 0x00AE,
+ "macr": 0x00AF,
+ "deg": 0x00B0,
+ "plusmn": 0x00B1,
+ "sup2": 0x00B2,
+ "sup3": 0x00B3,
+ "acute": 0x00B4,
+ "micro": 0x00B5,
+ "para": 0x00B6,
+ "middot": 0x00B7,
+ "cedil": 0x00B8,
+ "sup1": 0x00B9,
+ "ordm": 0x00BA,
+ "raquo": 0x00BB,
+ "frac14": 0x00BC,
+ "frac12": 0x00BD,
+ "frac34": 0x00BE,
+ "iquest": 0x00BF,
+ "Agrave": 0x00C0,
+ "Aacute": 0x00C1,
+ "Acirc": 0x00C2,
+ "Atilde": 0x00C3,
+ "Auml": 0x00C4,
+ "Aring": 0x00C5,
+ "AElig": 0x00C6,
+ "Ccedil": 0x00C7,
+ "Egrave": 0x00C8,
+ "Eacute": 0x00C9,
+ "Ecirc": 0x00CA,
+ "Euml": 0x00CB,
+ "Igrave": 0x00CC,
+ "Iacute": 0x00CD,
+ "Icirc": 0x00CE,
+ "Iuml": 0x00CF,
+ "ETH": 0x00D0,
+ "Ntilde": 0x00D1,
+ "Ograve": 0x00D2,
+ "Oacute": 0x00D3,
+ "Ocirc": 0x00D4,
+ "Otilde": 0x00D5,
+ "Ouml": 0x00D6,
+ "times": 0x00D7,
+ "Oslash": 0x00D8,
+ "Ugrave": 0x00D9,
+ "Uacute": 0x00DA,
+ "Ucirc": 0x00DB,
+ "Uuml": 0x00DC,
+ "Yacute": 0x00DD,
+ "THORN": 0x00DE,
+ "szlig": 0x00DF,
+ "agrave": 0x00E0,
+ "aacute": 0x00E1,
+ "acirc": 0x00E2,
+ "atilde": 0x00E3,
+ "auml": 0x00E4,
+ "aring": 0x00E5,
+ "aelig": 0x00E6,
+ "ccedil": 0x00E7,
+ "egrave": 0x00E8,
+ "eacute": 0x00E9,
+ "ecirc": 0x00EA,
+ "euml": 0x00EB,
+ "igrave": 0x00EC,
+ "iacute": 0x00ED,
+ "icirc": 0x00EE,
+ "iuml": 0x00EF,
+ "eth": 0x00F0,
+ "ntilde": 0x00F1,
+ "ograve": 0x00F2,
+ "oacute": 0x00F3,
+ "ocirc": 0x00F4,
+ "otilde": 0x00F5,
+ "ouml": 0x00F6,
+ "divide": 0x00F7,
+ "oslash": 0x00F8,
+ "ugrave": 0x00F9,
+ "uacute": 0x00FA,
+ "ucirc": 0x00FB,
+ "uuml": 0x00FC,
+ "yacute": 0x00FD,
+ "thorn": 0x00FE,
+ "yuml": 0x00FF,
+ "OElig": 0x0152,
+ "oelig": 0x0153,
+ "Scaron": 0x0160,
+ "scaron": 0x0161,
+ "Yuml": 0x0178,
+ "fnof": 0x0192,
+ "circ": 0x02C6,
+ "tilde": 0x02DC,
+ "Alpha": 0x0391,
+ "Beta": 0x0392,
+ "Gamma": 0x0393,
+ "Delta": 0x0394,
+ "Epsilon": 0x0395,
+ "Zeta": 0x0396,
+ "Eta": 0x0397,
+ "Theta": 0x0398,
+ "Iota": 0x0399,
+ "Kappa": 0x039A,
+ "Lambda": 0x039B,
+ "Mu": 0x039C,
+ "Nu": 0x039D,
+ "Xi": 0x039E,
+ "Omicron": 0x039F,
+ "Pi": 0x03A0,
+ "Rho": 0x03A1,
+ "Sigma": 0x03A3,
+ "Tau": 0x03A4,
+ "Upsilon": 0x03A5,
+ "Phi": 0x03A6,
+ "Chi": 0x03A7,
+ "Psi": 0x03A8,
+ "Omega": 0x03A9,
+ "alpha": 0x03B1,
+ "beta": 0x03B2,
+ "gamma": 0x03B3,
+ "delta": 0x03B4,
+ "epsilon": 0x03B5,
+ "zeta": 0x03B6,
+ "eta": 0x03B7,
+ "theta": 0x03B8,
+ "iota": 0x03B9,
+ "kappa": 0x03BA,
+ "lambda": 0x03BB,
+ "mu": 0x03BC,
+ "nu": 0x03BD,
+ "xi": 0x03BE,
+ "omicron": 0x03BF,
+ "pi": 0x03C0,
+ "rho": 0x03C1,
+ "sigmaf": 0x03C2,
+ "sigma": 0x03C3,
+ "tau": 0x03C4,
+ "upsilon": 0x03C5,
+ "phi": 0x03C6,
+ "chi": 0x03C7,
+ "psi": 0x03C8,
+ "omega": 0x03C9,
+ "thetasym": 0x03D1,
+ "upsih": 0x03D2,
+ "piv": 0x03D6,
+ "ensp": 0x2002,
+ "emsp": 0x2003,
+ "thinsp": 0x2009,
+ "zwnj": 0x200C,
+ "zwj": 0x200D,
+ "lrm": 0x200E,
+ "rlm": 0x200F,
+ "ndash": 0x2013,
+ "mdash": 0x2014,
+ "lsquo": 0x2018,
+ "rsquo": 0x2019,
+ "sbquo": 0x201A,
+ "ldquo": 0x201C,
+ "rdquo": 0x201D,
+ "bdquo": 0x201E,
+ "dagger": 0x2020,
+ "Dagger": 0x2021,
+ "bull": 0x2022,
+ "hellip": 0x2026,
+ "permil": 0x2030,
+ "prime": 0x2032,
+ "Prime": 0x2033,
+ "lsaquo": 0x2039,
+ "rsaquo": 0x203A,
+ "oline": 0x203E,
+ "frasl": 0x2044,
+ "euro": 0x20AC,
+ "image": 0x2111,
+ "weierp": 0x2118,
+ "real": 0x211C,
+ "trade": 0x2122,
+ "alefsym": 0x2135,
+ "larr": 0x2190,
+ "uarr": 0x2191,
+ "rarr": 0x2192,
+ "darr": 0x2193,
+ "harr": 0x2194,
+ "crarr": 0x21B5,
+ "lArr": 0x21D0,
+ "uArr": 0x21D1,
+ "rArr": 0x21D2,
+ "dArr": 0x21D3,
+ "hArr": 0x21D4,
+ "forall": 0x2200,
+ "part": 0x2202,
+ "exist": 0x2203,
+ "empty": 0x2205,
+ "nabla": 0x2207,
+ "isin": 0x2208,
+ "notin": 0x2209,
+ "ni": 0x220B,
+ "prod": 0x220F,
+ "sum": 0x2211,
+ "minus": 0x2212,
+ "lowast": 0x2217,
+ "radic": 0x221A,
+ "prop": 0x221D,
+ "infin": 0x221E,
+ "ang": 0x2220,
+ "and": 0x2227,
+ "or": 0x2228,
+ "cap": 0x2229,
+ "cup": 0x222A,
+ "int": 0x222B,
+ "there4": 0x2234,
+ "sim": 0x223C,
+ "cong": 0x2245,
+ "asymp": 0x2248,
+ "ne": 0x2260,
+ "equiv": 0x2261,
+ "le": 0x2264,
+ "ge": 0x2265,
+ "sub": 0x2282,
+ "sup": 0x2283,
+ "nsub": 0x2284,
+ "sube": 0x2286,
+ "supe": 0x2287,
+ "oplus": 0x2295,
+ "otimes": 0x2297,
+ "perp": 0x22A5,
+ "sdot": 0x22C5,
+ "lceil": 0x2308,
+ "rceil": 0x2309,
+ "lfloor": 0x230A,
+ "rfloor": 0x230B,
+ "lang": 0x2329,
+ "rang": 0x232A,
+ "loz": 0x25CA,
+ "spades": 0x2660,
+ "clubs": 0x2663,
+ "hearts": 0x2665,
+ "diams": 0x2666
+ });
+ }
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function transformES2017(context) {
+ var ES2017SubstitutionFlags;
+ (function (ES2017SubstitutionFlags) {
+ ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper";
+ })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {}));
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ var resolver = context.getEmitResolver();
+ var compilerOptions = context.getCompilerOptions();
+ var languageVersion = ts.getEmitScriptTarget(compilerOptions);
+ var currentSourceFileExternalHelpersModuleName;
+ var enabledSubstitutions;
+ var applicableSubstitutions;
+ var currentSuperContainer;
+ var previousOnEmitNode = context.onEmitNode;
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ context.onEmitNode = onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ var currentScope;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
}
- return undefined;
+ currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName;
+ return ts.visitEachChild(node, visitor, context);
}
- function visitImportEqualsDeclaration(node) {
- if (ts.contains(externalImports, node)) {
- hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));
+ function visitor(node) {
+ if (node.transformFlags & 16) {
+ return visitorWorker(node);
}
- return undefined;
+ else if (node.transformFlags & 32) {
+ return ts.visitEachChild(node, visitor, context);
+ }
+ return node;
}
- function visitExportDeclaration(node) {
- if (!node.moduleSpecifier) {
- var statements = [];
- ts.addRange(statements, ts.map(node.exportClause.elements, visitExportSpecifier));
- return statements;
+ function visitorWorker(node) {
+ switch (node.kind) {
+ case 119:
+ return undefined;
+ case 185:
+ return visitAwaitExpression(node);
+ case 148:
+ return visitMethodDeclaration(node);
+ case 221:
+ return visitFunctionDeclaration(node);
+ case 180:
+ return visitFunctionExpression(node);
+ case 181:
+ return visitArrowFunction(node);
+ default:
+ ts.Debug.failBadSyntaxKind(node);
+ return node;
}
- return undefined;
}
- function visitExportSpecifier(specifier) {
- if (resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name)
- || resolver.isValueAliasDeclaration(specifier)) {
- recordExportName(specifier.name);
- return createExportStatement(specifier.name, specifier.propertyName || specifier.name);
+ function visitAwaitExpression(node) {
+ return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node);
+ }
+ function visitMethodDeclaration(node) {
+ if (!ts.isAsyncFunctionLike(node)) {
+ return node;
}
- return undefined;
+ var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
+ ts.setCommentRange(method, node);
+ ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
+ ts.setOriginalNode(method, node);
+ return method;
}
- function visitExportAssignment(node) {
- if (!node.isExportEquals) {
- if (ts.nodeIsSynthesized(node) || resolver.isValueAliasDeclaration(node)) {
- return createExportStatement(ts.createLiteral("default"), node.expression);
- }
+ function visitFunctionDeclaration(node) {
+ if (!ts.isAsyncFunctionLike(node)) {
+ return node;
}
- return undefined;
+ var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
+ ts.setOriginalNode(func, node);
+ return func;
}
- function visitVariableStatement(node) {
- var shouldHoist = ((ts.getCombinedNodeFlags(ts.getOriginalNode(node.declarationList)) & 3) == 0) ||
- enclosingBlockScopedContainer.kind === 256;
- if (!shouldHoist) {
+ function visitFunctionExpression(node) {
+ if (!ts.isAsyncFunctionLike(node)) {
return node;
}
- var isExported = ts.hasModifier(node, 1);
- var expressions = [];
- for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
- var variable = _a[_i];
- var visited = transformVariable(variable, isExported);
- if (visited) {
- expressions.push(visited);
- }
+ if (ts.nodeIsMissing(node.body)) {
+ return ts.createOmittedExpression();
}
- if (expressions.length) {
- return ts.createStatement(ts.inlineExpressions(expressions), node);
+ var func = ts.createFunctionExpression(undefined, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
+ ts.setOriginalNode(func, node);
+ return func;
+ }
+ function visitArrowFunction(node) {
+ if (!ts.isAsyncFunctionLike(node)) {
+ return node;
}
- return undefined;
+ var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
+ ts.setOriginalNode(func, node);
+ return func;
}
- function transformVariable(node, isExported) {
- hoistBindingElement(node, isExported);
- if (!node.initializer) {
- return;
+ function transformFunctionBody(node) {
+ return transformAsyncFunctionBody(node);
+ }
+ function transformConciseBody(node) {
+ return transformAsyncFunctionBody(node);
+ }
+ function transformFunctionBodyWorker(body, start) {
+ if (start === void 0) { start = 0; }
+ var savedCurrentScope = currentScope;
+ currentScope = body;
+ startLexicalEnvironment();
+ var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
+ var visited = ts.updateBlock(body, statements);
+ var declarations = endLexicalEnvironment();
+ currentScope = savedCurrentScope;
+ return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
+ }
+ function transformAsyncFunctionBody(node) {
+ var nodeType = node.original ? node.original.type : node.type;
+ var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined;
+ var isArrowFunction = node.kind === 181;
+ var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0;
+ if (!isArrowFunction) {
+ var statements = [];
+ var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor);
+ statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ var block = ts.createBlock(statements, node.body, true);
+ if (languageVersion >= 2) {
+ if (resolver.getNodeCheckFlags(node) & 4096) {
+ enableSubstitutionForAsyncMethodsWithSuper();
+ ts.setEmitFlags(block, 8);
+ }
+ else if (resolver.getNodeCheckFlags(node) & 2048) {
+ enableSubstitutionForAsyncMethodsWithSuper();
+ ts.setEmitFlags(block, 4);
+ }
+ }
+ return block;
}
- var name = node.name;
- if (ts.isIdentifier(name)) {
- return ts.createAssignment(name, node.initializer);
+ else {
+ return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, true));
+ }
+ }
+ function transformConciseBodyWorker(body, forceBlockFunctionBody) {
+ if (ts.isBlock(body)) {
+ return transformFunctionBodyWorker(body);
}
else {
- return ts.flattenVariableDestructuringToExpression(context, node, hoistVariableDeclaration);
+ startLexicalEnvironment();
+ var visited = ts.visitNode(body, visitor, ts.isConciseBody);
+ var declarations = endLexicalEnvironment();
+ var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
+ if (forceBlockFunctionBody && !ts.isBlock(merged)) {
+ return ts.createBlock([
+ ts.createReturn(merged)
+ ]);
+ }
+ else {
+ return merged;
+ }
}
}
- function visitFunctionDeclaration(node) {
- if (ts.hasModifier(node, 1)) {
- var name_31 = node.name || ts.getGeneratedNameForNode(node);
- var newNode = ts.createFunctionDeclaration(undefined, undefined, node.asteriskToken, name_31, undefined, node.parameters, undefined, node.body, node);
- recordExportedFunctionDeclaration(node);
- if (!ts.hasModifier(node, 512)) {
- recordExportName(name_31);
+ function getPromiseConstructor(type) {
+ var typeName = ts.getEntityNameFromTypeNode(type);
+ if (typeName && ts.isEntityName(typeName)) {
+ var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
+ if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
+ || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
+ return typeName;
}
- ts.setOriginalNode(newNode, node);
- node = newNode;
}
- hoistFunctionDeclaration(node);
return undefined;
}
- function visitExpressionStatement(node) {
- var originalNode = ts.getOriginalNode(node);
- if ((originalNode.kind === 225 || originalNode.kind === 224) && ts.hasModifier(originalNode, 1)) {
- var name_32 = getDeclarationName(originalNode);
- if (originalNode.kind === 224) {
- hoistVariableDeclaration(name_32);
+ function enableSubstitutionForAsyncMethodsWithSuper() {
+ if ((enabledSubstitutions & 1) === 0) {
+ enabledSubstitutions |= 1;
+ context.enableSubstitution(175);
+ context.enableSubstitution(173);
+ context.enableSubstitution(174);
+ context.enableEmitNotification(222);
+ context.enableEmitNotification(148);
+ context.enableEmitNotification(150);
+ context.enableEmitNotification(151);
+ context.enableEmitNotification(149);
+ }
+ }
+ function substituteExpression(node) {
+ switch (node.kind) {
+ case 173:
+ return substitutePropertyAccessExpression(node);
+ case 174:
+ return substituteElementAccessExpression(node);
+ case 175:
+ if (enabledSubstitutions & 1) {
+ return substituteCallExpression(node);
+ }
+ break;
+ }
+ return node;
+ }
+ function substitutePropertyAccessExpression(node) {
+ if (enabledSubstitutions & 1 && node.expression.kind === 96) {
+ var flags = getSuperContainerAsyncMethodFlags();
+ if (flags) {
+ return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node);
}
- return [
- node,
- createExportStatement(name_32, name_32)
- ];
}
return node;
}
- function visitClassDeclaration(node) {
- var name = getDeclarationName(node);
- hoistVariableDeclaration(name);
- var statements = [];
- statements.push(ts.createStatement(ts.createAssignment(name, ts.createClassExpression(undefined, node.name, undefined, node.heritageClauses, node.members, node)), node));
- if (ts.hasModifier(node, 1)) {
- if (!ts.hasModifier(node, 512)) {
- recordExportName(name);
+ function substituteElementAccessExpression(node) {
+ if (enabledSubstitutions & 1 && node.expression.kind === 96) {
+ var flags = getSuperContainerAsyncMethodFlags();
+ if (flags) {
+ return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node);
}
- statements.push(createDeclarationExport(node));
}
- return statements;
+ return node;
+ }
+ function substituteCallExpression(node) {
+ var expression = node.expression;
+ if (ts.isSuperProperty(expression)) {
+ var flags = getSuperContainerAsyncMethodFlags();
+ if (flags) {
+ var argumentExpression = ts.isPropertyAccessExpression(expression)
+ ? substitutePropertyAccessExpression(expression)
+ : substituteElementAccessExpression(expression);
+ return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [
+ ts.createThis()
+ ].concat(node.arguments));
+ }
+ }
+ return node;
+ }
+ function isSuperContainer(node) {
+ var kind = node.kind;
+ return kind === 222
+ || kind === 149
+ || kind === 148
+ || kind === 150
+ || kind === 151;
+ }
+ function onEmitNode(emitContext, node, emitCallback) {
+ var savedApplicableSubstitutions = applicableSubstitutions;
+ var savedCurrentSuperContainer = currentSuperContainer;
+ if (enabledSubstitutions & 1 && isSuperContainer(node)) {
+ currentSuperContainer = node;
+ }
+ previousOnEmitNode(emitContext, node, emitCallback);
+ applicableSubstitutions = savedApplicableSubstitutions;
+ currentSuperContainer = savedCurrentSuperContainer;
+ }
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (emitContext === 1) {
+ return substituteExpression(node);
+ }
+ return node;
+ }
+ function createSuperAccessInAsyncMethod(argumentExpression, flags, location) {
+ if (flags & 4096) {
+ return ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value", location);
+ }
+ else {
+ return ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression], location);
+ }
+ }
+ function getSuperContainerAsyncMethodFlags() {
+ return currentSuperContainer !== undefined
+ && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 | 4096);
+ }
+ }
+ ts.transformES2017 = transformES2017;
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function transformES2016(context) {
+ var hoistVariableDeclaration = context.hoistVariableDeclaration;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitor(node) {
+ if (node.transformFlags & 64) {
+ return visitorWorker(node);
+ }
+ else if (node.transformFlags & 128) {
+ return ts.visitEachChild(node, visitor, context);
+ }
+ else {
+ return node;
+ }
+ }
+ function visitorWorker(node) {
+ switch (node.kind) {
+ case 188:
+ return visitBinaryExpression(node);
+ default:
+ ts.Debug.failBadSyntaxKind(node);
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function visitBinaryExpression(node) {
+ var left = ts.visitNode(node.left, visitor, ts.isExpression);
+ var right = ts.visitNode(node.right, visitor, ts.isExpression);
+ if (node.operatorToken.kind === 61) {
+ var target = void 0;
+ var value = void 0;
+ if (ts.isElementAccessExpression(left)) {
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left);
+ value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left);
+ }
+ else if (ts.isPropertyAccessExpression(left)) {
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left);
+ value = ts.createPropertyAccess(expressionTemp, left.name, left);
+ }
+ else {
+ target = left;
+ value = left;
+ }
+ return ts.createAssignment(target, ts.createMathPow(value, right, node), node);
+ }
+ else if (node.operatorToken.kind === 39) {
+ return ts.createMathPow(left, right, node);
+ }
+ else {
+ ts.Debug.failBadSyntaxKind(node);
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ }
+ ts.transformES2016 = transformES2016;
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var ES2015SubstitutionFlags;
+ (function (ES2015SubstitutionFlags) {
+ ES2015SubstitutionFlags[ES2015SubstitutionFlags["CapturedThis"] = 1] = "CapturedThis";
+ ES2015SubstitutionFlags[ES2015SubstitutionFlags["BlockScopedBindings"] = 2] = "BlockScopedBindings";
+ })(ES2015SubstitutionFlags || (ES2015SubstitutionFlags = {}));
+ var CopyDirection;
+ (function (CopyDirection) {
+ CopyDirection[CopyDirection["ToOriginal"] = 0] = "ToOriginal";
+ CopyDirection[CopyDirection["ToOutParameter"] = 1] = "ToOutParameter";
+ })(CopyDirection || (CopyDirection = {}));
+ var Jump;
+ (function (Jump) {
+ Jump[Jump["Break"] = 2] = "Break";
+ Jump[Jump["Continue"] = 4] = "Continue";
+ Jump[Jump["Return"] = 8] = "Return";
+ })(Jump || (Jump = {}));
+ var SuperCaptureResult;
+ (function (SuperCaptureResult) {
+ SuperCaptureResult[SuperCaptureResult["NoReplacement"] = 0] = "NoReplacement";
+ SuperCaptureResult[SuperCaptureResult["ReplaceSuperCapture"] = 1] = "ReplaceSuperCapture";
+ SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn";
+ })(SuperCaptureResult || (SuperCaptureResult = {}));
+ function transformES2015(context) {
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var resolver = context.getEmitResolver();
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ var previousOnEmitNode = context.onEmitNode;
+ context.onEmitNode = onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ var currentSourceFile;
+ var currentText;
+ var currentParent;
+ var currentNode;
+ var enclosingVariableStatement;
+ var enclosingBlockScopeContainer;
+ var enclosingBlockScopeContainerParent;
+ var enclosingFunction;
+ var enclosingNonArrowFunction;
+ var enclosingNonAsyncFunctionBody;
+ var convertedLoopState;
+ var enabledSubstitutions;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
+ }
+ currentSourceFile = node;
+ currentText = node.text;
+ return ts.visitNode(node, visitor, ts.isSourceFile);
}
- function shouldHoistLoopInitializer(node) {
- return ts.isVariableDeclarationList(node) && (ts.getCombinedNodeFlags(node) & 3) === 0;
+ function visitor(node) {
+ return saveStateAndInvoke(node, dispatcher);
}
- function visitForStatement(node) {
- var initializer = node.initializer;
- if (shouldHoistLoopInitializer(initializer)) {
- var expressions = [];
- for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {
- var variable = _a[_i];
- var visited = transformVariable(variable, false);
- if (visited) {
- expressions.push(visited);
- }
- }
- ;
- return ts.createFor(expressions.length
- ? ts.inlineExpressions(expressions)
- : ts.createSynthesizedNode(193), node.condition, node.incrementor, ts.visitNode(node.statement, visitNestedNode, ts.isStatement), node);
- }
- else {
- return ts.visitEachChild(node, visitNestedNode, context);
+ function dispatcher(node) {
+ return convertedLoopState
+ ? visitorForConvertedLoopWorker(node)
+ : visitorWorker(node);
+ }
+ function saveStateAndInvoke(node, f) {
+ var savedEnclosingFunction = enclosingFunction;
+ var savedEnclosingNonArrowFunction = enclosingNonArrowFunction;
+ var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody;
+ var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer;
+ var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent;
+ var savedEnclosingVariableStatement = enclosingVariableStatement;
+ var savedCurrentParent = currentParent;
+ var savedCurrentNode = currentNode;
+ var savedConvertedLoopState = convertedLoopState;
+ if (ts.nodeStartsNewLexicalEnvironment(node)) {
+ convertedLoopState = undefined;
}
+ onBeforeVisitNode(node);
+ var visited = f(node);
+ convertedLoopState = savedConvertedLoopState;
+ enclosingFunction = savedEnclosingFunction;
+ enclosingNonArrowFunction = savedEnclosingNonArrowFunction;
+ enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody;
+ enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer;
+ enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent;
+ enclosingVariableStatement = savedEnclosingVariableStatement;
+ currentParent = savedCurrentParent;
+ currentNode = savedCurrentNode;
+ return visited;
}
- function transformForBinding(node) {
- var firstDeclaration = ts.firstOrUndefined(node.declarations);
- hoistBindingElement(firstDeclaration, false);
- var name = firstDeclaration.name;
- return ts.isIdentifier(name)
- ? name
- : ts.flattenVariableDestructuringToExpression(context, firstDeclaration, hoistVariableDeclaration);
+ function shouldCheckNode(node) {
+ return (node.transformFlags & 256) !== 0 ||
+ node.kind === 215 ||
+ (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node));
}
- function visitForInStatement(node) {
- var initializer = node.initializer;
- if (shouldHoistLoopInitializer(initializer)) {
- var updated = ts.getMutableClone(node);
- updated.initializer = transformForBinding(initializer);
- updated.statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
- return updated;
+ function visitorWorker(node) {
+ if (shouldCheckNode(node)) {
+ return visitJavaScript(node);
+ }
+ else if (node.transformFlags & 512) {
+ return ts.visitEachChild(node, visitor, context);
}
else {
- return ts.visitEachChild(node, visitNestedNode, context);
+ return node;
}
}
- function visitForOfStatement(node) {
- var initializer = node.initializer;
- if (shouldHoistLoopInitializer(initializer)) {
- var updated = ts.getMutableClone(node);
- updated.initializer = transformForBinding(initializer);
- updated.statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
- return updated;
+ function visitorForConvertedLoopWorker(node) {
+ var result;
+ if (shouldCheckNode(node)) {
+ result = visitJavaScript(node);
}
else {
- return ts.visitEachChild(node, visitNestedNode, context);
- }
- }
- function visitDoStatement(node) {
- var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
- if (statement !== node.statement) {
- var updated = ts.getMutableClone(node);
- updated.statement = statement;
- return updated;
+ result = visitNodesInConvertedLoop(node);
}
- return node;
+ return result;
}
- function visitWhileStatement(node) {
- var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
- if (statement !== node.statement) {
- var updated = ts.getMutableClone(node);
- updated.statement = statement;
- return updated;
+ function visitNodesInConvertedLoop(node) {
+ switch (node.kind) {
+ case 212:
+ return visitReturnStatement(node);
+ case 201:
+ return visitVariableStatement(node);
+ case 214:
+ return visitSwitchStatement(node);
+ case 211:
+ case 210:
+ return visitBreakOrContinueStatement(node);
+ case 98:
+ return visitThisKeyword(node);
+ case 70:
+ return visitIdentifier(node);
+ default:
+ return ts.visitEachChild(node, visitor, context);
}
- return node;
}
- function visitLabeledStatement(node) {
- var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
- if (statement !== node.statement) {
- var updated = ts.getMutableClone(node);
- updated.statement = statement;
- return updated;
+ function visitJavaScript(node) {
+ switch (node.kind) {
+ case 83:
+ return node;
+ case 222:
+ return visitClassDeclaration(node);
+ case 193:
+ return visitClassExpression(node);
+ case 143:
+ return visitParameter(node);
+ case 221:
+ return visitFunctionDeclaration(node);
+ case 181:
+ return visitArrowFunction(node);
+ case 180:
+ return visitFunctionExpression(node);
+ case 219:
+ return visitVariableDeclaration(node);
+ case 70:
+ return visitIdentifier(node);
+ case 220:
+ return visitVariableDeclarationList(node);
+ case 215:
+ return visitLabeledStatement(node);
+ case 205:
+ return visitDoStatement(node);
+ case 206:
+ return visitWhileStatement(node);
+ case 207:
+ return visitForStatement(node);
+ case 208:
+ return visitForInStatement(node);
+ case 209:
+ return visitForOfStatement(node);
+ case 203:
+ return visitExpressionStatement(node);
+ case 172:
+ return visitObjectLiteralExpression(node);
+ case 254:
+ return visitShorthandPropertyAssignment(node);
+ case 171:
+ return visitArrayLiteralExpression(node);
+ case 175:
+ return visitCallExpression(node);
+ case 176:
+ return visitNewExpression(node);
+ case 179:
+ return visitParenthesizedExpression(node, true);
+ case 188:
+ return visitBinaryExpression(node, true);
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ return visitTemplateLiteral(node);
+ case 177:
+ return visitTaggedTemplateExpression(node);
+ case 190:
+ return visitTemplateExpression(node);
+ case 191:
+ return visitYieldExpression(node);
+ case 96:
+ return visitSuperKeyword();
+ case 191:
+ return ts.visitEachChild(node, visitor, context);
+ case 148:
+ return visitMethodDeclaration(node);
+ case 256:
+ return visitSourceFileNode(node);
+ case 201:
+ return visitVariableStatement(node);
+ default:
+ ts.Debug.failBadSyntaxKind(node);
+ return ts.visitEachChild(node, visitor, context);
}
- return node;
}
- function visitWithStatement(node) {
- var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
- if (statement !== node.statement) {
- var updated = ts.getMutableClone(node);
- updated.statement = statement;
- return updated;
+ function onBeforeVisitNode(node) {
+ if (currentNode) {
+ if (ts.isBlockScope(currentNode, currentParent)) {
+ enclosingBlockScopeContainer = currentNode;
+ enclosingBlockScopeContainerParent = currentParent;
+ }
+ if (ts.isFunctionLike(currentNode)) {
+ enclosingFunction = currentNode;
+ if (currentNode.kind !== 181) {
+ enclosingNonArrowFunction = currentNode;
+ if (!(ts.getEmitFlags(currentNode) & 2097152)) {
+ enclosingNonAsyncFunctionBody = currentNode;
+ }
+ }
+ }
+ switch (currentNode.kind) {
+ case 201:
+ enclosingVariableStatement = currentNode;
+ break;
+ case 220:
+ case 219:
+ case 170:
+ case 168:
+ case 169:
+ break;
+ default:
+ enclosingVariableStatement = undefined;
+ }
}
- return node;
+ currentParent = currentNode;
+ currentNode = node;
}
function visitSwitchStatement(node) {
- var caseBlock = ts.visitNode(node.caseBlock, visitNestedNode, ts.isCaseBlock);
- if (caseBlock !== node.caseBlock) {
- var updated = ts.getMutableClone(node);
- updated.caseBlock = caseBlock;
- return updated;
- }
- return node;
+ ts.Debug.assert(convertedLoopState !== undefined);
+ var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;
+ convertedLoopState.allowedNonLabeledJumps |= 2;
+ var result = ts.visitEachChild(node, visitor, context);
+ convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps;
+ return result;
}
- function visitCaseBlock(node) {
- var clauses = ts.visitNodes(node.clauses, visitNestedNode, ts.isCaseOrDefaultClause);
- if (clauses !== node.clauses) {
- var updated = ts.getMutableClone(node);
- updated.clauses = clauses;
- return updated;
- }
- return node;
+ function visitReturnStatement(node) {
+ ts.Debug.assert(convertedLoopState !== undefined);
+ convertedLoopState.nonLocalJumps |= 8;
+ return ts.createReturn(ts.createObjectLiteral([
+ ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression
+ ? ts.visitNode(node.expression, visitor, ts.isExpression)
+ : ts.createVoidZero())
+ ]));
}
- function visitCaseClause(node) {
- var statements = ts.visitNodes(node.statements, visitNestedNode, ts.isStatement);
- if (statements !== node.statements) {
- var updated = ts.getMutableClone(node);
- updated.statements = statements;
- return updated;
+ function visitThisKeyword(node) {
+ ts.Debug.assert(convertedLoopState !== undefined);
+ if (enclosingFunction && enclosingFunction.kind === 181) {
+ convertedLoopState.containsLexicalThis = true;
+ return node;
}
- return node;
+ return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this"));
}
- function visitDefaultClause(node) {
- return ts.visitEachChild(node, visitNestedNode, context);
+ function visitIdentifier(node) {
+ if (!convertedLoopState) {
+ return node;
+ }
+ if (ts.isGeneratedIdentifier(node)) {
+ return node;
+ }
+ if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) {
+ return node;
+ }
+ return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments"));
}
- function visitTryStatement(node) {
- return ts.visitEachChild(node, visitNestedNode, context);
+ function visitBreakOrContinueStatement(node) {
+ if (convertedLoopState) {
+ var jump = node.kind === 211 ? 2 : 4;
+ var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) ||
+ (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
+ if (!canUseBreakOrContinue) {
+ var labelMarker = void 0;
+ if (!node.label) {
+ if (node.kind === 211) {
+ convertedLoopState.nonLocalJumps |= 2;
+ labelMarker = "break";
+ }
+ else {
+ convertedLoopState.nonLocalJumps |= 4;
+ labelMarker = "continue";
+ }
+ }
+ else {
+ if (node.kind === 211) {
+ labelMarker = "break-" + node.label.text;
+ setLabeledJump(convertedLoopState, true, node.label.text, labelMarker);
+ }
+ else {
+ labelMarker = "continue-" + node.label.text;
+ setLabeledJump(convertedLoopState, false, node.label.text, labelMarker);
+ }
+ }
+ var returnExpression = ts.createLiteral(labelMarker);
+ if (convertedLoopState.loopOutParameters.length) {
+ var outParams = convertedLoopState.loopOutParameters;
+ var expr = void 0;
+ for (var i = 0; i < outParams.length; i++) {
+ var copyExpr = copyOutParameter(outParams[i], 1);
+ if (i === 0) {
+ expr = copyExpr;
+ }
+ else {
+ expr = ts.createBinary(expr, 25, copyExpr);
+ }
+ }
+ returnExpression = ts.createBinary(expr, 25, returnExpression);
+ }
+ return ts.createReturn(returnExpression);
+ }
+ }
+ return ts.visitEachChild(node, visitor, context);
}
- function visitCatchClause(node) {
- var block = ts.visitNode(node.block, visitNestedNode, ts.isBlock);
- if (block !== node.block) {
- var updated = ts.getMutableClone(node);
- updated.block = block;
- return updated;
+ function visitClassDeclaration(node) {
+ var modifierFlags = ts.getModifierFlags(node);
+ var isExported = modifierFlags & 1;
+ var isDefault = modifierFlags & 512;
+ var modifiers = isExported && !isDefault
+ ? ts.filter(node.modifiers, isExportModifier)
+ : undefined;
+ var statement = ts.createVariableStatement(modifiers, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(getDeclarationName(node, true), undefined, transformClassLikeDeclarationToExpression(node))
+ ]), node);
+ ts.setOriginalNode(statement, node);
+ ts.startOnNewLine(statement);
+ if (isExported && isDefault) {
+ var statements = [statement];
+ statements.push(ts.createExportAssignment(undefined, undefined, false, getDeclarationName(node, false)));
+ return statements;
}
- return node;
+ return statement;
}
- function visitBlock(node) {
- return ts.visitEachChild(node, visitNestedNode, context);
+ function isExportModifier(node) {
+ return node.kind === 83;
}
- function onEmitNode(emitContext, node, emitCallback) {
- if (node.kind === 256) {
- exportFunctionForFile = exportFunctionForFileMap[ts.getOriginalNodeId(node)];
- previousOnEmitNode(emitContext, node, emitCallback);
- exportFunctionForFile = undefined;
+ function visitClassExpression(node) {
+ return transformClassLikeDeclarationToExpression(node);
+ }
+ function transformClassLikeDeclarationToExpression(node) {
+ if (node.name) {
+ enableSubstitutionsForBlockScopedBindings();
}
- else {
- previousOnEmitNode(emitContext, node, emitCallback);
+ var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node);
+ var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter("_super")] : [], undefined, transformClassBody(node, extendsClauseElement));
+ if (ts.getEmitFlags(node) & 524288) {
+ ts.setEmitFlags(classFunction, 524288);
}
+ var inner = ts.createPartiallyEmittedExpression(classFunction);
+ inner.end = node.end;
+ ts.setEmitFlags(inner, 49152);
+ var outer = ts.createPartiallyEmittedExpression(inner);
+ outer.end = ts.skipTrivia(currentText, node.pos);
+ ts.setEmitFlags(outer, 49152);
+ return ts.createParen(ts.createCall(outer, undefined, extendsClauseElement
+ ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)]
+ : []));
}
- function onSubstituteNode(emitContext, node) {
- node = previousOnSubstituteNode(emitContext, node);
- if (emitContext === 1) {
- return substituteExpression(node);
- }
- return node;
+ function transformClassBody(node, extendsClauseElement) {
+ var statements = [];
+ startLexicalEnvironment();
+ addExtendsHelperIfNeeded(statements, node, extendsClauseElement);
+ addConstructor(statements, node, extendsClauseElement);
+ addClassMembers(statements, node);
+ var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentText, node.members.end), 17);
+ var localName = getLocalName(node);
+ var outer = ts.createPartiallyEmittedExpression(localName);
+ outer.end = closingBraceLocation.end;
+ ts.setEmitFlags(outer, 49152);
+ var statement = ts.createReturn(outer);
+ statement.pos = closingBraceLocation.pos;
+ ts.setEmitFlags(statement, 49152 | 12288);
+ statements.push(statement);
+ ts.addRange(statements, endLexicalEnvironment());
+ var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true);
+ ts.setEmitFlags(block, 49152);
+ return block;
}
- function substituteExpression(node) {
- switch (node.kind) {
- case 69:
- return substituteExpressionIdentifier(node);
- case 187:
- return substituteBinaryExpression(node);
- case 185:
- case 186:
- return substituteUnaryExpression(node);
+ function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {
+ if (extendsClauseElement) {
+ statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, getDeclarationName(node)), extendsClauseElement));
}
- return node;
}
- function substituteExpressionIdentifier(node) {
- var importDeclaration = resolver.getReferencedImportDeclaration(node);
- if (importDeclaration) {
- var importBinding = createImportBinding(importDeclaration);
- if (importBinding) {
- return importBinding;
- }
+ function addConstructor(statements, node, extendsClauseElement) {
+ var constructor = ts.getFirstConstructorWithBody(node);
+ var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
+ var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node);
+ if (extendsClauseElement) {
+ ts.setEmitFlags(constructorFunction, 256);
}
- return node;
+ statements.push(constructorFunction);
}
- function substituteBinaryExpression(node) {
- if (ts.isAssignmentOperator(node.operatorToken.kind)) {
- return substituteAssignmentExpression(node);
+ function transformConstructorParameters(constructor, hasSynthesizedSuper) {
+ if (constructor && !hasSynthesizedSuper) {
+ return ts.visitNodes(constructor.parameters, visitor, ts.isParameter);
}
- return node;
+ return [];
}
- function substituteAssignmentExpression(node) {
- ts.setEmitFlags(node, 128);
- var left = node.left;
- switch (left.kind) {
- case 69:
- var exportDeclaration = resolver.getReferencedExportContainer(left);
- if (exportDeclaration) {
- return createExportExpression(left, node);
- }
- break;
- case 171:
- case 170:
- if (hasExportedReferenceInDestructuringPattern(left)) {
- return substituteDestructuring(node);
- }
- break;
+ function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
+ var statements = [];
+ startLexicalEnvironment();
+ var statementOffset = -1;
+ if (hasSynthesizedSuper) {
+ statementOffset = 1;
}
- return node;
- }
- function isExportedBinding(name) {
- var container = resolver.getReferencedExportContainer(name);
- return container && container.kind === 256;
- }
- function hasExportedReferenceInDestructuringPattern(node) {
- switch (node.kind) {
- case 69:
- return isExportedBinding(node);
- case 171:
- for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
- var property = _a[_i];
- if (hasExportedReferenceInObjectDestructuringElement(property)) {
- return true;
- }
- }
- break;
- case 170:
- for (var _b = 0, _c = node.elements; _b < _c.length; _b++) {
- var element = _c[_b];
- if (hasExportedReferenceInArrayDestructuringElement(element)) {
- return true;
- }
- }
- break;
+ else if (constructor) {
+ statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor);
}
- return false;
- }
- function hasExportedReferenceInObjectDestructuringElement(node) {
- if (ts.isShorthandPropertyAssignment(node)) {
- return isExportedBinding(node.name);
+ if (constructor) {
+ addDefaultValueAssignmentsIfNeeded(statements, constructor);
+ addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
+ ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
- else if (ts.isPropertyAssignment(node)) {
- return hasExportedReferenceInDestructuringElement(node.initializer);
+ var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
+ if (superCaptureStatus === 1 || superCaptureStatus === 2) {
+ statementOffset++;
}
- else {
- return false;
+ if (constructor) {
+ var body = saveStateAndInvoke(constructor, function (constructor) { return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset); });
+ ts.addRange(statements, body);
}
- }
- function hasExportedReferenceInArrayDestructuringElement(node) {
- if (ts.isSpreadElementExpression(node)) {
- var expression = node.expression;
- return ts.isIdentifier(expression) && isExportedBinding(expression);
+ if (extendsClauseElement
+ && superCaptureStatus !== 2
+ && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {
+ statements.push(ts.createReturn(ts.createIdentifier("_this")));
}
- else {
- return hasExportedReferenceInDestructuringElement(node);
+ ts.addRange(statements, endLexicalEnvironment());
+ var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true);
+ if (!constructor) {
+ ts.setEmitFlags(block, 49152);
}
+ return block;
}
- function hasExportedReferenceInDestructuringElement(node) {
- if (ts.isBinaryExpression(node)) {
- var left = node.left;
- return node.operatorToken.kind === 56
- && isDestructuringPattern(left)
- && hasExportedReferenceInDestructuringPattern(left);
+ function isSufficientlyCoveredByReturnStatements(statement) {
+ if (statement.kind === 212) {
+ return true;
}
- else if (ts.isIdentifier(node)) {
- return isExportedBinding(node);
+ else if (statement.kind === 204) {
+ var ifStatement = statement;
+ if (ifStatement.elseStatement) {
+ return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
+ isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement);
+ }
}
- else if (ts.isSpreadElementExpression(node)) {
- var expression = node.expression;
- return ts.isIdentifier(expression) && isExportedBinding(expression);
+ else if (statement.kind === 200) {
+ var lastStatement = ts.lastOrUndefined(statement.statements);
+ if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
+ return true;
+ }
}
- else if (isDestructuringPattern(node)) {
- return hasExportedReferenceInDestructuringPattern(node);
+ return false;
+ }
+ function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {
+ if (!hasExtendsClause) {
+ if (ctor) {
+ addCaptureThisForNodeIfNeeded(statements, ctor);
+ }
+ return 0;
}
- else {
- return false;
+ if (!ctor) {
+ statements.push(ts.createReturn(createDefaultSuperCallOrThis()));
+ return 2;
}
- }
- function isDestructuringPattern(node) {
- var kind = node.kind;
- return kind === 69
- || kind === 171
- || kind === 170;
- }
- function substituteDestructuring(node) {
- return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration);
- }
- function substituteUnaryExpression(node) {
- var operand = node.operand;
- var operator = node.operator;
- var substitute = ts.isIdentifier(operand) &&
- (node.kind === 186 ||
- (node.kind === 185 && (operator === 41 || operator === 42)));
- if (substitute) {
- var exportDeclaration = resolver.getReferencedExportContainer(operand);
- if (exportDeclaration) {
- var expr = ts.createPrefix(node.operator, operand, node);
- ts.setEmitFlags(expr, 128);
- var call = createExportExpression(operand, expr);
- if (node.kind === 185) {
- return call;
- }
- else {
- return operator === 41
- ? ts.createSubtract(call, ts.createLiteral(1))
- : ts.createAdd(call, ts.createLiteral(1));
- }
+ if (hasSynthesizedSuper) {
+ captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
+ enableSubstitutionsForCapturedThis();
+ return 1;
+ }
+ var firstStatement;
+ var superCallExpression;
+ var ctorStatements = ctor.body.statements;
+ if (statementOffset < ctorStatements.length) {
+ firstStatement = ctorStatements[statementOffset];
+ if (firstStatement.kind === 203 && ts.isSuperCall(firstStatement.expression)) {
+ var superCall = firstStatement.expression;
+ superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall);
}
}
- return node;
- }
- function getDeclarationName(node) {
- return node.name ? ts.getSynthesizedClone(node.name) : ts.getGeneratedNameForNode(node);
- }
- function addExportStarFunction(statements, localNames) {
- var exportStarFunction = ts.createUniqueName("exportStar");
- var m = ts.createIdentifier("m");
- var n = ts.createIdentifier("n");
- var exports = ts.createIdentifier("exports");
- var condition = ts.createStrictInequality(n, ts.createLiteral("default"));
- if (localNames) {
- condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n)));
+ if (superCallExpression && statementOffset === ctorStatements.length - 1) {
+ statements.push(ts.createReturn(superCallExpression));
+ return 2;
}
- statements.push(ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(m)], undefined, ts.createBlock([
- ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(exports, undefined, ts.createObjectLiteral([]))
- ])),
- ts.createForIn(ts.createVariableDeclarationList([
- ts.createVariableDeclaration(n, undefined)
- ]), m, ts.createBlock([
- ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32)
- ])),
- ts.createStatement(ts.createCall(exportFunctionForFile, undefined, [exports]))
- ], undefined, true)));
- return exportStarFunction;
- }
- function createExportExpression(name, value) {
- var exportName = ts.isIdentifier(name) ? ts.createLiteral(name.text) : name;
- return ts.createCall(exportFunctionForFile, undefined, [exportName, value]);
- }
- function createExportStatement(name, value) {
- return ts.createStatement(createExportExpression(name, value));
+ captureThisForNode(statements, ctor, superCallExpression, firstStatement);
+ if (superCallExpression) {
+ return 1;
+ }
+ return 0;
}
- function createDeclarationExport(node) {
- var declarationName = getDeclarationName(node);
- var exportName = ts.hasModifier(node, 512) ? ts.createLiteral("default") : declarationName;
- return createExportStatement(exportName, declarationName);
+ function createDefaultSuperCallOrThis() {
+ var actualThis = ts.createThis();
+ ts.setEmitFlags(actualThis, 128);
+ var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
+ return ts.createLogicalOr(superCall, actualThis);
}
- function createImportBinding(importDeclaration) {
- var importAlias;
- var name;
- if (ts.isImportClause(importDeclaration)) {
- importAlias = ts.getGeneratedNameForNode(importDeclaration.parent);
- name = ts.createIdentifier("default");
- }
- else if (ts.isImportSpecifier(importDeclaration)) {
- importAlias = ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent);
- name = importDeclaration.propertyName || importDeclaration.name;
- }
- else {
+ function visitParameter(node) {
+ if (node.dotDotDotToken) {
return undefined;
}
- if (name.originalKeywordKind && languageVersion === 0) {
- return ts.createElementAccess(importAlias, ts.createLiteral(name.text));
+ else if (ts.isBindingPattern(node.name)) {
+ return ts.setOriginalNode(ts.createParameter(ts.getGeneratedNameForNode(node), undefined, node), node);
+ }
+ else if (node.initializer) {
+ return ts.setOriginalNode(ts.createParameter(node.name, undefined, node), node);
}
else {
- return ts.createPropertyAccess(importAlias, ts.getSynthesizedClone(name));
+ return node;
}
}
- function collectDependencyGroups(externalImports) {
- var groupIndices = ts.createMap();
- var dependencyGroups = [];
- for (var i = 0; i < externalImports.length; i++) {
- var externalImport = externalImports[i];
- var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions);
- var text = externalModuleName.text;
- if (ts.hasProperty(groupIndices, text)) {
- var groupIndex = groupIndices[text];
- dependencyGroups[groupIndex].externalImports.push(externalImport);
+ function shouldAddDefaultValueAssignments(node) {
+ return (node.transformFlags & 262144) !== 0;
+ }
+ function addDefaultValueAssignmentsIfNeeded(statements, node) {
+ if (!shouldAddDefaultValueAssignments(node)) {
+ return;
+ }
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ var name_32 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
+ if (dotDotDotToken) {
continue;
}
- else {
- groupIndices[text] = dependencyGroups.length;
- dependencyGroups.push({
- name: externalModuleName,
- externalImports: [externalImport]
- });
+ if (ts.isBindingPattern(name_32)) {
+ addDefaultValueAssignmentForBindingPattern(statements, parameter, name_32, initializer);
+ }
+ else if (initializer) {
+ addDefaultValueAssignmentForInitializer(statements, parameter, name_32, initializer);
}
}
- return dependencyGroups;
}
- function getNameOfDependencyGroup(dependencyGroup) {
- return dependencyGroup.name;
- }
- function recordExportName(name) {
- if (!exportedLocalNames) {
- exportedLocalNames = [];
+ function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {
+ var temp = ts.getGeneratedNameForNode(parameter);
+ if (name.elements.length > 0) {
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor))), 8388608));
}
- exportedLocalNames.push(name);
- }
- function recordExportedFunctionDeclaration(node) {
- if (!exportedFunctionDeclarations) {
- exportedFunctionDeclarations = [];
+ else if (initializer) {
+ statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608));
}
- exportedFunctionDeclarations.push(createDeclarationExport(node));
}
- function hoistBindingElement(node, isExported) {
- if (ts.isOmittedExpression(node)) {
+ function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {
+ initializer = ts.visitNode(initializer, visitor, ts.isExpression);
+ var statement = ts.createIf(ts.createStrictEquality(ts.getSynthesizedClone(name), ts.createVoidZero()), ts.setEmitFlags(ts.createBlock([
+ ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 1536), ts.setEmitFlags(initializer, 1536 | ts.getEmitFlags(initializer)), parameter))
+ ], parameter), 32 | 1024 | 12288), undefined, parameter);
+ statement.startsOnNewLine = true;
+ ts.setEmitFlags(statement, 12288 | 1024 | 8388608);
+ statements.push(statement);
+ }
+ function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
+ return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper;
+ }
+ function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
+ var parameter = ts.lastOrUndefined(node.parameters);
+ if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
return;
}
- var name = node.name;
- if (ts.isIdentifier(name)) {
- hoistVariableDeclaration(ts.getSynthesizedClone(name));
- if (isExported) {
- recordExportName(name);
- }
+ var declarationName = ts.getMutableClone(parameter.name);
+ ts.setEmitFlags(declarationName, 1536);
+ var expressionName = ts.getSynthesizedClone(parameter.name);
+ var restIndex = node.parameters.length - 1;
+ var temp = ts.createLoopVariable();
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([]))
+ ]), parameter), 8388608));
+ var forStatement = ts.createFor(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex))
+ ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([
+ ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), parameter))
+ ]));
+ ts.setEmitFlags(forStatement, 8388608);
+ ts.startOnNewLine(forStatement);
+ statements.push(forStatement);
+ }
+ function addCaptureThisForNodeIfNeeded(statements, node) {
+ if (node.transformFlags & 65536 && node.kind !== 181) {
+ captureThisForNode(statements, node, ts.createThis());
}
- else if (ts.isBindingPattern(name)) {
- ts.forEach(name.elements, isExported ? hoistExportedBindingElement : hoistNonExportedBindingElement);
+ }
+ function captureThisForNode(statements, node, initializer, originalStatement) {
+ enableSubstitutionsForCapturedThis();
+ var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration("_this", undefined, initializer)
+ ]), originalStatement);
+ ts.setEmitFlags(captureThisStatement, 49152 | 8388608);
+ ts.setSourceMapRange(captureThisStatement, node);
+ statements.push(captureThisStatement);
+ }
+ function addClassMembers(statements, node) {
+ for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
+ var member = _a[_i];
+ switch (member.kind) {
+ case 199:
+ statements.push(transformSemicolonClassElementToStatement(member));
+ break;
+ case 148:
+ statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member));
+ break;
+ case 150:
+ case 151:
+ var accessors = ts.getAllAccessorDeclarations(node.members, member);
+ if (member === accessors.firstAccessor) {
+ statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors));
+ }
+ break;
+ case 149:
+ break;
+ default:
+ ts.Debug.failBadSyntaxKind(node);
+ break;
+ }
}
}
- function hoistExportedBindingElement(node) {
- hoistBindingElement(node, true);
+ function transformSemicolonClassElementToStatement(member) {
+ return ts.createEmptyStatement(member);
}
- function hoistNonExportedBindingElement(node) {
- hoistBindingElement(node, false);
+ function transformClassMethodDeclarationToStatement(receiver, member) {
+ var commentRange = ts.getCommentRange(member);
+ var sourceMapRange = ts.getSourceMapRange(member);
+ var func = transformFunctionLikeToExpression(member, member, undefined);
+ ts.setEmitFlags(func, 49152);
+ ts.setSourceMapRange(func, sourceMapRange);
+ var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name), func), member);
+ ts.setOriginalNode(statement, member);
+ ts.setCommentRange(statement, commentRange);
+ ts.setEmitFlags(statement, 1536);
+ return statement;
}
- function updateSourceFile(node, statements, nodeEmitFlags) {
- var updated = ts.getMutableClone(node);
- updated.statements = ts.createNodeArray(statements, node.statements);
- ts.setEmitFlags(updated, nodeEmitFlags);
- return updated;
+ function transformAccessorsToStatement(receiver, accessors) {
+ var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor));
+ ts.setEmitFlags(statement, 49152);
+ return statement;
}
- }
- ts.transformSystemModule = transformSystemModule;
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function transformModule(context) {
- var transformModuleDelegates = ts.createMap((_a = {},
- _a[ts.ModuleKind.None] = transformCommonJSModule,
- _a[ts.ModuleKind.CommonJS] = transformCommonJSModule,
- _a[ts.ModuleKind.AMD] = transformAMDModule,
- _a[ts.ModuleKind.UMD] = transformUMDModule,
- _a));
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
- var compilerOptions = context.getCompilerOptions();
- var resolver = context.getEmitResolver();
- var host = context.getEmitHost();
- var languageVersion = ts.getEmitScriptTarget(compilerOptions);
- var moduleKind = ts.getEmitModuleKind(compilerOptions);
- var previousOnSubstituteNode = context.onSubstituteNode;
- var previousOnEmitNode = context.onEmitNode;
- context.onSubstituteNode = onSubstituteNode;
- context.onEmitNode = onEmitNode;
- context.enableSubstitution(69);
- context.enableSubstitution(187);
- context.enableSubstitution(185);
- context.enableSubstitution(186);
- context.enableSubstitution(254);
- context.enableEmitNotification(256);
- var currentSourceFile;
- var externalImports;
- var exportSpecifiers;
- var exportEquals;
- var bindingNameExportSpecifiersMap;
- var bindingNameExportSpecifiersForFileMap = ts.createMap();
- var hasExportStarsToExportValues;
- return transformSourceFile;
- function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
- return node;
+ function transformAccessorsToExpression(receiver, _a, startsOnNewLine) {
+ var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
+ var target = ts.getMutableClone(receiver);
+ ts.setEmitFlags(target, 49152 | 1024);
+ ts.setSourceMapRange(target, firstAccessor.name);
+ var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
+ ts.setEmitFlags(propertyName, 49152 | 512);
+ ts.setSourceMapRange(propertyName, firstAccessor.name);
+ var properties = [];
+ if (getAccessor) {
+ var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined);
+ ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));
+ ts.setEmitFlags(getterFunction, 16384);
+ var getter = ts.createPropertyAssignment("get", getterFunction);
+ ts.setCommentRange(getter, ts.getCommentRange(getAccessor));
+ properties.push(getter);
}
- if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- currentSourceFile = node;
- (_a = ts.collectExternalModuleInfo(node, resolver), externalImports = _a.externalImports, exportSpecifiers = _a.exportSpecifiers, exportEquals = _a.exportEquals, hasExportStarsToExportValues = _a.hasExportStarsToExportValues, _a);
- var transformModule_1 = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];
- var updated = transformModule_1(node);
- ts.aggregateTransformFlags(updated);
- currentSourceFile = undefined;
- externalImports = undefined;
- exportSpecifiers = undefined;
- exportEquals = undefined;
- hasExportStarsToExportValues = false;
- return updated;
+ if (setAccessor) {
+ var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined);
+ ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));
+ ts.setEmitFlags(setterFunction, 16384);
+ var setter = ts.createPropertyAssignment("set", setterFunction);
+ ts.setCommentRange(setter, ts.getCommentRange(setAccessor));
+ properties.push(setter);
}
- return node;
- var _a;
- }
- function transformCommonJSModule(node) {
- startLexicalEnvironment();
- var statements = [];
- var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, visitor);
- ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
- ts.addRange(statements, endLexicalEnvironment());
- addExportEqualsIfNeeded(statements, false);
- var updated = updateSourceFile(node, statements);
- if (hasExportStarsToExportValues) {
- ts.setEmitFlags(updated, 2 | ts.getEmitFlags(node));
+ properties.push(ts.createPropertyAssignment("enumerable", ts.createLiteral(true)), ts.createPropertyAssignment("configurable", ts.createLiteral(true)));
+ var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [
+ target,
+ propertyName,
+ ts.createObjectLiteral(properties, undefined, true)
+ ]);
+ if (startsOnNewLine) {
+ call.startsOnNewLine = true;
}
- return updated;
- }
- function transformAMDModule(node) {
- var define = ts.createIdentifier("define");
- var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
- return transformAsynchronousModule(node, define, moduleName, true);
+ return call;
}
- function transformUMDModule(node) {
- var define = ts.createIdentifier("define");
- ts.setEmitFlags(define, 16);
- return transformAsynchronousModule(node, define, undefined, false);
+ function visitArrowFunction(node) {
+ if (node.transformFlags & 32768) {
+ enableSubstitutionsForCapturedThis();
+ }
+ var func = transformFunctionLikeToExpression(node, node, undefined);
+ ts.setEmitFlags(func, 256);
+ return func;
}
- function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) {
- var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames;
- return updateSourceFile(node, [
- ts.createStatement(ts.createCall(define, undefined, (moduleName ? [moduleName] : []).concat([
- ts.createArrayLiteral([
- ts.createLiteral("require"),
- ts.createLiteral("exports")
- ].concat(aliasedModuleNames, unaliasedModuleNames)),
- ts.createFunctionExpression(undefined, undefined, undefined, [
- ts.createParameter("require"),
- ts.createParameter("exports")
- ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node))
- ])))
- ]);
+ function visitFunctionExpression(node) {
+ return transformFunctionLikeToExpression(node, node, node.name);
}
- function transformAsynchronousModuleBody(node) {
- startLexicalEnvironment();
- var statements = [];
- var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, visitor);
- ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
- ts.addRange(statements, endLexicalEnvironment());
- addExportEqualsIfNeeded(statements, true);
- var body = ts.createBlock(statements, undefined, true);
- if (hasExportStarsToExportValues) {
- ts.setEmitFlags(body, 2);
- }
- return body;
+ function visitFunctionDeclaration(node) {
+ return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node), node);
}
- function addExportEqualsIfNeeded(statements, emitAsReturn) {
- if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) {
- if (emitAsReturn) {
- var statement = ts.createReturn(exportEquals.expression, exportEquals);
- ts.setEmitFlags(statement, 12288 | 49152);
- statements.push(statement);
- }
- else {
- var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), exportEquals.expression), exportEquals);
- ts.setEmitFlags(statement, 49152);
- statements.push(statement);
- }
+ function transformFunctionLikeToExpression(node, location, name) {
+ var savedContainingNonArrowFunction = enclosingNonArrowFunction;
+ if (node.kind !== 181) {
+ enclosingNonArrowFunction = node;
}
+ var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node);
+ enclosingNonArrowFunction = savedContainingNonArrowFunction;
+ return expression;
}
- function visitor(node) {
- switch (node.kind) {
- case 230:
- return visitImportDeclaration(node);
- case 229:
- return visitImportEqualsDeclaration(node);
- case 236:
- return visitExportDeclaration(node);
- case 235:
- return visitExportAssignment(node);
- case 200:
- return visitVariableStatement(node);
- case 220:
- return visitFunctionDeclaration(node);
- case 221:
- return visitClassDeclaration(node);
- case 202:
- return visitExpressionStatement(node);
- default:
- return node;
+ function transformFunctionBody(node) {
+ var multiLine = false;
+ var singleLine = false;
+ var statementsLocation;
+ var closeBraceLocation;
+ var statements = [];
+ var body = node.body;
+ var statementOffset;
+ startLexicalEnvironment();
+ if (ts.isBlock(body)) {
+ statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);
}
- }
- function visitImportDeclaration(node) {
- if (!ts.contains(externalImports, node)) {
- return undefined;
+ addCaptureThisForNodeIfNeeded(statements, node);
+ addDefaultValueAssignmentsIfNeeded(statements, node);
+ addRestParameterIfNeeded(statements, node, false);
+ if (!multiLine && statements.length > 0) {
+ multiLine = true;
}
- var statements = [];
- var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
- if (moduleKind !== ts.ModuleKind.AMD) {
- if (!node.importClause) {
- statements.push(ts.createStatement(createRequireCall(node), node));
+ if (ts.isBlock(body)) {
+ statementsLocation = body.statements;
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
+ if (!multiLine && body.multiLine) {
+ multiLine = true;
}
- else {
- var variables = [];
- if (namespaceDeclaration && !ts.isDefaultImport(node)) {
- variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, createRequireCall(node)));
+ }
+ else {
+ ts.Debug.assert(node.kind === 181);
+ statementsLocation = ts.moveRangeEnd(body, -1);
+ var equalsGreaterThanToken = node.equalsGreaterThanToken;
+ if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
+ if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
+ singleLine = true;
}
else {
- variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), undefined, createRequireCall(node)));
- if (namespaceDeclaration && ts.isDefaultImport(node)) {
- variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node)));
- }
+ multiLine = true;
}
- statements.push(ts.createVariableStatement(undefined, ts.createConstDeclarationList(variables), node));
}
+ var expression = ts.visitNode(body, visitor, ts.isExpression);
+ var returnStatement = ts.createReturn(expression, body);
+ ts.setEmitFlags(returnStatement, 12288 | 1024 | 32768);
+ statements.push(returnStatement);
+ closeBraceLocation = body;
}
- else if (namespaceDeclaration && ts.isDefaultImport(node)) {
- statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node), node)
- ])));
+ var lexicalEnvironment = endLexicalEnvironment();
+ ts.addRange(statements, lexicalEnvironment);
+ if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
+ multiLine = true;
}
- addExportImportAssignments(statements, node);
- return ts.singleOrMany(statements);
+ var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine);
+ if (!multiLine && singleLine) {
+ ts.setEmitFlags(block, 32);
+ }
+ if (closeBraceLocation) {
+ ts.setTokenSourceMapRange(block, 17, closeBraceLocation);
+ }
+ ts.setOriginalNode(block, node.body);
+ return block;
}
- function visitImportEqualsDeclaration(node) {
- if (!ts.contains(externalImports, node)) {
- return undefined;
+ function visitExpressionStatement(node) {
+ switch (node.expression.kind) {
+ case 179:
+ return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false));
+ case 188:
+ return ts.updateStatement(node, visitBinaryExpression(node.expression, false));
}
- ts.setEmitFlags(node.name, 128);
- var statements = [];
- if (moduleKind !== ts.ModuleKind.AMD) {
- if (ts.hasModifier(node, 1)) {
- statements.push(ts.createStatement(createExportAssignment(node.name, createRequireCall(node)), node));
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitParenthesizedExpression(node, needsDestructuringValue) {
+ if (needsDestructuringValue) {
+ switch (node.expression.kind) {
+ case 179:
+ return ts.createParen(visitParenthesizedExpression(node.expression, true), node);
+ case 188:
+ return ts.createParen(visitBinaryExpression(node.expression, true), node);
+ }
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitBinaryExpression(node, needsDestructuringValue) {
+ ts.Debug.assert(ts.isDestructuringAssignment(node));
+ return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor);
+ }
+ function visitVariableStatement(node) {
+ if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) {
+ var assignments = void 0;
+ for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
+ var decl = _a[_i];
+ hoistVariableDeclarationDeclaredInConvertedLoop(convertedLoopState, decl);
+ if (decl.initializer) {
+ var assignment = void 0;
+ if (ts.isBindingPattern(decl.name)) {
+ assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, undefined, visitor);
+ }
+ else {
+ assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression));
+ }
+ (assignments || (assignments = [])).push(assignment);
+ }
+ }
+ if (assignments) {
+ return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node);
}
else {
- statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), undefined, createRequireCall(node))
- ], undefined, languageVersion >= 2 ? 2 : 0), node));
+ return undefined;
}
}
- else {
- if (ts.hasModifier(node, 1)) {
- statements.push(ts.createStatement(createExportAssignment(node.name, node.name), node));
- }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitVariableDeclarationList(node) {
+ if (node.flags & 3) {
+ enableSubstitutionsForBlockScopedBindings();
}
- addExportImportAssignments(statements, node);
- return statements;
+ var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1
+ ? visitVariableDeclarationInLetDeclarationList
+ : visitVariableDeclaration));
+ var declarationList = ts.createVariableDeclarationList(declarations, node);
+ ts.setOriginalNode(declarationList, node);
+ ts.setCommentRange(declarationList, node);
+ if (node.transformFlags & 8388608
+ && (ts.isBindingPattern(node.declarations[0].name)
+ || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {
+ var firstDeclaration = ts.firstOrUndefined(declarations);
+ var lastDeclaration = ts.lastOrUndefined(declarations);
+ ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
+ }
+ return declarationList;
}
- function visitExportDeclaration(node) {
- if (!ts.contains(externalImports, node)) {
- return undefined;
+ function shouldEmitExplicitInitializerForLetDeclaration(node) {
+ var flags = resolver.getNodeCheckFlags(node);
+ var isCapturedInFunction = flags & 131072;
+ var isDeclaredInLoop = flags & 262144;
+ var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer)
+ || (isCapturedInFunction
+ && isDeclaredInLoop
+ && ts.isBlock(enclosingBlockScopeContainer)
+ && ts.isIterationStatement(enclosingBlockScopeContainerParent, false));
+ var emitExplicitInitializer = !emittedAsTopLevel
+ && enclosingBlockScopeContainer.kind !== 208
+ && enclosingBlockScopeContainer.kind !== 209
+ && (!resolver.isDeclarationWithCollidingName(node)
+ || (isDeclaredInLoop
+ && !isCapturedInFunction
+ && !ts.isIterationStatement(enclosingBlockScopeContainer, false)));
+ return emitExplicitInitializer;
+ }
+ function visitVariableDeclarationInLetDeclarationList(node) {
+ var name = node.name;
+ if (ts.isBindingPattern(name)) {
+ return visitVariableDeclaration(node);
}
- var generatedName = ts.getGeneratedNameForNode(node);
- if (node.exportClause) {
- var statements = [];
- if (moduleKind !== ts.ModuleKind.AMD) {
- statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(generatedName, undefined, createRequireCall(node))
- ]), node));
- }
- for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) {
- var specifier = _a[_i];
- if (resolver.isValueAliasDeclaration(specifier)) {
- var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name);
- statements.push(ts.createStatement(createExportAssignment(specifier.name, exportedValue), specifier));
- }
- }
- return ts.singleOrMany(statements);
+ if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {
+ var clone_5 = ts.getMutableClone(node);
+ clone_5.initializer = ts.createVoidZero();
+ return clone_5;
}
- else if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) {
- return ts.createStatement(ts.createCall(ts.createIdentifier("__export"), undefined, [
- moduleKind !== ts.ModuleKind.AMD
- ? createRequireCall(node)
- : generatedName
- ]), node);
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitVariableDeclaration(node) {
+ if (ts.isBindingPattern(node.name)) {
+ var recordTempVariablesInLine = !enclosingVariableStatement
+ || !ts.hasModifier(enclosingVariableStatement, 1);
+ return ts.flattenVariableDestructuring(node, undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration);
}
+ return ts.visitEachChild(node, visitor, context);
}
- function visitExportAssignment(node) {
- if (!node.isExportEquals) {
- if (ts.nodeIsSynthesized(node) || resolver.isValueAliasDeclaration(node)) {
- var statements = [];
- addExportDefault(statements, node.expression, node);
- return statements;
+ function visitLabeledStatement(node) {
+ if (convertedLoopState) {
+ if (!convertedLoopState.labels) {
+ convertedLoopState.labels = ts.createMap();
}
+ convertedLoopState.labels[node.label.text] = node.label.text;
}
- return undefined;
+ var result;
+ if (ts.isIterationStatement(node.statement, false) && shouldConvertIterationStatementBody(node.statement)) {
+ result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement);
+ }
+ else {
+ result = ts.visitEachChild(node, visitor, context);
+ }
+ if (convertedLoopState) {
+ convertedLoopState.labels[node.label.text] = undefined;
+ }
+ return result;
}
- function addExportDefault(statements, expression, location) {
- tryAddExportDefaultCompat(statements);
- statements.push(ts.createStatement(createExportAssignment(ts.createIdentifier("default"), expression), location));
+ function visitDoStatement(node) {
+ return convertIterationStatementBodyIfNecessary(node);
}
- function tryAddExportDefaultCompat(statements) {
- var original = ts.getOriginalNode(currentSourceFile);
- ts.Debug.assert(original.kind === 256);
- if (!original.symbol.exports["___esModule"]) {
- if (languageVersion === 0) {
- statements.push(ts.createStatement(createExportAssignment(ts.createIdentifier("__esModule"), ts.createLiteral(true))));
+ function visitWhileStatement(node) {
+ return convertIterationStatementBodyIfNecessary(node);
+ }
+ function visitForStatement(node) {
+ return convertIterationStatementBodyIfNecessary(node);
+ }
+ function visitForInStatement(node) {
+ return convertIterationStatementBodyIfNecessary(node);
+ }
+ function visitForOfStatement(node) {
+ return convertIterationStatementBodyIfNecessary(node, convertForOfToFor);
+ }
+ function convertForOfToFor(node, convertedLoopBodyStatements) {
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var initializer = node.initializer;
+ var statements = [];
+ var counter = ts.createLoopVariable();
+ var rhsReference = expression.kind === 70
+ ? ts.createUniqueName(expression.text)
+ : ts.createTempVariable(undefined);
+ if (ts.isVariableDeclarationList(initializer)) {
+ if (initializer.flags & 3) {
+ enableSubstitutionsForBlockScopedBindings();
+ }
+ var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
+ if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
+ var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, ts.createElementAccess(rhsReference, counter), visitor);
+ var declarationList = ts.createVariableDeclarationList(declarations, initializer);
+ ts.setOriginalNode(declarationList, initializer);
+ var firstDeclaration = declarations[0];
+ var lastDeclaration = ts.lastOrUndefined(declarations);
+ ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
+ statements.push(ts.createVariableStatement(undefined, declarationList));
}
else {
- statements.push(ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [
- ts.createIdentifier("exports"),
- ts.createLiteral("__esModule"),
- ts.createObjectLiteral([
- ts.createPropertyAssignment("value", ts.createLiteral(true))
- ])
- ])));
+ statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter))
+ ], ts.moveRangePos(initializer, -1)), ts.moveRangeEnd(initializer, -1)));
}
}
- }
- function addExportImportAssignments(statements, node) {
- if (ts.isImportEqualsDeclaration(node)) {
- addExportMemberAssignments(statements, node.name);
- }
else {
- var names = ts.reduceEachChild(node, collectExportMembers, []);
- for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name_33 = names_1[_i];
- addExportMemberAssignments(statements, name_33);
+ var assignment = ts.createAssignment(initializer, ts.createElementAccess(rhsReference, counter));
+ if (ts.isDestructuringAssignment(assignment)) {
+ statements.push(ts.createStatement(ts.flattenDestructuringAssignment(context, assignment, false, hoistVariableDeclaration, visitor)));
+ }
+ else {
+ assignment.end = initializer.end;
+ statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1)));
}
}
- }
- function collectExportMembers(names, node) {
- if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node) && ts.isDeclaration(node)) {
- var name_34 = node.name;
- if (ts.isIdentifier(name_34)) {
- names.push(name_34);
+ var bodyLocation;
+ var statementsLocation;
+ if (convertedLoopBodyStatements) {
+ ts.addRange(statements, convertedLoopBodyStatements);
+ }
+ else {
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ if (ts.isBlock(statement)) {
+ ts.addRange(statements, statement.statements);
+ bodyLocation = statement;
+ statementsLocation = statement.statements;
+ }
+ else {
+ statements.push(statement);
}
}
- return ts.reduceEachChild(node, collectExportMembers, names);
+ ts.setEmitFlags(expression, 1536 | ts.getEmitFlags(expression));
+ var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation);
+ ts.setEmitFlags(body, 1536 | 12288);
+ var forStatement = ts.createFor(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)),
+ ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression)
+ ], node.expression), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node);
+ ts.setEmitFlags(forStatement, 8192);
+ return forStatement;
}
- function addExportMemberAssignments(statements, name) {
- if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) {
- for (var _i = 0, _a = exportSpecifiers[name.text]; _i < _a.length; _i++) {
- var specifier = _a[_i];
- statements.push(ts.startOnNewLine(ts.createStatement(createExportAssignment(specifier.name, name), specifier.name)));
+ function visitObjectLiteralExpression(node) {
+ var properties = node.properties;
+ var numProperties = properties.length;
+ var numInitialProperties = numProperties;
+ for (var i = 0; i < numProperties; i++) {
+ var property = properties[i];
+ if (property.transformFlags & 16777216
+ || property.name.kind === 141) {
+ numInitialProperties = i;
+ break;
}
}
+ ts.Debug.assert(numInitialProperties !== numProperties);
+ var temp = ts.createTempVariable(hoistVariableDeclaration);
+ var expressions = [];
+ var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 524288));
+ if (node.multiLine) {
+ assignment.startsOnNewLine = true;
+ }
+ expressions.push(assignment);
+ addObjectLiteralMembers(expressions, node, temp, numInitialProperties);
+ expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp);
+ return ts.inlineExpressions(expressions);
}
- function addExportMemberAssignment(statements, node) {
- if (ts.hasModifier(node, 512)) {
- addExportDefault(statements, getDeclarationName(node), node);
+ function shouldConvertIterationStatementBody(node) {
+ return (resolver.getNodeCheckFlags(node) & 65536) !== 0;
+ }
+ function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {
+ if (!state.hoistedLocalVariables) {
+ state.hoistedLocalVariables = [];
}
- else {
- statements.push(createExportStatement(node.name, ts.setEmitFlags(ts.getSynthesizedClone(node.name), 262144), node));
+ visit(node.name);
+ function visit(node) {
+ if (node.kind === 70) {
+ state.hoistedLocalVariables.push(node);
+ }
+ else {
+ for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!ts.isOmittedExpression(element)) {
+ visit(element.name);
+ }
+ }
+ }
}
}
- function visitVariableStatement(node) {
- var originalKind = ts.getOriginalNode(node).kind;
- if (originalKind === 225 ||
- originalKind === 224 ||
- originalKind === 221) {
- if (!ts.hasModifier(node, 1)) {
- return node;
+ function convertIterationStatementBodyIfNecessary(node, convert) {
+ if (!shouldConvertIterationStatementBody(node)) {
+ var saveAllowedNonLabeledJumps = void 0;
+ if (convertedLoopState) {
+ saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;
+ convertedLoopState.allowedNonLabeledJumps = 2 | 4;
}
- return ts.setOriginalNode(ts.createVariableStatement(undefined, node.declarationList), node);
- }
- var resultStatements = [];
- if (ts.hasModifier(node, 1)) {
- var variables = ts.getInitializedVariables(node.declarationList);
- if (variables.length > 0) {
- var inlineAssignments = ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), node);
- resultStatements.push(inlineAssignments);
+ var result = convert ? convert(node, undefined) : ts.visitEachChild(node, visitor, context);
+ if (convertedLoopState) {
+ convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;
}
+ return result;
}
- else {
- resultStatements.push(node);
- }
- for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
- var decl = _a[_i];
- addExportMemberAssignmentsForBindingName(resultStatements, decl.name);
- }
- return resultStatements;
- }
- function addExportMemberAssignmentsForBindingName(resultStatements, name) {
- if (ts.isBindingPattern(name)) {
- for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {
- var element = _a[_i];
- if (!ts.isOmittedExpression(element)) {
- addExportMemberAssignmentsForBindingName(resultStatements, element.name);
+ var functionName = ts.createUniqueName("_loop");
+ var loopInitializer;
+ switch (node.kind) {
+ case 207:
+ case 208:
+ case 209:
+ var initializer = node.initializer;
+ if (initializer && initializer.kind === 220) {
+ loopInitializer = initializer;
}
+ break;
+ }
+ var loopParameters = [];
+ var loopOutParameters = [];
+ if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3)) {
+ for (var _i = 0, _a = loopInitializer.declarations; _i < _a.length; _i++) {
+ var decl = _a[_i];
+ processLoopVariableDeclaration(decl, loopParameters, loopOutParameters);
}
}
- else {
- if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) {
- var sourceFileId = ts.getOriginalNodeId(currentSourceFile);
- if (!bindingNameExportSpecifiersForFileMap[sourceFileId]) {
- bindingNameExportSpecifiersForFileMap[sourceFileId] = ts.createMap();
- }
- bindingNameExportSpecifiersForFileMap[sourceFileId][name.text] = exportSpecifiers[name.text];
- addExportMemberAssignments(resultStatements, name);
+ var outerConvertedLoopState = convertedLoopState;
+ convertedLoopState = { loopOutParameters: loopOutParameters };
+ if (outerConvertedLoopState) {
+ if (outerConvertedLoopState.argumentsName) {
+ convertedLoopState.argumentsName = outerConvertedLoopState.argumentsName;
+ }
+ if (outerConvertedLoopState.thisName) {
+ convertedLoopState.thisName = outerConvertedLoopState.thisName;
+ }
+ if (outerConvertedLoopState.hoistedLocalVariables) {
+ convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables;
}
}
- }
- function transformInitializedVariable(node) {
- var name = node.name;
- if (ts.isBindingPattern(name)) {
- return ts.flattenVariableDestructuringToExpression(context, node, hoistVariableDeclaration, getModuleMemberName, visitor);
+ var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement);
+ var currentState = convertedLoopState;
+ convertedLoopState = outerConvertedLoopState;
+ if (loopOutParameters.length) {
+ var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
+ copyOutParameters(loopOutParameters, 1, statements_3);
+ loopBody = ts.createBlock(statements_3, undefined, true);
}
- else {
- return ts.createAssignment(getModuleMemberName(name), ts.visitNode(node.initializer, visitor, ts.isExpression));
+ if (!ts.isBlock(loopBody)) {
+ loopBody = ts.createBlock([loopBody], undefined, true);
}
- }
- function visitFunctionDeclaration(node) {
- var statements = [];
- var name = node.name || ts.getGeneratedNameForNode(node);
- if (ts.hasModifier(node, 1)) {
- statements.push(ts.setOriginalNode(ts.createFunctionDeclaration(undefined, undefined, node.asteriskToken, name, undefined, node.parameters, undefined, node.body, node), node));
- addExportMemberAssignment(statements, node);
+ var isAsyncBlockContainingAwait = enclosingNonArrowFunction
+ && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152) !== 0
+ && (node.statement.transformFlags & 16777216) !== 0;
+ var loopBodyFlags = 0;
+ if (currentState.containsLexicalThis) {
+ loopBodyFlags |= 256;
}
- else {
- statements.push(node);
+ if (isAsyncBlockContainingAwait) {
+ loopBodyFlags |= 2097152;
}
- if (node.name) {
- addExportMemberAssignments(statements, node.name);
+ var convertedLoopVariable = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(undefined, isAsyncBlockContainingAwait ? ts.createToken(38) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags))
+ ]));
+ var statements = [convertedLoopVariable];
+ var extraVariableDeclarations;
+ if (currentState.argumentsName) {
+ if (outerConvertedLoopState) {
+ outerConvertedLoopState.argumentsName = currentState.argumentsName;
+ }
+ else {
+ (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.argumentsName, undefined, ts.createIdentifier("arguments")));
+ }
}
- return ts.singleOrMany(statements);
- }
- function visitClassDeclaration(node) {
- var statements = [];
- var name = node.name || ts.getGeneratedNameForNode(node);
- if (ts.hasModifier(node, 1)) {
- statements.push(ts.setOriginalNode(ts.createClassDeclaration(undefined, undefined, name, undefined, node.heritageClauses, node.members, node), node));
- addExportMemberAssignment(statements, node);
+ if (currentState.thisName) {
+ if (outerConvertedLoopState) {
+ outerConvertedLoopState.thisName = currentState.thisName;
+ }
+ else {
+ (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.thisName, undefined, ts.createIdentifier("this")));
+ }
}
- else {
- statements.push(node);
+ if (currentState.hoistedLocalVariables) {
+ if (outerConvertedLoopState) {
+ outerConvertedLoopState.hoistedLocalVariables = currentState.hoistedLocalVariables;
+ }
+ else {
+ if (!extraVariableDeclarations) {
+ extraVariableDeclarations = [];
+ }
+ for (var _b = 0, _c = currentState.hoistedLocalVariables; _b < _c.length; _b++) {
+ var identifier = _c[_b];
+ extraVariableDeclarations.push(ts.createVariableDeclaration(identifier));
+ }
+ }
}
- if (node.name && !(node.decorators && node.decorators.length)) {
- addExportMemberAssignments(statements, node.name);
+ if (loopOutParameters.length) {
+ if (!extraVariableDeclarations) {
+ extraVariableDeclarations = [];
+ }
+ for (var _d = 0, loopOutParameters_1 = loopOutParameters; _d < loopOutParameters_1.length; _d++) {
+ var outParam = loopOutParameters_1[_d];
+ extraVariableDeclarations.push(ts.createVariableDeclaration(outParam.outParamName));
+ }
}
- return ts.singleOrMany(statements);
- }
- function visitExpressionStatement(node) {
- var original = ts.getOriginalNode(node);
- var origKind = original.kind;
- if (origKind === 224 || origKind === 225) {
- return visitExpressionStatementForEnumOrNamespaceDeclaration(node, original);
+ if (extraVariableDeclarations) {
+ statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(extraVariableDeclarations)));
}
- else if (origKind === 221) {
- var classDecl = original;
- if (classDecl.name) {
- var statements = [node];
- addExportMemberAssignments(statements, classDecl.name);
- return statements;
- }
+ var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait);
+ var loop;
+ if (convert) {
+ loop = convert(node, convertedLoopBodyStatements);
}
- return node;
- }
- function visitExpressionStatementForEnumOrNamespaceDeclaration(node, original) {
- var statements = [node];
- if (ts.hasModifier(original, 1) &&
- original.kind === 224 &&
- ts.isFirstDeclarationOfKind(original, 224)) {
- addVarForExportedEnumOrNamespaceDeclaration(statements, original);
+ else {
+ loop = ts.getMutableClone(node);
+ loop.statement = undefined;
+ loop = ts.visitEachChild(loop, visitor, context);
+ loop.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true);
+ loop.transformFlags = 0;
+ ts.aggregateTransformFlags(loop);
}
- addExportMemberAssignments(statements, original.name);
+ statements.push(currentParent.kind === 215
+ ? ts.createLabel(currentParent.label, loop)
+ : loop);
return statements;
}
- function addVarForExportedEnumOrNamespaceDeclaration(statements, node) {
- var transformedStatement = ts.createVariableStatement(undefined, [ts.createVariableDeclaration(getDeclarationName(node), undefined, ts.createPropertyAccess(ts.createIdentifier("exports"), getDeclarationName(node)))], node);
- ts.setEmitFlags(transformedStatement, 49152);
- statements.push(transformedStatement);
+ function copyOutParameter(outParam, copyDirection) {
+ var source = copyDirection === 0 ? outParam.outParamName : outParam.originalName;
+ var target = copyDirection === 0 ? outParam.originalName : outParam.outParamName;
+ return ts.createBinary(target, 57, source);
}
- function getDeclarationName(node) {
- return node.name ? ts.getSynthesizedClone(node.name) : ts.getGeneratedNameForNode(node);
+ function copyOutParameters(outParams, copyDirection, statements) {
+ for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {
+ var outParam = outParams_1[_i];
+ statements.push(ts.createStatement(copyOutParameter(outParam, copyDirection)));
+ }
}
- function onEmitNode(emitContext, node, emitCallback) {
- if (node.kind === 256) {
- bindingNameExportSpecifiersMap = bindingNameExportSpecifiersForFileMap[ts.getOriginalNodeId(node)];
- previousOnEmitNode(emitContext, node, emitCallback);
- bindingNameExportSpecifiersMap = undefined;
+ function generateCallToConvertedLoop(loopFunctionExpressionName, parameters, state, isAsyncBlockContainingAwait) {
+ var outerConvertedLoopState = convertedLoopState;
+ var statements = [];
+ var isSimpleLoop = !(state.nonLocalJumps & ~4) &&
+ !state.labeledNonLocalBreaks &&
+ !state.labeledNonLocalContinues;
+ var call = ts.createCall(loopFunctionExpressionName, undefined, ts.map(parameters, function (p) { return p.name; }));
+ var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(38), call) : call;
+ if (isSimpleLoop) {
+ statements.push(ts.createStatement(callResult));
+ copyOutParameters(state.loopOutParameters, 0, statements);
}
else {
- previousOnEmitNode(emitContext, node, emitCallback);
+ var loopResultName = ts.createUniqueName("state");
+ var stateVariable = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ts.createVariableDeclaration(loopResultName, undefined, callResult)]));
+ statements.push(stateVariable);
+ copyOutParameters(state.loopOutParameters, 0, statements);
+ if (state.nonLocalJumps & 8) {
+ var returnStatement = void 0;
+ if (outerConvertedLoopState) {
+ outerConvertedLoopState.nonLocalJumps |= 8;
+ returnStatement = ts.createReturn(loopResultName);
+ }
+ else {
+ returnStatement = ts.createReturn(ts.createPropertyAccess(loopResultName, "value"));
+ }
+ statements.push(ts.createIf(ts.createBinary(ts.createTypeOf(loopResultName), 33, ts.createLiteral("object")), returnStatement));
+ }
+ if (state.nonLocalJumps & 2) {
+ statements.push(ts.createIf(ts.createBinary(loopResultName, 33, ts.createLiteral("break")), ts.createBreak()));
+ }
+ if (state.labeledNonLocalBreaks || state.labeledNonLocalContinues) {
+ var caseClauses = [];
+ processLabeledJumps(state.labeledNonLocalBreaks, true, loopResultName, outerConvertedLoopState, caseClauses);
+ processLabeledJumps(state.labeledNonLocalContinues, false, loopResultName, outerConvertedLoopState, caseClauses);
+ statements.push(ts.createSwitch(loopResultName, ts.createCaseBlock(caseClauses)));
+ }
}
+ return statements;
}
- function onSubstituteNode(emitContext, node) {
- node = previousOnSubstituteNode(emitContext, node);
- if (emitContext === 1) {
- return substituteExpression(node);
- }
- else if (ts.isShorthandPropertyAssignment(node)) {
- return substituteShorthandPropertyAssignment(node);
+ function setLabeledJump(state, isBreak, labelText, labelMarker) {
+ if (isBreak) {
+ if (!state.labeledNonLocalBreaks) {
+ state.labeledNonLocalBreaks = ts.createMap();
+ }
+ state.labeledNonLocalBreaks[labelText] = labelMarker;
}
- return node;
- }
- function substituteShorthandPropertyAssignment(node) {
- var name = node.name;
- var exportedOrImportedName = substituteExpressionIdentifier(name);
- if (exportedOrImportedName !== name) {
- if (node.objectAssignmentInitializer) {
- var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer);
- return ts.createPropertyAssignment(name, initializer, node);
+ else {
+ if (!state.labeledNonLocalContinues) {
+ state.labeledNonLocalContinues = ts.createMap();
}
- return ts.createPropertyAssignment(name, exportedOrImportedName, node);
+ state.labeledNonLocalContinues[labelText] = labelMarker;
}
- return node;
}
- function substituteExpression(node) {
- switch (node.kind) {
- case 69:
- return substituteExpressionIdentifier(node);
- case 187:
- return substituteBinaryExpression(node);
- case 186:
- case 185:
- return substituteUnaryExpression(node);
+ function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) {
+ if (!table) {
+ return;
}
- return node;
- }
- function substituteExpressionIdentifier(node) {
- return trySubstituteExportedName(node)
- || trySubstituteImportedName(node)
- || node;
- }
- function substituteBinaryExpression(node) {
- var left = node.left;
- if (ts.isIdentifier(left) && ts.isAssignmentOperator(node.operatorToken.kind)) {
- if (bindingNameExportSpecifiersMap && ts.hasProperty(bindingNameExportSpecifiersMap, left.text)) {
- ts.setEmitFlags(node, 128);
- var nestedExportAssignment = void 0;
- for (var _i = 0, _a = bindingNameExportSpecifiersMap[left.text]; _i < _a.length; _i++) {
- var specifier = _a[_i];
- nestedExportAssignment = nestedExportAssignment ?
- createExportAssignment(specifier.name, nestedExportAssignment) :
- createExportAssignment(specifier.name, node);
- }
- return nestedExportAssignment;
+ for (var labelText in table) {
+ var labelMarker = table[labelText];
+ var statements = [];
+ if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) {
+ var label = ts.createIdentifier(labelText);
+ statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label));
+ }
+ else {
+ setLabeledJump(outerLoop, isBreak, labelText, labelMarker);
+ statements.push(ts.createReturn(loopResultName));
}
+ caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements));
}
- return node;
}
- function substituteUnaryExpression(node) {
- var operator = node.operator;
- var operand = node.operand;
- if (ts.isIdentifier(operand) && bindingNameExportSpecifiersForFileMap) {
- if (bindingNameExportSpecifiersMap && ts.hasProperty(bindingNameExportSpecifiersMap, operand.text)) {
- ts.setEmitFlags(node, 128);
- var transformedUnaryExpression = void 0;
- if (node.kind === 186) {
- transformedUnaryExpression = ts.createBinary(operand, ts.createToken(operator === 41 ? 57 : 58), ts.createLiteral(1), node);
- ts.setEmitFlags(transformedUnaryExpression, 128);
- }
- var nestedExportAssignment = void 0;
- for (var _i = 0, _a = bindingNameExportSpecifiersMap[operand.text]; _i < _a.length; _i++) {
- var specifier = _a[_i];
- nestedExportAssignment = nestedExportAssignment ?
- createExportAssignment(specifier.name, nestedExportAssignment) :
- createExportAssignment(specifier.name, transformedUnaryExpression || node);
+ function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) {
+ var name = decl.name;
+ if (ts.isBindingPattern(name)) {
+ for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!ts.isOmittedExpression(element)) {
+ processLoopVariableDeclaration(element, loopParameters, loopOutParameters);
}
- return nestedExportAssignment;
}
}
- return node;
- }
- function trySubstituteExportedName(node) {
- var emitFlags = ts.getEmitFlags(node);
- if ((emitFlags & 262144) === 0) {
- var container = resolver.getReferencedExportContainer(node, (emitFlags & 131072) !== 0);
- if (container) {
- if (container.kind === 256) {
- return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), node);
- }
+ else {
+ loopParameters.push(ts.createParameter(name));
+ if (resolver.getNodeCheckFlags(decl) & 2097152) {
+ var outParamName = ts.createUniqueName("out_" + name.text);
+ loopOutParameters.push({ originalName: name, outParamName: outParamName });
}
}
- return undefined;
}
- function trySubstituteImportedName(node) {
- if ((ts.getEmitFlags(node) & 262144) === 0) {
- var declaration = resolver.getReferencedImportDeclaration(node);
- if (declaration) {
- if (ts.isImportClause(declaration)) {
- if (languageVersion >= 1) {
- return ts.createPropertyAccess(ts.getGeneratedNameForNode(declaration.parent), ts.createIdentifier("default"), node);
- }
- else {
- return ts.createElementAccess(ts.getGeneratedNameForNode(declaration.parent), ts.createLiteral("default"), node);
- }
- }
- else if (ts.isImportSpecifier(declaration)) {
- var name_35 = declaration.propertyName || declaration.name;
- if (name_35.originalKeywordKind === 77 && languageVersion <= 0) {
- return ts.createElementAccess(ts.getGeneratedNameForNode(declaration.parent.parent.parent), ts.createLiteral(name_35.text), node);
- }
- else {
- return ts.createPropertyAccess(ts.getGeneratedNameForNode(declaration.parent.parent.parent), ts.getSynthesizedClone(name_35), node);
+ function addObjectLiteralMembers(expressions, node, receiver, start) {
+ var properties = node.properties;
+ var numProperties = properties.length;
+ for (var i = start; i < numProperties; i++) {
+ var property = properties[i];
+ switch (property.kind) {
+ case 150:
+ case 151:
+ var accessors = ts.getAllAccessorDeclarations(node.properties, property);
+ if (property === accessors.firstAccessor) {
+ expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine));
}
- }
+ break;
+ case 253:
+ expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));
+ break;
+ case 254:
+ expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));
+ break;
+ case 148:
+ expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine));
+ break;
+ default:
+ ts.Debug.failBadSyntaxKind(node);
+ break;
}
}
- return undefined;
}
- function getModuleMemberName(name) {
- return ts.createPropertyAccess(ts.createIdentifier("exports"), name, name);
+ function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {
+ var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), property);
+ if (startsOnNewLine) {
+ expression.startsOnNewLine = true;
+ }
+ return expression;
}
- function createRequireCall(importNode) {
- var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);
- var args = [];
- if (ts.isDefined(moduleName)) {
- args.push(moduleName);
+ function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {
+ var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), property);
+ if (startsOnNewLine) {
+ expression.startsOnNewLine = true;
}
- return ts.createCall(ts.createIdentifier("require"), undefined, args);
+ return expression;
}
- function createExportStatement(name, value, location) {
- var statement = ts.createStatement(createExportAssignment(name, value));
- statement.startsOnNewLine = true;
- if (location) {
- ts.setSourceMapRange(statement, location);
+ function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) {
+ var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined), method);
+ if (startsOnNewLine) {
+ expression.startsOnNewLine = true;
}
- return statement;
+ return expression;
}
- function createExportAssignment(name, value) {
- return ts.createAssignment(name.originalKeywordKind === 77 && languageVersion === 0
- ? ts.createElementAccess(ts.createIdentifier("exports"), ts.createLiteral(name.text))
- : ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value);
+ function visitMethodDeclaration(node) {
+ ts.Debug.assert(!ts.isComputedPropertyName(node.name));
+ var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined);
+ ts.setEmitFlags(functionExpression, 16384 | ts.getEmitFlags(functionExpression));
+ return ts.createPropertyAssignment(node.name, functionExpression, node);
}
- function collectAsynchronousDependencies(node, includeNonAmdDependencies) {
- var aliasedModuleNames = [];
- var unaliasedModuleNames = [];
- var importAliasNames = [];
- for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) {
- var amdDependency = _a[_i];
- if (amdDependency.name) {
- aliasedModuleNames.push(ts.createLiteral(amdDependency.path));
- importAliasNames.push(ts.createParameter(amdDependency.name));
- }
- else {
- unaliasedModuleNames.push(ts.createLiteral(amdDependency.path));
- }
- }
- for (var _b = 0, externalImports_3 = externalImports; _b < externalImports_3.length; _b++) {
- var importNode = externalImports_3[_b];
- var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);
- var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile);
- if (includeNonAmdDependencies && importAliasName) {
- ts.setEmitFlags(importAliasName, 128);
- aliasedModuleNames.push(externalModuleName);
- importAliasNames.push(ts.createParameter(importAliasName));
- }
- else {
- unaliasedModuleNames.push(externalModuleName);
- }
- }
- return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames };
+ function visitShorthandPropertyAssignment(node) {
+ return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), node);
}
- function updateSourceFile(node, statements) {
- var updated = ts.getMutableClone(node);
- updated.statements = ts.createNodeArray(statements, node.statements);
- return updated;
+ function visitYieldExpression(node) {
+ return ts.visitEachChild(node, visitor, context);
}
- var _a;
- }
- ts.transformModule = transformModule;
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var entities = createEntitiesMap();
- function transformJsx(context) {
- var compilerOptions = context.getCompilerOptions();
- var currentSourceFile;
- return transformSourceFile;
- function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
- return node;
- }
- currentSourceFile = node;
- node = ts.visitEachChild(node, visitor, context);
- currentSourceFile = undefined;
- return node;
+ function visitArrayLiteralExpression(node) {
+ return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma);
}
- function visitor(node) {
- if (node.transformFlags & 4) {
- return visitorWorker(node);
+ function visitCallExpression(node) {
+ return visitCallExpressionWithPotentialCapturedThisAssignment(node, true);
+ }
+ function visitImmediateSuperCallInBody(node) {
+ return visitCallExpressionWithPotentialCapturedThisAssignment(node, false);
+ }
+ function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
+ var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
+ if (node.expression.kind === 96) {
+ ts.setEmitFlags(thisArg, 128);
}
- else if (node.transformFlags & 8) {
- return ts.visitEachChild(node, visitor, context);
+ var resultingCall;
+ if (node.transformFlags & 1048576) {
+ resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false));
}
else {
- return node;
+ resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node);
}
- }
- function visitorWorker(node) {
- switch (node.kind) {
- case 241:
- return visitJsxElement(node, false);
- case 242:
- return visitJsxSelfClosingElement(node, false);
- case 248:
- return visitJsxExpression(node);
- default:
- ts.Debug.failBadSyntaxKind(node);
- return undefined;
+ if (node.expression.kind === 96) {
+ var actualThis = ts.createThis();
+ ts.setEmitFlags(actualThis, 128);
+ var initializer = ts.createLogicalOr(resultingCall, actualThis);
+ return assignToCapturedThis
+ ? ts.createAssignment(ts.createIdentifier("_this"), initializer)
+ : initializer;
}
+ return resultingCall;
}
- function transformJsxChildToExpression(node) {
- switch (node.kind) {
- case 244:
- return visitJsxText(node);
- case 248:
- return visitJsxExpression(node);
- case 241:
- return visitJsxElement(node, true);
- case 242:
- return visitJsxSelfClosingElement(node, true);
- default:
- ts.Debug.failBadSyntaxKind(node);
- return undefined;
+ function visitNewExpression(node) {
+ ts.Debug.assert((node.transformFlags & 1048576) !== 0);
+ var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
+ return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []);
+ }
+ function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) {
+ var numElements = elements.length;
+ var segments = ts.flatten(ts.spanMap(elements, partitionSpreadElement, function (partition, visitPartition, _start, end) {
+ return visitPartition(partition, multiLine, hasTrailingComma && end === numElements);
+ }));
+ if (segments.length === 1) {
+ var firstElement = elements[0];
+ return needsUniqueCopy && ts.isSpreadElementExpression(firstElement) && firstElement.expression.kind !== 171
+ ? ts.createArraySlice(segments[0])
+ : segments[0];
}
+ return ts.createArrayConcat(segments.shift(), segments);
}
- function visitJsxElement(node, isChild) {
- return visitJsxOpeningLikeElement(node.openingElement, node.children, isChild, node);
+ function partitionSpreadElement(node) {
+ return ts.isSpreadElementExpression(node)
+ ? visitSpanOfSpreadElements
+ : visitSpanOfNonSpreadElements;
}
- function visitJsxSelfClosingElement(node, isChild) {
- return visitJsxOpeningLikeElement(node, undefined, isChild, node);
+ function visitSpanOfSpreadElements(chunk) {
+ return ts.map(chunk, visitExpressionOfSpreadElement);
}
- function visitJsxOpeningLikeElement(node, children, isChild, location) {
- var tagName = getTagName(node);
- var objectProperties;
- var attrs = node.attributes;
- if (attrs.length === 0) {
- objectProperties = ts.createNull();
- }
- else {
- var segments = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { return isSpread
- ? ts.map(attrs, transformJsxSpreadAttributeToExpression)
- : ts.createObjectLiteral(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)); }));
- if (ts.isJsxSpreadAttribute(attrs[0])) {
- segments.unshift(ts.createObjectLiteral());
- }
- objectProperties = ts.singleOrUndefined(segments)
- || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments);
- }
- var element = ts.createReactCreateElement(compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);
- if (isChild) {
- ts.startOnNewLine(element);
- }
- return element;
+ function visitSpanOfNonSpreadElements(chunk, multiLine, hasTrailingComma) {
+ return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine);
}
- function transformJsxSpreadAttributeToExpression(node) {
+ function visitExpressionOfSpreadElement(node) {
return ts.visitNode(node.expression, visitor, ts.isExpression);
}
- function transformJsxAttributeToObjectLiteralElement(node) {
- var name = getAttributeName(node);
- var expression = transformJsxAttributeInitializer(node.initializer);
- return ts.createPropertyAssignment(name, expression);
+ function visitTemplateLiteral(node) {
+ return ts.createLiteral(node.text, node);
}
- function transformJsxAttributeInitializer(node) {
- if (node === undefined) {
- return ts.createLiteral(true);
- }
- else if (node.kind === 9) {
- var decoded = tryDecodeEntities(node.text);
- return decoded ? ts.createLiteral(decoded, node) : node;
- }
- else if (node.kind === 248) {
- return visitJsxExpression(node);
+ function visitTaggedTemplateExpression(node) {
+ var tag = ts.visitNode(node.tag, visitor, ts.isExpression);
+ var temp = ts.createTempVariable(hoistVariableDeclaration);
+ var templateArguments = [temp];
+ var cookedStrings = [];
+ var rawStrings = [];
+ var template = node.template;
+ if (ts.isNoSubstitutionTemplateLiteral(template)) {
+ cookedStrings.push(ts.createLiteral(template.text));
+ rawStrings.push(getRawLiteral(template));
}
else {
- ts.Debug.failBadSyntaxKind(node);
+ cookedStrings.push(ts.createLiteral(template.head.text));
+ rawStrings.push(getRawLiteral(template.head));
+ for (var _i = 0, _a = template.templateSpans; _i < _a.length; _i++) {
+ var templateSpan = _a[_i];
+ cookedStrings.push(ts.createLiteral(templateSpan.literal.text));
+ rawStrings.push(getRawLiteral(templateSpan.literal));
+ templateArguments.push(ts.visitNode(templateSpan.expression, visitor, ts.isExpression));
+ }
}
+ return ts.createParen(ts.inlineExpressions([
+ ts.createAssignment(temp, ts.createArrayLiteral(cookedStrings)),
+ ts.createAssignment(ts.createPropertyAccess(temp, "raw"), ts.createArrayLiteral(rawStrings)),
+ ts.createCall(tag, undefined, templateArguments)
+ ]));
}
- function visitJsxText(node) {
- var text = ts.getTextOfNode(node, true);
- var parts;
- var firstNonWhitespace = 0;
- var lastNonWhitespace = -1;
- for (var i = 0; i < text.length; i++) {
- var c = text.charCodeAt(i);
- if (ts.isLineBreak(c)) {
- if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) {
- var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1);
- if (!parts) {
- parts = [];
- }
- parts.push(ts.createLiteral(decodeEntities(part)));
- }
- firstNonWhitespace = -1;
- }
- else if (!ts.isWhiteSpace(c)) {
- lastNonWhitespace = i;
- if (firstNonWhitespace === -1) {
- firstNonWhitespace = i;
- }
- }
+ function getRawLiteral(node) {
+ var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
+ var isLast = node.kind === 12 || node.kind === 15;
+ text = text.substring(1, text.length - (isLast ? 1 : 2));
+ text = text.replace(/\r\n?/g, "\n");
+ return ts.createLiteral(text, node);
+ }
+ function visitTemplateExpression(node) {
+ var expressions = [];
+ addTemplateHead(expressions, node);
+ addTemplateSpans(expressions, node);
+ var expression = ts.reduceLeft(expressions, ts.createAdd);
+ if (ts.nodeIsSynthesized(expression)) {
+ ts.setTextRange(expression, node);
}
- if (firstNonWhitespace !== -1) {
- var part = text.substr(firstNonWhitespace);
- if (!parts) {
- parts = [];
- }
- parts.push(ts.createLiteral(decodeEntities(part)));
+ return expression;
+ }
+ function shouldAddTemplateHead(node) {
+ ts.Debug.assert(node.templateSpans.length !== 0);
+ return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0;
+ }
+ function addTemplateHead(expressions, node) {
+ if (!shouldAddTemplateHead(node)) {
+ return;
}
- if (parts) {
- return ts.reduceLeft(parts, aggregateJsxTextParts);
+ expressions.push(ts.createLiteral(node.head.text));
+ }
+ function addTemplateSpans(expressions, node) {
+ for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {
+ var span_6 = _a[_i];
+ expressions.push(ts.visitNode(span_6.expression, visitor, ts.isExpression));
+ if (span_6.literal.text.length !== 0) {
+ expressions.push(ts.createLiteral(span_6.literal.text));
+ }
}
- return undefined;
}
- function aggregateJsxTextParts(left, right) {
- return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right);
+ function visitSuperKeyword() {
+ return enclosingNonAsyncFunctionBody
+ && ts.isClassElement(enclosingNonAsyncFunctionBody)
+ && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32)
+ && currentParent.kind !== 175
+ ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype")
+ : ts.createIdentifier("_super");
}
- function decodeEntities(text) {
- return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) {
- if (decimal) {
- return String.fromCharCode(parseInt(decimal, 10));
- }
- else if (hex) {
- return String.fromCharCode(parseInt(hex, 16));
- }
- else {
- var ch = entities[word];
- return ch ? String.fromCharCode(ch) : match;
- }
- });
+ function visitSourceFileNode(node) {
+ var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1];
+ var statements = [];
+ startLexicalEnvironment();
+ ts.addRange(statements, prologue);
+ addCaptureThisForNodeIfNeeded(statements, node);
+ ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement));
+ ts.addRange(statements, endLexicalEnvironment());
+ var clone = ts.getMutableClone(node);
+ clone.statements = ts.createNodeArray(statements, node.statements);
+ return clone;
}
- function tryDecodeEntities(text) {
- var decoded = decodeEntities(text);
- return decoded === text ? undefined : decoded;
+ function onEmitNode(emitContext, node, emitCallback) {
+ var savedEnclosingFunction = enclosingFunction;
+ if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) {
+ enclosingFunction = node;
+ }
+ previousOnEmitNode(emitContext, node, emitCallback);
+ enclosingFunction = savedEnclosingFunction;
}
- function getTagName(node) {
- if (node.kind === 241) {
- return getTagName(node.openingElement);
+ function enableSubstitutionsForBlockScopedBindings() {
+ if ((enabledSubstitutions & 2) === 0) {
+ enabledSubstitutions |= 2;
+ context.enableSubstitution(70);
}
- else {
- var name_36 = node.tagName;
- if (ts.isIdentifier(name_36) && ts.isIntrinsicJsxName(name_36.text)) {
- return ts.createLiteral(name_36.text);
- }
- else {
- return ts.createExpressionFromEntityName(name_36);
- }
+ }
+ function enableSubstitutionsForCapturedThis() {
+ if ((enabledSubstitutions & 1) === 0) {
+ enabledSubstitutions |= 1;
+ context.enableSubstitution(98);
+ context.enableEmitNotification(149);
+ context.enableEmitNotification(148);
+ context.enableEmitNotification(150);
+ context.enableEmitNotification(151);
+ context.enableEmitNotification(181);
+ context.enableEmitNotification(180);
+ context.enableEmitNotification(221);
}
}
- function getAttributeName(node) {
- var name = node.name;
- if (/^[A-Za-z_]\w*$/.test(name.text)) {
- return name;
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (emitContext === 1) {
+ return substituteExpression(node);
}
- else {
- return ts.createLiteral(name.text);
+ if (ts.isIdentifier(node)) {
+ return substituteIdentifier(node);
}
+ return node;
}
- function visitJsxExpression(node) {
- return ts.visitNode(node.expression, visitor, ts.isExpression);
- }
- }
- ts.transformJsx = transformJsx;
- function createEntitiesMap() {
- return ts.createMap({
- "quot": 0x0022,
- "amp": 0x0026,
- "apos": 0x0027,
- "lt": 0x003C,
- "gt": 0x003E,
- "nbsp": 0x00A0,
- "iexcl": 0x00A1,
- "cent": 0x00A2,
- "pound": 0x00A3,
- "curren": 0x00A4,
- "yen": 0x00A5,
- "brvbar": 0x00A6,
- "sect": 0x00A7,
- "uml": 0x00A8,
- "copy": 0x00A9,
- "ordf": 0x00AA,
- "laquo": 0x00AB,
- "not": 0x00AC,
- "shy": 0x00AD,
- "reg": 0x00AE,
- "macr": 0x00AF,
- "deg": 0x00B0,
- "plusmn": 0x00B1,
- "sup2": 0x00B2,
- "sup3": 0x00B3,
- "acute": 0x00B4,
- "micro": 0x00B5,
- "para": 0x00B6,
- "middot": 0x00B7,
- "cedil": 0x00B8,
- "sup1": 0x00B9,
- "ordm": 0x00BA,
- "raquo": 0x00BB,
- "frac14": 0x00BC,
- "frac12": 0x00BD,
- "frac34": 0x00BE,
- "iquest": 0x00BF,
- "Agrave": 0x00C0,
- "Aacute": 0x00C1,
- "Acirc": 0x00C2,
- "Atilde": 0x00C3,
- "Auml": 0x00C4,
- "Aring": 0x00C5,
- "AElig": 0x00C6,
- "Ccedil": 0x00C7,
- "Egrave": 0x00C8,
- "Eacute": 0x00C9,
- "Ecirc": 0x00CA,
- "Euml": 0x00CB,
- "Igrave": 0x00CC,
- "Iacute": 0x00CD,
- "Icirc": 0x00CE,
- "Iuml": 0x00CF,
- "ETH": 0x00D0,
- "Ntilde": 0x00D1,
- "Ograve": 0x00D2,
- "Oacute": 0x00D3,
- "Ocirc": 0x00D4,
- "Otilde": 0x00D5,
- "Ouml": 0x00D6,
- "times": 0x00D7,
- "Oslash": 0x00D8,
- "Ugrave": 0x00D9,
- "Uacute": 0x00DA,
- "Ucirc": 0x00DB,
- "Uuml": 0x00DC,
- "Yacute": 0x00DD,
- "THORN": 0x00DE,
- "szlig": 0x00DF,
- "agrave": 0x00E0,
- "aacute": 0x00E1,
- "acirc": 0x00E2,
- "atilde": 0x00E3,
- "auml": 0x00E4,
- "aring": 0x00E5,
- "aelig": 0x00E6,
- "ccedil": 0x00E7,
- "egrave": 0x00E8,
- "eacute": 0x00E9,
- "ecirc": 0x00EA,
- "euml": 0x00EB,
- "igrave": 0x00EC,
- "iacute": 0x00ED,
- "icirc": 0x00EE,
- "iuml": 0x00EF,
- "eth": 0x00F0,
- "ntilde": 0x00F1,
- "ograve": 0x00F2,
- "oacute": 0x00F3,
- "ocirc": 0x00F4,
- "otilde": 0x00F5,
- "ouml": 0x00F6,
- "divide": 0x00F7,
- "oslash": 0x00F8,
- "ugrave": 0x00F9,
- "uacute": 0x00FA,
- "ucirc": 0x00FB,
- "uuml": 0x00FC,
- "yacute": 0x00FD,
- "thorn": 0x00FE,
- "yuml": 0x00FF,
- "OElig": 0x0152,
- "oelig": 0x0153,
- "Scaron": 0x0160,
- "scaron": 0x0161,
- "Yuml": 0x0178,
- "fnof": 0x0192,
- "circ": 0x02C6,
- "tilde": 0x02DC,
- "Alpha": 0x0391,
- "Beta": 0x0392,
- "Gamma": 0x0393,
- "Delta": 0x0394,
- "Epsilon": 0x0395,
- "Zeta": 0x0396,
- "Eta": 0x0397,
- "Theta": 0x0398,
- "Iota": 0x0399,
- "Kappa": 0x039A,
- "Lambda": 0x039B,
- "Mu": 0x039C,
- "Nu": 0x039D,
- "Xi": 0x039E,
- "Omicron": 0x039F,
- "Pi": 0x03A0,
- "Rho": 0x03A1,
- "Sigma": 0x03A3,
- "Tau": 0x03A4,
- "Upsilon": 0x03A5,
- "Phi": 0x03A6,
- "Chi": 0x03A7,
- "Psi": 0x03A8,
- "Omega": 0x03A9,
- "alpha": 0x03B1,
- "beta": 0x03B2,
- "gamma": 0x03B3,
- "delta": 0x03B4,
- "epsilon": 0x03B5,
- "zeta": 0x03B6,
- "eta": 0x03B7,
- "theta": 0x03B8,
- "iota": 0x03B9,
- "kappa": 0x03BA,
- "lambda": 0x03BB,
- "mu": 0x03BC,
- "nu": 0x03BD,
- "xi": 0x03BE,
- "omicron": 0x03BF,
- "pi": 0x03C0,
- "rho": 0x03C1,
- "sigmaf": 0x03C2,
- "sigma": 0x03C3,
- "tau": 0x03C4,
- "upsilon": 0x03C5,
- "phi": 0x03C6,
- "chi": 0x03C7,
- "psi": 0x03C8,
- "omega": 0x03C9,
- "thetasym": 0x03D1,
- "upsih": 0x03D2,
- "piv": 0x03D6,
- "ensp": 0x2002,
- "emsp": 0x2003,
- "thinsp": 0x2009,
- "zwnj": 0x200C,
- "zwj": 0x200D,
- "lrm": 0x200E,
- "rlm": 0x200F,
- "ndash": 0x2013,
- "mdash": 0x2014,
- "lsquo": 0x2018,
- "rsquo": 0x2019,
- "sbquo": 0x201A,
- "ldquo": 0x201C,
- "rdquo": 0x201D,
- "bdquo": 0x201E,
- "dagger": 0x2020,
- "Dagger": 0x2021,
- "bull": 0x2022,
- "hellip": 0x2026,
- "permil": 0x2030,
- "prime": 0x2032,
- "Prime": 0x2033,
- "lsaquo": 0x2039,
- "rsaquo": 0x203A,
- "oline": 0x203E,
- "frasl": 0x2044,
- "euro": 0x20AC,
- "image": 0x2111,
- "weierp": 0x2118,
- "real": 0x211C,
- "trade": 0x2122,
- "alefsym": 0x2135,
- "larr": 0x2190,
- "uarr": 0x2191,
- "rarr": 0x2192,
- "darr": 0x2193,
- "harr": 0x2194,
- "crarr": 0x21B5,
- "lArr": 0x21D0,
- "uArr": 0x21D1,
- "rArr": 0x21D2,
- "dArr": 0x21D3,
- "hArr": 0x21D4,
- "forall": 0x2200,
- "part": 0x2202,
- "exist": 0x2203,
- "empty": 0x2205,
- "nabla": 0x2207,
- "isin": 0x2208,
- "notin": 0x2209,
- "ni": 0x220B,
- "prod": 0x220F,
- "sum": 0x2211,
- "minus": 0x2212,
- "lowast": 0x2217,
- "radic": 0x221A,
- "prop": 0x221D,
- "infin": 0x221E,
- "ang": 0x2220,
- "and": 0x2227,
- "or": 0x2228,
- "cap": 0x2229,
- "cup": 0x222A,
- "int": 0x222B,
- "there4": 0x2234,
- "sim": 0x223C,
- "cong": 0x2245,
- "asymp": 0x2248,
- "ne": 0x2260,
- "equiv": 0x2261,
- "le": 0x2264,
- "ge": 0x2265,
- "sub": 0x2282,
- "sup": 0x2283,
- "nsub": 0x2284,
- "sube": 0x2286,
- "supe": 0x2287,
- "oplus": 0x2295,
- "otimes": 0x2297,
- "perp": 0x22A5,
- "sdot": 0x22C5,
- "lceil": 0x2308,
- "rceil": 0x2309,
- "lfloor": 0x230A,
- "rfloor": 0x230B,
- "lang": 0x2329,
- "rang": 0x232A,
- "loz": 0x25CA,
- "spades": 0x2660,
- "clubs": 0x2663,
- "hearts": 0x2665,
- "diams": 0x2666
- });
- }
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function transformES7(context) {
- var hoistVariableDeclaration = context.hoistVariableDeclaration;
- return transformSourceFile;
- function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
- return node;
+ function substituteIdentifier(node) {
+ if (enabledSubstitutions & 2) {
+ var original = ts.getParseTreeNode(node, ts.isIdentifier);
+ if (original && isNameOfDeclarationWithCollidingName(original)) {
+ return ts.getGeneratedNameForNode(original);
+ }
}
- return ts.visitEachChild(node, visitor, context);
+ return node;
}
- function visitor(node) {
- if (node.transformFlags & 16) {
- return visitorWorker(node);
+ function isNameOfDeclarationWithCollidingName(node) {
+ var parent = node.parent;
+ switch (parent.kind) {
+ case 170:
+ case 222:
+ case 225:
+ case 219:
+ return parent.name === node
+ && resolver.isDeclarationWithCollidingName(parent);
}
- else if (node.transformFlags & 32) {
- return ts.visitEachChild(node, visitor, context);
+ return false;
+ }
+ function substituteExpression(node) {
+ switch (node.kind) {
+ case 70:
+ return substituteExpressionIdentifier(node);
+ case 98:
+ return substituteThisKeyword(node);
}
- else {
- return node;
+ return node;
+ }
+ function substituteExpressionIdentifier(node) {
+ if (enabledSubstitutions & 2) {
+ var declaration = resolver.getReferencedDeclarationWithCollidingName(node);
+ if (declaration) {
+ return ts.getGeneratedNameForNode(declaration.name);
+ }
}
+ return node;
}
- function visitorWorker(node) {
- switch (node.kind) {
- case 187:
- return visitBinaryExpression(node);
- default:
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
+ function substituteThisKeyword(node) {
+ if (enabledSubstitutions & 1
+ && enclosingFunction
+ && ts.getEmitFlags(enclosingFunction) & 256) {
+ return ts.createIdentifier("_this", node);
}
+ return node;
}
- function visitBinaryExpression(node) {
- var left = ts.visitNode(node.left, visitor, ts.isExpression);
- var right = ts.visitNode(node.right, visitor, ts.isExpression);
- if (node.operatorToken.kind === 60) {
- var target = void 0;
- var value = void 0;
- if (ts.isElementAccessExpression(left)) {
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left);
- value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left);
+ function getLocalName(node, allowComments, allowSourceMaps) {
+ return getDeclarationName(node, allowComments, allowSourceMaps, 262144);
+ }
+ function getDeclarationName(node, allowComments, allowSourceMaps, emitFlags) {
+ if (node.name && !ts.isGeneratedIdentifier(node.name)) {
+ var name_33 = ts.getMutableClone(node.name);
+ emitFlags |= ts.getEmitFlags(node.name);
+ if (!allowSourceMaps) {
+ emitFlags |= 1536;
}
- else if (ts.isPropertyAccessExpression(left)) {
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left);
- value = ts.createPropertyAccess(expressionTemp, left.name, left);
+ if (!allowComments) {
+ emitFlags |= 49152;
}
- else {
- target = left;
- value = left;
+ if (emitFlags) {
+ ts.setEmitFlags(name_33, emitFlags);
}
- return ts.createAssignment(target, ts.createMathPow(value, right, node), node);
+ return name_33;
}
- else if (node.operatorToken.kind === 38) {
- return ts.createMathPow(left, right, node);
+ return ts.getGeneratedNameForNode(node);
+ }
+ function getClassMemberPrefix(node, member) {
+ var expression = getLocalName(node);
+ return ts.hasModifier(member, 32) ? expression : ts.createPropertyAccess(expression, "prototype");
+ }
+ function hasSynthesizedDefaultSuperCall(constructor, hasExtendsClause) {
+ if (!constructor || !hasExtendsClause) {
+ return false;
}
- else {
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
+ var parameter = ts.singleOrUndefined(constructor.parameters);
+ if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) {
+ return false;
+ }
+ var statement = ts.firstOrUndefined(constructor.body.statements);
+ if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 203) {
+ return false;
}
+ var statementExpression = statement.expression;
+ if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 175) {
+ return false;
+ }
+ var callTarget = statementExpression.expression;
+ if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 96) {
+ return false;
+ }
+ var callArgument = ts.singleOrUndefined(statementExpression.arguments);
+ if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 192) {
+ return false;
+ }
+ var expression = callArgument.expression;
+ return ts.isIdentifier(expression) && expression === parameter.name;
}
}
- ts.transformES7 = transformES7;
+ ts.transformES2015 = transformES2015;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ var OpCode;
+ (function (OpCode) {
+ OpCode[OpCode["Nop"] = 0] = "Nop";
+ OpCode[OpCode["Statement"] = 1] = "Statement";
+ OpCode[OpCode["Assign"] = 2] = "Assign";
+ OpCode[OpCode["Break"] = 3] = "Break";
+ OpCode[OpCode["BreakWhenTrue"] = 4] = "BreakWhenTrue";
+ OpCode[OpCode["BreakWhenFalse"] = 5] = "BreakWhenFalse";
+ OpCode[OpCode["Yield"] = 6] = "Yield";
+ OpCode[OpCode["YieldStar"] = 7] = "YieldStar";
+ OpCode[OpCode["Return"] = 8] = "Return";
+ OpCode[OpCode["Throw"] = 9] = "Throw";
+ OpCode[OpCode["Endfinally"] = 10] = "Endfinally";
+ })(OpCode || (OpCode = {}));
+ var BlockAction;
+ (function (BlockAction) {
+ BlockAction[BlockAction["Open"] = 0] = "Open";
+ BlockAction[BlockAction["Close"] = 1] = "Close";
+ })(BlockAction || (BlockAction = {}));
+ var CodeBlockKind;
+ (function (CodeBlockKind) {
+ CodeBlockKind[CodeBlockKind["Exception"] = 0] = "Exception";
+ CodeBlockKind[CodeBlockKind["With"] = 1] = "With";
+ CodeBlockKind[CodeBlockKind["Switch"] = 2] = "Switch";
+ CodeBlockKind[CodeBlockKind["Loop"] = 3] = "Loop";
+ CodeBlockKind[CodeBlockKind["Labeled"] = 4] = "Labeled";
+ })(CodeBlockKind || (CodeBlockKind = {}));
+ var ExceptionBlockState;
+ (function (ExceptionBlockState) {
+ ExceptionBlockState[ExceptionBlockState["Try"] = 0] = "Try";
+ ExceptionBlockState[ExceptionBlockState["Catch"] = 1] = "Catch";
+ ExceptionBlockState[ExceptionBlockState["Finally"] = 2] = "Finally";
+ ExceptionBlockState[ExceptionBlockState["Done"] = 3] = "Done";
+ })(ExceptionBlockState || (ExceptionBlockState = {}));
+ var Instruction;
+ (function (Instruction) {
+ Instruction[Instruction["Next"] = 0] = "Next";
+ Instruction[Instruction["Throw"] = 1] = "Throw";
+ Instruction[Instruction["Return"] = 2] = "Return";
+ Instruction[Instruction["Break"] = 3] = "Break";
+ Instruction[Instruction["Yield"] = 4] = "Yield";
+ Instruction[Instruction["YieldStar"] = 5] = "YieldStar";
+ Instruction[Instruction["Catch"] = 6] = "Catch";
+ Instruction[Instruction["Endfinally"] = 7] = "Endfinally";
+ })(Instruction || (Instruction = {}));
var instructionNames = ts.createMap((_a = {},
_a[2] = "return",
_a[3] = "break",
@@ -38897,7 +40595,7 @@ var ts;
if (ts.isDeclarationFile(node)) {
return node;
}
- if (node.transformFlags & 1024) {
+ if (node.transformFlags & 4096) {
currentSourceFile = node;
node = ts.visitEachChild(node, visitor, context);
currentSourceFile = undefined;
@@ -38912,10 +40610,10 @@ var ts;
else if (inGeneratorFunctionBody) {
return visitJavaScriptInGeneratorFunctionBody(node);
}
- else if (transformFlags & 512) {
+ else if (transformFlags & 2048) {
return visitGenerator(node);
}
- else if (transformFlags & 1024) {
+ else if (transformFlags & 4096) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -38924,13 +40622,13 @@ var ts;
}
function visitJavaScriptInStatementContainingYield(node) {
switch (node.kind) {
- case 204:
- return visitDoStatement(node);
case 205:
+ return visitDoStatement(node);
+ case 206:
return visitWhileStatement(node);
- case 213:
- return visitSwitchStatement(node);
case 214:
+ return visitSwitchStatement(node);
+ case 215:
return visitLabeledStatement(node);
default:
return visitJavaScriptInGeneratorFunctionBody(node);
@@ -38938,30 +40636,30 @@ var ts;
}
function visitJavaScriptInGeneratorFunctionBody(node) {
switch (node.kind) {
- case 220:
+ case 221:
return visitFunctionDeclaration(node);
- case 179:
+ case 180:
return visitFunctionExpression(node);
- case 149:
case 150:
+ case 151:
return visitAccessorDeclaration(node);
- case 200:
+ case 201:
return visitVariableStatement(node);
- case 206:
- return visitForStatement(node);
case 207:
+ return visitForStatement(node);
+ case 208:
return visitForInStatement(node);
- case 210:
+ case 211:
return visitBreakStatement(node);
- case 209:
+ case 210:
return visitContinueStatement(node);
- case 211:
+ case 212:
return visitReturnStatement(node);
default:
- if (node.transformFlags & 4194304) {
+ if (node.transformFlags & 16777216) {
return visitJavaScriptContainingYield(node);
}
- else if (node.transformFlags & (1024 | 8388608)) {
+ else if (node.transformFlags & (4096 | 33554432)) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -38971,21 +40669,21 @@ var ts;
}
function visitJavaScriptContainingYield(node) {
switch (node.kind) {
- case 187:
- return visitBinaryExpression(node);
case 188:
+ return visitBinaryExpression(node);
+ case 189:
return visitConditionalExpression(node);
- case 190:
+ case 191:
return visitYieldExpression(node);
- case 170:
- return visitArrayLiteralExpression(node);
case 171:
+ return visitArrayLiteralExpression(node);
+ case 172:
return visitObjectLiteralExpression(node);
- case 173:
- return visitElementAccessExpression(node);
case 174:
- return visitCallExpression(node);
+ return visitElementAccessExpression(node);
case 175:
+ return visitCallExpression(node);
+ case 176:
return visitNewExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -38993,9 +40691,9 @@ var ts;
}
function visitGenerator(node) {
switch (node.kind) {
- case 220:
+ case 221:
return visitFunctionDeclaration(node);
- case 179:
+ case 180:
return visitFunctionExpression(node);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -39025,7 +40723,7 @@ var ts;
}
function visitFunctionExpression(node) {
if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- node = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node);
+ node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node);
}
else {
var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
@@ -39098,7 +40796,7 @@ var ts;
return ts.createBlock(statements, body, body.multiLine);
}
function visitVariableStatement(node) {
- if (node.transformFlags & 4194304) {
+ if (node.transformFlags & 16777216) {
transformAndEmitVariableDeclarationList(node.declarationList);
return undefined;
}
@@ -39128,23 +40826,23 @@ var ts;
}
}
function isCompoundAssignment(kind) {
- return kind >= 57
- && kind <= 68;
+ return kind >= 58
+ && kind <= 69;
}
function getOperatorForCompoundAssignment(kind) {
switch (kind) {
- case 57: return 35;
case 58: return 36;
case 59: return 37;
case 60: return 38;
case 61: return 39;
case 62: return 40;
- case 63: return 43;
+ case 63: return 41;
case 64: return 44;
case 65: return 45;
case 66: return 46;
case 67: return 47;
case 68: return 48;
+ case 69: return 49;
}
}
function visitRightAssociativeBinaryExpression(node) {
@@ -39152,10 +40850,10 @@ var ts;
if (containsYield(right)) {
var target = void 0;
switch (left.kind) {
- case 172:
+ case 173:
target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);
break;
- case 173:
+ case 174:
target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression)));
break;
default:
@@ -39164,7 +40862,7 @@ var ts;
}
var operator = node.operatorToken.kind;
if (isCompoundAssignment(operator)) {
- return ts.createBinary(target, 56, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node);
+ return ts.createBinary(target, 57, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node);
}
else {
return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression));
@@ -39177,13 +40875,13 @@ var ts;
if (ts.isLogicalOperator(node.operatorToken.kind)) {
return visitLogicalBinaryExpression(node);
}
- else if (node.operatorToken.kind === 24) {
+ else if (node.operatorToken.kind === 25) {
return visitCommaExpression(node);
}
- var clone_5 = ts.getMutableClone(node);
- clone_5.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
- clone_5.right = ts.visitNode(node.right, visitor, ts.isExpression);
- return clone_5;
+ var clone_6 = ts.getMutableClone(node);
+ clone_6.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
+ clone_6.right = ts.visitNode(node.right, visitor, ts.isExpression);
+ return clone_6;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -39191,7 +40889,7 @@ var ts;
var resultLabel = defineLabel();
var resultLocal = declareLocal();
emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), node.left);
- if (node.operatorToken.kind === 51) {
+ if (node.operatorToken.kind === 52) {
emitBreakWhenFalse(resultLabel, resultLocal, node.left);
}
else {
@@ -39207,7 +40905,7 @@ var ts;
visit(node.right);
return ts.inlineExpressions(pendingExpressions);
function visit(node) {
- if (ts.isBinaryExpression(node) && node.operatorToken.kind === 24) {
+ if (ts.isBinaryExpression(node) && node.operatorToken.kind === 25) {
visit(node.left);
visit(node.right);
}
@@ -39250,7 +40948,7 @@ var ts;
function visitArrayLiteralExpression(node) {
return visitElements(node.elements, node.multiLine);
}
- function visitElements(elements, multiLine) {
+ function visitElements(elements, _multiLine) {
var numInitialElements = countInitialNodesWithoutYield(elements);
var temp = declareLocal();
var hasAssignedTemp = false;
@@ -39301,24 +40999,24 @@ var ts;
}
function visitElementAccessExpression(node) {
if (containsYield(node.argumentExpression)) {
- var clone_6 = ts.getMutableClone(node);
- clone_6.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
- clone_6.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
- return clone_6;
+ var clone_7 = ts.getMutableClone(node);
+ clone_7.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
+ clone_7.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
+ return clone_7;
}
return ts.visitEachChild(node, visitor, context);
}
function visitCallExpression(node) {
if (ts.forEach(node.arguments, containsYield)) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion, true), target = _a.target, thisArg = _a.thisArg;
- return ts.setOriginalNode(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isLeftHandSideExpression)), thisArg, visitElements(node.arguments, false), node), node);
+ return ts.setOriginalNode(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isLeftHandSideExpression)), thisArg, visitElements(node.arguments), node), node);
}
return ts.visitEachChild(node, visitor, context);
}
function visitNewExpression(node) {
if (ts.forEach(node.arguments, containsYield)) {
var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, false)), undefined, [], node), node);
+ return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)), undefined, [], node), node);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -39347,35 +41045,35 @@ var ts;
}
function transformAndEmitStatementWorker(node) {
switch (node.kind) {
- case 199:
+ case 200:
return transformAndEmitBlock(node);
- case 202:
- return transformAndEmitExpressionStatement(node);
case 203:
- return transformAndEmitIfStatement(node);
+ return transformAndEmitExpressionStatement(node);
case 204:
- return transformAndEmitDoStatement(node);
+ return transformAndEmitIfStatement(node);
case 205:
- return transformAndEmitWhileStatement(node);
+ return transformAndEmitDoStatement(node);
case 206:
- return transformAndEmitForStatement(node);
+ return transformAndEmitWhileStatement(node);
case 207:
+ return transformAndEmitForStatement(node);
+ case 208:
return transformAndEmitForInStatement(node);
- case 209:
- return transformAndEmitContinueStatement(node);
case 210:
- return transformAndEmitBreakStatement(node);
+ return transformAndEmitContinueStatement(node);
case 211:
- return transformAndEmitReturnStatement(node);
+ return transformAndEmitBreakStatement(node);
case 212:
- return transformAndEmitWithStatement(node);
+ return transformAndEmitReturnStatement(node);
case 213:
- return transformAndEmitSwitchStatement(node);
+ return transformAndEmitWithStatement(node);
case 214:
- return transformAndEmitLabeledStatement(node);
+ return transformAndEmitSwitchStatement(node);
case 215:
- return transformAndEmitThrowStatement(node);
+ return transformAndEmitLabeledStatement(node);
case 216:
+ return transformAndEmitThrowStatement(node);
+ case 217:
return transformAndEmitTryStatement(node);
default:
return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true));
@@ -39760,7 +41458,7 @@ var ts;
}
}
function containsYield(node) {
- return node && (node.transformFlags & 4194304) !== 0;
+ return node && (node.transformFlags & 16777216) !== 0;
}
function countInitialNodesWithoutYield(nodes) {
var numNodes = nodes.length;
@@ -39790,12 +41488,12 @@ var ts;
if (ts.isIdentifier(original) && original.parent) {
var declaration = resolver.getReferencedValueDeclaration(original);
if (declaration) {
- var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
- if (name_37) {
- var clone_7 = ts.getMutableClone(name_37);
- ts.setSourceMapRange(clone_7, node);
- ts.setCommentRange(clone_7, node);
- return clone_7;
+ var name_34 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
+ if (name_34) {
+ var clone_8 = ts.getMutableClone(name_34);
+ ts.setSourceMapRange(clone_8, node);
+ ts.setCommentRange(clone_8, node);
+ return clone_8;
}
}
}
@@ -39901,7 +41599,7 @@ var ts;
if (!renamedCatchVariables) {
renamedCatchVariables = ts.createMap();
renamedCatchVariableDeclarations = ts.createMap();
- context.enableSubstitution(69);
+ context.enableSubstitution(70);
}
renamedCatchVariables[text] = true;
renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;
@@ -40100,7 +41798,7 @@ var ts;
}
return expression;
}
- return ts.createNode(193);
+ return ts.createNode(194);
}
function createInstruction(instruction) {
var literal = ts.createLiteral(instruction);
@@ -40188,7 +41886,7 @@ var ts;
var buildResult = buildStatements();
return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"), undefined, [
ts.createThis(),
- ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, [ts.createParameter(state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 4194304)
+ ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 4194304)
]);
}
function buildStatements() {
@@ -40456,1456 +42154,1129 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- function transformES6(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
- var resolver = context.getEmitResolver();
+ function transformES5(context) {
var previousOnSubstituteNode = context.onSubstituteNode;
- var previousOnEmitNode = context.onEmitNode;
- context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- var currentSourceFile;
- var currentText;
- var currentParent;
- var currentNode;
- var enclosingVariableStatement;
- var enclosingBlockScopeContainer;
- var enclosingBlockScopeContainerParent;
- var enclosingFunction;
- var enclosingNonArrowFunction;
- var enclosingNonAsyncFunctionBody;
- var convertedLoopState;
- var enabledSubstitutions;
+ context.enableSubstitution(173);
+ context.enableSubstitution(253);
return transformSourceFile;
function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
- return node;
- }
- currentSourceFile = node;
- currentText = node.text;
- return ts.visitNode(node, visitor, ts.isSourceFile);
- }
- function visitor(node) {
- return saveStateAndInvoke(node, dispatcher);
- }
- function dispatcher(node) {
- return convertedLoopState
- ? visitorForConvertedLoopWorker(node)
- : visitorWorker(node);
- }
- function saveStateAndInvoke(node, f) {
- var savedEnclosingFunction = enclosingFunction;
- var savedEnclosingNonArrowFunction = enclosingNonArrowFunction;
- var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody;
- var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer;
- var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent;
- var savedEnclosingVariableStatement = enclosingVariableStatement;
- var savedCurrentParent = currentParent;
- var savedCurrentNode = currentNode;
- var savedConvertedLoopState = convertedLoopState;
- if (ts.nodeStartsNewLexicalEnvironment(node)) {
- convertedLoopState = undefined;
- }
- onBeforeVisitNode(node);
- var visited = f(node);
- convertedLoopState = savedConvertedLoopState;
- enclosingFunction = savedEnclosingFunction;
- enclosingNonArrowFunction = savedEnclosingNonArrowFunction;
- enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody;
- enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer;
- enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent;
- enclosingVariableStatement = savedEnclosingVariableStatement;
- currentParent = savedCurrentParent;
- currentNode = savedCurrentNode;
- return visited;
- }
- function shouldCheckNode(node) {
- return (node.transformFlags & 64) !== 0 ||
- node.kind === 214 ||
- (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node));
- }
- function visitorWorker(node) {
- if (shouldCheckNode(node)) {
- return visitJavaScript(node);
- }
- else if (node.transformFlags & 128) {
- return ts.visitEachChild(node, visitor, context);
- }
- else {
- return node;
- }
+ return node;
}
- function visitorForConvertedLoopWorker(node) {
- var result;
- if (shouldCheckNode(node)) {
- result = visitJavaScript(node);
- }
- else {
- result = visitNodesInConvertedLoop(node);
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (ts.isPropertyAccessExpression(node)) {
+ return substitutePropertyAccessExpression(node);
}
- return result;
- }
- function visitNodesInConvertedLoop(node) {
- switch (node.kind) {
- case 211:
- return visitReturnStatement(node);
- case 200:
- return visitVariableStatement(node);
- case 213:
- return visitSwitchStatement(node);
- case 210:
- case 209:
- return visitBreakOrContinueStatement(node);
- case 97:
- return visitThisKeyword(node);
- case 69:
- return visitIdentifier(node);
- default:
- return ts.visitEachChild(node, visitor, context);
+ else if (ts.isPropertyAssignment(node)) {
+ return substitutePropertyAssignment(node);
}
+ return node;
}
- function visitJavaScript(node) {
- switch (node.kind) {
- case 82:
- return node;
- case 221:
- return visitClassDeclaration(node);
- case 192:
- return visitClassExpression(node);
- case 142:
- return visitParameter(node);
- case 220:
- return visitFunctionDeclaration(node);
- case 180:
- return visitArrowFunction(node);
- case 179:
- return visitFunctionExpression(node);
- case 218:
- return visitVariableDeclaration(node);
- case 69:
- return visitIdentifier(node);
- case 219:
- return visitVariableDeclarationList(node);
- case 214:
- return visitLabeledStatement(node);
- case 204:
- return visitDoStatement(node);
- case 205:
- return visitWhileStatement(node);
- case 206:
- return visitForStatement(node);
- case 207:
- return visitForInStatement(node);
- case 208:
- return visitForOfStatement(node);
- case 202:
- return visitExpressionStatement(node);
- case 171:
- return visitObjectLiteralExpression(node);
- case 254:
- return visitShorthandPropertyAssignment(node);
- case 170:
- return visitArrayLiteralExpression(node);
- case 174:
- return visitCallExpression(node);
- case 175:
- return visitNewExpression(node);
- case 178:
- return visitParenthesizedExpression(node, true);
- case 187:
- return visitBinaryExpression(node, true);
- case 11:
- case 12:
- case 13:
- case 14:
- return visitTemplateLiteral(node);
- case 176:
- return visitTaggedTemplateExpression(node);
- case 189:
- return visitTemplateExpression(node);
- case 190:
- return visitYieldExpression(node);
- case 95:
- return visitSuperKeyword(node);
- case 190:
- return ts.visitEachChild(node, visitor, context);
- case 147:
- return visitMethodDeclaration(node);
- case 256:
- return visitSourceFileNode(node);
- case 200:
- return visitVariableStatement(node);
- default:
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
+ function substitutePropertyAccessExpression(node) {
+ var literalName = trySubstituteReservedName(node.name);
+ if (literalName) {
+ return ts.createElementAccess(node.expression, literalName, node);
}
+ return node;
}
- function onBeforeVisitNode(node) {
- if (currentNode) {
- if (ts.isBlockScope(currentNode, currentParent)) {
- enclosingBlockScopeContainer = currentNode;
- enclosingBlockScopeContainerParent = currentParent;
- }
- if (ts.isFunctionLike(currentNode)) {
- enclosingFunction = currentNode;
- if (currentNode.kind !== 180) {
- enclosingNonArrowFunction = currentNode;
- if (!(ts.getEmitFlags(currentNode) & 2097152)) {
- enclosingNonAsyncFunctionBody = currentNode;
- }
- }
- }
- switch (currentNode.kind) {
- case 200:
- enclosingVariableStatement = currentNode;
- break;
- case 219:
- case 218:
- case 169:
- case 167:
- case 168:
- break;
- default:
- enclosingVariableStatement = undefined;
- }
+ function substitutePropertyAssignment(node) {
+ var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name);
+ if (literalName) {
+ return ts.updatePropertyAssignment(node, literalName, node.initializer);
}
- currentParent = currentNode;
- currentNode = node;
- }
- function visitSwitchStatement(node) {
- ts.Debug.assert(convertedLoopState !== undefined);
- var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;
- convertedLoopState.allowedNonLabeledJumps |= 2;
- var result = ts.visitEachChild(node, visitor, context);
- convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps;
- return result;
- }
- function visitReturnStatement(node) {
- ts.Debug.assert(convertedLoopState !== undefined);
- convertedLoopState.nonLocalJumps |= 8;
- return ts.createReturn(ts.createObjectLiteral([
- ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression
- ? ts.visitNode(node.expression, visitor, ts.isExpression)
- : ts.createVoidZero())
- ]));
+ return node;
}
- function visitThisKeyword(node) {
- ts.Debug.assert(convertedLoopState !== undefined);
- if (enclosingFunction && enclosingFunction.kind === 180) {
- convertedLoopState.containsLexicalThis = true;
- return node;
+ function trySubstituteReservedName(name) {
+ var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined);
+ if (token >= 71 && token <= 106) {
+ return ts.createLiteral(name, name);
}
- return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this"));
+ return undefined;
}
- function visitIdentifier(node) {
- if (!convertedLoopState) {
- return node;
- }
- if (ts.isGeneratedIdentifier(node)) {
- return node;
- }
- if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) {
+ }
+ ts.transformES5 = transformES5;
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function transformModule(context) {
+ var transformModuleDelegates = ts.createMap((_a = {},
+ _a[ts.ModuleKind.None] = transformCommonJSModule,
+ _a[ts.ModuleKind.CommonJS] = transformCommonJSModule,
+ _a[ts.ModuleKind.AMD] = transformAMDModule,
+ _a[ts.ModuleKind.UMD] = transformUMDModule,
+ _a));
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var compilerOptions = context.getCompilerOptions();
+ var resolver = context.getEmitResolver();
+ var host = context.getEmitHost();
+ var languageVersion = ts.getEmitScriptTarget(compilerOptions);
+ var moduleKind = ts.getEmitModuleKind(compilerOptions);
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ var previousOnEmitNode = context.onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ context.onEmitNode = onEmitNode;
+ context.enableSubstitution(70);
+ context.enableSubstitution(188);
+ context.enableSubstitution(186);
+ context.enableSubstitution(187);
+ context.enableSubstitution(254);
+ context.enableEmitNotification(256);
+ var currentSourceFile;
+ var externalImports;
+ var exportSpecifiers;
+ var exportEquals;
+ var bindingNameExportSpecifiersMap;
+ var bindingNameExportSpecifiersForFileMap = ts.createMap();
+ var hasExportStarsToExportValues;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
return node;
}
- return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments"));
- }
- function visitBreakOrContinueStatement(node) {
- if (convertedLoopState) {
- var jump = node.kind === 210 ? 2 : 4;
- var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) ||
- (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
- if (!canUseBreakOrContinue) {
- var labelMarker = void 0;
- if (!node.label) {
- if (node.kind === 210) {
- convertedLoopState.nonLocalJumps |= 2;
- labelMarker = "break";
- }
- else {
- convertedLoopState.nonLocalJumps |= 4;
- labelMarker = "continue";
- }
- }
- else {
- if (node.kind === 210) {
- labelMarker = "break-" + node.label.text;
- setLabeledJump(convertedLoopState, true, node.label.text, labelMarker);
- }
- else {
- labelMarker = "continue-" + node.label.text;
- setLabeledJump(convertedLoopState, false, node.label.text, labelMarker);
- }
- }
- var returnExpression = ts.createLiteral(labelMarker);
- if (convertedLoopState.loopOutParameters.length) {
- var outParams = convertedLoopState.loopOutParameters;
- var expr = void 0;
- for (var i = 0; i < outParams.length; i++) {
- var copyExpr = copyOutParameter(outParams[i], 1);
- if (i === 0) {
- expr = copyExpr;
- }
- else {
- expr = ts.createBinary(expr, 24, copyExpr);
- }
- }
- returnExpression = ts.createBinary(expr, 24, returnExpression);
- }
- return ts.createReturn(returnExpression);
- }
- }
- return ts.visitEachChild(node, visitor, context);
- }
- function visitClassDeclaration(node) {
- var modifierFlags = ts.getModifierFlags(node);
- var isExported = modifierFlags & 1;
- var isDefault = modifierFlags & 512;
- var modifiers = isExported && !isDefault
- ? ts.filter(node.modifiers, isExportModifier)
- : undefined;
- var statement = ts.createVariableStatement(modifiers, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(getDeclarationName(node, true), undefined, transformClassLikeDeclarationToExpression(node))
- ]), node);
- ts.setOriginalNode(statement, node);
- ts.startOnNewLine(statement);
- if (isExported && isDefault) {
- var statements = [statement];
- statements.push(ts.createExportAssignment(undefined, undefined, false, getDeclarationName(node, false)));
- return statements;
- }
- return statement;
- }
- function isExportModifier(node) {
- return node.kind === 82;
- }
- function visitClassExpression(node) {
- return transformClassLikeDeclarationToExpression(node);
- }
- function transformClassLikeDeclarationToExpression(node) {
- if (node.name) {
- enableSubstitutionsForBlockScopedBindings();
- }
- var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node);
- var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter("_super")] : [], undefined, transformClassBody(node, extendsClauseElement));
- if (ts.getEmitFlags(node) & 524288) {
- ts.setEmitFlags(classFunction, 524288);
+ if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
+ currentSourceFile = node;
+ (_a = ts.collectExternalModuleInfo(node), externalImports = _a.externalImports, exportSpecifiers = _a.exportSpecifiers, exportEquals = _a.exportEquals, hasExportStarsToExportValues = _a.hasExportStarsToExportValues, _a);
+ var transformModule_1 = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];
+ var updated = transformModule_1(node);
+ ts.aggregateTransformFlags(updated);
+ currentSourceFile = undefined;
+ externalImports = undefined;
+ exportSpecifiers = undefined;
+ exportEquals = undefined;
+ hasExportStarsToExportValues = false;
+ return updated;
}
- var inner = ts.createPartiallyEmittedExpression(classFunction);
- inner.end = node.end;
- ts.setEmitFlags(inner, 49152);
- var outer = ts.createPartiallyEmittedExpression(inner);
- outer.end = ts.skipTrivia(currentText, node.pos);
- ts.setEmitFlags(outer, 49152);
- return ts.createParen(ts.createCall(outer, undefined, extendsClauseElement
- ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)]
- : []));
+ return node;
+ var _a;
}
- function transformClassBody(node, extendsClauseElement) {
- var statements = [];
+ function transformCommonJSModule(node) {
startLexicalEnvironment();
- addExtendsHelperIfNeeded(statements, node, extendsClauseElement);
- addConstructor(statements, node, extendsClauseElement);
- addClassMembers(statements, node);
- var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentText, node.members.end), 16);
- var localName = getLocalName(node);
- var outer = ts.createPartiallyEmittedExpression(localName);
- outer.end = closingBraceLocation.end;
- ts.setEmitFlags(outer, 49152);
- var statement = ts.createReturn(outer);
- statement.pos = closingBraceLocation.pos;
- ts.setEmitFlags(statement, 49152 | 12288);
- statements.push(statement);
+ var statements = [];
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, visitor);
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
- var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true);
- ts.setEmitFlags(block, 49152);
- return block;
- }
- function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {
- if (extendsClauseElement) {
- statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, getDeclarationName(node)), extendsClauseElement));
+ addExportEqualsIfNeeded(statements, false);
+ var updated = updateSourceFile(node, statements);
+ if (hasExportStarsToExportValues) {
+ ts.setEmitFlags(updated, 2 | ts.getEmitFlags(node));
}
+ return updated;
}
- function addConstructor(statements, node, extendsClauseElement) {
- var constructor = ts.getFirstConstructorWithBody(node);
- var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
- var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node);
- if (extendsClauseElement) {
- ts.setEmitFlags(constructorFunction, 256);
- }
- statements.push(constructorFunction);
+ function transformAMDModule(node) {
+ var define = ts.createIdentifier("define");
+ var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
+ return transformAsynchronousModule(node, define, moduleName, true);
}
- function transformConstructorParameters(constructor, hasSynthesizedSuper) {
- if (constructor && !hasSynthesizedSuper) {
- return ts.visitNodes(constructor.parameters, visitor, ts.isParameter);
- }
- return [];
+ function transformUMDModule(node) {
+ var define = ts.createIdentifier("define");
+ ts.setEmitFlags(define, 16);
+ return transformAsynchronousModule(node, define, undefined, false);
}
- function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
- var statements = [];
+ function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) {
+ var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames;
+ return updateSourceFile(node, [
+ ts.createStatement(ts.createCall(define, undefined, (moduleName ? [moduleName] : []).concat([
+ ts.createArrayLiteral([
+ ts.createLiteral("require"),
+ ts.createLiteral("exports")
+ ].concat(aliasedModuleNames, unaliasedModuleNames)),
+ ts.createFunctionExpression(undefined, undefined, undefined, undefined, [
+ ts.createParameter("require"),
+ ts.createParameter("exports")
+ ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node))
+ ])))
+ ]);
+ }
+ function transformAsynchronousModuleBody(node) {
startLexicalEnvironment();
- var statementOffset = -1;
- if (hasSynthesizedSuper) {
- statementOffset = 1;
- }
- else if (constructor) {
- statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor);
- }
- if (constructor) {
- addDefaultValueAssignmentsIfNeeded(statements, constructor);
- addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
- ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
- }
- var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
- if (superCaptureStatus === 1 || superCaptureStatus === 2) {
- statementOffset++;
- }
- if (constructor) {
- var body = saveStateAndInvoke(constructor, function (constructor) { return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset); });
- ts.addRange(statements, body);
- }
- if (extendsClauseElement
- && superCaptureStatus !== 2
- && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {
- statements.push(ts.createReturn(ts.createIdentifier("_this")));
- }
+ var statements = [];
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, visitor);
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
- var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true);
- if (!constructor) {
- ts.setEmitFlags(block, 49152);
+ addExportEqualsIfNeeded(statements, true);
+ var body = ts.createBlock(statements, undefined, true);
+ if (hasExportStarsToExportValues) {
+ ts.setEmitFlags(body, 2);
}
- return block;
+ return body;
}
- function isSufficientlyCoveredByReturnStatements(statement) {
- if (statement.kind === 211) {
- return true;
- }
- else if (statement.kind === 203) {
- var ifStatement = statement;
- if (ifStatement.elseStatement) {
- return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
- isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement);
+ function addExportEqualsIfNeeded(statements, emitAsReturn) {
+ if (exportEquals) {
+ if (emitAsReturn) {
+ var statement = ts.createReturn(exportEquals.expression, exportEquals);
+ ts.setEmitFlags(statement, 12288 | 49152);
+ statements.push(statement);
}
- }
- else if (statement.kind === 199) {
- var lastStatement = ts.lastOrUndefined(statement.statements);
- if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
- return true;
+ else {
+ var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), exportEquals.expression), exportEquals);
+ ts.setEmitFlags(statement, 49152);
+ statements.push(statement);
}
}
- return false;
}
- function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {
- if (!hasExtendsClause) {
- if (ctor) {
- addCaptureThisForNodeIfNeeded(statements, ctor);
- }
- return 0;
- }
- if (!ctor) {
- statements.push(ts.createReturn(createDefaultSuperCallOrThis()));
- return 2;
+ function visitor(node) {
+ switch (node.kind) {
+ case 231:
+ return visitImportDeclaration(node);
+ case 230:
+ return visitImportEqualsDeclaration(node);
+ case 237:
+ return visitExportDeclaration(node);
+ case 236:
+ return visitExportAssignment(node);
+ case 201:
+ return visitVariableStatement(node);
+ case 221:
+ return visitFunctionDeclaration(node);
+ case 222:
+ return visitClassDeclaration(node);
+ case 203:
+ return visitExpressionStatement(node);
+ default:
+ return node;
}
- if (hasSynthesizedSuper) {
- captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
- enableSubstitutionsForCapturedThis();
- return 1;
+ }
+ function visitImportDeclaration(node) {
+ if (!ts.contains(externalImports, node)) {
+ return undefined;
}
- var firstStatement;
- var superCallExpression;
- var ctorStatements = ctor.body.statements;
- if (statementOffset < ctorStatements.length) {
- firstStatement = ctorStatements[statementOffset];
- if (firstStatement.kind === 202 && ts.isSuperCall(firstStatement.expression)) {
- var superCall = firstStatement.expression;
- superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall);
+ var statements = [];
+ var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
+ if (moduleKind !== ts.ModuleKind.AMD) {
+ if (!node.importClause) {
+ statements.push(ts.createStatement(createRequireCall(node), node));
+ }
+ else {
+ var variables = [];
+ if (namespaceDeclaration && !ts.isDefaultImport(node)) {
+ variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, createRequireCall(node)));
+ }
+ else {
+ variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), undefined, createRequireCall(node)));
+ if (namespaceDeclaration && ts.isDefaultImport(node)) {
+ variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node)));
+ }
+ }
+ statements.push(ts.createVariableStatement(undefined, ts.createConstDeclarationList(variables), node));
}
}
- if (superCallExpression && statementOffset === ctorStatements.length - 1) {
- statements.push(ts.createReturn(superCallExpression));
- return 2;
- }
- captureThisForNode(statements, ctor, superCallExpression, firstStatement);
- if (superCallExpression) {
- return 1;
+ else if (namespaceDeclaration && ts.isDefaultImport(node)) {
+ statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node), node)
+ ])));
}
- return 0;
- }
- function createDefaultSuperCallOrThis() {
- var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128);
- var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
- return ts.createLogicalOr(superCall, actualThis);
+ addExportImportAssignments(statements, node);
+ return ts.singleOrMany(statements);
}
- function visitParameter(node) {
- if (node.dotDotDotToken) {
+ function visitImportEqualsDeclaration(node) {
+ if (!ts.contains(externalImports, node)) {
return undefined;
}
- else if (ts.isBindingPattern(node.name)) {
- return ts.setOriginalNode(ts.createParameter(ts.getGeneratedNameForNode(node), undefined, node), node);
- }
- else if (node.initializer) {
- return ts.setOriginalNode(ts.createParameter(node.name, undefined, node), node);
+ ts.setEmitFlags(node.name, 128);
+ var statements = [];
+ if (moduleKind !== ts.ModuleKind.AMD) {
+ if (ts.hasModifier(node, 1)) {
+ statements.push(ts.createStatement(createExportAssignment(node.name, createRequireCall(node)), node));
+ }
+ else {
+ statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), undefined, createRequireCall(node))
+ ], undefined, languageVersion >= 2 ? 2 : 0), node));
+ }
}
else {
- return node;
+ if (ts.hasModifier(node, 1)) {
+ statements.push(ts.createStatement(createExportAssignment(node.name, node.name), node));
+ }
}
+ addExportImportAssignments(statements, node);
+ return statements;
}
- function shouldAddDefaultValueAssignments(node) {
- return (node.transformFlags & 65536) !== 0;
- }
- function addDefaultValueAssignmentsIfNeeded(statements, node) {
- if (!shouldAddDefaultValueAssignments(node)) {
- return;
+ function visitExportDeclaration(node) {
+ if (!ts.contains(externalImports, node)) {
+ return undefined;
}
- for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
- var parameter = _a[_i];
- var name_38 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
- if (dotDotDotToken) {
- continue;
- }
- if (ts.isBindingPattern(name_38)) {
- addDefaultValueAssignmentForBindingPattern(statements, parameter, name_38, initializer);
+ var generatedName = ts.getGeneratedNameForNode(node);
+ if (node.exportClause) {
+ var statements = [];
+ if (moduleKind !== ts.ModuleKind.AMD) {
+ statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(generatedName, undefined, createRequireCall(node))
+ ]), node));
}
- else if (initializer) {
- addDefaultValueAssignmentForInitializer(statements, parameter, name_38, initializer);
+ for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) {
+ var specifier = _a[_i];
+ var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name);
+ statements.push(ts.createStatement(createExportAssignment(specifier.name, exportedValue), specifier));
}
+ return ts.singleOrMany(statements);
}
- }
- function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {
- var temp = ts.getGeneratedNameForNode(parameter);
- if (name.elements.length > 0) {
- statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenParameterDestructuring(context, parameter, temp, visitor))), 8388608));
- }
- else if (initializer) {
- statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608));
- }
- }
- function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {
- initializer = ts.visitNode(initializer, visitor, ts.isExpression);
- var statement = ts.createIf(ts.createStrictEquality(ts.getSynthesizedClone(name), ts.createVoidZero()), ts.setEmitFlags(ts.createBlock([
- ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 1536), ts.setEmitFlags(initializer, 1536 | ts.getEmitFlags(initializer)), parameter))
- ], parameter), 32 | 1024 | 12288), undefined, parameter);
- statement.startsOnNewLine = true;
- ts.setEmitFlags(statement, 12288 | 1024 | 8388608);
- statements.push(statement);
- }
- function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
- return node && node.dotDotDotToken && node.name.kind === 69 && !inConstructorWithSynthesizedSuper;
- }
- function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
- var parameter = ts.lastOrUndefined(node.parameters);
- if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
- return;
+ else {
+ return ts.createStatement(ts.createCall(ts.createIdentifier("__export"), undefined, [
+ moduleKind !== ts.ModuleKind.AMD
+ ? createRequireCall(node)
+ : generatedName
+ ]), node);
}
- var declarationName = ts.getMutableClone(parameter.name);
- ts.setEmitFlags(declarationName, 1536);
- var expressionName = ts.getSynthesizedClone(parameter.name);
- var restIndex = node.parameters.length - 1;
- var temp = ts.createLoopVariable();
- statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([]))
- ]), parameter), 8388608));
- var forStatement = ts.createFor(ts.createVariableDeclarationList([
- ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex))
- ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([
- ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), parameter))
- ]));
- ts.setEmitFlags(forStatement, 8388608);
- ts.startOnNewLine(forStatement);
- statements.push(forStatement);
}
- function addCaptureThisForNodeIfNeeded(statements, node) {
- if (node.transformFlags & 16384 && node.kind !== 180) {
- captureThisForNode(statements, node, ts.createThis());
+ function visitExportAssignment(node) {
+ if (node.isExportEquals) {
+ return undefined;
}
+ var statements = [];
+ addExportDefault(statements, node.expression, node);
+ return statements;
}
- function captureThisForNode(statements, node, initializer, originalStatement) {
- enableSubstitutionsForCapturedThis();
- var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration("_this", undefined, initializer)
- ]), originalStatement);
- ts.setEmitFlags(captureThisStatement, 49152 | 8388608);
- ts.setSourceMapRange(captureThisStatement, node);
- statements.push(captureThisStatement);
+ function addExportDefault(statements, expression, location) {
+ tryAddExportDefaultCompat(statements);
+ statements.push(ts.createStatement(createExportAssignment(ts.createIdentifier("default"), expression), location));
}
- function addClassMembers(statements, node) {
- for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
- var member = _a[_i];
- switch (member.kind) {
- case 198:
- statements.push(transformSemicolonClassElementToStatement(member));
- break;
- case 147:
- statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member));
- break;
- case 149:
- case 150:
- var accessors = ts.getAllAccessorDeclarations(node.members, member);
- if (member === accessors.firstAccessor) {
- statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors));
- }
- break;
- case 148:
- break;
- default:
- ts.Debug.failBadSyntaxKind(node);
- break;
+ function tryAddExportDefaultCompat(statements) {
+ var original = ts.getOriginalNode(currentSourceFile);
+ ts.Debug.assert(original.kind === 256);
+ if (!original.symbol.exports["___esModule"]) {
+ if (languageVersion === 0) {
+ statements.push(ts.createStatement(createExportAssignment(ts.createIdentifier("__esModule"), ts.createLiteral(true))));
+ }
+ else {
+ statements.push(ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [
+ ts.createIdentifier("exports"),
+ ts.createLiteral("__esModule"),
+ ts.createObjectLiteral([
+ ts.createPropertyAssignment("value", ts.createLiteral(true))
+ ])
+ ])));
}
}
}
- function transformSemicolonClassElementToStatement(member) {
- return ts.createEmptyStatement(member);
- }
- function transformClassMethodDeclarationToStatement(receiver, member) {
- var commentRange = ts.getCommentRange(member);
- var sourceMapRange = ts.getSourceMapRange(member);
- var func = transformFunctionLikeToExpression(member, member, undefined);
- ts.setEmitFlags(func, 49152);
- ts.setSourceMapRange(func, sourceMapRange);
- var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name), func), member);
- ts.setOriginalNode(statement, member);
- ts.setCommentRange(statement, commentRange);
- ts.setEmitFlags(statement, 1536);
- return statement;
- }
- function transformAccessorsToStatement(receiver, accessors) {
- var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor));
- ts.setEmitFlags(statement, 49152);
- return statement;
- }
- function transformAccessorsToExpression(receiver, _a, startsOnNewLine) {
- var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
- var target = ts.getMutableClone(receiver);
- ts.setEmitFlags(target, 49152 | 1024);
- ts.setSourceMapRange(target, firstAccessor.name);
- var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
- ts.setEmitFlags(propertyName, 49152 | 512);
- ts.setSourceMapRange(propertyName, firstAccessor.name);
- var properties = [];
- if (getAccessor) {
- var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined);
- ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));
- var getter = ts.createPropertyAssignment("get", getterFunction);
- ts.setCommentRange(getter, ts.getCommentRange(getAccessor));
- properties.push(getter);
- }
- if (setAccessor) {
- var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined);
- ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));
- var setter = ts.createPropertyAssignment("set", setterFunction);
- ts.setCommentRange(setter, ts.getCommentRange(setAccessor));
- properties.push(setter);
+ function addExportImportAssignments(statements, node) {
+ if (ts.isImportEqualsDeclaration(node)) {
+ addExportMemberAssignments(statements, node.name);
}
- properties.push(ts.createPropertyAssignment("enumerable", ts.createLiteral(true)), ts.createPropertyAssignment("configurable", ts.createLiteral(true)));
- var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [
- target,
- propertyName,
- ts.createObjectLiteral(properties, undefined, true)
- ]);
- if (startsOnNewLine) {
- call.startsOnNewLine = true;
+ else {
+ var names = ts.reduceEachChild(node, collectExportMembers, []);
+ for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
+ var name_35 = names_1[_i];
+ addExportMemberAssignments(statements, name_35);
+ }
}
- return call;
}
- function visitArrowFunction(node) {
- if (node.transformFlags & 8192) {
- enableSubstitutionsForCapturedThis();
+ function collectExportMembers(names, node) {
+ if (ts.isAliasSymbolDeclaration(node) && ts.isDeclaration(node)) {
+ var name_36 = node.name;
+ if (ts.isIdentifier(name_36)) {
+ names.push(name_36);
+ }
}
- var func = transformFunctionLikeToExpression(node, node, undefined);
- ts.setEmitFlags(func, 256);
- return func;
- }
- function visitFunctionExpression(node) {
- return transformFunctionLikeToExpression(node, node, node.name);
- }
- function visitFunctionDeclaration(node) {
- return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node), node);
+ return ts.reduceEachChild(node, collectExportMembers, names);
}
- function transformFunctionLikeToExpression(node, location, name) {
- var savedContainingNonArrowFunction = enclosingNonArrowFunction;
- if (node.kind !== 180) {
- enclosingNonArrowFunction = node;
+ function addExportMemberAssignments(statements, name) {
+ if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) {
+ for (var _i = 0, _a = exportSpecifiers[name.text]; _i < _a.length; _i++) {
+ var specifier = _a[_i];
+ statements.push(ts.startOnNewLine(ts.createStatement(createExportAssignment(specifier.name, name), specifier.name)));
+ }
}
- var expression = ts.setOriginalNode(ts.createFunctionExpression(node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node);
- enclosingNonArrowFunction = savedContainingNonArrowFunction;
- return expression;
}
- function transformFunctionBody(node) {
- var multiLine = false;
- var singleLine = false;
- var statementsLocation;
- var closeBraceLocation;
- var statements = [];
- var body = node.body;
- var statementOffset;
- startLexicalEnvironment();
- if (ts.isBlock(body)) {
- statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);
+ function addExportMemberAssignment(statements, node) {
+ if (ts.hasModifier(node, 512)) {
+ addExportDefault(statements, getDeclarationName(node), node);
}
- addCaptureThisForNodeIfNeeded(statements, node);
- addDefaultValueAssignmentsIfNeeded(statements, node);
- addRestParameterIfNeeded(statements, node, false);
- if (!multiLine && statements.length > 0) {
- multiLine = true;
+ else {
+ statements.push(createExportStatement(node.name, ts.setEmitFlags(ts.getSynthesizedClone(node.name), 262144), node));
}
- if (ts.isBlock(body)) {
- statementsLocation = body.statements;
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
- if (!multiLine && body.multiLine) {
- multiLine = true;
+ }
+ function visitVariableStatement(node) {
+ var originalKind = ts.getOriginalNode(node).kind;
+ if (originalKind === 226 ||
+ originalKind === 225 ||
+ originalKind === 222) {
+ if (!ts.hasModifier(node, 1)) {
+ return node;
}
+ return ts.setOriginalNode(ts.createVariableStatement(undefined, node.declarationList), node);
}
- else {
- ts.Debug.assert(node.kind === 180);
- statementsLocation = ts.moveRangeEnd(body, -1);
- var equalsGreaterThanToken = node.equalsGreaterThanToken;
- if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
- if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
- singleLine = true;
- }
- else {
- multiLine = true;
- }
+ var resultStatements = [];
+ if (ts.hasModifier(node, 1)) {
+ var variables = ts.getInitializedVariables(node.declarationList);
+ if (variables.length > 0) {
+ var inlineAssignments = ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), node);
+ resultStatements.push(inlineAssignments);
}
- var expression = ts.visitNode(body, visitor, ts.isExpression);
- var returnStatement = ts.createReturn(expression, body);
- ts.setEmitFlags(returnStatement, 12288 | 1024 | 32768);
- statements.push(returnStatement);
- closeBraceLocation = body;
- }
- var lexicalEnvironment = endLexicalEnvironment();
- ts.addRange(statements, lexicalEnvironment);
- if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
- multiLine = true;
- }
- var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine);
- if (!multiLine && singleLine) {
- ts.setEmitFlags(block, 32);
- }
- if (closeBraceLocation) {
- ts.setTokenSourceMapRange(block, 16, closeBraceLocation);
}
- ts.setOriginalNode(block, node.body);
- return block;
- }
- function visitExpressionStatement(node) {
- switch (node.expression.kind) {
- case 178:
- return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false));
- case 187:
- return ts.updateStatement(node, visitBinaryExpression(node.expression, false));
+ else {
+ resultStatements.push(node);
}
- return ts.visitEachChild(node, visitor, context);
- }
- function visitParenthesizedExpression(node, needsDestructuringValue) {
- if (needsDestructuringValue) {
- switch (node.expression.kind) {
- case 178:
- return ts.createParen(visitParenthesizedExpression(node.expression, true), node);
- case 187:
- return ts.createParen(visitBinaryExpression(node.expression, true), node);
- }
+ for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
+ var decl = _a[_i];
+ addExportMemberAssignmentsForBindingName(resultStatements, decl.name);
}
- return ts.visitEachChild(node, visitor, context);
- }
- function visitBinaryExpression(node, needsDestructuringValue) {
- ts.Debug.assert(ts.isDestructuringAssignment(node));
- return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor);
+ return resultStatements;
}
- function visitVariableStatement(node) {
- if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) {
- var assignments = void 0;
- for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
- var decl = _a[_i];
- hoistVariableDeclarationDeclaredInConvertedLoop(convertedLoopState, decl);
- if (decl.initializer) {
- var assignment = void 0;
- if (ts.isBindingPattern(decl.name)) {
- assignment = ts.flattenVariableDestructuringToExpression(context, decl, hoistVariableDeclaration, undefined, visitor);
- }
- else {
- assignment = ts.createBinary(decl.name, 56, ts.visitNode(decl.initializer, visitor, ts.isExpression));
- }
- (assignments || (assignments = [])).push(assignment);
+ function addExportMemberAssignmentsForBindingName(resultStatements, name) {
+ if (ts.isBindingPattern(name)) {
+ for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!ts.isOmittedExpression(element)) {
+ addExportMemberAssignmentsForBindingName(resultStatements, element.name);
}
}
- if (assignments) {
- return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 24, acc); }), node);
- }
- else {
- return undefined;
- }
- }
- return ts.visitEachChild(node, visitor, context);
- }
- function visitVariableDeclarationList(node) {
- if (node.flags & 3) {
- enableSubstitutionsForBlockScopedBindings();
}
- var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1
- ? visitVariableDeclarationInLetDeclarationList
- : visitVariableDeclaration));
- var declarationList = ts.createVariableDeclarationList(declarations, node);
- ts.setOriginalNode(declarationList, node);
- ts.setCommentRange(declarationList, node);
- if (node.transformFlags & 2097152
- && (ts.isBindingPattern(node.declarations[0].name)
- || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {
- var firstDeclaration = ts.firstOrUndefined(declarations);
- var lastDeclaration = ts.lastOrUndefined(declarations);
- ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
+ else {
+ if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) {
+ var sourceFileId = ts.getOriginalNodeId(currentSourceFile);
+ if (!bindingNameExportSpecifiersForFileMap[sourceFileId]) {
+ bindingNameExportSpecifiersForFileMap[sourceFileId] = ts.createMap();
+ }
+ bindingNameExportSpecifiersForFileMap[sourceFileId][name.text] = exportSpecifiers[name.text];
+ addExportMemberAssignments(resultStatements, name);
+ }
}
- return declarationList;
- }
- function shouldEmitExplicitInitializerForLetDeclaration(node) {
- var flags = resolver.getNodeCheckFlags(node);
- var isCapturedInFunction = flags & 131072;
- var isDeclaredInLoop = flags & 262144;
- var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer)
- || (isCapturedInFunction
- && isDeclaredInLoop
- && ts.isBlock(enclosingBlockScopeContainer)
- && ts.isIterationStatement(enclosingBlockScopeContainerParent, false));
- var emitExplicitInitializer = !emittedAsTopLevel
- && enclosingBlockScopeContainer.kind !== 207
- && enclosingBlockScopeContainer.kind !== 208
- && (!resolver.isDeclarationWithCollidingName(node)
- || (isDeclaredInLoop
- && !isCapturedInFunction
- && !ts.isIterationStatement(enclosingBlockScopeContainer, false)));
- return emitExplicitInitializer;
}
- function visitVariableDeclarationInLetDeclarationList(node) {
+ function transformInitializedVariable(node) {
var name = node.name;
if (ts.isBindingPattern(name)) {
- return visitVariableDeclaration(node);
+ return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, getModuleMemberName, visitor);
}
- if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {
- var clone_8 = ts.getMutableClone(node);
- clone_8.initializer = ts.createVoidZero();
- return clone_8;
+ else {
+ return ts.createAssignment(getModuleMemberName(name), ts.visitNode(node.initializer, visitor, ts.isExpression));
}
- return ts.visitEachChild(node, visitor, context);
}
- function visitVariableDeclaration(node) {
- if (ts.isBindingPattern(node.name)) {
- var recordTempVariablesInLine = !enclosingVariableStatement
- || !ts.hasModifier(enclosingVariableStatement, 1);
- return ts.flattenVariableDestructuring(context, node, undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration);
+ function visitFunctionDeclaration(node) {
+ var statements = [];
+ var name = node.name || ts.getGeneratedNameForNode(node);
+ if (ts.hasModifier(node, 1)) {
+ var isAsync = ts.hasModifier(node, 256);
+ statements.push(ts.setOriginalNode(ts.createFunctionDeclaration(undefined, isAsync ? [ts.createNode(119)] : undefined, node.asteriskToken, name, undefined, node.parameters, undefined, node.body, node), node));
+ addExportMemberAssignment(statements, node);
}
- return ts.visitEachChild(node, visitor, context);
- }
- function visitLabeledStatement(node) {
- if (convertedLoopState) {
- if (!convertedLoopState.labels) {
- convertedLoopState.labels = ts.createMap();
- }
- convertedLoopState.labels[node.label.text] = node.label.text;
+ else {
+ statements.push(node);
}
- var result;
- if (ts.isIterationStatement(node.statement, false) && shouldConvertIterationStatementBody(node.statement)) {
- result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement);
+ if (node.name) {
+ addExportMemberAssignments(statements, node.name);
+ }
+ return ts.singleOrMany(statements);
+ }
+ function visitClassDeclaration(node) {
+ var statements = [];
+ var name = node.name || ts.getGeneratedNameForNode(node);
+ if (ts.hasModifier(node, 1)) {
+ statements.push(ts.setOriginalNode(ts.createClassDeclaration(undefined, undefined, name, undefined, node.heritageClauses, node.members, node), node));
+ addExportMemberAssignment(statements, node);
}
else {
- result = ts.visitEachChild(node, visitor, context);
+ statements.push(node);
}
- if (convertedLoopState) {
- convertedLoopState.labels[node.label.text] = undefined;
+ if (node.name && !(node.decorators && node.decorators.length)) {
+ addExportMemberAssignments(statements, node.name);
}
- return result;
- }
- function visitDoStatement(node) {
- return convertIterationStatementBodyIfNecessary(node);
+ return ts.singleOrMany(statements);
}
- function visitWhileStatement(node) {
- return convertIterationStatementBodyIfNecessary(node);
+ function visitExpressionStatement(node) {
+ var original = ts.getOriginalNode(node);
+ var origKind = original.kind;
+ if (origKind === 225 || origKind === 226) {
+ return visitExpressionStatementForEnumOrNamespaceDeclaration(node, original);
+ }
+ else if (origKind === 222) {
+ var classDecl = original;
+ if (classDecl.name) {
+ var statements = [node];
+ addExportMemberAssignments(statements, classDecl.name);
+ return statements;
+ }
+ }
+ return node;
}
- function visitForStatement(node) {
- return convertIterationStatementBodyIfNecessary(node);
+ function visitExpressionStatementForEnumOrNamespaceDeclaration(node, original) {
+ var statements = [node];
+ if (ts.hasModifier(original, 1) &&
+ original.kind === 225 &&
+ ts.isFirstDeclarationOfKind(original, 225)) {
+ addVarForExportedEnumOrNamespaceDeclaration(statements, original);
+ }
+ addExportMemberAssignments(statements, original.name);
+ return statements;
}
- function visitForInStatement(node) {
- return convertIterationStatementBodyIfNecessary(node);
+ function addVarForExportedEnumOrNamespaceDeclaration(statements, node) {
+ var transformedStatement = ts.createVariableStatement(undefined, [ts.createVariableDeclaration(getDeclarationName(node), undefined, ts.createPropertyAccess(ts.createIdentifier("exports"), getDeclarationName(node)))], node);
+ ts.setEmitFlags(transformedStatement, 49152);
+ statements.push(transformedStatement);
}
- function visitForOfStatement(node) {
- return convertIterationStatementBodyIfNecessary(node, convertForOfToFor);
+ function getDeclarationName(node) {
+ return node.name ? ts.getSynthesizedClone(node.name) : ts.getGeneratedNameForNode(node);
}
- function convertForOfToFor(node, convertedLoopBodyStatements) {
- var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
- var initializer = node.initializer;
- var statements = [];
- var counter = ts.createLoopVariable();
- var rhsReference = expression.kind === 69
- ? ts.createUniqueName(expression.text)
- : ts.createTempVariable(undefined);
- if (ts.isVariableDeclarationList(initializer)) {
- if (initializer.flags & 3) {
- enableSubstitutionsForBlockScopedBindings();
- }
- var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
- if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
- var declarations = ts.flattenVariableDestructuring(context, firstOriginalDeclaration, ts.createElementAccess(rhsReference, counter), visitor);
- var declarationList = ts.createVariableDeclarationList(declarations, initializer);
- ts.setOriginalNode(declarationList, initializer);
- var firstDeclaration = declarations[0];
- var lastDeclaration = ts.lastOrUndefined(declarations);
- ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
- statements.push(ts.createVariableStatement(undefined, declarationList));
- }
- else {
- statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter))
- ], ts.moveRangePos(initializer, -1)), ts.moveRangeEnd(initializer, -1)));
- }
+ function onEmitNode(emitContext, node, emitCallback) {
+ if (node.kind === 256) {
+ bindingNameExportSpecifiersMap = bindingNameExportSpecifiersForFileMap[ts.getOriginalNodeId(node)];
+ previousOnEmitNode(emitContext, node, emitCallback);
+ bindingNameExportSpecifiersMap = undefined;
}
else {
- var assignment = ts.createAssignment(initializer, ts.createElementAccess(rhsReference, counter));
- if (ts.isDestructuringAssignment(assignment)) {
- statements.push(ts.createStatement(ts.flattenDestructuringAssignment(context, assignment, false, hoistVariableDeclaration, visitor)));
- }
- else {
- assignment.end = initializer.end;
- statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1)));
- }
+ previousOnEmitNode(emitContext, node, emitCallback);
}
- var bodyLocation;
- var statementsLocation;
- if (convertedLoopBodyStatements) {
- ts.addRange(statements, convertedLoopBodyStatements);
+ }
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (emitContext === 1) {
+ return substituteExpression(node);
}
- else {
- var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
- if (ts.isBlock(statement)) {
- ts.addRange(statements, statement.statements);
- bodyLocation = statement;
- statementsLocation = statement.statements;
- }
- else {
- statements.push(statement);
- }
+ else if (ts.isShorthandPropertyAssignment(node)) {
+ return substituteShorthandPropertyAssignment(node);
}
- ts.setEmitFlags(expression, 1536 | ts.getEmitFlags(expression));
- var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation);
- ts.setEmitFlags(body, 1536 | 12288);
- var forStatement = ts.createFor(ts.createVariableDeclarationList([
- ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)),
- ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression)
- ], node.expression), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node);
- ts.setEmitFlags(forStatement, 8192);
- return forStatement;
+ return node;
}
- function visitObjectLiteralExpression(node) {
- var properties = node.properties;
- var numProperties = properties.length;
- var numInitialProperties = numProperties;
- for (var i = 0; i < numProperties; i++) {
- var property = properties[i];
- if (property.transformFlags & 4194304
- || property.name.kind === 140) {
- numInitialProperties = i;
- break;
+ function substituteShorthandPropertyAssignment(node) {
+ var name = node.name;
+ var exportedOrImportedName = substituteExpressionIdentifier(name);
+ if (exportedOrImportedName !== name) {
+ if (node.objectAssignmentInitializer) {
+ var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer);
+ return ts.createPropertyAssignment(name, initializer, node);
}
+ return ts.createPropertyAssignment(name, exportedOrImportedName, node);
}
- ts.Debug.assert(numInitialProperties !== numProperties);
- var temp = ts.createTempVariable(hoistVariableDeclaration);
- var expressions = [];
- var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 524288));
- if (node.multiLine) {
- assignment.startsOnNewLine = true;
+ return node;
+ }
+ function substituteExpression(node) {
+ switch (node.kind) {
+ case 70:
+ return substituteExpressionIdentifier(node);
+ case 188:
+ return substituteBinaryExpression(node);
+ case 187:
+ case 186:
+ return substituteUnaryExpression(node);
}
- expressions.push(assignment);
- addObjectLiteralMembers(expressions, node, temp, numInitialProperties);
- expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp);
- return ts.inlineExpressions(expressions);
+ return node;
}
- function shouldConvertIterationStatementBody(node) {
- return (resolver.getNodeCheckFlags(node) & 65536) !== 0;
+ function substituteExpressionIdentifier(node) {
+ return trySubstituteExportedName(node)
+ || trySubstituteImportedName(node)
+ || node;
}
- function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {
- if (!state.hoistedLocalVariables) {
- state.hoistedLocalVariables = [];
- }
- visit(node.name);
- function visit(node) {
- if (node.kind === 69) {
- state.hoistedLocalVariables.push(node);
- }
- else {
- for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
- var element = _a[_i];
- if (!ts.isOmittedExpression(element)) {
- visit(element.name);
- }
+ function substituteBinaryExpression(node) {
+ var left = node.left;
+ if (ts.isIdentifier(left) && ts.isAssignmentOperator(node.operatorToken.kind)) {
+ if (bindingNameExportSpecifiersMap && ts.hasProperty(bindingNameExportSpecifiersMap, left.text)) {
+ ts.setEmitFlags(node, 128);
+ var nestedExportAssignment = void 0;
+ for (var _i = 0, _a = bindingNameExportSpecifiersMap[left.text]; _i < _a.length; _i++) {
+ var specifier = _a[_i];
+ nestedExportAssignment = nestedExportAssignment ?
+ createExportAssignment(specifier.name, nestedExportAssignment) :
+ createExportAssignment(specifier.name, node);
}
+ return nestedExportAssignment;
}
}
+ return node;
}
- function convertIterationStatementBodyIfNecessary(node, convert) {
- if (!shouldConvertIterationStatementBody(node)) {
- var saveAllowedNonLabeledJumps = void 0;
- if (convertedLoopState) {
- saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;
- convertedLoopState.allowedNonLabeledJumps = 2 | 4;
- }
- var result = convert ? convert(node, undefined) : ts.visitEachChild(node, visitor, context);
- if (convertedLoopState) {
- convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;
+ function substituteUnaryExpression(node) {
+ var operator = node.operator;
+ var operand = node.operand;
+ if (ts.isIdentifier(operand) && bindingNameExportSpecifiersForFileMap) {
+ if (bindingNameExportSpecifiersMap && ts.hasProperty(bindingNameExportSpecifiersMap, operand.text)) {
+ ts.setEmitFlags(node, 128);
+ var transformedUnaryExpression = void 0;
+ if (node.kind === 187) {
+ transformedUnaryExpression = ts.createBinary(operand, ts.createToken(operator === 42 ? 58 : 59), ts.createLiteral(1), node);
+ ts.setEmitFlags(transformedUnaryExpression, 128);
+ }
+ var nestedExportAssignment = void 0;
+ for (var _i = 0, _a = bindingNameExportSpecifiersMap[operand.text]; _i < _a.length; _i++) {
+ var specifier = _a[_i];
+ nestedExportAssignment = nestedExportAssignment ?
+ createExportAssignment(specifier.name, nestedExportAssignment) :
+ createExportAssignment(specifier.name, transformedUnaryExpression || node);
+ }
+ return nestedExportAssignment;
}
- return result;
}
- var functionName = ts.createUniqueName("_loop");
- var loopInitializer;
- switch (node.kind) {
- case 206:
- case 207:
- case 208:
- var initializer = node.initializer;
- if (initializer && initializer.kind === 219) {
- loopInitializer = initializer;
+ return node;
+ }
+ function trySubstituteExportedName(node) {
+ var emitFlags = ts.getEmitFlags(node);
+ if ((emitFlags & 262144) === 0) {
+ var container = resolver.getReferencedExportContainer(node, (emitFlags & 131072) !== 0);
+ if (container) {
+ if (container.kind === 256) {
+ return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), node);
}
- break;
- }
- var loopParameters = [];
- var loopOutParameters = [];
- if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3)) {
- for (var _i = 0, _a = loopInitializer.declarations; _i < _a.length; _i++) {
- var decl = _a[_i];
- processLoopVariableDeclaration(decl, loopParameters, loopOutParameters);
}
}
- var outerConvertedLoopState = convertedLoopState;
- convertedLoopState = { loopOutParameters: loopOutParameters };
- if (outerConvertedLoopState) {
- if (outerConvertedLoopState.argumentsName) {
- convertedLoopState.argumentsName = outerConvertedLoopState.argumentsName;
- }
- if (outerConvertedLoopState.thisName) {
- convertedLoopState.thisName = outerConvertedLoopState.thisName;
- }
- if (outerConvertedLoopState.hoistedLocalVariables) {
- convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables;
+ return undefined;
+ }
+ function trySubstituteImportedName(node) {
+ if ((ts.getEmitFlags(node) & 262144) === 0) {
+ var declaration = resolver.getReferencedImportDeclaration(node);
+ if (declaration) {
+ if (ts.isImportClause(declaration)) {
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(declaration.parent), ts.createIdentifier("default"), node);
+ }
+ else if (ts.isImportSpecifier(declaration)) {
+ var name_37 = declaration.propertyName || declaration.name;
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(declaration.parent.parent.parent), ts.getSynthesizedClone(name_37), node);
+ }
}
}
- var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement);
- var currentState = convertedLoopState;
- convertedLoopState = outerConvertedLoopState;
- if (loopOutParameters.length) {
- var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
- copyOutParameters(loopOutParameters, 1, statements_3);
- loopBody = ts.createBlock(statements_3, undefined, true);
- }
- if (!ts.isBlock(loopBody)) {
- loopBody = ts.createBlock([loopBody], undefined, true);
- }
- var isAsyncBlockContainingAwait = enclosingNonArrowFunction
- && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152) !== 0
- && (node.statement.transformFlags & 4194304) !== 0;
- var loopBodyFlags = 0;
- if (currentState.containsLexicalThis) {
- loopBodyFlags |= 256;
- }
- if (isAsyncBlockContainingAwait) {
- loopBodyFlags |= 2097152;
+ return undefined;
+ }
+ function getModuleMemberName(name) {
+ return ts.createPropertyAccess(ts.createIdentifier("exports"), name, name);
+ }
+ function createRequireCall(importNode) {
+ var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);
+ var args = [];
+ if (ts.isDefined(moduleName)) {
+ args.push(moduleName);
}
- var convertedLoopVariable = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(isAsyncBlockContainingAwait ? ts.createToken(37) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags))
- ]));
- var statements = [convertedLoopVariable];
- var extraVariableDeclarations;
- if (currentState.argumentsName) {
- if (outerConvertedLoopState) {
- outerConvertedLoopState.argumentsName = currentState.argumentsName;
- }
- else {
- (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.argumentsName, undefined, ts.createIdentifier("arguments")));
- }
+ return ts.createCall(ts.createIdentifier("require"), undefined, args);
+ }
+ function createExportStatement(name, value, location) {
+ var statement = ts.createStatement(createExportAssignment(name, value));
+ statement.startsOnNewLine = true;
+ if (location) {
+ ts.setSourceMapRange(statement, location);
}
- if (currentState.thisName) {
- if (outerConvertedLoopState) {
- outerConvertedLoopState.thisName = currentState.thisName;
+ return statement;
+ }
+ function createExportAssignment(name, value) {
+ return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value);
+ }
+ function collectAsynchronousDependencies(node, includeNonAmdDependencies) {
+ var aliasedModuleNames = [];
+ var unaliasedModuleNames = [];
+ var importAliasNames = [];
+ for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) {
+ var amdDependency = _a[_i];
+ if (amdDependency.name) {
+ aliasedModuleNames.push(ts.createLiteral(amdDependency.path));
+ importAliasNames.push(ts.createParameter(amdDependency.name));
}
else {
- (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.thisName, undefined, ts.createIdentifier("this")));
+ unaliasedModuleNames.push(ts.createLiteral(amdDependency.path));
}
}
- if (currentState.hoistedLocalVariables) {
- if (outerConvertedLoopState) {
- outerConvertedLoopState.hoistedLocalVariables = currentState.hoistedLocalVariables;
+ for (var _b = 0, externalImports_1 = externalImports; _b < externalImports_1.length; _b++) {
+ var importNode = externalImports_1[_b];
+ var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);
+ var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile);
+ if (includeNonAmdDependencies && importAliasName) {
+ ts.setEmitFlags(importAliasName, 128);
+ aliasedModuleNames.push(externalModuleName);
+ importAliasNames.push(ts.createParameter(importAliasName));
}
else {
- if (!extraVariableDeclarations) {
- extraVariableDeclarations = [];
- }
- for (var _b = 0, _c = currentState.hoistedLocalVariables; _b < _c.length; _b++) {
- var identifier = _c[_b];
- extraVariableDeclarations.push(ts.createVariableDeclaration(identifier));
- }
- }
- }
- if (loopOutParameters.length) {
- if (!extraVariableDeclarations) {
- extraVariableDeclarations = [];
- }
- for (var _d = 0, loopOutParameters_1 = loopOutParameters; _d < loopOutParameters_1.length; _d++) {
- var outParam = loopOutParameters_1[_d];
- extraVariableDeclarations.push(ts.createVariableDeclaration(outParam.outParamName));
+ unaliasedModuleNames.push(externalModuleName);
}
}
- if (extraVariableDeclarations) {
- statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(extraVariableDeclarations)));
- }
- var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait);
- var loop;
- if (convert) {
- loop = convert(node, convertedLoopBodyStatements);
+ return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames };
+ }
+ function updateSourceFile(node, statements) {
+ var updated = ts.getMutableClone(node);
+ updated.statements = ts.createNodeArray(statements, node.statements);
+ return updated;
+ }
+ var _a;
+ }
+ ts.transformModule = transformModule;
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function transformSystemModule(context) {
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration, hoistFunctionDeclaration = context.hoistFunctionDeclaration;
+ var compilerOptions = context.getCompilerOptions();
+ var resolver = context.getEmitResolver();
+ var host = context.getEmitHost();
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ var previousOnEmitNode = context.onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ context.onEmitNode = onEmitNode;
+ context.enableSubstitution(70);
+ context.enableSubstitution(188);
+ context.enableSubstitution(186);
+ context.enableSubstitution(187);
+ context.enableEmitNotification(256);
+ var exportFunctionForFileMap = [];
+ var currentSourceFile;
+ var externalImports;
+ var exportSpecifiers;
+ var exportEquals;
+ var hasExportStarsToExportValues;
+ var exportFunctionForFile;
+ var contextObjectForFile;
+ var exportedLocalNames;
+ var exportedFunctionDeclarations;
+ var enclosingBlockScopedContainer;
+ var currentParent;
+ var currentNode;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
}
- else {
- loop = ts.getMutableClone(node);
- loop.statement = undefined;
- loop = ts.visitEachChild(loop, visitor, context);
- loop.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true);
- loop.transformFlags = 0;
- ts.aggregateTransformFlags(loop);
+ if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
+ currentSourceFile = node;
+ currentNode = node;
+ var updated = transformSystemModuleWorker(node);
+ ts.aggregateTransformFlags(updated);
+ currentSourceFile = undefined;
+ externalImports = undefined;
+ exportSpecifiers = undefined;
+ exportEquals = undefined;
+ hasExportStarsToExportValues = false;
+ exportFunctionForFile = undefined;
+ contextObjectForFile = undefined;
+ exportedLocalNames = undefined;
+ exportedFunctionDeclarations = undefined;
+ return updated;
}
- statements.push(currentParent.kind === 214
- ? ts.createLabel(currentParent.label, loop)
- : loop);
- return statements;
+ return node;
}
- function copyOutParameter(outParam, copyDirection) {
- var source = copyDirection === 0 ? outParam.outParamName : outParam.originalName;
- var target = copyDirection === 0 ? outParam.originalName : outParam.outParamName;
- return ts.createBinary(target, 56, source);
+ function transformSystemModuleWorker(node) {
+ ts.Debug.assert(!exportFunctionForFile);
+ (_a = ts.collectExternalModuleInfo(node), externalImports = _a.externalImports, exportSpecifiers = _a.exportSpecifiers, exportEquals = _a.exportEquals, hasExportStarsToExportValues = _a.hasExportStarsToExportValues, _a);
+ exportFunctionForFile = ts.createUniqueName("exports");
+ contextObjectForFile = ts.createUniqueName("context");
+ exportFunctionForFileMap[ts.getOriginalNodeId(node)] = exportFunctionForFile;
+ var dependencyGroups = collectDependencyGroups(externalImports);
+ var statements = [];
+ addSystemModuleBody(statements, node, dependencyGroups);
+ var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
+ var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, getNameOfDependencyGroup));
+ var body = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [
+ ts.createParameter(exportFunctionForFile),
+ ts.createParameter(contextObjectForFile)
+ ], undefined, ts.setEmitFlags(ts.createBlock(statements, undefined, true), 1));
+ return updateSourceFile(node, [
+ ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), undefined, moduleName
+ ? [moduleName, dependencies, body]
+ : [dependencies, body]))
+ ], ~1 & ts.getEmitFlags(node));
+ var _a;
}
- function copyOutParameters(outParams, copyDirection, statements) {
- for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {
- var outParam = outParams_1[_i];
- statements.push(ts.createStatement(copyOutParameter(outParam, copyDirection)));
- }
+ function addSystemModuleBody(statements, node, dependencyGroups) {
+ startLexicalEnvironment();
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, visitSourceElement);
+ statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObjectForFile, ts.createPropertyAccess(contextObjectForFile, "id")))
+ ])));
+ var executeStatements = ts.visitNodes(node.statements, visitSourceElement, ts.isStatement, statementOffset);
+ ts.addRange(statements, endLexicalEnvironment());
+ ts.addRange(statements, exportedFunctionDeclarations);
+ var exportStarFunction = addExportStarIfNeeded(statements);
+ statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([
+ ts.createPropertyAssignment("setters", generateSetters(exportStarFunction, dependencyGroups)),
+ ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true)))
+ ]), true)));
}
- function generateCallToConvertedLoop(loopFunctionExpressionName, parameters, state, isAsyncBlockContainingAwait) {
- var outerConvertedLoopState = convertedLoopState;
- var statements = [];
- var isSimpleLoop = !(state.nonLocalJumps & ~4) &&
- !state.labeledNonLocalBreaks &&
- !state.labeledNonLocalContinues;
- var call = ts.createCall(loopFunctionExpressionName, undefined, ts.map(parameters, function (p) { return p.name; }));
- var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(37), call) : call;
- if (isSimpleLoop) {
- statements.push(ts.createStatement(callResult));
- copyOutParameters(state.loopOutParameters, 0, statements);
+ function addExportStarIfNeeded(statements) {
+ if (!hasExportStarsToExportValues) {
+ return;
}
- else {
- var loopResultName = ts.createUniqueName("state");
- var stateVariable = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ts.createVariableDeclaration(loopResultName, undefined, callResult)]));
- statements.push(stateVariable);
- copyOutParameters(state.loopOutParameters, 0, statements);
- if (state.nonLocalJumps & 8) {
- var returnStatement = void 0;
- if (outerConvertedLoopState) {
- outerConvertedLoopState.nonLocalJumps |= 8;
- returnStatement = ts.createReturn(loopResultName);
- }
- else {
- returnStatement = ts.createReturn(ts.createPropertyAccess(loopResultName, "value"));
+ if (!exportedLocalNames && ts.isEmpty(exportSpecifiers)) {
+ var hasExportDeclarationWithExportClause = false;
+ for (var _i = 0, externalImports_2 = externalImports; _i < externalImports_2.length; _i++) {
+ var externalImport = externalImports_2[_i];
+ if (externalImport.kind === 237 && externalImport.exportClause) {
+ hasExportDeclarationWithExportClause = true;
+ break;
}
- statements.push(ts.createIf(ts.createBinary(ts.createTypeOf(loopResultName), 32, ts.createLiteral("object")), returnStatement));
}
- if (state.nonLocalJumps & 2) {
- statements.push(ts.createIf(ts.createBinary(loopResultName, 32, ts.createLiteral("break")), ts.createBreak()));
- }
- if (state.labeledNonLocalBreaks || state.labeledNonLocalContinues) {
- var caseClauses = [];
- processLabeledJumps(state.labeledNonLocalBreaks, true, loopResultName, outerConvertedLoopState, caseClauses);
- processLabeledJumps(state.labeledNonLocalContinues, false, loopResultName, outerConvertedLoopState, caseClauses);
- statements.push(ts.createSwitch(loopResultName, ts.createCaseBlock(caseClauses)));
+ if (!hasExportDeclarationWithExportClause) {
+ return addExportStarFunction(statements, undefined);
}
}
- return statements;
- }
- function setLabeledJump(state, isBreak, labelText, labelMarker) {
- if (isBreak) {
- if (!state.labeledNonLocalBreaks) {
- state.labeledNonLocalBreaks = ts.createMap();
+ var exportedNames = [];
+ if (exportedLocalNames) {
+ for (var _a = 0, exportedLocalNames_1 = exportedLocalNames; _a < exportedLocalNames_1.length; _a++) {
+ var exportedLocalName = exportedLocalNames_1[_a];
+ exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName.text), ts.createLiteral(true)));
}
- state.labeledNonLocalBreaks[labelText] = labelMarker;
}
- else {
- if (!state.labeledNonLocalContinues) {
- state.labeledNonLocalContinues = ts.createMap();
+ for (var _b = 0, externalImports_3 = externalImports; _b < externalImports_3.length; _b++) {
+ var externalImport = externalImports_3[_b];
+ if (externalImport.kind !== 237) {
+ continue;
}
- state.labeledNonLocalContinues[labelText] = labelMarker;
- }
- }
- function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) {
- if (!table) {
- return;
- }
- for (var labelText in table) {
- var labelMarker = table[labelText];
- var statements = [];
- if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) {
- var label = ts.createIdentifier(labelText);
- statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label));
+ var exportDecl = externalImport;
+ if (!exportDecl.exportClause) {
+ continue;
}
- else {
- setLabeledJump(outerLoop, isBreak, labelText, labelMarker);
- statements.push(ts.createReturn(loopResultName));
+ for (var _c = 0, _d = exportDecl.exportClause.elements; _c < _d.length; _c++) {
+ var element = _d[_c];
+ exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true)));
}
- caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements));
}
+ var exportedNamesStorageRef = ts.createUniqueName("exportedNames");
+ statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(exportedNamesStorageRef, undefined, ts.createObjectLiteral(exportedNames, undefined, true))
+ ])));
+ return addExportStarFunction(statements, exportedNamesStorageRef);
}
- function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) {
- var name = decl.name;
- if (ts.isBindingPattern(name)) {
- for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {
- var element = _a[_i];
- if (!ts.isOmittedExpression(element)) {
- processLoopVariableDeclaration(element, loopParameters, loopOutParameters);
+ function generateSetters(exportStarFunction, dependencyGroups) {
+ var setters = [];
+ for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) {
+ var group = dependencyGroups_1[_i];
+ var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); });
+ var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName("");
+ var statements = [];
+ for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) {
+ var entry = _b[_a];
+ var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile);
+ switch (entry.kind) {
+ case 231:
+ if (!entry.importClause) {
+ break;
+ }
+ case 230:
+ ts.Debug.assert(importVariableName !== undefined);
+ statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName)));
+ break;
+ case 237:
+ ts.Debug.assert(importVariableName !== undefined);
+ if (entry.exportClause) {
+ var properties = [];
+ for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) {
+ var e = _d[_c];
+ properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text))));
+ }
+ statements.push(ts.createStatement(ts.createCall(exportFunctionForFile, undefined, [ts.createObjectLiteral(properties, undefined, true)])));
+ }
+ else {
+ statements.push(ts.createStatement(ts.createCall(exportStarFunction, undefined, [parameterName])));
+ }
+ break;
}
}
+ setters.push(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, ts.createBlock(statements, undefined, true)));
}
- else {
- loopParameters.push(ts.createParameter(name));
- if (resolver.getNodeCheckFlags(decl) & 2097152) {
- var outParamName = ts.createUniqueName("out_" + name.text);
- loopOutParameters.push({ originalName: name, outParamName: outParamName });
- }
- }
+ return ts.createArrayLiteral(setters, undefined, true);
}
- function addObjectLiteralMembers(expressions, node, receiver, start) {
- var properties = node.properties;
- var numProperties = properties.length;
- for (var i = start; i < numProperties; i++) {
- var property = properties[i];
- switch (property.kind) {
- case 149:
- case 150:
- var accessors = ts.getAllAccessorDeclarations(node.properties, property);
- if (property === accessors.firstAccessor) {
- expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine));
- }
- break;
- case 253:
- expressions.push(transformPropertyAssignmentToExpression(node, property, receiver, node.multiLine));
- break;
- case 254:
- expressions.push(transformShorthandPropertyAssignmentToExpression(node, property, receiver, node.multiLine));
- break;
- case 147:
- expressions.push(transformObjectLiteralMethodDeclarationToExpression(node, property, receiver, node.multiLine));
- break;
- default:
- ts.Debug.failBadSyntaxKind(node);
- break;
- }
+ function visitSourceElement(node) {
+ switch (node.kind) {
+ case 231:
+ return visitImportDeclaration(node);
+ case 230:
+ return visitImportEqualsDeclaration(node);
+ case 237:
+ return visitExportDeclaration(node);
+ case 236:
+ return visitExportAssignment(node);
+ default:
+ return visitNestedNode(node);
}
}
- function transformPropertyAssignmentToExpression(node, property, receiver, startsOnNewLine) {
- var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), property);
- if (startsOnNewLine) {
- expression.startsOnNewLine = true;
+ function visitNestedNode(node) {
+ var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
+ var savedCurrentParent = currentParent;
+ var savedCurrentNode = currentNode;
+ var currentGrandparent = currentParent;
+ currentParent = currentNode;
+ currentNode = node;
+ if (currentParent && ts.isBlockScope(currentParent, currentGrandparent)) {
+ enclosingBlockScopedContainer = currentParent;
}
- return expression;
+ var result = visitNestedNodeWorker(node);
+ enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
+ currentParent = savedCurrentParent;
+ currentNode = savedCurrentNode;
+ return result;
}
- function transformShorthandPropertyAssignmentToExpression(node, property, receiver, startsOnNewLine) {
- var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), property);
- if (startsOnNewLine) {
- expression.startsOnNewLine = true;
+ function visitNestedNodeWorker(node) {
+ switch (node.kind) {
+ case 201:
+ return visitVariableStatement(node);
+ case 221:
+ return visitFunctionDeclaration(node);
+ case 222:
+ return visitClassDeclaration(node);
+ case 207:
+ return visitForStatement(node);
+ case 208:
+ return visitForInStatement(node);
+ case 209:
+ return visitForOfStatement(node);
+ case 205:
+ return visitDoStatement(node);
+ case 206:
+ return visitWhileStatement(node);
+ case 215:
+ return visitLabeledStatement(node);
+ case 213:
+ return visitWithStatement(node);
+ case 214:
+ return visitSwitchStatement(node);
+ case 228:
+ return visitCaseBlock(node);
+ case 249:
+ return visitCaseClause(node);
+ case 250:
+ return visitDefaultClause(node);
+ case 217:
+ return visitTryStatement(node);
+ case 252:
+ return visitCatchClause(node);
+ case 200:
+ return visitBlock(node);
+ case 203:
+ return visitExpressionStatement(node);
+ default:
+ return node;
}
- return expression;
}
- function transformObjectLiteralMethodDeclarationToExpression(node, method, receiver, startsOnNewLine) {
- var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined), method);
- if (startsOnNewLine) {
- expression.startsOnNewLine = true;
+ function visitImportDeclaration(node) {
+ if (node.importClause && ts.contains(externalImports, node)) {
+ hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));
}
- return expression;
- }
- function visitMethodDeclaration(node) {
- ts.Debug.assert(!ts.isComputedPropertyName(node.name));
- var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined);
- ts.setEmitFlags(functionExpression, 16384 | ts.getEmitFlags(functionExpression));
- return ts.createPropertyAssignment(node.name, functionExpression, node);
+ return undefined;
}
- function visitShorthandPropertyAssignment(node) {
- return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), node);
+ function visitImportEqualsDeclaration(node) {
+ if (ts.contains(externalImports, node)) {
+ hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));
+ }
+ return undefined;
}
- function visitYieldExpression(node) {
- return ts.visitEachChild(node, visitor, context);
+ function visitExportDeclaration(node) {
+ if (!node.moduleSpecifier) {
+ var statements = [];
+ ts.addRange(statements, ts.map(node.exportClause.elements, visitExportSpecifier));
+ return statements;
+ }
+ return undefined;
}
- function visitArrayLiteralExpression(node) {
- return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma);
+ function visitExportSpecifier(specifier) {
+ recordExportName(specifier.name);
+ return createExportStatement(specifier.name, specifier.propertyName || specifier.name);
}
- function visitCallExpression(node) {
- return visitCallExpressionWithPotentialCapturedThisAssignment(node, true);
+ function visitExportAssignment(node) {
+ if (node.isExportEquals) {
+ return undefined;
+ }
+ return createExportStatement(ts.createLiteral("default"), node.expression);
}
- function visitImmediateSuperCallInBody(node) {
- return visitCallExpressionWithPotentialCapturedThisAssignment(node, false);
+ function visitVariableStatement(node) {
+ var shouldHoist = ((ts.getCombinedNodeFlags(ts.getOriginalNode(node.declarationList)) & 3) == 0) ||
+ enclosingBlockScopedContainer.kind === 256;
+ if (!shouldHoist) {
+ return node;
+ }
+ var isExported = ts.hasModifier(node, 1);
+ var expressions = [];
+ for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
+ var variable = _a[_i];
+ var visited = transformVariable(variable, isExported);
+ if (visited) {
+ expressions.push(visited);
+ }
+ }
+ if (expressions.length) {
+ return ts.createStatement(ts.inlineExpressions(expressions), node);
+ }
+ return undefined;
}
- function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
- var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- if (node.expression.kind === 95) {
- ts.setEmitFlags(thisArg, 128);
+ function transformVariable(node, isExported) {
+ hoistBindingElement(node, isExported);
+ if (!node.initializer) {
+ return;
}
- var resultingCall;
- if (node.transformFlags & 262144) {
- resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false));
+ var name = node.name;
+ if (ts.isIdentifier(name)) {
+ return ts.createAssignment(name, node.initializer);
}
else {
- resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node);
- }
- if (node.expression.kind === 95) {
- var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128);
- var initializer = ts.createLogicalOr(resultingCall, actualThis);
- return assignToCapturedThis
- ? ts.createAssignment(ts.createIdentifier("_this"), initializer)
- : initializer;
+ return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration);
}
- return resultingCall;
}
- function visitNewExpression(node) {
- ts.Debug.assert((node.transformFlags & 262144) !== 0);
- var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []);
+ function visitFunctionDeclaration(node) {
+ if (ts.hasModifier(node, 1)) {
+ var name_38 = node.name || ts.getGeneratedNameForNode(node);
+ var isAsync = ts.hasModifier(node, 256);
+ var newNode = ts.createFunctionDeclaration(undefined, isAsync ? [ts.createNode(119)] : undefined, node.asteriskToken, name_38, undefined, node.parameters, undefined, node.body, node);
+ recordExportedFunctionDeclaration(node);
+ if (!ts.hasModifier(node, 512)) {
+ recordExportName(name_38);
+ }
+ ts.setOriginalNode(newNode, node);
+ node = newNode;
+ }
+ hoistFunctionDeclaration(node);
+ return undefined;
}
- function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) {
- var numElements = elements.length;
- var segments = ts.flatten(ts.spanMap(elements, partitionSpreadElement, function (partition, visitPartition, start, end) {
- return visitPartition(partition, multiLine, hasTrailingComma && end === numElements);
- }));
- if (segments.length === 1) {
- var firstElement = elements[0];
- return needsUniqueCopy && ts.isSpreadElementExpression(firstElement) && firstElement.expression.kind !== 170
- ? ts.createArraySlice(segments[0])
- : segments[0];
+ function visitExpressionStatement(node) {
+ var originalNode = ts.getOriginalNode(node);
+ if ((originalNode.kind === 226 || originalNode.kind === 225) && ts.hasModifier(originalNode, 1)) {
+ var name_39 = getDeclarationName(originalNode);
+ if (originalNode.kind === 225) {
+ hoistVariableDeclaration(name_39);
+ }
+ return [
+ node,
+ createExportStatement(name_39, name_39)
+ ];
}
- return ts.createArrayConcat(segments.shift(), segments);
+ return node;
}
- function partitionSpreadElement(node) {
- return ts.isSpreadElementExpression(node)
- ? visitSpanOfSpreadElements
- : visitSpanOfNonSpreadElements;
+ function visitClassDeclaration(node) {
+ var name = getDeclarationName(node);
+ hoistVariableDeclaration(name);
+ var statements = [];
+ statements.push(ts.createStatement(ts.createAssignment(name, ts.createClassExpression(undefined, node.name, undefined, node.heritageClauses, node.members, node)), node));
+ if (ts.hasModifier(node, 1)) {
+ if (!ts.hasModifier(node, 512)) {
+ recordExportName(name);
+ }
+ statements.push(createDeclarationExport(node));
+ }
+ return statements;
}
- function visitSpanOfSpreadElements(chunk, multiLine, hasTrailingComma) {
- return ts.map(chunk, visitExpressionOfSpreadElement);
+ function shouldHoistLoopInitializer(node) {
+ return ts.isVariableDeclarationList(node) && (ts.getCombinedNodeFlags(node) & 3) === 0;
}
- function visitSpanOfNonSpreadElements(chunk, multiLine, hasTrailingComma) {
- return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine);
+ function visitForStatement(node) {
+ var initializer = node.initializer;
+ if (shouldHoistLoopInitializer(initializer)) {
+ var expressions = [];
+ for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {
+ var variable = _a[_i];
+ var visited = transformVariable(variable, false);
+ if (visited) {
+ expressions.push(visited);
+ }
+ }
+ ;
+ return ts.createFor(expressions.length
+ ? ts.inlineExpressions(expressions)
+ : ts.createSynthesizedNode(194), node.condition, node.incrementor, ts.visitNode(node.statement, visitNestedNode, ts.isStatement), node);
+ }
+ else {
+ return ts.visitEachChild(node, visitNestedNode, context);
+ }
}
- function visitExpressionOfSpreadElement(node) {
- return ts.visitNode(node.expression, visitor, ts.isExpression);
+ function transformForBinding(node) {
+ var firstDeclaration = ts.firstOrUndefined(node.declarations);
+ hoistBindingElement(firstDeclaration, false);
+ var name = firstDeclaration.name;
+ return ts.isIdentifier(name)
+ ? name
+ : ts.flattenVariableDestructuringToExpression(firstDeclaration, hoistVariableDeclaration);
}
- function visitTemplateLiteral(node) {
- return ts.createLiteral(node.text, node);
+ function visitForInStatement(node) {
+ var initializer = node.initializer;
+ if (shouldHoistLoopInitializer(initializer)) {
+ var updated = ts.getMutableClone(node);
+ updated.initializer = transformForBinding(initializer);
+ updated.statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
+ return updated;
+ }
+ else {
+ return ts.visitEachChild(node, visitNestedNode, context);
+ }
}
- function visitTaggedTemplateExpression(node) {
- var tag = ts.visitNode(node.tag, visitor, ts.isExpression);
- var temp = ts.createTempVariable(hoistVariableDeclaration);
- var templateArguments = [temp];
- var cookedStrings = [];
- var rawStrings = [];
- var template = node.template;
- if (ts.isNoSubstitutionTemplateLiteral(template)) {
- cookedStrings.push(ts.createLiteral(template.text));
- rawStrings.push(getRawLiteral(template));
+ function visitForOfStatement(node) {
+ var initializer = node.initializer;
+ if (shouldHoistLoopInitializer(initializer)) {
+ var updated = ts.getMutableClone(node);
+ updated.initializer = transformForBinding(initializer);
+ updated.statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
+ return updated;
}
else {
- cookedStrings.push(ts.createLiteral(template.head.text));
- rawStrings.push(getRawLiteral(template.head));
- for (var _i = 0, _a = template.templateSpans; _i < _a.length; _i++) {
- var templateSpan = _a[_i];
- cookedStrings.push(ts.createLiteral(templateSpan.literal.text));
- rawStrings.push(getRawLiteral(templateSpan.literal));
- templateArguments.push(ts.visitNode(templateSpan.expression, visitor, ts.isExpression));
- }
+ return ts.visitEachChild(node, visitNestedNode, context);
}
- return ts.createParen(ts.inlineExpressions([
- ts.createAssignment(temp, ts.createArrayLiteral(cookedStrings)),
- ts.createAssignment(ts.createPropertyAccess(temp, "raw"), ts.createArrayLiteral(rawStrings)),
- ts.createCall(tag, undefined, templateArguments)
- ]));
}
- function getRawLiteral(node) {
- var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
- var isLast = node.kind === 11 || node.kind === 14;
- text = text.substring(1, text.length - (isLast ? 1 : 2));
- text = text.replace(/\r\n?/g, "\n");
- return ts.createLiteral(text, node);
+ function visitDoStatement(node) {
+ var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
+ if (statement !== node.statement) {
+ var updated = ts.getMutableClone(node);
+ updated.statement = statement;
+ return updated;
+ }
+ return node;
}
- function visitTemplateExpression(node) {
- var expressions = [];
- addTemplateHead(expressions, node);
- addTemplateSpans(expressions, node);
- var expression = ts.reduceLeft(expressions, ts.createAdd);
- if (ts.nodeIsSynthesized(expression)) {
- ts.setTextRange(expression, node);
+ function visitWhileStatement(node) {
+ var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
+ if (statement !== node.statement) {
+ var updated = ts.getMutableClone(node);
+ updated.statement = statement;
+ return updated;
}
- return expression;
+ return node;
}
- function shouldAddTemplateHead(node) {
- ts.Debug.assert(node.templateSpans.length !== 0);
- return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0;
+ function visitLabeledStatement(node) {
+ var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
+ if (statement !== node.statement) {
+ var updated = ts.getMutableClone(node);
+ updated.statement = statement;
+ return updated;
+ }
+ return node;
}
- function addTemplateHead(expressions, node) {
- if (!shouldAddTemplateHead(node)) {
- return;
+ function visitWithStatement(node) {
+ var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, false, ts.liftToBlock);
+ if (statement !== node.statement) {
+ var updated = ts.getMutableClone(node);
+ updated.statement = statement;
+ return updated;
+ }
+ return node;
+ }
+ function visitSwitchStatement(node) {
+ var caseBlock = ts.visitNode(node.caseBlock, visitNestedNode, ts.isCaseBlock);
+ if (caseBlock !== node.caseBlock) {
+ var updated = ts.getMutableClone(node);
+ updated.caseBlock = caseBlock;
+ return updated;
+ }
+ return node;
+ }
+ function visitCaseBlock(node) {
+ var clauses = ts.visitNodes(node.clauses, visitNestedNode, ts.isCaseOrDefaultClause);
+ if (clauses !== node.clauses) {
+ var updated = ts.getMutableClone(node);
+ updated.clauses = clauses;
+ return updated;
}
- expressions.push(ts.createLiteral(node.head.text));
+ return node;
}
- function addTemplateSpans(expressions, node) {
- for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {
- var span_6 = _a[_i];
- expressions.push(ts.visitNode(span_6.expression, visitor, ts.isExpression));
- if (span_6.literal.text.length !== 0) {
- expressions.push(ts.createLiteral(span_6.literal.text));
- }
+ function visitCaseClause(node) {
+ var statements = ts.visitNodes(node.statements, visitNestedNode, ts.isStatement);
+ if (statements !== node.statements) {
+ var updated = ts.getMutableClone(node);
+ updated.statements = statements;
+ return updated;
}
+ return node;
}
- function visitSuperKeyword(node) {
- return enclosingNonAsyncFunctionBody
- && ts.isClassElement(enclosingNonAsyncFunctionBody)
- && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32)
- && currentParent.kind !== 174
- ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype")
- : ts.createIdentifier("_super");
+ function visitDefaultClause(node) {
+ return ts.visitEachChild(node, visitNestedNode, context);
}
- function visitSourceFileNode(node) {
- var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1];
- var statements = [];
- startLexicalEnvironment();
- ts.addRange(statements, prologue);
- addCaptureThisForNodeIfNeeded(statements, node);
- ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement));
- ts.addRange(statements, endLexicalEnvironment());
- var clone = ts.getMutableClone(node);
- clone.statements = ts.createNodeArray(statements, node.statements);
- return clone;
+ function visitTryStatement(node) {
+ return ts.visitEachChild(node, visitNestedNode, context);
}
- function onEmitNode(emitContext, node, emitCallback) {
- var savedEnclosingFunction = enclosingFunction;
- if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) {
- enclosingFunction = node;
+ function visitCatchClause(node) {
+ var block = ts.visitNode(node.block, visitNestedNode, ts.isBlock);
+ if (block !== node.block) {
+ var updated = ts.getMutableClone(node);
+ updated.block = block;
+ return updated;
}
- previousOnEmitNode(emitContext, node, emitCallback);
- enclosingFunction = savedEnclosingFunction;
+ return node;
}
- function enableSubstitutionsForBlockScopedBindings() {
- if ((enabledSubstitutions & 2) === 0) {
- enabledSubstitutions |= 2;
- context.enableSubstitution(69);
- }
+ function visitBlock(node) {
+ return ts.visitEachChild(node, visitNestedNode, context);
}
- function enableSubstitutionsForCapturedThis() {
- if ((enabledSubstitutions & 1) === 0) {
- enabledSubstitutions |= 1;
- context.enableSubstitution(97);
- context.enableEmitNotification(148);
- context.enableEmitNotification(147);
- context.enableEmitNotification(149);
- context.enableEmitNotification(150);
- context.enableEmitNotification(180);
- context.enableEmitNotification(179);
- context.enableEmitNotification(220);
+ function onEmitNode(emitContext, node, emitCallback) {
+ if (node.kind === 256) {
+ exportFunctionForFile = exportFunctionForFileMap[ts.getOriginalNodeId(node)];
+ previousOnEmitNode(emitContext, node, emitCallback);
+ exportFunctionForFile = undefined;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
}
}
function onSubstituteNode(emitContext, node) {
@@ -41913,122 +43284,320 @@ var ts;
if (emitContext === 1) {
return substituteExpression(node);
}
- if (ts.isIdentifier(node)) {
- return substituteIdentifier(node);
+ return node;
+ }
+ function substituteExpression(node) {
+ switch (node.kind) {
+ case 70:
+ return substituteExpressionIdentifier(node);
+ case 188:
+ return substituteBinaryExpression(node);
+ case 186:
+ case 187:
+ return substituteUnaryExpression(node);
}
return node;
}
- function substituteIdentifier(node) {
- if (enabledSubstitutions & 2) {
- var original = ts.getParseTreeNode(node, ts.isIdentifier);
- if (original && isNameOfDeclarationWithCollidingName(original)) {
- return ts.getGeneratedNameForNode(original);
+ function substituteExpressionIdentifier(node) {
+ var importDeclaration = resolver.getReferencedImportDeclaration(node);
+ if (importDeclaration) {
+ var importBinding = createImportBinding(importDeclaration);
+ if (importBinding) {
+ return importBinding;
}
}
return node;
}
- function isNameOfDeclarationWithCollidingName(node) {
- var parent = node.parent;
- switch (parent.kind) {
- case 169:
- case 221:
- case 224:
- case 218:
- return parent.name === node
- && resolver.isDeclarationWithCollidingName(parent);
+ function substituteBinaryExpression(node) {
+ if (ts.isAssignmentOperator(node.operatorToken.kind)) {
+ return substituteAssignmentExpression(node);
}
- return false;
+ return node;
}
- function substituteExpression(node) {
- switch (node.kind) {
- case 69:
- return substituteExpressionIdentifier(node);
- case 97:
- return substituteThisKeyword(node);
+ function substituteAssignmentExpression(node) {
+ ts.setEmitFlags(node, 128);
+ var left = node.left;
+ switch (left.kind) {
+ case 70:
+ var exportDeclaration = resolver.getReferencedExportContainer(left);
+ if (exportDeclaration) {
+ return createExportExpression(left, node);
+ }
+ break;
+ case 172:
+ case 171:
+ if (hasExportedReferenceInDestructuringPattern(left)) {
+ return substituteDestructuring(node);
+ }
+ break;
}
return node;
}
- function substituteExpressionIdentifier(node) {
- if (enabledSubstitutions & 2) {
- var declaration = resolver.getReferencedDeclarationWithCollidingName(node);
- if (declaration) {
- return ts.getGeneratedNameForNode(declaration.name);
+ function isExportedBinding(name) {
+ var container = resolver.getReferencedExportContainer(name);
+ return container && container.kind === 256;
+ }
+ function hasExportedReferenceInDestructuringPattern(node) {
+ switch (node.kind) {
+ case 70:
+ return isExportedBinding(node);
+ case 172:
+ for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
+ var property = _a[_i];
+ if (hasExportedReferenceInObjectDestructuringElement(property)) {
+ return true;
+ }
+ }
+ break;
+ case 171:
+ for (var _b = 0, _c = node.elements; _b < _c.length; _b++) {
+ var element = _c[_b];
+ if (hasExportedReferenceInArrayDestructuringElement(element)) {
+ return true;
+ }
+ }
+ break;
+ }
+ return false;
+ }
+ function hasExportedReferenceInObjectDestructuringElement(node) {
+ if (ts.isShorthandPropertyAssignment(node)) {
+ return isExportedBinding(node.name);
+ }
+ else if (ts.isPropertyAssignment(node)) {
+ return hasExportedReferenceInDestructuringElement(node.initializer);
+ }
+ else {
+ return false;
+ }
+ }
+ function hasExportedReferenceInArrayDestructuringElement(node) {
+ if (ts.isSpreadElementExpression(node)) {
+ var expression = node.expression;
+ return ts.isIdentifier(expression) && isExportedBinding(expression);
+ }
+ else {
+ return hasExportedReferenceInDestructuringElement(node);
+ }
+ }
+ function hasExportedReferenceInDestructuringElement(node) {
+ if (ts.isBinaryExpression(node)) {
+ var left = node.left;
+ return node.operatorToken.kind === 57
+ && isDestructuringPattern(left)
+ && hasExportedReferenceInDestructuringPattern(left);
+ }
+ else if (ts.isIdentifier(node)) {
+ return isExportedBinding(node);
+ }
+ else if (ts.isSpreadElementExpression(node)) {
+ var expression = node.expression;
+ return ts.isIdentifier(expression) && isExportedBinding(expression);
+ }
+ else if (isDestructuringPattern(node)) {
+ return hasExportedReferenceInDestructuringPattern(node);
+ }
+ else {
+ return false;
+ }
+ }
+ function isDestructuringPattern(node) {
+ var kind = node.kind;
+ return kind === 70
+ || kind === 172
+ || kind === 171;
+ }
+ function substituteDestructuring(node) {
+ return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration);
+ }
+ function substituteUnaryExpression(node) {
+ var operand = node.operand;
+ var operator = node.operator;
+ var substitute = ts.isIdentifier(operand) &&
+ (node.kind === 187 ||
+ (node.kind === 186 && (operator === 42 || operator === 43)));
+ if (substitute) {
+ var exportDeclaration = resolver.getReferencedExportContainer(operand);
+ if (exportDeclaration) {
+ var expr = ts.createPrefix(node.operator, operand, node);
+ ts.setEmitFlags(expr, 128);
+ var call = createExportExpression(operand, expr);
+ if (node.kind === 186) {
+ return call;
+ }
+ else {
+ return operator === 42
+ ? ts.createSubtract(call, ts.createLiteral(1))
+ : ts.createAdd(call, ts.createLiteral(1));
+ }
}
}
return node;
}
- function substituteThisKeyword(node) {
- if (enabledSubstitutions & 1
- && enclosingFunction
- && ts.getEmitFlags(enclosingFunction) & 256) {
- return ts.createIdentifier("_this", node);
+ function getDeclarationName(node) {
+ return node.name ? ts.getSynthesizedClone(node.name) : ts.getGeneratedNameForNode(node);
+ }
+ function addExportStarFunction(statements, localNames) {
+ var exportStarFunction = ts.createUniqueName("exportStar");
+ var m = ts.createIdentifier("m");
+ var n = ts.createIdentifier("n");
+ var exports = ts.createIdentifier("exports");
+ var condition = ts.createStrictInequality(n, ts.createLiteral("default"));
+ if (localNames) {
+ condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n)));
}
- return node;
+ statements.push(ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(m)], undefined, ts.createBlock([
+ ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(exports, undefined, ts.createObjectLiteral([]))
+ ])),
+ ts.createForIn(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(n, undefined)
+ ]), m, ts.createBlock([
+ ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32)
+ ])),
+ ts.createStatement(ts.createCall(exportFunctionForFile, undefined, [exports]))
+ ], undefined, true)));
+ return exportStarFunction;
}
- function getLocalName(node, allowComments, allowSourceMaps) {
- return getDeclarationName(node, allowComments, allowSourceMaps, 262144);
+ function createExportExpression(name, value) {
+ var exportName = ts.isIdentifier(name) ? ts.createLiteral(name.text) : name;
+ return ts.createCall(exportFunctionForFile, undefined, [exportName, value]);
}
- function getDeclarationName(node, allowComments, allowSourceMaps, emitFlags) {
- if (node.name && !ts.isGeneratedIdentifier(node.name)) {
- var name_39 = ts.getMutableClone(node.name);
- emitFlags |= ts.getEmitFlags(node.name);
- if (!allowSourceMaps) {
- emitFlags |= 1536;
- }
- if (!allowComments) {
- emitFlags |= 49152;
+ function createExportStatement(name, value) {
+ return ts.createStatement(createExportExpression(name, value));
+ }
+ function createDeclarationExport(node) {
+ var declarationName = getDeclarationName(node);
+ var exportName = ts.hasModifier(node, 512) ? ts.createLiteral("default") : declarationName;
+ return createExportStatement(exportName, declarationName);
+ }
+ function createImportBinding(importDeclaration) {
+ var importAlias;
+ var name;
+ if (ts.isImportClause(importDeclaration)) {
+ importAlias = ts.getGeneratedNameForNode(importDeclaration.parent);
+ name = ts.createIdentifier("default");
+ }
+ else if (ts.isImportSpecifier(importDeclaration)) {
+ importAlias = ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent);
+ name = importDeclaration.propertyName || importDeclaration.name;
+ }
+ else {
+ return undefined;
+ }
+ return ts.createPropertyAccess(importAlias, ts.getSynthesizedClone(name));
+ }
+ function collectDependencyGroups(externalImports) {
+ var groupIndices = ts.createMap();
+ var dependencyGroups = [];
+ for (var i = 0; i < externalImports.length; i++) {
+ var externalImport = externalImports[i];
+ var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions);
+ var text = externalModuleName.text;
+ if (ts.hasProperty(groupIndices, text)) {
+ var groupIndex = groupIndices[text];
+ dependencyGroups[groupIndex].externalImports.push(externalImport);
+ continue;
}
- if (emitFlags) {
- ts.setEmitFlags(name_39, emitFlags);
+ else {
+ groupIndices[text] = dependencyGroups.length;
+ dependencyGroups.push({
+ name: externalModuleName,
+ externalImports: [externalImport]
+ });
}
- return name_39;
}
- return ts.getGeneratedNameForNode(node);
+ return dependencyGroups;
}
- function getClassMemberPrefix(node, member) {
- var expression = getLocalName(node);
- return ts.hasModifier(member, 32) ? expression : ts.createPropertyAccess(expression, "prototype");
+ function getNameOfDependencyGroup(dependencyGroup) {
+ return dependencyGroup.name;
}
- function hasSynthesizedDefaultSuperCall(constructor, hasExtendsClause) {
- if (!constructor || !hasExtendsClause) {
- return false;
+ function recordExportName(name) {
+ if (!exportedLocalNames) {
+ exportedLocalNames = [];
}
- var parameter = ts.singleOrUndefined(constructor.parameters);
- if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) {
- return false;
+ exportedLocalNames.push(name);
+ }
+ function recordExportedFunctionDeclaration(node) {
+ if (!exportedFunctionDeclarations) {
+ exportedFunctionDeclarations = [];
}
- var statement = ts.firstOrUndefined(constructor.body.statements);
- if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 202) {
- return false;
+ exportedFunctionDeclarations.push(createDeclarationExport(node));
+ }
+ function hoistBindingElement(node, isExported) {
+ if (ts.isOmittedExpression(node)) {
+ return;
}
- var statementExpression = statement.expression;
- if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 174) {
- return false;
+ var name = node.name;
+ if (ts.isIdentifier(name)) {
+ hoistVariableDeclaration(ts.getSynthesizedClone(name));
+ if (isExported) {
+ recordExportName(name);
+ }
}
- var callTarget = statementExpression.expression;
- if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 95) {
- return false;
+ else if (ts.isBindingPattern(name)) {
+ ts.forEach(name.elements, isExported ? hoistExportedBindingElement : hoistNonExportedBindingElement);
}
- var callArgument = ts.singleOrUndefined(statementExpression.arguments);
- if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 191) {
- return false;
+ }
+ function hoistExportedBindingElement(node) {
+ hoistBindingElement(node, true);
+ }
+ function hoistNonExportedBindingElement(node) {
+ hoistBindingElement(node, false);
+ }
+ function updateSourceFile(node, statements, nodeEmitFlags) {
+ var updated = ts.getMutableClone(node);
+ updated.statements = ts.createNodeArray(statements, node.statements);
+ ts.setEmitFlags(updated, nodeEmitFlags);
+ return updated;
+ }
+ }
+ ts.transformSystemModule = transformSystemModule;
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function transformES2015Module(context) {
+ var compilerOptions = context.getCompilerOptions();
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
}
- var expression = callArgument.expression;
- return ts.isIdentifier(expression) && expression === parameter.name;
+ if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
+ return ts.visitEachChild(node, visitor, context);
+ }
+ return node;
+ }
+ function visitor(node) {
+ switch (node.kind) {
+ case 230:
+ return undefined;
+ case 236:
+ return visitExportAssignment(node);
+ }
+ return node;
+ }
+ function visitExportAssignment(node) {
+ return node.isExportEquals ? undefined : node;
}
}
- ts.transformES6 = transformES6;
+ ts.transformES2015Module = transformES2015Module;
})(ts || (ts = {}));
var ts;
(function (ts) {
var moduleTransformerMap = ts.createMap((_a = {},
- _a[ts.ModuleKind.ES6] = ts.transformES6Module,
+ _a[ts.ModuleKind.ES2015] = ts.transformES2015Module,
_a[ts.ModuleKind.System] = ts.transformSystemModule,
_a[ts.ModuleKind.AMD] = ts.transformModule,
_a[ts.ModuleKind.CommonJS] = ts.transformModule,
_a[ts.ModuleKind.UMD] = ts.transformModule,
_a[ts.ModuleKind.None] = ts.transformModule,
_a));
+ var SyntaxKindFeatureFlags;
+ (function (SyntaxKindFeatureFlags) {
+ SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution";
+ SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications";
+ })(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {}));
function getTransformers(compilerOptions) {
var jsx = compilerOptions.jsx;
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
@@ -42039,11 +43608,19 @@ var ts;
if (jsx === 2) {
transformers.push(ts.transformJsx);
}
- transformers.push(ts.transformES7);
+ if (languageVersion < 4) {
+ transformers.push(ts.transformES2017);
+ }
+ if (languageVersion < 3) {
+ transformers.push(ts.transformES2016);
+ }
if (languageVersion < 2) {
- transformers.push(ts.transformES6);
+ transformers.push(ts.transformES2015);
transformers.push(ts.transformGenerators);
}
+ if (languageVersion < 1) {
+ transformers.push(ts.transformES5);
+ }
return transformers;
}
ts.getTransformers = getTransformers;
@@ -42063,7 +43640,7 @@ var ts;
hoistFunctionDeclaration: hoistFunctionDeclaration,
startLexicalEnvironment: startLexicalEnvironment,
endLexicalEnvironment: endLexicalEnvironment,
- onSubstituteNode: function (emitContext, node) { return node; },
+ onSubstituteNode: function (_emitContext, node) { return node; },
enableSubstitution: enableSubstitution,
isSubstitutionEnabled: isSubstitutionEnabled,
onEmitNode: function (node, emitContext, emitCallback) { return emitCallback(node, emitContext); },
@@ -42203,7 +43780,7 @@ var ts;
emitNodeWithSourceMap: emitNodeWithSourceMap,
emitTokenWithSourceMap: emitTokenWithSourceMap,
getText: getText,
- getSourceMappingURL: getSourceMappingURL
+ getSourceMappingURL: getSourceMappingURL,
};
function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) {
if (disabled) {
@@ -42406,7 +43983,7 @@ var ts;
sources: sourceMapData.sourceMapSources,
names: sourceMapData.sourceMapNames,
mappings: sourceMapData.sourceMapMappings,
- sourcesContent: sourceMapData.sourceMapSourcesContent
+ sourcesContent: sourceMapData.sourceMapSourcesContent,
});
}
function getSourceMappingURL() {
@@ -42470,7 +44047,7 @@ var ts;
setSourceFile: setSourceFile,
emitNodeWithComments: emitNodeWithComments,
emitBodyWithDetachedComments: emitBodyWithDetachedComments,
- emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition
+ emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition,
};
function emitNodeWithComments(emitContext, node, emitCallback) {
if (disabled) {
@@ -42508,7 +44085,7 @@ var ts;
}
if (!skipTrailingComments) {
containerEnd = end;
- if (node.kind === 219) {
+ if (node.kind === 220) {
declarationListContainerEnd = end;
}
}
@@ -42584,7 +44161,7 @@ var ts;
emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos);
}
}
- function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
+ function emitLeadingComment(commentPos, commentEnd, _kind, hasTrailingNewLine, rangePos) {
if (!hasWrittenComment) {
ts.emitNewLineBeforeLeadingCommentOfPosition(currentLineMap, writer, rangePos, commentPos);
hasWrittenComment = true;
@@ -42602,7 +44179,7 @@ var ts;
function emitTrailingComments(pos) {
forEachTrailingCommentToEmit(pos, emitTrailingComment);
}
- function emitTrailingComment(commentPos, commentEnd, kind, hasTrailingNewLine) {
+ function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
if (!writer.isAtStartOfLine()) {
writer.write(" ");
}
@@ -42625,7 +44202,7 @@ var ts;
ts.performance.measure("commentTime", "beforeEmitTrailingCommentsOfPosition");
}
}
- function emitTrailingCommentOfPosition(commentPos, commentEnd, kind, hasTrailingNewLine) {
+ function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
emitPos(commentPos);
ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine);
emitPos(commentEnd);
@@ -42736,7 +44313,7 @@ var ts;
var isCurrentFileExternalModule;
var reportedDeclarationError = false;
var errorNameNode;
- var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments;
+ var emitJsDocComments = compilerOptions.removeComments ? function () { } : writeJsDocComments;
var emit = compilerOptions.stripInternal ? stripInternal : emitNode;
var noDeclare;
var moduleElementDeclarationEmitInfo = [];
@@ -42780,7 +44357,7 @@ var ts;
var oldWriter = writer;
ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) {
if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) {
- ts.Debug.assert(aliasEmitInfo.node.kind === 230);
+ ts.Debug.assert(aliasEmitInfo.node.kind === 231);
createAndSetNewTextWriterWithSymbolWriter();
ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit));
for (var i = 0; i < aliasEmitInfo.indent; i++) {
@@ -42811,7 +44388,7 @@ var ts;
reportedDeclarationError: reportedDeclarationError,
moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo,
synchronousDeclarationOutput: writer.getText(),
- referencesOutput: referencesOutput
+ referencesOutput: referencesOutput,
};
function hasInternalAnnotation(range) {
var comment = currentText.substring(range.pos, range.end);
@@ -42851,10 +44428,10 @@ var ts;
var oldWriter = writer;
ts.forEach(nodes, function (declaration) {
var nodeToCheck;
- if (declaration.kind === 218) {
+ if (declaration.kind === 219) {
nodeToCheck = declaration.parent.parent;
}
- else if (declaration.kind === 233 || declaration.kind === 234 || declaration.kind === 231) {
+ else if (declaration.kind === 234 || declaration.kind === 235 || declaration.kind === 232) {
ts.Debug.fail("We should be getting ImportDeclaration instead to write");
}
else {
@@ -42865,7 +44442,7 @@ var ts;
moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; });
}
if (moduleElementEmitInfo) {
- if (moduleElementEmitInfo.node.kind === 230) {
+ if (moduleElementEmitInfo.node.kind === 231) {
moduleElementEmitInfo.isVisible = true;
}
else {
@@ -42873,12 +44450,12 @@ var ts;
for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) {
increaseIndent();
}
- if (nodeToCheck.kind === 225) {
+ if (nodeToCheck.kind === 226) {
ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined);
asynchronousSubModuleDeclarationEmitInfo = [];
}
writeModuleElement(nodeToCheck);
- if (nodeToCheck.kind === 225) {
+ if (nodeToCheck.kind === 226) {
moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo;
asynchronousSubModuleDeclarationEmitInfo = undefined;
}
@@ -42990,67 +44567,67 @@ var ts;
}
function emitType(type) {
switch (type.kind) {
- case 117:
- case 132:
- case 130:
- case 120:
+ case 118:
case 133:
- case 103:
- case 135:
- case 93:
- case 127:
- case 165:
+ case 131:
+ case 121:
+ case 134:
+ case 104:
+ case 136:
+ case 94:
+ case 128:
case 166:
+ case 167:
return writeTextOfNode(currentText, type);
- case 194:
+ case 195:
return emitExpressionWithTypeArguments(type);
- case 155:
+ case 156:
return emitTypeReference(type);
- case 158:
+ case 159:
return emitTypeQuery(type);
- case 160:
- return emitArrayType(type);
case 161:
- return emitTupleType(type);
+ return emitArrayType(type);
case 162:
- return emitUnionType(type);
+ return emitTupleType(type);
case 163:
- return emitIntersectionType(type);
+ return emitUnionType(type);
case 164:
+ return emitIntersectionType(type);
+ case 165:
return emitParenType(type);
- case 156:
case 157:
+ case 158:
return emitSignatureDeclarationWithJsDocComments(type);
- case 159:
+ case 160:
return emitTypeLiteral(type);
- case 69:
+ case 70:
return emitEntityName(type);
- case 139:
+ case 140:
return emitEntityName(type);
- case 154:
+ case 155:
return emitTypePredicate(type);
}
function writeEntityName(entityName) {
- if (entityName.kind === 69) {
+ if (entityName.kind === 70) {
writeTextOfNode(currentText, entityName);
}
else {
- var left = entityName.kind === 139 ? entityName.left : entityName.expression;
- var right = entityName.kind === 139 ? entityName.right : entityName.name;
+ var left = entityName.kind === 140 ? entityName.left : entityName.expression;
+ var right = entityName.kind === 140 ? entityName.right : entityName.name;
writeEntityName(left);
write(".");
writeTextOfNode(currentText, right);
}
}
function emitEntityName(entityName) {
- var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 229 ? entityName.parent : enclosingDeclaration);
+ var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 230 ? entityName.parent : enclosingDeclaration);
handleSymbolAccessibilityError(visibilityResult);
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));
writeEntityName(entityName);
}
function emitExpressionWithTypeArguments(node) {
if (ts.isEntityNameExpression(node.expression)) {
- ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 172);
+ ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 173);
emitEntityName(node.expression);
if (node.typeArguments) {
write("<");
@@ -43131,7 +44708,7 @@ var ts;
}
}
function emitExportAssignment(node) {
- if (node.expression.kind === 69) {
+ if (node.expression.kind === 70) {
write(node.isExportEquals ? "export = " : "export default ");
writeTextOfNode(currentText, node.expression);
}
@@ -43152,11 +44729,11 @@ var ts;
}
write(";");
writeLine();
- if (node.expression.kind === 69) {
+ if (node.expression.kind === 70) {
var nodes = resolver.collectLinkedAliases(node.expression);
writeAsynchronousModuleElements(nodes);
}
- function getDefaultExportAccessibilityDiagnostic(diagnostic) {
+ function getDefaultExportAccessibilityDiagnostic() {
return {
diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,
errorNode: node
@@ -43170,7 +44747,7 @@ var ts;
if (isModuleElementVisible) {
writeModuleElement(node);
}
- else if (node.kind === 229 ||
+ else if (node.kind === 230 ||
(node.parent.kind === 256 && isCurrentFileExternalModule)) {
var isVisible = void 0;
if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 256) {
@@ -43182,7 +44759,7 @@ var ts;
});
}
else {
- if (node.kind === 230) {
+ if (node.kind === 231) {
var importDeclaration = node;
if (importDeclaration.importClause) {
isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) ||
@@ -43200,23 +44777,23 @@ var ts;
}
function writeModuleElement(node) {
switch (node.kind) {
- case 220:
+ case 221:
return writeFunctionDeclaration(node);
- case 200:
+ case 201:
return writeVariableStatement(node);
- case 222:
+ case 223:
return writeInterfaceDeclaration(node);
- case 221:
+ case 222:
return writeClassDeclaration(node);
- case 223:
- return writeTypeAliasDeclaration(node);
case 224:
- return writeEnumDeclaration(node);
+ return writeTypeAliasDeclaration(node);
case 225:
+ return writeEnumDeclaration(node);
+ case 226:
return writeModuleDeclaration(node);
- case 229:
- return writeImportEqualsDeclaration(node);
case 230:
+ return writeImportEqualsDeclaration(node);
+ case 231:
return writeImportDeclaration(node);
default:
ts.Debug.fail("Unknown symbol kind");
@@ -43231,7 +44808,7 @@ var ts;
if (modifiers & 512) {
write("default ");
}
- else if (node.kind !== 222 && !noDeclare) {
+ else if (node.kind !== 223 && !noDeclare) {
write("declare ");
}
}
@@ -43271,7 +44848,7 @@ var ts;
write(");");
}
writer.writeLine();
- function getImportEntityNameVisibilityError(symbolAccessibilityResult) {
+ function getImportEntityNameVisibilityError() {
return {
diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1,
errorNode: node,
@@ -43281,7 +44858,7 @@ var ts;
}
function isVisibleNamedBinding(namedBindings) {
if (namedBindings) {
- if (namedBindings.kind === 232) {
+ if (namedBindings.kind === 233) {
return resolver.isDeclarationVisible(namedBindings);
}
else {
@@ -43304,7 +44881,7 @@ var ts;
if (currentWriterPos !== writer.getTextPos()) {
write(", ");
}
- if (node.importClause.namedBindings.kind === 232) {
+ if (node.importClause.namedBindings.kind === 233) {
write("* as ");
writeTextOfNode(currentText, node.importClause.namedBindings.name);
}
@@ -43321,13 +44898,13 @@ var ts;
writer.writeLine();
}
function emitExternalModuleSpecifier(parent) {
- resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 225;
+ resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 226;
var moduleSpecifier;
- if (parent.kind === 229) {
+ if (parent.kind === 230) {
var node = parent;
moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node);
}
- else if (parent.kind === 225) {
+ else if (parent.kind === 226) {
moduleSpecifier = parent.name;
}
else {
@@ -43395,7 +44972,7 @@ var ts;
writeTextOfNode(currentText, node.name);
}
}
- while (node.body && node.body.kind !== 226) {
+ while (node.body && node.body.kind !== 227) {
node = node.body;
write(".");
writeTextOfNode(currentText, node.name);
@@ -43429,7 +45006,7 @@ var ts;
write(";");
writeLine();
enclosingDeclaration = prevEnclosingDeclaration;
- function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult) {
+ function getTypeAliasDeclarationVisibilityError() {
return {
diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,
errorNode: node.type,
@@ -43465,7 +45042,7 @@ var ts;
writeLine();
}
function isPrivateMethodTypeParameter(node) {
- return node.parent.kind === 147 && ts.hasModifier(node.parent, 8);
+ return node.parent.kind === 148 && ts.hasModifier(node.parent, 8);
}
function emitTypeParameters(typeParameters) {
function emitTypeParameter(node) {
@@ -43475,49 +45052,49 @@ var ts;
writeTextOfNode(currentText, node.name);
if (node.constraint && !isPrivateMethodTypeParameter(node)) {
write(" extends ");
- if (node.parent.kind === 156 ||
- node.parent.kind === 157 ||
- (node.parent.parent && node.parent.parent.kind === 159)) {
- ts.Debug.assert(node.parent.kind === 147 ||
- node.parent.kind === 146 ||
- node.parent.kind === 156 ||
+ if (node.parent.kind === 157 ||
+ node.parent.kind === 158 ||
+ (node.parent.parent && node.parent.parent.kind === 160)) {
+ ts.Debug.assert(node.parent.kind === 148 ||
+ node.parent.kind === 147 ||
node.parent.kind === 157 ||
- node.parent.kind === 151 ||
- node.parent.kind === 152);
+ node.parent.kind === 158 ||
+ node.parent.kind === 152 ||
+ node.parent.kind === 153);
emitType(node.constraint);
}
else {
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError);
}
}
- function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult) {
+ function getTypeParameterConstraintVisibilityError() {
var diagnosticMessage;
switch (node.parent.kind) {
- case 221:
+ case 222:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
break;
- case 222:
+ case 223:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
- case 152:
+ case 153:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 151:
+ case 152:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
+ case 148:
case 147:
- case 146:
if (ts.hasModifier(node.parent, 32)) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 221) {
+ else if (node.parent.parent.kind === 222) {
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 220:
+ case 221:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
default:
@@ -43545,16 +45122,16 @@ var ts;
if (ts.isEntityNameExpression(node.expression)) {
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError);
}
- else if (!isImplementsList && node.expression.kind === 93) {
+ else if (!isImplementsList && node.expression.kind === 94) {
write("null");
}
else {
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer);
}
- function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
+ function getHeritageClauseVisibilityError() {
var diagnosticMessage;
- if (node.parent.parent.kind === 221) {
+ if (node.parent.parent.kind === 222) {
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;
@@ -43634,17 +45211,17 @@ var ts;
writeLine();
}
function emitVariableDeclaration(node) {
- if (node.kind !== 218 || resolver.isDeclarationVisible(node)) {
+ if (node.kind !== 219 || resolver.isDeclarationVisible(node)) {
if (ts.isBindingPattern(node.name)) {
emitBindingPattern(node.name);
}
else {
writeTextOfNode(currentText, node.name);
- if ((node.kind === 145 || node.kind === 144 ||
- (node.kind === 142 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) {
+ if ((node.kind === 146 || node.kind === 145 ||
+ (node.kind === 143 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) {
write("?");
}
- if ((node.kind === 145 || node.kind === 144) && node.parent.kind === 159) {
+ if ((node.kind === 146 || node.kind === 145) && node.parent.kind === 160) {
emitTypeOfVariableDeclarationFromTypeLiteral(node);
}
else if (resolver.isLiteralConstDeclaration(node)) {
@@ -43657,14 +45234,14 @@ var ts;
}
}
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
- if (node.kind === 218) {
+ if (node.kind === 219) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
}
- else if (node.kind === 145 || node.kind === 144) {
+ else if (node.kind === 146 || node.kind === 145) {
if (ts.hasModifier(node, 32)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
@@ -43672,7 +45249,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 === 221) {
+ else if (node.parent.kind === 222) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -43698,7 +45275,7 @@ var ts;
var elements = [];
for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 193) {
+ if (element.kind !== 194) {
elements.push(element);
}
}
@@ -43764,7 +45341,7 @@ var ts;
accessorWithTypeAnnotation = node;
var type = getTypeAnnotationFromAccessor(node);
if (!type) {
- var anotherAccessor = node.kind === 149 ? accessors.setAccessor : accessors.getAccessor;
+ var anotherAccessor = node.kind === 150 ? accessors.setAccessor : accessors.getAccessor;
type = getTypeAnnotationFromAccessor(anotherAccessor);
if (type) {
accessorWithTypeAnnotation = anotherAccessor;
@@ -43777,7 +45354,7 @@ var ts;
}
function getTypeAnnotationFromAccessor(accessor) {
if (accessor) {
- return accessor.kind === 149
+ return accessor.kind === 150
? accessor.type
: accessor.parameters.length > 0
? accessor.parameters[0].type
@@ -43786,7 +45363,7 @@ var ts;
}
function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
- if (accessorWithTypeAnnotation.kind === 150) {
+ if (accessorWithTypeAnnotation.kind === 151) {
if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
@@ -43832,17 +45409,17 @@ var ts;
}
if (!resolver.isImplementationOfOverload(node)) {
emitJsDocComments(node);
- if (node.kind === 220) {
+ if (node.kind === 221) {
emitModuleElementDeclarationFlags(node);
}
- else if (node.kind === 147 || node.kind === 148) {
+ else if (node.kind === 148 || node.kind === 149) {
emitClassMemberDeclarationFlags(ts.getModifierFlags(node));
}
- if (node.kind === 220) {
+ if (node.kind === 221) {
write("function ");
writeTextOfNode(currentText, node.name);
}
- else if (node.kind === 148) {
+ else if (node.kind === 149) {
write("constructor");
}
else {
@@ -43862,15 +45439,15 @@ var ts;
var prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
var closeParenthesizedFunctionType = false;
- if (node.kind === 153) {
+ if (node.kind === 154) {
emitClassMemberDeclarationFlags(ts.getModifierFlags(node));
write("[");
}
else {
- if (node.kind === 152 || node.kind === 157) {
+ if (node.kind === 153 || node.kind === 158) {
write("new ");
}
- else if (node.kind === 156) {
+ else if (node.kind === 157) {
var currentOutput = writer.getText();
if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") {
closeParenthesizedFunctionType = true;
@@ -43881,20 +45458,20 @@ var ts;
write("(");
}
emitCommaList(node.parameters, emitParameterDeclaration);
- if (node.kind === 153) {
+ if (node.kind === 154) {
write("]");
}
else {
write(")");
}
- var isFunctionTypeOrConstructorType = node.kind === 156 || node.kind === 157;
- if (isFunctionTypeOrConstructorType || node.parent.kind === 159) {
+ var isFunctionTypeOrConstructorType = node.kind === 157 || node.kind === 158;
+ if (isFunctionTypeOrConstructorType || node.parent.kind === 160) {
if (node.type) {
write(isFunctionTypeOrConstructorType ? " => " : ": ");
emitType(node.type);
}
}
- else if (node.kind !== 148 && !ts.hasModifier(node, 8)) {
+ else if (node.kind !== 149 && !ts.hasModifier(node, 8)) {
writeReturnTypeAtSignature(node, getReturnTypeVisibilityError);
}
enclosingDeclaration = prevEnclosingDeclaration;
@@ -43908,23 +45485,23 @@ var ts;
function getReturnTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
switch (node.kind) {
- case 152:
+ case 153:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 151:
+ case 152:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 153:
+ case 154:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
+ case 148:
case 147:
- case 146:
if (ts.hasModifier(node, 32)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
@@ -43932,7 +45509,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 === 221) {
+ else if (node.parent.kind === 222) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -43945,7 +45522,7 @@ var ts;
ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
}
break;
- case 220:
+ case 221:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -43977,9 +45554,9 @@ var ts;
write("?");
}
decreaseIndent();
- if (node.parent.kind === 156 ||
- node.parent.kind === 157 ||
- node.parent.parent.kind === 159) {
+ if (node.parent.kind === 157 ||
+ node.parent.kind === 158 ||
+ node.parent.parent.kind === 160) {
emitTypeOfVariableDeclarationFromTypeLiteral(node);
}
else if (!ts.hasModifier(node.parent, 8)) {
@@ -43995,22 +45572,22 @@ var ts;
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
switch (node.parent.kind) {
- case 148:
+ case 149:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
- case 152:
+ case 153:
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 151:
+ case 152:
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
+ case 148:
case 147:
- case 146:
if (ts.hasModifier(node.parent, 32)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
@@ -44018,7 +45595,7 @@ var ts;
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 221) {
+ else if (node.parent.parent.kind === 222) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -44030,7 +45607,7 @@ var ts;
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
- case 220:
+ case 221:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -44041,12 +45618,12 @@ var ts;
}
}
function emitBindingPattern(bindingPattern) {
- if (bindingPattern.kind === 167) {
+ if (bindingPattern.kind === 168) {
write("{");
emitCommaList(bindingPattern.elements, emitBindingElement);
write("}");
}
- else if (bindingPattern.kind === 168) {
+ else if (bindingPattern.kind === 169) {
write("[");
var elements = bindingPattern.elements;
emitCommaList(elements, emitBindingElement);
@@ -44057,10 +45634,10 @@ var ts;
}
}
function emitBindingElement(bindingElement) {
- if (bindingElement.kind === 193) {
+ if (bindingElement.kind === 194) {
write(" ");
}
- else if (bindingElement.kind === 169) {
+ else if (bindingElement.kind === 170) {
if (bindingElement.propertyName) {
writeTextOfNode(currentText, bindingElement.propertyName);
write(": ");
@@ -44070,7 +45647,7 @@ var ts;
emitBindingPattern(bindingElement.name);
}
else {
- ts.Debug.assert(bindingElement.name.kind === 69);
+ ts.Debug.assert(bindingElement.name.kind === 70);
if (bindingElement.dotDotDotToken) {
write("...");
}
@@ -44082,37 +45659,37 @@ var ts;
}
function emitNode(node) {
switch (node.kind) {
- case 220:
- case 225:
- case 229:
- case 222:
case 221:
+ case 226:
+ case 230:
case 223:
+ case 222:
case 224:
+ case 225:
return emitModuleElement(node, isModuleElementVisible(node));
- case 200:
+ case 201:
return emitModuleElement(node, isVariableStatementVisible(node));
- case 230:
+ case 231:
return emitModuleElement(node, !node.importClause);
- case 236:
+ case 237:
return emitExportDeclaration(node);
+ case 149:
case 148:
case 147:
- case 146:
return writeFunctionDeclaration(node);
- case 152:
- case 151:
case 153:
+ case 152:
+ case 154:
return emitSignatureDeclarationWithJsDocComments(node);
- case 149:
case 150:
+ case 151:
return emitAccessorDeclaration(node);
+ case 146:
case 145:
- case 144:
return emitPropertyDeclaration(node);
case 255:
return emitEnumMemberDeclaration(node);
- case 235:
+ case 236:
return emitExportAssignment(node);
case 256:
return emitSourceFile(node);
@@ -44132,7 +45709,7 @@ var ts;
referencesOutput += "/// " + newLine;
}
return addedBundledEmitReference;
- function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) {
+ function getDeclFileName(emitFileNames, _sourceFiles, isBundledEmit) {
if (isBundledEmit && !addBundledFileReference) {
return;
}
@@ -44169,8 +45746,14 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ var TempFlags;
+ (function (TempFlags) {
+ TempFlags[TempFlags["Auto"] = 0] = "Auto";
+ TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask";
+ TempFlags[TempFlags["_i"] = 268435456] = "_i";
+ })(TempFlags || (TempFlags = {}));
var id = function (s) { return s; };
- var nullTransformers = [function (ctx) { return id; }];
+ var nullTransformers = [function (_) { return id; }];
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) {
var delimiters = createDelimiterMap();
var brackets = createBracketsMap();
@@ -44348,191 +45931,205 @@ var ts;
function pipelineEmitInIdentifierNameContext(node) {
var kind = node.kind;
switch (kind) {
- case 69:
+ case 70:
return emitIdentifier(node);
}
}
function pipelineEmitInUnspecifiedContext(node) {
var kind = node.kind;
switch (kind) {
- case 12:
case 13:
case 14:
+ case 15:
return emitLiteral(node);
- case 69:
+ case 70:
return emitIdentifier(node);
- case 74:
- case 77:
- case 82:
- case 103:
- case 110:
+ case 75:
+ case 78:
+ case 83:
+ case 104:
case 111:
case 112:
case 113:
- case 115:
+ case 114:
+ case 116:
case 117:
case 118:
+ case 119:
case 120:
+ case 121:
case 122:
- case 130:
+ case 123:
+ case 124:
+ case 125:
+ case 126:
+ case 127:
case 128:
+ case 129:
+ case 130:
+ case 131:
case 132:
case 133:
+ case 134:
+ case 135:
+ case 136:
case 137:
+ case 138:
+ case 139:
writeTokenText(kind);
return;
- case 139:
- return emitQualifiedName(node);
case 140:
- return emitComputedPropertyName(node);
+ return emitQualifiedName(node);
case 141:
- return emitTypeParameter(node);
+ return emitComputedPropertyName(node);
case 142:
- return emitParameter(node);
+ return emitTypeParameter(node);
case 143:
- return emitDecorator(node);
+ return emitParameter(node);
case 144:
- return emitPropertySignature(node);
+ return emitDecorator(node);
case 145:
- return emitPropertyDeclaration(node);
+ return emitPropertySignature(node);
case 146:
- return emitMethodSignature(node);
+ return emitPropertyDeclaration(node);
case 147:
- return emitMethodDeclaration(node);
+ return emitMethodSignature(node);
case 148:
- return emitConstructor(node);
+ return emitMethodDeclaration(node);
case 149:
+ return emitConstructor(node);
case 150:
- return emitAccessorDeclaration(node);
case 151:
- return emitCallSignature(node);
+ return emitAccessorDeclaration(node);
case 152:
- return emitConstructSignature(node);
+ return emitCallSignature(node);
case 153:
- return emitIndexSignature(node);
+ return emitConstructSignature(node);
case 154:
- return emitTypePredicate(node);
+ return emitIndexSignature(node);
case 155:
- return emitTypeReference(node);
+ return emitTypePredicate(node);
case 156:
- return emitFunctionType(node);
+ return emitTypeReference(node);
case 157:
- return emitConstructorType(node);
+ return emitFunctionType(node);
case 158:
- return emitTypeQuery(node);
+ return emitConstructorType(node);
case 159:
- return emitTypeLiteral(node);
+ return emitTypeQuery(node);
case 160:
- return emitArrayType(node);
+ return emitTypeLiteral(node);
case 161:
- return emitTupleType(node);
+ return emitArrayType(node);
case 162:
- return emitUnionType(node);
+ return emitTupleType(node);
case 163:
- return emitIntersectionType(node);
+ return emitUnionType(node);
case 164:
+ return emitIntersectionType(node);
+ case 165:
return emitParenthesizedType(node);
- case 194:
+ case 195:
return emitExpressionWithTypeArguments(node);
- case 165:
- return emitThisType(node);
case 166:
- return emitLiteralType(node);
+ return emitThisType();
case 167:
- return emitObjectBindingPattern(node);
+ return emitLiteralType(node);
case 168:
- return emitArrayBindingPattern(node);
+ return emitObjectBindingPattern(node);
case 169:
+ return emitArrayBindingPattern(node);
+ case 170:
return emitBindingElement(node);
- case 197:
- return emitTemplateSpan(node);
case 198:
- return emitSemicolonClassElement(node);
+ return emitTemplateSpan(node);
case 199:
- return emitBlock(node);
+ return emitSemicolonClassElement();
case 200:
- return emitVariableStatement(node);
+ return emitBlock(node);
case 201:
- return emitEmptyStatement(node);
+ return emitVariableStatement(node);
case 202:
- return emitExpressionStatement(node);
+ return emitEmptyStatement();
case 203:
- return emitIfStatement(node);
+ return emitExpressionStatement(node);
case 204:
- return emitDoStatement(node);
+ return emitIfStatement(node);
case 205:
- return emitWhileStatement(node);
+ return emitDoStatement(node);
case 206:
- return emitForStatement(node);
+ return emitWhileStatement(node);
case 207:
- return emitForInStatement(node);
+ return emitForStatement(node);
case 208:
- return emitForOfStatement(node);
+ return emitForInStatement(node);
case 209:
- return emitContinueStatement(node);
+ return emitForOfStatement(node);
case 210:
- return emitBreakStatement(node);
+ return emitContinueStatement(node);
case 211:
- return emitReturnStatement(node);
+ return emitBreakStatement(node);
case 212:
- return emitWithStatement(node);
+ return emitReturnStatement(node);
case 213:
- return emitSwitchStatement(node);
+ return emitWithStatement(node);
case 214:
- return emitLabeledStatement(node);
+ return emitSwitchStatement(node);
case 215:
- return emitThrowStatement(node);
+ return emitLabeledStatement(node);
case 216:
- return emitTryStatement(node);
+ return emitThrowStatement(node);
case 217:
- return emitDebuggerStatement(node);
+ return emitTryStatement(node);
case 218:
- return emitVariableDeclaration(node);
+ return emitDebuggerStatement(node);
case 219:
- return emitVariableDeclarationList(node);
+ return emitVariableDeclaration(node);
case 220:
- return emitFunctionDeclaration(node);
+ return emitVariableDeclarationList(node);
case 221:
- return emitClassDeclaration(node);
+ return emitFunctionDeclaration(node);
case 222:
- return emitInterfaceDeclaration(node);
+ return emitClassDeclaration(node);
case 223:
- return emitTypeAliasDeclaration(node);
+ return emitInterfaceDeclaration(node);
case 224:
- return emitEnumDeclaration(node);
+ return emitTypeAliasDeclaration(node);
case 225:
- return emitModuleDeclaration(node);
+ return emitEnumDeclaration(node);
case 226:
- return emitModuleBlock(node);
+ return emitModuleDeclaration(node);
case 227:
+ return emitModuleBlock(node);
+ case 228:
return emitCaseBlock(node);
- case 229:
- return emitImportEqualsDeclaration(node);
case 230:
- return emitImportDeclaration(node);
+ return emitImportEqualsDeclaration(node);
case 231:
- return emitImportClause(node);
+ return emitImportDeclaration(node);
case 232:
- return emitNamespaceImport(node);
+ return emitImportClause(node);
case 233:
- return emitNamedImports(node);
+ return emitNamespaceImport(node);
case 234:
- return emitImportSpecifier(node);
+ return emitNamedImports(node);
case 235:
- return emitExportAssignment(node);
+ return emitImportSpecifier(node);
case 236:
- return emitExportDeclaration(node);
+ return emitExportAssignment(node);
case 237:
- return emitNamedExports(node);
+ return emitExportDeclaration(node);
case 238:
- return emitExportSpecifier(node);
+ return emitNamedExports(node);
case 239:
- return;
+ return emitExportSpecifier(node);
case 240:
+ return;
+ case 241:
return emitExternalModuleReference(node);
- case 244:
+ case 10:
return emitJsxText(node);
- case 243:
+ case 244:
return emitJsxOpeningElement(node);
case 245:
return emitJsxClosingElement(node);
@@ -44567,73 +46164,73 @@ var ts;
case 8:
return emitNumericLiteral(node);
case 9:
- case 10:
case 11:
+ case 12:
return emitLiteral(node);
- case 69:
+ case 70:
return emitIdentifier(node);
- case 84:
- case 93:
- case 95:
- case 99:
- case 97:
+ case 85:
+ case 94:
+ case 96:
+ case 100:
+ case 98:
writeTokenText(kind);
return;
- case 170:
- return emitArrayLiteralExpression(node);
case 171:
- return emitObjectLiteralExpression(node);
+ return emitArrayLiteralExpression(node);
case 172:
- return emitPropertyAccessExpression(node);
+ return emitObjectLiteralExpression(node);
case 173:
- return emitElementAccessExpression(node);
+ return emitPropertyAccessExpression(node);
case 174:
- return emitCallExpression(node);
+ return emitElementAccessExpression(node);
case 175:
- return emitNewExpression(node);
+ return emitCallExpression(node);
case 176:
- return emitTaggedTemplateExpression(node);
+ return emitNewExpression(node);
case 177:
- return emitTypeAssertionExpression(node);
+ return emitTaggedTemplateExpression(node);
case 178:
- return emitParenthesizedExpression(node);
+ return emitTypeAssertionExpression(node);
case 179:
- return emitFunctionExpression(node);
+ return emitParenthesizedExpression(node);
case 180:
- return emitArrowFunction(node);
+ return emitFunctionExpression(node);
case 181:
- return emitDeleteExpression(node);
+ return emitArrowFunction(node);
case 182:
- return emitTypeOfExpression(node);
+ return emitDeleteExpression(node);
case 183:
- return emitVoidExpression(node);
+ return emitTypeOfExpression(node);
case 184:
- return emitAwaitExpression(node);
+ return emitVoidExpression(node);
case 185:
- return emitPrefixUnaryExpression(node);
+ return emitAwaitExpression(node);
case 186:
- return emitPostfixUnaryExpression(node);
+ return emitPrefixUnaryExpression(node);
case 187:
- return emitBinaryExpression(node);
+ return emitPostfixUnaryExpression(node);
case 188:
- return emitConditionalExpression(node);
+ return emitBinaryExpression(node);
case 189:
- return emitTemplateExpression(node);
+ return emitConditionalExpression(node);
case 190:
- return emitYieldExpression(node);
+ return emitTemplateExpression(node);
case 191:
- return emitSpreadElementExpression(node);
+ return emitYieldExpression(node);
case 192:
- return emitClassExpression(node);
+ return emitSpreadElementExpression(node);
case 193:
+ return emitClassExpression(node);
+ case 194:
return;
- case 195:
- return emitAsExpression(node);
case 196:
+ return emitAsExpression(node);
+ case 197:
return emitNonNullExpression(node);
- case 241:
- return emitJsxElement(node);
case 242:
+ return emitJsxElement(node);
+ case 243:
return emitJsxSelfClosingElement(node);
case 288:
return emitPartiallyEmittedExpression(node);
@@ -44669,7 +46266,7 @@ var ts;
emit(node.right);
}
function emitEntityName(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
emitExpression(node);
}
else {
@@ -44739,7 +46336,7 @@ var ts;
function emitAccessorDeclaration(node) {
emitDecorators(node, node.decorators);
emitModifiers(node, node.modifiers);
- write(node.kind === 149 ? "get " : "set ");
+ write(node.kind === 150 ? "get " : "set ");
emit(node.name);
emitSignatureAndBody(node, emitSignatureHead);
}
@@ -44767,7 +46364,7 @@ var ts;
emitWithPrefix(": ", node.type);
write(";");
}
- function emitSemicolonClassElement(node) {
+ function emitSemicolonClassElement() {
write(";");
}
function emitTypePredicate(node) {
@@ -44821,7 +46418,7 @@ var ts;
emit(node.type);
write(")");
}
- function emitThisType(node) {
+ function emitThisType() {
write("this");
}
function emitLiteralType(node) {
@@ -44889,7 +46486,7 @@ var ts;
if (!(ts.getEmitFlags(node) & 1048576)) {
var dotRangeStart = node.expression.end;
var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1;
- var dotToken = { kind: 21, pos: dotRangeStart, end: dotRangeEnd };
+ var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd };
indentBeforeDot = needsIndentation(node, node.expression, dotToken);
indentAfterDot = needsIndentation(node, dotToken, node.name);
}
@@ -44904,7 +46501,7 @@ var ts;
function needsDotDotForPropertyAccess(expression) {
if (expression.kind === 8) {
var text = getLiteralTextOfNode(expression);
- return text.indexOf(ts.tokenToString(21)) < 0;
+ return text.indexOf(ts.tokenToString(22)) < 0;
}
else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) {
var constantValue = ts.getConstantValue(expression);
@@ -44921,11 +46518,13 @@ var ts;
}
function emitCallExpression(node) {
emitExpression(node.expression);
+ emitTypeArguments(node, node.typeArguments);
emitExpressionList(node, node.arguments, 1296);
}
function emitNewExpression(node) {
write("new ");
emitExpression(node.expression);
+ emitTypeArguments(node, node.typeArguments);
emitExpressionList(node, node.arguments, 9488);
}
function emitTaggedTemplateExpression(node) {
@@ -44985,16 +46584,16 @@ var ts;
}
function shouldEmitWhitespaceBeforeOperand(node) {
var operand = node.operand;
- return operand.kind === 185
- && ((node.operator === 35 && (operand.operator === 35 || operand.operator === 41))
- || (node.operator === 36 && (operand.operator === 36 || operand.operator === 42)));
+ return operand.kind === 186
+ && ((node.operator === 36 && (operand.operator === 36 || operand.operator === 42))
+ || (node.operator === 37 && (operand.operator === 37 || operand.operator === 43)));
}
function emitPostfixUnaryExpression(node) {
emitExpression(node.operand);
writeTokenText(node.operator);
}
function emitBinaryExpression(node) {
- var isCommaOperator = node.operatorToken.kind !== 24;
+ var isCommaOperator = node.operatorToken.kind !== 25;
var indentBeforeOperator = needsIndentation(node, node.left, node.operatorToken);
var indentAfterOperator = needsIndentation(node, node.operatorToken, node.right);
emitExpression(node.left);
@@ -45055,16 +46654,16 @@ var ts;
emitExpression(node.expression);
emit(node.literal);
}
- function emitBlock(node, format) {
+ function emitBlock(node) {
if (isSingleLineEmptyBlock(node)) {
- writeToken(15, node.pos, node);
+ writeToken(16, node.pos, node);
write(" ");
- writeToken(16, node.statements.end, node);
+ writeToken(17, node.statements.end, node);
}
else {
- writeToken(15, node.pos, node);
+ writeToken(16, node.pos, node);
emitBlockStatements(node);
- writeToken(16, node.statements.end, node);
+ writeToken(17, node.statements.end, node);
}
}
function emitBlockStatements(node) {
@@ -45080,7 +46679,7 @@ var ts;
emit(node.declarationList);
write(";");
}
- function emitEmptyStatement(node) {
+ function emitEmptyStatement() {
write(";");
}
function emitExpressionStatement(node) {
@@ -45088,16 +46687,16 @@ var ts;
write(";");
}
function emitIfStatement(node) {
- var openParenPos = writeToken(88, node.pos, node);
+ var openParenPos = writeToken(89, node.pos, node);
write(" ");
- writeToken(17, openParenPos, node);
+ writeToken(18, openParenPos, node);
emitExpression(node.expression);
- writeToken(18, node.expression.end, node);
+ writeToken(19, node.expression.end, node);
emitEmbeddedStatement(node.thenStatement);
if (node.elseStatement) {
writeLine();
- writeToken(80, node.thenStatement.end, node);
- if (node.elseStatement.kind === 203) {
+ writeToken(81, node.thenStatement.end, node);
+ if (node.elseStatement.kind === 204) {
write(" ");
emit(node.elseStatement);
}
@@ -45126,9 +46725,9 @@ var ts;
emitEmbeddedStatement(node.statement);
}
function emitForStatement(node) {
- var openParenPos = writeToken(86, node.pos);
+ var openParenPos = writeToken(87, node.pos);
write(" ");
- writeToken(17, openParenPos, node);
+ writeToken(18, openParenPos, node);
emitForBinding(node.initializer);
write(";");
emitExpressionWithPrefix(" ", node.condition);
@@ -45138,28 +46737,28 @@ var ts;
emitEmbeddedStatement(node.statement);
}
function emitForInStatement(node) {
- var openParenPos = writeToken(86, node.pos);
+ var openParenPos = writeToken(87, node.pos);
write(" ");
- writeToken(17, openParenPos);
+ writeToken(18, openParenPos);
emitForBinding(node.initializer);
write(" in ");
emitExpression(node.expression);
- writeToken(18, node.expression.end);
+ writeToken(19, node.expression.end);
emitEmbeddedStatement(node.statement);
}
function emitForOfStatement(node) {
- var openParenPos = writeToken(86, node.pos);
+ var openParenPos = writeToken(87, node.pos);
write(" ");
- writeToken(17, openParenPos);
+ writeToken(18, openParenPos);
emitForBinding(node.initializer);
write(" of ");
emitExpression(node.expression);
- writeToken(18, node.expression.end);
+ writeToken(19, node.expression.end);
emitEmbeddedStatement(node.statement);
}
function emitForBinding(node) {
if (node !== undefined) {
- if (node.kind === 219) {
+ if (node.kind === 220) {
emit(node);
}
else {
@@ -45168,17 +46767,17 @@ var ts;
}
}
function emitContinueStatement(node) {
- writeToken(75, node.pos);
+ writeToken(76, node.pos);
emitWithPrefix(" ", node.label);
write(";");
}
function emitBreakStatement(node) {
- writeToken(70, node.pos);
+ writeToken(71, node.pos);
emitWithPrefix(" ", node.label);
write(";");
}
function emitReturnStatement(node) {
- writeToken(94, node.pos, node);
+ writeToken(95, node.pos, node);
emitExpressionWithPrefix(" ", node.expression);
write(";");
}
@@ -45189,11 +46788,11 @@ var ts;
emitEmbeddedStatement(node.statement);
}
function emitSwitchStatement(node) {
- var openParenPos = writeToken(96, node.pos);
+ var openParenPos = writeToken(97, node.pos);
write(" ");
- writeToken(17, openParenPos);
+ writeToken(18, openParenPos);
emitExpression(node.expression);
- writeToken(18, node.expression.end);
+ writeToken(19, node.expression.end);
write(" ");
emit(node.caseBlock);
}
@@ -45218,11 +46817,12 @@ var ts;
}
}
function emitDebuggerStatement(node) {
- writeToken(76, node.pos);
+ writeToken(77, node.pos);
write(";");
}
function emitVariableDeclaration(node) {
emit(node.name);
+ emitWithPrefix(": ", node.type);
emitExpressionWithPrefix(" = ", node.initializer);
}
function emitVariableDeclarationList(node) {
@@ -45249,13 +46849,13 @@ var ts;
}
if (ts.getEmitFlags(node) & 4194304) {
emitSignatureHead(node);
- emitBlockFunctionBody(node, body);
+ emitBlockFunctionBody(body);
}
else {
var savedTempFlags = tempFlags;
tempFlags = 0;
emitSignatureHead(node);
- emitBlockFunctionBody(node, body);
+ emitBlockFunctionBody(body);
tempFlags = savedTempFlags;
}
if (indentedFlag) {
@@ -45278,7 +46878,7 @@ var ts;
emitParameters(node, node.parameters);
emitWithPrefix(": ", node.type);
}
- function shouldEmitBlockFunctionBodyOnSingleLine(parentNode, body) {
+ function shouldEmitBlockFunctionBodyOnSingleLine(body) {
if (ts.getEmitFlags(body) & 32) {
return true;
}
@@ -45302,14 +46902,14 @@ var ts;
}
return true;
}
- function emitBlockFunctionBody(parentNode, body) {
+ function emitBlockFunctionBody(body) {
write(" {");
increaseIndent();
- emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(parentNode, body)
+ emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(body)
? emitBlockFunctionBodyOnSingleLine
: emitBlockFunctionBodyWorker);
decreaseIndent();
- writeToken(16, body.statements.end, body);
+ writeToken(17, body.statements.end, body);
}
function emitBlockFunctionBodyOnSingleLine(body) {
emitBlockFunctionBodyWorker(body, true);
@@ -45387,7 +46987,7 @@ var ts;
write(node.flags & 16 ? "namespace " : "module ");
emit(node.name);
var body = node.body;
- while (body.kind === 225) {
+ while (body.kind === 226) {
write(".");
emit(body.name);
body = body.body;
@@ -45410,9 +47010,9 @@ var ts;
}
}
function emitCaseBlock(node) {
- writeToken(15, node.pos);
+ writeToken(16, node.pos);
emitList(node, node.clauses, 65);
- writeToken(16, node.clauses.end);
+ writeToken(17, node.clauses.end);
}
function emitImportEqualsDeclaration(node) {
emitModifiers(node, node.modifiers);
@@ -45423,7 +47023,7 @@ var ts;
write(";");
}
function emitModuleReference(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
emitExpression(node);
}
else {
@@ -45543,7 +47143,7 @@ var ts;
}
}
function emitJsxTagName(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
emitExpression(node);
}
else {
@@ -45581,11 +47181,11 @@ var ts;
}
function emitCatchClause(node) {
writeLine();
- var openParenPos = writeToken(72, node.pos);
+ var openParenPos = writeToken(73, node.pos);
write(" ");
- writeToken(17, openParenPos);
+ writeToken(18, openParenPos);
emit(node.variableDeclaration);
- writeToken(18, node.variableDeclaration ? node.variableDeclaration.end : openParenPos);
+ writeToken(19, node.variableDeclaration ? node.variableDeclaration.end : openParenPos);
write(" ");
emit(node.block);
}
@@ -45692,7 +47292,7 @@ var ts;
paramEmitted = true;
helpersEmitted = true;
}
- if (!awaiterEmitted && node.flags & 8192) {
+ if ((languageVersion < 4) && (!awaiterEmitted && node.flags & 8192)) {
writeLines(awaiterHelper);
if (languageVersion < 2) {
writeLines(generatorHelper);
@@ -46001,7 +47601,7 @@ var ts;
&& !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile);
}
function skipSynthesizedParentheses(node) {
- while (node.kind === 178 && ts.nodeIsSynthesized(node)) {
+ while (node.kind === 179 && ts.nodeIsSynthesized(node)) {
node = node.expression;
}
return node;
@@ -46108,19 +47708,19 @@ var ts;
}
function generateNameForNode(node) {
switch (node.kind) {
- case 69:
+ case 70:
return makeUniqueName(getTextOfNode(node));
+ case 226:
case 225:
- case 224:
return generateNameForModuleOrEnum(node);
- case 230:
- case 236:
+ case 231:
+ case 237:
return generateNameForImportOrExportDeclaration(node);
- case 220:
case 221:
- case 235:
+ case 222:
+ case 236:
return generateNameForExportDefault();
- case 192:
+ case 193:
return generateNameForClassExpression();
default:
return makeTempVariableName(0);
@@ -46190,6 +47790,68 @@ var ts;
}
}
ts.emitFiles = emitFiles;
+ var ListFormat;
+ (function (ListFormat) {
+ ListFormat[ListFormat["None"] = 0] = "None";
+ ListFormat[ListFormat["SingleLine"] = 0] = "SingleLine";
+ ListFormat[ListFormat["MultiLine"] = 1] = "MultiLine";
+ ListFormat[ListFormat["PreserveLines"] = 2] = "PreserveLines";
+ ListFormat[ListFormat["LinesMask"] = 3] = "LinesMask";
+ ListFormat[ListFormat["NotDelimited"] = 0] = "NotDelimited";
+ ListFormat[ListFormat["BarDelimited"] = 4] = "BarDelimited";
+ ListFormat[ListFormat["AmpersandDelimited"] = 8] = "AmpersandDelimited";
+ ListFormat[ListFormat["CommaDelimited"] = 16] = "CommaDelimited";
+ ListFormat[ListFormat["DelimitersMask"] = 28] = "DelimitersMask";
+ ListFormat[ListFormat["AllowTrailingComma"] = 32] = "AllowTrailingComma";
+ ListFormat[ListFormat["Indented"] = 64] = "Indented";
+ ListFormat[ListFormat["SpaceBetweenBraces"] = 128] = "SpaceBetweenBraces";
+ ListFormat[ListFormat["SpaceBetweenSiblings"] = 256] = "SpaceBetweenSiblings";
+ ListFormat[ListFormat["Braces"] = 512] = "Braces";
+ ListFormat[ListFormat["Parenthesis"] = 1024] = "Parenthesis";
+ ListFormat[ListFormat["AngleBrackets"] = 2048] = "AngleBrackets";
+ ListFormat[ListFormat["SquareBrackets"] = 4096] = "SquareBrackets";
+ ListFormat[ListFormat["BracketsMask"] = 7680] = "BracketsMask";
+ ListFormat[ListFormat["OptionalIfUndefined"] = 8192] = "OptionalIfUndefined";
+ ListFormat[ListFormat["OptionalIfEmpty"] = 16384] = "OptionalIfEmpty";
+ ListFormat[ListFormat["Optional"] = 24576] = "Optional";
+ ListFormat[ListFormat["PreferNewLine"] = 32768] = "PreferNewLine";
+ ListFormat[ListFormat["NoTrailingNewLine"] = 65536] = "NoTrailingNewLine";
+ ListFormat[ListFormat["NoInterveningComments"] = 131072] = "NoInterveningComments";
+ ListFormat[ListFormat["Modifiers"] = 256] = "Modifiers";
+ ListFormat[ListFormat["HeritageClauses"] = 256] = "HeritageClauses";
+ ListFormat[ListFormat["TypeLiteralMembers"] = 65] = "TypeLiteralMembers";
+ ListFormat[ListFormat["TupleTypeElements"] = 336] = "TupleTypeElements";
+ ListFormat[ListFormat["UnionTypeConstituents"] = 260] = "UnionTypeConstituents";
+ ListFormat[ListFormat["IntersectionTypeConstituents"] = 264] = "IntersectionTypeConstituents";
+ ListFormat[ListFormat["ObjectBindingPatternElements"] = 432] = "ObjectBindingPatternElements";
+ ListFormat[ListFormat["ArrayBindingPatternElements"] = 304] = "ArrayBindingPatternElements";
+ ListFormat[ListFormat["ObjectLiteralExpressionProperties"] = 978] = "ObjectLiteralExpressionProperties";
+ ListFormat[ListFormat["ArrayLiteralExpressionElements"] = 4466] = "ArrayLiteralExpressionElements";
+ ListFormat[ListFormat["CallExpressionArguments"] = 1296] = "CallExpressionArguments";
+ ListFormat[ListFormat["NewExpressionArguments"] = 9488] = "NewExpressionArguments";
+ ListFormat[ListFormat["TemplateExpressionSpans"] = 131072] = "TemplateExpressionSpans";
+ ListFormat[ListFormat["SingleLineBlockStatements"] = 384] = "SingleLineBlockStatements";
+ ListFormat[ListFormat["MultiLineBlockStatements"] = 65] = "MultiLineBlockStatements";
+ ListFormat[ListFormat["VariableDeclarationList"] = 272] = "VariableDeclarationList";
+ ListFormat[ListFormat["SingleLineFunctionBodyStatements"] = 384] = "SingleLineFunctionBodyStatements";
+ ListFormat[ListFormat["MultiLineFunctionBodyStatements"] = 1] = "MultiLineFunctionBodyStatements";
+ ListFormat[ListFormat["ClassHeritageClauses"] = 256] = "ClassHeritageClauses";
+ ListFormat[ListFormat["ClassMembers"] = 65] = "ClassMembers";
+ ListFormat[ListFormat["InterfaceMembers"] = 65] = "InterfaceMembers";
+ ListFormat[ListFormat["EnumMembers"] = 81] = "EnumMembers";
+ ListFormat[ListFormat["CaseBlockClauses"] = 65] = "CaseBlockClauses";
+ ListFormat[ListFormat["NamedImportsOrExportsElements"] = 432] = "NamedImportsOrExportsElements";
+ ListFormat[ListFormat["JsxElementChildren"] = 131072] = "JsxElementChildren";
+ ListFormat[ListFormat["JsxElementAttributes"] = 131328] = "JsxElementAttributes";
+ ListFormat[ListFormat["CaseOrDefaultClauseStatements"] = 81985] = "CaseOrDefaultClauseStatements";
+ ListFormat[ListFormat["HeritageClauseTypes"] = 272] = "HeritageClauseTypes";
+ ListFormat[ListFormat["SourceFileStatements"] = 65537] = "SourceFileStatements";
+ ListFormat[ListFormat["Decorators"] = 24577] = "Decorators";
+ ListFormat[ListFormat["TypeArguments"] = 26960] = "TypeArguments";
+ ListFormat[ListFormat["TypeParameters"] = 26960] = "TypeParameters";
+ ListFormat[ListFormat["Parameters"] = 1360] = "Parameters";
+ ListFormat[ListFormat["IndexSignatureParameters"] = 4432] = "IndexSignatureParameters";
+ })(ListFormat || (ListFormat = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -46643,7 +48305,7 @@ var ts;
getSourceFiles: program.getSourceFiles,
isSourceFileFromExternalLibrary: function (file) { return !!sourceFilesFoundSearchingNodeModules[file.path]; },
writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
- isEmitBlocked: isEmitBlocked
+ isEmitBlocked: isEmitBlocked,
};
}
function getDiagnosticsProducingTypeChecker() {
@@ -46721,7 +48383,7 @@ var ts;
return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
}
}
- function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) {
+ function getSyntacticDiagnosticsForFile(sourceFile) {
return sourceFile.parseDiagnostics;
}
function runWithCancellationToken(func) {
@@ -46742,14 +48404,14 @@ var ts;
ts.Debug.assert(!!sourceFile.bindDiagnostics);
var bindDiagnostics = sourceFile.bindDiagnostics;
var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ?
- getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) :
+ getJavaScriptSemanticDiagnosticsForFile(sourceFile) :
typeChecker.getDiagnostics(sourceFile, cancellationToken);
var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
- return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile);
+ return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile);
});
}
- function getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) {
+ function getJavaScriptSemanticDiagnosticsForFile(sourceFile) {
return runWithCancellationToken(function () {
var diagnostics = [];
walk(sourceFile);
@@ -46759,16 +48421,16 @@ var ts;
return false;
}
switch (node.kind) {
- case 229:
+ case 230:
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));
return true;
- case 235:
+ case 236:
if (node.isExportEquals) {
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));
return true;
}
break;
- case 221:
+ case 222:
var classDeclaration = node;
if (checkModifiers(classDeclaration.modifiers) ||
checkTypeParameters(classDeclaration.typeParameters)) {
@@ -46777,29 +48439,29 @@ var ts;
break;
case 251:
var heritageClause = node;
- if (heritageClause.token === 106) {
+ if (heritageClause.token === 107) {
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
return true;
}
break;
- case 222:
+ case 223:
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
return true;
- case 225:
+ case 226:
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
return true;
- case 223:
+ case 224:
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
return true;
- case 147:
- case 146:
case 148:
+ case 147:
case 149:
case 150:
- case 179:
- case 220:
+ case 151:
case 180:
- case 220:
+ case 221:
+ case 181:
+ case 221:
var functionDeclaration = node;
if (checkModifiers(functionDeclaration.modifiers) ||
checkTypeParameters(functionDeclaration.typeParameters) ||
@@ -46807,20 +48469,20 @@ var ts;
return true;
}
break;
- case 200:
+ case 201:
var variableStatement = node;
if (checkModifiers(variableStatement.modifiers)) {
return true;
}
break;
- case 218:
+ case 219:
var variableDeclaration = node;
if (checkTypeAnnotation(variableDeclaration.type)) {
return true;
}
break;
- case 174:
case 175:
+ case 176:
var expression = node;
if (expression.typeArguments && expression.typeArguments.length > 0) {
var start = expression.typeArguments.pos;
@@ -46828,7 +48490,7 @@ var ts;
return true;
}
break;
- case 142:
+ case 143:
var parameter = node;
if (parameter.modifiers) {
var start = parameter.modifiers.pos;
@@ -46844,12 +48506,12 @@ var ts;
return true;
}
break;
- case 145:
+ case 146:
var propertyDeclaration = node;
if (propertyDeclaration.modifiers) {
for (var _i = 0, _a = propertyDeclaration.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 113) {
+ if (modifier.kind !== 114) {
diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
return true;
}
@@ -46859,14 +48521,14 @@ var ts;
return true;
}
break;
- case 224:
+ case 225:
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
return true;
- case 177:
+ case 178:
var typeAssertionExpression = node;
diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
return true;
- case 143:
+ case 144:
if (!options.experimentalDecorators) {
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
}
@@ -46894,18 +48556,18 @@ var ts;
for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {
var modifier = modifiers_1[_i];
switch (modifier.kind) {
- case 112:
- case 110:
+ case 113:
case 111:
- case 128:
- case 122:
+ case 112:
+ case 129:
+ case 123:
diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
return true;
- case 113:
- case 82:
- case 74:
- case 77:
- case 115:
+ case 114:
+ case 83:
+ case 75:
+ case 78:
+ case 116:
}
}
}
@@ -46938,7 +48600,7 @@ var ts;
return ts.getBaseFileName(fileName).indexOf(".") >= 0;
}
function processRootFile(fileName, isDefaultLib) {
- processSourceFile(ts.normalizePath(fileName), isDefaultLib, true);
+ processSourceFile(ts.normalizePath(fileName), isDefaultLib);
}
function fileReferenceIsEqualTo(a, b) {
return a.fileName === b.fileName;
@@ -46977,9 +48639,9 @@ var ts;
return;
function collectModuleReferences(node, inAmbientModule) {
switch (node.kind) {
+ case 231:
case 230:
- case 229:
- case 236:
+ case 237:
var moduleNameExpr = ts.getExternalModuleName(node);
if (!moduleNameExpr || moduleNameExpr.kind !== 9) {
break;
@@ -46991,7 +48653,7 @@ var ts;
(imports || (imports = [])).push(moduleNameExpr);
}
break;
- case 225:
+ case 226:
if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) {
var moduleName = node.name;
if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) {
@@ -47018,7 +48680,7 @@ var ts;
}
}
}
- function processSourceFile(fileName, isDefaultLib, isReference, refFile, refPos, refEnd) {
+ function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {
var diagnosticArgument;
var diagnostic;
if (hasExtension(fileName)) {
@@ -47026,7 +48688,7 @@ var ts;
diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;
diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"];
}
- else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) {
+ else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) {
diagnostic = ts.Diagnostics.File_0_not_found;
diagnosticArgument = [fileName];
}
@@ -47036,13 +48698,13 @@ var ts;
}
}
else {
- var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd);
+ var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd);
if (!nonTsFile) {
if (options.allowNonTsExtensions) {
diagnostic = ts.Diagnostics.File_0_not_found;
diagnosticArgument = [fileName];
}
- else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) {
+ else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) {
diagnostic = ts.Diagnostics.File_0_not_found;
fileName += ".ts";
diagnosticArgument = [fileName];
@@ -47066,7 +48728,7 @@ var ts;
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName));
}
}
- function findSourceFile(fileName, path, isDefaultLib, isReference, refFile, refPos, refEnd) {
+ function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) {
if (filesByName.contains(path)) {
var file_1 = filesByName.get(path);
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
@@ -47075,16 +48737,16 @@ var ts;
if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) {
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
if (!options.noResolve) {
- processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
+ processReferencedFiles(file_1, isDefaultLib);
processTypeReferenceDirectives(file_1);
}
modulesWithElidedImports[file_1.path] = false;
- processImportedModules(file_1, ts.getDirectoryPath(fileName));
+ processImportedModules(file_1);
}
else if (file_1 && modulesWithElidedImports[file_1.path]) {
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
modulesWithElidedImports[file_1.path] = false;
- processImportedModules(file_1, ts.getDirectoryPath(fileName));
+ processImportedModules(file_1);
}
}
return file_1;
@@ -47111,12 +48773,11 @@ var ts;
}
}
skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib;
- var basePath = ts.getDirectoryPath(fileName);
if (!options.noResolve) {
- processReferencedFiles(file, basePath, isDefaultLib);
+ processReferencedFiles(file, isDefaultLib);
processTypeReferenceDirectives(file);
}
- processImportedModules(file, basePath);
+ processImportedModules(file);
if (isDefaultLib) {
files.unshift(file);
}
@@ -47126,10 +48787,10 @@ var ts;
}
return file;
}
- function processReferencedFiles(file, basePath, isDefaultLib) {
+ function processReferencedFiles(file, isDefaultLib) {
ts.forEach(file.referencedFiles, function (ref) {
var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
- processSourceFile(referencedFileName, isDefaultLib, true, file, ref.pos, ref.end);
+ processSourceFile(referencedFileName, isDefaultLib, file, ref.pos, ref.end);
});
}
function processTypeReferenceDirectives(file) {
@@ -47151,7 +48812,7 @@ var ts;
var saveResolution = true;
if (resolvedTypeReferenceDirective) {
if (resolvedTypeReferenceDirective.primary) {
- processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd);
+ processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd);
}
else {
if (previousResolution) {
@@ -47162,7 +48823,7 @@ var ts;
saveResolution = false;
}
else {
- processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd);
+ processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd);
}
}
}
@@ -47188,7 +48849,7 @@ var ts;
function getCanonicalFileName(fileName) {
return host.getCanonicalFileName(fileName);
}
- function processImportedModules(file, basePath) {
+ function processImportedModules(file) {
collectExternalModuleReferences(file);
if (file.imports.length || file.moduleAugmentations.length) {
file.resolvedModules = ts.createMap();
@@ -47208,7 +48869,7 @@ var ts;
modulesWithElidedImports[file.path] = true;
}
else if (shouldAddFile) {
- findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
+ findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
}
if (isFromNodeModulesSearch) {
currentNodeModulesDepth--;
@@ -47378,7 +49039,7 @@ var ts;
if (!options.noEmit && !options.suppressOutputPathCheck) {
var emitHost = getEmitHost();
var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined);
- ts.forEachExpectedEmitFile(emitHost, function (emitFileNames, sourceFiles, isBundledEmit) {
+ ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) {
verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1);
verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1);
});
@@ -47387,10 +49048,10 @@ var ts;
if (emitFileName) {
var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName);
if (filesByName.contains(emitFilePath)) {
- createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file);
+ createEmitBlockingDiagnostics(emitFileName, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file);
}
if (emitFilesSeen.contains(emitFilePath)) {
- createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files);
+ createEmitBlockingDiagnostics(emitFileName, ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files);
}
else {
emitFilesSeen.set(emitFilePath, true);
@@ -47398,7 +49059,7 @@ var ts;
}
}
}
- function createEmitBlockingDiagnostics(emitFileName, emitFilePath, message) {
+ function createEmitBlockingDiagnostics(emitFileName, message) {
hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true);
programDiagnostics.add(ts.createCompilerDiagnostic(message, emitFileName));
}
@@ -47411,24 +49072,24 @@ var ts;
ts.optionDeclarations = [
{
name: "charset",
- type: "string"
+ type: "string",
},
ts.compileOnSaveCommandLineOption,
{
name: "declaration",
shortName: "d",
type: "boolean",
- description: ts.Diagnostics.Generates_corresponding_d_ts_file
+ description: ts.Diagnostics.Generates_corresponding_d_ts_file,
},
{
name: "declarationDir",
type: "string",
isFilePath: true,
- paramType: ts.Diagnostics.DIRECTORY
+ paramType: ts.Diagnostics.DIRECTORY,
},
{
name: "diagnostics",
- type: "boolean"
+ type: "boolean",
},
{
name: "extendedDiagnostics",
@@ -47443,7 +49104,7 @@ var ts;
name: "help",
shortName: "h",
type: "boolean",
- description: ts.Diagnostics.Print_this_message
+ description: ts.Diagnostics.Print_this_message,
},
{
name: "help",
@@ -47453,15 +49114,15 @@ var ts;
{
name: "init",
type: "boolean",
- description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file
+ description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file,
},
{
name: "inlineSourceMap",
- type: "boolean"
+ type: "boolean",
},
{
name: "inlineSources",
- type: "boolean"
+ type: "boolean",
},
{
name: "jsx",
@@ -47470,7 +49131,7 @@ var ts;
"react": 2
}),
paramType: ts.Diagnostics.KIND,
- description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react
+ description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react,
},
{
name: "reactNamespace",
@@ -47479,18 +49140,18 @@ var ts;
},
{
name: "listFiles",
- type: "boolean"
+ type: "boolean",
},
{
name: "locale",
- type: "string"
+ type: "string",
},
{
name: "mapRoot",
type: "string",
isFilePath: true,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
- paramType: ts.Diagnostics.LOCATION
+ paramType: ts.Diagnostics.LOCATION,
},
{
name: "module",
@@ -47501,11 +49162,11 @@ var ts;
"amd": ts.ModuleKind.AMD,
"system": ts.ModuleKind.System,
"umd": ts.ModuleKind.UMD,
- "es6": ts.ModuleKind.ES6,
- "es2015": ts.ModuleKind.ES2015
+ "es6": ts.ModuleKind.ES2015,
+ "es2015": ts.ModuleKind.ES2015,
}),
description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015,
- paramType: ts.Diagnostics.KIND
+ paramType: ts.Diagnostics.KIND,
},
{
name: "newLine",
@@ -47514,12 +49175,12 @@ var ts;
"lf": 1
}),
description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
- paramType: ts.Diagnostics.NEWLINE
+ paramType: ts.Diagnostics.NEWLINE,
},
{
name: "noEmit",
type: "boolean",
- description: ts.Diagnostics.Do_not_emit_outputs
+ description: ts.Diagnostics.Do_not_emit_outputs,
},
{
name: "noEmitHelpers",
@@ -47528,7 +49189,7 @@ var ts;
{
name: "noEmitOnError",
type: "boolean",
- description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported
+ description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
},
{
name: "noErrorTruncation",
@@ -47537,59 +49198,59 @@ var ts;
{
name: "noImplicitAny",
type: "boolean",
- description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type
+ description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type,
},
{
name: "noImplicitThis",
type: "boolean",
- description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type
+ description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type,
},
{
name: "noUnusedLocals",
type: "boolean",
- description: ts.Diagnostics.Report_errors_on_unused_locals
+ description: ts.Diagnostics.Report_errors_on_unused_locals,
},
{
name: "noUnusedParameters",
type: "boolean",
- description: ts.Diagnostics.Report_errors_on_unused_parameters
+ description: ts.Diagnostics.Report_errors_on_unused_parameters,
},
{
name: "noLib",
- type: "boolean"
+ type: "boolean",
},
{
name: "noResolve",
- type: "boolean"
+ type: "boolean",
},
{
name: "skipDefaultLibCheck",
- type: "boolean"
+ type: "boolean",
},
{
name: "skipLibCheck",
type: "boolean",
- description: ts.Diagnostics.Skip_type_checking_of_declaration_files
+ description: ts.Diagnostics.Skip_type_checking_of_declaration_files,
},
{
name: "out",
type: "string",
isFilePath: false,
- paramType: ts.Diagnostics.FILE
+ paramType: ts.Diagnostics.FILE,
},
{
name: "outFile",
type: "string",
isFilePath: true,
description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,
- paramType: ts.Diagnostics.FILE
+ paramType: ts.Diagnostics.FILE,
},
{
name: "outDir",
type: "string",
isFilePath: true,
description: ts.Diagnostics.Redirect_output_structure_to_the_directory,
- paramType: ts.Diagnostics.DIRECTORY
+ paramType: ts.Diagnostics.DIRECTORY,
},
{
name: "preserveConstEnums",
@@ -47612,30 +49273,30 @@ var ts;
{
name: "removeComments",
type: "boolean",
- description: ts.Diagnostics.Do_not_emit_comments_to_output
+ description: ts.Diagnostics.Do_not_emit_comments_to_output,
},
{
name: "rootDir",
type: "string",
isFilePath: true,
paramType: ts.Diagnostics.LOCATION,
- description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir
+ description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir,
},
{
name: "isolatedModules",
- type: "boolean"
+ type: "boolean",
},
{
name: "sourceMap",
type: "boolean",
- description: ts.Diagnostics.Generates_corresponding_map_file
+ description: ts.Diagnostics.Generates_corresponding_map_file,
},
{
name: "sourceRoot",
type: "string",
isFilePath: true,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
- paramType: ts.Diagnostics.LOCATION
+ paramType: ts.Diagnostics.LOCATION,
},
{
name: "suppressExcessPropertyErrors",
@@ -47646,7 +49307,7 @@ var ts;
{
name: "suppressImplicitAnyIndexErrors",
type: "boolean",
- description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures
+ description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures,
},
{
name: "stripInternal",
@@ -47661,22 +49322,24 @@ var ts;
"es3": 0,
"es5": 1,
"es6": 2,
- "es2015": 2
+ "es2015": 2,
+ "es2016": 3,
+ "es2017": 4,
}),
description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015,
- paramType: ts.Diagnostics.VERSION
+ paramType: ts.Diagnostics.VERSION,
},
{
name: "version",
shortName: "v",
type: "boolean",
- description: ts.Diagnostics.Print_the_compiler_s_version
+ description: ts.Diagnostics.Print_the_compiler_s_version,
},
{
name: "watch",
shortName: "w",
type: "boolean",
- description: ts.Diagnostics.Watch_input_files
+ description: ts.Diagnostics.Watch_input_files,
},
{
name: "experimentalDecorators",
@@ -47693,10 +49356,10 @@ var ts;
name: "moduleResolution",
type: ts.createMap({
"node": ts.ModuleResolutionKind.NodeJs,
- "classic": ts.ModuleResolutionKind.Classic
+ "classic": ts.ModuleResolutionKind.Classic,
}),
description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,
- paramType: ts.Diagnostics.STRATEGY
+ paramType: ts.Diagnostics.STRATEGY,
},
{
name: "allowUnusedLabels",
@@ -47819,7 +49482,7 @@ var ts;
"es2016.array.include": "lib.es2016.array.include.d.ts",
"es2017.object": "lib.es2017.object.d.ts",
"es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts"
- })
+ }),
},
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon
},
@@ -47846,7 +49509,7 @@ var ts;
ts.typingOptionDeclarations = [
{
name: "enableAutoDiscovery",
- type: "boolean"
+ type: "boolean",
},
{
name: "include",
@@ -47869,7 +49532,7 @@ var ts;
module: ts.ModuleKind.CommonJS,
target: 1,
noImplicitAny: false,
- sourceMap: false
+ sourceMap: false,
};
var optionNameMapCache;
function getOptionNameMap() {
@@ -47889,10 +49552,7 @@ var ts;
}
ts.getOptionNameMap = getOptionNameMap;
function createCompilerDiagnosticForInvalidCustomType(opt) {
- var namesOfType = [];
- for (var key in opt.type) {
- namesOfType.push(" '" + key + "'");
- }
+ var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", ");
return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType);
}
ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType;
@@ -48507,7 +50167,7 @@ var ts;
reportDiagnostic(diagnostic, host);
}
}
- function reportEmittedFiles(files, host) {
+ function reportEmittedFiles(files) {
if (!files || files.length == 0) {
return;
}
@@ -48566,10 +50226,10 @@ var ts;
});
return count;
}
- function getDiagnosticText(message) {
- var args = [];
+ function getDiagnosticText(_message) {
+ var _args = [];
for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
+ _args[_i - 1] = arguments[_i];
}
var diagnostic = ts.createCompilerDiagnostic.apply(undefined, arguments);
return diagnostic.messageText;
@@ -48841,7 +50501,7 @@ var ts;
}
var sourceFile = hostGetSourceFile(fileName, languageVersion, onError);
if (sourceFile && ts.isWatchSet(compilerOptions) && ts.sys.watchFile) {
- sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function (fileName, removed) { return sourceFileChanged(sourceFile, removed); });
+ sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function (_fileName, removed) { return sourceFileChanged(sourceFile, removed); });
}
return sourceFile;
}
@@ -48963,7 +50623,7 @@ var ts;
var emitOutput = program.emit();
diagnostics = diagnostics.concat(emitOutput.diagnostics);
reportDiagnostics(ts.sortAndDeduplicateDiagnostics(diagnostics), compilerHost);
- reportEmittedFiles(emitOutput.emittedFiles, compilerHost);
+ reportEmittedFiles(emitOutput.emittedFiles);
if (emitOutput.emitSkipped && diagnostics.length > 0) {
return ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
}
@@ -49105,3 +50765,5 @@ if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnviron
ts.sys.tryEnableSourceMapsForHost();
}
ts.executeCommandLine(ts.sys.args);
+
+//# sourceMappingURL=tsc.js.map
diff --git a/lib/tsserver.js b/lib/tsserver.js
index f5437988c1a20..be6578b076203 100644
--- a/lib/tsserver.js
+++ b/lib/tsserver.js
@@ -20,6 +20,418 @@ var __extends = (this && this.__extends) || function (d, b) {
};
var ts;
(function (ts) {
+ (function (SyntaxKind) {
+ SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown";
+ SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken";
+ SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia";
+ SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia";
+ SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia";
+ SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia";
+ SyntaxKind[SyntaxKind["ShebangTrivia"] = 6] = "ShebangTrivia";
+ SyntaxKind[SyntaxKind["ConflictMarkerTrivia"] = 7] = "ConflictMarkerTrivia";
+ SyntaxKind[SyntaxKind["NumericLiteral"] = 8] = "NumericLiteral";
+ SyntaxKind[SyntaxKind["StringLiteral"] = 9] = "StringLiteral";
+ SyntaxKind[SyntaxKind["JsxText"] = 10] = "JsxText";
+ SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 11] = "RegularExpressionLiteral";
+ SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 12] = "NoSubstitutionTemplateLiteral";
+ SyntaxKind[SyntaxKind["TemplateHead"] = 13] = "TemplateHead";
+ SyntaxKind[SyntaxKind["TemplateMiddle"] = 14] = "TemplateMiddle";
+ SyntaxKind[SyntaxKind["TemplateTail"] = 15] = "TemplateTail";
+ SyntaxKind[SyntaxKind["OpenBraceToken"] = 16] = "OpenBraceToken";
+ SyntaxKind[SyntaxKind["CloseBraceToken"] = 17] = "CloseBraceToken";
+ SyntaxKind[SyntaxKind["OpenParenToken"] = 18] = "OpenParenToken";
+ SyntaxKind[SyntaxKind["CloseParenToken"] = 19] = "CloseParenToken";
+ SyntaxKind[SyntaxKind["OpenBracketToken"] = 20] = "OpenBracketToken";
+ SyntaxKind[SyntaxKind["CloseBracketToken"] = 21] = "CloseBracketToken";
+ SyntaxKind[SyntaxKind["DotToken"] = 22] = "DotToken";
+ SyntaxKind[SyntaxKind["DotDotDotToken"] = 23] = "DotDotDotToken";
+ SyntaxKind[SyntaxKind["SemicolonToken"] = 24] = "SemicolonToken";
+ SyntaxKind[SyntaxKind["CommaToken"] = 25] = "CommaToken";
+ SyntaxKind[SyntaxKind["LessThanToken"] = 26] = "LessThanToken";
+ SyntaxKind[SyntaxKind["LessThanSlashToken"] = 27] = "LessThanSlashToken";
+ SyntaxKind[SyntaxKind["GreaterThanToken"] = 28] = "GreaterThanToken";
+ SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 29] = "LessThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 30] = "GreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 31] = "EqualsEqualsToken";
+ SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 32] = "ExclamationEqualsToken";
+ SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 33] = "EqualsEqualsEqualsToken";
+ SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 34] = "ExclamationEqualsEqualsToken";
+ SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 35] = "EqualsGreaterThanToken";
+ SyntaxKind[SyntaxKind["PlusToken"] = 36] = "PlusToken";
+ SyntaxKind[SyntaxKind["MinusToken"] = 37] = "MinusToken";
+ SyntaxKind[SyntaxKind["AsteriskToken"] = 38] = "AsteriskToken";
+ SyntaxKind[SyntaxKind["AsteriskAsteriskToken"] = 39] = "AsteriskAsteriskToken";
+ SyntaxKind[SyntaxKind["SlashToken"] = 40] = "SlashToken";
+ SyntaxKind[SyntaxKind["PercentToken"] = 41] = "PercentToken";
+ SyntaxKind[SyntaxKind["PlusPlusToken"] = 42] = "PlusPlusToken";
+ SyntaxKind[SyntaxKind["MinusMinusToken"] = 43] = "MinusMinusToken";
+ SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 44] = "LessThanLessThanToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 45] = "GreaterThanGreaterThanToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 46] = "GreaterThanGreaterThanGreaterThanToken";
+ SyntaxKind[SyntaxKind["AmpersandToken"] = 47] = "AmpersandToken";
+ SyntaxKind[SyntaxKind["BarToken"] = 48] = "BarToken";
+ SyntaxKind[SyntaxKind["CaretToken"] = 49] = "CaretToken";
+ SyntaxKind[SyntaxKind["ExclamationToken"] = 50] = "ExclamationToken";
+ SyntaxKind[SyntaxKind["TildeToken"] = 51] = "TildeToken";
+ SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 52] = "AmpersandAmpersandToken";
+ SyntaxKind[SyntaxKind["BarBarToken"] = 53] = "BarBarToken";
+ SyntaxKind[SyntaxKind["QuestionToken"] = 54] = "QuestionToken";
+ SyntaxKind[SyntaxKind["ColonToken"] = 55] = "ColonToken";
+ SyntaxKind[SyntaxKind["AtToken"] = 56] = "AtToken";
+ SyntaxKind[SyntaxKind["EqualsToken"] = 57] = "EqualsToken";
+ SyntaxKind[SyntaxKind["PlusEqualsToken"] = 58] = "PlusEqualsToken";
+ SyntaxKind[SyntaxKind["MinusEqualsToken"] = 59] = "MinusEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 60] = "AsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 61] = "AsteriskAsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["SlashEqualsToken"] = 62] = "SlashEqualsToken";
+ SyntaxKind[SyntaxKind["PercentEqualsToken"] = 63] = "PercentEqualsToken";
+ SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 64] = "LessThanLessThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 65] = "GreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 66] = "GreaterThanGreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 67] = "AmpersandEqualsToken";
+ SyntaxKind[SyntaxKind["BarEqualsToken"] = 68] = "BarEqualsToken";
+ SyntaxKind[SyntaxKind["CaretEqualsToken"] = 69] = "CaretEqualsToken";
+ SyntaxKind[SyntaxKind["Identifier"] = 70] = "Identifier";
+ SyntaxKind[SyntaxKind["BreakKeyword"] = 71] = "BreakKeyword";
+ SyntaxKind[SyntaxKind["CaseKeyword"] = 72] = "CaseKeyword";
+ SyntaxKind[SyntaxKind["CatchKeyword"] = 73] = "CatchKeyword";
+ SyntaxKind[SyntaxKind["ClassKeyword"] = 74] = "ClassKeyword";
+ SyntaxKind[SyntaxKind["ConstKeyword"] = 75] = "ConstKeyword";
+ SyntaxKind[SyntaxKind["ContinueKeyword"] = 76] = "ContinueKeyword";
+ SyntaxKind[SyntaxKind["DebuggerKeyword"] = 77] = "DebuggerKeyword";
+ SyntaxKind[SyntaxKind["DefaultKeyword"] = 78] = "DefaultKeyword";
+ SyntaxKind[SyntaxKind["DeleteKeyword"] = 79] = "DeleteKeyword";
+ SyntaxKind[SyntaxKind["DoKeyword"] = 80] = "DoKeyword";
+ SyntaxKind[SyntaxKind["ElseKeyword"] = 81] = "ElseKeyword";
+ SyntaxKind[SyntaxKind["EnumKeyword"] = 82] = "EnumKeyword";
+ SyntaxKind[SyntaxKind["ExportKeyword"] = 83] = "ExportKeyword";
+ SyntaxKind[SyntaxKind["ExtendsKeyword"] = 84] = "ExtendsKeyword";
+ SyntaxKind[SyntaxKind["FalseKeyword"] = 85] = "FalseKeyword";
+ SyntaxKind[SyntaxKind["FinallyKeyword"] = 86] = "FinallyKeyword";
+ SyntaxKind[SyntaxKind["ForKeyword"] = 87] = "ForKeyword";
+ SyntaxKind[SyntaxKind["FunctionKeyword"] = 88] = "FunctionKeyword";
+ SyntaxKind[SyntaxKind["IfKeyword"] = 89] = "IfKeyword";
+ SyntaxKind[SyntaxKind["ImportKeyword"] = 90] = "ImportKeyword";
+ SyntaxKind[SyntaxKind["InKeyword"] = 91] = "InKeyword";
+ SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 92] = "InstanceOfKeyword";
+ SyntaxKind[SyntaxKind["NewKeyword"] = 93] = "NewKeyword";
+ SyntaxKind[SyntaxKind["NullKeyword"] = 94] = "NullKeyword";
+ SyntaxKind[SyntaxKind["ReturnKeyword"] = 95] = "ReturnKeyword";
+ SyntaxKind[SyntaxKind["SuperKeyword"] = 96] = "SuperKeyword";
+ SyntaxKind[SyntaxKind["SwitchKeyword"] = 97] = "SwitchKeyword";
+ SyntaxKind[SyntaxKind["ThisKeyword"] = 98] = "ThisKeyword";
+ SyntaxKind[SyntaxKind["ThrowKeyword"] = 99] = "ThrowKeyword";
+ SyntaxKind[SyntaxKind["TrueKeyword"] = 100] = "TrueKeyword";
+ SyntaxKind[SyntaxKind["TryKeyword"] = 101] = "TryKeyword";
+ SyntaxKind[SyntaxKind["TypeOfKeyword"] = 102] = "TypeOfKeyword";
+ SyntaxKind[SyntaxKind["VarKeyword"] = 103] = "VarKeyword";
+ SyntaxKind[SyntaxKind["VoidKeyword"] = 104] = "VoidKeyword";
+ SyntaxKind[SyntaxKind["WhileKeyword"] = 105] = "WhileKeyword";
+ SyntaxKind[SyntaxKind["WithKeyword"] = 106] = "WithKeyword";
+ SyntaxKind[SyntaxKind["ImplementsKeyword"] = 107] = "ImplementsKeyword";
+ SyntaxKind[SyntaxKind["InterfaceKeyword"] = 108] = "InterfaceKeyword";
+ SyntaxKind[SyntaxKind["LetKeyword"] = 109] = "LetKeyword";
+ SyntaxKind[SyntaxKind["PackageKeyword"] = 110] = "PackageKeyword";
+ SyntaxKind[SyntaxKind["PrivateKeyword"] = 111] = "PrivateKeyword";
+ SyntaxKind[SyntaxKind["ProtectedKeyword"] = 112] = "ProtectedKeyword";
+ SyntaxKind[SyntaxKind["PublicKeyword"] = 113] = "PublicKeyword";
+ SyntaxKind[SyntaxKind["StaticKeyword"] = 114] = "StaticKeyword";
+ SyntaxKind[SyntaxKind["YieldKeyword"] = 115] = "YieldKeyword";
+ SyntaxKind[SyntaxKind["AbstractKeyword"] = 116] = "AbstractKeyword";
+ SyntaxKind[SyntaxKind["AsKeyword"] = 117] = "AsKeyword";
+ SyntaxKind[SyntaxKind["AnyKeyword"] = 118] = "AnyKeyword";
+ SyntaxKind[SyntaxKind["AsyncKeyword"] = 119] = "AsyncKeyword";
+ SyntaxKind[SyntaxKind["AwaitKeyword"] = 120] = "AwaitKeyword";
+ SyntaxKind[SyntaxKind["BooleanKeyword"] = 121] = "BooleanKeyword";
+ SyntaxKind[SyntaxKind["ConstructorKeyword"] = 122] = "ConstructorKeyword";
+ SyntaxKind[SyntaxKind["DeclareKeyword"] = 123] = "DeclareKeyword";
+ SyntaxKind[SyntaxKind["GetKeyword"] = 124] = "GetKeyword";
+ SyntaxKind[SyntaxKind["IsKeyword"] = 125] = "IsKeyword";
+ SyntaxKind[SyntaxKind["ModuleKeyword"] = 126] = "ModuleKeyword";
+ SyntaxKind[SyntaxKind["NamespaceKeyword"] = 127] = "NamespaceKeyword";
+ SyntaxKind[SyntaxKind["NeverKeyword"] = 128] = "NeverKeyword";
+ SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 129] = "ReadonlyKeyword";
+ SyntaxKind[SyntaxKind["RequireKeyword"] = 130] = "RequireKeyword";
+ SyntaxKind[SyntaxKind["NumberKeyword"] = 131] = "NumberKeyword";
+ SyntaxKind[SyntaxKind["SetKeyword"] = 132] = "SetKeyword";
+ SyntaxKind[SyntaxKind["StringKeyword"] = 133] = "StringKeyword";
+ SyntaxKind[SyntaxKind["SymbolKeyword"] = 134] = "SymbolKeyword";
+ SyntaxKind[SyntaxKind["TypeKeyword"] = 135] = "TypeKeyword";
+ SyntaxKind[SyntaxKind["UndefinedKeyword"] = 136] = "UndefinedKeyword";
+ SyntaxKind[SyntaxKind["FromKeyword"] = 137] = "FromKeyword";
+ SyntaxKind[SyntaxKind["GlobalKeyword"] = 138] = "GlobalKeyword";
+ SyntaxKind[SyntaxKind["OfKeyword"] = 139] = "OfKeyword";
+ SyntaxKind[SyntaxKind["QualifiedName"] = 140] = "QualifiedName";
+ SyntaxKind[SyntaxKind["ComputedPropertyName"] = 141] = "ComputedPropertyName";
+ SyntaxKind[SyntaxKind["TypeParameter"] = 142] = "TypeParameter";
+ SyntaxKind[SyntaxKind["Parameter"] = 143] = "Parameter";
+ SyntaxKind[SyntaxKind["Decorator"] = 144] = "Decorator";
+ SyntaxKind[SyntaxKind["PropertySignature"] = 145] = "PropertySignature";
+ SyntaxKind[SyntaxKind["PropertyDeclaration"] = 146] = "PropertyDeclaration";
+ SyntaxKind[SyntaxKind["MethodSignature"] = 147] = "MethodSignature";
+ SyntaxKind[SyntaxKind["MethodDeclaration"] = 148] = "MethodDeclaration";
+ SyntaxKind[SyntaxKind["Constructor"] = 149] = "Constructor";
+ SyntaxKind[SyntaxKind["GetAccessor"] = 150] = "GetAccessor";
+ SyntaxKind[SyntaxKind["SetAccessor"] = 151] = "SetAccessor";
+ SyntaxKind[SyntaxKind["CallSignature"] = 152] = "CallSignature";
+ SyntaxKind[SyntaxKind["ConstructSignature"] = 153] = "ConstructSignature";
+ SyntaxKind[SyntaxKind["IndexSignature"] = 154] = "IndexSignature";
+ SyntaxKind[SyntaxKind["TypePredicate"] = 155] = "TypePredicate";
+ SyntaxKind[SyntaxKind["TypeReference"] = 156] = "TypeReference";
+ SyntaxKind[SyntaxKind["FunctionType"] = 157] = "FunctionType";
+ SyntaxKind[SyntaxKind["ConstructorType"] = 158] = "ConstructorType";
+ SyntaxKind[SyntaxKind["TypeQuery"] = 159] = "TypeQuery";
+ SyntaxKind[SyntaxKind["TypeLiteral"] = 160] = "TypeLiteral";
+ SyntaxKind[SyntaxKind["ArrayType"] = 161] = "ArrayType";
+ SyntaxKind[SyntaxKind["TupleType"] = 162] = "TupleType";
+ SyntaxKind[SyntaxKind["UnionType"] = 163] = "UnionType";
+ SyntaxKind[SyntaxKind["IntersectionType"] = 164] = "IntersectionType";
+ SyntaxKind[SyntaxKind["ParenthesizedType"] = 165] = "ParenthesizedType";
+ SyntaxKind[SyntaxKind["ThisType"] = 166] = "ThisType";
+ SyntaxKind[SyntaxKind["LiteralType"] = 167] = "LiteralType";
+ SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 168] = "ObjectBindingPattern";
+ SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 169] = "ArrayBindingPattern";
+ SyntaxKind[SyntaxKind["BindingElement"] = 170] = "BindingElement";
+ SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 171] = "ArrayLiteralExpression";
+ SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 172] = "ObjectLiteralExpression";
+ SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 173] = "PropertyAccessExpression";
+ SyntaxKind[SyntaxKind["ElementAccessExpression"] = 174] = "ElementAccessExpression";
+ SyntaxKind[SyntaxKind["CallExpression"] = 175] = "CallExpression";
+ SyntaxKind[SyntaxKind["NewExpression"] = 176] = "NewExpression";
+ SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 177] = "TaggedTemplateExpression";
+ SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 178] = "TypeAssertionExpression";
+ SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 179] = "ParenthesizedExpression";
+ SyntaxKind[SyntaxKind["FunctionExpression"] = 180] = "FunctionExpression";
+ SyntaxKind[SyntaxKind["ArrowFunction"] = 181] = "ArrowFunction";
+ SyntaxKind[SyntaxKind["DeleteExpression"] = 182] = "DeleteExpression";
+ SyntaxKind[SyntaxKind["TypeOfExpression"] = 183] = "TypeOfExpression";
+ SyntaxKind[SyntaxKind["VoidExpression"] = 184] = "VoidExpression";
+ SyntaxKind[SyntaxKind["AwaitExpression"] = 185] = "AwaitExpression";
+ SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 186] = "PrefixUnaryExpression";
+ SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 187] = "PostfixUnaryExpression";
+ SyntaxKind[SyntaxKind["BinaryExpression"] = 188] = "BinaryExpression";
+ SyntaxKind[SyntaxKind["ConditionalExpression"] = 189] = "ConditionalExpression";
+ SyntaxKind[SyntaxKind["TemplateExpression"] = 190] = "TemplateExpression";
+ SyntaxKind[SyntaxKind["YieldExpression"] = 191] = "YieldExpression";
+ SyntaxKind[SyntaxKind["SpreadElementExpression"] = 192] = "SpreadElementExpression";
+ SyntaxKind[SyntaxKind["ClassExpression"] = 193] = "ClassExpression";
+ SyntaxKind[SyntaxKind["OmittedExpression"] = 194] = "OmittedExpression";
+ SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 195] = "ExpressionWithTypeArguments";
+ SyntaxKind[SyntaxKind["AsExpression"] = 196] = "AsExpression";
+ SyntaxKind[SyntaxKind["NonNullExpression"] = 197] = "NonNullExpression";
+ SyntaxKind[SyntaxKind["TemplateSpan"] = 198] = "TemplateSpan";
+ SyntaxKind[SyntaxKind["SemicolonClassElement"] = 199] = "SemicolonClassElement";
+ SyntaxKind[SyntaxKind["Block"] = 200] = "Block";
+ SyntaxKind[SyntaxKind["VariableStatement"] = 201] = "VariableStatement";
+ SyntaxKind[SyntaxKind["EmptyStatement"] = 202] = "EmptyStatement";
+ SyntaxKind[SyntaxKind["ExpressionStatement"] = 203] = "ExpressionStatement";
+ SyntaxKind[SyntaxKind["IfStatement"] = 204] = "IfStatement";
+ SyntaxKind[SyntaxKind["DoStatement"] = 205] = "DoStatement";
+ SyntaxKind[SyntaxKind["WhileStatement"] = 206] = "WhileStatement";
+ SyntaxKind[SyntaxKind["ForStatement"] = 207] = "ForStatement";
+ SyntaxKind[SyntaxKind["ForInStatement"] = 208] = "ForInStatement";
+ SyntaxKind[SyntaxKind["ForOfStatement"] = 209] = "ForOfStatement";
+ SyntaxKind[SyntaxKind["ContinueStatement"] = 210] = "ContinueStatement";
+ SyntaxKind[SyntaxKind["BreakStatement"] = 211] = "BreakStatement";
+ SyntaxKind[SyntaxKind["ReturnStatement"] = 212] = "ReturnStatement";
+ SyntaxKind[SyntaxKind["WithStatement"] = 213] = "WithStatement";
+ SyntaxKind[SyntaxKind["SwitchStatement"] = 214] = "SwitchStatement";
+ SyntaxKind[SyntaxKind["LabeledStatement"] = 215] = "LabeledStatement";
+ SyntaxKind[SyntaxKind["ThrowStatement"] = 216] = "ThrowStatement";
+ SyntaxKind[SyntaxKind["TryStatement"] = 217] = "TryStatement";
+ SyntaxKind[SyntaxKind["DebuggerStatement"] = 218] = "DebuggerStatement";
+ SyntaxKind[SyntaxKind["VariableDeclaration"] = 219] = "VariableDeclaration";
+ SyntaxKind[SyntaxKind["VariableDeclarationList"] = 220] = "VariableDeclarationList";
+ SyntaxKind[SyntaxKind["FunctionDeclaration"] = 221] = "FunctionDeclaration";
+ SyntaxKind[SyntaxKind["ClassDeclaration"] = 222] = "ClassDeclaration";
+ SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 223] = "InterfaceDeclaration";
+ SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 224] = "TypeAliasDeclaration";
+ SyntaxKind[SyntaxKind["EnumDeclaration"] = 225] = "EnumDeclaration";
+ SyntaxKind[SyntaxKind["ModuleDeclaration"] = 226] = "ModuleDeclaration";
+ SyntaxKind[SyntaxKind["ModuleBlock"] = 227] = "ModuleBlock";
+ SyntaxKind[SyntaxKind["CaseBlock"] = 228] = "CaseBlock";
+ SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 229] = "NamespaceExportDeclaration";
+ SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 230] = "ImportEqualsDeclaration";
+ SyntaxKind[SyntaxKind["ImportDeclaration"] = 231] = "ImportDeclaration";
+ SyntaxKind[SyntaxKind["ImportClause"] = 232] = "ImportClause";
+ SyntaxKind[SyntaxKind["NamespaceImport"] = 233] = "NamespaceImport";
+ SyntaxKind[SyntaxKind["NamedImports"] = 234] = "NamedImports";
+ SyntaxKind[SyntaxKind["ImportSpecifier"] = 235] = "ImportSpecifier";
+ SyntaxKind[SyntaxKind["ExportAssignment"] = 236] = "ExportAssignment";
+ SyntaxKind[SyntaxKind["ExportDeclaration"] = 237] = "ExportDeclaration";
+ SyntaxKind[SyntaxKind["NamedExports"] = 238] = "NamedExports";
+ SyntaxKind[SyntaxKind["ExportSpecifier"] = 239] = "ExportSpecifier";
+ SyntaxKind[SyntaxKind["MissingDeclaration"] = 240] = "MissingDeclaration";
+ SyntaxKind[SyntaxKind["ExternalModuleReference"] = 241] = "ExternalModuleReference";
+ SyntaxKind[SyntaxKind["JsxElement"] = 242] = "JsxElement";
+ SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 243] = "JsxSelfClosingElement";
+ SyntaxKind[SyntaxKind["JsxOpeningElement"] = 244] = "JsxOpeningElement";
+ SyntaxKind[SyntaxKind["JsxClosingElement"] = 245] = "JsxClosingElement";
+ SyntaxKind[SyntaxKind["JsxAttribute"] = 246] = "JsxAttribute";
+ SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 247] = "JsxSpreadAttribute";
+ SyntaxKind[SyntaxKind["JsxExpression"] = 248] = "JsxExpression";
+ SyntaxKind[SyntaxKind["CaseClause"] = 249] = "CaseClause";
+ SyntaxKind[SyntaxKind["DefaultClause"] = 250] = "DefaultClause";
+ SyntaxKind[SyntaxKind["HeritageClause"] = 251] = "HeritageClause";
+ SyntaxKind[SyntaxKind["CatchClause"] = 252] = "CatchClause";
+ SyntaxKind[SyntaxKind["PropertyAssignment"] = 253] = "PropertyAssignment";
+ SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 254] = "ShorthandPropertyAssignment";
+ SyntaxKind[SyntaxKind["EnumMember"] = 255] = "EnumMember";
+ SyntaxKind[SyntaxKind["SourceFile"] = 256] = "SourceFile";
+ SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 257] = "JSDocTypeExpression";
+ SyntaxKind[SyntaxKind["JSDocAllType"] = 258] = "JSDocAllType";
+ SyntaxKind[SyntaxKind["JSDocUnknownType"] = 259] = "JSDocUnknownType";
+ SyntaxKind[SyntaxKind["JSDocArrayType"] = 260] = "JSDocArrayType";
+ SyntaxKind[SyntaxKind["JSDocUnionType"] = 261] = "JSDocUnionType";
+ SyntaxKind[SyntaxKind["JSDocTupleType"] = 262] = "JSDocTupleType";
+ SyntaxKind[SyntaxKind["JSDocNullableType"] = 263] = "JSDocNullableType";
+ SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 264] = "JSDocNonNullableType";
+ SyntaxKind[SyntaxKind["JSDocRecordType"] = 265] = "JSDocRecordType";
+ SyntaxKind[SyntaxKind["JSDocRecordMember"] = 266] = "JSDocRecordMember";
+ SyntaxKind[SyntaxKind["JSDocTypeReference"] = 267] = "JSDocTypeReference";
+ SyntaxKind[SyntaxKind["JSDocOptionalType"] = 268] = "JSDocOptionalType";
+ SyntaxKind[SyntaxKind["JSDocFunctionType"] = 269] = "JSDocFunctionType";
+ SyntaxKind[SyntaxKind["JSDocVariadicType"] = 270] = "JSDocVariadicType";
+ SyntaxKind[SyntaxKind["JSDocConstructorType"] = 271] = "JSDocConstructorType";
+ SyntaxKind[SyntaxKind["JSDocThisType"] = 272] = "JSDocThisType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 273] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 274] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 275] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 276] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 277] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 278] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 279] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 280] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 281] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocLiteralType"] = 282] = "JSDocLiteralType";
+ SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 283] = "JSDocNullKeyword";
+ SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 284] = "JSDocUndefinedKeyword";
+ SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 285] = "JSDocNeverKeyword";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 286] = "SyntaxList";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 287] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 288] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["Count"] = 289] = "Count";
+ SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment";
+ SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment";
+ SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 58] = "FirstCompoundAssignment";
+ SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 69] = "LastCompoundAssignment";
+ SyntaxKind[SyntaxKind["FirstReservedWord"] = 71] = "FirstReservedWord";
+ SyntaxKind[SyntaxKind["LastReservedWord"] = 106] = "LastReservedWord";
+ SyntaxKind[SyntaxKind["FirstKeyword"] = 71] = "FirstKeyword";
+ SyntaxKind[SyntaxKind["LastKeyword"] = 139] = "LastKeyword";
+ SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 107] = "FirstFutureReservedWord";
+ SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 115] = "LastFutureReservedWord";
+ SyntaxKind[SyntaxKind["FirstTypeNode"] = 155] = "FirstTypeNode";
+ SyntaxKind[SyntaxKind["LastTypeNode"] = 167] = "LastTypeNode";
+ SyntaxKind[SyntaxKind["FirstPunctuation"] = 16] = "FirstPunctuation";
+ SyntaxKind[SyntaxKind["LastPunctuation"] = 69] = "LastPunctuation";
+ SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken";
+ SyntaxKind[SyntaxKind["LastToken"] = 139] = "LastToken";
+ SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken";
+ SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken";
+ SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken";
+ SyntaxKind[SyntaxKind["LastLiteralToken"] = 12] = "LastLiteralToken";
+ SyntaxKind[SyntaxKind["FirstTemplateToken"] = 12] = "FirstTemplateToken";
+ SyntaxKind[SyntaxKind["LastTemplateToken"] = 15] = "LastTemplateToken";
+ SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator";
+ SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator";
+ SyntaxKind[SyntaxKind["FirstNode"] = 140] = "FirstNode";
+ SyntaxKind[SyntaxKind["FirstJSDocNode"] = 257] = "FirstJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 282] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 273] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 285] = "LastJSDocTagNode";
+ })(ts.SyntaxKind || (ts.SyntaxKind = {}));
+ var SyntaxKind = ts.SyntaxKind;
+ (function (NodeFlags) {
+ NodeFlags[NodeFlags["None"] = 0] = "None";
+ NodeFlags[NodeFlags["Let"] = 1] = "Let";
+ NodeFlags[NodeFlags["Const"] = 2] = "Const";
+ NodeFlags[NodeFlags["NestedNamespace"] = 4] = "NestedNamespace";
+ NodeFlags[NodeFlags["Synthesized"] = 8] = "Synthesized";
+ NodeFlags[NodeFlags["Namespace"] = 16] = "Namespace";
+ NodeFlags[NodeFlags["ExportContext"] = 32] = "ExportContext";
+ NodeFlags[NodeFlags["ContainsThis"] = 64] = "ContainsThis";
+ NodeFlags[NodeFlags["HasImplicitReturn"] = 128] = "HasImplicitReturn";
+ NodeFlags[NodeFlags["HasExplicitReturn"] = 256] = "HasExplicitReturn";
+ NodeFlags[NodeFlags["GlobalAugmentation"] = 512] = "GlobalAugmentation";
+ NodeFlags[NodeFlags["HasClassExtends"] = 1024] = "HasClassExtends";
+ NodeFlags[NodeFlags["HasDecorators"] = 2048] = "HasDecorators";
+ NodeFlags[NodeFlags["HasParamDecorators"] = 4096] = "HasParamDecorators";
+ NodeFlags[NodeFlags["HasAsyncFunctions"] = 8192] = "HasAsyncFunctions";
+ NodeFlags[NodeFlags["HasJsxSpreadAttributes"] = 16384] = "HasJsxSpreadAttributes";
+ NodeFlags[NodeFlags["DisallowInContext"] = 32768] = "DisallowInContext";
+ NodeFlags[NodeFlags["YieldContext"] = 65536] = "YieldContext";
+ NodeFlags[NodeFlags["DecoratorContext"] = 131072] = "DecoratorContext";
+ NodeFlags[NodeFlags["AwaitContext"] = 262144] = "AwaitContext";
+ NodeFlags[NodeFlags["ThisNodeHasError"] = 524288] = "ThisNodeHasError";
+ NodeFlags[NodeFlags["JavaScriptFile"] = 1048576] = "JavaScriptFile";
+ NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 2097152] = "ThisNodeOrAnySubNodesHasError";
+ NodeFlags[NodeFlags["HasAggregatedChildData"] = 4194304] = "HasAggregatedChildData";
+ NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped";
+ NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags";
+ NodeFlags[NodeFlags["EmitHelperFlags"] = 31744] = "EmitHelperFlags";
+ NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 32128] = "ReachabilityAndEmitFlags";
+ NodeFlags[NodeFlags["ContextFlags"] = 1540096] = "ContextFlags";
+ NodeFlags[NodeFlags["TypeExcludesFlags"] = 327680] = "TypeExcludesFlags";
+ })(ts.NodeFlags || (ts.NodeFlags = {}));
+ var NodeFlags = ts.NodeFlags;
+ (function (ModifierFlags) {
+ ModifierFlags[ModifierFlags["None"] = 0] = "None";
+ ModifierFlags[ModifierFlags["Export"] = 1] = "Export";
+ ModifierFlags[ModifierFlags["Ambient"] = 2] = "Ambient";
+ ModifierFlags[ModifierFlags["Public"] = 4] = "Public";
+ ModifierFlags[ModifierFlags["Private"] = 8] = "Private";
+ ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected";
+ ModifierFlags[ModifierFlags["Static"] = 32] = "Static";
+ ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly";
+ ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract";
+ ModifierFlags[ModifierFlags["Async"] = 256] = "Async";
+ ModifierFlags[ModifierFlags["Default"] = 512] = "Default";
+ ModifierFlags[ModifierFlags["Const"] = 2048] = "Const";
+ ModifierFlags[ModifierFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
+ ModifierFlags[ModifierFlags["AccessibilityModifier"] = 28] = "AccessibilityModifier";
+ ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 92] = "ParameterPropertyModifier";
+ ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier";
+ ModifierFlags[ModifierFlags["TypeScriptModifier"] = 2270] = "TypeScriptModifier";
+ })(ts.ModifierFlags || (ts.ModifierFlags = {}));
+ var ModifierFlags = ts.ModifierFlags;
+ (function (JsxFlags) {
+ JsxFlags[JsxFlags["None"] = 0] = "None";
+ JsxFlags[JsxFlags["IntrinsicNamedElement"] = 1] = "IntrinsicNamedElement";
+ JsxFlags[JsxFlags["IntrinsicIndexedElement"] = 2] = "IntrinsicIndexedElement";
+ JsxFlags[JsxFlags["IntrinsicElement"] = 3] = "IntrinsicElement";
+ })(ts.JsxFlags || (ts.JsxFlags = {}));
+ var JsxFlags = ts.JsxFlags;
+ (function (RelationComparisonResult) {
+ RelationComparisonResult[RelationComparisonResult["Succeeded"] = 1] = "Succeeded";
+ RelationComparisonResult[RelationComparisonResult["Failed"] = 2] = "Failed";
+ RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported";
+ })(ts.RelationComparisonResult || (ts.RelationComparisonResult = {}));
+ var RelationComparisonResult = ts.RelationComparisonResult;
+ (function (GeneratedIdentifierKind) {
+ GeneratedIdentifierKind[GeneratedIdentifierKind["None"] = 0] = "None";
+ GeneratedIdentifierKind[GeneratedIdentifierKind["Auto"] = 1] = "Auto";
+ GeneratedIdentifierKind[GeneratedIdentifierKind["Loop"] = 2] = "Loop";
+ GeneratedIdentifierKind[GeneratedIdentifierKind["Unique"] = 3] = "Unique";
+ GeneratedIdentifierKind[GeneratedIdentifierKind["Node"] = 4] = "Node";
+ })(ts.GeneratedIdentifierKind || (ts.GeneratedIdentifierKind = {}));
+ var GeneratedIdentifierKind = ts.GeneratedIdentifierKind;
+ (function (FlowFlags) {
+ FlowFlags[FlowFlags["Unreachable"] = 1] = "Unreachable";
+ FlowFlags[FlowFlags["Start"] = 2] = "Start";
+ FlowFlags[FlowFlags["BranchLabel"] = 4] = "BranchLabel";
+ FlowFlags[FlowFlags["LoopLabel"] = 8] = "LoopLabel";
+ FlowFlags[FlowFlags["Assignment"] = 16] = "Assignment";
+ FlowFlags[FlowFlags["TrueCondition"] = 32] = "TrueCondition";
+ FlowFlags[FlowFlags["FalseCondition"] = 64] = "FalseCondition";
+ FlowFlags[FlowFlags["SwitchClause"] = 128] = "SwitchClause";
+ FlowFlags[FlowFlags["ArrayMutation"] = 256] = "ArrayMutation";
+ FlowFlags[FlowFlags["Referenced"] = 512] = "Referenced";
+ FlowFlags[FlowFlags["Shared"] = 1024] = "Shared";
+ FlowFlags[FlowFlags["Label"] = 12] = "Label";
+ FlowFlags[FlowFlags["Condition"] = 96] = "Condition";
+ })(ts.FlowFlags || (ts.FlowFlags = {}));
+ var FlowFlags = ts.FlowFlags;
var OperationCanceledException = (function () {
function OperationCanceledException() {
}
@@ -32,6 +444,38 @@ var ts;
ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated";
})(ts.ExitStatus || (ts.ExitStatus = {}));
var ExitStatus = ts.ExitStatus;
+ (function (TypeFormatFlags) {
+ TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None";
+ TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 1] = "WriteArrayAsGenericType";
+ TypeFormatFlags[TypeFormatFlags["UseTypeOfFunction"] = 2] = "UseTypeOfFunction";
+ TypeFormatFlags[TypeFormatFlags["NoTruncation"] = 4] = "NoTruncation";
+ TypeFormatFlags[TypeFormatFlags["WriteArrowStyleSignature"] = 8] = "WriteArrowStyleSignature";
+ TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 16] = "WriteOwnNameForAnyLike";
+ TypeFormatFlags[TypeFormatFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature";
+ TypeFormatFlags[TypeFormatFlags["InElementType"] = 64] = "InElementType";
+ TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType";
+ TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument";
+ TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias";
+ TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue";
+ })(ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));
+ var TypeFormatFlags = ts.TypeFormatFlags;
+ (function (SymbolFormatFlags) {
+ SymbolFormatFlags[SymbolFormatFlags["None"] = 0] = "None";
+ SymbolFormatFlags[SymbolFormatFlags["WriteTypeParametersOrArguments"] = 1] = "WriteTypeParametersOrArguments";
+ SymbolFormatFlags[SymbolFormatFlags["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing";
+ })(ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {}));
+ var SymbolFormatFlags = ts.SymbolFormatFlags;
+ (function (SymbolAccessibility) {
+ SymbolAccessibility[SymbolAccessibility["Accessible"] = 0] = "Accessible";
+ SymbolAccessibility[SymbolAccessibility["NotAccessible"] = 1] = "NotAccessible";
+ SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed";
+ })(ts.SymbolAccessibility || (ts.SymbolAccessibility = {}));
+ var SymbolAccessibility = ts.SymbolAccessibility;
+ (function (TypePredicateKind) {
+ TypePredicateKind[TypePredicateKind["This"] = 0] = "This";
+ TypePredicateKind[TypePredicateKind["Identifier"] = 1] = "Identifier";
+ })(ts.TypePredicateKind || (ts.TypePredicateKind = {}));
+ var TypePredicateKind = ts.TypePredicateKind;
(function (TypeReferenceSerializationKind) {
TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithConstructSignatureAndValue"] = 1] = "TypeWithConstructSignatureAndValue";
@@ -46,6 +490,166 @@ var ts;
TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 10] = "ObjectType";
})(ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));
var TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind;
+ (function (SymbolFlags) {
+ SymbolFlags[SymbolFlags["None"] = 0] = "None";
+ SymbolFlags[SymbolFlags["FunctionScopedVariable"] = 1] = "FunctionScopedVariable";
+ SymbolFlags[SymbolFlags["BlockScopedVariable"] = 2] = "BlockScopedVariable";
+ SymbolFlags[SymbolFlags["Property"] = 4] = "Property";
+ SymbolFlags[SymbolFlags["EnumMember"] = 8] = "EnumMember";
+ SymbolFlags[SymbolFlags["Function"] = 16] = "Function";
+ SymbolFlags[SymbolFlags["Class"] = 32] = "Class";
+ SymbolFlags[SymbolFlags["Interface"] = 64] = "Interface";
+ SymbolFlags[SymbolFlags["ConstEnum"] = 128] = "ConstEnum";
+ SymbolFlags[SymbolFlags["RegularEnum"] = 256] = "RegularEnum";
+ SymbolFlags[SymbolFlags["ValueModule"] = 512] = "ValueModule";
+ SymbolFlags[SymbolFlags["NamespaceModule"] = 1024] = "NamespaceModule";
+ SymbolFlags[SymbolFlags["TypeLiteral"] = 2048] = "TypeLiteral";
+ SymbolFlags[SymbolFlags["ObjectLiteral"] = 4096] = "ObjectLiteral";
+ SymbolFlags[SymbolFlags["Method"] = 8192] = "Method";
+ SymbolFlags[SymbolFlags["Constructor"] = 16384] = "Constructor";
+ SymbolFlags[SymbolFlags["GetAccessor"] = 32768] = "GetAccessor";
+ SymbolFlags[SymbolFlags["SetAccessor"] = 65536] = "SetAccessor";
+ SymbolFlags[SymbolFlags["Signature"] = 131072] = "Signature";
+ SymbolFlags[SymbolFlags["TypeParameter"] = 262144] = "TypeParameter";
+ SymbolFlags[SymbolFlags["TypeAlias"] = 524288] = "TypeAlias";
+ SymbolFlags[SymbolFlags["ExportValue"] = 1048576] = "ExportValue";
+ SymbolFlags[SymbolFlags["ExportType"] = 2097152] = "ExportType";
+ SymbolFlags[SymbolFlags["ExportNamespace"] = 4194304] = "ExportNamespace";
+ SymbolFlags[SymbolFlags["Alias"] = 8388608] = "Alias";
+ SymbolFlags[SymbolFlags["Instantiated"] = 16777216] = "Instantiated";
+ SymbolFlags[SymbolFlags["Merged"] = 33554432] = "Merged";
+ SymbolFlags[SymbolFlags["Transient"] = 67108864] = "Transient";
+ SymbolFlags[SymbolFlags["Prototype"] = 134217728] = "Prototype";
+ SymbolFlags[SymbolFlags["SyntheticProperty"] = 268435456] = "SyntheticProperty";
+ SymbolFlags[SymbolFlags["Optional"] = 536870912] = "Optional";
+ SymbolFlags[SymbolFlags["ExportStar"] = 1073741824] = "ExportStar";
+ SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum";
+ SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable";
+ SymbolFlags[SymbolFlags["Value"] = 107455] = "Value";
+ SymbolFlags[SymbolFlags["Type"] = 793064] = "Type";
+ SymbolFlags[SymbolFlags["Namespace"] = 1920] = "Namespace";
+ SymbolFlags[SymbolFlags["Module"] = 1536] = "Module";
+ SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor";
+ SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 107454] = "FunctionScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 107455] = "BlockScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["ParameterExcludes"] = 107455] = "ParameterExcludes";
+ SymbolFlags[SymbolFlags["PropertyExcludes"] = 0] = "PropertyExcludes";
+ SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 900095] = "EnumMemberExcludes";
+ SymbolFlags[SymbolFlags["FunctionExcludes"] = 106927] = "FunctionExcludes";
+ SymbolFlags[SymbolFlags["ClassExcludes"] = 899519] = "ClassExcludes";
+ SymbolFlags[SymbolFlags["InterfaceExcludes"] = 792968] = "InterfaceExcludes";
+ SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes";
+ SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes";
+ SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 106639] = "ValueModuleExcludes";
+ SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes";
+ SymbolFlags[SymbolFlags["MethodExcludes"] = 99263] = "MethodExcludes";
+ SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 41919] = "GetAccessorExcludes";
+ SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 74687] = "SetAccessorExcludes";
+ SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 530920] = "TypeParameterExcludes";
+ SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 793064] = "TypeAliasExcludes";
+ SymbolFlags[SymbolFlags["AliasExcludes"] = 8388608] = "AliasExcludes";
+ SymbolFlags[SymbolFlags["ModuleMember"] = 8914931] = "ModuleMember";
+ SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal";
+ SymbolFlags[SymbolFlags["HasExports"] = 1952] = "HasExports";
+ SymbolFlags[SymbolFlags["HasMembers"] = 6240] = "HasMembers";
+ SymbolFlags[SymbolFlags["BlockScoped"] = 418] = "BlockScoped";
+ SymbolFlags[SymbolFlags["PropertyOrAccessor"] = 98308] = "PropertyOrAccessor";
+ SymbolFlags[SymbolFlags["Export"] = 7340032] = "Export";
+ SymbolFlags[SymbolFlags["ClassMember"] = 106500] = "ClassMember";
+ SymbolFlags[SymbolFlags["Classifiable"] = 788448] = "Classifiable";
+ })(ts.SymbolFlags || (ts.SymbolFlags = {}));
+ var SymbolFlags = ts.SymbolFlags;
+ (function (NodeCheckFlags) {
+ NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked";
+ NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis";
+ NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis";
+ NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance";
+ NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic";
+ NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked";
+ NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper";
+ NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding";
+ NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments";
+ NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed";
+ NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass";
+ NodeCheckFlags[NodeCheckFlags["LoopWithCapturedBlockScopedBinding"] = 65536] = "LoopWithCapturedBlockScopedBinding";
+ NodeCheckFlags[NodeCheckFlags["CapturedBlockScopedBinding"] = 131072] = "CapturedBlockScopedBinding";
+ NodeCheckFlags[NodeCheckFlags["BlockScopedBindingInLoop"] = 262144] = "BlockScopedBindingInLoop";
+ NodeCheckFlags[NodeCheckFlags["ClassWithBodyScopedClassBinding"] = 524288] = "ClassWithBodyScopedClassBinding";
+ NodeCheckFlags[NodeCheckFlags["BodyScopedClassBinding"] = 1048576] = "BodyScopedClassBinding";
+ NodeCheckFlags[NodeCheckFlags["NeedsLoopOutParameter"] = 2097152] = "NeedsLoopOutParameter";
+ NodeCheckFlags[NodeCheckFlags["AssignmentsMarked"] = 4194304] = "AssignmentsMarked";
+ NodeCheckFlags[NodeCheckFlags["ClassWithConstructorReference"] = 8388608] = "ClassWithConstructorReference";
+ NodeCheckFlags[NodeCheckFlags["ConstructorReferenceInClass"] = 16777216] = "ConstructorReferenceInClass";
+ })(ts.NodeCheckFlags || (ts.NodeCheckFlags = {}));
+ var NodeCheckFlags = ts.NodeCheckFlags;
+ (function (TypeFlags) {
+ TypeFlags[TypeFlags["Any"] = 1] = "Any";
+ TypeFlags[TypeFlags["String"] = 2] = "String";
+ TypeFlags[TypeFlags["Number"] = 4] = "Number";
+ TypeFlags[TypeFlags["Boolean"] = 8] = "Boolean";
+ TypeFlags[TypeFlags["Enum"] = 16] = "Enum";
+ TypeFlags[TypeFlags["StringLiteral"] = 32] = "StringLiteral";
+ TypeFlags[TypeFlags["NumberLiteral"] = 64] = "NumberLiteral";
+ TypeFlags[TypeFlags["BooleanLiteral"] = 128] = "BooleanLiteral";
+ TypeFlags[TypeFlags["EnumLiteral"] = 256] = "EnumLiteral";
+ TypeFlags[TypeFlags["ESSymbol"] = 512] = "ESSymbol";
+ TypeFlags[TypeFlags["Void"] = 1024] = "Void";
+ TypeFlags[TypeFlags["Undefined"] = 2048] = "Undefined";
+ TypeFlags[TypeFlags["Null"] = 4096] = "Null";
+ TypeFlags[TypeFlags["Never"] = 8192] = "Never";
+ TypeFlags[TypeFlags["TypeParameter"] = 16384] = "TypeParameter";
+ TypeFlags[TypeFlags["Class"] = 32768] = "Class";
+ TypeFlags[TypeFlags["Interface"] = 65536] = "Interface";
+ TypeFlags[TypeFlags["Reference"] = 131072] = "Reference";
+ TypeFlags[TypeFlags["Tuple"] = 262144] = "Tuple";
+ TypeFlags[TypeFlags["Union"] = 524288] = "Union";
+ TypeFlags[TypeFlags["Intersection"] = 1048576] = "Intersection";
+ TypeFlags[TypeFlags["Anonymous"] = 2097152] = "Anonymous";
+ TypeFlags[TypeFlags["Instantiated"] = 4194304] = "Instantiated";
+ TypeFlags[TypeFlags["ObjectLiteral"] = 8388608] = "ObjectLiteral";
+ TypeFlags[TypeFlags["FreshLiteral"] = 16777216] = "FreshLiteral";
+ TypeFlags[TypeFlags["ContainsWideningType"] = 33554432] = "ContainsWideningType";
+ TypeFlags[TypeFlags["ContainsObjectLiteral"] = 67108864] = "ContainsObjectLiteral";
+ TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 134217728] = "ContainsAnyFunctionType";
+ TypeFlags[TypeFlags["Nullable"] = 6144] = "Nullable";
+ TypeFlags[TypeFlags["Literal"] = 480] = "Literal";
+ TypeFlags[TypeFlags["StringOrNumberLiteral"] = 96] = "StringOrNumberLiteral";
+ TypeFlags[TypeFlags["DefinitelyFalsy"] = 7392] = "DefinitelyFalsy";
+ TypeFlags[TypeFlags["PossiblyFalsy"] = 7406] = "PossiblyFalsy";
+ TypeFlags[TypeFlags["Intrinsic"] = 16015] = "Intrinsic";
+ TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive";
+ TypeFlags[TypeFlags["StringLike"] = 34] = "StringLike";
+ TypeFlags[TypeFlags["NumberLike"] = 340] = "NumberLike";
+ TypeFlags[TypeFlags["BooleanLike"] = 136] = "BooleanLike";
+ TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike";
+ TypeFlags[TypeFlags["ObjectType"] = 2588672] = "ObjectType";
+ TypeFlags[TypeFlags["UnionOrIntersection"] = 1572864] = "UnionOrIntersection";
+ TypeFlags[TypeFlags["StructuredType"] = 4161536] = "StructuredType";
+ TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 4177920] = "StructuredOrTypeParameter";
+ TypeFlags[TypeFlags["Narrowable"] = 4178943] = "Narrowable";
+ TypeFlags[TypeFlags["NotUnionOrUnit"] = 2589185] = "NotUnionOrUnit";
+ TypeFlags[TypeFlags["RequiresWidening"] = 100663296] = "RequiresWidening";
+ TypeFlags[TypeFlags["PropagatingFlags"] = 234881024] = "PropagatingFlags";
+ })(ts.TypeFlags || (ts.TypeFlags = {}));
+ var TypeFlags = ts.TypeFlags;
+ (function (SignatureKind) {
+ SignatureKind[SignatureKind["Call"] = 0] = "Call";
+ SignatureKind[SignatureKind["Construct"] = 1] = "Construct";
+ })(ts.SignatureKind || (ts.SignatureKind = {}));
+ var SignatureKind = ts.SignatureKind;
+ (function (IndexKind) {
+ IndexKind[IndexKind["String"] = 0] = "String";
+ IndexKind[IndexKind["Number"] = 1] = "Number";
+ })(ts.IndexKind || (ts.IndexKind = {}));
+ var IndexKind = ts.IndexKind;
+ (function (SpecialPropertyAssignmentKind) {
+ SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["None"] = 0] = "None";
+ SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ExportsProperty"] = 1] = "ExportsProperty";
+ SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ModuleExports"] = 2] = "ModuleExports";
+ SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["PrototypeProperty"] = 3] = "PrototypeProperty";
+ SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ThisProperty"] = 4] = "ThisProperty";
+ })(ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {}));
+ var SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind;
(function (DiagnosticCategory) {
DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
@@ -63,10 +667,267 @@ var ts;
ModuleKind[ModuleKind["AMD"] = 2] = "AMD";
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
ModuleKind[ModuleKind["System"] = 4] = "System";
- ModuleKind[ModuleKind["ES6"] = 5] = "ES6";
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
})(ts.ModuleKind || (ts.ModuleKind = {}));
var ModuleKind = ts.ModuleKind;
+ (function (JsxEmit) {
+ JsxEmit[JsxEmit["None"] = 0] = "None";
+ JsxEmit[JsxEmit["Preserve"] = 1] = "Preserve";
+ JsxEmit[JsxEmit["React"] = 2] = "React";
+ })(ts.JsxEmit || (ts.JsxEmit = {}));
+ var JsxEmit = ts.JsxEmit;
+ (function (NewLineKind) {
+ NewLineKind[NewLineKind["CarriageReturnLineFeed"] = 0] = "CarriageReturnLineFeed";
+ NewLineKind[NewLineKind["LineFeed"] = 1] = "LineFeed";
+ })(ts.NewLineKind || (ts.NewLineKind = {}));
+ var NewLineKind = ts.NewLineKind;
+ (function (ScriptKind) {
+ ScriptKind[ScriptKind["Unknown"] = 0] = "Unknown";
+ ScriptKind[ScriptKind["JS"] = 1] = "JS";
+ ScriptKind[ScriptKind["JSX"] = 2] = "JSX";
+ ScriptKind[ScriptKind["TS"] = 3] = "TS";
+ ScriptKind[ScriptKind["TSX"] = 4] = "TSX";
+ })(ts.ScriptKind || (ts.ScriptKind = {}));
+ var ScriptKind = ts.ScriptKind;
+ (function (ScriptTarget) {
+ ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3";
+ ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5";
+ ScriptTarget[ScriptTarget["ES2015"] = 2] = "ES2015";
+ ScriptTarget[ScriptTarget["ES2016"] = 3] = "ES2016";
+ ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017";
+ ScriptTarget[ScriptTarget["Latest"] = 4] = "Latest";
+ })(ts.ScriptTarget || (ts.ScriptTarget = {}));
+ var ScriptTarget = ts.ScriptTarget;
+ (function (LanguageVariant) {
+ LanguageVariant[LanguageVariant["Standard"] = 0] = "Standard";
+ LanguageVariant[LanguageVariant["JSX"] = 1] = "JSX";
+ })(ts.LanguageVariant || (ts.LanguageVariant = {}));
+ var LanguageVariant = ts.LanguageVariant;
+ (function (DiagnosticStyle) {
+ DiagnosticStyle[DiagnosticStyle["Simple"] = 0] = "Simple";
+ DiagnosticStyle[DiagnosticStyle["Pretty"] = 1] = "Pretty";
+ })(ts.DiagnosticStyle || (ts.DiagnosticStyle = {}));
+ var DiagnosticStyle = ts.DiagnosticStyle;
+ (function (WatchDirectoryFlags) {
+ WatchDirectoryFlags[WatchDirectoryFlags["None"] = 0] = "None";
+ WatchDirectoryFlags[WatchDirectoryFlags["Recursive"] = 1] = "Recursive";
+ })(ts.WatchDirectoryFlags || (ts.WatchDirectoryFlags = {}));
+ var WatchDirectoryFlags = ts.WatchDirectoryFlags;
+ (function (CharacterCodes) {
+ CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter";
+ CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter";
+ CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed";
+ CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn";
+ CharacterCodes[CharacterCodes["lineSeparator"] = 8232] = "lineSeparator";
+ CharacterCodes[CharacterCodes["paragraphSeparator"] = 8233] = "paragraphSeparator";
+ CharacterCodes[CharacterCodes["nextLine"] = 133] = "nextLine";
+ CharacterCodes[CharacterCodes["space"] = 32] = "space";
+ CharacterCodes[CharacterCodes["nonBreakingSpace"] = 160] = "nonBreakingSpace";
+ CharacterCodes[CharacterCodes["enQuad"] = 8192] = "enQuad";
+ CharacterCodes[CharacterCodes["emQuad"] = 8193] = "emQuad";
+ CharacterCodes[CharacterCodes["enSpace"] = 8194] = "enSpace";
+ CharacterCodes[CharacterCodes["emSpace"] = 8195] = "emSpace";
+ CharacterCodes[CharacterCodes["threePerEmSpace"] = 8196] = "threePerEmSpace";
+ CharacterCodes[CharacterCodes["fourPerEmSpace"] = 8197] = "fourPerEmSpace";
+ CharacterCodes[CharacterCodes["sixPerEmSpace"] = 8198] = "sixPerEmSpace";
+ CharacterCodes[CharacterCodes["figureSpace"] = 8199] = "figureSpace";
+ CharacterCodes[CharacterCodes["punctuationSpace"] = 8200] = "punctuationSpace";
+ CharacterCodes[CharacterCodes["thinSpace"] = 8201] = "thinSpace";
+ CharacterCodes[CharacterCodes["hairSpace"] = 8202] = "hairSpace";
+ CharacterCodes[CharacterCodes["zeroWidthSpace"] = 8203] = "zeroWidthSpace";
+ CharacterCodes[CharacterCodes["narrowNoBreakSpace"] = 8239] = "narrowNoBreakSpace";
+ CharacterCodes[CharacterCodes["ideographicSpace"] = 12288] = "ideographicSpace";
+ CharacterCodes[CharacterCodes["mathematicalSpace"] = 8287] = "mathematicalSpace";
+ CharacterCodes[CharacterCodes["ogham"] = 5760] = "ogham";
+ CharacterCodes[CharacterCodes["_"] = 95] = "_";
+ CharacterCodes[CharacterCodes["$"] = 36] = "$";
+ CharacterCodes[CharacterCodes["_0"] = 48] = "_0";
+ CharacterCodes[CharacterCodes["_1"] = 49] = "_1";
+ CharacterCodes[CharacterCodes["_2"] = 50] = "_2";
+ CharacterCodes[CharacterCodes["_3"] = 51] = "_3";
+ CharacterCodes[CharacterCodes["_4"] = 52] = "_4";
+ CharacterCodes[CharacterCodes["_5"] = 53] = "_5";
+ CharacterCodes[CharacterCodes["_6"] = 54] = "_6";
+ CharacterCodes[CharacterCodes["_7"] = 55] = "_7";
+ CharacterCodes[CharacterCodes["_8"] = 56] = "_8";
+ CharacterCodes[CharacterCodes["_9"] = 57] = "_9";
+ CharacterCodes[CharacterCodes["a"] = 97] = "a";
+ CharacterCodes[CharacterCodes["b"] = 98] = "b";
+ CharacterCodes[CharacterCodes["c"] = 99] = "c";
+ CharacterCodes[CharacterCodes["d"] = 100] = "d";
+ CharacterCodes[CharacterCodes["e"] = 101] = "e";
+ CharacterCodes[CharacterCodes["f"] = 102] = "f";
+ CharacterCodes[CharacterCodes["g"] = 103] = "g";
+ CharacterCodes[CharacterCodes["h"] = 104] = "h";
+ CharacterCodes[CharacterCodes["i"] = 105] = "i";
+ CharacterCodes[CharacterCodes["j"] = 106] = "j";
+ CharacterCodes[CharacterCodes["k"] = 107] = "k";
+ CharacterCodes[CharacterCodes["l"] = 108] = "l";
+ CharacterCodes[CharacterCodes["m"] = 109] = "m";
+ CharacterCodes[CharacterCodes["n"] = 110] = "n";
+ CharacterCodes[CharacterCodes["o"] = 111] = "o";
+ CharacterCodes[CharacterCodes["p"] = 112] = "p";
+ CharacterCodes[CharacterCodes["q"] = 113] = "q";
+ CharacterCodes[CharacterCodes["r"] = 114] = "r";
+ CharacterCodes[CharacterCodes["s"] = 115] = "s";
+ CharacterCodes[CharacterCodes["t"] = 116] = "t";
+ CharacterCodes[CharacterCodes["u"] = 117] = "u";
+ CharacterCodes[CharacterCodes["v"] = 118] = "v";
+ CharacterCodes[CharacterCodes["w"] = 119] = "w";
+ CharacterCodes[CharacterCodes["x"] = 120] = "x";
+ CharacterCodes[CharacterCodes["y"] = 121] = "y";
+ CharacterCodes[CharacterCodes["z"] = 122] = "z";
+ CharacterCodes[CharacterCodes["A"] = 65] = "A";
+ CharacterCodes[CharacterCodes["B"] = 66] = "B";
+ CharacterCodes[CharacterCodes["C"] = 67] = "C";
+ CharacterCodes[CharacterCodes["D"] = 68] = "D";
+ CharacterCodes[CharacterCodes["E"] = 69] = "E";
+ CharacterCodes[CharacterCodes["F"] = 70] = "F";
+ CharacterCodes[CharacterCodes["G"] = 71] = "G";
+ CharacterCodes[CharacterCodes["H"] = 72] = "H";
+ CharacterCodes[CharacterCodes["I"] = 73] = "I";
+ CharacterCodes[CharacterCodes["J"] = 74] = "J";
+ CharacterCodes[CharacterCodes["K"] = 75] = "K";
+ CharacterCodes[CharacterCodes["L"] = 76] = "L";
+ CharacterCodes[CharacterCodes["M"] = 77] = "M";
+ CharacterCodes[CharacterCodes["N"] = 78] = "N";
+ CharacterCodes[CharacterCodes["O"] = 79] = "O";
+ CharacterCodes[CharacterCodes["P"] = 80] = "P";
+ CharacterCodes[CharacterCodes["Q"] = 81] = "Q";
+ CharacterCodes[CharacterCodes["R"] = 82] = "R";
+ CharacterCodes[CharacterCodes["S"] = 83] = "S";
+ CharacterCodes[CharacterCodes["T"] = 84] = "T";
+ CharacterCodes[CharacterCodes["U"] = 85] = "U";
+ CharacterCodes[CharacterCodes["V"] = 86] = "V";
+ CharacterCodes[CharacterCodes["W"] = 87] = "W";
+ CharacterCodes[CharacterCodes["X"] = 88] = "X";
+ CharacterCodes[CharacterCodes["Y"] = 89] = "Y";
+ CharacterCodes[CharacterCodes["Z"] = 90] = "Z";
+ CharacterCodes[CharacterCodes["ampersand"] = 38] = "ampersand";
+ CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk";
+ CharacterCodes[CharacterCodes["at"] = 64] = "at";
+ CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash";
+ CharacterCodes[CharacterCodes["backtick"] = 96] = "backtick";
+ CharacterCodes[CharacterCodes["bar"] = 124] = "bar";
+ CharacterCodes[CharacterCodes["caret"] = 94] = "caret";
+ CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace";
+ CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket";
+ CharacterCodes[CharacterCodes["closeParen"] = 41] = "closeParen";
+ CharacterCodes[CharacterCodes["colon"] = 58] = "colon";
+ CharacterCodes[CharacterCodes["comma"] = 44] = "comma";
+ CharacterCodes[CharacterCodes["dot"] = 46] = "dot";
+ CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote";
+ CharacterCodes[CharacterCodes["equals"] = 61] = "equals";
+ CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation";
+ CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan";
+ CharacterCodes[CharacterCodes["hash"] = 35] = "hash";
+ CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan";
+ CharacterCodes[CharacterCodes["minus"] = 45] = "minus";
+ CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace";
+ CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket";
+ CharacterCodes[CharacterCodes["openParen"] = 40] = "openParen";
+ CharacterCodes[CharacterCodes["percent"] = 37] = "percent";
+ CharacterCodes[CharacterCodes["plus"] = 43] = "plus";
+ CharacterCodes[CharacterCodes["question"] = 63] = "question";
+ CharacterCodes[CharacterCodes["semicolon"] = 59] = "semicolon";
+ CharacterCodes[CharacterCodes["singleQuote"] = 39] = "singleQuote";
+ CharacterCodes[CharacterCodes["slash"] = 47] = "slash";
+ CharacterCodes[CharacterCodes["tilde"] = 126] = "tilde";
+ CharacterCodes[CharacterCodes["backspace"] = 8] = "backspace";
+ CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed";
+ CharacterCodes[CharacterCodes["byteOrderMark"] = 65279] = "byteOrderMark";
+ CharacterCodes[CharacterCodes["tab"] = 9] = "tab";
+ CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab";
+ })(ts.CharacterCodes || (ts.CharacterCodes = {}));
+ var CharacterCodes = ts.CharacterCodes;
+ (function (TransformFlags) {
+ TransformFlags[TransformFlags["None"] = 0] = "None";
+ TransformFlags[TransformFlags["TypeScript"] = 1] = "TypeScript";
+ TransformFlags[TransformFlags["ContainsTypeScript"] = 2] = "ContainsTypeScript";
+ TransformFlags[TransformFlags["Jsx"] = 4] = "Jsx";
+ TransformFlags[TransformFlags["ContainsJsx"] = 8] = "ContainsJsx";
+ TransformFlags[TransformFlags["ES2017"] = 16] = "ES2017";
+ TransformFlags[TransformFlags["ContainsES2017"] = 32] = "ContainsES2017";
+ TransformFlags[TransformFlags["ES2016"] = 64] = "ES2016";
+ TransformFlags[TransformFlags["ContainsES2016"] = 128] = "ContainsES2016";
+ TransformFlags[TransformFlags["ES2015"] = 256] = "ES2015";
+ TransformFlags[TransformFlags["ContainsES2015"] = 512] = "ContainsES2015";
+ TransformFlags[TransformFlags["DestructuringAssignment"] = 1024] = "DestructuringAssignment";
+ TransformFlags[TransformFlags["Generator"] = 2048] = "Generator";
+ TransformFlags[TransformFlags["ContainsGenerator"] = 4096] = "ContainsGenerator";
+ TransformFlags[TransformFlags["ContainsDecorators"] = 8192] = "ContainsDecorators";
+ TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 16384] = "ContainsPropertyInitializer";
+ TransformFlags[TransformFlags["ContainsLexicalThis"] = 32768] = "ContainsLexicalThis";
+ TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 65536] = "ContainsCapturedLexicalThis";
+ TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 131072] = "ContainsLexicalThisInComputedPropertyName";
+ TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 262144] = "ContainsDefaultValueAssignments";
+ TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 524288] = "ContainsParameterPropertyAssignments";
+ TransformFlags[TransformFlags["ContainsSpreadElementExpression"] = 1048576] = "ContainsSpreadElementExpression";
+ TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 2097152] = "ContainsComputedPropertyName";
+ TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 4194304] = "ContainsBlockScopedBinding";
+ TransformFlags[TransformFlags["ContainsBindingPattern"] = 8388608] = "ContainsBindingPattern";
+ TransformFlags[TransformFlags["ContainsYield"] = 16777216] = "ContainsYield";
+ TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 33554432] = "ContainsHoistedDeclarationOrCompletion";
+ TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
+ TransformFlags[TransformFlags["AssertTypeScript"] = 3] = "AssertTypeScript";
+ TransformFlags[TransformFlags["AssertJsx"] = 12] = "AssertJsx";
+ TransformFlags[TransformFlags["AssertES2017"] = 48] = "AssertES2017";
+ TransformFlags[TransformFlags["AssertES2016"] = 192] = "AssertES2016";
+ TransformFlags[TransformFlags["AssertES2015"] = 768] = "AssertES2015";
+ TransformFlags[TransformFlags["AssertGenerator"] = 6144] = "AssertGenerator";
+ TransformFlags[TransformFlags["NodeExcludes"] = 536874325] = "NodeExcludes";
+ TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 592227669] = "ArrowFunctionExcludes";
+ TransformFlags[TransformFlags["FunctionExcludes"] = 592293205] = "FunctionExcludes";
+ TransformFlags[TransformFlags["ConstructorExcludes"] = 591760725] = "ConstructorExcludes";
+ TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 591760725] = "MethodOrAccessorExcludes";
+ TransformFlags[TransformFlags["ClassExcludes"] = 539749717] = "ClassExcludes";
+ TransformFlags[TransformFlags["ModuleExcludes"] = 574729557] = "ModuleExcludes";
+ TransformFlags[TransformFlags["TypeExcludes"] = -3] = "TypeExcludes";
+ TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 539110741] = "ObjectLiteralExcludes";
+ TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 537922901] = "ArrayLiteralOrCallOrNewExcludes";
+ TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 545262933] = "VariableDeclarationListExcludes";
+ TransformFlags[TransformFlags["ParameterExcludes"] = 545262933] = "ParameterExcludes";
+ TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 548864] = "TypeScriptClassSyntaxMask";
+ TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 327680] = "ES2015FunctionSyntaxMask";
+ })(ts.TransformFlags || (ts.TransformFlags = {}));
+ var TransformFlags = ts.TransformFlags;
+ (function (EmitFlags) {
+ EmitFlags[EmitFlags["EmitEmitHelpers"] = 1] = "EmitEmitHelpers";
+ EmitFlags[EmitFlags["EmitExportStar"] = 2] = "EmitExportStar";
+ EmitFlags[EmitFlags["EmitSuperHelper"] = 4] = "EmitSuperHelper";
+ EmitFlags[EmitFlags["EmitAdvancedSuperHelper"] = 8] = "EmitAdvancedSuperHelper";
+ EmitFlags[EmitFlags["UMDDefine"] = 16] = "UMDDefine";
+ EmitFlags[EmitFlags["SingleLine"] = 32] = "SingleLine";
+ EmitFlags[EmitFlags["AdviseOnEmitNode"] = 64] = "AdviseOnEmitNode";
+ EmitFlags[EmitFlags["NoSubstitution"] = 128] = "NoSubstitution";
+ EmitFlags[EmitFlags["CapturesThis"] = 256] = "CapturesThis";
+ EmitFlags[EmitFlags["NoLeadingSourceMap"] = 512] = "NoLeadingSourceMap";
+ EmitFlags[EmitFlags["NoTrailingSourceMap"] = 1024] = "NoTrailingSourceMap";
+ EmitFlags[EmitFlags["NoSourceMap"] = 1536] = "NoSourceMap";
+ EmitFlags[EmitFlags["NoNestedSourceMaps"] = 2048] = "NoNestedSourceMaps";
+ EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 4096] = "NoTokenLeadingSourceMaps";
+ EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 8192] = "NoTokenTrailingSourceMaps";
+ EmitFlags[EmitFlags["NoTokenSourceMaps"] = 12288] = "NoTokenSourceMaps";
+ EmitFlags[EmitFlags["NoLeadingComments"] = 16384] = "NoLeadingComments";
+ EmitFlags[EmitFlags["NoTrailingComments"] = 32768] = "NoTrailingComments";
+ EmitFlags[EmitFlags["NoComments"] = 49152] = "NoComments";
+ EmitFlags[EmitFlags["NoNestedComments"] = 65536] = "NoNestedComments";
+ EmitFlags[EmitFlags["ExportName"] = 131072] = "ExportName";
+ EmitFlags[EmitFlags["LocalName"] = 262144] = "LocalName";
+ EmitFlags[EmitFlags["Indented"] = 524288] = "Indented";
+ EmitFlags[EmitFlags["NoIndentation"] = 1048576] = "NoIndentation";
+ EmitFlags[EmitFlags["AsyncFunctionBody"] = 2097152] = "AsyncFunctionBody";
+ EmitFlags[EmitFlags["ReuseTempVariableScope"] = 4194304] = "ReuseTempVariableScope";
+ EmitFlags[EmitFlags["CustomPrologue"] = 8388608] = "CustomPrologue";
+ })(ts.EmitFlags || (ts.EmitFlags = {}));
+ var EmitFlags = ts.EmitFlags;
+ (function (EmitContext) {
+ EmitContext[EmitContext["SourceFile"] = 0] = "SourceFile";
+ EmitContext[EmitContext["Expression"] = 1] = "Expression";
+ EmitContext[EmitContext["IdentifierName"] = 2] = "IdentifierName";
+ EmitContext[EmitContext["Unspecified"] = 3] = "Unspecified";
+ })(ts.EmitContext || (ts.EmitContext = {}));
+ var EmitContext = ts.EmitContext;
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -77,7 +938,7 @@ var ts;
(function (performance) {
var profilerEvent = typeof onProfilerEvent === "function" && onProfilerEvent.profiler === true
? onProfilerEvent
- : function (markName) { };
+ : function (_markName) { };
var enabled = false;
var profilerStart = 0;
var counts;
@@ -129,7 +990,14 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ (function (Ternary) {
+ Ternary[Ternary["False"] = 0] = "False";
+ Ternary[Ternary["Maybe"] = 1] = "Maybe";
+ Ternary[Ternary["True"] = -1] = "True";
+ })(ts.Ternary || (ts.Ternary = {}));
+ var Ternary = ts.Ternary;
var createObject = Object.create;
+ ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
function createMap(template) {
var map = createObject(null);
map["__"] = undefined;
@@ -150,7 +1018,7 @@ var ts;
remove: remove,
forEachValue: forEachValueInMap,
getKeys: getKeys,
- clear: clear
+ clear: clear,
};
function forEachValueInMap(f) {
for (var key in files) {
@@ -192,6 +1060,12 @@ var ts;
return getCanonicalFileName(nonCanonicalizedPath);
}
ts.toPath = toPath;
+ (function (Comparison) {
+ Comparison[Comparison["LessThan"] = -1] = "LessThan";
+ Comparison[Comparison["EqualTo"] = 0] = "EqualTo";
+ Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan";
+ })(ts.Comparison || (ts.Comparison = {}));
+ var Comparison = ts.Comparison;
function forEach(array, callback) {
if (array) {
for (var i = 0, len = array.length; i < len; i++) {
@@ -335,13 +1209,32 @@ var ts;
if (array) {
result = [];
for (var i = 0; i < array.length; i++) {
- var v = array[i];
- result.push(f(v, i));
+ result.push(f(array[i], i));
}
}
return result;
}
ts.map = map;
+ function sameMap(array, f) {
+ var result;
+ if (array) {
+ for (var i = 0; i < array.length; i++) {
+ if (result) {
+ result.push(f(array[i], i));
+ }
+ else {
+ var item = array[i];
+ var mapped = f(item, i);
+ if (item !== mapped) {
+ result = array.slice(0, i);
+ result.push(mapped);
+ }
+ }
+ }
+ }
+ return result || array;
+ }
+ ts.sameMap = sameMap;
function flatten(array) {
var result;
if (array) {
@@ -442,6 +1335,18 @@ var ts;
return result;
}
ts.mapObject = mapObject;
+ function some(array, predicate) {
+ if (array) {
+ for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {
+ var v = array_5[_i];
+ if (!predicate || predicate(v)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ ts.some = some;
function concatenate(array1, array2) {
if (!array2 || !array2.length)
return array1;
@@ -454,8 +1359,8 @@ var ts;
var result;
if (array) {
result = [];
- loop: for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {
- var item = array_5[_i];
+ loop: for (var _i = 0, array_6 = array; _i < array_6.length; _i++) {
+ var item = array_6[_i];
for (var _a = 0, result_1 = result; _a < result_1.length; _a++) {
var res = result_1[_a];
if (areEqual ? areEqual(res, item) : res === item) {
@@ -488,8 +1393,8 @@ var ts;
ts.compact = compact;
function sum(array, prop) {
var result = 0;
- for (var _i = 0, array_6 = array; _i < array_6.length; _i++) {
- var v = array_6[_i];
+ for (var _i = 0, array_7 = array; _i < array_7.length; _i++) {
+ var v = array_7[_i];
result += v[prop];
}
return result;
@@ -708,8 +1613,8 @@ var ts;
ts.equalOwnProperties = equalOwnProperties;
function arrayToMap(array, makeKey, makeValue) {
var result = createMap();
- for (var _i = 0, array_7 = array; _i < array_7.length; _i++) {
- var value = array_7[_i];
+ for (var _i = 0, array_8 = array; _i < array_8.length; _i++) {
+ var value = array_8[_i];
result[makeKey(value)] = makeValue ? makeValue(value) : value;
}
return result;
@@ -810,7 +1715,7 @@ var ts;
return function (t) { return compose(a(t)); };
}
else {
- return function (t) { return function (u) { return u; }; };
+ return function (_) { return function (u) { return u; }; };
}
}
ts.chain = chain;
@@ -841,7 +1746,7 @@ var ts;
ts.compose = compose;
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) {
@@ -866,11 +1771,11 @@ var ts;
length: length,
messageText: text,
category: message.category,
- code: message.code
+ code: message.code,
};
}
ts.createFileDiagnostic = createFileDiagnostic;
- function formatMessage(dummy, message) {
+ function formatMessage(_dummy, message) {
var text = getLocaleSpecificMessage(message);
if (arguments.length > 2) {
text = formatStringFromArgs(text, arguments, 2);
@@ -933,7 +1838,7 @@ var ts;
if (b === undefined)
return 1;
if (ignoreCase) {
- if (String.prototype.localeCompare) {
+ if (ts.collator && String.prototype.localeCompare) {
var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" });
return result < 0 ? -1 : result > 0 ? 1 : 0;
}
@@ -1086,7 +1991,7 @@ var ts;
function getEmitModuleKind(compilerOptions) {
return typeof compilerOptions.module === "number" ?
compilerOptions.module :
- getEmitScriptTarget(compilerOptions) === 2 ? ts.ModuleKind.ES6 : ts.ModuleKind.CommonJS;
+ getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
}
ts.getEmitModuleKind = getEmitModuleKind;
function hasZeroOrOneAsteriskCharacter(str) {
@@ -1383,7 +2288,7 @@ var ts;
function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {
return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
}
- function getFileMatcherPatterns(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {
+ function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {
path = normalizePath(path);
currentDirectory = normalizePath(currentDirectory);
var absolutePath = combinePaths(currentDirectory, path);
@@ -1398,7 +2303,7 @@ var ts;
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, getFileSystemEntries) {
path = normalizePath(path);
currentDirectory = normalizePath(currentDirectory);
- var patterns = getFileMatcherPatterns(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
+ var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
var regexFlag = useCaseSensitiveFileNames ? "" : "i";
var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag);
var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag);
@@ -1508,6 +2413,14 @@ var ts;
return false;
}
ts.isSupportedSourceFileName = isSupportedSourceFileName;
+ (function (ExtensionPriority) {
+ ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles";
+ ExtensionPriority[ExtensionPriority["DeclarationAndJavaScriptFiles"] = 2] = "DeclarationAndJavaScriptFiles";
+ ExtensionPriority[ExtensionPriority["Limit"] = 5] = "Limit";
+ ExtensionPriority[ExtensionPriority["Highest"] = 0] = "Highest";
+ ExtensionPriority[ExtensionPriority["Lowest"] = 2] = "Lowest";
+ })(ts.ExtensionPriority || (ts.ExtensionPriority = {}));
+ var ExtensionPriority = ts.ExtensionPriority;
function getExtensionPriority(path, supportedExtensions) {
for (var i = supportedExtensions.length - 1; i >= 0; i--) {
if (fileExtensionIs(path, supportedExtensions[i])) {
@@ -1571,10 +2484,10 @@ var ts;
this.name = name;
this.declarations = undefined;
}
- function Type(checker, flags) {
+ function Type(_checker, flags) {
this.flags = flags;
}
- function Signature(checker) {
+ function Signature() {
}
function Node(kind, pos, end) {
this.id = 0;
@@ -1596,6 +2509,13 @@ var ts;
getTypeConstructor: function () { return Type; },
getSignatureConstructor: function () { return Signature; }
};
+ (function (AssertionLevel) {
+ AssertionLevel[AssertionLevel["None"] = 0] = "None";
+ AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal";
+ AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive";
+ AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive";
+ })(ts.AssertionLevel || (ts.AssertionLevel = {}));
+ var AssertionLevel = ts.AssertionLevel;
var Debug;
(function (Debug) {
Debug.currentAssertionLevel = 0;
@@ -1908,7 +2828,7 @@ var ts;
}
var platform = _os.platform();
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
- function readFile(fileName, encoding) {
+ function readFile(fileName, _encoding) {
if (!fileExists(fileName)) {
return undefined;
}
@@ -1980,6 +2900,11 @@ var ts;
function readDirectory(path, extensions, excludes, includes) {
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), getAccessibleFileSystemEntries);
}
+ var FileSystemEntryKind;
+ (function (FileSystemEntryKind) {
+ FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File";
+ FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory";
+ })(FileSystemEntryKind || (FileSystemEntryKind = {}));
function fileSystemEntryExists(path, entryKind) {
try {
var stat = _fs.statSync(path);
@@ -2121,7 +3046,7 @@ var ts;
args: ChakraHost.args,
useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames,
write: ChakraHost.echo,
- readFile: function (path, encoding) {
+ readFile: function (path, _encoding) {
return ChakraHost.readFile(path);
},
writeFile: function (path, data, writeByteOrderMark) {
@@ -2137,9 +3062,9 @@ var ts;
getExecutingFilePath: function () { return ChakraHost.executingFile; },
getCurrentDirectory: function () { return ChakraHost.currentDirectory; },
getDirectories: ChakraHost.getDirectories,
- getEnvironmentVariable: ChakraHost.getEnvironmentVariable || (function (name) { return ""; }),
+ getEnvironmentVariable: ChakraHost.getEnvironmentVariable || (function () { return ""; }),
readDirectory: function (path, extensions, excludes, includes) {
- var pattern = ts.getFileMatcherPatterns(path, extensions, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory);
+ var pattern = ts.getFileMatcherPatterns(path, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory);
return ChakraHost.readDirectory(path, extensions, pattern.basePaths, pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern);
},
exit: ChakraHost.quit,
@@ -2927,7 +3852,7 @@ var ts;
Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: "Binding_element_0_implicitly_has_an_1_type_7031", message: "Binding element '{0}' implicitly has an '{1}' type." },
Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: { code: 7032, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032", message: "Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation." },
Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: { code: 7033, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033", message: "Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation." },
- Variable_0_implicitly_has_type_any_in_some_locations_where_its_type_cannot_be_determined: { code: 7034, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_type_any_in_some_locations_where_its_type_cannot_be_determined_7034", message: "Variable '{0}' implicitly has type 'any' in some locations where its type cannot be determined." },
+ Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: { code: 7034, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034", message: "Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined." },
You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "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_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." },
import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." },
@@ -2964,10194 +3889,8756 @@ var ts;
Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" },
Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" },
Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" },
- Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }
+ Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
};
})(ts || (ts = {}));
var ts;
(function (ts) {
- function tokenIsIdentifierOrKeyword(token) {
- return token >= 69;
- }
- ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;
- var textToToken = ts.createMap({
- "abstract": 115,
- "any": 117,
- "as": 116,
- "boolean": 120,
- "break": 70,
- "case": 71,
- "catch": 72,
- "class": 73,
- "continue": 75,
- "const": 74,
- "constructor": 121,
- "debugger": 76,
- "declare": 122,
- "default": 77,
- "delete": 78,
- "do": 79,
- "else": 80,
- "enum": 81,
- "export": 82,
- "extends": 83,
- "false": 84,
- "finally": 85,
- "for": 86,
- "from": 136,
- "function": 87,
- "get": 123,
- "if": 88,
- "implements": 106,
- "import": 89,
- "in": 90,
- "instanceof": 91,
- "interface": 107,
- "is": 124,
- "let": 108,
- "module": 125,
- "namespace": 126,
- "never": 127,
- "new": 92,
- "null": 93,
- "number": 130,
- "package": 109,
- "private": 110,
- "protected": 111,
- "public": 112,
- "readonly": 128,
- "require": 129,
- "global": 137,
- "return": 94,
- "set": 131,
- "static": 113,
- "string": 132,
- "super": 95,
- "switch": 96,
- "symbol": 133,
- "this": 97,
- "throw": 98,
- "true": 99,
- "try": 100,
- "type": 134,
- "typeof": 101,
- "undefined": 135,
- "var": 102,
- "void": 103,
- "while": 104,
- "with": 105,
- "yield": 114,
- "async": 118,
- "await": 119,
- "of": 138,
- "{": 15,
- "}": 16,
- "(": 17,
- ")": 18,
- "[": 19,
- "]": 20,
- ".": 21,
- "...": 22,
- ";": 23,
- ",": 24,
- "<": 25,
- ">": 27,
- "<=": 28,
- ">=": 29,
- "==": 30,
- "!=": 31,
- "===": 32,
- "!==": 33,
- "=>": 34,
- "+": 35,
- "-": 36,
- "**": 38,
- "*": 37,
- "/": 39,
- "%": 40,
- "++": 41,
- "--": 42,
- "<<": 43,
- "": 26,
- ">>": 44,
- ">>>": 45,
- "&": 46,
- "|": 47,
- "^": 48,
- "!": 49,
- "~": 50,
- "&&": 51,
- "||": 52,
- "?": 53,
- ":": 54,
- "=": 56,
- "+=": 57,
- "-=": 58,
- "*=": 59,
- "**=": 60,
- "/=": 61,
- "%=": 62,
- "<<=": 63,
- ">>=": 64,
- ">>>=": 65,
- "&=": 66,
- "|=": 67,
- "^=": 68,
- "@": 55
- });
- var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
- var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
- var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
- var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
- function lookupInUnicodeMap(code, map) {
- if (code < map[0]) {
- return false;
- }
- var lo = 0;
- var hi = map.length;
- var mid;
- while (lo + 1 < hi) {
- mid = lo + (hi - lo) / 2;
- mid -= mid % 2;
- if (map[mid] <= code && code <= map[mid + 1]) {
- return true;
- }
- if (code < map[mid]) {
- hi = mid;
- }
- else {
- lo = mid + 2;
- }
- }
- return false;
- }
- function isUnicodeIdentifierStart(code, languageVersion) {
- return languageVersion >= 1 ?
- lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierStart);
- }
- ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;
- function isUnicodeIdentifierPart(code, languageVersion) {
- return languageVersion >= 1 ?
- lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierPart);
+ function trace(host) {
+ host.trace(ts.formatMessage.apply(undefined, arguments));
}
- function makeReverseMap(source) {
- var result = [];
- for (var name_4 in source) {
- result[source[name_4]] = name_4;
- }
- return result;
+ ts.trace = trace;
+ function isTraceEnabled(compilerOptions, host) {
+ return compilerOptions.traceResolution && host.trace !== undefined;
}
- var tokenStrings = makeReverseMap(textToToken);
- function tokenToString(t) {
- return tokenStrings[t];
+ ts.isTraceEnabled = isTraceEnabled;
+ function createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations) {
+ return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
}
- ts.tokenToString = tokenToString;
- function stringToToken(s) {
- return textToToken[s];
+ ts.createResolvedModule = createResolvedModule;
+ function moduleHasNonRelativeName(moduleName) {
+ return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
}
- ts.stringToToken = stringToToken;
- function computeLineStarts(text) {
- var result = new Array();
- var pos = 0;
- var lineStart = 0;
- while (pos < text.length) {
- var ch = text.charCodeAt(pos);
- pos++;
- switch (ch) {
- case 13:
- if (text.charCodeAt(pos) === 10) {
- pos++;
+ function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
+ var jsonContent = readJson(packageJsonPath, state.host);
+ function tryReadFromField(fieldName) {
+ if (ts.hasProperty(jsonContent, fieldName)) {
+ var typesFile = jsonContent[fieldName];
+ if (typeof typesFile === "string") {
+ var typesFilePath_1 = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile));
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath_1);
}
- case 10:
- result.push(lineStart);
- lineStart = pos;
- break;
- default:
- if (ch > 127 && isLineBreak(ch)) {
- result.push(lineStart);
- lineStart = pos;
+ return typesFilePath_1;
+ }
+ else {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile);
}
- break;
+ }
}
}
- result.push(lineStart);
- return result;
- }
- ts.computeLineStarts = computeLineStarts;
- function getPositionOfLineAndCharacter(sourceFile, line, character) {
- return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character);
- }
- ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter;
- function computePositionOfLineAndCharacter(lineStarts, line, character) {
- ts.Debug.assert(line >= 0 && line < lineStarts.length);
- return lineStarts[line] + character;
- }
- ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter;
- function getLineStarts(sourceFile) {
- return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text));
- }
- ts.getLineStarts = getLineStarts;
- function computeLineAndCharacterOfPosition(lineStarts, position) {
- var lineNumber = ts.binarySearch(lineStarts, position);
- if (lineNumber < 0) {
- lineNumber = ~lineNumber - 1;
- ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file");
+ var typesFilePath = tryReadFromField("typings") || tryReadFromField("types");
+ if (typesFilePath) {
+ return typesFilePath;
}
- return {
- line: lineNumber,
- character: position - lineStarts[lineNumber]
- };
- }
- ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition;
- function getLineAndCharacterOfPosition(sourceFile, position) {
- return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position);
- }
- ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition;
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- function isWhiteSpace(ch) {
- return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);
- }
- ts.isWhiteSpace = isWhiteSpace;
- function isWhiteSpaceSingleLine(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;
- }
- ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine;
- function isLineBreak(ch) {
- return ch === 10 ||
- ch === 13 ||
- ch === 8232 ||
- ch === 8233;
- }
- ts.isLineBreak = isLineBreak;
- function isDigit(ch) {
- return ch >= 48 && ch <= 57;
+ if (state.compilerOptions.allowJs && jsonContent.main && typeof jsonContent.main === "string") {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0, jsonContent.main);
+ }
+ var mainFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
+ return mainFilePath;
+ }
+ return undefined;
}
- function isOctalDigit(ch) {
- return ch >= 48 && ch <= 55;
+ function readJson(path, host) {
+ try {
+ var jsonText = host.readFile(path);
+ return jsonText ? JSON.parse(jsonText) : {};
+ }
+ catch (e) {
+ return {};
+ }
}
- ts.isOctalDigit = isOctalDigit;
- function couldStartTrivia(text, pos) {
- var ch = text.charCodeAt(pos);
- switch (ch) {
- case 13:
- case 10:
- case 9:
- case 11:
- case 12:
- case 32:
- case 47:
- case 60:
- case 61:
- case 62:
- return true;
- case 35:
- return pos === 0;
- default:
- return ch > 127;
+ var typeReferenceExtensions = [".d.ts"];
+ function getEffectiveTypeRoots(options, host) {
+ if (options.typeRoots) {
+ return options.typeRoots;
+ }
+ var currentDirectory;
+ if (options.configFilePath) {
+ currentDirectory = ts.getDirectoryPath(options.configFilePath);
+ }
+ else if (host.getCurrentDirectory) {
+ currentDirectory = host.getCurrentDirectory();
}
+ return currentDirectory !== undefined && getDefaultTypeRoots(currentDirectory, host);
}
- ts.couldStartTrivia = couldStartTrivia;
- function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) {
- if (stopAtComments === void 0) { stopAtComments = false; }
- if (ts.positionIsSynthesized(pos)) {
- return pos;
+ ts.getEffectiveTypeRoots = getEffectiveTypeRoots;
+ function getDefaultTypeRoots(currentDirectory, host) {
+ if (!host.directoryExists) {
+ return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];
}
+ var typeRoots;
while (true) {
- var ch = text.charCodeAt(pos);
- switch (ch) {
- case 13:
- if (text.charCodeAt(pos + 1) === 10) {
- pos++;
- }
- case 10:
- pos++;
- if (stopAfterLineBreak) {
- return pos;
- }
- continue;
- case 9:
- case 11:
- case 12:
- case 32:
- pos++;
- continue;
- case 47:
- if (stopAtComments) {
- break;
- }
- if (text.charCodeAt(pos + 1) === 47) {
- pos += 2;
- while (pos < text.length) {
- if (isLineBreak(text.charCodeAt(pos))) {
- break;
- }
- pos++;
- }
- continue;
- }
- if (text.charCodeAt(pos + 1) === 42) {
- pos += 2;
- while (pos < text.length) {
- if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {
- pos += 2;
- break;
- }
- pos++;
- }
- continue;
- }
- break;
- case 60:
- case 61:
- case 62:
- if (isConflictMarkerTrivia(text, pos)) {
- pos = scanConflictMarkerTrivia(text, pos);
- continue;
- }
- break;
- case 35:
- if (pos === 0 && isShebangTrivia(text, pos)) {
- pos = scanShebangTrivia(text, pos);
- continue;
- }
- break;
- default:
- if (ch > 127 && (isWhiteSpace(ch))) {
- pos++;
- continue;
- }
- break;
+ var atTypes = ts.combinePaths(currentDirectory, nodeModulesAtTypes);
+ if (host.directoryExists(atTypes)) {
+ (typeRoots || (typeRoots = [])).push(atTypes);
}
- return pos;
+ var parent_1 = ts.getDirectoryPath(currentDirectory);
+ if (parent_1 === currentDirectory) {
+ break;
+ }
+ currentDirectory = parent_1;
}
+ return typeRoots;
}
- ts.skipTrivia = skipTrivia;
- var mergeConflictMarkerLength = "<<<<<<<".length;
- function isConflictMarkerTrivia(text, pos) {
- ts.Debug.assert(pos >= 0);
- if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) {
- var ch = text.charCodeAt(pos);
- if ((pos + mergeConflictMarkerLength) < text.length) {
- for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) {
- if (text.charCodeAt(pos + i) !== ch) {
- return false;
+ var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types");
+ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) {
+ var traceEnabled = isTraceEnabled(options, host);
+ var moduleResolutionState = {
+ compilerOptions: options,
+ host: host,
+ skipTsx: true,
+ traceEnabled: traceEnabled
+ };
+ var typeRoots = getEffectiveTypeRoots(options, host);
+ if (traceEnabled) {
+ if (containingFile === undefined) {
+ if (typeRoots === undefined) {
+ trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName);
+ }
+ else {
+ trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots);
+ }
+ }
+ else {
+ if (typeRoots === undefined) {
+ trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile);
+ }
+ else {
+ trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots);
+ }
+ }
+ }
+ var failedLookupLocations = [];
+ if (typeRoots && typeRoots.length) {
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
+ }
+ var primarySearchPaths = typeRoots;
+ for (var _i = 0, primarySearchPaths_1 = primarySearchPaths; _i < primarySearchPaths_1.length; _i++) {
+ var typeRoot = primarySearchPaths_1[_i];
+ var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName);
+ var candidateDirectory = ts.getDirectoryPath(candidate);
+ var resolvedFile_1 = loadNodeModuleFromDirectory(typeReferenceExtensions, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState);
+ if (resolvedFile_1) {
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile_1, true);
}
+ return {
+ resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolvedFile_1 },
+ failedLookupLocations: failedLookupLocations
+ };
}
- return ch === 61 ||
- text.charCodeAt(pos + mergeConflictMarkerLength) === 32;
}
}
- return false;
- }
- function scanConflictMarkerTrivia(text, pos, error) {
- if (error) {
- error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength);
+ else {
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths);
+ }
}
- var ch = text.charCodeAt(pos);
- var len = text.length;
- if (ch === 60 || ch === 62) {
- while (pos < len && !isLineBreak(text.charCodeAt(pos))) {
- pos++;
+ var resolvedFile;
+ var initialLocationForSecondaryLookup;
+ if (containingFile) {
+ initialLocationForSecondaryLookup = ts.getDirectoryPath(containingFile);
+ }
+ if (initialLocationForSecondaryLookup !== undefined) {
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
+ }
+ resolvedFile = loadModuleFromNodeModules(typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, false);
+ if (traceEnabled) {
+ if (resolvedFile) {
+ trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false);
+ }
+ else {
+ trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
+ }
}
}
else {
- ts.Debug.assert(ch === 61);
- while (pos < len) {
- var ch_1 = text.charCodeAt(pos);
- if (ch_1 === 62 && isConflictMarkerTrivia(text, pos)) {
- break;
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder);
+ }
+ }
+ return {
+ resolvedTypeReferenceDirective: resolvedFile
+ ? { primary: false, resolvedFileName: resolvedFile }
+ : undefined,
+ failedLookupLocations: failedLookupLocations
+ };
+ }
+ ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
+ function getAutomaticTypeDirectiveNames(options, host) {
+ if (options.types) {
+ return options.types;
+ }
+ var result = [];
+ if (host.directoryExists && host.getDirectories) {
+ var typeRoots = getEffectiveTypeRoots(options, host);
+ if (typeRoots) {
+ for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {
+ var root = typeRoots_1[_i];
+ if (host.directoryExists(root)) {
+ for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) {
+ var typeDirectivePath = _b[_a];
+ var normalized = ts.normalizePath(typeDirectivePath);
+ var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized));
+ var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null;
+ if (!isNotNeededPackage) {
+ result.push(ts.getBaseFileName(normalized));
+ }
+ }
+ }
}
- pos++;
}
}
- return pos;
+ return result;
}
- var shebangTriviaRegex = /^#!.*/;
- function isShebangTrivia(text, pos) {
- ts.Debug.assert(pos === 0);
- return shebangTriviaRegex.test(text);
+ ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
+ function resolveModuleName(moduleName, containingFile, compilerOptions, host) {
+ var traceEnabled = isTraceEnabled(compilerOptions, host);
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile);
+ }
+ var moduleResolution = compilerOptions.moduleResolution;
+ if (moduleResolution === undefined) {
+ moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);
+ }
+ }
+ else {
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);
+ }
+ }
+ var result;
+ switch (moduleResolution) {
+ case ts.ModuleResolutionKind.NodeJs:
+ result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host);
+ break;
+ case ts.ModuleResolutionKind.Classic:
+ result = classicNameResolver(moduleName, containingFile, compilerOptions, host);
+ break;
+ }
+ if (traceEnabled) {
+ if (result.resolvedModule) {
+ trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);
+ }
+ else {
+ trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);
+ }
+ }
+ return result;
}
- function scanShebangTrivia(text, pos) {
- var shebang = shebangTriviaRegex.exec(text)[0];
- pos = pos + shebang.length;
- return pos;
+ ts.resolveModuleName = resolveModuleName;
+ function tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) {
+ if (moduleHasNonRelativeName(moduleName)) {
+ return tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state);
+ }
+ else {
+ return tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state);
+ }
}
- function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
- var pendingPos;
- var pendingEnd;
- var pendingKind;
- var pendingHasTrailingNewLine;
- var hasPendingCommentRange = false;
- var collecting = trailing || pos === 0;
- var accumulator = initial;
- scan: while (pos >= 0 && pos < text.length) {
- var ch = text.charCodeAt(pos);
- switch (ch) {
- case 13:
- if (text.charCodeAt(pos + 1) === 10) {
- pos++;
- }
- case 10:
- pos++;
- if (trailing) {
- break scan;
- }
- collecting = true;
- if (hasPendingCommentRange) {
- pendingHasTrailingNewLine = true;
- }
- continue;
- case 9:
- case 11:
- case 12:
- case 32:
- pos++;
- continue;
- case 47:
- var nextChar = text.charCodeAt(pos + 1);
- var hasTrailingNewLine = false;
- if (nextChar === 47 || nextChar === 42) {
- var kind = nextChar === 47 ? 2 : 3;
- var startPos = pos;
- pos += 2;
- if (nextChar === 47) {
- while (pos < text.length) {
- if (isLineBreak(text.charCodeAt(pos))) {
- hasTrailingNewLine = true;
- break;
- }
- pos++;
- }
- }
- else {
- while (pos < text.length) {
- if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {
- pos += 2;
- break;
- }
- pos++;
- }
- }
- if (collecting) {
- if (hasPendingCommentRange) {
- accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);
- if (!reduce && accumulator) {
- return accumulator;
- }
- hasPendingCommentRange = false;
- }
- pendingPos = startPos;
- pendingEnd = pos;
- pendingKind = kind;
- pendingHasTrailingNewLine = hasTrailingNewLine;
- hasPendingCommentRange = true;
- }
- continue;
- }
- break scan;
- default:
- if (ch > 127 && (isWhiteSpace(ch))) {
- if (hasPendingCommentRange && isLineBreak(ch)) {
- pendingHasTrailingNewLine = true;
- }
- pos++;
- continue;
- }
- break scan;
+ function tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) {
+ if (!state.compilerOptions.rootDirs) {
+ return undefined;
+ }
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName);
+ }
+ var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
+ var matchedRootDir;
+ var matchedNormalizedPrefix;
+ for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) {
+ var rootDir = _a[_i];
+ var normalizedRoot = ts.normalizePath(rootDir);
+ if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) {
+ normalizedRoot += ts.directorySeparator;
+ }
+ var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) &&
+ (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length);
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix);
+ }
+ if (isLongestMatchingPrefix) {
+ matchedNormalizedPrefix = normalizedRoot;
+ matchedRootDir = rootDir;
}
}
- if (hasPendingCommentRange) {
- accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);
+ if (matchedNormalizedPrefix) {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix);
+ }
+ var suffix = candidate.substr(matchedNormalizedPrefix.length);
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate);
+ }
+ var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state);
+ if (resolvedFileName) {
+ return resolvedFileName;
+ }
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs);
+ }
+ for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) {
+ var rootDir = _c[_b];
+ if (rootDir === matchedRootDir) {
+ continue;
+ }
+ var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix);
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1);
+ }
+ var baseDirectory = ts.getDirectoryPath(candidate_1);
+ var resolvedFileName_1 = loader(candidate_1, supportedExtensions, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state);
+ if (resolvedFileName_1) {
+ return resolvedFileName_1;
+ }
+ }
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed);
+ }
}
- return accumulator;
- }
- function forEachLeadingCommentRange(text, pos, cb, state) {
- return iterateCommentRanges(false, text, pos, false, cb, state);
- }
- ts.forEachLeadingCommentRange = forEachLeadingCommentRange;
- function forEachTrailingCommentRange(text, pos, cb, state) {
- return iterateCommentRanges(false, text, pos, true, cb, state);
- }
- ts.forEachTrailingCommentRange = forEachTrailingCommentRange;
- function reduceEachLeadingCommentRange(text, pos, cb, state, initial) {
- return iterateCommentRanges(true, text, pos, false, cb, state, initial);
- }
- ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange;
- function reduceEachTrailingCommentRange(text, pos, cb, state, initial) {
- return iterateCommentRanges(true, text, pos, true, cb, state, initial);
+ return undefined;
}
- ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange;
- function appendCommentRange(pos, end, kind, hasTrailingNewLine, state, comments) {
- if (!comments) {
- comments = [];
+ function tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state) {
+ if (!state.compilerOptions.baseUrl) {
+ return undefined;
+ }
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName);
+ }
+ var matchedPattern = undefined;
+ if (state.compilerOptions.paths) {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
+ }
+ matchedPattern = ts.matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName);
+ }
+ if (matchedPattern) {
+ var matchedStar = typeof matchedPattern === "string" ? undefined : ts.matchedText(matchedPattern, moduleName);
+ var matchedPatternText = typeof matchedPattern === "string" ? matchedPattern : ts.patternText(matchedPattern);
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText);
+ }
+ for (var _i = 0, _a = state.compilerOptions.paths[matchedPatternText]; _i < _a.length; _i++) {
+ var subst = _a[_i];
+ var path = matchedStar ? subst.replace("*", matchedStar) : subst;
+ var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path));
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path);
+ }
+ var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
+ if (resolvedFileName) {
+ return resolvedFileName;
+ }
+ }
+ return undefined;
+ }
+ else {
+ var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName));
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate);
+ }
+ return loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
}
- comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind });
- return comments;
- }
- function getLeadingCommentRanges(text, pos) {
- return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined);
- }
- ts.getLeadingCommentRanges = getLeadingCommentRanges;
- function getTrailingCommentRanges(text, pos) {
- return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined);
}
- ts.getTrailingCommentRanges = getTrailingCommentRanges;
- function getShebang(text) {
- return shebangTriviaRegex.test(text)
- ? shebangTriviaRegex.exec(text)[0]
- : undefined;
+ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) {
+ var containingDirectory = ts.getDirectoryPath(containingFile);
+ var supportedExtensions = ts.getSupportedExtensions(compilerOptions);
+ var traceEnabled = isTraceEnabled(compilerOptions, host);
+ var failedLookupLocations = [];
+ var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: false };
+ var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, supportedExtensions, state);
+ var isExternalLibraryImport = false;
+ if (!resolvedFileName) {
+ if (moduleHasNonRelativeName(moduleName)) {
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName);
+ }
+ resolvedFileName = loadModuleFromNodeModules(moduleName, containingDirectory, failedLookupLocations, state, false);
+ isExternalLibraryImport = resolvedFileName !== undefined;
+ }
+ else {
+ var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
+ resolvedFileName = nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, false, state);
+ }
+ }
+ if (resolvedFileName && host.realpath) {
+ var originalFileName = resolvedFileName;
+ resolvedFileName = ts.normalizePath(host.realpath(resolvedFileName));
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, originalFileName, resolvedFileName);
+ }
+ }
+ return createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations);
}
- ts.getShebang = getShebang;
- function isIdentifierStart(ch, languageVersion) {
- return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 ||
- ch === 36 || ch === 95 ||
- ch > 127 && isUnicodeIdentifierStart(ch, languageVersion);
+ ts.nodeModuleNameResolver = nodeModuleNameResolver;
+ function nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state) {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate);
+ }
+ var resolvedFileName = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state);
+ return resolvedFileName || loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, onlyRecordFailures, state);
}
- 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);
+ function directoryProbablyExists(directoryName, host) {
+ return !host.directoryExists || host.directoryExists(directoryName);
}
- ts.isIdentifierPart = isIdentifierPart;
- function isIdentifierText(name, languageVersion) {
- if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {
- return false;
+ ts.directoryProbablyExists = directoryProbablyExists;
+ function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) {
+ var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocation, onlyRecordFailures, state);
+ if (resolvedByAddingExtension) {
+ return resolvedByAddingExtension;
}
- for (var i = 1, n = name.length; i < n; i++) {
- if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {
- return false;
+ if (ts.hasJavaScriptFileExtension(candidate)) {
+ var extensionless = ts.removeFileExtension(candidate);
+ if (state.traceEnabled) {
+ var extension = candidate.substring(extensionless.length);
+ trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
}
+ return tryAddingExtensions(extensionless, extensions, failedLookupLocation, onlyRecordFailures, state);
}
- return true;
}
- ts.isIdentifierText = isIdentifierText;
- function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) {
- if (languageVariant === void 0) { languageVariant = 0; }
- var pos;
- var end;
- var startPos;
- var tokenPos;
- var token;
- var tokenValue;
- var precedingLineBreak;
- var hasExtendedUnicodeEscape;
- var tokenIsUnterminated;
- setText(text, start, length);
- 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 === 69 || token > 105; },
- isReservedWord: function () { return token >= 70 && token <= 105; },
- isUnterminated: function () { return tokenIsUnterminated; },
- reScanGreaterToken: reScanGreaterToken,
- reScanSlashToken: reScanSlashToken,
- reScanTemplateToken: reScanTemplateToken,
- scanJsxIdentifier: scanJsxIdentifier,
- scanJsxAttributeValue: scanJsxAttributeValue,
- reScanJsxToken: reScanJsxToken,
- scanJsxToken: scanJsxToken,
- scanJSDocToken: scanJSDocToken,
- scan: scan,
- getText: getText,
- setText: setText,
- setScriptTarget: setScriptTarget,
- setLanguageVariant: setLanguageVariant,
- setOnError: setOnError,
- setTextPos: setTextPos,
- tryScan: tryScan,
- lookAhead: lookAhead,
- scanRange: scanRange
- };
- function error(message, length) {
- if (onError) {
- onError(message, length || 0);
+ function tryAddingExtensions(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) {
+ if (!onlyRecordFailures) {
+ var directory = ts.getDirectoryPath(candidate);
+ if (directory) {
+ onlyRecordFailures = !directoryProbablyExists(directory, state.host);
}
}
- function scanNumber() {
- var start = pos;
- while (isDigit(text.charCodeAt(pos)))
- pos++;
- if (text.charCodeAt(pos) === 46) {
- pos++;
- while (isDigit(text.charCodeAt(pos)))
- pos++;
+ return ts.forEach(extensions, function (ext) {
+ return !(state.skipTsx && ts.isJsxOrTsxExtension(ext)) && tryFile(candidate + ext, failedLookupLocation, onlyRecordFailures, state);
+ });
+ }
+ function tryFile(fileName, failedLookupLocation, onlyRecordFailures, state) {
+ if (!onlyRecordFailures && state.host.fileExists(fileName)) {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
}
- var end = pos;
- if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) {
- pos++;
- if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45)
- pos++;
- if (isDigit(text.charCodeAt(pos))) {
- pos++;
- while (isDigit(text.charCodeAt(pos)))
- pos++;
- end = pos;
+ return fileName;
+ }
+ else {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName);
+ }
+ failedLookupLocation.push(fileName);
+ return undefined;
+ }
+ }
+ function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, onlyRecordFailures, state) {
+ var packageJsonPath = pathToPackageJson(candidate);
+ var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host);
+ if (directoryExists && state.host.fileExists(packageJsonPath)) {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
+ }
+ var typesFile = tryReadTypesSection(packageJsonPath, candidate, state);
+ if (typesFile) {
+ var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host);
+ var result = tryFile(typesFile, failedLookupLocation, onlyRecordFailures_1, state) ||
+ tryAddingExtensions(typesFile, extensions, failedLookupLocation, onlyRecordFailures_1, state);
+ if (result) {
+ return result;
}
- else {
- error(ts.Diagnostics.Digit_expected);
+ }
+ else {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field);
}
}
- return "" + +(text.substring(start, end));
}
- function scanOctalDigits() {
- var start = pos;
- while (isOctalDigit(text.charCodeAt(pos))) {
- pos++;
+ else {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath);
}
- return +(text.substring(start, pos));
+ failedLookupLocation.push(packageJsonPath);
}
- function scanExactNumberOfHexDigits(count) {
- return scanHexDigits(count, false);
+ return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state);
+ }
+ function pathToPackageJson(directory) {
+ return ts.combinePaths(directory, "package.json");
+ }
+ function loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) {
+ var nodeModulesFolder = ts.combinePaths(directory, "node_modules");
+ var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);
+ var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));
+ var supportedExtensions = ts.getSupportedExtensions(state.compilerOptions);
+ var result = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, !nodeModulesFolderExists, state);
+ if (result) {
+ return result;
}
- function scanMinimumNumberOfHexDigits(count) {
- return scanHexDigits(count, true);
+ result = loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state);
+ if (result) {
+ return result;
}
- function scanHexDigits(minCount, scanAsManyAsPossible) {
- var digits = 0;
- var value = 0;
- while (digits < minCount || scanAsManyAsPossible) {
- var ch = text.charCodeAt(pos);
- if (ch >= 48 && ch <= 57) {
- value = value * 16 + ch - 48;
- }
- else if (ch >= 65 && ch <= 70) {
- value = value * 16 + ch - 65 + 10;
- }
- else if (ch >= 97 && ch <= 102) {
- value = value * 16 + ch - 97 + 10;
+ }
+ function loadModuleFromNodeModules(moduleName, directory, failedLookupLocations, state, checkOneLevel) {
+ return loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, checkOneLevel, false);
+ }
+ ts.loadModuleFromNodeModules = loadModuleFromNodeModules;
+ function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) {
+ return loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, false, true);
+ }
+ function loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, checkOneLevel, typesOnly) {
+ directory = ts.normalizeSlashes(directory);
+ while (true) {
+ var baseName = ts.getBaseFileName(directory);
+ if (baseName !== "node_modules") {
+ var packageResult = void 0;
+ if (!typesOnly) {
+ packageResult = loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state);
+ if (packageResult && ts.hasTypeScriptFileExtension(packageResult)) {
+ return packageResult;
+ }
}
- else {
- break;
+ var typesResult = loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state);
+ if (typesResult || packageResult) {
+ return typesResult || packageResult;
}
- pos++;
- digits++;
}
- if (digits < minCount) {
- value = -1;
+ var parentPath = ts.getDirectoryPath(directory);
+ if (parentPath === directory || checkOneLevel) {
+ break;
}
- return value;
+ directory = parentPath;
}
- function scanString(allowEscapes) {
- if (allowEscapes === void 0) { allowEscapes = true; }
- var quote = text.charCodeAt(pos);
- pos++;
- var result = "";
- var start = pos;
- while (true) {
- if (pos >= end) {
- result += text.substring(start, pos);
- tokenIsUnterminated = true;
- error(ts.Diagnostics.Unterminated_string_literal);
- break;
- }
- var ch = text.charCodeAt(pos);
- if (ch === quote) {
- result += text.substring(start, pos);
- pos++;
- break;
- }
- if (ch === 92 && allowEscapes) {
- result += text.substring(start, pos);
- result += scanEscapeSequence();
- start = pos;
- continue;
- }
- if (isLineBreak(ch)) {
- result += text.substring(start, pos);
- tokenIsUnterminated = true;
- error(ts.Diagnostics.Unterminated_string_literal);
- break;
- }
- pos++;
- }
- return result;
+ return undefined;
+ }
+ function classicNameResolver(moduleName, containingFile, compilerOptions, host) {
+ var traceEnabled = isTraceEnabled(compilerOptions, host);
+ var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: !compilerOptions.jsx };
+ var failedLookupLocations = [];
+ var supportedExtensions = ts.getSupportedExtensions(compilerOptions);
+ var containingDirectory = ts.getDirectoryPath(containingFile);
+ var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, supportedExtensions, state);
+ if (resolvedFileName) {
+ return createResolvedModule(resolvedFileName, false, failedLookupLocations);
}
- function scanTemplateAndSetTokenValue() {
- var startedWithBacktick = text.charCodeAt(pos) === 96;
- pos++;
- var start = pos;
- var contents = "";
- var resultingToken;
- while (true) {
- if (pos >= end) {
- contents += text.substring(start, pos);
- tokenIsUnterminated = true;
- error(ts.Diagnostics.Unterminated_template_literal);
- resultingToken = startedWithBacktick ? 11 : 14;
- break;
- }
- var currChar = text.charCodeAt(pos);
- if (currChar === 96) {
- contents += text.substring(start, pos);
- pos++;
- resultingToken = startedWithBacktick ? 11 : 14;
- break;
- }
- if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) {
- contents += text.substring(start, pos);
- pos += 2;
- resultingToken = startedWithBacktick ? 12 : 13;
- break;
- }
- if (currChar === 92) {
- contents += text.substring(start, pos);
- contents += scanEscapeSequence();
- start = pos;
- continue;
- }
- if (currChar === 13) {
- contents += text.substring(start, pos);
- pos++;
- if (pos < end && text.charCodeAt(pos) === 10) {
- pos++;
- }
- contents += "\n";
- start = pos;
- continue;
- }
- pos++;
- }
- ts.Debug.assert(resultingToken !== undefined);
- tokenValue = contents;
- return resultingToken;
+ var referencedSourceFile;
+ if (moduleHasNonRelativeName(moduleName)) {
+ referencedSourceFile = referencedSourceFile = loadModuleFromAncestorDirectories(moduleName, containingDirectory, supportedExtensions, failedLookupLocations, state) ||
+ loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);
}
- function scanEscapeSequence() {
- pos++;
- if (pos >= end) {
- error(ts.Diagnostics.Unexpected_end_of_text);
- return "";
- }
- var ch = text.charCodeAt(pos);
- pos++;
- switch (ch) {
- case 48:
- return "\0";
- case 98:
- return "\b";
- case 116:
- return "\t";
- case 110:
- return "\n";
- case 118:
- return "\v";
- case 102:
- return "\f";
- case 114:
- return "\r";
- case 39:
- return "\'";
- case 34:
- return "\"";
- case 117:
- if (pos < end && text.charCodeAt(pos) === 123) {
- hasExtendedUnicodeEscape = true;
- pos++;
- return scanExtendedUnicodeEscape();
- }
- return scanHexadecimalEscape(4);
- case 120:
- return scanHexadecimalEscape(2);
- case 13:
- if (pos < end && text.charCodeAt(pos) === 10) {
- pos++;
- }
- case 10:
- case 8232:
- case 8233:
- return "";
- default:
- return String.fromCharCode(ch);
- }
+ else {
+ var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
+ referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, false, state);
}
- function scanHexadecimalEscape(numDigits) {
- var escapedValue = scanExactNumberOfHexDigits(numDigits);
- if (escapedValue >= 0) {
- return String.fromCharCode(escapedValue);
+ return referencedSourceFile
+ ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations }
+ : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
+ }
+ ts.classicNameResolver = classicNameResolver;
+ function loadModuleFromAncestorDirectories(moduleName, containingDirectory, supportedExtensions, failedLookupLocations, state) {
+ while (true) {
+ var searchName = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
+ var referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, false, state);
+ if (referencedSourceFile) {
+ return referencedSourceFile;
}
- else {
- error(ts.Diagnostics.Hexadecimal_digit_expected);
- return "";
+ var parentPath = ts.getDirectoryPath(containingDirectory);
+ if (parentPath === containingDirectory) {
+ return undefined;
}
+ containingDirectory = parentPath;
}
- function scanExtendedUnicodeEscape() {
- var escapedValue = scanMinimumNumberOfHexDigits(1);
- var isInvalidExtendedEscape = false;
- if (escapedValue < 0) {
- error(ts.Diagnostics.Hexadecimal_digit_expected);
- isInvalidExtendedEscape = true;
- }
- else if (escapedValue > 0x10FFFF) {
- error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
- isInvalidExtendedEscape = true;
- }
- if (pos >= end) {
- error(ts.Diagnostics.Unexpected_end_of_text);
- isInvalidExtendedEscape = true;
- }
- else if (text.charCodeAt(pos) === 125) {
- pos++;
- }
- else {
- error(ts.Diagnostics.Unterminated_Unicode_escape_sequence);
- isInvalidExtendedEscape = true;
- }
- if (isInvalidExtendedEscape) {
- return "";
+ }
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ ts.externalHelpersModuleNameText = "tslib";
+ function getDeclarationOfKind(symbol, kind) {
+ var declarations = symbol.declarations;
+ if (declarations) {
+ for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) {
+ var declaration = declarations_1[_i];
+ if (declaration.kind === kind) {
+ return declaration;
+ }
}
- return utf16EncodeAsString(escapedValue);
}
- function utf16EncodeAsString(codePoint) {
- ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF);
- if (codePoint <= 65535) {
- return String.fromCharCode(codePoint);
+ return undefined;
+ }
+ ts.getDeclarationOfKind = getDeclarationOfKind;
+ var stringWriters = [];
+ function getSingleLineStringWriter() {
+ if (stringWriters.length === 0) {
+ var str_1 = "";
+ var writeText = function (text) { return str_1 += text; };
+ return {
+ string: function () { return str_1; },
+ writeKeyword: writeText,
+ writeOperator: writeText,
+ writePunctuation: writeText,
+ writeSpace: writeText,
+ writeStringLiteral: writeText,
+ writeParameter: writeText,
+ writeSymbol: writeText,
+ writeLine: function () { return str_1 += " "; },
+ increaseIndent: function () { },
+ decreaseIndent: function () { },
+ clear: function () { return str_1 = ""; },
+ trackSymbol: function () { },
+ reportInaccessibleThisError: function () { }
+ };
+ }
+ return stringWriters.pop();
+ }
+ ts.getSingleLineStringWriter = getSingleLineStringWriter;
+ function releaseStringWriter(writer) {
+ writer.clear();
+ stringWriters.push(writer);
+ }
+ ts.releaseStringWriter = releaseStringWriter;
+ function getFullWidth(node) {
+ return node.end - node.pos;
+ }
+ ts.getFullWidth = getFullWidth;
+ function arrayIsEqualTo(array1, array2, equaler) {
+ if (!array1 || !array2) {
+ return array1 === array2;
+ }
+ if (array1.length !== array2.length) {
+ return false;
+ }
+ for (var i = 0; i < array1.length; i++) {
+ var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i];
+ if (!equals) {
+ return false;
}
- var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800;
- var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00;
- return String.fromCharCode(codeUnit1, codeUnit2);
}
- function peekUnicodeEscape() {
- if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) {
- var start_1 = pos;
- pos += 2;
- var value = scanExactNumberOfHexDigits(4);
- pos = start_1;
- return value;
+ return true;
+ }
+ ts.arrayIsEqualTo = arrayIsEqualTo;
+ function hasResolvedModule(sourceFile, moduleNameText) {
+ return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]);
+ }
+ ts.hasResolvedModule = hasResolvedModule;
+ function getResolvedModule(sourceFile, moduleNameText) {
+ return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
+ }
+ ts.getResolvedModule = getResolvedModule;
+ function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {
+ if (!sourceFile.resolvedModules) {
+ sourceFile.resolvedModules = ts.createMap();
+ }
+ sourceFile.resolvedModules[moduleNameText] = resolvedModule;
+ }
+ ts.setResolvedModule = setResolvedModule;
+ function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
+ if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
+ sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap();
+ }
+ sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective;
+ }
+ ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
+ function moduleResolutionIsEqualTo(oldResolution, newResolution) {
+ return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport;
+ }
+ ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;
+ function typeDirectiveIsEqualTo(oldResolution, newResolution) {
+ return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary;
+ }
+ ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
+ function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) {
+ if (names.length !== newResolutions.length) {
+ return false;
+ }
+ for (var i = 0; i < names.length; i++) {
+ var newResolution = newResolutions[i];
+ var oldResolution = oldResolutions && oldResolutions[names[i]];
+ var changed = oldResolution
+ ? !newResolution || !comparer(oldResolution, newResolution)
+ : newResolution;
+ if (changed) {
+ return true;
}
- return -1;
}
- function scanIdentifierParts() {
- var result = "";
- var start = pos;
- while (pos < end) {
- var ch = text.charCodeAt(pos);
- if (isIdentifierPart(ch, languageVersion)) {
- pos++;
- }
- else if (ch === 92) {
- ch = peekUnicodeEscape();
- if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
- break;
- }
- result += text.substring(start, pos);
- result += String.fromCharCode(ch);
- pos += 6;
- start = pos;
- }
- else {
- break;
- }
+ return false;
+ }
+ ts.hasChangesInResolutions = hasChangesInResolutions;
+ function containsParseError(node) {
+ aggregateChildData(node);
+ return (node.flags & 2097152) !== 0;
+ }
+ ts.containsParseError = containsParseError;
+ function aggregateChildData(node) {
+ if (!(node.flags & 4194304)) {
+ var thisNodeOrAnySubNodesHasError = ((node.flags & 524288) !== 0) ||
+ ts.forEachChild(node, containsParseError);
+ if (thisNodeOrAnySubNodesHasError) {
+ node.flags |= 2097152;
}
- result += text.substring(start, pos);
- return result;
+ node.flags |= 4194304;
}
- function getIdentifierToken() {
- var len = tokenValue.length;
- if (len >= 2 && len <= 11) {
- var ch = tokenValue.charCodeAt(0);
- if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) {
- return token = textToToken[tokenValue];
- }
+ }
+ function getSourceFileOfNode(node) {
+ while (node && node.kind !== 256) {
+ node = node.parent;
+ }
+ return node;
+ }
+ ts.getSourceFileOfNode = getSourceFileOfNode;
+ function isStatementWithLocals(node) {
+ switch (node.kind) {
+ case 200:
+ case 228:
+ case 207:
+ case 208:
+ case 209:
+ return true;
+ }
+ return false;
+ }
+ ts.isStatementWithLocals = isStatementWithLocals;
+ function getStartPositionOfLine(line, sourceFile) {
+ ts.Debug.assert(line >= 0);
+ return ts.getLineStarts(sourceFile)[line];
+ }
+ ts.getStartPositionOfLine = getStartPositionOfLine;
+ function nodePosToString(node) {
+ var file = getSourceFileOfNode(node);
+ var loc = ts.getLineAndCharacterOfPosition(file, node.pos);
+ return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")";
+ }
+ ts.nodePosToString = nodePosToString;
+ function getStartPosOfNode(node) {
+ return node.pos;
+ }
+ ts.getStartPosOfNode = getStartPosOfNode;
+ function isDefined(value) {
+ return value !== undefined;
+ }
+ ts.isDefined = isDefined;
+ function getEndLinePosition(line, sourceFile) {
+ ts.Debug.assert(line >= 0);
+ var lineStarts = ts.getLineStarts(sourceFile);
+ var lineIndex = line;
+ var sourceText = sourceFile.text;
+ if (lineIndex + 1 === lineStarts.length) {
+ return sourceText.length - 1;
+ }
+ else {
+ var start = lineStarts[lineIndex];
+ var pos = lineStarts[lineIndex + 1] - 1;
+ ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos)));
+ while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) {
+ pos--;
}
- return token = 69;
+ return pos;
}
- function scanBinaryOrOctalDigits(base) {
- ts.Debug.assert(base === 2 || base === 8, "Expected either base 2 or base 8");
- var value = 0;
- var numberOfDigits = 0;
- while (true) {
- var ch = text.charCodeAt(pos);
- var valueOfCh = ch - 48;
- if (!isDigit(ch) || valueOfCh >= base) {
- break;
- }
- value = value * base + valueOfCh;
- pos++;
- numberOfDigits++;
+ }
+ ts.getEndLinePosition = getEndLinePosition;
+ function nodeIsMissing(node) {
+ if (node === undefined) {
+ return true;
+ }
+ return node.pos === node.end && node.pos >= 0 && node.kind !== 1;
+ }
+ ts.nodeIsMissing = nodeIsMissing;
+ function nodeIsPresent(node) {
+ return !nodeIsMissing(node);
+ }
+ ts.nodeIsPresent = nodeIsPresent;
+ function getTokenPosOfNode(node, sourceFile, includeJsDocComment) {
+ if (nodeIsMissing(node)) {
+ return node.pos;
+ }
+ if (isJSDocNode(node)) {
+ return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true);
+ }
+ if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) {
+ return getTokenPosOfNode(node.jsDocComments[0]);
+ }
+ if (node.kind === 286 && node._children.length > 0) {
+ return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment);
+ }
+ return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
+ }
+ ts.getTokenPosOfNode = getTokenPosOfNode;
+ function isJSDocNode(node) {
+ return node.kind >= 257 && node.kind <= 282;
+ }
+ ts.isJSDocNode = isJSDocNode;
+ function isJSDocTag(node) {
+ return node.kind >= 273 && node.kind <= 285;
+ }
+ ts.isJSDocTag = isJSDocTag;
+ function getNonDecoratorTokenPosOfNode(node, sourceFile) {
+ if (nodeIsMissing(node) || !node.decorators) {
+ return getTokenPosOfNode(node, sourceFile);
+ }
+ return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end);
+ }
+ ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode;
+ function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) {
+ if (includeTrivia === void 0) { includeTrivia = false; }
+ if (nodeIsMissing(node)) {
+ return "";
+ }
+ var text = sourceFile.text;
+ return text.substring(includeTrivia ? node.pos : ts.skipTrivia(text, node.pos), node.end);
+ }
+ ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;
+ function getTextOfNodeFromSourceText(sourceText, node) {
+ if (nodeIsMissing(node)) {
+ return "";
+ }
+ return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end);
+ }
+ ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText;
+ function getTextOfNode(node, includeTrivia) {
+ if (includeTrivia === void 0) { includeTrivia = false; }
+ return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia);
+ }
+ ts.getTextOfNode = getTextOfNode;
+ function getLiteralText(node, sourceFile, languageVersion) {
+ if (languageVersion < 2 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) {
+ return getQuotedEscapedLiteralText('"', node.text, '"');
+ }
+ if (!nodeIsSynthesized(node) && node.parent) {
+ var text = getSourceTextOfNodeFromSourceFile(sourceFile, node);
+ if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) {
+ return node.text;
}
- if (numberOfDigits === 0) {
- return -1;
+ return text;
+ }
+ switch (node.kind) {
+ case 9:
+ return getQuotedEscapedLiteralText('"', node.text, '"');
+ case 12:
+ return getQuotedEscapedLiteralText("`", node.text, "`");
+ case 13:
+ return getQuotedEscapedLiteralText("`", node.text, "${");
+ case 14:
+ return getQuotedEscapedLiteralText("}", node.text, "${");
+ case 15:
+ return getQuotedEscapedLiteralText("}", node.text, "`");
+ case 8:
+ return node.text;
+ }
+ ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for.");
+ }
+ ts.getLiteralText = getLiteralText;
+ function isBinaryOrOctalIntegerLiteral(node, text) {
+ if (node.kind === 8 && text.length > 1) {
+ switch (text.charCodeAt(1)) {
+ case 98:
+ case 66:
+ case 111:
+ case 79:
+ return true;
}
- return value;
}
- function scan() {
- startPos = pos;
- hasExtendedUnicodeEscape = false;
- precedingLineBreak = false;
- tokenIsUnterminated = false;
- while (true) {
- tokenPos = pos;
- if (pos >= end) {
- return token = 1;
- }
- var ch = text.charCodeAt(pos);
- if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) {
- pos = scanShebangTrivia(text, pos);
- if (skipTrivia) {
- continue;
- }
- else {
- return token = 6;
- }
- }
- switch (ch) {
- case 10:
- case 13:
- precedingLineBreak = true;
- if (skipTrivia) {
- pos++;
- continue;
- }
- else {
- if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) {
- pos += 2;
- }
- else {
- pos++;
- }
- return token = 4;
- }
- case 9:
- case 11:
- case 12:
- case 32:
- if (skipTrivia) {
- pos++;
- continue;
- }
- else {
- while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {
- pos++;
- }
- return token = 5;
- }
- case 33:
- if (text.charCodeAt(pos + 1) === 61) {
- if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 33;
- }
- return pos += 2, token = 31;
- }
- pos++;
- return token = 49;
- case 34:
- case 39:
- tokenValue = scanString();
- return token = 9;
- case 96:
- return token = scanTemplateAndSetTokenValue();
- case 37:
- if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 62;
- }
- pos++;
- return token = 40;
- case 38:
- if (text.charCodeAt(pos + 1) === 38) {
- return pos += 2, token = 51;
- }
- if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 66;
- }
- pos++;
- return token = 46;
- case 40:
- pos++;
- return token = 17;
- case 41:
- pos++;
- return token = 18;
- case 42:
- if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 59;
- }
- if (text.charCodeAt(pos + 1) === 42) {
- if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 60;
- }
- return pos += 2, token = 38;
- }
- pos++;
- return token = 37;
- case 43:
- if (text.charCodeAt(pos + 1) === 43) {
- return pos += 2, token = 41;
- }
- if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 57;
- }
- pos++;
- return token = 35;
- case 44:
- pos++;
- return token = 24;
- case 45:
- if (text.charCodeAt(pos + 1) === 45) {
- return pos += 2, token = 42;
- }
- if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 58;
- }
- pos++;
- return token = 36;
- case 46:
- if (isDigit(text.charCodeAt(pos + 1))) {
- tokenValue = scanNumber();
- return token = 8;
- }
- if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) {
- return pos += 3, token = 22;
- }
- pos++;
- return token = 21;
- case 47:
- if (text.charCodeAt(pos + 1) === 47) {
- pos += 2;
- while (pos < end) {
- if (isLineBreak(text.charCodeAt(pos))) {
- break;
- }
- pos++;
- }
- if (skipTrivia) {
- continue;
- }
- else {
- return token = 2;
- }
- }
- if (text.charCodeAt(pos + 1) === 42) {
- pos += 2;
- var commentClosed = false;
- while (pos < end) {
- var ch_2 = text.charCodeAt(pos);
- if (ch_2 === 42 && text.charCodeAt(pos + 1) === 47) {
- pos += 2;
- commentClosed = true;
- break;
- }
- if (isLineBreak(ch_2)) {
- precedingLineBreak = true;
- }
- pos++;
- }
- if (!commentClosed) {
- error(ts.Diagnostics.Asterisk_Slash_expected);
- }
- if (skipTrivia) {
- continue;
- }
- else {
- tokenIsUnterminated = !commentClosed;
- return token = 3;
- }
- }
- if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 61;
- }
- pos++;
- return token = 39;
- case 48:
- if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) {
- pos += 2;
- var value = scanMinimumNumberOfHexDigits(1);
- if (value < 0) {
- error(ts.Diagnostics.Hexadecimal_digit_expected);
- value = 0;
- }
- tokenValue = "" + value;
- return token = 8;
- }
- else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) {
- pos += 2;
- var value = scanBinaryOrOctalDigits(2);
- if (value < 0) {
- error(ts.Diagnostics.Binary_digit_expected);
- value = 0;
- }
- tokenValue = "" + value;
- return token = 8;
- }
- else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) {
- pos += 2;
- var value = scanBinaryOrOctalDigits(8);
- if (value < 0) {
- error(ts.Diagnostics.Octal_digit_expected);
- value = 0;
- }
- tokenValue = "" + value;
- return token = 8;
- }
- if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {
- tokenValue = "" + scanOctalDigits();
- return token = 8;
- }
- case 49:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- tokenValue = scanNumber();
- return token = 8;
- case 58:
- pos++;
- return token = 54;
- case 59:
- pos++;
- return token = 23;
- case 60:
- if (isConflictMarkerTrivia(text, pos)) {
- pos = scanConflictMarkerTrivia(text, pos, error);
- if (skipTrivia) {
- continue;
- }
- else {
- return token = 7;
- }
- }
- if (text.charCodeAt(pos + 1) === 60) {
- if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 63;
- }
- return pos += 2, token = 43;
- }
- if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 28;
- }
- if (languageVariant === 1 &&
- text.charCodeAt(pos + 1) === 47 &&
- text.charCodeAt(pos + 2) !== 42) {
- return pos += 2, token = 26;
- }
- pos++;
- return token = 25;
- case 61:
- if (isConflictMarkerTrivia(text, pos)) {
- pos = scanConflictMarkerTrivia(text, pos, error);
- if (skipTrivia) {
- continue;
- }
- else {
- return token = 7;
- }
- }
- if (text.charCodeAt(pos + 1) === 61) {
- if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 32;
- }
- return pos += 2, token = 30;
- }
- if (text.charCodeAt(pos + 1) === 62) {
- return pos += 2, token = 34;
- }
- pos++;
- return token = 56;
- case 62:
- if (isConflictMarkerTrivia(text, pos)) {
- pos = scanConflictMarkerTrivia(text, pos, error);
- if (skipTrivia) {
- continue;
- }
- else {
- return token = 7;
- }
- }
- pos++;
- return token = 27;
- case 63:
- pos++;
- return token = 53;
- case 91:
- pos++;
- return token = 19;
- case 93:
- pos++;
- return token = 20;
- case 94:
- if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 68;
- }
- pos++;
- return token = 48;
- case 123:
- pos++;
- return token = 15;
- case 124:
- if (text.charCodeAt(pos + 1) === 124) {
- return pos += 2, token = 52;
- }
- if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 67;
- }
- pos++;
- return token = 47;
- case 125:
- pos++;
- return token = 16;
- case 126:
- pos++;
- return token = 50;
- case 64:
- pos++;
- return token = 55;
- case 92:
- var cookedChar = peekUnicodeEscape();
- if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
- pos += 6;
- tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
- return token = getIdentifierToken();
- }
- error(ts.Diagnostics.Invalid_character);
- pos++;
- return token = 0;
- default:
- if (isIdentifierStart(ch, languageVersion)) {
- pos++;
- while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))
- pos++;
- tokenValue = text.substring(tokenPos, pos);
- if (ch === 92) {
- tokenValue += scanIdentifierParts();
- }
- return token = getIdentifierToken();
- }
- else if (isWhiteSpaceSingleLine(ch)) {
- pos++;
- continue;
- }
- else if (isLineBreak(ch)) {
- precedingLineBreak = true;
- pos++;
- continue;
- }
- error(ts.Diagnostics.Invalid_character);
- pos++;
- return token = 0;
- }
- }
+ return false;
+ }
+ ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral;
+ function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) {
+ return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote;
+ }
+ function escapeIdentifier(identifier) {
+ return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier;
+ }
+ ts.escapeIdentifier = escapeIdentifier;
+ function unescapeIdentifier(identifier) {
+ return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier;
+ }
+ ts.unescapeIdentifier = unescapeIdentifier;
+ function makeIdentifierFromModuleName(moduleName) {
+ return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_");
+ }
+ ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName;
+ function isBlockOrCatchScoped(declaration) {
+ return (ts.getCombinedNodeFlags(declaration) & 3) !== 0 ||
+ isCatchClauseVariableDeclaration(declaration);
+ }
+ ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
+ function isAmbientModule(node) {
+ return node && node.kind === 226 &&
+ (node.name.kind === 9 || isGlobalScopeAugmentation(node));
+ }
+ ts.isAmbientModule = isAmbientModule;
+ function isShorthandAmbientModuleSymbol(moduleSymbol) {
+ return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
+ }
+ ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
+ function isShorthandAmbientModule(node) {
+ return node.kind === 226 && (!node.body);
+ }
+ function isBlockScopedContainerTopLevel(node) {
+ return node.kind === 256 ||
+ node.kind === 226 ||
+ isFunctionLike(node);
+ }
+ ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
+ function isGlobalScopeAugmentation(module) {
+ return !!(module.flags & 512);
+ }
+ ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation;
+ function isExternalModuleAugmentation(node) {
+ if (!node || !isAmbientModule(node)) {
+ return false;
}
- function reScanGreaterToken() {
- if (token === 27) {
- if (text.charCodeAt(pos) === 62) {
- if (text.charCodeAt(pos + 1) === 62) {
- if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 65;
- }
- return pos += 2, token = 45;
- }
- if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 64;
- }
- pos++;
- return token = 44;
- }
- if (text.charCodeAt(pos) === 61) {
- pos++;
- return token = 29;
- }
+ switch (node.parent.kind) {
+ case 256:
+ return ts.isExternalModule(node.parent);
+ case 227:
+ return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
+ }
+ return false;
+ }
+ ts.isExternalModuleAugmentation = isExternalModuleAugmentation;
+ function isBlockScope(node, parentNode) {
+ switch (node.kind) {
+ case 256:
+ case 228:
+ case 252:
+ case 226:
+ case 207:
+ case 208:
+ case 209:
+ case 149:
+ case 148:
+ case 150:
+ case 151:
+ case 221:
+ case 180:
+ case 181:
+ return true;
+ case 200:
+ return parentNode && !isFunctionLike(parentNode);
+ }
+ return false;
+ }
+ ts.isBlockScope = isBlockScope;
+ function getEnclosingBlockScopeContainer(node) {
+ var current = node.parent;
+ while (current) {
+ if (isBlockScope(current, current.parent)) {
+ return current;
}
- return token;
+ current = current.parent;
}
- function reScanSlashToken() {
- if (token === 39 || token === 61) {
- var p = tokenPos + 1;
- var inEscape = false;
- var inCharacterClass = false;
- while (true) {
- if (p >= end) {
- tokenIsUnterminated = true;
- error(ts.Diagnostics.Unterminated_regular_expression_literal);
- break;
- }
- var ch = text.charCodeAt(p);
- if (isLineBreak(ch)) {
- tokenIsUnterminated = true;
- error(ts.Diagnostics.Unterminated_regular_expression_literal);
- break;
- }
- if (inEscape) {
- inEscape = false;
- }
- else if (ch === 47 && !inCharacterClass) {
- p++;
- break;
- }
- else if (ch === 91) {
- inCharacterClass = true;
- }
- else if (ch === 92) {
- inEscape = true;
- }
- else if (ch === 93) {
- inCharacterClass = false;
- }
- p++;
- }
- while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {
- p++;
- }
- pos = p;
- tokenValue = text.substring(tokenPos, pos);
- token = 10;
+ }
+ ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer;
+ function isCatchClauseVariableDeclaration(declaration) {
+ return declaration &&
+ declaration.kind === 219 &&
+ declaration.parent &&
+ declaration.parent.kind === 252;
+ }
+ ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration;
+ function declarationNameToString(name) {
+ return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name);
+ }
+ ts.declarationNameToString = declarationNameToString;
+ function createDiagnosticForNode(node, message, arg0, arg1, arg2) {
+ var sourceFile = getSourceFileOfNode(node);
+ var span = getErrorSpanForNode(sourceFile, node);
+ return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2);
+ }
+ ts.createDiagnosticForNode = createDiagnosticForNode;
+ function createDiagnosticForNodeFromMessageChain(node, messageChain) {
+ var sourceFile = getSourceFileOfNode(node);
+ var span = getErrorSpanForNode(sourceFile, node);
+ return {
+ file: sourceFile,
+ start: span.start,
+ length: span.length,
+ code: messageChain.code,
+ category: messageChain.category,
+ messageText: messageChain.next ? messageChain : messageChain.messageText
+ };
+ }
+ ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;
+ function getSpanOfTokenAtPosition(sourceFile, pos) {
+ var scanner = ts.createScanner(sourceFile.languageVersion, true, sourceFile.languageVariant, sourceFile.text, undefined, pos);
+ scanner.scan();
+ var start = scanner.getTokenPos();
+ return ts.createTextSpanFromBounds(start, scanner.getTextPos());
+ }
+ ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
+ function getErrorSpanForArrowFunction(sourceFile, node) {
+ var pos = ts.skipTrivia(sourceFile.text, node.pos);
+ if (node.body && node.body.kind === 200) {
+ var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
+ var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
+ if (startLine < endLine) {
+ return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1);
}
- return token;
}
- function reScanTemplateToken() {
- ts.Debug.assert(token === 16, "'reScanTemplateToken' should only be called on a '}'");
- pos = tokenPos;
- return token = scanTemplateAndSetTokenValue();
+ return ts.createTextSpanFromBounds(pos, node.end);
+ }
+ function getErrorSpanForNode(sourceFile, node) {
+ var errorNode = node;
+ switch (node.kind) {
+ case 256:
+ var pos_1 = ts.skipTrivia(sourceFile.text, 0, false);
+ if (pos_1 === sourceFile.text.length) {
+ return ts.createTextSpan(0, 0);
+ }
+ return getSpanOfTokenAtPosition(sourceFile, pos_1);
+ case 219:
+ case 170:
+ case 222:
+ case 193:
+ case 223:
+ case 226:
+ case 225:
+ case 255:
+ case 221:
+ case 180:
+ case 148:
+ case 150:
+ case 151:
+ case 224:
+ errorNode = node.name;
+ break;
+ case 181:
+ return getErrorSpanForArrowFunction(sourceFile, node);
}
- function reScanJsxToken() {
- pos = tokenPos = startPos;
- return token = scanJsxToken();
+ if (errorNode === undefined) {
+ return getSpanOfTokenAtPosition(sourceFile, node.pos);
}
- function scanJsxToken() {
- startPos = tokenPos = pos;
- if (pos >= end) {
- return token = 1;
- }
- var char = text.charCodeAt(pos);
- if (char === 60) {
- if (text.charCodeAt(pos + 1) === 47) {
- pos += 2;
- return token = 26;
+ var pos = nodeIsMissing(errorNode)
+ ? errorNode.pos
+ : ts.skipTrivia(sourceFile.text, errorNode.pos);
+ return ts.createTextSpanFromBounds(pos, errorNode.end);
+ }
+ ts.getErrorSpanForNode = getErrorSpanForNode;
+ function isExternalOrCommonJsModule(file) {
+ return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined;
+ }
+ ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule;
+ function isDeclarationFile(file) {
+ return file.isDeclarationFile;
+ }
+ ts.isDeclarationFile = isDeclarationFile;
+ function isConstEnumDeclaration(node) {
+ return node.kind === 225 && isConst(node);
+ }
+ ts.isConstEnumDeclaration = isConstEnumDeclaration;
+ function isConst(node) {
+ return !!(ts.getCombinedNodeFlags(node) & 2)
+ || !!(ts.getCombinedModifierFlags(node) & 2048);
+ }
+ ts.isConst = isConst;
+ function isLet(node) {
+ return !!(ts.getCombinedNodeFlags(node) & 1);
+ }
+ ts.isLet = isLet;
+ function isSuperCall(n) {
+ return n.kind === 175 && n.expression.kind === 96;
+ }
+ ts.isSuperCall = isSuperCall;
+ function isPrologueDirective(node) {
+ return node.kind === 203 && node.expression.kind === 9;
+ }
+ ts.isPrologueDirective = isPrologueDirective;
+ function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
+ return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos);
+ }
+ ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;
+ function getLeadingCommentRangesOfNodeFromText(node, text) {
+ return ts.getLeadingCommentRanges(text, node.pos);
+ }
+ ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText;
+ function getJsDocComments(node, sourceFileOfNode) {
+ return getJsDocCommentsFromText(node, sourceFileOfNode.text);
+ }
+ ts.getJsDocComments = getJsDocComments;
+ function getJsDocCommentsFromText(node, text) {
+ var commentRanges = (node.kind === 143 ||
+ node.kind === 142 ||
+ node.kind === 180 ||
+ node.kind === 181) ?
+ ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
+ getLeadingCommentRangesOfNodeFromText(node, text);
+ return ts.filter(commentRanges, isJsDocComment);
+ function isJsDocComment(comment) {
+ return text.charCodeAt(comment.pos + 1) === 42 &&
+ text.charCodeAt(comment.pos + 2) === 42 &&
+ text.charCodeAt(comment.pos + 3) !== 47;
+ }
+ }
+ ts.getJsDocCommentsFromText = getJsDocCommentsFromText;
+ ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/;
+ ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/;
+ ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/;
+ function isPartOfTypeNode(node) {
+ if (155 <= node.kind && node.kind <= 167) {
+ return true;
+ }
+ switch (node.kind) {
+ case 118:
+ case 131:
+ case 133:
+ case 121:
+ case 134:
+ case 136:
+ case 128:
+ return true;
+ case 104:
+ return node.parent.kind !== 184;
+ case 195:
+ return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
+ case 70:
+ if (node.parent.kind === 140 && node.parent.right === node) {
+ node = node.parent;
}
- pos++;
- return token = 25;
- }
- if (char === 123) {
- pos++;
- return token = 15;
- }
- while (pos < end) {
- pos++;
- char = text.charCodeAt(pos);
- if ((char === 123) || (char === 60)) {
- break;
+ else if (node.parent.kind === 173 && node.parent.name === node) {
+ node = node.parent;
+ }
+ ts.Debug.assert(node.kind === 70 || node.kind === 140 || node.kind === 173, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
+ case 140:
+ case 173:
+ case 98:
+ var parent_2 = node.parent;
+ if (parent_2.kind === 159) {
+ return false;
+ }
+ if (155 <= parent_2.kind && parent_2.kind <= 167) {
+ return true;
}
+ switch (parent_2.kind) {
+ case 195:
+ return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_2);
+ case 142:
+ return node === parent_2.constraint;
+ case 146:
+ case 145:
+ case 143:
+ case 219:
+ return node === parent_2.type;
+ case 221:
+ case 180:
+ case 181:
+ case 149:
+ case 148:
+ case 147:
+ case 150:
+ case 151:
+ return node === parent_2.type;
+ case 152:
+ case 153:
+ case 154:
+ return node === parent_2.type;
+ case 178:
+ return node === parent_2.type;
+ case 175:
+ case 176:
+ return parent_2.typeArguments && ts.indexOf(parent_2.typeArguments, node) >= 0;
+ case 177:
+ return false;
+ }
+ }
+ return false;
+ }
+ ts.isPartOfTypeNode = isPartOfTypeNode;
+ function forEachReturnStatement(body, visitor) {
+ return traverse(body);
+ function traverse(node) {
+ switch (node.kind) {
+ case 212:
+ return visitor(node);
+ case 228:
+ case 200:
+ case 204:
+ case 205:
+ case 206:
+ case 207:
+ case 208:
+ case 209:
+ case 213:
+ case 214:
+ case 249:
+ case 250:
+ case 215:
+ case 217:
+ case 252:
+ return ts.forEachChild(node, traverse);
}
- return token = 244;
}
- function scanJsxIdentifier() {
- if (tokenIsIdentifierOrKeyword(token)) {
- var firstCharPosition = pos;
- while (pos < end) {
- var ch = text.charCodeAt(pos);
- if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
- pos++;
+ }
+ ts.forEachReturnStatement = forEachReturnStatement;
+ function forEachYieldExpression(body, visitor) {
+ return traverse(body);
+ function traverse(node) {
+ switch (node.kind) {
+ case 191:
+ visitor(node);
+ var operand = node.expression;
+ if (operand) {
+ traverse(operand);
}
- else {
- break;
+ case 225:
+ case 223:
+ case 226:
+ case 224:
+ case 222:
+ case 193:
+ return;
+ default:
+ if (isFunctionLike(node)) {
+ var name_4 = node.name;
+ if (name_4 && name_4.kind === 141) {
+ traverse(name_4.expression);
+ return;
+ }
+ }
+ else if (!isPartOfTypeNode(node)) {
+ ts.forEachChild(node, traverse);
}
- }
- tokenValue += text.substr(firstCharPosition, pos - firstCharPosition);
}
- return token;
}
- function scanJsxAttributeValue() {
- startPos = pos;
- switch (text.charCodeAt(pos)) {
- case 34:
- case 39:
- tokenValue = scanString(false);
- return token = 9;
- default:
- return scan();
+ }
+ ts.forEachYieldExpression = forEachYieldExpression;
+ function isVariableLike(node) {
+ if (node) {
+ switch (node.kind) {
+ case 170:
+ case 255:
+ case 143:
+ case 253:
+ case 146:
+ case 145:
+ case 254:
+ case 219:
+ return true;
}
}
- function scanJSDocToken() {
- if (pos >= end) {
- return token = 1;
+ return false;
+ }
+ ts.isVariableLike = isVariableLike;
+ function isAccessor(node) {
+ return node && (node.kind === 150 || node.kind === 151);
+ }
+ ts.isAccessor = isAccessor;
+ function isClassLike(node) {
+ return node && (node.kind === 222 || node.kind === 193);
+ }
+ ts.isClassLike = isClassLike;
+ function isFunctionLike(node) {
+ return node && isFunctionLikeKind(node.kind);
+ }
+ ts.isFunctionLike = isFunctionLike;
+ function isFunctionLikeKind(kind) {
+ switch (kind) {
+ case 149:
+ case 180:
+ case 221:
+ case 181:
+ case 148:
+ case 147:
+ case 150:
+ case 151:
+ case 152:
+ case 153:
+ case 154:
+ case 157:
+ case 158:
+ return true;
+ }
+ return false;
+ }
+ ts.isFunctionLikeKind = isFunctionLikeKind;
+ function introducesArgumentsExoticObject(node) {
+ switch (node.kind) {
+ case 148:
+ case 147:
+ case 149:
+ case 150:
+ case 151:
+ case 221:
+ case 180:
+ return true;
+ }
+ return false;
+ }
+ ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject;
+ function isIterationStatement(node, lookInLabeledStatements) {
+ switch (node.kind) {
+ case 207:
+ case 208:
+ case 209:
+ case 205:
+ case 206:
+ return true;
+ case 215:
+ return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
+ }
+ return false;
+ }
+ ts.isIterationStatement = isIterationStatement;
+ function isFunctionBlock(node) {
+ return node && node.kind === 200 && isFunctionLike(node.parent);
+ }
+ ts.isFunctionBlock = isFunctionBlock;
+ function isObjectLiteralMethod(node) {
+ return node && node.kind === 148 && node.parent.kind === 172;
+ }
+ ts.isObjectLiteralMethod = isObjectLiteralMethod;
+ function isObjectLiteralOrClassExpressionMethod(node) {
+ return node.kind === 148 &&
+ (node.parent.kind === 172 ||
+ node.parent.kind === 193);
+ }
+ ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;
+ function isIdentifierTypePredicate(predicate) {
+ return predicate && predicate.kind === 1;
+ }
+ ts.isIdentifierTypePredicate = isIdentifierTypePredicate;
+ function isThisTypePredicate(predicate) {
+ return predicate && predicate.kind === 0;
+ }
+ ts.isThisTypePredicate = isThisTypePredicate;
+ function getContainingFunction(node) {
+ while (true) {
+ node = node.parent;
+ if (!node || isFunctionLike(node)) {
+ return node;
}
- startPos = pos;
- tokenPos = pos;
- var ch = text.charCodeAt(pos);
- switch (ch) {
- case 9:
- case 11:
- case 12:
- case 32:
- while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {
- pos++;
- }
- return token = 5;
- case 64:
- pos++;
- return token = 55;
- case 10:
- case 13:
- pos++;
- return token = 4;
- case 42:
- pos++;
- return token = 37;
- case 123:
- pos++;
- return token = 15;
- case 125:
- pos++;
- return token = 16;
- case 91:
- pos++;
- return token = 19;
- case 93:
- pos++;
- return token = 20;
- case 61:
- pos++;
- return token = 56;
- case 44:
- pos++;
- return token = 24;
+ }
+ }
+ ts.getContainingFunction = getContainingFunction;
+ function getContainingClass(node) {
+ while (true) {
+ node = node.parent;
+ if (!node || isClassLike(node)) {
+ return node;
}
- if (isIdentifierStart(ch, 2)) {
- pos++;
- while (isIdentifierPart(text.charCodeAt(pos), 2) && pos < end) {
- pos++;
- }
- return token = 69;
+ }
+ }
+ ts.getContainingClass = getContainingClass;
+ function getThisContainer(node, includeArrowFunctions) {
+ while (true) {
+ node = node.parent;
+ if (!node) {
+ return undefined;
}
- else {
- return pos += 1, token = 0;
+ switch (node.kind) {
+ case 141:
+ if (isClassLike(node.parent.parent)) {
+ return node;
+ }
+ node = node.parent;
+ break;
+ case 144:
+ if (node.parent.kind === 143 && isClassElement(node.parent.parent)) {
+ node = node.parent.parent;
+ }
+ else if (isClassElement(node.parent)) {
+ node = node.parent;
+ }
+ break;
+ case 181:
+ if (!includeArrowFunctions) {
+ continue;
+ }
+ case 221:
+ case 180:
+ case 226:
+ case 146:
+ case 145:
+ case 148:
+ case 147:
+ case 149:
+ case 150:
+ case 151:
+ case 152:
+ case 153:
+ case 154:
+ case 225:
+ case 256:
+ return node;
}
}
- function speculationHelper(callback, isLookahead) {
- var savePos = pos;
- var saveStartPos = startPos;
- var saveTokenPos = tokenPos;
- var saveToken = token;
- var saveTokenValue = tokenValue;
- var savePrecedingLineBreak = precedingLineBreak;
- var result = callback();
- if (!result || isLookahead) {
- pos = savePos;
- startPos = saveStartPos;
- tokenPos = saveTokenPos;
- token = saveToken;
- tokenValue = saveTokenValue;
- precedingLineBreak = savePrecedingLineBreak;
+ }
+ ts.getThisContainer = getThisContainer;
+ function getSuperContainer(node, stopOnFunctions) {
+ while (true) {
+ node = node.parent;
+ if (!node) {
+ return node;
+ }
+ switch (node.kind) {
+ case 141:
+ node = node.parent;
+ break;
+ case 221:
+ case 180:
+ case 181:
+ if (!stopOnFunctions) {
+ continue;
+ }
+ case 146:
+ case 145:
+ case 148:
+ case 147:
+ case 149:
+ case 150:
+ case 151:
+ return node;
+ case 144:
+ if (node.parent.kind === 143 && isClassElement(node.parent.parent)) {
+ node = node.parent.parent;
+ }
+ else if (isClassElement(node.parent)) {
+ node = node.parent;
+ }
+ break;
}
- return result;
}
- function scanRange(start, length, callback) {
- var saveEnd = end;
- var savePos = pos;
- var saveStartPos = startPos;
- var saveTokenPos = tokenPos;
- var saveToken = token;
- var savePrecedingLineBreak = precedingLineBreak;
- var saveTokenValue = tokenValue;
- var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
- var saveTokenIsUnterminated = tokenIsUnterminated;
- setText(text, start, length);
- var result = callback();
- end = saveEnd;
- pos = savePos;
- startPos = saveStartPos;
- tokenPos = saveTokenPos;
- token = saveToken;
- precedingLineBreak = savePrecedingLineBreak;
- tokenValue = saveTokenValue;
- hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape;
- tokenIsUnterminated = saveTokenIsUnterminated;
- return result;
+ }
+ ts.getSuperContainer = getSuperContainer;
+ function getImmediatelyInvokedFunctionExpression(func) {
+ if (func.kind === 180 || func.kind === 181) {
+ var prev = func;
+ var parent_3 = func.parent;
+ while (parent_3.kind === 179) {
+ prev = parent_3;
+ parent_3 = parent_3.parent;
+ }
+ if (parent_3.kind === 175 && parent_3.expression === prev) {
+ return parent_3;
+ }
}
- function lookAhead(callback) {
- return speculationHelper(callback, true);
+ }
+ ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;
+ function isSuperProperty(node) {
+ var kind = node.kind;
+ return (kind === 173 || kind === 174)
+ && node.expression.kind === 96;
+ }
+ ts.isSuperProperty = isSuperProperty;
+ function getEntityNameFromTypeNode(node) {
+ if (node) {
+ switch (node.kind) {
+ case 156:
+ return node.typeName;
+ case 195:
+ ts.Debug.assert(isEntityNameExpression(node.expression));
+ return node.expression;
+ case 70:
+ case 140:
+ return node;
+ }
}
- function tryScan(callback) {
- return speculationHelper(callback, false);
+ return undefined;
+ }
+ ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
+ function isCallLikeExpression(node) {
+ switch (node.kind) {
+ case 175:
+ case 176:
+ case 177:
+ case 144:
+ return true;
+ default:
+ return false;
}
- function getText() {
- return text;
+ }
+ ts.isCallLikeExpression = isCallLikeExpression;
+ function getInvokedExpression(node) {
+ if (node.kind === 177) {
+ return node.tag;
}
- function setText(newText, start, length) {
- text = newText || "";
- end = length === undefined ? text.length : start + length;
- setTextPos(start || 0);
+ return node.expression;
+ }
+ ts.getInvokedExpression = getInvokedExpression;
+ function nodeCanBeDecorated(node) {
+ switch (node.kind) {
+ case 222:
+ return true;
+ case 146:
+ return node.parent.kind === 222;
+ case 150:
+ case 151:
+ case 148:
+ return node.body !== undefined
+ && node.parent.kind === 222;
+ case 143:
+ return node.parent.body !== undefined
+ && (node.parent.kind === 149
+ || node.parent.kind === 148
+ || node.parent.kind === 151)
+ && node.parent.parent.kind === 222;
}
- function setOnError(errorCallback) {
- onError = errorCallback;
+ return false;
+ }
+ ts.nodeCanBeDecorated = nodeCanBeDecorated;
+ function nodeIsDecorated(node) {
+ return node.decorators !== undefined
+ && nodeCanBeDecorated(node);
+ }
+ ts.nodeIsDecorated = nodeIsDecorated;
+ function nodeOrChildIsDecorated(node) {
+ return nodeIsDecorated(node) || childIsDecorated(node);
+ }
+ ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
+ function childIsDecorated(node) {
+ switch (node.kind) {
+ case 222:
+ return ts.forEach(node.members, nodeOrChildIsDecorated);
+ case 148:
+ case 151:
+ return ts.forEach(node.parameters, nodeIsDecorated);
}
- function setScriptTarget(scriptTarget) {
- languageVersion = scriptTarget;
+ }
+ ts.childIsDecorated = childIsDecorated;
+ function isJSXTagName(node) {
+ var parent = node.parent;
+ if (parent.kind === 244 ||
+ parent.kind === 243 ||
+ parent.kind === 245) {
+ return parent.tagName === node;
}
- function setLanguageVariant(variant) {
- languageVariant = variant;
+ return false;
+ }
+ ts.isJSXTagName = isJSXTagName;
+ function isPartOfExpression(node) {
+ switch (node.kind) {
+ case 98:
+ case 96:
+ case 94:
+ case 100:
+ case 85:
+ case 11:
+ case 171:
+ case 172:
+ case 173:
+ case 174:
+ case 175:
+ case 176:
+ case 177:
+ case 196:
+ case 178:
+ case 197:
+ case 179:
+ case 180:
+ case 193:
+ case 181:
+ case 184:
+ case 182:
+ case 183:
+ case 186:
+ case 187:
+ case 188:
+ case 189:
+ case 192:
+ case 190:
+ case 12:
+ case 194:
+ case 242:
+ case 243:
+ case 191:
+ case 185:
+ return true;
+ case 140:
+ while (node.parent.kind === 140) {
+ node = node.parent;
+ }
+ return node.parent.kind === 159 || isJSXTagName(node);
+ case 70:
+ if (node.parent.kind === 159 || isJSXTagName(node)) {
+ return true;
+ }
+ case 8:
+ case 9:
+ case 98:
+ var parent_4 = node.parent;
+ switch (parent_4.kind) {
+ case 219:
+ case 143:
+ case 146:
+ case 145:
+ case 255:
+ case 253:
+ case 170:
+ return parent_4.initializer === node;
+ case 203:
+ case 204:
+ case 205:
+ case 206:
+ case 212:
+ case 213:
+ case 214:
+ case 249:
+ case 216:
+ case 214:
+ return parent_4.expression === node;
+ case 207:
+ var forStatement = parent_4;
+ return (forStatement.initializer === node && forStatement.initializer.kind !== 220) ||
+ forStatement.condition === node ||
+ forStatement.incrementor === node;
+ case 208:
+ case 209:
+ var forInStatement = parent_4;
+ return (forInStatement.initializer === node && forInStatement.initializer.kind !== 220) ||
+ forInStatement.expression === node;
+ case 178:
+ case 196:
+ return node === parent_4.expression;
+ case 198:
+ return node === parent_4.expression;
+ case 141:
+ return node === parent_4.expression;
+ case 144:
+ case 248:
+ case 247:
+ return true;
+ case 195:
+ return parent_4.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_4);
+ default:
+ if (isPartOfExpression(parent_4)) {
+ return true;
+ }
+ }
}
- function setTextPos(textPos) {
- ts.Debug.assert(textPos >= 0);
- pos = textPos;
- startPos = textPos;
- tokenPos = textPos;
- token = 0;
- precedingLineBreak = false;
- tokenValue = undefined;
- hasExtendedUnicodeEscape = false;
- tokenIsUnterminated = false;
+ return false;
+ }
+ ts.isPartOfExpression = isPartOfExpression;
+ function isInstantiatedModule(node, preserveConstEnums) {
+ var moduleState = ts.getModuleInstanceState(node);
+ return moduleState === 1 ||
+ (preserveConstEnums && moduleState === 2);
+ }
+ ts.isInstantiatedModule = isInstantiatedModule;
+ function isExternalModuleImportEqualsDeclaration(node) {
+ return node.kind === 230 && node.moduleReference.kind === 241;
+ }
+ ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
+ function getExternalModuleImportEqualsDeclarationExpression(node) {
+ ts.Debug.assert(isExternalModuleImportEqualsDeclaration(node));
+ return node.moduleReference.expression;
+ }
+ ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
+ function isInternalModuleImportEqualsDeclaration(node) {
+ return node.kind === 230 && node.moduleReference.kind !== 241;
+ }
+ ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
+ function isSourceFileJavaScript(file) {
+ return isInJavaScriptFile(file);
+ }
+ ts.isSourceFileJavaScript = isSourceFileJavaScript;
+ function isInJavaScriptFile(node) {
+ return node && !!(node.flags & 1048576);
+ }
+ ts.isInJavaScriptFile = isInJavaScriptFile;
+ function isRequireCall(expression, checkArgumentIsStringLiteral) {
+ var isRequire = expression.kind === 175 &&
+ expression.expression.kind === 70 &&
+ expression.expression.text === "require" &&
+ expression.arguments.length === 1;
+ return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9);
+ }
+ ts.isRequireCall = isRequireCall;
+ function isSingleOrDoubleQuote(charCode) {
+ return charCode === 39 || charCode === 34;
+ }
+ ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote;
+ function isDeclarationOfFunctionExpression(s) {
+ if (s.valueDeclaration && s.valueDeclaration.kind === 219) {
+ var declaration = s.valueDeclaration;
+ return declaration.initializer && declaration.initializer.kind === 180;
}
+ return false;
}
- ts.createScanner = createScanner;
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" };
- ts.optionDeclarations = [
- {
- name: "charset",
- type: "string"
- },
- ts.compileOnSaveCommandLineOption,
- {
- name: "declaration",
- shortName: "d",
- type: "boolean",
- description: ts.Diagnostics.Generates_corresponding_d_ts_file
- },
- {
- name: "declarationDir",
- type: "string",
- isFilePath: true,
- paramType: ts.Diagnostics.DIRECTORY
- },
- {
- name: "diagnostics",
- type: "boolean"
- },
- {
- name: "extendedDiagnostics",
- type: "boolean",
- experimental: true
- },
- {
- name: "emitBOM",
- type: "boolean"
- },
- {
- name: "help",
- shortName: "h",
- type: "boolean",
- description: ts.Diagnostics.Print_this_message
- },
- {
- name: "help",
- shortName: "?",
- type: "boolean"
- },
- {
- name: "init",
- type: "boolean",
- description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file
- },
- {
- name: "inlineSourceMap",
- type: "boolean"
- },
- {
- name: "inlineSources",
- type: "boolean"
- },
- {
- name: "jsx",
- type: ts.createMap({
- "preserve": 1,
- "react": 2
- }),
- paramType: ts.Diagnostics.KIND,
- description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react
- },
- {
- name: "reactNamespace",
- type: "string",
- description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit
- },
- {
- name: "listFiles",
- type: "boolean"
- },
- {
- name: "locale",
- type: "string"
- },
- {
- name: "mapRoot",
- type: "string",
- isFilePath: true,
- description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
- paramType: ts.Diagnostics.LOCATION
- },
- {
- name: "module",
- shortName: "m",
- type: ts.createMap({
- "none": ts.ModuleKind.None,
- "commonjs": ts.ModuleKind.CommonJS,
- "amd": ts.ModuleKind.AMD,
- "system": ts.ModuleKind.System,
- "umd": ts.ModuleKind.UMD,
- "es6": ts.ModuleKind.ES6,
- "es2015": ts.ModuleKind.ES2015
- }),
- description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015,
- paramType: ts.Diagnostics.KIND
- },
- {
- name: "newLine",
- type: ts.createMap({
- "crlf": 0,
- "lf": 1
- }),
- description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
- paramType: ts.Diagnostics.NEWLINE
- },
- {
- name: "noEmit",
- type: "boolean",
- description: ts.Diagnostics.Do_not_emit_outputs
- },
- {
- name: "noEmitHelpers",
- type: "boolean"
- },
- {
- name: "noEmitOnError",
- type: "boolean",
- description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported
- },
- {
- name: "noErrorTruncation",
- type: "boolean"
- },
- {
- name: "noImplicitAny",
- type: "boolean",
- description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type
- },
- {
- name: "noImplicitThis",
- type: "boolean",
- description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type
- },
- {
- name: "noUnusedLocals",
- type: "boolean",
- description: ts.Diagnostics.Report_errors_on_unused_locals
- },
- {
- name: "noUnusedParameters",
- type: "boolean",
- description: ts.Diagnostics.Report_errors_on_unused_parameters
- },
- {
- name: "noLib",
- type: "boolean"
- },
- {
- name: "noResolve",
- type: "boolean"
- },
- {
- name: "skipDefaultLibCheck",
- type: "boolean"
- },
- {
- name: "skipLibCheck",
- type: "boolean",
- description: ts.Diagnostics.Skip_type_checking_of_declaration_files
- },
- {
- name: "out",
- type: "string",
- isFilePath: false,
- paramType: ts.Diagnostics.FILE
- },
- {
- name: "outFile",
- type: "string",
- isFilePath: true,
- description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,
- paramType: ts.Diagnostics.FILE
- },
- {
- name: "outDir",
- type: "string",
- isFilePath: true,
- description: ts.Diagnostics.Redirect_output_structure_to_the_directory,
- paramType: ts.Diagnostics.DIRECTORY
- },
- {
- name: "preserveConstEnums",
- type: "boolean",
- description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
- },
- {
- name: "pretty",
- description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental,
- type: "boolean"
- },
- {
- name: "project",
- shortName: "p",
- type: "string",
- isFilePath: true,
- description: ts.Diagnostics.Compile_the_project_in_the_given_directory,
- paramType: ts.Diagnostics.DIRECTORY
- },
- {
- name: "removeComments",
- type: "boolean",
- description: ts.Diagnostics.Do_not_emit_comments_to_output
- },
- {
- name: "rootDir",
- type: "string",
- isFilePath: true,
- paramType: ts.Diagnostics.LOCATION,
- description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir
- },
- {
- name: "isolatedModules",
- type: "boolean"
- },
- {
- name: "sourceMap",
- type: "boolean",
- description: ts.Diagnostics.Generates_corresponding_map_file
- },
- {
- name: "sourceRoot",
- type: "string",
- isFilePath: true,
- description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
- paramType: ts.Diagnostics.LOCATION
- },
- {
- name: "suppressExcessPropertyErrors",
- type: "boolean",
- description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals,
- experimental: true
- },
- {
- name: "suppressImplicitAnyIndexErrors",
- type: "boolean",
- description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures
- },
- {
- name: "stripInternal",
- type: "boolean",
- description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,
- experimental: true
- },
- {
- name: "target",
- shortName: "t",
- type: ts.createMap({
- "es3": 0,
- "es5": 1,
- "es6": 2,
- "es2015": 2
- }),
- description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015,
- paramType: ts.Diagnostics.VERSION
- },
- {
- name: "version",
- shortName: "v",
- type: "boolean",
- description: ts.Diagnostics.Print_the_compiler_s_version
- },
- {
- name: "watch",
- shortName: "w",
- type: "boolean",
- description: ts.Diagnostics.Watch_input_files
- },
- {
- name: "experimentalDecorators",
- type: "boolean",
- description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators
- },
- {
- name: "emitDecoratorMetadata",
- type: "boolean",
- experimental: true,
- description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
- },
- {
- name: "moduleResolution",
- type: ts.createMap({
- "node": ts.ModuleResolutionKind.NodeJs,
- "classic": ts.ModuleResolutionKind.Classic
- }),
- description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,
- paramType: ts.Diagnostics.STRATEGY
- },
- {
- name: "allowUnusedLabels",
- type: "boolean",
- description: ts.Diagnostics.Do_not_report_errors_on_unused_labels
- },
- {
- name: "noImplicitReturns",
- type: "boolean",
- description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value
- },
- {
- name: "noFallthroughCasesInSwitch",
- type: "boolean",
- description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement
- },
- {
- name: "allowUnreachableCode",
- type: "boolean",
- description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code
- },
- {
- name: "forceConsistentCasingInFileNames",
- type: "boolean",
- description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file
- },
- {
- name: "baseUrl",
- type: "string",
- isFilePath: true,
- description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names
- },
- {
- name: "paths",
- type: "object",
- isTSConfigOnly: true
- },
- {
- name: "rootDirs",
- type: "list",
- isTSConfigOnly: true,
- element: {
- name: "rootDirs",
- type: "string",
- isFilePath: true
+ ts.isDeclarationOfFunctionExpression = isDeclarationOfFunctionExpression;
+ function getSpecialPropertyAssignmentKind(expression) {
+ if (!isInJavaScriptFile(expression)) {
+ return 0;
+ }
+ if (expression.kind !== 188) {
+ return 0;
+ }
+ var expr = expression;
+ if (expr.operatorToken.kind !== 57 || expr.left.kind !== 173) {
+ return 0;
+ }
+ var lhs = expr.left;
+ if (lhs.expression.kind === 70) {
+ var lhsId = lhs.expression;
+ if (lhsId.text === "exports") {
+ return 1;
}
- },
- {
- name: "typeRoots",
- type: "list",
- element: {
- name: "typeRoots",
- type: "string",
- isFilePath: true
+ else if (lhsId.text === "module" && lhs.name.text === "exports") {
+ return 2;
}
- },
- {
- name: "types",
- type: "list",
- element: {
- name: "types",
- type: "string"
- },
- description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation
- },
- {
- name: "traceResolution",
- type: "boolean",
- description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process
- },
- {
- name: "allowJs",
- type: "boolean",
- description: ts.Diagnostics.Allow_javascript_files_to_be_compiled
- },
- {
- name: "allowSyntheticDefaultImports",
- type: "boolean",
- description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking
- },
- {
- name: "noImplicitUseStrict",
- type: "boolean",
- description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output
- },
- {
- name: "maxNodeModuleJsDepth",
- type: "number",
- description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files
- },
- {
- name: "listEmittedFiles",
- type: "boolean"
- },
- {
- name: "lib",
- type: "list",
- element: {
- name: "lib",
- type: ts.createMap({
- "es5": "lib.es5.d.ts",
- "es6": "lib.es2015.d.ts",
- "es2015": "lib.es2015.d.ts",
- "es7": "lib.es2016.d.ts",
- "es2016": "lib.es2016.d.ts",
- "es2017": "lib.es2017.d.ts",
- "dom": "lib.dom.d.ts",
- "dom.iterable": "lib.dom.iterable.d.ts",
- "webworker": "lib.webworker.d.ts",
- "scripthost": "lib.scripthost.d.ts",
- "es2015.core": "lib.es2015.core.d.ts",
- "es2015.collection": "lib.es2015.collection.d.ts",
- "es2015.generator": "lib.es2015.generator.d.ts",
- "es2015.iterable": "lib.es2015.iterable.d.ts",
- "es2015.promise": "lib.es2015.promise.d.ts",
- "es2015.proxy": "lib.es2015.proxy.d.ts",
- "es2015.reflect": "lib.es2015.reflect.d.ts",
- "es2015.symbol": "lib.es2015.symbol.d.ts",
- "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts",
- "es2016.array.include": "lib.es2016.array.include.d.ts",
- "es2017.object": "lib.es2017.object.d.ts",
- "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts"
- })
- },
- description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon
- },
- {
- name: "disableSizeLimit",
- type: "boolean"
- },
- {
- name: "strictNullChecks",
- type: "boolean",
- description: ts.Diagnostics.Enable_strict_null_checks
- },
- {
- name: "importHelpers",
- type: "boolean",
- description: ts.Diagnostics.Import_emit_helpers_from_tslib
- },
- {
- name: "alwaysStrict",
- type: "boolean",
- description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file
}
- ];
- ts.typingOptionDeclarations = [
- {
- name: "enableAutoDiscovery",
- type: "boolean"
- },
- {
- name: "include",
- type: "list",
- element: {
- name: "include",
- type: "string"
- }
- },
- {
- name: "exclude",
- type: "list",
- element: {
- name: "exclude",
- type: "string"
+ else if (lhs.expression.kind === 98) {
+ return 4;
+ }
+ else if (lhs.expression.kind === 173) {
+ var innerPropertyAccess = lhs.expression;
+ if (innerPropertyAccess.expression.kind === 70) {
+ var innerPropertyAccessIdentifier = innerPropertyAccess.expression;
+ if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") {
+ return 1;
+ }
+ if (innerPropertyAccess.name.text === "prototype") {
+ return 3;
+ }
}
}
- ];
- ts.defaultInitCompilerOptions = {
- module: ts.ModuleKind.CommonJS,
- target: 1,
- noImplicitAny: false,
- sourceMap: false
- };
- var optionNameMapCache;
- function getOptionNameMap() {
- if (optionNameMapCache) {
- return optionNameMapCache;
+ return 0;
+ }
+ ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind;
+ function getExternalModuleName(node) {
+ if (node.kind === 231) {
+ return node.moduleSpecifier;
}
- var optionNameMap = ts.createMap();
- var shortOptionNames = ts.createMap();
- ts.forEach(ts.optionDeclarations, function (option) {
- optionNameMap[option.name.toLowerCase()] = option;
- if (option.shortName) {
- shortOptionNames[option.shortName] = option.name;
+ if (node.kind === 230) {
+ var reference = node.moduleReference;
+ if (reference.kind === 241) {
+ return reference.expression;
}
- });
- optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames };
- return optionNameMapCache;
- }
- ts.getOptionNameMap = getOptionNameMap;
- function createCompilerDiagnosticForInvalidCustomType(opt) {
- var namesOfType = [];
- for (var key in opt.type) {
- namesOfType.push(" '" + key + "'");
}
- return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType);
- }
- ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType;
- function parseCustomTypeOption(opt, value, errors) {
- var key = trimString((value || "")).toLowerCase();
- var map = opt.type;
- if (key in map) {
- return map[key];
+ if (node.kind === 237) {
+ return node.moduleSpecifier;
}
- else {
- errors.push(createCompilerDiagnosticForInvalidCustomType(opt));
+ if (node.kind === 226 && node.name.kind === 9) {
+ return node.name;
}
}
- ts.parseCustomTypeOption = parseCustomTypeOption;
- function parseListTypeOption(opt, value, errors) {
- if (value === void 0) { value = ""; }
- value = trimString(value);
- if (ts.startsWith(value, "-")) {
- return undefined;
- }
- if (value === "") {
- return [];
+ ts.getExternalModuleName = getExternalModuleName;
+ function getNamespaceDeclarationNode(node) {
+ if (node.kind === 230) {
+ return node;
}
- var values = value.split(",");
- switch (opt.element.type) {
- case "number":
- return ts.map(values, parseInt);
- case "string":
- return ts.map(values, function (v) { return v || ""; });
- default:
- return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; });
+ var importClause = node.importClause;
+ if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 233) {
+ return importClause.namedBindings;
}
}
- ts.parseListTypeOption = parseListTypeOption;
- function parseCommandLine(commandLine, readFile) {
- var options = {};
- var fileNames = [];
- var errors = [];
- var _a = getOptionNameMap(), optionNameMap = _a.optionNameMap, shortOptionNames = _a.shortOptionNames;
- parseStrings(commandLine);
- return {
- options: options,
- fileNames: fileNames,
- errors: errors
- };
- function parseStrings(args) {
- var i = 0;
- while (i < args.length) {
- var s = args[i];
- i++;
- if (s.charCodeAt(0) === 64) {
- parseResponseFile(s.slice(1));
- }
- else if (s.charCodeAt(0) === 45) {
- s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase();
- if (s in shortOptionNames) {
- s = shortOptionNames[s];
- }
- if (s in optionNameMap) {
- var opt = optionNameMap[s];
- if (opt.isTSConfigOnly) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name));
- }
- else {
- if (!args[i] && opt.type !== "boolean") {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name));
- }
- switch (opt.type) {
- case "number":
- options[opt.name] = parseInt(args[i]);
- i++;
- break;
- case "boolean":
- options[opt.name] = true;
- break;
- case "string":
- options[opt.name] = args[i] || "";
- i++;
- break;
- case "list":
- var result = parseListTypeOption(opt, args[i], errors);
- options[opt.name] = result || [];
- if (result) {
- i++;
- }
- break;
- default:
- options[opt.name] = parseCustomTypeOption(opt, args[i], errors);
- i++;
- break;
- }
- }
- }
- else {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s));
- }
- }
- else {
- fileNames.push(s);
- }
- }
- }
- function parseResponseFile(fileName) {
- var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName);
- if (!text) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName));
- return;
- }
- var args = [];
- var pos = 0;
- while (true) {
- while (pos < text.length && text.charCodeAt(pos) <= 32)
- pos++;
- if (pos >= text.length)
- break;
- var start = pos;
- if (text.charCodeAt(start) === 34) {
- pos++;
- while (pos < text.length && text.charCodeAt(pos) !== 34)
- pos++;
- if (pos < text.length) {
- args.push(text.substring(start + 1, pos));
- pos++;
- }
- else {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName));
- }
- }
- else {
- while (text.charCodeAt(pos) > 32)
- pos++;
- args.push(text.substring(start, pos));
- }
+ ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
+ function isDefaultImport(node) {
+ return node.kind === 231
+ && node.importClause
+ && !!node.importClause.name;
+ }
+ ts.isDefaultImport = isDefaultImport;
+ function hasQuestionToken(node) {
+ if (node) {
+ switch (node.kind) {
+ case 143:
+ case 148:
+ case 147:
+ case 254:
+ case 253:
+ case 146:
+ case 145:
+ return node.questionToken !== undefined;
}
- parseStrings(args);
}
+ return false;
}
- ts.parseCommandLine = parseCommandLine;
- function readConfigFile(fileName, readFile) {
- var text = "";
- try {
- text = readFile(fileName);
- }
- catch (e) {
- return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };
- }
- return parseConfigFileTextToJson(fileName, text);
+ ts.hasQuestionToken = hasQuestionToken;
+ function isJSDocConstructSignature(node) {
+ return node.kind === 269 &&
+ node.parameters.length > 0 &&
+ node.parameters[0].type.kind === 271;
}
- ts.readConfigFile = readConfigFile;
- function parseConfigFileTextToJson(fileName, jsonText, stripComments) {
- if (stripComments === void 0) { stripComments = true; }
- try {
- var jsonTextToParse = stripComments ? removeComments(jsonText) : jsonText;
- return { config: /\S/.test(jsonTextToParse) ? JSON.parse(jsonTextToParse) : {} };
- }
- catch (e) {
- return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) };
+ ts.isJSDocConstructSignature = isJSDocConstructSignature;
+ function getJSDocTag(node, kind, checkParentVariableStatement) {
+ if (!node) {
+ return undefined;
}
- }
- ts.parseConfigFileTextToJson = parseConfigFileTextToJson;
- function generateTSConfig(options, fileNames) {
- var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions);
- var configurations = {
- compilerOptions: serializeCompilerOptions(compilerOptions)
- };
- if (fileNames && fileNames.length) {
- configurations.files = fileNames;
+ var jsDocTags = getJSDocTags(node, checkParentVariableStatement);
+ if (!jsDocTags) {
+ return undefined;
}
- return configurations;
- function getCustomTypeMapOfCommandLineOption(optionDefinition) {
- if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") {
- return undefined;
- }
- else if (optionDefinition.type === "list") {
- return getCustomTypeMapOfCommandLineOption(optionDefinition.element);
- }
- else {
- return optionDefinition.type;
+ for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) {
+ var tag = jsDocTags_1[_i];
+ if (tag.kind === kind) {
+ return tag;
}
}
- function getNameOfCompilerOptionValue(value, customTypeMap) {
- for (var key in customTypeMap) {
- if (customTypeMap[key] === value) {
- return key;
- }
+ }
+ function append(previous, additional) {
+ if (additional) {
+ if (!previous) {
+ previous = [];
+ }
+ for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) {
+ var x = additional_1[_i];
+ previous.push(x);
}
- return undefined;
}
- function serializeCompilerOptions(options) {
- var result = ts.createMap();
- var optionsNameMap = getOptionNameMap().optionNameMap;
- for (var name_5 in options) {
- if (ts.hasProperty(options, name_5)) {
- switch (name_5) {
- case "init":
- case "watch":
- case "version":
- case "help":
- case "project":
- break;
- default:
- var value = options[name_5];
- var optionDefinition = optionsNameMap[name_5.toLowerCase()];
- if (optionDefinition) {
- var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);
- if (!customTypeMap) {
- result[name_5] = value;
- }
- else {
- if (optionDefinition.type === "list") {
- var convertedValue = [];
- for (var _i = 0, _a = value; _i < _a.length; _i++) {
- var element = _a[_i];
- convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap));
- }
- result[name_5] = convertedValue;
- }
- else {
- result[name_5] = getNameOfCompilerOptionValue(value, customTypeMap);
- }
- }
- }
- break;
- }
+ return previous;
+ }
+ function getJSDocComments(node, checkParentVariableStatement) {
+ return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); });
+ }
+ ts.getJSDocComments = getJSDocComments;
+ function getJSDocTags(node, checkParentVariableStatement) {
+ return getJSDocs(node, checkParentVariableStatement, function (docs) {
+ var result = [];
+ for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) {
+ var doc = docs_1[_i];
+ if (doc.tags) {
+ result.push.apply(result, doc.tags);
}
}
return result;
- }
+ }, function (tags) { return tags; });
}
- ts.generateTSConfig = generateTSConfig;
- function removeComments(jsonText) {
- var output = "";
- var scanner = ts.createScanner(1, false, 0, jsonText);
- var token;
- while ((token = scanner.scan()) !== 1) {
- switch (token) {
- case 2:
- case 3:
- output += scanner.getTokenText().replace(/\S/g, " ");
- break;
- default:
- output += scanner.getTokenText();
- break;
+ function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) {
+ var result = undefined;
+ if (checkParentVariableStatement) {
+ var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) &&
+ (node.parent).initializer === node &&
+ node.parent.parent.parent.kind === 201;
+ var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&
+ node.parent.parent.kind === 201;
+ var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent :
+ isVariableOfVariableDeclarationStatement ? node.parent.parent :
+ undefined;
+ if (variableStatementNode) {
+ result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags));
+ }
+ if (node.kind === 226 &&
+ node.parent && node.parent.kind === 226) {
+ result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags));
+ }
+ var parent_5 = node.parent;
+ var isSourceOfAssignmentExpressionStatement = parent_5 && parent_5.parent &&
+ parent_5.kind === 188 &&
+ parent_5.operatorToken.kind === 57 &&
+ parent_5.parent.kind === 203;
+ if (isSourceOfAssignmentExpressionStatement) {
+ result = append(result, getJSDocs(parent_5.parent, checkParentVariableStatement, getDocs, getTags));
+ }
+ var isPropertyAssignmentExpression = parent_5 && parent_5.kind === 253;
+ if (isPropertyAssignmentExpression) {
+ result = append(result, getJSDocs(parent_5, checkParentVariableStatement, getDocs, getTags));
+ }
+ if (node.kind === 143) {
+ var paramTags = getJSDocParameterTag(node, checkParentVariableStatement);
+ if (paramTags) {
+ result = append(result, getTags(paramTags));
+ }
}
}
- return output;
- }
- function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) {
- if (existingOptions === void 0) { existingOptions = {}; }
- if (resolutionStack === void 0) { resolutionStack = []; }
- var errors = [];
- var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
- var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName);
- if (resolutionStack.indexOf(resolvedPath) >= 0) {
- return {
- options: {},
- fileNames: [],
- typingOptions: {},
- raw: json,
- errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))],
- wildcardDirectories: {}
- };
+ if (isVariableLike(node) && node.initializer) {
+ result = append(result, getJSDocs(node.initializer, false, getDocs, getTags));
}
- var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
- var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
- if (json["extends"]) {
- var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];
- if (typeof json["extends"] === "string") {
- _b = (tryExtendsName(json["extends"]) || [include, exclude, files, baseOptions]), include = _b[0], exclude = _b[1], files = _b[2], baseOptions = _b[3];
+ if (node.jsDocComments) {
+ if (result) {
+ result = append(result, getDocs(node.jsDocComments));
}
else {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string"));
- }
- if (include && !json["include"]) {
- json["include"] = include;
- }
- if (exclude && !json["exclude"]) {
- json["exclude"] = exclude;
+ return getDocs(node.jsDocComments);
}
- if (files && !json["files"]) {
- json["files"] = files;
+ }
+ return result;
+ }
+ function getJSDocParameterTag(param, checkParentVariableStatement) {
+ var func = param.parent;
+ var tags = getJSDocTags(func, checkParentVariableStatement);
+ if (!param.name) {
+ var i = func.parameters.indexOf(param);
+ var paramTags = ts.filter(tags, function (tag) { return tag.kind === 275; });
+ if (paramTags && 0 <= i && i < paramTags.length) {
+ return [paramTags[i]];
}
- options = ts.assign({}, baseOptions, options);
}
- options = ts.extend(existingOptions, options);
- options.configFilePath = configFileName;
- var _c = getFileNames(errors), fileNames = _c.fileNames, wildcardDirectories = _c.wildcardDirectories;
- var compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
- return {
- options: options,
- fileNames: fileNames,
- typingOptions: typingOptions,
- raw: json,
- errors: errors,
- wildcardDirectories: wildcardDirectories,
- compileOnSave: compileOnSave
- };
- function tryExtendsName(extendedConfig) {
- if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted));
- return;
- }
- var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);
- if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json")) {
- extendedConfigPath = extendedConfigPath + ".json";
- if (!host.fileExists(extendedConfigPath)) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
- return;
- }
- }
- var extendedResult = readConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
- if (extendedResult.error) {
- errors.push(extendedResult.error);
- return;
+ else if (param.name.kind === 70) {
+ var name_5 = param.name.text;
+ var paramTags = ts.filter(tags, function (tag) { return tag.kind === 275 && tag.parameterName.text === name_5; });
+ if (paramTags) {
+ return paramTags;
}
- var extendedDirname = ts.getDirectoryPath(extendedConfigPath);
- var relativeDifference = ts.convertToRelativePath(extendedDirname, basePath, getCanonicalFileName);
- var updatePath = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference, path); };
- var result = parseJsonConfigFileContent(extendedResult.config, host, extendedDirname, undefined, ts.getBaseFileName(extendedConfigPath), resolutionStack.concat([resolvedPath]));
- errors.push.apply(errors, result.errors);
- var _a = ts.map(["include", "exclude", "files"], function (key) {
- if (!json[key] && extendedResult.config[key]) {
- return ts.map(extendedResult.config[key], updatePath);
- }
- }), include = _a[0], exclude = _a[1], files = _a[2];
- return [include, exclude, files, result.options];
}
- function getFileNames(errors) {
- var fileNames;
- if (ts.hasProperty(json, "files")) {
- if (ts.isArray(json["files"])) {
- fileNames = json["files"];
- }
- else {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array"));
- }
- }
- var includeSpecs;
- if (ts.hasProperty(json, "include")) {
- if (ts.isArray(json["include"])) {
- includeSpecs = json["include"];
- }
- else {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "include", "Array"));
- }
- }
- var excludeSpecs;
- if (ts.hasProperty(json, "exclude")) {
- if (ts.isArray(json["exclude"])) {
- excludeSpecs = json["exclude"];
- }
- else {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "exclude", "Array"));
- }
- }
- else if (ts.hasProperty(json, "excludes")) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
+ else {
+ return undefined;
+ }
+ }
+ function getJSDocTypeTag(node) {
+ return getJSDocTag(node, 277, false);
+ }
+ ts.getJSDocTypeTag = getJSDocTypeTag;
+ function getJSDocReturnTag(node) {
+ return getJSDocTag(node, 276, true);
+ }
+ ts.getJSDocReturnTag = getJSDocReturnTag;
+ function getJSDocTemplateTag(node) {
+ return getJSDocTag(node, 278, false);
+ }
+ ts.getJSDocTemplateTag = getJSDocTemplateTag;
+ function getCorrespondingJSDocParameterTag(parameter) {
+ if (parameter.name && parameter.name.kind === 70) {
+ var parameterName = parameter.name.text;
+ var jsDocTags = getJSDocTags(parameter.parent, true);
+ if (!jsDocTags) {
+ return undefined;
}
- else {
- excludeSpecs = ["node_modules", "bower_components", "jspm_packages"];
- var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
- if (outDir) {
- excludeSpecs.push(outDir);
+ for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) {
+ var tag = jsDocTags_2[_i];
+ if (tag.kind === 275) {
+ var parameterTag = tag;
+ if (parameterTag.parameterName.text === parameterName) {
+ return parameterTag;
+ }
}
}
- if (fileNames === undefined && includeSpecs === undefined) {
- includeSpecs = ["**/*"];
- }
- return matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors);
- }
- var _b;
- }
- ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
- function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {
- if (!ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) {
- return false;
- }
- var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption["compileOnSave"], basePath, errors);
- if (typeof result === "boolean" && result) {
- return result;
}
- return false;
+ return undefined;
}
- ts.convertCompileOnSaveOptionFromJson = convertCompileOnSaveOptionFromJson;
- function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) {
- var errors = [];
- var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
- return { options: options, errors: errors };
+ ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag;
+ function hasRestParameter(s) {
+ return isRestParameter(ts.lastOrUndefined(s.parameters));
}
- ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
- function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) {
- var errors = [];
- var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
- return { options: options, errors: errors };
+ ts.hasRestParameter = hasRestParameter;
+ function hasDeclaredRestParameter(s) {
+ return isDeclaredRestParam(ts.lastOrUndefined(s.parameters));
}
- ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
- function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
- var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
- ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }
- : {};
- convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
- return options;
+ ts.hasDeclaredRestParameter = hasDeclaredRestParameter;
+ function isRestParameter(node) {
+ if (node && (node.flags & 1048576)) {
+ if (node.type && node.type.kind === 270) {
+ return true;
+ }
+ var paramTag = getCorrespondingJSDocParameterTag(node);
+ if (paramTag && paramTag.typeExpression) {
+ return paramTag.typeExpression.type.kind === 270;
+ }
+ }
+ return isDeclaredRestParam(node);
}
- function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
- var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
- ? { enableAutoDiscovery: true, include: [], exclude: [] }
- : { enableAutoDiscovery: false, include: [], exclude: [] };
- convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
- return options;
+ ts.isRestParameter = isRestParameter;
+ function isDeclaredRestParam(node) {
+ return node && node.dotDotDotToken !== undefined;
}
- function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {
- if (!jsonOptions) {
- return;
+ ts.isDeclaredRestParam = isDeclaredRestParam;
+ function isAssignmentTarget(node) {
+ while (node.parent.kind === 179) {
+ node = node.parent;
}
- var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; });
- for (var id in jsonOptions) {
- if (id in optionNameMap) {
- var opt = optionNameMap[id];
- defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);
+ while (true) {
+ var parent_6 = node.parent;
+ if (parent_6.kind === 171 || parent_6.kind === 192) {
+ node = parent_6;
+ continue;
}
- else {
- errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id));
+ if (parent_6.kind === 253 || parent_6.kind === 254) {
+ node = parent_6.parent;
+ continue;
}
+ return parent_6.kind === 188 &&
+ isAssignmentOperator(parent_6.operatorToken.kind) &&
+ parent_6.left === node ||
+ (parent_6.kind === 208 || parent_6.kind === 209) &&
+ parent_6.initializer === node;
}
}
- function convertJsonOption(opt, value, basePath, errors) {
- var optType = opt.type;
- var expectedType = typeof optType === "string" ? optType : "string";
- if (optType === "list" && ts.isArray(value)) {
- return convertJsonOptionOfListType(opt, value, basePath, errors);
+ ts.isAssignmentTarget = isAssignmentTarget;
+ function isNodeDescendantOf(node, ancestor) {
+ while (node) {
+ if (node === ancestor)
+ return true;
+ node = node.parent;
}
- else if (typeof value === expectedType) {
- if (typeof optType !== "string") {
- return convertJsonOptionOfCustomType(opt, value, errors);
+ return false;
+ }
+ ts.isNodeDescendantOf = isNodeDescendantOf;
+ function isInAmbientContext(node) {
+ while (node) {
+ if (hasModifier(node, 2) || (node.kind === 256 && node.isDeclarationFile)) {
+ return true;
}
- else {
- if (opt.isFilePath) {
- value = ts.normalizePath(ts.combinePaths(basePath, value));
- if (value === "") {
- value = ".";
- }
- }
+ node = node.parent;
+ }
+ return false;
+ }
+ ts.isInAmbientContext = isInAmbientContext;
+ function isDeclarationName(name) {
+ if (name.kind !== 70 && name.kind !== 9 && name.kind !== 8) {
+ return false;
+ }
+ var parent = name.parent;
+ if (parent.kind === 235 || parent.kind === 239) {
+ if (parent.propertyName) {
+ return true;
}
- return value;
}
- else {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType));
+ if (isDeclaration(parent)) {
+ return parent.name === name;
}
+ return false;
}
- function convertJsonOptionOfCustomType(opt, value, errors) {
- var key = value.toLowerCase();
- if (key in opt.type) {
- return opt.type[key];
- }
- else {
- errors.push(createCompilerDiagnosticForInvalidCustomType(opt));
+ ts.isDeclarationName = isDeclarationName;
+ function isLiteralComputedPropertyDeclarationName(node) {
+ return (node.kind === 9 || node.kind === 8) &&
+ node.parent.kind === 141 &&
+ isDeclaration(node.parent.parent);
+ }
+ ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
+ function isIdentifierName(node) {
+ var parent = node.parent;
+ switch (parent.kind) {
+ case 146:
+ case 145:
+ case 148:
+ case 147:
+ case 150:
+ case 151:
+ case 255:
+ case 253:
+ case 173:
+ return parent.name === node;
+ case 140:
+ if (parent.right === node) {
+ while (parent.kind === 140) {
+ parent = parent.parent;
+ }
+ return parent.kind === 159;
+ }
+ return false;
+ case 170:
+ case 235:
+ return parent.propertyName === node;
+ case 239:
+ return true;
}
+ return false;
}
- function convertJsonOptionOfListType(option, values, basePath, errors) {
- return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; });
+ ts.isIdentifierName = isIdentifierName;
+ function isAliasSymbolDeclaration(node) {
+ return node.kind === 230 ||
+ node.kind === 229 ||
+ node.kind === 232 && !!node.name ||
+ node.kind === 233 ||
+ node.kind === 235 ||
+ node.kind === 239 ||
+ node.kind === 236 && exportAssignmentIsAlias(node);
}
- function trimString(s) {
- return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, "");
+ ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
+ function exportAssignmentIsAlias(node) {
+ return isEntityNameExpression(node.expression);
}
- var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
- var invalidMultipleRecursionPatterns = /(^|\/)\*\*\/(.*\/)?\*\*($|\/)/;
- var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/;
- var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//;
- var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
- function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) {
- basePath = ts.normalizePath(basePath);
- var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;
- var literalFileMap = ts.createMap();
- var wildcardFileMap = ts.createMap();
- if (include) {
- include = validateSpecs(include, errors, false);
- }
- if (exclude) {
- exclude = validateSpecs(exclude, errors, true);
- }
- var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames);
- var supportedExtensions = ts.getSupportedExtensions(options);
- if (fileNames) {
- for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {
- var fileName = fileNames_1[_i];
- var file = ts.combinePaths(basePath, fileName);
- literalFileMap[keyMapper(file)] = file;
- }
- }
- if (include && include.length > 0) {
- for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensions, exclude, include); _a < _b.length; _a++) {
- var file = _b[_a];
- if (hasFileWithHigherPriorityExtension(file, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) {
- continue;
- }
- removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper);
- var key = keyMapper(file);
- if (!(key in literalFileMap) && !(key in wildcardFileMap)) {
- wildcardFileMap[key] = file;
+ ts.exportAssignmentIsAlias = exportAssignmentIsAlias;
+ function getClassExtendsHeritageClauseElement(node) {
+ var heritageClause = getHeritageClause(node.heritageClauses, 84);
+ return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
+ }
+ ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement;
+ function getClassImplementsHeritageClauseElements(node) {
+ var heritageClause = getHeritageClause(node.heritageClauses, 107);
+ return heritageClause ? heritageClause.types : undefined;
+ }
+ ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;
+ function getInterfaceBaseTypeNodes(node) {
+ var heritageClause = getHeritageClause(node.heritageClauses, 84);
+ return heritageClause ? heritageClause.types : undefined;
+ }
+ ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;
+ function getHeritageClause(clauses, kind) {
+ if (clauses) {
+ for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) {
+ var clause = clauses_1[_i];
+ if (clause.token === kind) {
+ return clause;
}
}
}
- var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []);
- var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []);
- wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive);
- return {
- fileNames: literalFiles.concat(wildcardFiles),
- wildcardDirectories: wildcardDirectories
- };
+ return undefined;
}
- function validateSpecs(specs, errors, allowTrailingRecursion) {
- var validSpecs = [];
- for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) {
- var spec = specs_2[_i];
- if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec));
- }
- else if (invalidMultipleRecursionPatterns.test(spec)) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0, spec));
+ ts.getHeritageClause = getHeritageClause;
+ function tryResolveScriptReference(host, sourceFile, reference) {
+ if (!host.getCompilerOptions().noResolve) {
+ var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName);
+ return host.getSourceFile(referenceFileName);
+ }
+ }
+ ts.tryResolveScriptReference = tryResolveScriptReference;
+ function getAncestor(node, kind) {
+ while (node) {
+ if (node.kind === kind) {
+ return node;
}
- else if (invalidDotDotAfterRecursiveWildcardPattern.test(spec)) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec));
+ node = node.parent;
+ }
+ return undefined;
+ }
+ ts.getAncestor = getAncestor;
+ function getFileReferenceFromReferencePath(comment, commentRange) {
+ var simpleReferenceRegEx = /^\/\/\/\s*/gim;
+ if (simpleReferenceRegEx.test(comment)) {
+ if (isNoDefaultLibRegEx.test(comment)) {
+ return {
+ isNoDefaultLib: true
+ };
}
else {
- validSpecs.push(spec);
+ var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment);
+ var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment);
+ if (refMatchResult || refLibResult) {
+ var start = commentRange.pos;
+ var end = commentRange.end;
+ return {
+ fileReference: {
+ pos: start,
+ end: end,
+ fileName: (refMatchResult || refLibResult)[3]
+ },
+ isNoDefaultLib: false,
+ isTypeReferenceDirective: !!refLibResult
+ };
+ }
+ return {
+ diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax,
+ isNoDefaultLib: false
+ };
}
}
- return validSpecs;
+ return undefined;
}
- function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) {
- var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude");
- var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i");
- var wildcardDirectories = ts.createMap();
- if (include !== undefined) {
- var recursiveKeys = [];
- for (var _i = 0, include_1 = include; _i < include_1.length; _i++) {
- var file = include_1[_i];
- var name_6 = ts.normalizePath(ts.combinePaths(path, file));
- if (excludeRegex && excludeRegex.test(name_6)) {
- continue;
- }
- var match = wildcardDirectoryPattern.exec(name_6);
- if (match) {
- var key = useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase();
- var flags = watchRecursivePattern.test(name_6) ? 1 : 0;
- var existingFlags = wildcardDirectories[key];
- if (existingFlags === undefined || existingFlags < flags) {
- wildcardDirectories[key] = flags;
- if (flags === 1) {
- recursiveKeys.push(key);
- }
- }
- }
+ ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath;
+ function isKeyword(token) {
+ return 71 <= token && token <= 139;
+ }
+ ts.isKeyword = isKeyword;
+ function isTrivia(token) {
+ return 2 <= token && token <= 7;
+ }
+ ts.isTrivia = isTrivia;
+ function isAsyncFunctionLike(node) {
+ return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node);
+ }
+ ts.isAsyncFunctionLike = isAsyncFunctionLike;
+ function isStringOrNumericLiteral(kind) {
+ return kind === 9 || kind === 8;
+ }
+ ts.isStringOrNumericLiteral = isStringOrNumericLiteral;
+ function hasDynamicName(declaration) {
+ return declaration.name && isDynamicName(declaration.name);
+ }
+ ts.hasDynamicName = hasDynamicName;
+ function isDynamicName(name) {
+ return name.kind === 141 &&
+ !isStringOrNumericLiteral(name.expression.kind) &&
+ !isWellKnownSymbolSyntactically(name.expression);
+ }
+ ts.isDynamicName = isDynamicName;
+ function isWellKnownSymbolSyntactically(node) {
+ return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression);
+ }
+ ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;
+ function getPropertyNameForPropertyNameNode(name) {
+ if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 143) {
+ return name.text;
+ }
+ if (name.kind === 141) {
+ var nameExpression = name.expression;
+ if (isWellKnownSymbolSyntactically(nameExpression)) {
+ var rightHandSideName = nameExpression.name.text;
+ return getPropertyNameForKnownSymbolName(rightHandSideName);
}
- for (var key in wildcardDirectories) {
- for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) {
- var recursiveKey = recursiveKeys_1[_a];
- if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) {
- delete wildcardDirectories[key];
- }
- }
+ else if (nameExpression.kind === 9 || nameExpression.kind === 8) {
+ return nameExpression.text;
}
}
- return wildcardDirectories;
+ return undefined;
}
- function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {
- var extensionPriority = ts.getExtensionPriority(file, extensions);
- var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority);
- for (var i = 0; i < adjustedExtensionPriority; i++) {
- var higherPriorityExtension = extensions[i];
- var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension));
- if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) {
+ ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;
+ function getPropertyNameForKnownSymbolName(symbolName) {
+ return "__@" + symbolName;
+ }
+ ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName;
+ function isESSymbolIdentifier(node) {
+ return node.kind === 70 && node.text === "Symbol";
+ }
+ ts.isESSymbolIdentifier = isESSymbolIdentifier;
+ function isPushOrUnshiftIdentifier(node) {
+ return node.text === "push" || node.text === "unshift";
+ }
+ ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;
+ function isModifierKind(token) {
+ switch (token) {
+ case 116:
+ case 119:
+ case 75:
+ case 123:
+ case 78:
+ case 83:
+ case 113:
+ case 111:
+ case 112:
+ case 129:
+ case 114:
return true;
- }
}
return false;
}
- function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) {
- var extensionPriority = ts.getExtensionPriority(file, extensions);
- var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority);
- for (var i = nextExtensionPriority; i < extensions.length; i++) {
- var lowerPriorityExtension = extensions[i];
- var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension));
- delete wildcardFiles[lowerPriorityPath];
- }
+ ts.isModifierKind = isModifierKind;
+ function isParameterDeclaration(node) {
+ var root = getRootDeclaration(node);
+ return root.kind === 143;
}
- function addFileToOutput(output, file) {
- output.push(file);
- return output;
+ ts.isParameterDeclaration = isParameterDeclaration;
+ function getRootDeclaration(node) {
+ while (node.kind === 170) {
+ node = node.parent.parent;
+ }
+ return node;
}
- function caseSensitiveKeyMapper(key) {
- return key;
+ ts.getRootDeclaration = getRootDeclaration;
+ function nodeStartsNewLexicalEnvironment(node) {
+ var kind = node.kind;
+ return kind === 149
+ || kind === 180
+ || kind === 221
+ || kind === 181
+ || kind === 148
+ || kind === 150
+ || kind === 151
+ || kind === 226
+ || kind === 256;
}
- function caseInsensitiveKeyMapper(key) {
- return key.toLowerCase();
+ ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
+ function nodeIsSynthesized(node) {
+ return ts.positionIsSynthesized(node.pos)
+ || ts.positionIsSynthesized(node.end);
}
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var JsTyping;
- (function (JsTyping) {
- ;
- ;
- var safeList;
- var EmptySafeList = ts.createMap();
- function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, compilerOptions) {
- var inferredTypings = ts.createMap();
- if (!typingOptions || !typingOptions.enableAutoDiscovery) {
- return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
- }
- fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) {
- var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f));
- return kind === 1 || kind === 2;
- });
- if (!safeList) {
- var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); });
- safeList = result.config ? ts.createMap(result.config) : EmptySafeList;
- }
- var filesToWatch = [];
- var searchDirs = [];
- var exclude = [];
- mergeTypings(typingOptions.include);
- exclude = typingOptions.exclude || [];
- var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
- if (projectRootPath !== undefined) {
- possibleSearchDirs.push(projectRootPath);
- }
- searchDirs = ts.deduplicate(possibleSearchDirs);
- for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) {
- var searchDir = searchDirs_1[_i];
- var packageJsonPath = ts.combinePaths(searchDir, "package.json");
- getTypingNamesFromJson(packageJsonPath, filesToWatch);
- var bowerJsonPath = ts.combinePaths(searchDir, "bower.json");
- getTypingNamesFromJson(bowerJsonPath, filesToWatch);
- var nodeModulesPath = ts.combinePaths(searchDir, "node_modules");
- getTypingNamesFromNodeModuleFolder(nodeModulesPath);
- }
- getTypingNamesFromSourceFileNames(fileNames);
- for (var name_7 in packageNameToTypingLocation) {
- if (name_7 in inferredTypings && !inferredTypings[name_7]) {
- inferredTypings[name_7] = packageNameToTypingLocation[name_7];
- }
- }
- for (var _a = 0, exclude_1 = exclude; _a < exclude_1.length; _a++) {
- var excludeTypingName = exclude_1[_a];
- delete inferredTypings[excludeTypingName];
+ ts.nodeIsSynthesized = nodeIsSynthesized;
+ function getOriginalNode(node) {
+ if (node) {
+ while (node.original !== undefined) {
+ node = node.original;
}
- var newTypingNames = [];
- var cachedTypingPaths = [];
- for (var typing in inferredTypings) {
- if (inferredTypings[typing] !== undefined) {
- cachedTypingPaths.push(inferredTypings[typing]);
- }
- else {
- newTypingNames.push(typing);
- }
+ }
+ return node;
+ }
+ ts.getOriginalNode = getOriginalNode;
+ function isParseTreeNode(node) {
+ return (node.flags & 8) === 0;
+ }
+ ts.isParseTreeNode = isParseTreeNode;
+ function getParseTreeNode(node, nodeTest) {
+ if (isParseTreeNode(node)) {
+ return node;
+ }
+ node = getOriginalNode(node);
+ if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) {
+ return node;
+ }
+ return undefined;
+ }
+ ts.getParseTreeNode = getParseTreeNode;
+ function getOriginalSourceFiles(sourceFiles) {
+ var originalSourceFiles = [];
+ for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
+ var sourceFile = sourceFiles_1[_i];
+ var originalSourceFile = getParseTreeNode(sourceFile, isSourceFile);
+ if (originalSourceFile) {
+ originalSourceFiles.push(originalSourceFile);
}
- return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch };
- function mergeTypings(typingNames) {
- if (!typingNames) {
- return;
- }
- for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) {
- var typing = typingNames_1[_i];
- if (!(typing in inferredTypings)) {
- inferredTypings[typing] = undefined;
- }
+ }
+ return originalSourceFiles;
+ }
+ ts.getOriginalSourceFiles = getOriginalSourceFiles;
+ function getOriginalNodeId(node) {
+ node = getOriginalNode(node);
+ return node ? ts.getNodeId(node) : 0;
+ }
+ ts.getOriginalNodeId = getOriginalNodeId;
+ (function (Associativity) {
+ Associativity[Associativity["Left"] = 0] = "Left";
+ Associativity[Associativity["Right"] = 1] = "Right";
+ })(ts.Associativity || (ts.Associativity = {}));
+ var Associativity = ts.Associativity;
+ function getExpressionAssociativity(expression) {
+ var operator = getOperator(expression);
+ var hasArguments = expression.kind === 176 && expression.arguments !== undefined;
+ return getOperatorAssociativity(expression.kind, operator, hasArguments);
+ }
+ ts.getExpressionAssociativity = getExpressionAssociativity;
+ function getOperatorAssociativity(kind, operator, hasArguments) {
+ switch (kind) {
+ case 176:
+ return hasArguments ? 0 : 1;
+ case 186:
+ case 183:
+ case 184:
+ case 182:
+ case 185:
+ case 189:
+ case 191:
+ return 1;
+ case 188:
+ switch (operator) {
+ case 39:
+ case 57:
+ case 58:
+ case 59:
+ case 61:
+ case 60:
+ case 62:
+ case 63:
+ case 64:
+ case 65:
+ case 66:
+ case 67:
+ case 69:
+ case 68:
+ return 1;
}
- }
- function getTypingNamesFromJson(jsonPath, filesToWatch) {
- var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); });
- if (result.config) {
- var jsonConfig = result.config;
- filesToWatch.push(jsonPath);
- if (jsonConfig.dependencies) {
- mergeTypings(ts.getOwnKeys(jsonConfig.dependencies));
- }
- if (jsonConfig.devDependencies) {
- mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies));
- }
- if (jsonConfig.optionalDependencies) {
- mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies));
- }
- if (jsonConfig.peerDependencies) {
- mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies));
- }
+ }
+ return 0;
+ }
+ ts.getOperatorAssociativity = getOperatorAssociativity;
+ function getExpressionPrecedence(expression) {
+ var operator = getOperator(expression);
+ var hasArguments = expression.kind === 176 && expression.arguments !== undefined;
+ return getOperatorPrecedence(expression.kind, operator, hasArguments);
+ }
+ ts.getExpressionPrecedence = getExpressionPrecedence;
+ function getOperator(expression) {
+ if (expression.kind === 188) {
+ return expression.operatorToken.kind;
+ }
+ else if (expression.kind === 186 || expression.kind === 187) {
+ return expression.operator;
+ }
+ else {
+ return expression.kind;
+ }
+ }
+ ts.getOperator = getOperator;
+ function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
+ switch (nodeKind) {
+ case 98:
+ case 96:
+ case 70:
+ case 94:
+ case 100:
+ case 85:
+ case 8:
+ case 9:
+ case 171:
+ case 172:
+ case 180:
+ case 181:
+ case 193:
+ case 242:
+ case 243:
+ case 11:
+ case 12:
+ case 190:
+ case 179:
+ case 194:
+ return 19;
+ case 177:
+ case 173:
+ case 174:
+ return 18;
+ case 176:
+ return hasArguments ? 18 : 17;
+ case 175:
+ return 17;
+ case 187:
+ return 16;
+ case 186:
+ case 183:
+ case 184:
+ case 182:
+ case 185:
+ return 15;
+ case 188:
+ switch (operatorKind) {
+ case 50:
+ case 51:
+ return 15;
+ case 39:
+ case 38:
+ case 40:
+ case 41:
+ return 14;
+ case 36:
+ case 37:
+ return 13;
+ case 44:
+ case 45:
+ case 46:
+ return 12;
+ case 26:
+ case 29:
+ case 28:
+ case 30:
+ case 91:
+ case 92:
+ return 11;
+ case 31:
+ case 33:
+ case 32:
+ case 34:
+ return 10;
+ case 47:
+ return 9;
+ case 49:
+ return 8;
+ case 48:
+ return 7;
+ case 52:
+ return 6;
+ case 53:
+ return 5;
+ case 57:
+ case 58:
+ case 59:
+ case 61:
+ case 60:
+ case 62:
+ case 63:
+ case 64:
+ case 65:
+ case 66:
+ case 67:
+ case 69:
+ case 68:
+ return 3;
+ case 25:
+ return 0;
+ default:
+ return -1;
}
+ case 189:
+ return 4;
+ case 191:
+ return 2;
+ case 192:
+ return 1;
+ default:
+ return -1;
+ }
+ }
+ ts.getOperatorPrecedence = getOperatorPrecedence;
+ function createDiagnosticCollection() {
+ var nonFileDiagnostics = [];
+ var fileDiagnostics = ts.createMap();
+ var diagnosticsModified = false;
+ var modificationCount = 0;
+ return {
+ add: add,
+ getGlobalDiagnostics: getGlobalDiagnostics,
+ getDiagnostics: getDiagnostics,
+ getModificationCount: getModificationCount,
+ reattachFileDiagnostics: reattachFileDiagnostics
+ };
+ function getModificationCount() {
+ return modificationCount;
+ }
+ function reattachFileDiagnostics(newFile) {
+ if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) {
+ return;
}
- function getTypingNamesFromSourceFileNames(fileNames) {
- var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension);
- var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); });
- var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); });
- if (safeList !== EmptySafeList) {
- mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; }));
- }
- var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; });
- if (hasJsxFile) {
- mergeTypings(["react"]);
- }
+ for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) {
+ var diagnostic = _a[_i];
+ diagnostic.file = newFile;
}
- function getTypingNamesFromNodeModuleFolder(nodeModulesPath) {
- if (!host.directoryExists(nodeModulesPath)) {
- return;
- }
- var typingNames = [];
- var fileNames = host.readDirectory(nodeModulesPath, [".json"], undefined, undefined, 2);
- for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) {
- var fileName = fileNames_2[_i];
- var normalizedFileName = ts.normalizePath(fileName);
- if (ts.getBaseFileName(normalizedFileName) !== "package.json") {
- continue;
- }
- var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); });
- if (!result.config) {
- continue;
- }
- var packageJson = result.config;
- if (packageJson._requiredBy &&
- ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) {
- continue;
- }
- if (!packageJson.name) {
- continue;
- }
- if (packageJson.typings) {
- var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName));
- inferredTypings[packageJson.name] = absolutePath;
- }
- else {
- typingNames.push(packageJson.name);
- }
+ }
+ function add(diagnostic) {
+ var diagnostics;
+ if (diagnostic.file) {
+ diagnostics = fileDiagnostics[diagnostic.file.fileName];
+ if (!diagnostics) {
+ diagnostics = [];
+ fileDiagnostics[diagnostic.file.fileName] = diagnostics;
}
- mergeTypings(typingNames);
}
- }
- JsTyping.discoverTypings = discoverTypings;
- })(JsTyping = ts.JsTyping || (ts.JsTyping = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var server;
- (function (server) {
- (function (LogLevel) {
- LogLevel[LogLevel["terse"] = 0] = "terse";
- LogLevel[LogLevel["normal"] = 1] = "normal";
- LogLevel[LogLevel["requestTime"] = 2] = "requestTime";
- LogLevel[LogLevel["verbose"] = 3] = "verbose";
- })(server.LogLevel || (server.LogLevel = {}));
- var LogLevel = server.LogLevel;
- server.emptyArray = [];
- var Msg;
- (function (Msg) {
- Msg.Err = "Err";
- Msg.Info = "Info";
- Msg.Perf = "Perf";
- })(Msg = server.Msg || (server.Msg = {}));
- function getProjectRootPath(project) {
- switch (project.projectKind) {
- case server.ProjectKind.Configured:
- return ts.getDirectoryPath(project.getProjectName());
- case server.ProjectKind.Inferred:
- return "";
- case server.ProjectKind.External:
- var projectName = ts.normalizeSlashes(project.getProjectName());
- return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName;
+ else {
+ diagnostics = nonFileDiagnostics;
}
+ diagnostics.push(diagnostic);
+ diagnosticsModified = true;
+ modificationCount++;
}
- function createInstallTypingsRequest(project, typingOptions, cachePath) {
- return {
- projectName: project.getProjectName(),
- fileNames: project.getFileNames(),
- compilerOptions: project.getCompilerOptions(),
- typingOptions: typingOptions,
- projectRootPath: getProjectRootPath(project),
- cachePath: cachePath,
- kind: "discover"
- };
+ function getGlobalDiagnostics() {
+ sortAndDeduplicate();
+ return nonFileDiagnostics;
}
- server.createInstallTypingsRequest = createInstallTypingsRequest;
- var Errors;
- (function (Errors) {
- function ThrowNoProject() {
- throw new Error("No Project.");
- }
- Errors.ThrowNoProject = ThrowNoProject;
- function ThrowProjectLanguageServiceDisabled() {
- throw new Error("The project's language service is disabled.");
+ function getDiagnostics(fileName) {
+ sortAndDeduplicate();
+ if (fileName) {
+ return fileDiagnostics[fileName] || [];
}
- Errors.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled;
- function ThrowProjectDoesNotContainDocument(fileName, project) {
- throw new Error("Project '" + project.getProjectName() + "' does not contain document '" + fileName + "'");
+ var allDiagnostics = [];
+ function pushDiagnostic(d) {
+ allDiagnostics.push(d);
}
- Errors.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument;
- })(Errors = server.Errors || (server.Errors = {}));
- function getDefaultFormatCodeSettings(host) {
- return {
- indentSize: 4,
- tabSize: 4,
- newLineCharacter: host.newLine || "\n",
- convertTabsToSpaces: true,
- indentStyle: ts.IndentStyle.Smart,
- insertSpaceAfterCommaDelimiter: true,
- insertSpaceAfterSemicolonInForStatements: true,
- insertSpaceBeforeAndAfterBinaryOperators: true,
- insertSpaceAfterKeywordsInControlFlowStatements: true,
- insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
- insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
- insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
- insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
- insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,
- placeOpenBraceOnNewLineForFunctions: false,
- placeOpenBraceOnNewLineForControlBlocks: false
- };
- }
- server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings;
- function mergeMaps(target, source) {
- for (var key in source) {
- if (ts.hasProperty(source, key)) {
- target[key] = source[key];
- }
+ ts.forEach(nonFileDiagnostics, pushDiagnostic);
+ for (var key in fileDiagnostics) {
+ ts.forEach(fileDiagnostics[key], pushDiagnostic);
}
+ return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
}
- server.mergeMaps = mergeMaps;
- function removeItemFromSet(items, itemToRemove) {
- if (items.length === 0) {
- return;
- }
- var index = items.indexOf(itemToRemove);
- if (index < 0) {
+ function sortAndDeduplicate() {
+ if (!diagnosticsModified) {
return;
}
- if (index === items.length - 1) {
- items.pop();
- }
- else {
- items[index] = items.pop();
+ diagnosticsModified = false;
+ nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics);
+ for (var key in fileDiagnostics) {
+ fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]);
}
}
- server.removeItemFromSet = removeItemFromSet;
- function toNormalizedPath(fileName) {
- return ts.normalizePath(fileName);
- }
- server.toNormalizedPath = toNormalizedPath;
- function normalizedPathToPath(normalizedPath, currentDirectory, getCanonicalFileName) {
- var f = ts.isRootedDiskPath(normalizedPath) ? normalizedPath : ts.getNormalizedAbsolutePath(normalizedPath, currentDirectory);
- return getCanonicalFileName(f);
+ }
+ ts.createDiagnosticCollection = createDiagnosticCollection;
+ var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
+ var escapedCharsMap = ts.createMap({
+ "\0": "\\0",
+ "\t": "\\t",
+ "\v": "\\v",
+ "\f": "\\f",
+ "\b": "\\b",
+ "\r": "\\r",
+ "\n": "\\n",
+ "\\": "\\\\",
+ "\"": "\\\"",
+ "\u2028": "\\u2028",
+ "\u2029": "\\u2029",
+ "\u0085": "\\u0085"
+ });
+ function escapeString(s) {
+ s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s;
+ return s;
+ function getReplacement(c) {
+ return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0));
}
- server.normalizedPathToPath = normalizedPathToPath;
- function asNormalizedPath(fileName) {
- return fileName;
- }
- server.asNormalizedPath = asNormalizedPath;
- function createNormalizedPathMap() {
- var map = Object.create(null);
- return {
- get: function (path) {
- return map[path];
- },
- set: function (path, value) {
- map[path] = value;
- },
- contains: function (path) {
- return ts.hasProperty(map, path);
- },
- remove: function (path) {
- delete map[path];
- }
- };
- }
- server.createNormalizedPathMap = createNormalizedPathMap;
- function throwLanguageServiceIsDisabledError() {
- throw new Error("LanguageService is disabled");
- }
- server.nullLanguageService = {
- cleanupSemanticCache: throwLanguageServiceIsDisabledError,
- getSyntacticDiagnostics: throwLanguageServiceIsDisabledError,
- getSemanticDiagnostics: throwLanguageServiceIsDisabledError,
- getCompilerOptionsDiagnostics: throwLanguageServiceIsDisabledError,
- getSyntacticClassifications: throwLanguageServiceIsDisabledError,
- getEncodedSyntacticClassifications: throwLanguageServiceIsDisabledError,
- getSemanticClassifications: throwLanguageServiceIsDisabledError,
- getEncodedSemanticClassifications: throwLanguageServiceIsDisabledError,
- getCompletionsAtPosition: throwLanguageServiceIsDisabledError,
- findReferences: throwLanguageServiceIsDisabledError,
- getCompletionEntryDetails: throwLanguageServiceIsDisabledError,
- getQuickInfoAtPosition: throwLanguageServiceIsDisabledError,
- findRenameLocations: throwLanguageServiceIsDisabledError,
- getNameOrDottedNameSpan: throwLanguageServiceIsDisabledError,
- getBreakpointStatementAtPosition: throwLanguageServiceIsDisabledError,
- getBraceMatchingAtPosition: throwLanguageServiceIsDisabledError,
- getSignatureHelpItems: throwLanguageServiceIsDisabledError,
- getDefinitionAtPosition: throwLanguageServiceIsDisabledError,
- getRenameInfo: throwLanguageServiceIsDisabledError,
- getTypeDefinitionAtPosition: throwLanguageServiceIsDisabledError,
- getReferencesAtPosition: throwLanguageServiceIsDisabledError,
- getDocumentHighlights: throwLanguageServiceIsDisabledError,
- getOccurrencesAtPosition: throwLanguageServiceIsDisabledError,
- getNavigateToItems: throwLanguageServiceIsDisabledError,
- getNavigationBarItems: throwLanguageServiceIsDisabledError,
- getNavigationTree: throwLanguageServiceIsDisabledError,
- getOutliningSpans: throwLanguageServiceIsDisabledError,
- getTodoComments: throwLanguageServiceIsDisabledError,
- getIndentationAtPosition: throwLanguageServiceIsDisabledError,
- getFormattingEditsForRange: throwLanguageServiceIsDisabledError,
- getFormattingEditsForDocument: throwLanguageServiceIsDisabledError,
- getFormattingEditsAfterKeystroke: throwLanguageServiceIsDisabledError,
- getDocCommentTemplateAtPosition: throwLanguageServiceIsDisabledError,
- isValidBraceCompletionAtPosition: throwLanguageServiceIsDisabledError,
- getEmitOutput: throwLanguageServiceIsDisabledError,
- getProgram: throwLanguageServiceIsDisabledError,
- getNonBoundSourceFile: throwLanguageServiceIsDisabledError,
- dispose: throwLanguageServiceIsDisabledError,
- getCompletionEntrySymbol: throwLanguageServiceIsDisabledError,
- getImplementationAtPosition: throwLanguageServiceIsDisabledError,
- getSourceFile: throwLanguageServiceIsDisabledError,
- getCodeFixesAtPosition: throwLanguageServiceIsDisabledError
- };
- server.nullLanguageServiceHost = {
- setCompilationSettings: function () { return undefined; },
- notifyFileRemoved: function () { return undefined; }
- };
- function isInferredProjectName(name) {
- return /dev\/null\/inferredProject\d+\*/.test(name);
- }
- server.isInferredProjectName = isInferredProjectName;
- function makeInferredProjectName(counter) {
- return "/dev/null/inferredProject" + counter + "*";
- }
- server.makeInferredProjectName = makeInferredProjectName;
- var ThrottledOperations = (function () {
- function ThrottledOperations(host) {
- this.host = host;
- this.pendingTimeouts = ts.createMap();
- }
- ThrottledOperations.prototype.schedule = function (operationId, delay, cb) {
- if (ts.hasProperty(this.pendingTimeouts, operationId)) {
- this.host.clearTimeout(this.pendingTimeouts[operationId]);
- }
- this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb);
- };
- ThrottledOperations.run = function (self, operationId, cb) {
- delete self.pendingTimeouts[operationId];
- cb();
- };
- return ThrottledOperations;
- }());
- server.ThrottledOperations = ThrottledOperations;
- var GcTimer = (function () {
- function GcTimer(host, delay, logger) {
- this.host = host;
- this.delay = delay;
- this.logger = logger;
- }
- GcTimer.prototype.scheduleCollect = function () {
- if (!this.host.gc || this.timerId != undefined) {
- return;
- }
- this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this);
- };
- GcTimer.run = function (self) {
- self.timerId = undefined;
- var log = self.logger.hasLevel(LogLevel.requestTime);
- var before = log && self.host.getMemoryUsage();
- self.host.gc();
- if (log) {
- var after = self.host.getMemoryUsage();
- self.logger.perftrc("GC::before " + before + ", after " + after);
- }
- };
- return GcTimer;
- }());
- server.GcTimer = GcTimer;
- })(server = ts.server || (ts.server = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function trace(host, message) {
- host.trace(ts.formatMessage.apply(undefined, arguments));
}
- ts.trace = trace;
- function isTraceEnabled(compilerOptions, host) {
- return compilerOptions.traceResolution && host.trace !== undefined;
+ ts.escapeString = escapeString;
+ function isIntrinsicJsxName(name) {
+ var ch = name.substr(0, 1);
+ return ch.toLowerCase() === ch;
}
- ts.isTraceEnabled = isTraceEnabled;
- function createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations) {
- return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
+ ts.isIntrinsicJsxName = isIntrinsicJsxName;
+ function get16BitUnicodeEscapeSequence(charCode) {
+ var hexCharCode = charCode.toString(16).toUpperCase();
+ var paddedHexCode = ("0000" + hexCharCode).slice(-4);
+ return "\\u" + paddedHexCode;
}
- ts.createResolvedModule = createResolvedModule;
- function moduleHasNonRelativeName(moduleName) {
- return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
+ var nonAsciiCharacters = /[^\u0000-\u007F]/g;
+ function escapeNonAsciiCharacters(s) {
+ return nonAsciiCharacters.test(s) ?
+ s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) :
+ s;
}
- function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
- var jsonContent = readJson(packageJsonPath, state.host);
- function tryReadFromField(fieldName) {
- if (ts.hasProperty(jsonContent, fieldName)) {
- var typesFile = jsonContent[fieldName];
- if (typeof typesFile === "string") {
- var typesFilePath_1 = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile));
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath_1);
- }
- return typesFilePath_1;
- }
- else {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile);
- }
+ ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters;
+ var indentStrings = ["", " "];
+ function getIndentString(level) {
+ if (indentStrings[level] === undefined) {
+ indentStrings[level] = getIndentString(level - 1) + indentStrings[1];
+ }
+ return indentStrings[level];
+ }
+ ts.getIndentString = getIndentString;
+ function getIndentSize() {
+ return indentStrings[1].length;
+ }
+ ts.getIndentSize = getIndentSize;
+ function createTextWriter(newLine) {
+ var output;
+ var indent;
+ var lineStart;
+ var lineCount;
+ var linePos;
+ function write(s) {
+ if (s && s.length) {
+ if (lineStart) {
+ output += getIndentString(indent);
+ lineStart = false;
}
+ output += s;
}
}
- var typesFilePath = tryReadFromField("typings") || tryReadFromField("types");
- if (typesFilePath) {
- return typesFilePath;
+ function reset() {
+ output = "";
+ indent = 0;
+ lineStart = true;
+ lineCount = 0;
+ linePos = 0;
}
- if (state.compilerOptions.allowJs && jsonContent.main && typeof jsonContent.main === "string") {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0, jsonContent.main);
+ function rawWrite(s) {
+ if (s !== undefined) {
+ if (lineStart) {
+ lineStart = false;
+ }
+ output += s;
}
- var mainFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
- return mainFilePath;
}
- return undefined;
- }
- function readJson(path, host) {
- try {
- var jsonText = host.readFile(path);
- return jsonText ? JSON.parse(jsonText) : {};
+ function writeLiteral(s) {
+ if (s && s.length) {
+ write(s);
+ var lineStartsOfS = ts.computeLineStarts(s);
+ if (lineStartsOfS.length > 1) {
+ lineCount = lineCount + lineStartsOfS.length - 1;
+ linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS);
+ }
+ }
}
- catch (e) {
- return {};
+ function writeLine() {
+ if (!lineStart) {
+ output += newLine;
+ lineCount++;
+ linePos = output.length;
+ lineStart = true;
+ }
+ }
+ function writeTextOfNode(text, node) {
+ write(getTextOfNodeFromSourceText(text, node));
}
+ reset();
+ return {
+ write: write,
+ rawWrite: rawWrite,
+ writeTextOfNode: writeTextOfNode,
+ writeLiteral: writeLiteral,
+ writeLine: writeLine,
+ increaseIndent: function () { indent++; },
+ decreaseIndent: function () { 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; },
+ isAtStartOfLine: function () { return lineStart; },
+ reset: reset
+ };
}
- var typeReferenceExtensions = [".d.ts"];
- function getEffectiveTypeRoots(options, host) {
- if (options.typeRoots) {
- return options.typeRoots;
+ ts.createTextWriter = createTextWriter;
+ function getResolvedExternalModuleName(host, file) {
+ return file.moduleName || getExternalModuleNameFromPath(host, file.fileName);
+ }
+ ts.getResolvedExternalModuleName = getResolvedExternalModuleName;
+ function getExternalModuleNameFromDeclaration(host, resolver, declaration) {
+ var file = resolver.getExternalModuleFileFromDeclaration(declaration);
+ if (!file || isDeclarationFile(file)) {
+ return undefined;
}
- var currentDirectory;
- if (options.configFilePath) {
- currentDirectory = ts.getDirectoryPath(options.configFilePath);
+ return getResolvedExternalModuleName(host, file);
+ }
+ ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration;
+ function getExternalModuleNameFromPath(host, fileName) {
+ var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); };
+ var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName);
+ var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
+ var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, false);
+ return ts.removeFileExtension(relativePath);
+ }
+ ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath;
+ function getOwnEmitOutputFilePath(sourceFile, host, extension) {
+ var compilerOptions = host.getCompilerOptions();
+ var emitOutputFilePathWithoutExtension;
+ if (compilerOptions.outDir) {
+ emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir));
}
- else if (host.getCurrentDirectory) {
- currentDirectory = host.getCurrentDirectory();
+ else {
+ emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName);
}
- return currentDirectory !== undefined && getDefaultTypeRoots(currentDirectory, host);
+ return emitOutputFilePathWithoutExtension + extension;
}
- ts.getEffectiveTypeRoots = getEffectiveTypeRoots;
- function getDefaultTypeRoots(currentDirectory, host) {
- if (!host.directoryExists) {
- return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];
+ ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath;
+ function getDeclarationEmitOutputFilePath(sourceFile, host) {
+ var options = host.getCompilerOptions();
+ var outputDir = options.declarationDir || options.outDir;
+ var path = outputDir
+ ? getSourceFilePathInNewDir(sourceFile, host, outputDir)
+ : sourceFile.fileName;
+ return ts.removeFileExtension(path) + ".d.ts";
+ }
+ ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath;
+ function getSourceFilesToEmit(host, targetSourceFile) {
+ var options = host.getCompilerOptions();
+ if (options.outFile || options.out) {
+ var moduleKind = ts.getEmitModuleKind(options);
+ var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System;
+ var sourceFiles = host.getSourceFiles();
+ return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule);
}
- var typeRoots;
- while (true) {
- var atTypes = ts.combinePaths(currentDirectory, nodeModulesAtTypes);
- if (host.directoryExists(atTypes)) {
- (typeRoots || (typeRoots = [])).push(atTypes);
- }
- var parent_1 = ts.getDirectoryPath(currentDirectory);
- if (parent_1 === currentDirectory) {
- break;
- }
- currentDirectory = parent_1;
+ else {
+ var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile];
+ return ts.filter(sourceFiles, isNonDeclarationFile);
}
- return typeRoots;
}
- var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types");
- function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) {
- var traceEnabled = isTraceEnabled(options, host);
- var moduleResolutionState = {
- compilerOptions: options,
- host: host,
- skipTsx: true,
- traceEnabled: traceEnabled
- };
- var typeRoots = getEffectiveTypeRoots(options, host);
- if (traceEnabled) {
- if (containingFile === undefined) {
- if (typeRoots === undefined) {
- trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName);
- }
- else {
- trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots);
- }
- }
- else {
- if (typeRoots === undefined) {
- trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile);
- }
- else {
- trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots);
+ ts.getSourceFilesToEmit = getSourceFilesToEmit;
+ function isNonDeclarationFile(sourceFile) {
+ return !isDeclarationFile(sourceFile);
+ }
+ function isBundleEmitNonExternalModule(sourceFile) {
+ return !isDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile);
+ }
+ function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) {
+ var options = host.getCompilerOptions();
+ if (options.outFile || options.out) {
+ onBundledEmit(sourceFiles);
+ }
+ else {
+ for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) {
+ var sourceFile = sourceFiles_2[_i];
+ if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) {
+ onSingleFileEmit(host, sourceFile);
}
}
}
- var failedLookupLocations = [];
- if (typeRoots && typeRoots.length) {
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
- }
- var primarySearchPaths = typeRoots;
- for (var _i = 0, primarySearchPaths_1 = primarySearchPaths; _i < primarySearchPaths_1.length; _i++) {
- var typeRoot = primarySearchPaths_1[_i];
- var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName);
- var candidateDirectory = ts.getDirectoryPath(candidate);
- var resolvedFile_1 = loadNodeModuleFromDirectory(typeReferenceExtensions, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState);
- if (resolvedFile_1) {
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile_1, true);
+ function onSingleFileEmit(host, sourceFile) {
+ var extension = ".js";
+ if (options.jsx === 1) {
+ if (isSourceFileJavaScript(sourceFile)) {
+ if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) {
+ extension = ".jsx";
}
- return {
- resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolvedFile_1 },
- failedLookupLocations: failedLookupLocations
- };
+ }
+ else if (sourceFile.languageVariant === 1) {
+ extension = ".jsx";
}
}
+ var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);
+ var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);
+ var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;
+ action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], false);
}
- else {
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths);
+ function onBundledEmit(sourceFiles) {
+ if (sourceFiles.length) {
+ var jsFilePath = options.outFile || options.out;
+ var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);
+ var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined;
+ action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, true);
}
}
- var resolvedFile;
- var initialLocationForSecondaryLookup;
- if (containingFile) {
- initialLocationForSecondaryLookup = ts.getDirectoryPath(containingFile);
- }
- if (initialLocationForSecondaryLookup !== undefined) {
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
- }
- resolvedFile = loadModuleFromNodeModules(typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, false);
- if (traceEnabled) {
- if (resolvedFile) {
- trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false);
- }
- else {
- trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
- }
- }
+ }
+ ts.forEachTransformedEmitFile = forEachTransformedEmitFile;
+ function getSourceMapFilePath(jsFilePath, options) {
+ return options.sourceMap ? jsFilePath + ".map" : undefined;
+ }
+ function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) {
+ var options = host.getCompilerOptions();
+ if (options.outFile || options.out) {
+ onBundledEmit(host);
}
else {
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder);
+ var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile];
+ for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {
+ var sourceFile = sourceFiles_3[_i];
+ if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) {
+ onSingleFileEmit(host, sourceFile);
+ }
}
}
- return {
- resolvedTypeReferenceDirective: resolvedFile
- ? { primary: false, resolvedFileName: resolvedFile }
- : undefined,
- failedLookupLocations: failedLookupLocations
- };
- }
- ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
- function getAutomaticTypeDirectiveNames(options, host) {
- if (options.types) {
- return options.types;
- }
- var result = [];
- if (host.directoryExists && host.getDirectories) {
- var typeRoots = getEffectiveTypeRoots(options, host);
- if (typeRoots) {
- for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {
- var root = typeRoots_1[_i];
- if (host.directoryExists(root)) {
- for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) {
- var typeDirectivePath = _b[_a];
- var normalized = ts.normalizePath(typeDirectivePath);
- var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized));
- var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null;
- if (!isNotNeededPackage) {
- result.push(ts.getBaseFileName(normalized));
- }
- }
+ function onSingleFileEmit(host, sourceFile) {
+ var extension = ".js";
+ if (options.jsx === 1) {
+ if (isSourceFileJavaScript(sourceFile)) {
+ if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) {
+ extension = ".jsx";
}
}
+ else if (sourceFile.languageVariant === 1) {
+ extension = ".jsx";
+ }
+ }
+ var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);
+ var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;
+ var emitFileNames = {
+ jsFilePath: jsFilePath,
+ sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),
+ declarationFilePath: declarationFilePath
+ };
+ action(emitFileNames, [sourceFile], false, emitOnlyDtsFiles);
+ }
+ function onBundledEmit(host) {
+ var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { return !isDeclarationFile(sourceFile) &&
+ !host.isSourceFileFromExternalLibrary(sourceFile) &&
+ (!ts.isExternalModule(sourceFile) ||
+ !!ts.getEmitModuleKind(options)); });
+ if (bundledSources.length) {
+ var jsFilePath = options.outFile || options.out;
+ var emitFileNames = {
+ jsFilePath: jsFilePath,
+ sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),
+ declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined
+ };
+ action(emitFileNames, bundledSources, true, emitOnlyDtsFiles);
}
}
- return result;
}
- ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
- function resolveModuleName(moduleName, containingFile, compilerOptions, host) {
- var traceEnabled = isTraceEnabled(compilerOptions, host);
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile);
- }
- var moduleResolution = compilerOptions.moduleResolution;
- if (moduleResolution === undefined) {
- moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);
+ ts.forEachExpectedEmitFile = forEachExpectedEmitFile;
+ function getSourceFilePathInNewDir(sourceFile, host, newDirPath) {
+ var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory());
+ var commonSourceDirectory = host.getCommonSourceDirectory();
+ var isSourceFileInCommonSourceDirectory = host.getCanonicalFileName(sourceFilePath).indexOf(host.getCanonicalFileName(commonSourceDirectory)) === 0;
+ sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
+ return ts.combinePaths(newDirPath, sourceFilePath);
+ }
+ ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir;
+ function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) {
+ host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) {
+ diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
+ }, sourceFiles);
+ }
+ ts.writeFile = writeFile;
+ function getLineOfLocalPosition(currentSourceFile, pos) {
+ return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line;
+ }
+ ts.getLineOfLocalPosition = getLineOfLocalPosition;
+ function getLineOfLocalPositionFromLineMap(lineMap, pos) {
+ return ts.computeLineAndCharacterOfPosition(lineMap, pos).line;
+ }
+ ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap;
+ function getFirstConstructorWithBody(node) {
+ return ts.forEach(node.members, function (member) {
+ if (member.kind === 149 && nodeIsPresent(member.body)) {
+ return member;
}
+ });
+ }
+ ts.getFirstConstructorWithBody = getFirstConstructorWithBody;
+ function getSetAccessorTypeAnnotationNode(accessor) {
+ if (accessor && accessor.parameters.length > 0) {
+ var hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]);
+ return accessor.parameters[hasThis ? 1 : 0].type;
}
- else {
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);
+ }
+ ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode;
+ function getThisParameter(signature) {
+ if (signature.parameters.length) {
+ var thisParameter = signature.parameters[0];
+ if (parameterIsThisKeyword(thisParameter)) {
+ return thisParameter;
}
}
- var result;
- switch (moduleResolution) {
- case ts.ModuleResolutionKind.NodeJs:
- result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host);
- break;
- case ts.ModuleResolutionKind.Classic:
- result = classicNameResolver(moduleName, containingFile, compilerOptions, host);
- break;
- }
- if (traceEnabled) {
- if (result.resolvedModule) {
- trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);
+ }
+ ts.getThisParameter = getThisParameter;
+ function parameterIsThisKeyword(parameter) {
+ return isThisIdentifier(parameter.name);
+ }
+ ts.parameterIsThisKeyword = parameterIsThisKeyword;
+ function isThisIdentifier(node) {
+ return node && node.kind === 70 && identifierIsThisKeyword(node);
+ }
+ ts.isThisIdentifier = isThisIdentifier;
+ function identifierIsThisKeyword(id) {
+ return id.originalKeywordKind === 98;
+ }
+ ts.identifierIsThisKeyword = identifierIsThisKeyword;
+ function getAllAccessorDeclarations(declarations, accessor) {
+ var firstAccessor;
+ var secondAccessor;
+ var getAccessor;
+ var setAccessor;
+ if (hasDynamicName(accessor)) {
+ firstAccessor = accessor;
+ if (accessor.kind === 150) {
+ getAccessor = accessor;
+ }
+ else if (accessor.kind === 151) {
+ setAccessor = accessor;
}
else {
- trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);
+ ts.Debug.fail("Accessor has wrong kind");
}
}
- return result;
- }
- ts.resolveModuleName = resolveModuleName;
- function tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) {
- if (moduleHasNonRelativeName(moduleName)) {
- return tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state);
- }
else {
- return tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state);
+ ts.forEach(declarations, function (member) {
+ if ((member.kind === 150 || member.kind === 151)
+ && hasModifier(member, 32) === hasModifier(accessor, 32)) {
+ var memberName = getPropertyNameForPropertyNameNode(member.name);
+ var accessorName = getPropertyNameForPropertyNameNode(accessor.name);
+ if (memberName === accessorName) {
+ if (!firstAccessor) {
+ firstAccessor = member;
+ }
+ else if (!secondAccessor) {
+ secondAccessor = member;
+ }
+ if (member.kind === 150 && !getAccessor) {
+ getAccessor = member;
+ }
+ if (member.kind === 151 && !setAccessor) {
+ setAccessor = member;
+ }
+ }
+ }
+ });
}
+ return {
+ firstAccessor: firstAccessor,
+ secondAccessor: secondAccessor,
+ getAccessor: getAccessor,
+ setAccessor: setAccessor
+ };
}
- function tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) {
- if (!state.compilerOptions.rootDirs) {
- return undefined;
- }
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName);
+ ts.getAllAccessorDeclarations = getAllAccessorDeclarations;
+ function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) {
+ emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments);
+ }
+ ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments;
+ function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) {
+ if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos &&
+ getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) {
+ writer.writeLine();
}
- var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
- var matchedRootDir;
- var matchedNormalizedPrefix;
- for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) {
- var rootDir = _a[_i];
- var normalizedRoot = ts.normalizePath(rootDir);
- if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) {
- normalizedRoot += ts.directorySeparator;
- }
- var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) &&
- (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length);
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix);
- }
- if (isLongestMatchingPrefix) {
- matchedNormalizedPrefix = normalizedRoot;
- matchedRootDir = rootDir;
- }
+ }
+ ts.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition;
+ function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) {
+ if (pos !== commentPos &&
+ getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) {
+ writer.writeLine();
}
- if (matchedNormalizedPrefix) {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix);
- }
- var suffix = candidate.substr(matchedNormalizedPrefix.length);
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate);
- }
- var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state);
- if (resolvedFileName) {
- return resolvedFileName;
- }
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs);
+ }
+ ts.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition;
+ function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) {
+ if (comments && comments.length > 0) {
+ if (leadingSeparator) {
+ writer.write(" ");
}
- for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) {
- var rootDir = _c[_b];
- if (rootDir === matchedRootDir) {
- continue;
+ var emitInterveningSeparator = false;
+ for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) {
+ var comment = comments_1[_i];
+ if (emitInterveningSeparator) {
+ writer.write(" ");
+ emitInterveningSeparator = false;
}
- var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix);
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1);
+ writeComment(text, lineMap, writer, comment.pos, comment.end, newLine);
+ if (comment.hasTrailingNewLine) {
+ writer.writeLine();
}
- var baseDirectory = ts.getDirectoryPath(candidate_1);
- var resolvedFileName_1 = loader(candidate_1, supportedExtensions, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state);
- if (resolvedFileName_1) {
- return resolvedFileName_1;
+ else {
+ emitInterveningSeparator = true;
}
}
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed);
+ if (emitInterveningSeparator && trailingSeparator) {
+ writer.write(" ");
}
}
- return undefined;
}
- function tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state) {
- if (!state.compilerOptions.baseUrl) {
- return undefined;
- }
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName);
- }
- var matchedPattern = undefined;
- if (state.compilerOptions.paths) {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
+ ts.emitComments = emitComments;
+ function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) {
+ var leadingComments;
+ var currentDetachedCommentInfo;
+ if (removeComments) {
+ if (node.pos === 0) {
+ leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment);
}
- matchedPattern = ts.matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName);
}
- if (matchedPattern) {
- var matchedStar = typeof matchedPattern === "string" ? undefined : ts.matchedText(matchedPattern, moduleName);
- var matchedPatternText = typeof matchedPattern === "string" ? matchedPattern : ts.patternText(matchedPattern);
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText);
+ else {
+ leadingComments = ts.getLeadingCommentRanges(text, node.pos);
+ }
+ if (leadingComments) {
+ var detachedComments = [];
+ var lastComment = void 0;
+ for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) {
+ var comment = leadingComments_1[_i];
+ if (lastComment) {
+ var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end);
+ var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos);
+ if (commentLine >= lastCommentLine + 2) {
+ break;
+ }
+ }
+ detachedComments.push(comment);
+ lastComment = comment;
}
- for (var _i = 0, _a = state.compilerOptions.paths[matchedPatternText]; _i < _a.length; _i++) {
- var subst = _a[_i];
- var path = matchedStar ? subst.replace("*", matchedStar) : subst;
- var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path));
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path);
+ if (detachedComments.length) {
+ var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end);
+ var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos));
+ if (nodeLine >= lastCommentLine + 2) {
+ emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments);
+ emitComments(text, lineMap, writer, detachedComments, false, true, newLine, writeComment);
+ currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end };
}
- var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
- if (resolvedFileName) {
- return resolvedFileName;
+ }
+ }
+ return currentDetachedCommentInfo;
+ function isPinnedComment(comment) {
+ return text.charCodeAt(comment.pos + 1) === 42 &&
+ text.charCodeAt(comment.pos + 2) === 33;
+ }
+ }
+ ts.emitDetachedComments = emitDetachedComments;
+ function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) {
+ if (text.charCodeAt(commentPos + 1) === 42) {
+ var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, commentPos);
+ var lineCount = lineMap.length;
+ var firstCommentLineIndent = void 0;
+ for (var pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) {
+ var nextLineStart = (currentLine + 1) === lineCount
+ ? text.length + 1
+ : lineMap[currentLine + 1];
+ if (pos !== commentPos) {
+ if (firstCommentLineIndent === undefined) {
+ firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos);
+ }
+ var currentWriterIndentSpacing = writer.getIndent() * getIndentSize();
+ var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart);
+ if (spacesToEmit > 0) {
+ var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize();
+ var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize());
+ writer.rawWrite(indentSizeSpaceString);
+ while (numberOfSingleSpacesToEmit) {
+ writer.rawWrite(" ");
+ numberOfSingleSpacesToEmit--;
+ }
+ }
+ else {
+ writer.rawWrite("");
+ }
}
+ writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart);
+ pos = nextLineStart;
}
- return undefined;
}
else {
- var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName));
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate);
+ writer.write(text.substring(commentPos, commentEnd));
+ }
+ }
+ ts.writeCommentRange = writeCommentRange;
+ function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) {
+ var end = Math.min(commentEnd, nextLineStart - 1);
+ var currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, "");
+ if (currentLineText) {
+ writer.write(currentLineText);
+ if (end !== commentEnd) {
+ writer.writeLine();
}
- return loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
+ }
+ else {
+ writer.writeLiteral(newLine);
}
}
- function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) {
- var containingDirectory = ts.getDirectoryPath(containingFile);
- var supportedExtensions = ts.getSupportedExtensions(compilerOptions);
- var traceEnabled = isTraceEnabled(compilerOptions, host);
- var failedLookupLocations = [];
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: false };
- var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, supportedExtensions, state);
- var isExternalLibraryImport = false;
- if (!resolvedFileName) {
- if (moduleHasNonRelativeName(moduleName)) {
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName);
- }
- resolvedFileName = loadModuleFromNodeModules(moduleName, containingDirectory, failedLookupLocations, state, false);
- isExternalLibraryImport = resolvedFileName !== undefined;
+ function calculateIndent(text, pos, end) {
+ var currentLineIndent = 0;
+ for (; pos < end && ts.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) {
+ if (text.charCodeAt(pos) === 9) {
+ currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize());
}
else {
- var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
- resolvedFileName = nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, false, state);
- }
- }
- if (resolvedFileName && host.realpath) {
- var originalFileName = resolvedFileName;
- resolvedFileName = ts.normalizePath(host.realpath(resolvedFileName));
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, originalFileName, resolvedFileName);
+ currentLineIndent++;
}
}
- return createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations);
+ return currentLineIndent;
}
- ts.nodeModuleNameResolver = nodeModuleNameResolver;
- function nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state) {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate);
- }
- var resolvedFileName = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state);
- return resolvedFileName || loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, onlyRecordFailures, state);
+ function hasModifiers(node) {
+ return getModifierFlags(node) !== 0;
}
- function directoryProbablyExists(directoryName, host) {
- return !host.directoryExists || host.directoryExists(directoryName);
+ ts.hasModifiers = hasModifiers;
+ function hasModifier(node, flags) {
+ return (getModifierFlags(node) & flags) !== 0;
}
- ts.directoryProbablyExists = directoryProbablyExists;
- function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) {
- var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocation, onlyRecordFailures, state);
- if (resolvedByAddingExtension) {
- return resolvedByAddingExtension;
+ ts.hasModifier = hasModifier;
+ function getModifierFlags(node) {
+ if (node.modifierFlagsCache & 536870912) {
+ return node.modifierFlagsCache & ~536870912;
}
- if (ts.hasJavaScriptFileExtension(candidate)) {
- var extensionless = ts.removeFileExtension(candidate);
- if (state.traceEnabled) {
- var extension = candidate.substring(extensionless.length);
- trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
+ var flags = 0;
+ if (node.modifiers) {
+ for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
+ var modifier = _a[_i];
+ flags |= modifierToFlag(modifier.kind);
}
- return tryAddingExtensions(extensionless, extensions, failedLookupLocation, onlyRecordFailures, state);
}
+ if (node.flags & 4) {
+ flags |= 1;
+ }
+ node.modifierFlagsCache = flags | 536870912;
+ return flags;
}
- function tryAddingExtensions(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) {
- if (!onlyRecordFailures) {
- var directory = ts.getDirectoryPath(candidate);
- if (directory) {
- onlyRecordFailures = !directoryProbablyExists(directory, state.host);
- }
+ ts.getModifierFlags = getModifierFlags;
+ function modifierToFlag(token) {
+ switch (token) {
+ case 114: return 32;
+ case 113: return 4;
+ case 112: return 16;
+ case 111: return 8;
+ case 116: return 128;
+ case 83: return 1;
+ case 123: return 2;
+ case 75: return 2048;
+ case 78: return 512;
+ case 119: return 256;
+ case 129: return 64;
}
- return ts.forEach(extensions, function (ext) {
- return !(state.skipTsx && ts.isJsxOrTsxExtension(ext)) && tryFile(candidate + ext, failedLookupLocation, onlyRecordFailures, state);
- });
+ return 0;
}
- function tryFile(fileName, failedLookupLocation, onlyRecordFailures, state) {
- if (!onlyRecordFailures && state.host.fileExists(fileName)) {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
- }
- return fileName;
+ ts.modifierToFlag = modifierToFlag;
+ function isLogicalOperator(token) {
+ return token === 53
+ || token === 52
+ || token === 50;
+ }
+ ts.isLogicalOperator = isLogicalOperator;
+ function isAssignmentOperator(token) {
+ return token >= 57 && token <= 69;
+ }
+ ts.isAssignmentOperator = isAssignmentOperator;
+ function tryGetClassExtendingExpressionWithTypeArguments(node) {
+ if (node.kind === 195 &&
+ node.parent.token === 84 &&
+ isClassLike(node.parent.parent)) {
+ return node.parent.parent;
}
- else {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName);
+ }
+ ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;
+ function isDestructuringAssignment(node) {
+ if (isBinaryExpression(node)) {
+ if (node.operatorToken.kind === 57) {
+ var kind = node.left.kind;
+ return kind === 172
+ || kind === 171;
}
- failedLookupLocation.push(fileName);
- return undefined;
}
+ return false;
}
- function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, onlyRecordFailures, state) {
- var packageJsonPath = pathToPackageJson(candidate);
- var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host);
- if (directoryExists && state.host.fileExists(packageJsonPath)) {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
- }
- var typesFile = tryReadTypesSection(packageJsonPath, candidate, state);
- if (typesFile) {
- var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host);
- var result = tryFile(typesFile, failedLookupLocation, onlyRecordFailures_1, state) ||
- tryAddingExtensions(typesFile, extensions, failedLookupLocation, onlyRecordFailures_1, state);
- if (result) {
- return result;
- }
- }
- else {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field);
- }
- }
+ ts.isDestructuringAssignment = isDestructuringAssignment;
+ function isSupportedExpressionWithTypeArguments(node) {
+ return isSupportedExpressionWithTypeArgumentsRest(node.expression);
+ }
+ ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments;
+ function isSupportedExpressionWithTypeArgumentsRest(node) {
+ if (node.kind === 70) {
+ return true;
+ }
+ else if (isPropertyAccessExpression(node)) {
+ return isSupportedExpressionWithTypeArgumentsRest(node.expression);
}
else {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath);
- }
- failedLookupLocation.push(packageJsonPath);
+ return false;
}
- return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state);
}
- function pathToPackageJson(directory) {
- return ts.combinePaths(directory, "package.json");
+ function isExpressionWithTypeArgumentsInClassExtendsClause(node) {
+ return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined;
}
- function loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) {
- var nodeModulesFolder = ts.combinePaths(directory, "node_modules");
- var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);
- var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));
- var supportedExtensions = ts.getSupportedExtensions(state.compilerOptions);
- var result = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, !nodeModulesFolderExists, state);
- if (result) {
- return result;
+ ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
+ function isEntityNameExpression(node) {
+ return node.kind === 70 ||
+ node.kind === 173 && isEntityNameExpression(node.expression);
+ }
+ ts.isEntityNameExpression = isEntityNameExpression;
+ function isRightSideOfQualifiedNameOrPropertyAccess(node) {
+ return (node.parent.kind === 140 && node.parent.right === node) ||
+ (node.parent.kind === 173 && node.parent.name === node);
+ }
+ ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
+ function isEmptyObjectLiteralOrArrayLiteral(expression) {
+ var kind = expression.kind;
+ if (kind === 172) {
+ return expression.properties.length === 0;
}
- result = loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state);
- if (result) {
- return result;
+ if (kind === 171) {
+ return expression.elements.length === 0;
}
+ return false;
}
- function loadModuleFromNodeModules(moduleName, directory, failedLookupLocations, state, checkOneLevel) {
- return loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, checkOneLevel, false);
+ ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral;
+ function getLocalSymbolForExportDefault(symbol) {
+ return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512) ? symbol.valueDeclaration.localSymbol : undefined;
}
- ts.loadModuleFromNodeModules = loadModuleFromNodeModules;
- function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) {
- return loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, false, true);
+ ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault;
+ function tryExtractTypeScriptExtension(fileName) {
+ return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });
}
- function loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, checkOneLevel, typesOnly) {
- directory = ts.normalizeSlashes(directory);
- while (true) {
- var baseName = ts.getBaseFileName(directory);
- if (baseName !== "node_modules") {
- var packageResult = void 0;
- if (!typesOnly) {
- packageResult = loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state);
- if (packageResult && ts.hasTypeScriptFileExtension(packageResult)) {
- return packageResult;
- }
- }
- var typesResult = loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state);
- if (typesResult || packageResult) {
- return typesResult || packageResult;
- }
+ ts.tryExtractTypeScriptExtension = tryExtractTypeScriptExtension;
+ function getExpandedCharCodes(input) {
+ var output = [];
+ var length = input.length;
+ for (var i = 0; i < length; i++) {
+ var charCode = input.charCodeAt(i);
+ if (charCode < 0x80) {
+ output.push(charCode);
}
- var parentPath = ts.getDirectoryPath(directory);
- if (parentPath === directory || checkOneLevel) {
- break;
+ else if (charCode < 0x800) {
+ output.push((charCode >> 6) | 192);
+ output.push((charCode & 63) | 128);
}
- directory = parentPath;
- }
- return undefined;
- }
- function classicNameResolver(moduleName, containingFile, compilerOptions, host) {
- var traceEnabled = isTraceEnabled(compilerOptions, host);
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: !compilerOptions.jsx };
- var failedLookupLocations = [];
- var supportedExtensions = ts.getSupportedExtensions(compilerOptions);
- var containingDirectory = ts.getDirectoryPath(containingFile);
- var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, supportedExtensions, state);
- if (resolvedFileName) {
- return createResolvedModule(resolvedFileName, false, failedLookupLocations);
- }
- var referencedSourceFile;
- if (moduleHasNonRelativeName(moduleName)) {
- referencedSourceFile = referencedSourceFile = loadModuleFromAncestorDirectories(moduleName, containingDirectory, supportedExtensions, failedLookupLocations, state) ||
- loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);
- }
- else {
- var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
- referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, false, state);
- }
- return referencedSourceFile
- ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations }
- : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
- }
- ts.classicNameResolver = classicNameResolver;
- function loadModuleFromAncestorDirectories(moduleName, containingDirectory, supportedExtensions, failedLookupLocations, state) {
- while (true) {
- var searchName = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
- var referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, false, state);
- if (referencedSourceFile) {
- return referencedSourceFile;
+ else if (charCode < 0x10000) {
+ output.push((charCode >> 12) | 224);
+ output.push(((charCode >> 6) & 63) | 128);
+ output.push((charCode & 63) | 128);
}
- var parentPath = ts.getDirectoryPath(containingDirectory);
- if (parentPath === containingDirectory) {
- return undefined;
+ else if (charCode < 0x20000) {
+ output.push((charCode >> 18) | 240);
+ output.push(((charCode >> 12) & 63) | 128);
+ output.push(((charCode >> 6) & 63) | 128);
+ output.push((charCode & 63) | 128);
}
- containingDirectory = parentPath;
- }
- }
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- ts.externalHelpersModuleNameText = "tslib";
- function getDeclarationOfKind(symbol, kind) {
- var declarations = symbol.declarations;
- if (declarations) {
- for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) {
- var declaration = declarations_1[_i];
- if (declaration.kind === kind) {
- return declaration;
- }
+ else {
+ ts.Debug.assert(false, "Unexpected code point");
}
}
- return undefined;
+ return output;
}
- ts.getDeclarationOfKind = getDeclarationOfKind;
- var stringWriters = [];
- function getSingleLineStringWriter() {
- if (stringWriters.length === 0) {
- var str_1 = "";
- var writeText = function (text) { return str_1 += text; };
- return {
- string: function () { return str_1; },
- writeKeyword: writeText,
- writeOperator: writeText,
- writePunctuation: writeText,
- writeSpace: writeText,
- writeStringLiteral: writeText,
- writeParameter: writeText,
- writeSymbol: writeText,
- writeLine: function () { return str_1 += " "; },
- increaseIndent: function () { },
- decreaseIndent: function () { },
- clear: function () { return str_1 = ""; },
- trackSymbol: function () { },
- reportInaccessibleThisError: function () { }
- };
- }
- return stringWriters.pop();
+ ts.stringify = typeof JSON !== "undefined" && JSON.stringify
+ ? JSON.stringify
+ : stringifyFallback;
+ function stringifyFallback(value) {
+ return value === undefined ? undefined : stringifyValue(value);
}
- ts.getSingleLineStringWriter = getSingleLineStringWriter;
- function releaseStringWriter(writer) {
- writer.clear();
- stringWriters.push(writer);
+ function stringifyValue(value) {
+ return typeof value === "string" ? "\"" + escapeString(value) + "\""
+ : typeof value === "number" ? isFinite(value) ? String(value) : "null"
+ : typeof value === "boolean" ? value ? "true" : "false"
+ : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value)
+ : "null";
}
- ts.releaseStringWriter = releaseStringWriter;
- function getFullWidth(node) {
- return node.end - node.pos;
+ function cycleCheck(cb, value) {
+ ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON");
+ value.__cycle = true;
+ var result = cb(value);
+ delete value.__cycle;
+ return result;
}
- ts.getFullWidth = getFullWidth;
- function arrayIsEqualTo(array1, array2, equaler) {
- if (!array1 || !array2) {
- return array1 === array2;
- }
- if (array1.length !== array2.length) {
- return false;
- }
- for (var i = 0; i < array1.length; i++) {
- var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i];
- if (!equals) {
- return false;
- }
- }
- return true;
+ function stringifyArray(value) {
+ return "[" + ts.reduceLeft(value, stringifyElement, "") + "]";
}
- ts.arrayIsEqualTo = arrayIsEqualTo;
- function hasResolvedModule(sourceFile, moduleNameText) {
- return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]);
+ function stringifyElement(memo, value) {
+ return (memo ? memo + "," : memo) + stringifyValue(value);
}
- ts.hasResolvedModule = hasResolvedModule;
- function getResolvedModule(sourceFile, moduleNameText) {
- return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
+ function stringifyObject(value) {
+ return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}";
}
- ts.getResolvedModule = getResolvedModule;
- function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {
- if (!sourceFile.resolvedModules) {
- sourceFile.resolvedModules = ts.createMap();
- }
- sourceFile.resolvedModules[moduleNameText] = resolvedModule;
+ function stringifyProperty(memo, value, key) {
+ return value === undefined || typeof value === "function" || key === "__cycle" ? memo
+ : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value));
}
- ts.setResolvedModule = setResolvedModule;
- function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
- if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
- sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap();
+ var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+ function convertToBase64(input) {
+ var result = "";
+ var charCodes = getExpandedCharCodes(input);
+ var i = 0;
+ var length = charCodes.length;
+ var byte1, byte2, byte3, byte4;
+ while (i < length) {
+ byte1 = charCodes[i] >> 2;
+ byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4;
+ byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6;
+ byte4 = charCodes[i + 2] & 63;
+ if (i + 1 >= length) {
+ byte3 = byte4 = 64;
+ }
+ else if (i + 2 >= length) {
+ byte4 = 64;
+ }
+ result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);
+ i += 3;
}
- sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective;
- }
- ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
- function moduleResolutionIsEqualTo(oldResolution, newResolution) {
- return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport;
- }
- ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;
- function typeDirectiveIsEqualTo(oldResolution, newResolution) {
- return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary;
+ return result;
}
- ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
- function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) {
- if (names.length !== newResolutions.length) {
- return false;
+ ts.convertToBase64 = convertToBase64;
+ var carriageReturnLineFeed = "\r\n";
+ var lineFeed = "\n";
+ function getNewLineCharacter(options) {
+ if (options.newLine === 0) {
+ return carriageReturnLineFeed;
}
- for (var i = 0; i < names.length; i++) {
- var newResolution = newResolutions[i];
- var oldResolution = oldResolutions && oldResolutions[names[i]];
- var changed = oldResolution
- ? !newResolution || !comparer(oldResolution, newResolution)
- : newResolution;
- if (changed) {
- return true;
- }
+ else if (options.newLine === 1) {
+ return lineFeed;
}
- return false;
- }
- ts.hasChangesInResolutions = hasChangesInResolutions;
- function containsParseError(node) {
- aggregateChildData(node);
- return (node.flags & 2097152) !== 0;
- }
- ts.containsParseError = containsParseError;
- function aggregateChildData(node) {
- if (!(node.flags & 4194304)) {
- var thisNodeOrAnySubNodesHasError = ((node.flags & 524288) !== 0) ||
- ts.forEachChild(node, containsParseError);
- if (thisNodeOrAnySubNodesHasError) {
- node.flags |= 2097152;
- }
- node.flags |= 4194304;
+ else if (ts.sys) {
+ return ts.sys.newLine;
}
+ return carriageReturnLineFeed;
}
- function getSourceFileOfNode(node) {
- while (node && node.kind !== 256) {
- node = node.parent;
- }
- return node;
+ ts.getNewLineCharacter = getNewLineCharacter;
+ function isSimpleExpression(node) {
+ return isSimpleExpressionWorker(node, 0);
}
- ts.getSourceFileOfNode = getSourceFileOfNode;
- function isStatementWithLocals(node) {
- switch (node.kind) {
- case 199:
- case 227:
- case 206:
- case 207:
- case 208:
+ ts.isSimpleExpression = isSimpleExpression;
+ function isSimpleExpressionWorker(node, depth) {
+ if (depth <= 5) {
+ var kind = node.kind;
+ if (kind === 9
+ || kind === 8
+ || kind === 11
+ || kind === 12
+ || kind === 70
+ || kind === 98
+ || kind === 96
+ || kind === 100
+ || kind === 85
+ || kind === 94) {
+ return true;
+ }
+ else if (kind === 173) {
+ return isSimpleExpressionWorker(node.expression, depth + 1);
+ }
+ else if (kind === 174) {
+ return isSimpleExpressionWorker(node.expression, depth + 1)
+ && isSimpleExpressionWorker(node.argumentExpression, depth + 1);
+ }
+ else if (kind === 186
+ || kind === 187) {
+ return isSimpleExpressionWorker(node.operand, depth + 1);
+ }
+ else if (kind === 188) {
+ return node.operatorToken.kind !== 39
+ && isSimpleExpressionWorker(node.left, depth + 1)
+ && isSimpleExpressionWorker(node.right, depth + 1);
+ }
+ else if (kind === 189) {
+ return isSimpleExpressionWorker(node.condition, depth + 1)
+ && isSimpleExpressionWorker(node.whenTrue, depth + 1)
+ && isSimpleExpressionWorker(node.whenFalse, depth + 1);
+ }
+ else if (kind === 184
+ || kind === 183
+ || kind === 182) {
+ return isSimpleExpressionWorker(node.expression, depth + 1);
+ }
+ else if (kind === 171) {
+ return node.elements.length === 0;
+ }
+ else if (kind === 172) {
+ return node.properties.length === 0;
+ }
+ else if (kind === 175) {
+ if (!isSimpleExpressionWorker(node.expression, depth + 1)) {
+ return false;
+ }
+ for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
+ var argument = _a[_i];
+ if (!isSimpleExpressionWorker(argument, depth + 1)) {
+ return false;
+ }
+ }
return true;
+ }
}
return false;
}
- ts.isStatementWithLocals = isStatementWithLocals;
- function getStartPositionOfLine(line, sourceFile) {
- ts.Debug.assert(line >= 0);
- return ts.getLineStarts(sourceFile)[line];
- }
- ts.getStartPositionOfLine = getStartPositionOfLine;
- function nodePosToString(node) {
- var file = getSourceFileOfNode(node);
- var loc = ts.getLineAndCharacterOfPosition(file, node.pos);
- return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")";
- }
- ts.nodePosToString = nodePosToString;
- function getStartPosOfNode(node) {
- return node.pos;
- }
- ts.getStartPosOfNode = getStartPosOfNode;
- function isDefined(value) {
- return value !== undefined;
- }
- ts.isDefined = isDefined;
- function getEndLinePosition(line, sourceFile) {
- ts.Debug.assert(line >= 0);
- var lineStarts = ts.getLineStarts(sourceFile);
- var lineIndex = line;
- var sourceText = sourceFile.text;
- if (lineIndex + 1 === lineStarts.length) {
- return sourceText.length - 1;
+ var syntaxKindCache = ts.createMap();
+ function formatSyntaxKind(kind) {
+ var syntaxKindEnum = ts.SyntaxKind;
+ if (syntaxKindEnum) {
+ if (syntaxKindCache[kind]) {
+ return syntaxKindCache[kind];
+ }
+ for (var name_6 in syntaxKindEnum) {
+ if (syntaxKindEnum[name_6] === kind) {
+ return syntaxKindCache[kind] = kind.toString() + " (" + name_6 + ")";
+ }
+ }
}
else {
- var start = lineStarts[lineIndex];
- var pos = lineStarts[lineIndex + 1] - 1;
- ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos)));
- while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) {
- pos--;
- }
- return pos;
+ return kind.toString();
}
}
- ts.getEndLinePosition = getEndLinePosition;
- function nodeIsMissing(node) {
- if (node === undefined) {
- return true;
- }
- return node.pos === node.end && node.pos >= 0 && node.kind !== 1;
+ ts.formatSyntaxKind = formatSyntaxKind;
+ function movePos(pos, value) {
+ return ts.positionIsSynthesized(pos) ? -1 : pos + value;
}
- ts.nodeIsMissing = nodeIsMissing;
- function nodeIsPresent(node) {
- return !nodeIsMissing(node);
+ ts.movePos = movePos;
+ function createRange(pos, end) {
+ return { pos: pos, end: end };
}
- ts.nodeIsPresent = nodeIsPresent;
- function getTokenPosOfNode(node, sourceFile, includeJsDocComment) {
- if (nodeIsMissing(node)) {
- return node.pos;
- }
- if (isJSDocNode(node)) {
- return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true);
- }
- if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) {
- return getTokenPosOfNode(node.jsDocComments[0]);
- }
- if (node.kind === 286 && node._children.length > 0) {
- return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment);
- }
- return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
+ ts.createRange = createRange;
+ function moveRangeEnd(range, end) {
+ return createRange(range.pos, end);
}
- ts.getTokenPosOfNode = getTokenPosOfNode;
- function isJSDocNode(node) {
- return node.kind >= 257 && node.kind <= 282;
+ ts.moveRangeEnd = moveRangeEnd;
+ function moveRangePos(range, pos) {
+ return createRange(pos, range.end);
}
- ts.isJSDocNode = isJSDocNode;
- function isJSDocTag(node) {
- return node.kind >= 273 && node.kind <= 285;
+ ts.moveRangePos = moveRangePos;
+ function moveRangePastDecorators(node) {
+ return node.decorators && node.decorators.length > 0
+ ? moveRangePos(node, node.decorators.end)
+ : node;
}
- ts.isJSDocTag = isJSDocTag;
- function getNonDecoratorTokenPosOfNode(node, sourceFile) {
- if (nodeIsMissing(node) || !node.decorators) {
- return getTokenPosOfNode(node, sourceFile);
- }
- return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end);
+ ts.moveRangePastDecorators = moveRangePastDecorators;
+ function moveRangePastModifiers(node) {
+ return node.modifiers && node.modifiers.length > 0
+ ? moveRangePos(node, node.modifiers.end)
+ : moveRangePastDecorators(node);
}
- ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode;
- function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) {
- if (includeTrivia === void 0) { includeTrivia = false; }
- if (nodeIsMissing(node)) {
- return "";
- }
- var text = sourceFile.text;
- return text.substring(includeTrivia ? node.pos : ts.skipTrivia(text, node.pos), node.end);
+ ts.moveRangePastModifiers = moveRangePastModifiers;
+ function isCollapsedRange(range) {
+ return range.pos === range.end;
}
- ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;
- function getTextOfNodeFromSourceText(sourceText, node) {
- if (nodeIsMissing(node)) {
- return "";
- }
- return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end);
+ ts.isCollapsedRange = isCollapsedRange;
+ function collapseRangeToStart(range) {
+ return isCollapsedRange(range) ? range : moveRangeEnd(range, range.pos);
}
- ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText;
- function getTextOfNode(node, includeTrivia) {
- if (includeTrivia === void 0) { includeTrivia = false; }
- return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia);
+ ts.collapseRangeToStart = collapseRangeToStart;
+ function collapseRangeToEnd(range) {
+ return isCollapsedRange(range) ? range : moveRangePos(range, range.end);
}
- ts.getTextOfNode = getTextOfNode;
- function getLiteralText(node, sourceFile, languageVersion) {
- if (languageVersion < 2 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) {
- return getQuotedEscapedLiteralText('"', node.text, '"');
- }
- if (!nodeIsSynthesized(node) && node.parent) {
- var text = getSourceTextOfNodeFromSourceFile(sourceFile, node);
- if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) {
- return node.text;
- }
- return text;
- }
- switch (node.kind) {
- case 9:
- return getQuotedEscapedLiteralText('"', node.text, '"');
- case 11:
- return getQuotedEscapedLiteralText("`", node.text, "`");
- case 12:
- return getQuotedEscapedLiteralText("`", node.text, "${");
- case 13:
- return getQuotedEscapedLiteralText("}", node.text, "${");
- case 14:
- return getQuotedEscapedLiteralText("}", node.text, "`");
- case 8:
- return node.text;
- }
- ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for.");
+ ts.collapseRangeToEnd = collapseRangeToEnd;
+ function createTokenRange(pos, token) {
+ return createRange(pos, pos + ts.tokenToString(token).length);
}
- ts.getLiteralText = getLiteralText;
- function isBinaryOrOctalIntegerLiteral(node, text) {
- if (node.kind === 8 && text.length > 1) {
- switch (text.charCodeAt(1)) {
- case 98:
- case 66:
- case 111:
- case 79:
- return true;
- }
- }
- return false;
+ ts.createTokenRange = createTokenRange;
+ function rangeIsOnSingleLine(range, sourceFile) {
+ return rangeStartIsOnSameLineAsRangeEnd(range, range, sourceFile);
}
- ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral;
- function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) {
- return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote;
+ ts.rangeIsOnSingleLine = rangeIsOnSingleLine;
+ function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) {
+ return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), getStartPositionOfRange(range2, sourceFile), sourceFile);
}
- function escapeIdentifier(identifier) {
- return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier;
+ ts.rangeStartPositionsAreOnSameLine = rangeStartPositionsAreOnSameLine;
+ function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) {
+ return positionsAreOnSameLine(range1.end, range2.end, sourceFile);
}
- ts.escapeIdentifier = escapeIdentifier;
- function unescapeIdentifier(identifier) {
- return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier;
+ ts.rangeEndPositionsAreOnSameLine = rangeEndPositionsAreOnSameLine;
+ function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) {
+ return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), range2.end, sourceFile);
}
- ts.unescapeIdentifier = unescapeIdentifier;
- function makeIdentifierFromModuleName(moduleName) {
- return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_");
+ ts.rangeStartIsOnSameLineAsRangeEnd = rangeStartIsOnSameLineAsRangeEnd;
+ function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) {
+ return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile);
}
- ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName;
- function isBlockOrCatchScoped(declaration) {
- return (ts.getCombinedNodeFlags(declaration) & 3) !== 0 ||
- isCatchClauseVariableDeclaration(declaration);
+ ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;
+ function positionsAreOnSameLine(pos1, pos2, sourceFile) {
+ return pos1 === pos2 ||
+ getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2);
}
- ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
- function isAmbientModule(node) {
- return node && node.kind === 225 &&
- (node.name.kind === 9 || isGlobalScopeAugmentation(node));
- }
- ts.isAmbientModule = isAmbientModule;
- function isShorthandAmbientModuleSymbol(moduleSymbol) {
- return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
- }
- ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
- function isShorthandAmbientModule(node) {
- return node.kind === 225 && (!node.body);
+ ts.positionsAreOnSameLine = positionsAreOnSameLine;
+ function getStartPositionOfRange(range, sourceFile) {
+ return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);
}
- function isBlockScopedContainerTopLevel(node) {
- return node.kind === 256 ||
- node.kind === 225 ||
- isFunctionLike(node);
+ ts.getStartPositionOfRange = getStartPositionOfRange;
+ function collectExternalModuleInfo(sourceFile) {
+ var externalImports = [];
+ var exportSpecifiers = ts.createMap();
+ var exportEquals = undefined;
+ var hasExportStarsToExportValues = false;
+ for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
+ var node = _a[_i];
+ switch (node.kind) {
+ case 231:
+ externalImports.push(node);
+ break;
+ case 230:
+ if (node.moduleReference.kind === 241) {
+ externalImports.push(node);
+ }
+ break;
+ case 237:
+ if (node.moduleSpecifier) {
+ if (!node.exportClause) {
+ externalImports.push(node);
+ hasExportStarsToExportValues = true;
+ }
+ else {
+ externalImports.push(node);
+ }
+ }
+ else {
+ for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
+ var specifier = _c[_b];
+ var name_7 = (specifier.propertyName || specifier.name).text;
+ (exportSpecifiers[name_7] || (exportSpecifiers[name_7] = [])).push(specifier);
+ }
+ }
+ break;
+ case 236:
+ if (node.isExportEquals && !exportEquals) {
+ exportEquals = node;
+ }
+ break;
+ }
+ }
+ return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues };
}
- ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
- function isGlobalScopeAugmentation(module) {
- return !!(module.flags & 512);
+ ts.collectExternalModuleInfo = collectExternalModuleInfo;
+ function getInitializedVariables(node) {
+ return ts.filter(node.declarations, isInitializedVariable);
}
- ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation;
- function isExternalModuleAugmentation(node) {
- if (!node || !isAmbientModule(node)) {
- return false;
- }
- switch (node.parent.kind) {
- case 256:
- return ts.isExternalModule(node.parent);
- case 226:
- return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
- }
- return false;
+ ts.getInitializedVariables = getInitializedVariables;
+ function isInitializedVariable(node) {
+ return node.initializer !== undefined;
}
- ts.isExternalModuleAugmentation = isExternalModuleAugmentation;
- function isBlockScope(node, parentNode) {
- switch (node.kind) {
- case 256:
- case 227:
- case 252:
- case 225:
- case 206:
- case 207:
- case 208:
- case 148:
- case 147:
- case 149:
- case 150:
- case 220:
- case 179:
- case 180:
- return true;
- case 199:
- return parentNode && !isFunctionLike(parentNode);
+ function isMergedWithClass(node) {
+ if (node.symbol) {
+ for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) {
+ var declaration = _a[_i];
+ if (declaration.kind === 222 && declaration !== node) {
+ return true;
+ }
+ }
}
return false;
}
- ts.isBlockScope = isBlockScope;
- function getEnclosingBlockScopeContainer(node) {
- var current = node.parent;
- while (current) {
- if (isBlockScope(current, current.parent)) {
- return current;
- }
- current = current.parent;
- }
+ ts.isMergedWithClass = isMergedWithClass;
+ function isFirstDeclarationOfKind(node, kind) {
+ return node.symbol && getDeclarationOfKind(node.symbol, kind) === node;
}
- ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer;
- function isCatchClauseVariableDeclaration(declaration) {
- return declaration &&
- declaration.kind === 218 &&
- declaration.parent &&
- declaration.parent.kind === 252;
+ ts.isFirstDeclarationOfKind = isFirstDeclarationOfKind;
+ function isNodeArray(array) {
+ return array.hasOwnProperty("pos")
+ && array.hasOwnProperty("end");
}
- ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration;
- function declarationNameToString(name) {
- return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name);
+ ts.isNodeArray = isNodeArray;
+ function isNoSubstitutionTemplateLiteral(node) {
+ return node.kind === 12;
}
- ts.declarationNameToString = declarationNameToString;
- function createDiagnosticForNode(node, message, arg0, arg1, arg2) {
- var sourceFile = getSourceFileOfNode(node);
- var span = getErrorSpanForNode(sourceFile, node);
- return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2);
+ ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral;
+ function isLiteralKind(kind) {
+ return 8 <= kind && kind <= 12;
}
- ts.createDiagnosticForNode = createDiagnosticForNode;
- function createDiagnosticForNodeFromMessageChain(node, messageChain) {
- var sourceFile = getSourceFileOfNode(node);
- var span = getErrorSpanForNode(sourceFile, node);
- return {
- file: sourceFile,
- start: span.start,
- length: span.length,
- code: messageChain.code,
- category: messageChain.category,
- messageText: messageChain.next ? messageChain : messageChain.messageText
- };
+ ts.isLiteralKind = isLiteralKind;
+ function isTextualLiteralKind(kind) {
+ return kind === 9 || kind === 12;
}
- ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;
- function getSpanOfTokenAtPosition(sourceFile, pos) {
- var scanner = ts.createScanner(sourceFile.languageVersion, true, sourceFile.languageVariant, sourceFile.text, undefined, pos);
- scanner.scan();
- var start = scanner.getTokenPos();
- return ts.createTextSpanFromBounds(start, scanner.getTextPos());
+ ts.isTextualLiteralKind = isTextualLiteralKind;
+ function isLiteralExpression(node) {
+ return isLiteralKind(node.kind);
}
- ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
- function getErrorSpanForArrowFunction(sourceFile, node) {
- var pos = ts.skipTrivia(sourceFile.text, node.pos);
- if (node.body && node.body.kind === 199) {
- var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
- var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
- if (startLine < endLine) {
- return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1);
- }
- }
- return ts.createTextSpanFromBounds(pos, node.end);
+ ts.isLiteralExpression = isLiteralExpression;
+ function isTemplateLiteralKind(kind) {
+ return 12 <= kind && kind <= 15;
}
- function getErrorSpanForNode(sourceFile, node) {
- var errorNode = node;
- switch (node.kind) {
- case 256:
- var pos_1 = ts.skipTrivia(sourceFile.text, 0, false);
- if (pos_1 === sourceFile.text.length) {
- return ts.createTextSpan(0, 0);
- }
- return getSpanOfTokenAtPosition(sourceFile, pos_1);
- case 218:
- case 169:
- case 221:
- case 192:
- case 222:
- case 225:
- case 224:
- case 255:
- case 220:
- case 179:
- case 147:
- case 149:
- case 150:
- case 223:
- errorNode = node.name;
- break;
- case 180:
- return getErrorSpanForArrowFunction(sourceFile, node);
- }
- if (errorNode === undefined) {
- return getSpanOfTokenAtPosition(sourceFile, node.pos);
- }
- var pos = nodeIsMissing(errorNode)
- ? errorNode.pos
- : ts.skipTrivia(sourceFile.text, errorNode.pos);
- return ts.createTextSpanFromBounds(pos, errorNode.end);
+ ts.isTemplateLiteralKind = isTemplateLiteralKind;
+ function isTemplateHead(node) {
+ return node.kind === 13;
}
- ts.getErrorSpanForNode = getErrorSpanForNode;
- function isExternalOrCommonJsModule(file) {
- return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined;
+ ts.isTemplateHead = isTemplateHead;
+ function isTemplateMiddleOrTemplateTail(node) {
+ var kind = node.kind;
+ return kind === 14
+ || kind === 15;
}
- ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule;
- function isDeclarationFile(file) {
- return file.isDeclarationFile;
+ ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail;
+ function isIdentifier(node) {
+ return node.kind === 70;
}
- ts.isDeclarationFile = isDeclarationFile;
- function isConstEnumDeclaration(node) {
- return node.kind === 224 && isConst(node);
+ ts.isIdentifier = isIdentifier;
+ function isGeneratedIdentifier(node) {
+ return isIdentifier(node) && node.autoGenerateKind > 0;
}
- ts.isConstEnumDeclaration = isConstEnumDeclaration;
- function isConst(node) {
- return !!(ts.getCombinedNodeFlags(node) & 2)
- || !!(ts.getCombinedModifierFlags(node) & 2048);
+ ts.isGeneratedIdentifier = isGeneratedIdentifier;
+ function isModifier(node) {
+ return isModifierKind(node.kind);
}
- ts.isConst = isConst;
- function isLet(node) {
- return !!(ts.getCombinedNodeFlags(node) & 1);
+ ts.isModifier = isModifier;
+ function isQualifiedName(node) {
+ return node.kind === 140;
}
- ts.isLet = isLet;
- function isSuperCall(n) {
- return n.kind === 174 && n.expression.kind === 95;
+ ts.isQualifiedName = isQualifiedName;
+ function isComputedPropertyName(node) {
+ return node.kind === 141;
}
- ts.isSuperCall = isSuperCall;
- function isPrologueDirective(node) {
- return node.kind === 202 && node.expression.kind === 9;
+ ts.isComputedPropertyName = isComputedPropertyName;
+ function isEntityName(node) {
+ var kind = node.kind;
+ return kind === 140
+ || kind === 70;
}
- ts.isPrologueDirective = isPrologueDirective;
- function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
- return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos);
+ ts.isEntityName = isEntityName;
+ function isPropertyName(node) {
+ var kind = node.kind;
+ return kind === 70
+ || kind === 9
+ || kind === 8
+ || kind === 141;
}
- ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;
- function getLeadingCommentRangesOfNodeFromText(node, text) {
- return ts.getLeadingCommentRanges(text, node.pos);
+ ts.isPropertyName = isPropertyName;
+ function isModuleName(node) {
+ var kind = node.kind;
+ return kind === 70
+ || kind === 9;
}
- ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText;
- function getJsDocComments(node, sourceFileOfNode) {
- return getJsDocCommentsFromText(node, sourceFileOfNode.text);
+ ts.isModuleName = isModuleName;
+ function isBindingName(node) {
+ var kind = node.kind;
+ return kind === 70
+ || kind === 168
+ || kind === 169;
}
- ts.getJsDocComments = getJsDocComments;
- function getJsDocCommentsFromText(node, text) {
- var commentRanges = (node.kind === 142 ||
- node.kind === 141 ||
- node.kind === 179 ||
- node.kind === 180) ?
- ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
- getLeadingCommentRangesOfNodeFromText(node, text);
- return ts.filter(commentRanges, isJsDocComment);
- function isJsDocComment(comment) {
- return text.charCodeAt(comment.pos + 1) === 42 &&
- text.charCodeAt(comment.pos + 2) === 42 &&
- text.charCodeAt(comment.pos + 3) !== 47;
- }
+ ts.isBindingName = isBindingName;
+ function isTypeParameter(node) {
+ return node.kind === 142;
}
- ts.getJsDocCommentsFromText = getJsDocCommentsFromText;
- ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/;
- ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/;
- ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/;
- function isPartOfTypeNode(node) {
- if (154 <= node.kind && node.kind <= 166) {
- return true;
- }
- switch (node.kind) {
- case 117:
- case 130:
- case 132:
- case 120:
- case 133:
- case 135:
- case 127:
- return true;
- case 103:
- return node.parent.kind !== 183;
- case 194:
- return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
- case 69:
- if (node.parent.kind === 139 && node.parent.right === node) {
- node = node.parent;
- }
- else if (node.parent.kind === 172 && node.parent.name === node) {
- node = node.parent;
- }
- ts.Debug.assert(node.kind === 69 || node.kind === 139 || node.kind === 172, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
- case 139:
- case 172:
- case 97:
- var parent_2 = node.parent;
- if (parent_2.kind === 158) {
- return false;
- }
- if (154 <= parent_2.kind && parent_2.kind <= 166) {
- return true;
- }
- switch (parent_2.kind) {
- case 194:
- return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_2);
- case 141:
- return node === parent_2.constraint;
- case 145:
- case 144:
- case 142:
- case 218:
- return node === parent_2.type;
- case 220:
- case 179:
- case 180:
- case 148:
- case 147:
- case 146:
- case 149:
- case 150:
- return node === parent_2.type;
- case 151:
- case 152:
- case 153:
- return node === parent_2.type;
- case 177:
- return node === parent_2.type;
- case 174:
- case 175:
- return parent_2.typeArguments && ts.indexOf(parent_2.typeArguments, node) >= 0;
- case 176:
- return false;
- }
- }
- return false;
+ ts.isTypeParameter = isTypeParameter;
+ function isParameter(node) {
+ return node.kind === 143;
}
- ts.isPartOfTypeNode = isPartOfTypeNode;
- function forEachReturnStatement(body, visitor) {
- return traverse(body);
- function traverse(node) {
- switch (node.kind) {
- case 211:
- return visitor(node);
- case 227:
- case 199:
- case 203:
- case 204:
- case 205:
- case 206:
- case 207:
- case 208:
- case 212:
- case 213:
- case 249:
- case 250:
- case 214:
- case 216:
- case 252:
- return ts.forEachChild(node, traverse);
- }
- }
+ ts.isParameter = isParameter;
+ function isDecorator(node) {
+ return node.kind === 144;
}
- ts.forEachReturnStatement = forEachReturnStatement;
- function forEachYieldExpression(body, visitor) {
- return traverse(body);
- function traverse(node) {
- switch (node.kind) {
- case 190:
- visitor(node);
- var operand = node.expression;
- if (operand) {
- traverse(operand);
- }
- case 224:
- case 222:
- case 225:
- case 223:
- case 221:
- case 192:
- return;
- default:
- if (isFunctionLike(node)) {
- var name_8 = node.name;
- if (name_8 && name_8.kind === 140) {
- traverse(name_8.expression);
- return;
- }
- }
- else if (!isPartOfTypeNode(node)) {
- ts.forEachChild(node, traverse);
- }
- }
- }
+ ts.isDecorator = isDecorator;
+ function isMethodDeclaration(node) {
+ return node.kind === 148;
}
- ts.forEachYieldExpression = forEachYieldExpression;
- function isVariableLike(node) {
- if (node) {
- switch (node.kind) {
- case 169:
- case 255:
- case 142:
- case 253:
- case 145:
- case 144:
- case 254:
- case 218:
- return true;
- }
- }
- return false;
+ ts.isMethodDeclaration = isMethodDeclaration;
+ function isClassElement(node) {
+ var kind = node.kind;
+ return kind === 149
+ || kind === 146
+ || kind === 148
+ || kind === 150
+ || kind === 151
+ || kind === 154
+ || kind === 199;
}
- ts.isVariableLike = isVariableLike;
- function isAccessor(node) {
- return node && (node.kind === 149 || node.kind === 150);
+ ts.isClassElement = isClassElement;
+ function isObjectLiteralElementLike(node) {
+ var kind = node.kind;
+ return kind === 253
+ || kind === 254
+ || kind === 148
+ || kind === 150
+ || kind === 151
+ || kind === 240;
}
- ts.isAccessor = isAccessor;
- function isClassLike(node) {
- return node && (node.kind === 221 || node.kind === 192);
+ ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
+ function isTypeNodeKind(kind) {
+ return (kind >= 155 && kind <= 167)
+ || kind === 118
+ || kind === 131
+ || kind === 121
+ || kind === 133
+ || kind === 134
+ || kind === 104
+ || kind === 128
+ || kind === 195;
}
- ts.isClassLike = isClassLike;
- function isFunctionLike(node) {
- return node && isFunctionLikeKind(node.kind);
+ function isTypeNode(node) {
+ return isTypeNodeKind(node.kind);
}
- ts.isFunctionLike = isFunctionLike;
- function isFunctionLikeKind(kind) {
- switch (kind) {
- case 148:
- case 179:
- case 220:
- case 180:
- case 147:
- case 146:
- case 149:
- case 150:
- case 151:
- case 152:
- case 153:
- case 156:
- case 157:
- return true;
+ ts.isTypeNode = isTypeNode;
+ function isBindingPattern(node) {
+ if (node) {
+ var kind = node.kind;
+ return kind === 169
+ || kind === 168;
}
return false;
}
- ts.isFunctionLikeKind = isFunctionLikeKind;
- function introducesArgumentsExoticObject(node) {
- switch (node.kind) {
- case 147:
- case 146:
- case 148:
- case 149:
- case 150:
- case 220:
- case 179:
- return true;
- }
- return false;
+ ts.isBindingPattern = isBindingPattern;
+ function isBindingElement(node) {
+ return node.kind === 170;
}
- ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject;
- function isIterationStatement(node, lookInLabeledStatements) {
- switch (node.kind) {
- case 206:
- case 207:
- case 208:
- case 204:
- case 205:
- return true;
- case 214:
- return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
- }
- return false;
+ ts.isBindingElement = isBindingElement;
+ function isArrayBindingElement(node) {
+ var kind = node.kind;
+ return kind === 170
+ || kind === 194;
}
- ts.isIterationStatement = isIterationStatement;
- function isFunctionBlock(node) {
- return node && node.kind === 199 && isFunctionLike(node.parent);
+ ts.isArrayBindingElement = isArrayBindingElement;
+ function isPropertyAccessExpression(node) {
+ return node.kind === 173;
}
- ts.isFunctionBlock = isFunctionBlock;
- function isObjectLiteralMethod(node) {
- return node && node.kind === 147 && node.parent.kind === 171;
+ ts.isPropertyAccessExpression = isPropertyAccessExpression;
+ function isElementAccessExpression(node) {
+ return node.kind === 174;
}
- ts.isObjectLiteralMethod = isObjectLiteralMethod;
- function isObjectLiteralOrClassExpressionMethod(node) {
- return node.kind === 147 &&
- (node.parent.kind === 171 ||
- node.parent.kind === 192);
+ ts.isElementAccessExpression = isElementAccessExpression;
+ function isBinaryExpression(node) {
+ return node.kind === 188;
}
- ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;
- function isIdentifierTypePredicate(predicate) {
- return predicate && predicate.kind === 1;
+ ts.isBinaryExpression = isBinaryExpression;
+ function isConditionalExpression(node) {
+ return node.kind === 189;
}
- ts.isIdentifierTypePredicate = isIdentifierTypePredicate;
- function isThisTypePredicate(predicate) {
- return predicate && predicate.kind === 0;
- }
- ts.isThisTypePredicate = isThisTypePredicate;
- function getContainingFunction(node) {
- while (true) {
- node = node.parent;
- if (!node || isFunctionLike(node)) {
- return node;
- }
- }
- }
- ts.getContainingFunction = getContainingFunction;
- function getContainingClass(node) {
- while (true) {
- node = node.parent;
- if (!node || isClassLike(node)) {
- return node;
- }
- }
- }
- ts.getContainingClass = getContainingClass;
- function getThisContainer(node, includeArrowFunctions) {
- while (true) {
- node = node.parent;
- if (!node) {
- return undefined;
- }
- switch (node.kind) {
- case 140:
- if (isClassLike(node.parent.parent)) {
- return node;
- }
- node = node.parent;
- break;
- case 143:
- if (node.parent.kind === 142 && isClassElement(node.parent.parent)) {
- node = node.parent.parent;
- }
- else if (isClassElement(node.parent)) {
- node = node.parent;
- }
- break;
- case 180:
- if (!includeArrowFunctions) {
- continue;
- }
- case 220:
- case 179:
- case 225:
- case 145:
- case 144:
- case 147:
- case 146:
- case 148:
- case 149:
- case 150:
- case 151:
- case 152:
- case 153:
- case 224:
- case 256:
- return node;
- }
- }
+ ts.isConditionalExpression = isConditionalExpression;
+ function isCallExpression(node) {
+ return node.kind === 175;
}
- ts.getThisContainer = getThisContainer;
- function getSuperContainer(node, stopOnFunctions) {
- while (true) {
- node = node.parent;
- if (!node) {
- return node;
- }
- switch (node.kind) {
- case 140:
- node = node.parent;
- break;
- case 220:
- case 179:
- case 180:
- if (!stopOnFunctions) {
- continue;
- }
- case 145:
- case 144:
- case 147:
- case 146:
- case 148:
- case 149:
- case 150:
- return node;
- case 143:
- if (node.parent.kind === 142 && isClassElement(node.parent.parent)) {
- node = node.parent.parent;
- }
- else if (isClassElement(node.parent)) {
- node = node.parent;
- }
- break;
- }
- }
+ ts.isCallExpression = isCallExpression;
+ function isTemplateLiteral(node) {
+ var kind = node.kind;
+ return kind === 190
+ || kind === 12;
}
- ts.getSuperContainer = getSuperContainer;
- function getImmediatelyInvokedFunctionExpression(func) {
- if (func.kind === 179 || func.kind === 180) {
- var prev = func;
- var parent_3 = func.parent;
- while (parent_3.kind === 178) {
- prev = parent_3;
- parent_3 = parent_3.parent;
- }
- if (parent_3.kind === 174 && parent_3.expression === prev) {
- return parent_3;
- }
- }
+ ts.isTemplateLiteral = isTemplateLiteral;
+ function isSpreadElementExpression(node) {
+ return node.kind === 192;
}
- ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;
- function isSuperProperty(node) {
- var kind = node.kind;
- return (kind === 172 || kind === 173)
- && node.expression.kind === 95;
+ ts.isSpreadElementExpression = isSpreadElementExpression;
+ function isExpressionWithTypeArguments(node) {
+ return node.kind === 195;
}
- ts.isSuperProperty = isSuperProperty;
- function getEntityNameFromTypeNode(node) {
- if (node) {
- switch (node.kind) {
- case 155:
- return node.typeName;
- case 194:
- ts.Debug.assert(isEntityNameExpression(node.expression));
- return node.expression;
- case 69:
- case 139:
- return node;
- }
- }
- return undefined;
+ ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
+ function isLeftHandSideExpressionKind(kind) {
+ return kind === 173
+ || kind === 174
+ || kind === 176
+ || kind === 175
+ || kind === 242
+ || kind === 243
+ || kind === 177
+ || kind === 171
+ || kind === 179
+ || kind === 172
+ || kind === 193
+ || kind === 180
+ || kind === 70
+ || kind === 11
+ || kind === 8
+ || kind === 9
+ || kind === 12
+ || kind === 190
+ || kind === 85
+ || kind === 94
+ || kind === 98
+ || kind === 100
+ || kind === 96
+ || kind === 197;
}
- ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
- function isCallLikeExpression(node) {
- switch (node.kind) {
- case 174:
- case 175:
- case 176:
- case 143:
- return true;
- default:
- return false;
- }
+ function isLeftHandSideExpression(node) {
+ return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
}
- ts.isCallLikeExpression = isCallLikeExpression;
- function getInvokedExpression(node) {
- if (node.kind === 176) {
- return node.tag;
- }
- return node.expression;
+ ts.isLeftHandSideExpression = isLeftHandSideExpression;
+ function isUnaryExpressionKind(kind) {
+ return kind === 186
+ || kind === 187
+ || kind === 182
+ || kind === 183
+ || kind === 184
+ || kind === 185
+ || kind === 178
+ || isLeftHandSideExpressionKind(kind);
}
- ts.getInvokedExpression = getInvokedExpression;
- function nodeCanBeDecorated(node) {
- switch (node.kind) {
- case 221:
- return true;
- case 145:
- return node.parent.kind === 221;
- case 149:
- case 150:
- case 147:
- return node.body !== undefined
- && node.parent.kind === 221;
- case 142:
- return node.parent.body !== undefined
- && (node.parent.kind === 148
- || node.parent.kind === 147
- || node.parent.kind === 150)
- && node.parent.parent.kind === 221;
- }
- return false;
+ function isUnaryExpression(node) {
+ return isUnaryExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
}
- ts.nodeCanBeDecorated = nodeCanBeDecorated;
- function nodeIsDecorated(node) {
- return node.decorators !== undefined
- && nodeCanBeDecorated(node);
+ ts.isUnaryExpression = isUnaryExpression;
+ function isExpressionKind(kind) {
+ return kind === 189
+ || kind === 191
+ || kind === 181
+ || kind === 188
+ || kind === 192
+ || kind === 196
+ || kind === 194
+ || isUnaryExpressionKind(kind);
}
- ts.nodeIsDecorated = nodeIsDecorated;
- function nodeOrChildIsDecorated(node) {
- return nodeIsDecorated(node) || childIsDecorated(node);
+ function isExpression(node) {
+ return isExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
}
- ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
- function childIsDecorated(node) {
- switch (node.kind) {
- case 221:
- return ts.forEach(node.members, nodeOrChildIsDecorated);
- case 147:
- case 150:
- return ts.forEach(node.parameters, nodeIsDecorated);
- }
+ ts.isExpression = isExpression;
+ function isAssertionExpression(node) {
+ var kind = node.kind;
+ return kind === 178
+ || kind === 196;
}
- ts.childIsDecorated = childIsDecorated;
- function isJSXTagName(node) {
- var parent = node.parent;
- if (parent.kind === 243 ||
- parent.kind === 242 ||
- parent.kind === 245) {
- return parent.tagName === node;
- }
- return false;
+ ts.isAssertionExpression = isAssertionExpression;
+ function isPartiallyEmittedExpression(node) {
+ return node.kind === 288;
}
- ts.isJSXTagName = isJSXTagName;
- function isPartOfExpression(node) {
- switch (node.kind) {
- case 97:
- case 95:
- case 93:
- case 99:
- case 84:
- case 10:
- case 170:
- case 171:
- case 172:
- case 173:
- case 174:
- case 175:
- case 176:
- case 195:
- case 177:
- case 196:
- case 178:
- case 179:
- case 192:
- case 180:
- case 183:
- case 181:
- case 182:
- case 185:
- case 186:
- case 187:
- case 188:
- case 191:
- case 189:
- case 11:
- case 193:
- case 241:
- case 242:
- case 190:
- case 184:
- return true;
- case 139:
- while (node.parent.kind === 139) {
- node = node.parent;
- }
- return node.parent.kind === 158 || isJSXTagName(node);
- case 69:
- if (node.parent.kind === 158 || isJSXTagName(node)) {
- return true;
- }
- case 8:
- case 9:
- case 97:
- var parent_4 = node.parent;
- switch (parent_4.kind) {
- case 218:
- case 142:
- case 145:
- case 144:
- case 255:
- case 253:
- case 169:
- return parent_4.initializer === node;
- case 202:
- case 203:
- case 204:
- case 205:
- case 211:
- case 212:
- case 213:
- case 249:
- case 215:
- case 213:
- return parent_4.expression === node;
- case 206:
- var forStatement = parent_4;
- return (forStatement.initializer === node && forStatement.initializer.kind !== 219) ||
- forStatement.condition === node ||
- forStatement.incrementor === node;
- case 207:
- case 208:
- var forInStatement = parent_4;
- return (forInStatement.initializer === node && forInStatement.initializer.kind !== 219) ||
- forInStatement.expression === node;
- case 177:
- case 195:
- return node === parent_4.expression;
- case 197:
- return node === parent_4.expression;
- case 140:
- return node === parent_4.expression;
- case 143:
- case 248:
- case 247:
- return true;
- case 194:
- return parent_4.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_4);
- default:
- if (isPartOfExpression(parent_4)) {
- return true;
- }
- }
- }
- return false;
+ ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
+ function isNotEmittedStatement(node) {
+ return node.kind === 287;
}
- ts.isPartOfExpression = isPartOfExpression;
- function isInstantiatedModule(node, preserveConstEnums) {
- var moduleState = ts.getModuleInstanceState(node);
- return moduleState === 1 ||
- (preserveConstEnums && moduleState === 2);
+ ts.isNotEmittedStatement = isNotEmittedStatement;
+ function isNotEmittedOrPartiallyEmittedNode(node) {
+ return isNotEmittedStatement(node)
+ || isPartiallyEmittedExpression(node);
}
- ts.isInstantiatedModule = isInstantiatedModule;
- function isExternalModuleImportEqualsDeclaration(node) {
- return node.kind === 229 && node.moduleReference.kind === 240;
+ ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
+ function isOmittedExpression(node) {
+ return node.kind === 194;
}
- ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
- function getExternalModuleImportEqualsDeclarationExpression(node) {
- ts.Debug.assert(isExternalModuleImportEqualsDeclaration(node));
- return node.moduleReference.expression;
+ ts.isOmittedExpression = isOmittedExpression;
+ function isTemplateSpan(node) {
+ return node.kind === 198;
}
- ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
- function isInternalModuleImportEqualsDeclaration(node) {
- return node.kind === 229 && node.moduleReference.kind !== 240;
+ ts.isTemplateSpan = isTemplateSpan;
+ function isBlock(node) {
+ return node.kind === 200;
}
- ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
- function isSourceFileJavaScript(file) {
- return isInJavaScriptFile(file);
+ ts.isBlock = isBlock;
+ function isConciseBody(node) {
+ return isBlock(node)
+ || isExpression(node);
}
- ts.isSourceFileJavaScript = isSourceFileJavaScript;
- function isInJavaScriptFile(node) {
- return node && !!(node.flags & 1048576);
+ ts.isConciseBody = isConciseBody;
+ function isFunctionBody(node) {
+ return isBlock(node);
}
- ts.isInJavaScriptFile = isInJavaScriptFile;
- function isRequireCall(expression, checkArgumentIsStringLiteral) {
- var isRequire = expression.kind === 174 &&
- expression.expression.kind === 69 &&
- expression.expression.text === "require" &&
- expression.arguments.length === 1;
- return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9);
+ ts.isFunctionBody = isFunctionBody;
+ function isForInitializer(node) {
+ return isVariableDeclarationList(node)
+ || isExpression(node);
}
- ts.isRequireCall = isRequireCall;
- function isSingleOrDoubleQuote(charCode) {
- return charCode === 39 || charCode === 34;
+ ts.isForInitializer = isForInitializer;
+ function isVariableDeclaration(node) {
+ return node.kind === 219;
}
- ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote;
- function isDeclarationOfFunctionExpression(s) {
- if (s.valueDeclaration && s.valueDeclaration.kind === 218) {
- var declaration = s.valueDeclaration;
- return declaration.initializer && declaration.initializer.kind === 179;
- }
- return false;
+ ts.isVariableDeclaration = isVariableDeclaration;
+ function isVariableDeclarationList(node) {
+ return node.kind === 220;
}
- ts.isDeclarationOfFunctionExpression = isDeclarationOfFunctionExpression;
- function getSpecialPropertyAssignmentKind(expression) {
- if (!isInJavaScriptFile(expression)) {
- return 0;
- }
- if (expression.kind !== 187) {
- return 0;
- }
- var expr = expression;
- if (expr.operatorToken.kind !== 56 || expr.left.kind !== 172) {
- return 0;
- }
- var lhs = expr.left;
- if (lhs.expression.kind === 69) {
- var lhsId = lhs.expression;
- if (lhsId.text === "exports") {
- return 1;
- }
- else if (lhsId.text === "module" && lhs.name.text === "exports") {
- return 2;
- }
- }
- else if (lhs.expression.kind === 97) {
- return 4;
- }
- else if (lhs.expression.kind === 172) {
- var innerPropertyAccess = lhs.expression;
- if (innerPropertyAccess.expression.kind === 69) {
- var innerPropertyAccessIdentifier = innerPropertyAccess.expression;
- if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") {
- return 1;
- }
- if (innerPropertyAccess.name.text === "prototype") {
- return 3;
- }
- }
- }
- return 0;
+ ts.isVariableDeclarationList = isVariableDeclarationList;
+ function isCaseBlock(node) {
+ return node.kind === 228;
}
- ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind;
- function getExternalModuleName(node) {
- if (node.kind === 230) {
- return node.moduleSpecifier;
- }
- if (node.kind === 229) {
- var reference = node.moduleReference;
- if (reference.kind === 240) {
- return reference.expression;
- }
- }
- if (node.kind === 236) {
- return node.moduleSpecifier;
- }
- if (node.kind === 225 && node.name.kind === 9) {
- return node.name;
- }
+ ts.isCaseBlock = isCaseBlock;
+ function isModuleBody(node) {
+ var kind = node.kind;
+ return kind === 227
+ || kind === 226;
}
- ts.getExternalModuleName = getExternalModuleName;
- function getNamespaceDeclarationNode(node) {
- if (node.kind === 229) {
- return node;
- }
- var importClause = node.importClause;
- if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 232) {
- return importClause.namedBindings;
- }
+ ts.isModuleBody = isModuleBody;
+ function isImportEqualsDeclaration(node) {
+ return node.kind === 230;
}
- ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
- function isDefaultImport(node) {
- return node.kind === 230
- && node.importClause
- && !!node.importClause.name;
+ ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
+ function isImportClause(node) {
+ return node.kind === 232;
}
- ts.isDefaultImport = isDefaultImport;
- function hasQuestionToken(node) {
- if (node) {
- switch (node.kind) {
- case 142:
- case 147:
- case 146:
- case 254:
- case 253:
- case 145:
- case 144:
- return node.questionToken !== undefined;
- }
- }
- return false;
+ ts.isImportClause = isImportClause;
+ function isNamedImportBindings(node) {
+ var kind = node.kind;
+ return kind === 234
+ || kind === 233;
}
- ts.hasQuestionToken = hasQuestionToken;
- function isJSDocConstructSignature(node) {
- return node.kind === 269 &&
- node.parameters.length > 0 &&
- node.parameters[0].type.kind === 271;
+ ts.isNamedImportBindings = isNamedImportBindings;
+ function isImportSpecifier(node) {
+ return node.kind === 235;
}
- ts.isJSDocConstructSignature = isJSDocConstructSignature;
- function getJSDocTag(node, kind, checkParentVariableStatement) {
- if (!node) {
- return undefined;
- }
- var jsDocTags = getJSDocTags(node, checkParentVariableStatement);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) {
- var tag = jsDocTags_1[_i];
- if (tag.kind === kind) {
- return tag;
- }
- }
+ ts.isImportSpecifier = isImportSpecifier;
+ function isNamedExports(node) {
+ return node.kind === 238;
}
- function append(previous, additional) {
- if (additional) {
- if (!previous) {
- previous = [];
- }
- for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) {
- var x = additional_1[_i];
- previous.push(x);
- }
- }
- return previous;
+ ts.isNamedExports = isNamedExports;
+ function isExportSpecifier(node) {
+ return node.kind === 239;
}
- function getJSDocComments(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); });
+ ts.isExportSpecifier = isExportSpecifier;
+ function isModuleOrEnumDeclaration(node) {
+ return node.kind === 226 || node.kind === 225;
}
- ts.getJSDocComments = getJSDocComments;
- function getJSDocTags(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) {
- var result = [];
- for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) {
- var doc = docs_1[_i];
- if (doc.tags) {
- result.push.apply(result, doc.tags);
- }
- }
- return result;
- }, function (tags) { return tags; });
- }
- function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) {
- var result = undefined;
- if (checkParentVariableStatement) {
- var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) &&
- (node.parent).initializer === node &&
- node.parent.parent.parent.kind === 200;
- var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&
- node.parent.parent.kind === 200;
- var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent :
- isVariableOfVariableDeclarationStatement ? node.parent.parent :
- undefined;
- if (variableStatementNode) {
- result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags));
- }
- if (node.kind === 225 &&
- node.parent && node.parent.kind === 225) {
- result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags));
- }
- var parent_5 = node.parent;
- var isSourceOfAssignmentExpressionStatement = parent_5 && parent_5.parent &&
- parent_5.kind === 187 &&
- parent_5.operatorToken.kind === 56 &&
- parent_5.parent.kind === 202;
- if (isSourceOfAssignmentExpressionStatement) {
- result = append(result, getJSDocs(parent_5.parent, checkParentVariableStatement, getDocs, getTags));
- }
- var isPropertyAssignmentExpression = parent_5 && parent_5.kind === 253;
- if (isPropertyAssignmentExpression) {
- result = append(result, getJSDocs(parent_5, checkParentVariableStatement, getDocs, getTags));
- }
- if (node.kind === 142) {
- var paramTags = getJSDocParameterTag(node, checkParentVariableStatement);
- if (paramTags) {
- result = append(result, getTags(paramTags));
- }
- }
- }
- if (isVariableLike(node) && node.initializer) {
- result = append(result, getJSDocs(node.initializer, false, getDocs, getTags));
- }
- if (node.jsDocComments) {
- if (result) {
- result = append(result, getDocs(node.jsDocComments));
- }
- else {
- return getDocs(node.jsDocComments);
- }
- }
- return result;
+ ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
+ function isDeclarationKind(kind) {
+ return kind === 181
+ || kind === 170
+ || kind === 222
+ || kind === 193
+ || kind === 149
+ || kind === 225
+ || kind === 255
+ || kind === 239
+ || kind === 221
+ || kind === 180
+ || kind === 150
+ || kind === 232
+ || kind === 230
+ || kind === 235
+ || kind === 223
+ || kind === 148
+ || kind === 147
+ || kind === 226
+ || kind === 229
+ || kind === 233
+ || kind === 143
+ || kind === 253
+ || kind === 146
+ || kind === 145
+ || kind === 151
+ || kind === 254
+ || kind === 224
+ || kind === 142
+ || kind === 219
+ || kind === 279;
}
- function getJSDocParameterTag(param, checkParentVariableStatement) {
- var func = param.parent;
- var tags = getJSDocTags(func, checkParentVariableStatement);
- if (!param.name) {
- var i = func.parameters.indexOf(param);
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 275; });
- if (paramTags && 0 <= i && i < paramTags.length) {
- return [paramTags[i]];
- }
- }
- else if (param.name.kind === 69) {
- var name_9 = param.name.text;
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 275 && tag.parameterName.text === name_9; });
- if (paramTags) {
- return paramTags;
- }
- }
- else {
- return undefined;
- }
+ function isDeclarationStatementKind(kind) {
+ return kind === 221
+ || kind === 240
+ || kind === 222
+ || kind === 223
+ || kind === 224
+ || kind === 225
+ || kind === 226
+ || kind === 231
+ || kind === 230
+ || kind === 237
+ || kind === 236
+ || kind === 229;
}
- function getJSDocTypeTag(node) {
- return getJSDocTag(node, 277, false);
+ function isStatementKindButNotDeclarationKind(kind) {
+ return kind === 211
+ || kind === 210
+ || kind === 218
+ || kind === 205
+ || kind === 203
+ || kind === 202
+ || kind === 208
+ || kind === 209
+ || kind === 207
+ || kind === 204
+ || kind === 215
+ || kind === 212
+ || kind === 214
+ || kind === 216
+ || kind === 217
+ || kind === 201
+ || kind === 206
+ || kind === 213
+ || kind === 287;
}
- ts.getJSDocTypeTag = getJSDocTypeTag;
- function getJSDocReturnTag(node) {
- return getJSDocTag(node, 276, true);
+ function isDeclaration(node) {
+ return isDeclarationKind(node.kind);
}
- ts.getJSDocReturnTag = getJSDocReturnTag;
- function getJSDocTemplateTag(node) {
- return getJSDocTag(node, 278, false);
+ ts.isDeclaration = isDeclaration;
+ function isDeclarationStatement(node) {
+ return isDeclarationStatementKind(node.kind);
}
- ts.getJSDocTemplateTag = getJSDocTemplateTag;
- function getCorrespondingJSDocParameterTag(parameter) {
- if (parameter.name && parameter.name.kind === 69) {
- var parameterName = parameter.name.text;
- var jsDocTags = getJSDocTags(parameter.parent, true);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) {
- var tag = jsDocTags_2[_i];
- if (tag.kind === 275) {
- var parameterTag = tag;
- if (parameterTag.parameterName.text === parameterName) {
- return parameterTag;
- }
- }
- }
- }
- return undefined;
+ ts.isDeclarationStatement = isDeclarationStatement;
+ function isStatementButNotDeclaration(node) {
+ return isStatementKindButNotDeclarationKind(node.kind);
}
- ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag;
- function hasRestParameter(s) {
- return isRestParameter(ts.lastOrUndefined(s.parameters));
+ ts.isStatementButNotDeclaration = isStatementButNotDeclaration;
+ function isStatement(node) {
+ var kind = node.kind;
+ return isStatementKindButNotDeclarationKind(kind)
+ || isDeclarationStatementKind(kind)
+ || kind === 200;
}
- ts.hasRestParameter = hasRestParameter;
- function hasDeclaredRestParameter(s) {
- return isDeclaredRestParam(ts.lastOrUndefined(s.parameters));
+ ts.isStatement = isStatement;
+ function isModuleReference(node) {
+ var kind = node.kind;
+ return kind === 241
+ || kind === 140
+ || kind === 70;
}
- ts.hasDeclaredRestParameter = hasDeclaredRestParameter;
- function isRestParameter(node) {
- if (node && (node.flags & 1048576)) {
- if (node.type && node.type.kind === 270) {
- return true;
- }
- var paramTag = getCorrespondingJSDocParameterTag(node);
- if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 270;
- }
- }
- return isDeclaredRestParam(node);
+ ts.isModuleReference = isModuleReference;
+ function isJsxOpeningElement(node) {
+ return node.kind === 244;
}
- ts.isRestParameter = isRestParameter;
- function isDeclaredRestParam(node) {
- return node && node.dotDotDotToken !== undefined;
+ ts.isJsxOpeningElement = isJsxOpeningElement;
+ function isJsxClosingElement(node) {
+ return node.kind === 245;
}
- ts.isDeclaredRestParam = isDeclaredRestParam;
- function isAssignmentTarget(node) {
- while (node.parent.kind === 178) {
- node = node.parent;
- }
- while (true) {
- var parent_6 = node.parent;
- if (parent_6.kind === 170 || parent_6.kind === 191) {
- node = parent_6;
- continue;
- }
- if (parent_6.kind === 253 || parent_6.kind === 254) {
- node = parent_6.parent;
- continue;
- }
- return parent_6.kind === 187 &&
- isAssignmentOperator(parent_6.operatorToken.kind) &&
- parent_6.left === node ||
- (parent_6.kind === 207 || parent_6.kind === 208) &&
- parent_6.initializer === node;
- }
+ ts.isJsxClosingElement = isJsxClosingElement;
+ function isJsxTagNameExpression(node) {
+ var kind = node.kind;
+ return kind === 98
+ || kind === 70
+ || kind === 173;
}
- ts.isAssignmentTarget = isAssignmentTarget;
- function isNodeDescendantOf(node, ancestor) {
- while (node) {
- if (node === ancestor)
- return true;
- node = node.parent;
- }
- return false;
+ ts.isJsxTagNameExpression = isJsxTagNameExpression;
+ function isJsxChild(node) {
+ var kind = node.kind;
+ return kind === 242
+ || kind === 248
+ || kind === 243
+ || kind === 10;
}
- ts.isNodeDescendantOf = isNodeDescendantOf;
- function isInAmbientContext(node) {
- while (node) {
- if (hasModifier(node, 2) || (node.kind === 256 && node.isDeclarationFile)) {
- return true;
- }
- node = node.parent;
- }
- return false;
+ ts.isJsxChild = isJsxChild;
+ function isJsxAttributeLike(node) {
+ var kind = node.kind;
+ return kind === 246
+ || kind === 247;
}
- ts.isInAmbientContext = isInAmbientContext;
- function isDeclarationName(name) {
- if (name.kind !== 69 && name.kind !== 9 && name.kind !== 8) {
- return false;
- }
- var parent = name.parent;
- if (parent.kind === 234 || parent.kind === 238) {
- if (parent.propertyName) {
- return true;
- }
- }
- if (isDeclaration(parent)) {
- return parent.name === name;
- }
- return false;
+ ts.isJsxAttributeLike = isJsxAttributeLike;
+ function isJsxSpreadAttribute(node) {
+ return node.kind === 247;
}
- ts.isDeclarationName = isDeclarationName;
- function isLiteralComputedPropertyDeclarationName(node) {
- return (node.kind === 9 || node.kind === 8) &&
- node.parent.kind === 140 &&
- isDeclaration(node.parent.parent);
+ ts.isJsxSpreadAttribute = isJsxSpreadAttribute;
+ function isJsxAttribute(node) {
+ return node.kind === 246;
}
- ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
- function isIdentifierName(node) {
- var parent = node.parent;
- switch (parent.kind) {
- case 145:
- case 144:
- case 147:
- case 146:
- case 149:
- case 150:
- case 255:
- case 253:
- case 172:
- return parent.name === node;
- case 139:
- if (parent.right === node) {
- while (parent.kind === 139) {
- parent = parent.parent;
- }
- return parent.kind === 158;
- }
- return false;
- case 169:
- case 234:
- return parent.propertyName === node;
- case 238:
- return true;
- }
- return false;
+ ts.isJsxAttribute = isJsxAttribute;
+ function isStringLiteralOrJsxExpression(node) {
+ var kind = node.kind;
+ return kind === 9
+ || kind === 248;
}
- ts.isIdentifierName = isIdentifierName;
- function isAliasSymbolDeclaration(node) {
- return node.kind === 229 ||
- node.kind === 228 ||
- node.kind === 231 && !!node.name ||
- node.kind === 232 ||
- node.kind === 234 ||
- node.kind === 238 ||
- node.kind === 235 && exportAssignmentIsAlias(node);
+ ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
+ function isCaseOrDefaultClause(node) {
+ var kind = node.kind;
+ return kind === 249
+ || kind === 250;
}
- ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
- function exportAssignmentIsAlias(node) {
- return isEntityNameExpression(node.expression);
+ ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
+ function isHeritageClause(node) {
+ return node.kind === 251;
}
- ts.exportAssignmentIsAlias = exportAssignmentIsAlias;
- function getClassExtendsHeritageClauseElement(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 83);
- return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
+ ts.isHeritageClause = isHeritageClause;
+ function isCatchClause(node) {
+ return node.kind === 252;
}
- ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement;
- function getClassImplementsHeritageClauseElements(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 106);
- return heritageClause ? heritageClause.types : undefined;
+ ts.isCatchClause = isCatchClause;
+ function isPropertyAssignment(node) {
+ return node.kind === 253;
}
- ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;
- function getInterfaceBaseTypeNodes(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 83);
- return heritageClause ? heritageClause.types : undefined;
+ ts.isPropertyAssignment = isPropertyAssignment;
+ function isShorthandPropertyAssignment(node) {
+ return node.kind === 254;
}
- ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;
- function getHeritageClause(clauses, kind) {
- if (clauses) {
- for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) {
- var clause = clauses_1[_i];
- if (clause.token === kind) {
- return clause;
- }
- }
- }
- return undefined;
+ ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;
+ function isEnumMember(node) {
+ return node.kind === 255;
}
- ts.getHeritageClause = getHeritageClause;
- function tryResolveScriptReference(host, sourceFile, reference) {
- if (!host.getCompilerOptions().noResolve) {
- var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName);
- return host.getSourceFile(referenceFileName);
- }
+ ts.isEnumMember = isEnumMember;
+ function isSourceFile(node) {
+ return node.kind === 256;
}
- ts.tryResolveScriptReference = tryResolveScriptReference;
- function getAncestor(node, kind) {
- while (node) {
- if (node.kind === kind) {
- return node;
- }
- node = node.parent;
- }
- return undefined;
+ ts.isSourceFile = isSourceFile;
+ function isWatchSet(options) {
+ return options.watch && options.hasOwnProperty("watch");
}
- ts.getAncestor = getAncestor;
- function getFileReferenceFromReferencePath(comment, commentRange) {
- var simpleReferenceRegEx = /^\/\/\/\s*/gim;
- if (simpleReferenceRegEx.test(comment)) {
- if (isNoDefaultLibRegEx.test(comment)) {
- return {
- isNoDefaultLib: true
- };
- }
- else {
- var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment);
- var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment);
- if (refMatchResult || refLibResult) {
- var start = commentRange.pos;
- var end = commentRange.end;
- return {
- fileReference: {
- pos: start,
- end: end,
- fileName: (refMatchResult || refLibResult)[3]
- },
- isNoDefaultLib: false,
- isTypeReferenceDirective: !!refLibResult
- };
- }
- return {
- diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax,
- isNoDefaultLib: false
- };
- }
+ ts.isWatchSet = isWatchSet;
+})(ts || (ts = {}));
+(function (ts) {
+ function getDefaultLibFileName(options) {
+ switch (options.target) {
+ case 4:
+ return "lib.es2017.d.ts";
+ case 3:
+ return "lib.es2016.d.ts";
+ case 2:
+ return "lib.es6.d.ts";
+ default:
+ return "lib.d.ts";
}
- return undefined;
- }
- ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath;
- function isKeyword(token) {
- return 70 <= token && token <= 138;
}
- ts.isKeyword = isKeyword;
- function isTrivia(token) {
- return 2 <= token && token <= 7;
- }
- ts.isTrivia = isTrivia;
- function isAsyncFunctionLike(node) {
- return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node);
+ ts.getDefaultLibFileName = getDefaultLibFileName;
+ function textSpanEnd(span) {
+ return span.start + span.length;
}
- ts.isAsyncFunctionLike = isAsyncFunctionLike;
- function isStringOrNumericLiteral(kind) {
- return kind === 9 || kind === 8;
+ ts.textSpanEnd = textSpanEnd;
+ function textSpanIsEmpty(span) {
+ return span.length === 0;
}
- ts.isStringOrNumericLiteral = isStringOrNumericLiteral;
- function hasDynamicName(declaration) {
- return declaration.name && isDynamicName(declaration.name);
+ ts.textSpanIsEmpty = textSpanIsEmpty;
+ function textSpanContainsPosition(span, position) {
+ return position >= span.start && position < textSpanEnd(span);
}
- ts.hasDynamicName = hasDynamicName;
- function isDynamicName(name) {
- return name.kind === 140 &&
- !isStringOrNumericLiteral(name.expression.kind) &&
- !isWellKnownSymbolSyntactically(name.expression);
+ ts.textSpanContainsPosition = textSpanContainsPosition;
+ function textSpanContainsTextSpan(span, other) {
+ return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);
}
- ts.isDynamicName = isDynamicName;
- function isWellKnownSymbolSyntactically(node) {
- return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression);
+ ts.textSpanContainsTextSpan = textSpanContainsTextSpan;
+ function textSpanOverlapsWith(span, other) {
+ var overlapStart = Math.max(span.start, other.start);
+ var overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other));
+ return overlapStart < overlapEnd;
}
- ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;
- function getPropertyNameForPropertyNameNode(name) {
- if (name.kind === 69 || name.kind === 9 || name.kind === 8 || name.kind === 142) {
- return name.text;
- }
- if (name.kind === 140) {
- var nameExpression = name.expression;
- if (isWellKnownSymbolSyntactically(nameExpression)) {
- var rightHandSideName = nameExpression.name.text;
- return getPropertyNameForKnownSymbolName(rightHandSideName);
- }
- else if (nameExpression.kind === 9 || nameExpression.kind === 8) {
- return nameExpression.text;
- }
+ ts.textSpanOverlapsWith = textSpanOverlapsWith;
+ function textSpanOverlap(span1, span2) {
+ var overlapStart = Math.max(span1.start, span2.start);
+ var overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));
+ if (overlapStart < overlapEnd) {
+ return createTextSpanFromBounds(overlapStart, overlapEnd);
}
return undefined;
}
- ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;
- function getPropertyNameForKnownSymbolName(symbolName) {
- return "__@" + symbolName;
+ ts.textSpanOverlap = textSpanOverlap;
+ function textSpanIntersectsWithTextSpan(span, other) {
+ return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start;
}
- ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName;
- function isESSymbolIdentifier(node) {
- return node.kind === 69 && node.text === "Symbol";
+ ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan;
+ function textSpanIntersectsWith(span, start, length) {
+ var end = start + length;
+ return start <= textSpanEnd(span) && end >= span.start;
}
- ts.isESSymbolIdentifier = isESSymbolIdentifier;
- function isModifierKind(token) {
- switch (token) {
- case 115:
- case 118:
- case 74:
- case 122:
- case 77:
- case 82:
- case 112:
- case 110:
- case 111:
- case 128:
- case 113:
- return true;
- }
- return false;
+ ts.textSpanIntersectsWith = textSpanIntersectsWith;
+ function decodedTextSpanIntersectsWith(start1, length1, start2, length2) {
+ var end1 = start1 + length1;
+ var end2 = start2 + length2;
+ return start2 <= end1 && end2 >= start1;
}
- ts.isModifierKind = isModifierKind;
- function isParameterDeclaration(node) {
- var root = getRootDeclaration(node);
- return root.kind === 142;
+ ts.decodedTextSpanIntersectsWith = decodedTextSpanIntersectsWith;
+ function textSpanIntersectsWithPosition(span, position) {
+ return position <= textSpanEnd(span) && position >= span.start;
}
- ts.isParameterDeclaration = isParameterDeclaration;
- function getRootDeclaration(node) {
- while (node.kind === 169) {
- node = node.parent.parent;
+ ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition;
+ function textSpanIntersection(span1, span2) {
+ var intersectStart = Math.max(span1.start, span2.start);
+ var intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));
+ if (intersectStart <= intersectEnd) {
+ return createTextSpanFromBounds(intersectStart, intersectEnd);
}
- return node;
+ return undefined;
}
- ts.getRootDeclaration = getRootDeclaration;
- function nodeStartsNewLexicalEnvironment(node) {
- var kind = node.kind;
- return kind === 148
- || kind === 179
- || kind === 220
- || kind === 180
- || kind === 147
- || kind === 149
- || kind === 150
- || kind === 225
- || kind === 256;
+ ts.textSpanIntersection = textSpanIntersection;
+ function createTextSpan(start, length) {
+ if (start < 0) {
+ throw new Error("start < 0");
+ }
+ if (length < 0) {
+ throw new Error("length < 0");
+ }
+ return { start: start, length: length };
}
- ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
- function nodeIsSynthesized(node) {
- return ts.positionIsSynthesized(node.pos)
- || ts.positionIsSynthesized(node.end);
+ ts.createTextSpan = createTextSpan;
+ function createTextSpanFromBounds(start, end) {
+ return createTextSpan(start, end - start);
}
- ts.nodeIsSynthesized = nodeIsSynthesized;
- function getOriginalNode(node) {
- if (node) {
- while (node.original !== undefined) {
- node = node.original;
- }
- }
- return node;
+ ts.createTextSpanFromBounds = createTextSpanFromBounds;
+ function textChangeRangeNewSpan(range) {
+ return createTextSpan(range.span.start, range.newLength);
}
- ts.getOriginalNode = getOriginalNode;
- function isParseTreeNode(node) {
- return (node.flags & 8) === 0;
+ ts.textChangeRangeNewSpan = textChangeRangeNewSpan;
+ function textChangeRangeIsUnchanged(range) {
+ return textSpanIsEmpty(range.span) && range.newLength === 0;
}
- ts.isParseTreeNode = isParseTreeNode;
- function getParseTreeNode(node, nodeTest) {
- if (isParseTreeNode(node)) {
- return node;
+ ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged;
+ function createTextChangeRange(span, newLength) {
+ if (newLength < 0) {
+ throw new Error("newLength < 0");
}
- node = getOriginalNode(node);
- if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) {
- return node;
+ return { span: span, newLength: newLength };
+ }
+ ts.createTextChangeRange = createTextChangeRange;
+ ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0);
+ function collapseTextChangeRangesAcrossMultipleVersions(changes) {
+ if (changes.length === 0) {
+ return ts.unchangedTextChangeRange;
}
- return undefined;
+ if (changes.length === 1) {
+ return changes[0];
+ }
+ var change0 = changes[0];
+ var oldStartN = change0.span.start;
+ var oldEndN = textSpanEnd(change0.span);
+ var newEndN = oldStartN + change0.newLength;
+ for (var i = 1; i < changes.length; i++) {
+ var nextChange = changes[i];
+ var oldStart1 = oldStartN;
+ var oldEnd1 = oldEndN;
+ var newEnd1 = newEndN;
+ var oldStart2 = nextChange.span.start;
+ var oldEnd2 = textSpanEnd(nextChange.span);
+ var newEnd2 = oldStart2 + nextChange.newLength;
+ oldStartN = Math.min(oldStart1, oldStart2);
+ oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1));
+ newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));
+ }
+ return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN);
}
- ts.getParseTreeNode = getParseTreeNode;
- function getOriginalSourceFiles(sourceFiles) {
- var originalSourceFiles = [];
- for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
- var sourceFile = sourceFiles_1[_i];
- var originalSourceFile = getParseTreeNode(sourceFile, isSourceFile);
- if (originalSourceFile) {
- originalSourceFiles.push(originalSourceFile);
+ ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
+ function getTypeParameterOwner(d) {
+ if (d && d.kind === 142) {
+ for (var current = d; current; current = current.parent) {
+ if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 223) {
+ return current;
+ }
}
}
- return originalSourceFiles;
- }
- ts.getOriginalSourceFiles = getOriginalSourceFiles;
- function getOriginalNodeId(node) {
- node = getOriginalNode(node);
- return node ? ts.getNodeId(node) : 0;
}
- ts.getOriginalNodeId = getOriginalNodeId;
- function getExpressionAssociativity(expression) {
- var operator = getOperator(expression);
- var hasArguments = expression.kind === 175 && expression.arguments !== undefined;
- return getOperatorAssociativity(expression.kind, operator, hasArguments);
+ ts.getTypeParameterOwner = getTypeParameterOwner;
+ function isParameterPropertyDeclaration(node) {
+ return ts.hasModifier(node, 92) && node.parent.kind === 149 && ts.isClassLike(node.parent.parent);
}
- ts.getExpressionAssociativity = getExpressionAssociativity;
- function getOperatorAssociativity(kind, operator, hasArguments) {
- switch (kind) {
- case 175:
- return hasArguments ? 0 : 1;
- case 185:
- case 182:
- case 183:
- case 181:
- case 184:
- case 188:
- case 190:
- return 1;
- case 187:
- switch (operator) {
- case 38:
- case 56:
- case 57:
- case 58:
- case 60:
- case 59:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 68:
- case 67:
- return 1;
- }
+ ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
+ function walkUpBindingElementsAndPatterns(node) {
+ while (node && (node.kind === 170 || ts.isBindingPattern(node))) {
+ node = node.parent;
}
- return 0;
- }
- ts.getOperatorAssociativity = getOperatorAssociativity;
- function getExpressionPrecedence(expression) {
- var operator = getOperator(expression);
- var hasArguments = expression.kind === 175 && expression.arguments !== undefined;
- return getOperatorPrecedence(expression.kind, operator, hasArguments);
+ return node;
}
- ts.getExpressionPrecedence = getExpressionPrecedence;
- function getOperator(expression) {
- if (expression.kind === 187) {
- return expression.operatorToken.kind;
+ function getCombinedModifierFlags(node) {
+ node = walkUpBindingElementsAndPatterns(node);
+ var flags = ts.getModifierFlags(node);
+ if (node.kind === 219) {
+ node = node.parent;
}
- else if (expression.kind === 185 || expression.kind === 186) {
- return expression.operator;
+ if (node && node.kind === 220) {
+ flags |= ts.getModifierFlags(node);
+ node = node.parent;
}
- else {
- return expression.kind;
+ if (node && node.kind === 201) {
+ flags |= ts.getModifierFlags(node);
}
+ return flags;
}
- ts.getOperator = getOperator;
- function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
- switch (nodeKind) {
- case 97:
- case 95:
- case 69:
- case 93:
- case 99:
- case 84:
- case 8:
- case 9:
- case 170:
- case 171:
- case 179:
- case 180:
- case 192:
- case 241:
- case 242:
- case 10:
- case 11:
- case 189:
- case 178:
- case 193:
- return 19;
- case 176:
- case 172:
- case 173:
- return 18;
- case 175:
- return hasArguments ? 18 : 17;
- case 174:
- return 17;
- case 186:
- return 16;
- case 185:
- case 182:
- case 183:
- case 181:
- case 184:
- return 15;
- case 187:
- switch (operatorKind) {
- case 49:
- case 50:
- return 15;
- case 38:
- case 37:
- case 39:
- case 40:
- return 14;
- case 35:
- case 36:
- return 13;
- case 43:
- case 44:
- case 45:
- return 12;
- case 25:
- case 28:
- case 27:
- case 29:
- case 90:
- case 91:
- return 11;
- case 30:
- case 32:
- case 31:
- case 33:
- return 10;
- case 46:
- return 9;
- case 48:
- return 8;
- case 47:
- return 7;
- case 51:
- return 6;
- case 52:
- return 5;
- case 56:
- case 57:
- case 58:
- case 60:
- case 59:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 68:
- case 67:
- return 3;
- case 24:
- return 0;
- default:
- return -1;
- }
- case 188:
- return 4;
- case 190:
- return 2;
- case 191:
- return 1;
- default:
- return -1;
+ ts.getCombinedModifierFlags = getCombinedModifierFlags;
+ function getCombinedNodeFlags(node) {
+ node = walkUpBindingElementsAndPatterns(node);
+ var flags = node.flags;
+ if (node.kind === 219) {
+ node = node.parent;
}
+ if (node && node.kind === 220) {
+ flags |= node.flags;
+ node = node.parent;
+ }
+ if (node && node.kind === 201) {
+ flags |= node.flags;
+ }
+ return flags;
}
- ts.getOperatorPrecedence = getOperatorPrecedence;
- function createDiagnosticCollection() {
- var nonFileDiagnostics = [];
- var fileDiagnostics = ts.createMap();
- var diagnosticsModified = false;
- var modificationCount = 0;
- return {
- add: add,
- getGlobalDiagnostics: getGlobalDiagnostics,
- getDiagnostics: getDiagnostics,
- getModificationCount: getModificationCount,
- reattachFileDiagnostics: reattachFileDiagnostics
- };
- function getModificationCount() {
- return modificationCount;
+ ts.getCombinedNodeFlags = getCombinedNodeFlags;
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function tokenIsIdentifierOrKeyword(token) {
+ return token >= 70;
+ }
+ ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;
+ var textToToken = ts.createMap({
+ "abstract": 116,
+ "any": 118,
+ "as": 117,
+ "boolean": 121,
+ "break": 71,
+ "case": 72,
+ "catch": 73,
+ "class": 74,
+ "continue": 76,
+ "const": 75,
+ "constructor": 122,
+ "debugger": 77,
+ "declare": 123,
+ "default": 78,
+ "delete": 79,
+ "do": 80,
+ "else": 81,
+ "enum": 82,
+ "export": 83,
+ "extends": 84,
+ "false": 85,
+ "finally": 86,
+ "for": 87,
+ "from": 137,
+ "function": 88,
+ "get": 124,
+ "if": 89,
+ "implements": 107,
+ "import": 90,
+ "in": 91,
+ "instanceof": 92,
+ "interface": 108,
+ "is": 125,
+ "let": 109,
+ "module": 126,
+ "namespace": 127,
+ "never": 128,
+ "new": 93,
+ "null": 94,
+ "number": 131,
+ "package": 110,
+ "private": 111,
+ "protected": 112,
+ "public": 113,
+ "readonly": 129,
+ "require": 130,
+ "global": 138,
+ "return": 95,
+ "set": 132,
+ "static": 114,
+ "string": 133,
+ "super": 96,
+ "switch": 97,
+ "symbol": 134,
+ "this": 98,
+ "throw": 99,
+ "true": 100,
+ "try": 101,
+ "type": 135,
+ "typeof": 102,
+ "undefined": 136,
+ "var": 103,
+ "void": 104,
+ "while": 105,
+ "with": 106,
+ "yield": 115,
+ "async": 119,
+ "await": 120,
+ "of": 139,
+ "{": 16,
+ "}": 17,
+ "(": 18,
+ ")": 19,
+ "[": 20,
+ "]": 21,
+ ".": 22,
+ "...": 23,
+ ";": 24,
+ ",": 25,
+ "<": 26,
+ ">": 28,
+ "<=": 29,
+ ">=": 30,
+ "==": 31,
+ "!=": 32,
+ "===": 33,
+ "!==": 34,
+ "=>": 35,
+ "+": 36,
+ "-": 37,
+ "**": 39,
+ "*": 38,
+ "/": 40,
+ "%": 41,
+ "++": 42,
+ "--": 43,
+ "<<": 44,
+ "": 27,
+ ">>": 45,
+ ">>>": 46,
+ "&": 47,
+ "|": 48,
+ "^": 49,
+ "!": 50,
+ "~": 51,
+ "&&": 52,
+ "||": 53,
+ "?": 54,
+ ":": 55,
+ "=": 57,
+ "+=": 58,
+ "-=": 59,
+ "*=": 60,
+ "**=": 61,
+ "/=": 62,
+ "%=": 63,
+ "<<=": 64,
+ ">>=": 65,
+ ">>>=": 66,
+ "&=": 67,
+ "|=": 68,
+ "^=": 69,
+ "@": 56,
+ });
+ 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;
}
- function reattachFileDiagnostics(newFile) {
- if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) {
- return;
- }
- for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) {
- var diagnostic = _a[_i];
- diagnostic.file = newFile;
+ var lo = 0;
+ var hi = map.length;
+ var mid;
+ while (lo + 1 < hi) {
+ mid = lo + (hi - lo) / 2;
+ mid -= mid % 2;
+ if (map[mid] <= code && code <= map[mid + 1]) {
+ return true;
}
- }
- function add(diagnostic) {
- var diagnostics;
- if (diagnostic.file) {
- diagnostics = fileDiagnostics[diagnostic.file.fileName];
- if (!diagnostics) {
- diagnostics = [];
- fileDiagnostics[diagnostic.file.fileName] = diagnostics;
- }
+ if (code < map[mid]) {
+ hi = mid;
}
else {
- diagnostics = nonFileDiagnostics;
+ lo = mid + 2;
}
- diagnostics.push(diagnostic);
- diagnosticsModified = true;
- modificationCount++;
- }
- function getGlobalDiagnostics() {
- sortAndDeduplicate();
- return nonFileDiagnostics;
}
- function getDiagnostics(fileName) {
- sortAndDeduplicate();
- if (fileName) {
- return fileDiagnostics[fileName] || [];
- }
- var allDiagnostics = [];
- function pushDiagnostic(d) {
- allDiagnostics.push(d);
- }
- ts.forEach(nonFileDiagnostics, pushDiagnostic);
- for (var key in fileDiagnostics) {
- ts.forEach(fileDiagnostics[key], pushDiagnostic);
- }
- return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
+ return false;
+ }
+ function isUnicodeIdentifierStart(code, languageVersion) {
+ return languageVersion >= 1 ?
+ lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierStart);
+ }
+ ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;
+ function isUnicodeIdentifierPart(code, languageVersion) {
+ return languageVersion >= 1 ?
+ lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierPart);
+ }
+ function makeReverseMap(source) {
+ var result = [];
+ for (var name_8 in source) {
+ result[source[name_8]] = name_8;
}
- function sortAndDeduplicate() {
- if (!diagnosticsModified) {
- return;
- }
- diagnosticsModified = false;
- nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics);
- for (var key in fileDiagnostics) {
- fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]);
+ return result;
+ }
+ var tokenStrings = makeReverseMap(textToToken);
+ function tokenToString(t) {
+ return tokenStrings[t];
+ }
+ ts.tokenToString = tokenToString;
+ function stringToToken(s) {
+ return textToToken[s];
+ }
+ ts.stringToToken = stringToToken;
+ function computeLineStarts(text) {
+ var result = new Array();
+ var pos = 0;
+ var lineStart = 0;
+ while (pos < text.length) {
+ var ch = text.charCodeAt(pos);
+ pos++;
+ switch (ch) {
+ case 13:
+ if (text.charCodeAt(pos) === 10) {
+ pos++;
+ }
+ case 10:
+ result.push(lineStart);
+ lineStart = pos;
+ break;
+ default:
+ if (ch > 127 && isLineBreak(ch)) {
+ result.push(lineStart);
+ lineStart = pos;
+ }
+ break;
}
}
+ result.push(lineStart);
+ return result;
}
- ts.createDiagnosticCollection = createDiagnosticCollection;
- var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
- var escapedCharsMap = ts.createMap({
- "\0": "\\0",
- "\t": "\\t",
- "\v": "\\v",
- "\f": "\\f",
- "\b": "\\b",
- "\r": "\\r",
- "\n": "\\n",
- "\\": "\\\\",
- "\"": "\\\"",
- "\u2028": "\\u2028",
- "\u2029": "\\u2029",
- "\u0085": "\\u0085"
- });
- function escapeString(s) {
- s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s;
- return s;
- function getReplacement(c) {
- return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0));
+ ts.computeLineStarts = computeLineStarts;
+ function getPositionOfLineAndCharacter(sourceFile, line, character) {
+ return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character);
+ }
+ ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter;
+ function computePositionOfLineAndCharacter(lineStarts, line, character) {
+ ts.Debug.assert(line >= 0 && line < lineStarts.length);
+ return lineStarts[line] + character;
+ }
+ ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter;
+ function getLineStarts(sourceFile) {
+ return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text));
+ }
+ ts.getLineStarts = getLineStarts;
+ function computeLineAndCharacterOfPosition(lineStarts, position) {
+ var lineNumber = ts.binarySearch(lineStarts, position);
+ if (lineNumber < 0) {
+ lineNumber = ~lineNumber - 1;
+ ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file");
}
+ return {
+ line: lineNumber,
+ character: position - lineStarts[lineNumber]
+ };
}
- ts.escapeString = escapeString;
- function isIntrinsicJsxName(name) {
- var ch = name.substr(0, 1);
- return ch.toLowerCase() === ch;
+ ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition;
+ function getLineAndCharacterOfPosition(sourceFile, position) {
+ return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position);
}
- ts.isIntrinsicJsxName = isIntrinsicJsxName;
- function get16BitUnicodeEscapeSequence(charCode) {
- var hexCharCode = charCode.toString(16).toUpperCase();
- var paddedHexCode = ("0000" + hexCharCode).slice(-4);
- return "\\u" + paddedHexCode;
+ ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition;
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
+ function isWhiteSpace(ch) {
+ return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);
}
- var nonAsciiCharacters = /[^\u0000-\u007F]/g;
- function escapeNonAsciiCharacters(s) {
- return nonAsciiCharacters.test(s) ?
- s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) :
- s;
+ ts.isWhiteSpace = isWhiteSpace;
+ function isWhiteSpaceSingleLine(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;
}
- ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters;
- var indentStrings = ["", " "];
- function getIndentString(level) {
- if (indentStrings[level] === undefined) {
- indentStrings[level] = getIndentString(level - 1) + indentStrings[1];
- }
- return indentStrings[level];
+ ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine;
+ function isLineBreak(ch) {
+ return ch === 10 ||
+ ch === 13 ||
+ ch === 8232 ||
+ ch === 8233;
}
- ts.getIndentString = getIndentString;
- function getIndentSize() {
- return indentStrings[1].length;
+ ts.isLineBreak = isLineBreak;
+ function isDigit(ch) {
+ return ch >= 48 && ch <= 57;
}
- ts.getIndentSize = getIndentSize;
- function createTextWriter(newLine) {
- var output;
- var indent;
- var lineStart;
- var lineCount;
- var linePos;
- function write(s) {
- if (s && s.length) {
- if (lineStart) {
- output += getIndentString(indent);
- lineStart = false;
- }
- output += s;
- }
- }
- function reset() {
- output = "";
- indent = 0;
- lineStart = true;
- lineCount = 0;
- linePos = 0;
+ function isOctalDigit(ch) {
+ return ch >= 48 && ch <= 55;
+ }
+ ts.isOctalDigit = isOctalDigit;
+ function couldStartTrivia(text, pos) {
+ var ch = text.charCodeAt(pos);
+ switch (ch) {
+ case 13:
+ case 10:
+ case 9:
+ case 11:
+ case 12:
+ case 32:
+ case 47:
+ case 60:
+ case 61:
+ case 62:
+ return true;
+ case 35:
+ return pos === 0;
+ default:
+ return ch > 127;
}
- function rawWrite(s) {
- if (s !== undefined) {
- if (lineStart) {
- lineStart = false;
- }
- output += s;
+ }
+ ts.couldStartTrivia = couldStartTrivia;
+ function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) {
+ if (stopAtComments === void 0) { stopAtComments = false; }
+ if (ts.positionIsSynthesized(pos)) {
+ return pos;
+ }
+ while (true) {
+ var ch = text.charCodeAt(pos);
+ switch (ch) {
+ case 13:
+ if (text.charCodeAt(pos + 1) === 10) {
+ pos++;
+ }
+ case 10:
+ pos++;
+ if (stopAfterLineBreak) {
+ return pos;
+ }
+ continue;
+ case 9:
+ case 11:
+ case 12:
+ case 32:
+ pos++;
+ continue;
+ case 47:
+ if (stopAtComments) {
+ break;
+ }
+ if (text.charCodeAt(pos + 1) === 47) {
+ pos += 2;
+ while (pos < text.length) {
+ if (isLineBreak(text.charCodeAt(pos))) {
+ break;
+ }
+ pos++;
+ }
+ continue;
+ }
+ if (text.charCodeAt(pos + 1) === 42) {
+ pos += 2;
+ while (pos < text.length) {
+ if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {
+ pos += 2;
+ break;
+ }
+ pos++;
+ }
+ continue;
+ }
+ break;
+ case 60:
+ case 61:
+ case 62:
+ if (isConflictMarkerTrivia(text, pos)) {
+ pos = scanConflictMarkerTrivia(text, pos);
+ continue;
+ }
+ break;
+ case 35:
+ if (pos === 0 && isShebangTrivia(text, pos)) {
+ pos = scanShebangTrivia(text, pos);
+ continue;
+ }
+ break;
+ default:
+ if (ch > 127 && (isWhiteSpace(ch))) {
+ pos++;
+ continue;
+ }
+ break;
}
+ return pos;
}
- function writeLiteral(s) {
- if (s && s.length) {
- write(s);
- var lineStartsOfS = ts.computeLineStarts(s);
- if (lineStartsOfS.length > 1) {
- lineCount = lineCount + lineStartsOfS.length - 1;
- linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS);
+ }
+ ts.skipTrivia = skipTrivia;
+ var mergeConflictMarkerLength = "<<<<<<<".length;
+ function isConflictMarkerTrivia(text, pos) {
+ ts.Debug.assert(pos >= 0);
+ if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) {
+ var ch = text.charCodeAt(pos);
+ if ((pos + mergeConflictMarkerLength) < text.length) {
+ for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) {
+ if (text.charCodeAt(pos + i) !== ch) {
+ return false;
+ }
}
+ return ch === 61 ||
+ text.charCodeAt(pos + mergeConflictMarkerLength) === 32;
}
}
- function writeLine() {
- if (!lineStart) {
- output += newLine;
- lineCount++;
- linePos = output.length;
- lineStart = true;
+ return false;
+ }
+ function scanConflictMarkerTrivia(text, pos, error) {
+ if (error) {
+ error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength);
+ }
+ var ch = text.charCodeAt(pos);
+ var len = text.length;
+ if (ch === 60 || ch === 62) {
+ while (pos < len && !isLineBreak(text.charCodeAt(pos))) {
+ pos++;
}
}
- function writeTextOfNode(text, node) {
- write(getTextOfNodeFromSourceText(text, node));
+ else {
+ ts.Debug.assert(ch === 61);
+ while (pos < len) {
+ var ch_1 = text.charCodeAt(pos);
+ if (ch_1 === 62 && isConflictMarkerTrivia(text, pos)) {
+ break;
+ }
+ pos++;
+ }
}
- reset();
- return {
- write: write,
- rawWrite: rawWrite,
- writeTextOfNode: writeTextOfNode,
- writeLiteral: writeLiteral,
- writeLine: writeLine,
- increaseIndent: function () { indent++; },
- decreaseIndent: function () { 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; },
- isAtStartOfLine: function () { return lineStart; },
- reset: reset
- };
- }
- ts.createTextWriter = createTextWriter;
- function getResolvedExternalModuleName(host, file) {
- return file.moduleName || getExternalModuleNameFromPath(host, file.fileName);
+ return pos;
}
- ts.getResolvedExternalModuleName = getResolvedExternalModuleName;
- function getExternalModuleNameFromDeclaration(host, resolver, declaration) {
- var file = resolver.getExternalModuleFileFromDeclaration(declaration);
- if (!file || isDeclarationFile(file)) {
- return undefined;
- }
- return getResolvedExternalModuleName(host, file);
+ var shebangTriviaRegex = /^#!.*/;
+ function isShebangTrivia(text, pos) {
+ ts.Debug.assert(pos === 0);
+ return shebangTriviaRegex.test(text);
}
- ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration;
- function getExternalModuleNameFromPath(host, fileName) {
- var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); };
- var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName);
- var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
- var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, false);
- return ts.removeFileExtension(relativePath);
+ function scanShebangTrivia(text, pos) {
+ var shebang = shebangTriviaRegex.exec(text)[0];
+ pos = pos + shebang.length;
+ return pos;
}
- ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath;
- function getOwnEmitOutputFilePath(sourceFile, host, extension) {
- var compilerOptions = host.getCompilerOptions();
- var emitOutputFilePathWithoutExtension;
- if (compilerOptions.outDir) {
- emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir));
+ function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
+ var pendingPos;
+ var pendingEnd;
+ var pendingKind;
+ var pendingHasTrailingNewLine;
+ var hasPendingCommentRange = false;
+ var collecting = trailing || pos === 0;
+ var accumulator = initial;
+ scan: while (pos >= 0 && pos < text.length) {
+ var ch = text.charCodeAt(pos);
+ switch (ch) {
+ case 13:
+ if (text.charCodeAt(pos + 1) === 10) {
+ pos++;
+ }
+ case 10:
+ pos++;
+ if (trailing) {
+ break scan;
+ }
+ collecting = true;
+ if (hasPendingCommentRange) {
+ pendingHasTrailingNewLine = true;
+ }
+ continue;
+ case 9:
+ case 11:
+ case 12:
+ case 32:
+ pos++;
+ continue;
+ case 47:
+ var nextChar = text.charCodeAt(pos + 1);
+ var hasTrailingNewLine = false;
+ if (nextChar === 47 || nextChar === 42) {
+ var kind = nextChar === 47 ? 2 : 3;
+ var startPos = pos;
+ pos += 2;
+ if (nextChar === 47) {
+ while (pos < text.length) {
+ if (isLineBreak(text.charCodeAt(pos))) {
+ hasTrailingNewLine = true;
+ break;
+ }
+ pos++;
+ }
+ }
+ else {
+ while (pos < text.length) {
+ if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {
+ pos += 2;
+ break;
+ }
+ pos++;
+ }
+ }
+ if (collecting) {
+ if (hasPendingCommentRange) {
+ accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);
+ if (!reduce && accumulator) {
+ return accumulator;
+ }
+ hasPendingCommentRange = false;
+ }
+ pendingPos = startPos;
+ pendingEnd = pos;
+ pendingKind = kind;
+ pendingHasTrailingNewLine = hasTrailingNewLine;
+ hasPendingCommentRange = true;
+ }
+ continue;
+ }
+ break scan;
+ default:
+ if (ch > 127 && (isWhiteSpace(ch))) {
+ if (hasPendingCommentRange && isLineBreak(ch)) {
+ pendingHasTrailingNewLine = true;
+ }
+ pos++;
+ continue;
+ }
+ break scan;
+ }
}
- else {
- emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName);
+ if (hasPendingCommentRange) {
+ accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);
}
- return emitOutputFilePathWithoutExtension + extension;
+ return accumulator;
}
- ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath;
- function getDeclarationEmitOutputFilePath(sourceFile, host) {
- var options = host.getCompilerOptions();
- var outputDir = options.declarationDir || options.outDir;
- var path = outputDir
- ? getSourceFilePathInNewDir(sourceFile, host, outputDir)
- : sourceFile.fileName;
- return ts.removeFileExtension(path) + ".d.ts";
+ function forEachLeadingCommentRange(text, pos, cb, state) {
+ return iterateCommentRanges(false, text, pos, false, cb, state);
}
- ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath;
- function getSourceFilesToEmit(host, targetSourceFile) {
- var options = host.getCompilerOptions();
- if (options.outFile || options.out) {
- var moduleKind = ts.getEmitModuleKind(options);
- var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System;
- var sourceFiles = host.getSourceFiles();
- return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule);
- }
- else {
- var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile];
- return ts.filter(sourceFiles, isNonDeclarationFile);
+ ts.forEachLeadingCommentRange = forEachLeadingCommentRange;
+ function forEachTrailingCommentRange(text, pos, cb, state) {
+ return iterateCommentRanges(false, text, pos, true, cb, state);
+ }
+ ts.forEachTrailingCommentRange = forEachTrailingCommentRange;
+ function reduceEachLeadingCommentRange(text, pos, cb, state, initial) {
+ return iterateCommentRanges(true, text, pos, false, cb, state, initial);
+ }
+ ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange;
+ function reduceEachTrailingCommentRange(text, pos, cb, state, initial) {
+ return iterateCommentRanges(true, text, pos, true, cb, state, initial);
+ }
+ ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange;
+ function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) {
+ if (!comments) {
+ comments = [];
}
+ comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind });
+ return comments;
}
- ts.getSourceFilesToEmit = getSourceFilesToEmit;
- function isNonDeclarationFile(sourceFile) {
- return !isDeclarationFile(sourceFile);
+ function getLeadingCommentRanges(text, pos) {
+ return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined);
}
- function isBundleEmitNonExternalModule(sourceFile) {
- return !isDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile);
+ ts.getLeadingCommentRanges = getLeadingCommentRanges;
+ function getTrailingCommentRanges(text, pos) {
+ return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined);
}
- function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) {
- var options = host.getCompilerOptions();
- if (options.outFile || options.out) {
- onBundledEmit(host, sourceFiles);
+ ts.getTrailingCommentRanges = getTrailingCommentRanges;
+ function getShebang(text) {
+ return shebangTriviaRegex.test(text)
+ ? shebangTriviaRegex.exec(text)[0]
+ : undefined;
+ }
+ ts.getShebang = getShebang;
+ function isIdentifierStart(ch, languageVersion) {
+ return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 ||
+ ch === 36 || ch === 95 ||
+ ch > 127 && isUnicodeIdentifierStart(ch, languageVersion);
+ }
+ ts.isIdentifierStart = isIdentifierStart;
+ function isIdentifierPart(ch, languageVersion) {
+ return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 ||
+ ch >= 48 && ch <= 57 || ch === 36 || ch === 95 ||
+ ch > 127 && isUnicodeIdentifierPart(ch, languageVersion);
+ }
+ ts.isIdentifierPart = isIdentifierPart;
+ function isIdentifierText(name, languageVersion) {
+ if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {
+ return false;
}
- else {
- for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) {
- var sourceFile = sourceFiles_2[_i];
- if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) {
- onSingleFileEmit(host, sourceFile);
- }
+ for (var i = 1, n = name.length; i < n; i++) {
+ if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {
+ return false;
}
}
- function onSingleFileEmit(host, sourceFile) {
- var extension = ".js";
- if (options.jsx === 1) {
- if (isSourceFileJavaScript(sourceFile)) {
- if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) {
- extension = ".jsx";
- }
+ return true;
+ }
+ ts.isIdentifierText = isIdentifierText;
+ function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) {
+ if (languageVariant === void 0) { languageVariant = 0; }
+ var pos;
+ var end;
+ var startPos;
+ var tokenPos;
+ var token;
+ var tokenValue;
+ var precedingLineBreak;
+ var hasExtendedUnicodeEscape;
+ var tokenIsUnterminated;
+ setText(text, start, length);
+ 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 === 70 || token > 106; },
+ isReservedWord: function () { return token >= 71 && token <= 106; },
+ isUnterminated: function () { return tokenIsUnterminated; },
+ reScanGreaterToken: reScanGreaterToken,
+ reScanSlashToken: reScanSlashToken,
+ reScanTemplateToken: reScanTemplateToken,
+ scanJsxIdentifier: scanJsxIdentifier,
+ scanJsxAttributeValue: scanJsxAttributeValue,
+ reScanJsxToken: reScanJsxToken,
+ scanJsxToken: scanJsxToken,
+ scanJSDocToken: scanJSDocToken,
+ scan: scan,
+ getText: getText,
+ setText: setText,
+ setScriptTarget: setScriptTarget,
+ setLanguageVariant: setLanguageVariant,
+ setOnError: setOnError,
+ setTextPos: setTextPos,
+ tryScan: tryScan,
+ lookAhead: lookAhead,
+ scanRange: scanRange,
+ };
+ function error(message, length) {
+ if (onError) {
+ onError(message, length || 0);
+ }
+ }
+ function scanNumber() {
+ var start = pos;
+ while (isDigit(text.charCodeAt(pos)))
+ pos++;
+ if (text.charCodeAt(pos) === 46) {
+ pos++;
+ while (isDigit(text.charCodeAt(pos)))
+ pos++;
+ }
+ var end = pos;
+ if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) {
+ pos++;
+ if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45)
+ pos++;
+ if (isDigit(text.charCodeAt(pos))) {
+ pos++;
+ while (isDigit(text.charCodeAt(pos)))
+ pos++;
+ end = pos;
}
- else if (sourceFile.languageVariant === 1) {
- extension = ".jsx";
+ else {
+ error(ts.Diagnostics.Digit_expected);
}
}
- var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);
- var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);
- var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;
- action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], false);
+ return "" + +(text.substring(start, end));
}
- function onBundledEmit(host, sourceFiles) {
- if (sourceFiles.length) {
- var jsFilePath = options.outFile || options.out;
- var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);
- var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined;
- action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, true);
+ function scanOctalDigits() {
+ var start = pos;
+ while (isOctalDigit(text.charCodeAt(pos))) {
+ pos++;
}
+ return +(text.substring(start, pos));
}
- }
- ts.forEachTransformedEmitFile = forEachTransformedEmitFile;
- function getSourceMapFilePath(jsFilePath, options) {
- return options.sourceMap ? jsFilePath + ".map" : undefined;
- }
- function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) {
- var options = host.getCompilerOptions();
- if (options.outFile || options.out) {
- onBundledEmit(host);
+ function scanExactNumberOfHexDigits(count) {
+ return scanHexDigits(count, false);
}
- else {
- var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile];
- for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {
- var sourceFile = sourceFiles_3[_i];
- if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) {
- onSingleFileEmit(host, sourceFile);
- }
- }
+ function scanMinimumNumberOfHexDigits(count) {
+ return scanHexDigits(count, true);
}
- function onSingleFileEmit(host, sourceFile) {
- var extension = ".js";
- if (options.jsx === 1) {
- if (isSourceFileJavaScript(sourceFile)) {
- if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) {
- extension = ".jsx";
- }
+ function scanHexDigits(minCount, scanAsManyAsPossible) {
+ var digits = 0;
+ var value = 0;
+ while (digits < minCount || scanAsManyAsPossible) {
+ var ch = text.charCodeAt(pos);
+ if (ch >= 48 && ch <= 57) {
+ value = value * 16 + ch - 48;
}
- else if (sourceFile.languageVariant === 1) {
- extension = ".jsx";
+ else if (ch >= 65 && ch <= 70) {
+ value = value * 16 + ch - 65 + 10;
}
+ else if (ch >= 97 && ch <= 102) {
+ value = value * 16 + ch - 97 + 10;
+ }
+ else {
+ break;
+ }
+ pos++;
+ digits++;
}
- var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);
- var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;
- var emitFileNames = {
- jsFilePath: jsFilePath,
- sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),
- declarationFilePath: declarationFilePath
- };
- action(emitFileNames, [sourceFile], false, emitOnlyDtsFiles);
- }
- function onBundledEmit(host) {
- var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { return !isDeclarationFile(sourceFile) &&
- !host.isSourceFileFromExternalLibrary(sourceFile) &&
- (!ts.isExternalModule(sourceFile) ||
- !!ts.getEmitModuleKind(options)); });
- if (bundledSources.length) {
- var jsFilePath = options.outFile || options.out;
- var emitFileNames = {
- jsFilePath: jsFilePath,
- sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),
- declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined
- };
- action(emitFileNames, bundledSources, true, emitOnlyDtsFiles);
+ if (digits < minCount) {
+ value = -1;
}
+ return value;
}
- }
- ts.forEachExpectedEmitFile = forEachExpectedEmitFile;
- function getSourceFilePathInNewDir(sourceFile, host, newDirPath) {
- var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory());
- var commonSourceDirectory = host.getCommonSourceDirectory();
- var isSourceFileInCommonSourceDirectory = host.getCanonicalFileName(sourceFilePath).indexOf(host.getCanonicalFileName(commonSourceDirectory)) === 0;
- sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
- return ts.combinePaths(newDirPath, sourceFilePath);
- }
- ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir;
- function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) {
- host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) {
- diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
- }, sourceFiles);
- }
- ts.writeFile = writeFile;
- function getLineOfLocalPosition(currentSourceFile, pos) {
- return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line;
- }
- ts.getLineOfLocalPosition = getLineOfLocalPosition;
- function getLineOfLocalPositionFromLineMap(lineMap, pos) {
- return ts.computeLineAndCharacterOfPosition(lineMap, pos).line;
- }
- ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap;
- function getFirstConstructorWithBody(node) {
- return ts.forEach(node.members, function (member) {
- if (member.kind === 148 && nodeIsPresent(member.body)) {
- return member;
+ function scanString(allowEscapes) {
+ if (allowEscapes === void 0) { allowEscapes = true; }
+ var quote = text.charCodeAt(pos);
+ pos++;
+ var result = "";
+ var start = pos;
+ while (true) {
+ if (pos >= end) {
+ result += text.substring(start, pos);
+ tokenIsUnterminated = true;
+ error(ts.Diagnostics.Unterminated_string_literal);
+ break;
+ }
+ var ch = text.charCodeAt(pos);
+ if (ch === quote) {
+ result += text.substring(start, pos);
+ pos++;
+ break;
+ }
+ if (ch === 92 && allowEscapes) {
+ result += text.substring(start, pos);
+ result += scanEscapeSequence();
+ start = pos;
+ continue;
+ }
+ if (isLineBreak(ch)) {
+ result += text.substring(start, pos);
+ tokenIsUnterminated = true;
+ error(ts.Diagnostics.Unterminated_string_literal);
+ break;
+ }
+ pos++;
}
- });
- }
- ts.getFirstConstructorWithBody = getFirstConstructorWithBody;
- function getSetAccessorTypeAnnotationNode(accessor) {
- if (accessor && accessor.parameters.length > 0) {
- var hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]);
- return accessor.parameters[hasThis ? 1 : 0].type;
+ return result;
}
- }
- ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode;
- function getThisParameter(signature) {
- if (signature.parameters.length) {
- var thisParameter = signature.parameters[0];
- if (parameterIsThisKeyword(thisParameter)) {
- return thisParameter;
+ function scanTemplateAndSetTokenValue() {
+ var startedWithBacktick = text.charCodeAt(pos) === 96;
+ pos++;
+ var start = pos;
+ var contents = "";
+ var resultingToken;
+ while (true) {
+ if (pos >= end) {
+ contents += text.substring(start, pos);
+ tokenIsUnterminated = true;
+ error(ts.Diagnostics.Unterminated_template_literal);
+ resultingToken = startedWithBacktick ? 12 : 15;
+ break;
+ }
+ var currChar = text.charCodeAt(pos);
+ if (currChar === 96) {
+ contents += text.substring(start, pos);
+ pos++;
+ resultingToken = startedWithBacktick ? 12 : 15;
+ break;
+ }
+ if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) {
+ contents += text.substring(start, pos);
+ pos += 2;
+ resultingToken = startedWithBacktick ? 13 : 14;
+ break;
+ }
+ if (currChar === 92) {
+ contents += text.substring(start, pos);
+ contents += scanEscapeSequence();
+ start = pos;
+ continue;
+ }
+ if (currChar === 13) {
+ contents += text.substring(start, pos);
+ pos++;
+ if (pos < end && text.charCodeAt(pos) === 10) {
+ pos++;
+ }
+ contents += "\n";
+ start = pos;
+ continue;
+ }
+ pos++;
}
+ ts.Debug.assert(resultingToken !== undefined);
+ tokenValue = contents;
+ return resultingToken;
}
- }
- ts.getThisParameter = getThisParameter;
- function parameterIsThisKeyword(parameter) {
- return isThisIdentifier(parameter.name);
- }
- ts.parameterIsThisKeyword = parameterIsThisKeyword;
- function isThisIdentifier(node) {
- return node && node.kind === 69 && identifierIsThisKeyword(node);
- }
- ts.isThisIdentifier = isThisIdentifier;
- function identifierIsThisKeyword(id) {
- return id.originalKeywordKind === 97;
- }
- ts.identifierIsThisKeyword = identifierIsThisKeyword;
- function getAllAccessorDeclarations(declarations, accessor) {
- var firstAccessor;
- var secondAccessor;
- var getAccessor;
- var setAccessor;
- if (hasDynamicName(accessor)) {
- firstAccessor = accessor;
- if (accessor.kind === 149) {
- getAccessor = accessor;
+ function scanEscapeSequence() {
+ pos++;
+ if (pos >= end) {
+ error(ts.Diagnostics.Unexpected_end_of_text);
+ return "";
}
- else if (accessor.kind === 150) {
- setAccessor = accessor;
+ var ch = text.charCodeAt(pos);
+ pos++;
+ switch (ch) {
+ case 48:
+ return "\0";
+ case 98:
+ return "\b";
+ case 116:
+ return "\t";
+ case 110:
+ return "\n";
+ case 118:
+ return "\v";
+ case 102:
+ return "\f";
+ case 114:
+ return "\r";
+ case 39:
+ return "\'";
+ case 34:
+ return "\"";
+ case 117:
+ if (pos < end && text.charCodeAt(pos) === 123) {
+ hasExtendedUnicodeEscape = true;
+ pos++;
+ return scanExtendedUnicodeEscape();
+ }
+ return scanHexadecimalEscape(4);
+ case 120:
+ return scanHexadecimalEscape(2);
+ case 13:
+ if (pos < end && text.charCodeAt(pos) === 10) {
+ pos++;
+ }
+ case 10:
+ case 8232:
+ case 8233:
+ return "";
+ default:
+ return String.fromCharCode(ch);
+ }
+ }
+ function scanHexadecimalEscape(numDigits) {
+ var escapedValue = scanExactNumberOfHexDigits(numDigits);
+ if (escapedValue >= 0) {
+ return String.fromCharCode(escapedValue);
}
else {
- ts.Debug.fail("Accessor has wrong kind");
+ error(ts.Diagnostics.Hexadecimal_digit_expected);
+ return "";
}
}
- else {
- ts.forEach(declarations, function (member) {
- if ((member.kind === 149 || member.kind === 150)
- && hasModifier(member, 32) === hasModifier(accessor, 32)) {
- var memberName = getPropertyNameForPropertyNameNode(member.name);
- var accessorName = getPropertyNameForPropertyNameNode(accessor.name);
- if (memberName === accessorName) {
- if (!firstAccessor) {
- firstAccessor = member;
- }
- else if (!secondAccessor) {
- secondAccessor = member;
- }
- if (member.kind === 149 && !getAccessor) {
- getAccessor = member;
- }
- if (member.kind === 150 && !setAccessor) {
- setAccessor = member;
- }
- }
- }
- });
- }
- return {
- firstAccessor: firstAccessor,
- secondAccessor: secondAccessor,
- getAccessor: getAccessor,
- setAccessor: setAccessor
- };
- }
- ts.getAllAccessorDeclarations = getAllAccessorDeclarations;
- function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) {
- emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments);
- }
- ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments;
- function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) {
- if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos &&
- getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) {
- writer.writeLine();
- }
- }
- ts.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition;
- function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) {
- if (pos !== commentPos &&
- getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) {
- writer.writeLine();
- }
- }
- ts.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition;
- function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) {
- if (comments && comments.length > 0) {
- if (leadingSeparator) {
- writer.write(" ");
+ function scanExtendedUnicodeEscape() {
+ var escapedValue = scanMinimumNumberOfHexDigits(1);
+ var isInvalidExtendedEscape = false;
+ if (escapedValue < 0) {
+ error(ts.Diagnostics.Hexadecimal_digit_expected);
+ isInvalidExtendedEscape = true;
}
- var emitInterveningSeparator = false;
- for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) {
- var comment = comments_1[_i];
- if (emitInterveningSeparator) {
- writer.write(" ");
- emitInterveningSeparator = false;
- }
- writeComment(text, lineMap, writer, comment.pos, comment.end, newLine);
- if (comment.hasTrailingNewLine) {
- writer.writeLine();
- }
- else {
- emitInterveningSeparator = true;
- }
+ else if (escapedValue > 0x10FFFF) {
+ error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
+ isInvalidExtendedEscape = true;
}
- if (emitInterveningSeparator && trailingSeparator) {
- writer.write(" ");
+ if (pos >= end) {
+ error(ts.Diagnostics.Unexpected_end_of_text);
+ isInvalidExtendedEscape = true;
+ }
+ else if (text.charCodeAt(pos) === 125) {
+ pos++;
+ }
+ else {
+ error(ts.Diagnostics.Unterminated_Unicode_escape_sequence);
+ isInvalidExtendedEscape = true;
+ }
+ if (isInvalidExtendedEscape) {
+ return "";
}
+ return utf16EncodeAsString(escapedValue);
}
- }
- ts.emitComments = emitComments;
- function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) {
- var leadingComments;
- var currentDetachedCommentInfo;
- if (removeComments) {
- if (node.pos === 0) {
- leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment);
+ function utf16EncodeAsString(codePoint) {
+ ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF);
+ if (codePoint <= 65535) {
+ return String.fromCharCode(codePoint);
}
+ var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800;
+ var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00;
+ return String.fromCharCode(codeUnit1, codeUnit2);
}
- else {
- leadingComments = ts.getLeadingCommentRanges(text, node.pos);
+ function peekUnicodeEscape() {
+ if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) {
+ var start_1 = pos;
+ pos += 2;
+ var value = scanExactNumberOfHexDigits(4);
+ pos = start_1;
+ return value;
+ }
+ return -1;
}
- if (leadingComments) {
- var detachedComments = [];
- var lastComment = void 0;
- for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) {
- var comment = leadingComments_1[_i];
- if (lastComment) {
- var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end);
- var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos);
- if (commentLine >= lastCommentLine + 2) {
+ function scanIdentifierParts() {
+ var result = "";
+ var start = pos;
+ while (pos < end) {
+ var ch = text.charCodeAt(pos);
+ if (isIdentifierPart(ch, languageVersion)) {
+ pos++;
+ }
+ else if (ch === 92) {
+ ch = peekUnicodeEscape();
+ if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
break;
}
+ result += text.substring(start, pos);
+ result += String.fromCharCode(ch);
+ pos += 6;
+ start = pos;
}
- detachedComments.push(comment);
- lastComment = comment;
- }
- if (detachedComments.length) {
- var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end);
- var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos));
- if (nodeLine >= lastCommentLine + 2) {
- emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments);
- emitComments(text, lineMap, writer, detachedComments, false, true, newLine, writeComment);
- currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end };
+ else {
+ break;
}
}
+ result += text.substring(start, pos);
+ return result;
}
- return currentDetachedCommentInfo;
- function isPinnedComment(comment) {
- return text.charCodeAt(comment.pos + 1) === 42 &&
- text.charCodeAt(comment.pos + 2) === 33;
- }
- }
- ts.emitDetachedComments = emitDetachedComments;
- function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) {
- if (text.charCodeAt(commentPos + 1) === 42) {
- var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, commentPos);
- var lineCount = lineMap.length;
- var firstCommentLineIndent = void 0;
- for (var pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) {
- var nextLineStart = (currentLine + 1) === lineCount
- ? text.length + 1
- : lineMap[currentLine + 1];
- if (pos !== commentPos) {
- if (firstCommentLineIndent === undefined) {
- firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos);
- }
- var currentWriterIndentSpacing = writer.getIndent() * getIndentSize();
- var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart);
- if (spacesToEmit > 0) {
- var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize();
- var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize());
- writer.rawWrite(indentSizeSpaceString);
- while (numberOfSingleSpacesToEmit) {
- writer.rawWrite(" ");
- numberOfSingleSpacesToEmit--;
- }
- }
- else {
- writer.rawWrite("");
- }
+ function getIdentifierToken() {
+ var len = tokenValue.length;
+ if (len >= 2 && len <= 11) {
+ var ch = tokenValue.charCodeAt(0);
+ if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) {
+ return token = textToToken[tokenValue];
}
- writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart);
- pos = nextLineStart;
- }
- }
- else {
- writer.write(text.substring(commentPos, commentEnd));
- }
- }
- ts.writeCommentRange = writeCommentRange;
- function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) {
- var end = Math.min(commentEnd, nextLineStart - 1);
- var currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, "");
- if (currentLineText) {
- writer.write(currentLineText);
- if (end !== commentEnd) {
- writer.writeLine();
- }
- }
- else {
- writer.writeLiteral(newLine);
- }
- }
- function calculateIndent(text, pos, end) {
- var currentLineIndent = 0;
- for (; pos < end && ts.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) {
- if (text.charCodeAt(pos) === 9) {
- currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize());
- }
- else {
- currentLineIndent++;
}
+ return token = 70;
}
- return currentLineIndent;
- }
- function hasModifiers(node) {
- return getModifierFlags(node) !== 0;
- }
- ts.hasModifiers = hasModifiers;
- function hasModifier(node, flags) {
- return (getModifierFlags(node) & flags) !== 0;
- }
- ts.hasModifier = hasModifier;
- function getModifierFlags(node) {
- if (node.modifierFlagsCache & 536870912) {
- return node.modifierFlagsCache & ~536870912;
- }
- var flags = 0;
- if (node.modifiers) {
- for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
- var modifier = _a[_i];
- flags |= modifierToFlag(modifier.kind);
+ function scanBinaryOrOctalDigits(base) {
+ ts.Debug.assert(base === 2 || base === 8, "Expected either base 2 or base 8");
+ var value = 0;
+ var numberOfDigits = 0;
+ while (true) {
+ var ch = text.charCodeAt(pos);
+ var valueOfCh = ch - 48;
+ if (!isDigit(ch) || valueOfCh >= base) {
+ break;
+ }
+ value = value * base + valueOfCh;
+ pos++;
+ numberOfDigits++;
}
- }
- if (node.flags & 4) {
- flags |= 1;
- }
- node.modifierFlagsCache = flags | 536870912;
- return flags;
- }
- ts.getModifierFlags = getModifierFlags;
- function modifierToFlag(token) {
- switch (token) {
- case 113: return 32;
- case 112: return 4;
- case 111: return 16;
- case 110: return 8;
- case 115: return 128;
- case 82: return 1;
- case 122: return 2;
- case 74: return 2048;
- case 77: return 512;
- case 118: return 256;
- case 128: return 64;
- }
- return 0;
- }
- ts.modifierToFlag = modifierToFlag;
- function isLogicalOperator(token) {
- return token === 52
- || token === 51
- || token === 49;
- }
- ts.isLogicalOperator = isLogicalOperator;
- function isAssignmentOperator(token) {
- return token >= 56 && token <= 68;
- }
- ts.isAssignmentOperator = isAssignmentOperator;
- function tryGetClassExtendingExpressionWithTypeArguments(node) {
- if (node.kind === 194 &&
- node.parent.token === 83 &&
- isClassLike(node.parent.parent)) {
- return node.parent.parent;
- }
- }
- ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;
- function isDestructuringAssignment(node) {
- if (isBinaryExpression(node)) {
- if (node.operatorToken.kind === 56) {
- var kind = node.left.kind;
- return kind === 171
- || kind === 170;
+ if (numberOfDigits === 0) {
+ return -1;
}
+ return value;
}
- return false;
- }
- ts.isDestructuringAssignment = isDestructuringAssignment;
- function isSupportedExpressionWithTypeArguments(node) {
- return isSupportedExpressionWithTypeArgumentsRest(node.expression);
- }
- ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments;
- function isSupportedExpressionWithTypeArgumentsRest(node) {
- if (node.kind === 69) {
- return true;
+ function scan() {
+ startPos = pos;
+ hasExtendedUnicodeEscape = false;
+ precedingLineBreak = false;
+ tokenIsUnterminated = false;
+ while (true) {
+ tokenPos = pos;
+ if (pos >= end) {
+ return token = 1;
+ }
+ var ch = text.charCodeAt(pos);
+ if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) {
+ pos = scanShebangTrivia(text, pos);
+ if (skipTrivia) {
+ continue;
+ }
+ else {
+ return token = 6;
+ }
+ }
+ switch (ch) {
+ case 10:
+ case 13:
+ precedingLineBreak = true;
+ if (skipTrivia) {
+ pos++;
+ continue;
+ }
+ else {
+ if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) {
+ pos += 2;
+ }
+ else {
+ pos++;
+ }
+ return token = 4;
+ }
+ case 9:
+ case 11:
+ case 12:
+ case 32:
+ if (skipTrivia) {
+ pos++;
+ continue;
+ }
+ else {
+ while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {
+ pos++;
+ }
+ return token = 5;
+ }
+ case 33:
+ if (text.charCodeAt(pos + 1) === 61) {
+ if (text.charCodeAt(pos + 2) === 61) {
+ return pos += 3, token = 34;
+ }
+ return pos += 2, token = 32;
+ }
+ pos++;
+ return token = 50;
+ case 34:
+ case 39:
+ tokenValue = scanString();
+ return token = 9;
+ case 96:
+ return token = scanTemplateAndSetTokenValue();
+ case 37:
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 63;
+ }
+ pos++;
+ return token = 41;
+ case 38:
+ if (text.charCodeAt(pos + 1) === 38) {
+ return pos += 2, token = 52;
+ }
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 67;
+ }
+ pos++;
+ return token = 47;
+ case 40:
+ pos++;
+ return token = 18;
+ case 41:
+ pos++;
+ return token = 19;
+ case 42:
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 60;
+ }
+ if (text.charCodeAt(pos + 1) === 42) {
+ if (text.charCodeAt(pos + 2) === 61) {
+ return pos += 3, token = 61;
+ }
+ return pos += 2, token = 39;
+ }
+ pos++;
+ return token = 38;
+ case 43:
+ if (text.charCodeAt(pos + 1) === 43) {
+ return pos += 2, token = 42;
+ }
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 58;
+ }
+ pos++;
+ return token = 36;
+ case 44:
+ pos++;
+ return token = 25;
+ case 45:
+ if (text.charCodeAt(pos + 1) === 45) {
+ return pos += 2, token = 43;
+ }
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 59;
+ }
+ pos++;
+ return token = 37;
+ case 46:
+ if (isDigit(text.charCodeAt(pos + 1))) {
+ tokenValue = scanNumber();
+ return token = 8;
+ }
+ if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) {
+ return pos += 3, token = 23;
+ }
+ pos++;
+ return token = 22;
+ case 47:
+ if (text.charCodeAt(pos + 1) === 47) {
+ pos += 2;
+ while (pos < end) {
+ if (isLineBreak(text.charCodeAt(pos))) {
+ break;
+ }
+ pos++;
+ }
+ if (skipTrivia) {
+ continue;
+ }
+ else {
+ return token = 2;
+ }
+ }
+ if (text.charCodeAt(pos + 1) === 42) {
+ pos += 2;
+ var commentClosed = false;
+ while (pos < end) {
+ var ch_2 = text.charCodeAt(pos);
+ if (ch_2 === 42 && text.charCodeAt(pos + 1) === 47) {
+ pos += 2;
+ commentClosed = true;
+ break;
+ }
+ if (isLineBreak(ch_2)) {
+ precedingLineBreak = true;
+ }
+ pos++;
+ }
+ if (!commentClosed) {
+ error(ts.Diagnostics.Asterisk_Slash_expected);
+ }
+ if (skipTrivia) {
+ continue;
+ }
+ else {
+ tokenIsUnterminated = !commentClosed;
+ return token = 3;
+ }
+ }
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 62;
+ }
+ pos++;
+ return token = 40;
+ case 48:
+ if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) {
+ pos += 2;
+ var value = scanMinimumNumberOfHexDigits(1);
+ if (value < 0) {
+ error(ts.Diagnostics.Hexadecimal_digit_expected);
+ value = 0;
+ }
+ tokenValue = "" + value;
+ return token = 8;
+ }
+ else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) {
+ pos += 2;
+ var value = scanBinaryOrOctalDigits(2);
+ if (value < 0) {
+ error(ts.Diagnostics.Binary_digit_expected);
+ value = 0;
+ }
+ tokenValue = "" + value;
+ return token = 8;
+ }
+ else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) {
+ pos += 2;
+ var value = scanBinaryOrOctalDigits(8);
+ if (value < 0) {
+ error(ts.Diagnostics.Octal_digit_expected);
+ value = 0;
+ }
+ tokenValue = "" + value;
+ return token = 8;
+ }
+ if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {
+ tokenValue = "" + scanOctalDigits();
+ return token = 8;
+ }
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ tokenValue = scanNumber();
+ return token = 8;
+ case 58:
+ pos++;
+ return token = 55;
+ case 59:
+ pos++;
+ return token = 24;
+ case 60:
+ if (isConflictMarkerTrivia(text, pos)) {
+ pos = scanConflictMarkerTrivia(text, pos, error);
+ if (skipTrivia) {
+ continue;
+ }
+ else {
+ return token = 7;
+ }
+ }
+ if (text.charCodeAt(pos + 1) === 60) {
+ if (text.charCodeAt(pos + 2) === 61) {
+ return pos += 3, token = 64;
+ }
+ return pos += 2, token = 44;
+ }
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 29;
+ }
+ if (languageVariant === 1 &&
+ text.charCodeAt(pos + 1) === 47 &&
+ text.charCodeAt(pos + 2) !== 42) {
+ return pos += 2, token = 27;
+ }
+ pos++;
+ return token = 26;
+ case 61:
+ if (isConflictMarkerTrivia(text, pos)) {
+ pos = scanConflictMarkerTrivia(text, pos, error);
+ if (skipTrivia) {
+ continue;
+ }
+ else {
+ return token = 7;
+ }
+ }
+ if (text.charCodeAt(pos + 1) === 61) {
+ if (text.charCodeAt(pos + 2) === 61) {
+ return pos += 3, token = 33;
+ }
+ return pos += 2, token = 31;
+ }
+ if (text.charCodeAt(pos + 1) === 62) {
+ return pos += 2, token = 35;
+ }
+ pos++;
+ return token = 57;
+ case 62:
+ if (isConflictMarkerTrivia(text, pos)) {
+ pos = scanConflictMarkerTrivia(text, pos, error);
+ if (skipTrivia) {
+ continue;
+ }
+ else {
+ return token = 7;
+ }
+ }
+ pos++;
+ return token = 28;
+ case 63:
+ pos++;
+ return token = 54;
+ case 91:
+ pos++;
+ return token = 20;
+ case 93:
+ pos++;
+ return token = 21;
+ case 94:
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 69;
+ }
+ pos++;
+ return token = 49;
+ case 123:
+ pos++;
+ return token = 16;
+ case 124:
+ if (text.charCodeAt(pos + 1) === 124) {
+ return pos += 2, token = 53;
+ }
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 68;
+ }
+ pos++;
+ return token = 48;
+ case 125:
+ pos++;
+ return token = 17;
+ case 126:
+ pos++;
+ return token = 51;
+ case 64:
+ pos++;
+ return token = 56;
+ case 92:
+ var cookedChar = peekUnicodeEscape();
+ if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
+ pos += 6;
+ tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
+ error(ts.Diagnostics.Invalid_character);
+ pos++;
+ return token = 0;
+ default:
+ if (isIdentifierStart(ch, languageVersion)) {
+ pos++;
+ while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))
+ pos++;
+ tokenValue = text.substring(tokenPos, pos);
+ if (ch === 92) {
+ tokenValue += scanIdentifierParts();
+ }
+ return token = getIdentifierToken();
+ }
+ else if (isWhiteSpaceSingleLine(ch)) {
+ pos++;
+ continue;
+ }
+ else if (isLineBreak(ch)) {
+ precedingLineBreak = true;
+ pos++;
+ continue;
+ }
+ error(ts.Diagnostics.Invalid_character);
+ pos++;
+ return token = 0;
+ }
+ }
}
- else if (isPropertyAccessExpression(node)) {
- return isSupportedExpressionWithTypeArgumentsRest(node.expression);
+ function reScanGreaterToken() {
+ if (token === 28) {
+ if (text.charCodeAt(pos) === 62) {
+ if (text.charCodeAt(pos + 1) === 62) {
+ if (text.charCodeAt(pos + 2) === 61) {
+ return pos += 3, token = 66;
+ }
+ return pos += 2, token = 46;
+ }
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 65;
+ }
+ pos++;
+ return token = 45;
+ }
+ if (text.charCodeAt(pos) === 61) {
+ pos++;
+ return token = 30;
+ }
+ }
+ return token;
}
- else {
- return false;
+ function reScanSlashToken() {
+ if (token === 40 || token === 62) {
+ var p = tokenPos + 1;
+ var inEscape = false;
+ var inCharacterClass = false;
+ while (true) {
+ if (p >= end) {
+ tokenIsUnterminated = true;
+ error(ts.Diagnostics.Unterminated_regular_expression_literal);
+ break;
+ }
+ var ch = text.charCodeAt(p);
+ if (isLineBreak(ch)) {
+ tokenIsUnterminated = true;
+ error(ts.Diagnostics.Unterminated_regular_expression_literal);
+ break;
+ }
+ if (inEscape) {
+ inEscape = false;
+ }
+ else if (ch === 47 && !inCharacterClass) {
+ p++;
+ break;
+ }
+ else if (ch === 91) {
+ inCharacterClass = true;
+ }
+ else if (ch === 92) {
+ inEscape = true;
+ }
+ else if (ch === 93) {
+ inCharacterClass = false;
+ }
+ p++;
+ }
+ while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {
+ p++;
+ }
+ pos = p;
+ tokenValue = text.substring(tokenPos, pos);
+ token = 11;
+ }
+ return token;
}
- }
- function isExpressionWithTypeArgumentsInClassExtendsClause(node) {
- return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined;
- }
- ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
- function isEntityNameExpression(node) {
- return node.kind === 69 ||
- node.kind === 172 && isEntityNameExpression(node.expression);
- }
- ts.isEntityNameExpression = isEntityNameExpression;
- function isRightSideOfQualifiedNameOrPropertyAccess(node) {
- return (node.parent.kind === 139 && node.parent.right === node) ||
- (node.parent.kind === 172 && node.parent.name === node);
- }
- ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
- function isEmptyObjectLiteralOrArrayLiteral(expression) {
- var kind = expression.kind;
- if (kind === 171) {
- return expression.properties.length === 0;
+ function reScanTemplateToken() {
+ ts.Debug.assert(token === 17, "'reScanTemplateToken' should only be called on a '}'");
+ pos = tokenPos;
+ return token = scanTemplateAndSetTokenValue();
}
- if (kind === 170) {
- return expression.elements.length === 0;
+ function reScanJsxToken() {
+ pos = tokenPos = startPos;
+ return token = scanJsxToken();
}
- return false;
- }
- ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral;
- function getLocalSymbolForExportDefault(symbol) {
- return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512) ? symbol.valueDeclaration.localSymbol : undefined;
- }
- ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault;
- function tryExtractTypeScriptExtension(fileName) {
- return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });
- }
- ts.tryExtractTypeScriptExtension = tryExtractTypeScriptExtension;
- function getExpandedCharCodes(input) {
- var output = [];
- var length = input.length;
- for (var i = 0; i < length; i++) {
- var charCode = input.charCodeAt(i);
- if (charCode < 0x80) {
- output.push(charCode);
+ function scanJsxToken() {
+ startPos = tokenPos = pos;
+ if (pos >= end) {
+ return token = 1;
}
- else if (charCode < 0x800) {
- output.push((charCode >> 6) | 192);
- output.push((charCode & 63) | 128);
+ var char = text.charCodeAt(pos);
+ if (char === 60) {
+ if (text.charCodeAt(pos + 1) === 47) {
+ pos += 2;
+ return token = 27;
+ }
+ pos++;
+ return token = 26;
}
- else if (charCode < 0x10000) {
- output.push((charCode >> 12) | 224);
- output.push(((charCode >> 6) & 63) | 128);
- output.push((charCode & 63) | 128);
+ if (char === 123) {
+ pos++;
+ return token = 16;
}
- else if (charCode < 0x20000) {
- output.push((charCode >> 18) | 240);
- output.push(((charCode >> 12) & 63) | 128);
- output.push(((charCode >> 6) & 63) | 128);
- output.push((charCode & 63) | 128);
+ while (pos < end) {
+ pos++;
+ char = text.charCodeAt(pos);
+ if ((char === 123) || (char === 60)) {
+ break;
+ }
}
- else {
- ts.Debug.assert(false, "Unexpected code point");
+ return token = 10;
+ }
+ function scanJsxIdentifier() {
+ if (tokenIsIdentifierOrKeyword(token)) {
+ var firstCharPosition = pos;
+ while (pos < end) {
+ var ch = text.charCodeAt(pos);
+ if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
+ pos++;
+ }
+ else {
+ break;
+ }
+ }
+ tokenValue += text.substr(firstCharPosition, pos - firstCharPosition);
}
+ return token;
}
- return output;
- }
- ts.stringify = typeof JSON !== "undefined" && JSON.stringify
- ? JSON.stringify
- : stringifyFallback;
- function stringifyFallback(value) {
- return value === undefined ? undefined : stringifyValue(value);
- }
- function stringifyValue(value) {
- return typeof value === "string" ? "\"" + escapeString(value) + "\""
- : typeof value === "number" ? isFinite(value) ? String(value) : "null"
- : typeof value === "boolean" ? value ? "true" : "false"
- : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value)
- : "null";
- }
- function cycleCheck(cb, value) {
- ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON");
- value.__cycle = true;
- var result = cb(value);
- delete value.__cycle;
- return result;
- }
- function stringifyArray(value) {
- return "[" + ts.reduceLeft(value, stringifyElement, "") + "]";
- }
- function stringifyElement(memo, value) {
- return (memo ? memo + "," : memo) + stringifyValue(value);
- }
- function stringifyObject(value) {
- return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}";
- }
- function stringifyProperty(memo, value, key) {
- return value === undefined || typeof value === "function" || key === "__cycle" ? memo
- : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value));
- }
- var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- function convertToBase64(input) {
- var result = "";
- var charCodes = getExpandedCharCodes(input);
- var i = 0;
- var length = charCodes.length;
- var byte1, byte2, byte3, byte4;
- while (i < length) {
- byte1 = charCodes[i] >> 2;
- byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4;
- byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6;
- byte4 = charCodes[i + 2] & 63;
- if (i + 1 >= length) {
- byte3 = byte4 = 64;
+ function scanJsxAttributeValue() {
+ startPos = pos;
+ switch (text.charCodeAt(pos)) {
+ case 34:
+ case 39:
+ tokenValue = scanString(false);
+ return token = 9;
+ default:
+ return scan();
}
- else if (i + 2 >= length) {
- byte4 = 64;
+ }
+ function scanJSDocToken() {
+ if (pos >= end) {
+ return token = 1;
+ }
+ startPos = pos;
+ tokenPos = pos;
+ var ch = text.charCodeAt(pos);
+ switch (ch) {
+ case 9:
+ case 11:
+ case 12:
+ case 32:
+ while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {
+ pos++;
+ }
+ return token = 5;
+ case 64:
+ pos++;
+ return token = 56;
+ case 10:
+ case 13:
+ pos++;
+ return token = 4;
+ case 42:
+ pos++;
+ return token = 38;
+ case 123:
+ pos++;
+ return token = 16;
+ case 125:
+ pos++;
+ return token = 17;
+ case 91:
+ pos++;
+ return token = 20;
+ case 93:
+ pos++;
+ return token = 21;
+ case 61:
+ pos++;
+ return token = 57;
+ case 44:
+ pos++;
+ return token = 25;
+ }
+ if (isIdentifierStart(ch, 4)) {
+ pos++;
+ while (isIdentifierPart(text.charCodeAt(pos), 4) && pos < end) {
+ pos++;
+ }
+ return token = 70;
+ }
+ else {
+ return pos += 1, token = 0;
}
- result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);
- i += 3;
}
- return result;
- }
- ts.convertToBase64 = convertToBase64;
- var carriageReturnLineFeed = "\r\n";
- var lineFeed = "\n";
- function getNewLineCharacter(options) {
- if (options.newLine === 0) {
- return carriageReturnLineFeed;
+ function speculationHelper(callback, isLookahead) {
+ var savePos = pos;
+ var saveStartPos = startPos;
+ var saveTokenPos = tokenPos;
+ var saveToken = token;
+ var saveTokenValue = tokenValue;
+ var savePrecedingLineBreak = precedingLineBreak;
+ var result = callback();
+ if (!result || isLookahead) {
+ pos = savePos;
+ startPos = saveStartPos;
+ tokenPos = saveTokenPos;
+ token = saveToken;
+ tokenValue = saveTokenValue;
+ precedingLineBreak = savePrecedingLineBreak;
+ }
+ return result;
}
- else if (options.newLine === 1) {
- return lineFeed;
+ function scanRange(start, length, callback) {
+ var saveEnd = end;
+ var savePos = pos;
+ var saveStartPos = startPos;
+ var saveTokenPos = tokenPos;
+ var saveToken = token;
+ var savePrecedingLineBreak = precedingLineBreak;
+ var saveTokenValue = tokenValue;
+ var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
+ var saveTokenIsUnterminated = tokenIsUnterminated;
+ setText(text, start, length);
+ var result = callback();
+ end = saveEnd;
+ pos = savePos;
+ startPos = saveStartPos;
+ tokenPos = saveTokenPos;
+ token = saveToken;
+ precedingLineBreak = savePrecedingLineBreak;
+ tokenValue = saveTokenValue;
+ hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape;
+ tokenIsUnterminated = saveTokenIsUnterminated;
+ return result;
}
- else if (ts.sys) {
- return ts.sys.newLine;
+ function lookAhead(callback) {
+ return speculationHelper(callback, true);
+ }
+ function tryScan(callback) {
+ return speculationHelper(callback, false);
+ }
+ function getText() {
+ return text;
+ }
+ function setText(newText, start, length) {
+ text = newText || "";
+ end = length === undefined ? text.length : start + length;
+ setTextPos(start || 0);
+ }
+ function setOnError(errorCallback) {
+ onError = errorCallback;
+ }
+ function setScriptTarget(scriptTarget) {
+ languageVersion = scriptTarget;
+ }
+ function setLanguageVariant(variant) {
+ languageVariant = variant;
+ }
+ function setTextPos(textPos) {
+ ts.Debug.assert(textPos >= 0);
+ pos = textPos;
+ startPos = textPos;
+ tokenPos = textPos;
+ token = 0;
+ precedingLineBreak = false;
+ tokenValue = undefined;
+ hasExtendedUnicodeEscape = false;
+ tokenIsUnterminated = false;
}
- return carriageReturnLineFeed;
}
- ts.getNewLineCharacter = getNewLineCharacter;
- function isSimpleExpression(node) {
- return isSimpleExpressionWorker(node, 0);
+ ts.createScanner = createScanner;
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var NodeConstructor;
+ var SourceFileConstructor;
+ function createNode(kind, location, flags) {
+ var ConstructorForKind = kind === 256
+ ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))
+ : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()));
+ var node = location
+ ? new ConstructorForKind(kind, location.pos, location.end)
+ : new ConstructorForKind(kind, -1, -1);
+ node.flags = flags | 8;
+ return node;
}
- ts.isSimpleExpression = isSimpleExpression;
- function isSimpleExpressionWorker(node, depth) {
- if (depth <= 5) {
- var kind = node.kind;
- if (kind === 9
- || kind === 8
- || kind === 10
- || kind === 11
- || kind === 69
- || kind === 97
- || kind === 95
- || kind === 99
- || kind === 84
- || kind === 93) {
- return true;
- }
- else if (kind === 172) {
- return isSimpleExpressionWorker(node.expression, depth + 1);
- }
- else if (kind === 173) {
- return isSimpleExpressionWorker(node.expression, depth + 1)
- && isSimpleExpressionWorker(node.argumentExpression, depth + 1);
- }
- else if (kind === 185
- || kind === 186) {
- return isSimpleExpressionWorker(node.operand, depth + 1);
- }
- else if (kind === 187) {
- return node.operatorToken.kind !== 38
- && isSimpleExpressionWorker(node.left, depth + 1)
- && isSimpleExpressionWorker(node.right, depth + 1);
- }
- else if (kind === 188) {
- return isSimpleExpressionWorker(node.condition, depth + 1)
- && isSimpleExpressionWorker(node.whenTrue, depth + 1)
- && isSimpleExpressionWorker(node.whenFalse, depth + 1);
- }
- else if (kind === 183
- || kind === 182
- || kind === 181) {
- return isSimpleExpressionWorker(node.expression, depth + 1);
- }
- else if (kind === 170) {
- return node.elements.length === 0;
- }
- else if (kind === 171) {
- return node.properties.length === 0;
- }
- else if (kind === 174) {
- if (!isSimpleExpressionWorker(node.expression, depth + 1)) {
- return false;
- }
- for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
- var argument = _a[_i];
- if (!isSimpleExpressionWorker(argument, depth + 1)) {
- return false;
- }
- }
- return true;
+ function updateNode(updated, original) {
+ if (updated !== original) {
+ setOriginalNode(updated, original);
+ if (original.startsOnNewLine) {
+ updated.startsOnNewLine = true;
}
+ ts.aggregateTransformFlags(updated);
}
- return false;
+ return updated;
}
- var syntaxKindCache = ts.createMap();
- function formatSyntaxKind(kind) {
- var syntaxKindEnum = ts.SyntaxKind;
- if (syntaxKindEnum) {
- if (syntaxKindCache[kind]) {
- return syntaxKindCache[kind];
- }
- for (var name_10 in syntaxKindEnum) {
- if (syntaxKindEnum[name_10] === kind) {
- return syntaxKindCache[kind] = kind.toString() + " (" + name_10 + ")";
- }
+ ts.updateNode = updateNode;
+ function createNodeArray(elements, location, hasTrailingComma) {
+ if (elements) {
+ if (ts.isNodeArray(elements)) {
+ return elements;
}
}
else {
- return kind.toString();
+ elements = [];
}
+ var array = elements;
+ if (location) {
+ array.pos = location.pos;
+ array.end = location.end;
+ }
+ else {
+ array.pos = -1;
+ array.end = -1;
+ }
+ if (hasTrailingComma) {
+ array.hasTrailingComma = true;
+ }
+ return array;
}
- ts.formatSyntaxKind = formatSyntaxKind;
- function movePos(pos, value) {
- return ts.positionIsSynthesized(pos) ? -1 : pos + value;
- }
- ts.movePos = movePos;
- function createRange(pos, end) {
- return { pos: pos, end: end };
- }
- ts.createRange = createRange;
- function moveRangeEnd(range, end) {
- return createRange(range.pos, end);
+ ts.createNodeArray = createNodeArray;
+ function createSynthesizedNode(kind, startsOnNewLine) {
+ var node = createNode(kind, undefined);
+ node.startsOnNewLine = startsOnNewLine;
+ return node;
}
- ts.moveRangeEnd = moveRangeEnd;
- function moveRangePos(range, pos) {
- return createRange(pos, range.end);
+ ts.createSynthesizedNode = createSynthesizedNode;
+ function createSynthesizedNodeArray(elements) {
+ return createNodeArray(elements, undefined);
}
- ts.moveRangePos = moveRangePos;
- function moveRangePastDecorators(node) {
- return node.decorators && node.decorators.length > 0
- ? moveRangePos(node, node.decorators.end)
- : node;
+ ts.createSynthesizedNodeArray = createSynthesizedNodeArray;
+ function getSynthesizedClone(node) {
+ var clone = createNode(node.kind, undefined, node.flags);
+ setOriginalNode(clone, node);
+ for (var key in node) {
+ if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {
+ continue;
+ }
+ clone[key] = node[key];
+ }
+ return clone;
}
- ts.moveRangePastDecorators = moveRangePastDecorators;
- function moveRangePastModifiers(node) {
- return node.modifiers && node.modifiers.length > 0
- ? moveRangePos(node, node.modifiers.end)
- : moveRangePastDecorators(node);
+ ts.getSynthesizedClone = getSynthesizedClone;
+ function getMutableClone(node) {
+ var clone = getSynthesizedClone(node);
+ clone.pos = node.pos;
+ clone.end = node.end;
+ clone.parent = node.parent;
+ return clone;
}
- ts.moveRangePastModifiers = moveRangePastModifiers;
- function isCollapsedRange(range) {
- return range.pos === range.end;
+ ts.getMutableClone = getMutableClone;
+ function createLiteral(value, location) {
+ if (typeof value === "number") {
+ var node = createNode(8, location, undefined);
+ node.text = value.toString();
+ return node;
+ }
+ else if (typeof value === "boolean") {
+ return createNode(value ? 100 : 85, location, undefined);
+ }
+ else if (typeof value === "string") {
+ var node = createNode(9, location, undefined);
+ node.text = value;
+ return node;
+ }
+ else if (value) {
+ var node = createNode(9, location, undefined);
+ node.textSourceNode = value;
+ node.text = value.text;
+ return node;
+ }
}
- ts.isCollapsedRange = isCollapsedRange;
- function collapseRangeToStart(range) {
- return isCollapsedRange(range) ? range : moveRangeEnd(range, range.pos);
+ ts.createLiteral = createLiteral;
+ var nextAutoGenerateId = 0;
+ function createIdentifier(text, location) {
+ var node = createNode(70, location);
+ node.text = ts.escapeIdentifier(text);
+ node.originalKeywordKind = ts.stringToToken(text);
+ node.autoGenerateKind = 0;
+ node.autoGenerateId = 0;
+ return node;
}
- ts.collapseRangeToStart = collapseRangeToStart;
- function collapseRangeToEnd(range) {
- return isCollapsedRange(range) ? range : moveRangePos(range, range.end);
+ ts.createIdentifier = createIdentifier;
+ function createTempVariable(recordTempVariable, location) {
+ var name = createNode(70, location);
+ name.text = "";
+ name.originalKeywordKind = 0;
+ name.autoGenerateKind = 1;
+ name.autoGenerateId = nextAutoGenerateId;
+ nextAutoGenerateId++;
+ if (recordTempVariable) {
+ recordTempVariable(name);
+ }
+ return name;
}
- ts.collapseRangeToEnd = collapseRangeToEnd;
- function createTokenRange(pos, token) {
- return createRange(pos, pos + ts.tokenToString(token).length);
+ ts.createTempVariable = createTempVariable;
+ function createLoopVariable(location) {
+ var name = createNode(70, location);
+ name.text = "";
+ name.originalKeywordKind = 0;
+ name.autoGenerateKind = 2;
+ name.autoGenerateId = nextAutoGenerateId;
+ nextAutoGenerateId++;
+ return name;
}
- ts.createTokenRange = createTokenRange;
- function rangeIsOnSingleLine(range, sourceFile) {
- return rangeStartIsOnSameLineAsRangeEnd(range, range, sourceFile);
+ ts.createLoopVariable = createLoopVariable;
+ function createUniqueName(text, location) {
+ var name = createNode(70, location);
+ name.text = text;
+ name.originalKeywordKind = 0;
+ name.autoGenerateKind = 3;
+ name.autoGenerateId = nextAutoGenerateId;
+ nextAutoGenerateId++;
+ return name;
}
- ts.rangeIsOnSingleLine = rangeIsOnSingleLine;
- function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) {
- return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), getStartPositionOfRange(range2, sourceFile), sourceFile);
+ ts.createUniqueName = createUniqueName;
+ function getGeneratedNameForNode(node, location) {
+ var name = createNode(70, location);
+ name.original = node;
+ name.text = "";
+ name.originalKeywordKind = 0;
+ name.autoGenerateKind = 4;
+ name.autoGenerateId = nextAutoGenerateId;
+ nextAutoGenerateId++;
+ return name;
}
- ts.rangeStartPositionsAreOnSameLine = rangeStartPositionsAreOnSameLine;
- function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) {
- return positionsAreOnSameLine(range1.end, range2.end, sourceFile);
+ ts.getGeneratedNameForNode = getGeneratedNameForNode;
+ function createToken(token) {
+ return createNode(token);
}
- ts.rangeEndPositionsAreOnSameLine = rangeEndPositionsAreOnSameLine;
- function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) {
- return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), range2.end, sourceFile);
+ ts.createToken = createToken;
+ function createSuper() {
+ var node = createNode(96);
+ return node;
}
- ts.rangeStartIsOnSameLineAsRangeEnd = rangeStartIsOnSameLineAsRangeEnd;
- function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) {
- return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile);
+ ts.createSuper = createSuper;
+ function createThis(location) {
+ var node = createNode(98, location);
+ return node;
}
- ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;
- function positionsAreOnSameLine(pos1, pos2, sourceFile) {
- return pos1 === pos2 ||
- getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2);
+ ts.createThis = createThis;
+ function createNull() {
+ var node = createNode(94);
+ return node;
}
- ts.positionsAreOnSameLine = positionsAreOnSameLine;
- function getStartPositionOfRange(range, sourceFile) {
- return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);
+ ts.createNull = createNull;
+ function createComputedPropertyName(expression, location) {
+ var node = createNode(141, location);
+ node.expression = expression;
+ return node;
}
- ts.getStartPositionOfRange = getStartPositionOfRange;
- function collectExternalModuleInfo(sourceFile, resolver) {
- var externalImports = [];
- var exportSpecifiers = ts.createMap();
- var exportEquals = undefined;
- var hasExportStarsToExportValues = false;
- for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
- var node = _a[_i];
- switch (node.kind) {
- case 230:
- if (!node.importClause ||
- resolver.isReferencedAliasDeclaration(node.importClause, true)) {
- externalImports.push(node);
- }
- break;
- case 229:
- if (node.moduleReference.kind === 240 && resolver.isReferencedAliasDeclaration(node)) {
- externalImports.push(node);
- }
- break;
- case 236:
- if (node.moduleSpecifier) {
- if (!node.exportClause) {
- if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) {
- externalImports.push(node);
- hasExportStarsToExportValues = true;
- }
- }
- else if (resolver.isValueAliasDeclaration(node)) {
- externalImports.push(node);
- }
- }
- else {
- for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
- var specifier = _c[_b];
- var name_11 = (specifier.propertyName || specifier.name).text;
- (exportSpecifiers[name_11] || (exportSpecifiers[name_11] = [])).push(specifier);
- }
- }
- break;
- case 235:
- if (node.isExportEquals && !exportEquals) {
- exportEquals = node;
- }
- break;
- }
+ ts.createComputedPropertyName = createComputedPropertyName;
+ function updateComputedPropertyName(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createComputedPropertyName(expression, node), node);
}
- return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues };
+ return node;
}
- ts.collectExternalModuleInfo = collectExternalModuleInfo;
- function getInitializedVariables(node) {
- return ts.filter(node.declarations, isInitializedVariable);
+ ts.updateComputedPropertyName = updateComputedPropertyName;
+ function createParameter(name, initializer, location) {
+ return createParameterDeclaration(undefined, undefined, undefined, name, undefined, undefined, initializer, location);
}
- ts.getInitializedVariables = getInitializedVariables;
- function isInitializedVariable(node) {
- return node.initializer !== undefined;
+ ts.createParameter = createParameter;
+ function createParameterDeclaration(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) {
+ var node = createNode(143, location, flags);
+ node.decorators = decorators ? createNodeArray(decorators) : undefined;
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.dotDotDotToken = dotDotDotToken;
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ node.questionToken = questionToken;
+ node.type = type;
+ node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined;
+ return node;
}
- function isMergedWithClass(node) {
- if (node.symbol) {
- for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) {
- var declaration = _a[_i];
- if (declaration.kind === 221 && declaration !== node) {
- return true;
- }
- }
+ ts.createParameterDeclaration = createParameterDeclaration;
+ function updateParameterDeclaration(node, decorators, modifiers, name, type, initializer) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {
+ return updateNode(createParameterDeclaration(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node);
}
- return false;
- }
- ts.isMergedWithClass = isMergedWithClass;
- function isFirstDeclarationOfKind(node, kind) {
- return node.symbol && getDeclarationOfKind(node.symbol, kind) === node;
+ return node;
}
- ts.isFirstDeclarationOfKind = isFirstDeclarationOfKind;
- function isNodeArray(array) {
- return array.hasOwnProperty("pos")
- && array.hasOwnProperty("end");
+ ts.updateParameterDeclaration = updateParameterDeclaration;
+ function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) {
+ var node = createNode(146, location);
+ node.decorators = decorators ? createNodeArray(decorators) : undefined;
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ node.questionToken = questionToken;
+ node.type = type;
+ node.initializer = initializer;
+ return node;
}
- ts.isNodeArray = isNodeArray;
- function isNoSubstitutionTemplateLiteral(node) {
- return node.kind === 11;
+ ts.createProperty = createProperty;
+ function updateProperty(node, decorators, modifiers, name, type, initializer) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {
+ return updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer, node), node);
+ }
+ return node;
}
- ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral;
- function isLiteralKind(kind) {
- return 8 <= kind && kind <= 11;
+ ts.updateProperty = updateProperty;
+ function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
+ var node = createNode(148, location, flags);
+ node.decorators = decorators ? createNodeArray(decorators) : undefined;
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.asteriskToken = asteriskToken;
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
+ node.parameters = createNodeArray(parameters);
+ node.type = type;
+ node.body = body;
+ return node;
}
- ts.isLiteralKind = isLiteralKind;
- function isTextualLiteralKind(kind) {
- return kind === 9 || kind === 11;
+ ts.createMethod = createMethod;
+ function updateMethod(node, decorators, modifiers, name, typeParameters, parameters, type, body) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {
+ return updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);
+ }
+ return node;
}
- ts.isTextualLiteralKind = isTextualLiteralKind;
- function isLiteralExpression(node) {
- return isLiteralKind(node.kind);
+ ts.updateMethod = updateMethod;
+ function createConstructor(decorators, modifiers, parameters, body, location, flags) {
+ var node = createNode(149, location, flags);
+ node.decorators = decorators ? createNodeArray(decorators) : undefined;
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.typeParameters = undefined;
+ node.parameters = createNodeArray(parameters);
+ node.type = undefined;
+ node.body = body;
+ return node;
}
- ts.isLiteralExpression = isLiteralExpression;
- function isTemplateLiteralKind(kind) {
- return 11 <= kind && kind <= 14;
+ ts.createConstructor = createConstructor;
+ function updateConstructor(node, decorators, modifiers, parameters, body) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body) {
+ return updateNode(createConstructor(decorators, modifiers, parameters, body, node, node.flags), node);
+ }
+ return node;
}
- ts.isTemplateLiteralKind = isTemplateLiteralKind;
- function isTemplateHead(node) {
- return node.kind === 12;
+ ts.updateConstructor = updateConstructor;
+ function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) {
+ var node = createNode(150, location, flags);
+ node.decorators = decorators ? createNodeArray(decorators) : undefined;
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ node.typeParameters = undefined;
+ node.parameters = createNodeArray(parameters);
+ node.type = type;
+ node.body = body;
+ return node;
}
- ts.isTemplateHead = isTemplateHead;
- function isTemplateMiddleOrTemplateTail(node) {
- var kind = node.kind;
- return kind === 13
- || kind === 14;
+ ts.createGetAccessor = createGetAccessor;
+ function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body) {
+ return updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body, node, node.flags), node);
+ }
+ return node;
}
- ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail;
- function isIdentifier(node) {
- return node.kind === 69;
+ ts.updateGetAccessor = updateGetAccessor;
+ function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) {
+ var node = createNode(151, location, flags);
+ node.decorators = decorators ? createNodeArray(decorators) : undefined;
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ node.typeParameters = undefined;
+ node.parameters = createNodeArray(parameters);
+ node.body = body;
+ return node;
}
- ts.isIdentifier = isIdentifier;
- function isGeneratedIdentifier(node) {
- return isIdentifier(node) && node.autoGenerateKind > 0;
+ ts.createSetAccessor = createSetAccessor;
+ function updateSetAccessor(node, decorators, modifiers, name, parameters, body) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body) {
+ return updateNode(createSetAccessor(decorators, modifiers, name, parameters, body, node, node.flags), node);
+ }
+ return node;
}
- ts.isGeneratedIdentifier = isGeneratedIdentifier;
- function isModifier(node) {
- return isModifierKind(node.kind);
+ ts.updateSetAccessor = updateSetAccessor;
+ function createObjectBindingPattern(elements, location) {
+ var node = createNode(168, location);
+ node.elements = createNodeArray(elements);
+ return node;
}
- ts.isModifier = isModifier;
- function isQualifiedName(node) {
- return node.kind === 139;
+ ts.createObjectBindingPattern = createObjectBindingPattern;
+ function updateObjectBindingPattern(node, elements) {
+ if (node.elements !== elements) {
+ return updateNode(createObjectBindingPattern(elements, node), node);
+ }
+ return node;
}
- ts.isQualifiedName = isQualifiedName;
- function isComputedPropertyName(node) {
- return node.kind === 140;
+ ts.updateObjectBindingPattern = updateObjectBindingPattern;
+ function createArrayBindingPattern(elements, location) {
+ var node = createNode(169, location);
+ node.elements = createNodeArray(elements);
+ return node;
}
- ts.isComputedPropertyName = isComputedPropertyName;
- function isEntityName(node) {
- var kind = node.kind;
- return kind === 139
- || kind === 69;
+ ts.createArrayBindingPattern = createArrayBindingPattern;
+ function updateArrayBindingPattern(node, elements) {
+ if (node.elements !== elements) {
+ return updateNode(createArrayBindingPattern(elements, node), node);
+ }
+ return node;
}
- ts.isEntityName = isEntityName;
- function isPropertyName(node) {
- var kind = node.kind;
- return kind === 69
- || kind === 9
- || kind === 8
- || kind === 140;
+ ts.updateArrayBindingPattern = updateArrayBindingPattern;
+ function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) {
+ var node = createNode(170, location);
+ node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName;
+ node.dotDotDotToken = dotDotDotToken;
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ node.initializer = initializer;
+ return node;
}
- ts.isPropertyName = isPropertyName;
- function isModuleName(node) {
- var kind = node.kind;
- return kind === 69
- || kind === 9;
+ ts.createBindingElement = createBindingElement;
+ function updateBindingElement(node, propertyName, name, initializer) {
+ if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) {
+ return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node);
+ }
+ return node;
}
- ts.isModuleName = isModuleName;
- function isBindingName(node) {
- var kind = node.kind;
- return kind === 69
- || kind === 167
- || kind === 168;
+ ts.updateBindingElement = updateBindingElement;
+ function createArrayLiteral(elements, location, multiLine) {
+ var node = createNode(171, location);
+ node.elements = parenthesizeListElements(createNodeArray(elements));
+ if (multiLine) {
+ node.multiLine = true;
+ }
+ return node;
}
- ts.isBindingName = isBindingName;
- function isTypeParameter(node) {
- return node.kind === 141;
+ ts.createArrayLiteral = createArrayLiteral;
+ function updateArrayLiteral(node, elements) {
+ if (node.elements !== elements) {
+ return updateNode(createArrayLiteral(elements, node, node.multiLine), node);
+ }
+ return node;
}
- ts.isTypeParameter = isTypeParameter;
- function isParameter(node) {
- return node.kind === 142;
+ ts.updateArrayLiteral = updateArrayLiteral;
+ function createObjectLiteral(properties, location, multiLine) {
+ var node = createNode(172, location);
+ node.properties = createNodeArray(properties);
+ if (multiLine) {
+ node.multiLine = true;
+ }
+ return node;
}
- ts.isParameter = isParameter;
- function isDecorator(node) {
- return node.kind === 143;
+ ts.createObjectLiteral = createObjectLiteral;
+ function updateObjectLiteral(node, properties) {
+ if (node.properties !== properties) {
+ return updateNode(createObjectLiteral(properties, node, node.multiLine), node);
+ }
+ return node;
}
- ts.isDecorator = isDecorator;
- function isMethodDeclaration(node) {
- return node.kind === 147;
+ ts.updateObjectLiteral = updateObjectLiteral;
+ function createPropertyAccess(expression, name, location, flags) {
+ var node = createNode(173, location, flags);
+ node.expression = parenthesizeForAccess(expression);
+ (node.emitNode || (node.emitNode = {})).flags |= 1048576;
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ return node;
}
- ts.isMethodDeclaration = isMethodDeclaration;
- function isClassElement(node) {
- var kind = node.kind;
- return kind === 148
- || kind === 145
- || kind === 147
- || kind === 149
- || kind === 150
- || kind === 153
- || kind === 198;
+ ts.createPropertyAccess = createPropertyAccess;
+ function updatePropertyAccess(node, expression, name) {
+ if (node.expression !== expression || node.name !== name) {
+ var propertyAccess = createPropertyAccess(expression, name, node, node.flags);
+ (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node);
+ return updateNode(propertyAccess, node);
+ }
+ return node;
}
- ts.isClassElement = isClassElement;
- function isObjectLiteralElementLike(node) {
- var kind = node.kind;
- return kind === 253
- || kind === 254
- || kind === 147
- || kind === 149
- || kind === 150
- || kind === 239;
+ ts.updatePropertyAccess = updatePropertyAccess;
+ function createElementAccess(expression, index, location) {
+ var node = createNode(174, location);
+ node.expression = parenthesizeForAccess(expression);
+ node.argumentExpression = typeof index === "number" ? createLiteral(index) : index;
+ return node;
}
- ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
- function isTypeNodeKind(kind) {
- return (kind >= 154 && kind <= 166)
- || kind === 117
- || kind === 130
- || kind === 120
- || kind === 132
- || kind === 133
- || kind === 103
- || kind === 127
- || kind === 194;
+ ts.createElementAccess = createElementAccess;
+ function updateElementAccess(node, expression, argumentExpression) {
+ if (node.expression !== expression || node.argumentExpression !== argumentExpression) {
+ return updateNode(createElementAccess(expression, argumentExpression, node), node);
+ }
+ return node;
}
- function isTypeNode(node) {
- return isTypeNodeKind(node.kind);
+ ts.updateElementAccess = updateElementAccess;
+ function createCall(expression, typeArguments, argumentsArray, location, flags) {
+ var node = createNode(175, location, flags);
+ node.expression = parenthesizeForAccess(expression);
+ if (typeArguments) {
+ node.typeArguments = createNodeArray(typeArguments);
+ }
+ node.arguments = parenthesizeListElements(createNodeArray(argumentsArray));
+ return node;
}
- ts.isTypeNode = isTypeNode;
- function isBindingPattern(node) {
- if (node) {
- var kind = node.kind;
- return kind === 168
- || kind === 167;
+ ts.createCall = createCall;
+ function updateCall(node, expression, typeArguments, argumentsArray) {
+ if (expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments) {
+ return updateNode(createCall(expression, typeArguments, argumentsArray, node, node.flags), node);
}
- return false;
+ return node;
}
- ts.isBindingPattern = isBindingPattern;
- function isBindingElement(node) {
- return node.kind === 169;
+ ts.updateCall = updateCall;
+ function createNew(expression, typeArguments, argumentsArray, location, flags) {
+ var node = createNode(176, location, flags);
+ node.expression = parenthesizeForNew(expression);
+ node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;
+ node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;
+ return node;
}
- ts.isBindingElement = isBindingElement;
- function isArrayBindingElement(node) {
- var kind = node.kind;
- return kind === 169
- || kind === 193;
+ ts.createNew = createNew;
+ function updateNew(node, expression, typeArguments, argumentsArray) {
+ if (node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray) {
+ return updateNode(createNew(expression, typeArguments, argumentsArray, node, node.flags), node);
+ }
+ return node;
}
- ts.isArrayBindingElement = isArrayBindingElement;
- function isPropertyAccessExpression(node) {
- return node.kind === 172;
+ ts.updateNew = updateNew;
+ function createTaggedTemplate(tag, template, location) {
+ var node = createNode(177, location);
+ node.tag = parenthesizeForAccess(tag);
+ node.template = template;
+ return node;
}
- ts.isPropertyAccessExpression = isPropertyAccessExpression;
- function isElementAccessExpression(node) {
- return node.kind === 173;
+ ts.createTaggedTemplate = createTaggedTemplate;
+ function updateTaggedTemplate(node, tag, template) {
+ if (node.tag !== tag || node.template !== template) {
+ return updateNode(createTaggedTemplate(tag, template, node), node);
+ }
+ return node;
}
- ts.isElementAccessExpression = isElementAccessExpression;
- function isBinaryExpression(node) {
- return node.kind === 187;
+ ts.updateTaggedTemplate = updateTaggedTemplate;
+ function createParen(expression, location) {
+ var node = createNode(179, location);
+ node.expression = expression;
+ return node;
}
- ts.isBinaryExpression = isBinaryExpression;
- function isConditionalExpression(node) {
- return node.kind === 188;
+ ts.createParen = createParen;
+ function updateParen(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createParen(expression, node), node);
+ }
+ return node;
}
- ts.isConditionalExpression = isConditionalExpression;
- function isCallExpression(node) {
- return node.kind === 174;
+ ts.updateParen = updateParen;
+ function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
+ var node = createNode(180, location, flags);
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.asteriskToken = asteriskToken;
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
+ node.parameters = createNodeArray(parameters);
+ node.type = type;
+ node.body = body;
+ return node;
}
- ts.isCallExpression = isCallExpression;
- function isTemplateLiteral(node) {
- var kind = node.kind;
- return kind === 189
- || kind === 11;
+ ts.createFunctionExpression = createFunctionExpression;
+ function updateFunctionExpression(node, modifiers, name, typeParameters, parameters, type, body) {
+ if (node.name !== name || node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {
+ return updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);
+ }
+ return node;
}
- ts.isTemplateLiteral = isTemplateLiteral;
- function isSpreadElementExpression(node) {
- return node.kind === 191;
+ ts.updateFunctionExpression = updateFunctionExpression;
+ function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) {
+ var node = createNode(181, location, flags);
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
+ node.parameters = createNodeArray(parameters);
+ node.type = type;
+ node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(35);
+ node.body = parenthesizeConciseBody(body);
+ return node;
}
- ts.isSpreadElementExpression = isSpreadElementExpression;
- function isExpressionWithTypeArguments(node) {
- return node.kind === 194;
+ ts.createArrowFunction = createArrowFunction;
+ function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) {
+ if (node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {
+ return updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body, node, node.flags), node);
+ }
+ return node;
}
- ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
- function isLeftHandSideExpressionKind(kind) {
- return kind === 172
- || kind === 173
- || kind === 175
- || kind === 174
- || kind === 241
- || kind === 242
- || kind === 176
- || kind === 170
- || kind === 178
- || kind === 171
- || kind === 192
- || kind === 179
- || kind === 69
- || kind === 10
- || kind === 8
- || kind === 9
- || kind === 11
- || kind === 189
- || kind === 84
- || kind === 93
- || kind === 97
- || kind === 99
- || kind === 95
- || kind === 196;
+ ts.updateArrowFunction = updateArrowFunction;
+ function createDelete(expression, location) {
+ var node = createNode(182, location);
+ node.expression = parenthesizePrefixOperand(expression);
+ return node;
}
- function isLeftHandSideExpression(node) {
- return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
+ ts.createDelete = createDelete;
+ function updateDelete(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createDelete(expression, node), expression);
+ }
+ return node;
}
- ts.isLeftHandSideExpression = isLeftHandSideExpression;
- function isUnaryExpressionKind(kind) {
- return kind === 185
- || kind === 186
- || kind === 181
- || kind === 182
- || kind === 183
- || kind === 184
- || kind === 177
- || isLeftHandSideExpressionKind(kind);
+ ts.updateDelete = updateDelete;
+ function createTypeOf(expression, location) {
+ var node = createNode(183, location);
+ node.expression = parenthesizePrefixOperand(expression);
+ return node;
}
- function isUnaryExpression(node) {
- return isUnaryExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
+ ts.createTypeOf = createTypeOf;
+ function updateTypeOf(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createTypeOf(expression, node), expression);
+ }
+ return node;
}
- ts.isUnaryExpression = isUnaryExpression;
- function isExpressionKind(kind) {
- return kind === 188
- || kind === 190
- || kind === 180
- || kind === 187
- || kind === 191
- || kind === 195
- || kind === 193
- || isUnaryExpressionKind(kind);
+ ts.updateTypeOf = updateTypeOf;
+ function createVoid(expression, location) {
+ var node = createNode(184, location);
+ node.expression = parenthesizePrefixOperand(expression);
+ return node;
}
- function isExpression(node) {
- return isExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
+ ts.createVoid = createVoid;
+ function updateVoid(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createVoid(expression, node), node);
+ }
+ return node;
}
- ts.isExpression = isExpression;
- function isAssertionExpression(node) {
- var kind = node.kind;
- return kind === 177
- || kind === 195;
+ ts.updateVoid = updateVoid;
+ function createAwait(expression, location) {
+ var node = createNode(185, location);
+ node.expression = parenthesizePrefixOperand(expression);
+ return node;
}
- ts.isAssertionExpression = isAssertionExpression;
- function isPartiallyEmittedExpression(node) {
- return node.kind === 288;
+ ts.createAwait = createAwait;
+ function updateAwait(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createAwait(expression, node), node);
+ }
+ return node;
}
- ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
- function isNotEmittedStatement(node) {
- return node.kind === 287;
+ ts.updateAwait = updateAwait;
+ function createPrefix(operator, operand, location) {
+ var node = createNode(186, location);
+ node.operator = operator;
+ node.operand = parenthesizePrefixOperand(operand);
+ return node;
}
- ts.isNotEmittedStatement = isNotEmittedStatement;
- function isNotEmittedOrPartiallyEmittedNode(node) {
- return isNotEmittedStatement(node)
- || isPartiallyEmittedExpression(node);
+ ts.createPrefix = createPrefix;
+ function updatePrefix(node, operand) {
+ if (node.operand !== operand) {
+ return updateNode(createPrefix(node.operator, operand, node), node);
+ }
+ return node;
}
- ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
- function isOmittedExpression(node) {
- return node.kind === 193;
+ ts.updatePrefix = updatePrefix;
+ function createPostfix(operand, operator, location) {
+ var node = createNode(187, location);
+ node.operand = parenthesizePostfixOperand(operand);
+ node.operator = operator;
+ return node;
}
- ts.isOmittedExpression = isOmittedExpression;
- function isTemplateSpan(node) {
- return node.kind === 197;
+ ts.createPostfix = createPostfix;
+ function updatePostfix(node, operand) {
+ if (node.operand !== operand) {
+ return updateNode(createPostfix(operand, node.operator, node), node);
+ }
+ return node;
}
- ts.isTemplateSpan = isTemplateSpan;
- function isBlock(node) {
- return node.kind === 199;
+ ts.updatePostfix = updatePostfix;
+ function createBinary(left, operator, right, location) {
+ var operatorToken = typeof operator === "number" ? createToken(operator) : operator;
+ var operatorKind = operatorToken.kind;
+ var node = createNode(188, location);
+ node.left = parenthesizeBinaryOperand(operatorKind, left, true, undefined);
+ node.operatorToken = operatorToken;
+ node.right = parenthesizeBinaryOperand(operatorKind, right, false, node.left);
+ return node;
}
- ts.isBlock = isBlock;
- function isConciseBody(node) {
- return isBlock(node)
- || isExpression(node);
+ ts.createBinary = createBinary;
+ function updateBinary(node, left, right) {
+ if (node.left !== left || node.right !== right) {
+ return updateNode(createBinary(left, node.operatorToken, right, node), node);
+ }
+ return node;
}
- ts.isConciseBody = isConciseBody;
- function isFunctionBody(node) {
- return isBlock(node);
+ ts.updateBinary = updateBinary;
+ function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) {
+ var node = createNode(189, location);
+ node.condition = condition;
+ node.questionToken = questionToken;
+ node.whenTrue = whenTrue;
+ node.colonToken = colonToken;
+ node.whenFalse = whenFalse;
+ return node;
}
- ts.isFunctionBody = isFunctionBody;
- function isForInitializer(node) {
- return isVariableDeclarationList(node)
- || isExpression(node);
+ ts.createConditional = createConditional;
+ function updateConditional(node, condition, whenTrue, whenFalse) {
+ if (node.condition !== condition || node.whenTrue !== whenTrue || node.whenFalse !== whenFalse) {
+ return updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse, node), node);
+ }
+ return node;
}
- ts.isForInitializer = isForInitializer;
- function isVariableDeclaration(node) {
- return node.kind === 218;
+ ts.updateConditional = updateConditional;
+ function createTemplateExpression(head, templateSpans, location) {
+ var node = createNode(190, location);
+ node.head = head;
+ node.templateSpans = createNodeArray(templateSpans);
+ return node;
}
- ts.isVariableDeclaration = isVariableDeclaration;
- function isVariableDeclarationList(node) {
- return node.kind === 219;
+ ts.createTemplateExpression = createTemplateExpression;
+ function updateTemplateExpression(node, head, templateSpans) {
+ if (node.head !== head || node.templateSpans !== templateSpans) {
+ return updateNode(createTemplateExpression(head, templateSpans, node), node);
+ }
+ return node;
}
- ts.isVariableDeclarationList = isVariableDeclarationList;
- function isCaseBlock(node) {
- return node.kind === 227;
+ ts.updateTemplateExpression = updateTemplateExpression;
+ function createYield(asteriskToken, expression, location) {
+ var node = createNode(191, location);
+ node.asteriskToken = asteriskToken;
+ node.expression = expression;
+ return node;
}
- ts.isCaseBlock = isCaseBlock;
- function isModuleBody(node) {
- var kind = node.kind;
- return kind === 226
- || kind === 225;
+ ts.createYield = createYield;
+ function updateYield(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createYield(node.asteriskToken, expression, node), node);
+ }
+ return node;
}
- ts.isModuleBody = isModuleBody;
- function isImportEqualsDeclaration(node) {
- return node.kind === 229;
+ ts.updateYield = updateYield;
+ function createSpread(expression, location) {
+ var node = createNode(192, location);
+ node.expression = parenthesizeExpressionForList(expression);
+ return node;
}
- ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
- function isImportClause(node) {
- return node.kind === 231;
+ ts.createSpread = createSpread;
+ function updateSpread(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createSpread(expression, node), node);
+ }
+ return node;
}
- ts.isImportClause = isImportClause;
- function isNamedImportBindings(node) {
- var kind = node.kind;
- return kind === 233
- || kind === 232;
+ ts.updateSpread = updateSpread;
+ function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) {
+ var node = createNode(193, location);
+ node.decorators = undefined;
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.name = name;
+ node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
+ node.heritageClauses = createNodeArray(heritageClauses);
+ node.members = createNodeArray(members);
+ return node;
}
- ts.isNamedImportBindings = isNamedImportBindings;
- function isImportSpecifier(node) {
- return node.kind === 234;
+ ts.createClassExpression = createClassExpression;
+ function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) {
+ if (node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) {
+ return updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members, node), node);
+ }
+ return node;
}
- ts.isImportSpecifier = isImportSpecifier;
- function isNamedExports(node) {
- return node.kind === 237;
+ ts.updateClassExpression = updateClassExpression;
+ function createOmittedExpression(location) {
+ var node = createNode(194, location);
+ return node;
}
- ts.isNamedExports = isNamedExports;
- function isExportSpecifier(node) {
- return node.kind === 238;
+ ts.createOmittedExpression = createOmittedExpression;
+ function createExpressionWithTypeArguments(typeArguments, expression, location) {
+ var node = createNode(195, location);
+ node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;
+ node.expression = parenthesizeForAccess(expression);
+ return node;
}
- ts.isExportSpecifier = isExportSpecifier;
- function isModuleOrEnumDeclaration(node) {
- return node.kind === 225 || node.kind === 224;
+ ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments;
+ function updateExpressionWithTypeArguments(node, typeArguments, expression) {
+ if (node.typeArguments !== typeArguments || node.expression !== expression) {
+ return updateNode(createExpressionWithTypeArguments(typeArguments, expression, node), node);
+ }
+ return node;
}
- ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
- function isDeclarationKind(kind) {
- return kind === 180
- || kind === 169
- || kind === 221
- || kind === 192
- || kind === 148
- || kind === 224
- || kind === 255
- || kind === 238
- || kind === 220
- || kind === 179
- || kind === 149
- || kind === 231
- || kind === 229
- || kind === 234
- || kind === 222
- || kind === 147
- || kind === 146
- || kind === 225
- || kind === 228
- || kind === 232
- || kind === 142
- || kind === 253
- || kind === 145
- || kind === 144
- || kind === 150
- || kind === 254
- || kind === 223
- || kind === 141
- || kind === 218
- || kind === 279;
+ ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;
+ function createTemplateSpan(expression, literal, location) {
+ var node = createNode(198, location);
+ node.expression = expression;
+ node.literal = literal;
+ return node;
}
- function isDeclarationStatementKind(kind) {
- return kind === 220
- || kind === 239
- || kind === 221
- || kind === 222
- || kind === 223
- || kind === 224
- || kind === 225
- || kind === 230
- || kind === 229
- || kind === 236
- || kind === 235
- || kind === 228;
+ ts.createTemplateSpan = createTemplateSpan;
+ function updateTemplateSpan(node, expression, literal) {
+ if (node.expression !== expression || node.literal !== literal) {
+ return updateNode(createTemplateSpan(expression, literal, node), node);
+ }
+ return node;
}
- function isStatementKindButNotDeclarationKind(kind) {
- return kind === 210
- || kind === 209
- || kind === 217
- || kind === 204
- || kind === 202
- || kind === 201
- || kind === 207
- || kind === 208
- || kind === 206
- || kind === 203
- || kind === 214
- || kind === 211
- || kind === 213
- || kind === 215
- || kind === 216
- || kind === 200
- || kind === 205
- || kind === 212
- || kind === 287;
+ ts.updateTemplateSpan = updateTemplateSpan;
+ function createBlock(statements, location, multiLine, flags) {
+ var block = createNode(200, location, flags);
+ block.statements = createNodeArray(statements);
+ if (multiLine) {
+ block.multiLine = true;
+ }
+ return block;
}
- function isDeclaration(node) {
- return isDeclarationKind(node.kind);
+ ts.createBlock = createBlock;
+ function updateBlock(node, statements) {
+ if (statements !== node.statements) {
+ return updateNode(createBlock(statements, node, node.multiLine, node.flags), node);
+ }
+ return node;
}
- ts.isDeclaration = isDeclaration;
- function isDeclarationStatement(node) {
- return isDeclarationStatementKind(node.kind);
+ ts.updateBlock = updateBlock;
+ function createVariableStatement(modifiers, declarationList, location, flags) {
+ var node = createNode(201, location, flags);
+ node.decorators = undefined;
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
+ return node;
}
- ts.isDeclarationStatement = isDeclarationStatement;
- function isStatementButNotDeclaration(node) {
- return isStatementKindButNotDeclarationKind(node.kind);
+ ts.createVariableStatement = createVariableStatement;
+ function updateVariableStatement(node, modifiers, declarationList) {
+ if (node.modifiers !== modifiers || node.declarationList !== declarationList) {
+ return updateNode(createVariableStatement(modifiers, declarationList, node, node.flags), node);
+ }
+ return node;
}
- ts.isStatementButNotDeclaration = isStatementButNotDeclaration;
- function isStatement(node) {
- var kind = node.kind;
- return isStatementKindButNotDeclarationKind(kind)
- || isDeclarationStatementKind(kind)
- || kind === 199;
+ ts.updateVariableStatement = updateVariableStatement;
+ function createVariableDeclarationList(declarations, location, flags) {
+ var node = createNode(220, location, flags);
+ node.declarations = createNodeArray(declarations);
+ return node;
}
- ts.isStatement = isStatement;
- function isModuleReference(node) {
- var kind = node.kind;
- return kind === 240
- || kind === 139
- || kind === 69;
+ ts.createVariableDeclarationList = createVariableDeclarationList;
+ function updateVariableDeclarationList(node, declarations) {
+ if (node.declarations !== declarations) {
+ return updateNode(createVariableDeclarationList(declarations, node, node.flags), node);
+ }
+ return node;
}
- ts.isModuleReference = isModuleReference;
- function isJsxOpeningElement(node) {
- return node.kind === 243;
+ ts.updateVariableDeclarationList = updateVariableDeclarationList;
+ function createVariableDeclaration(name, type, initializer, location, flags) {
+ var node = createNode(219, location, flags);
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ node.type = type;
+ node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;
+ return node;
}
- ts.isJsxOpeningElement = isJsxOpeningElement;
- function isJsxClosingElement(node) {
- return node.kind === 245;
+ ts.createVariableDeclaration = createVariableDeclaration;
+ function updateVariableDeclaration(node, name, type, initializer) {
+ if (node.name !== name || node.type !== type || node.initializer !== initializer) {
+ return updateNode(createVariableDeclaration(name, type, initializer, node, node.flags), node);
+ }
+ return node;
}
- ts.isJsxClosingElement = isJsxClosingElement;
- function isJsxTagNameExpression(node) {
- var kind = node.kind;
- return kind === 97
- || kind === 69
- || kind === 172;
+ ts.updateVariableDeclaration = updateVariableDeclaration;
+ function createEmptyStatement(location) {
+ return createNode(202, location);
}
- ts.isJsxTagNameExpression = isJsxTagNameExpression;
- function isJsxChild(node) {
- var kind = node.kind;
- return kind === 241
- || kind === 248
- || kind === 242
- || kind === 244;
+ ts.createEmptyStatement = createEmptyStatement;
+ function createStatement(expression, location, flags) {
+ var node = createNode(203, location, flags);
+ node.expression = parenthesizeExpressionForExpressionStatement(expression);
+ return node;
}
- ts.isJsxChild = isJsxChild;
- function isJsxAttributeLike(node) {
- var kind = node.kind;
- return kind === 246
- || kind === 247;
+ ts.createStatement = createStatement;
+ function updateStatement(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createStatement(expression, node, node.flags), node);
+ }
+ return node;
}
- ts.isJsxAttributeLike = isJsxAttributeLike;
- function isJsxSpreadAttribute(node) {
- return node.kind === 247;
+ ts.updateStatement = updateStatement;
+ function createIf(expression, thenStatement, elseStatement, location) {
+ var node = createNode(204, location);
+ node.expression = expression;
+ node.thenStatement = thenStatement;
+ node.elseStatement = elseStatement;
+ return node;
}
- ts.isJsxSpreadAttribute = isJsxSpreadAttribute;
- function isJsxAttribute(node) {
- return node.kind === 246;
+ ts.createIf = createIf;
+ function updateIf(node, expression, thenStatement, elseStatement) {
+ if (node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement) {
+ return updateNode(createIf(expression, thenStatement, elseStatement, node), node);
+ }
+ return node;
}
- ts.isJsxAttribute = isJsxAttribute;
- function isStringLiteralOrJsxExpression(node) {
- var kind = node.kind;
- return kind === 9
- || kind === 248;
+ ts.updateIf = updateIf;
+ function createDo(statement, expression, location) {
+ var node = createNode(205, location);
+ node.statement = statement;
+ node.expression = expression;
+ return node;
}
- ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
- function isCaseOrDefaultClause(node) {
- var kind = node.kind;
- return kind === 249
- || kind === 250;
+ ts.createDo = createDo;
+ function updateDo(node, statement, expression) {
+ if (node.statement !== statement || node.expression !== expression) {
+ return updateNode(createDo(statement, expression, node), node);
+ }
+ return node;
}
- ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
- function isHeritageClause(node) {
- return node.kind === 251;
+ ts.updateDo = updateDo;
+ function createWhile(expression, statement, location) {
+ var node = createNode(206, location);
+ node.expression = expression;
+ node.statement = statement;
+ return node;
}
- ts.isHeritageClause = isHeritageClause;
- function isCatchClause(node) {
- return node.kind === 252;
+ ts.createWhile = createWhile;
+ function updateWhile(node, expression, statement) {
+ if (node.expression !== expression || node.statement !== statement) {
+ return updateNode(createWhile(expression, statement, node), node);
+ }
+ return node;
}
- ts.isCatchClause = isCatchClause;
- function isPropertyAssignment(node) {
- return node.kind === 253;
+ ts.updateWhile = updateWhile;
+ function createFor(initializer, condition, incrementor, statement, location) {
+ var node = createNode(207, location, undefined);
+ node.initializer = initializer;
+ node.condition = condition;
+ node.incrementor = incrementor;
+ node.statement = statement;
+ return node;
}
- ts.isPropertyAssignment = isPropertyAssignment;
- function isShorthandPropertyAssignment(node) {
- return node.kind === 254;
+ ts.createFor = createFor;
+ function updateFor(node, initializer, condition, incrementor, statement) {
+ if (node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement) {
+ return updateNode(createFor(initializer, condition, incrementor, statement, node), node);
+ }
+ return node;
}
- ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;
- function isEnumMember(node) {
- return node.kind === 255;
+ ts.updateFor = updateFor;
+ function createForIn(initializer, expression, statement, location) {
+ var node = createNode(208, location);
+ node.initializer = initializer;
+ node.expression = expression;
+ node.statement = statement;
+ return node;
}
- ts.isEnumMember = isEnumMember;
- function isSourceFile(node) {
- return node.kind === 256;
+ ts.createForIn = createForIn;
+ function updateForIn(node, initializer, expression, statement) {
+ if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) {
+ return updateNode(createForIn(initializer, expression, statement, node), node);
+ }
+ return node;
}
- ts.isSourceFile = isSourceFile;
- function isWatchSet(options) {
- return options.watch && options.hasOwnProperty("watch");
+ ts.updateForIn = updateForIn;
+ function createForOf(initializer, expression, statement, location) {
+ var node = createNode(209, location);
+ node.initializer = initializer;
+ node.expression = expression;
+ node.statement = statement;
+ return node;
}
- ts.isWatchSet = isWatchSet;
-})(ts || (ts = {}));
-(function (ts) {
- function getDefaultLibFileName(options) {
- return options.target === 2 ? "lib.es6.d.ts" : "lib.d.ts";
+ ts.createForOf = createForOf;
+ function updateForOf(node, initializer, expression, statement) {
+ if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) {
+ return updateNode(createForOf(initializer, expression, statement, node), node);
+ }
+ return node;
}
- ts.getDefaultLibFileName = getDefaultLibFileName;
- function textSpanEnd(span) {
- return span.start + span.length;
+ ts.updateForOf = updateForOf;
+ function createContinue(label, location) {
+ var node = createNode(210, location);
+ if (label) {
+ node.label = label;
+ }
+ return node;
}
- ts.textSpanEnd = textSpanEnd;
- function textSpanIsEmpty(span) {
- return span.length === 0;
+ ts.createContinue = createContinue;
+ function updateContinue(node, label) {
+ if (node.label !== label) {
+ return updateNode(createContinue(label, node), node);
+ }
+ return node;
}
- ts.textSpanIsEmpty = textSpanIsEmpty;
- function textSpanContainsPosition(span, position) {
- return position >= span.start && position < textSpanEnd(span);
+ ts.updateContinue = updateContinue;
+ function createBreak(label, location) {
+ var node = createNode(211, location);
+ if (label) {
+ node.label = label;
+ }
+ return node;
}
- ts.textSpanContainsPosition = textSpanContainsPosition;
- function textSpanContainsTextSpan(span, other) {
- return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);
+ ts.createBreak = createBreak;
+ function updateBreak(node, label) {
+ if (node.label !== label) {
+ return updateNode(createBreak(label, node), node);
+ }
+ return node;
}
- ts.textSpanContainsTextSpan = textSpanContainsTextSpan;
- function textSpanOverlapsWith(span, other) {
- var overlapStart = Math.max(span.start, other.start);
- var overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other));
- return overlapStart < overlapEnd;
+ ts.updateBreak = updateBreak;
+ function createReturn(expression, location) {
+ var node = createNode(212, location);
+ node.expression = expression;
+ return node;
}
- ts.textSpanOverlapsWith = textSpanOverlapsWith;
- function textSpanOverlap(span1, span2) {
- var overlapStart = Math.max(span1.start, span2.start);
- var overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));
- if (overlapStart < overlapEnd) {
- return createTextSpanFromBounds(overlapStart, overlapEnd);
+ ts.createReturn = createReturn;
+ function updateReturn(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createReturn(expression, node), node);
}
- return undefined;
- }
- ts.textSpanOverlap = textSpanOverlap;
- function textSpanIntersectsWithTextSpan(span, other) {
- return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start;
+ return node;
}
- ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan;
- function textSpanIntersectsWith(span, start, length) {
- var end = start + length;
- return start <= textSpanEnd(span) && end >= span.start;
+ ts.updateReturn = updateReturn;
+ function createWith(expression, statement, location) {
+ var node = createNode(213, location);
+ node.expression = expression;
+ node.statement = statement;
+ return node;
}
- ts.textSpanIntersectsWith = textSpanIntersectsWith;
- function decodedTextSpanIntersectsWith(start1, length1, start2, length2) {
- var end1 = start1 + length1;
- var end2 = start2 + length2;
- return start2 <= end1 && end2 >= start1;
+ ts.createWith = createWith;
+ function updateWith(node, expression, statement) {
+ if (node.expression !== expression || node.statement !== statement) {
+ return updateNode(createWith(expression, statement, node), node);
+ }
+ return node;
}
- ts.decodedTextSpanIntersectsWith = decodedTextSpanIntersectsWith;
- function textSpanIntersectsWithPosition(span, position) {
- return position <= textSpanEnd(span) && position >= span.start;
+ ts.updateWith = updateWith;
+ function createSwitch(expression, caseBlock, location) {
+ var node = createNode(214, location);
+ node.expression = parenthesizeExpressionForList(expression);
+ node.caseBlock = caseBlock;
+ return node;
}
- ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition;
- function textSpanIntersection(span1, span2) {
- var intersectStart = Math.max(span1.start, span2.start);
- var intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));
- if (intersectStart <= intersectEnd) {
- return createTextSpanFromBounds(intersectStart, intersectEnd);
+ ts.createSwitch = createSwitch;
+ function updateSwitch(node, expression, caseBlock) {
+ if (node.expression !== expression || node.caseBlock !== caseBlock) {
+ return updateNode(createSwitch(expression, caseBlock, node), node);
}
- return undefined;
+ return node;
}
- ts.textSpanIntersection = textSpanIntersection;
- function createTextSpan(start, length) {
- if (start < 0) {
- throw new Error("start < 0");
- }
- if (length < 0) {
- throw new Error("length < 0");
+ ts.updateSwitch = updateSwitch;
+ function createLabel(label, statement, location) {
+ var node = createNode(215, location);
+ node.label = typeof label === "string" ? createIdentifier(label) : label;
+ node.statement = statement;
+ return node;
+ }
+ ts.createLabel = createLabel;
+ function updateLabel(node, label, statement) {
+ if (node.label !== label || node.statement !== statement) {
+ return updateNode(createLabel(label, statement, node), node);
}
- return { start: start, length: length };
+ return node;
}
- ts.createTextSpan = createTextSpan;
- function createTextSpanFromBounds(start, end) {
- return createTextSpan(start, end - start);
+ ts.updateLabel = updateLabel;
+ function createThrow(expression, location) {
+ var node = createNode(216, location);
+ node.expression = expression;
+ return node;
}
- ts.createTextSpanFromBounds = createTextSpanFromBounds;
- function textChangeRangeNewSpan(range) {
- return createTextSpan(range.span.start, range.newLength);
- }
- ts.textChangeRangeNewSpan = textChangeRangeNewSpan;
- function textChangeRangeIsUnchanged(range) {
- return textSpanIsEmpty(range.span) && range.newLength === 0;
- }
- ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged;
- function createTextChangeRange(span, newLength) {
- if (newLength < 0) {
- throw new Error("newLength < 0");
+ ts.createThrow = createThrow;
+ function updateThrow(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createThrow(expression, node), node);
}
- return { span: span, newLength: newLength };
+ return node;
}
- ts.createTextChangeRange = createTextChangeRange;
- ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0);
- function collapseTextChangeRangesAcrossMultipleVersions(changes) {
- if (changes.length === 0) {
- return ts.unchangedTextChangeRange;
- }
- if (changes.length === 1) {
- return changes[0];
- }
- var change0 = changes[0];
- var oldStartN = change0.span.start;
- var oldEndN = textSpanEnd(change0.span);
- var newEndN = oldStartN + change0.newLength;
- for (var i = 1; i < changes.length; i++) {
- var nextChange = changes[i];
- var oldStart1 = oldStartN;
- var oldEnd1 = oldEndN;
- var newEnd1 = newEndN;
- var oldStart2 = nextChange.span.start;
- var oldEnd2 = textSpanEnd(nextChange.span);
- var newEnd2 = oldStart2 + nextChange.newLength;
- oldStartN = Math.min(oldStart1, oldStart2);
- oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1));
- newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));
- }
- return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN);
+ ts.updateThrow = updateThrow;
+ function createTry(tryBlock, catchClause, finallyBlock, location) {
+ var node = createNode(217, location);
+ node.tryBlock = tryBlock;
+ node.catchClause = catchClause;
+ node.finallyBlock = finallyBlock;
+ return node;
}
- ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
- function getTypeParameterOwner(d) {
- if (d && d.kind === 141) {
- for (var current = d; current; current = current.parent) {
- if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 222) {
- return current;
- }
- }
+ ts.createTry = createTry;
+ function updateTry(node, tryBlock, catchClause, finallyBlock) {
+ if (node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock) {
+ return updateNode(createTry(tryBlock, catchClause, finallyBlock, node), node);
}
+ return node;
}
- ts.getTypeParameterOwner = getTypeParameterOwner;
- function isParameterPropertyDeclaration(node) {
- return ts.hasModifier(node, 92) && node.parent.kind === 148 && ts.isClassLike(node.parent.parent);
+ ts.updateTry = updateTry;
+ function createCaseBlock(clauses, location) {
+ var node = createNode(228, location);
+ node.clauses = createNodeArray(clauses);
+ return node;
}
- ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
- function walkUpBindingElementsAndPatterns(node) {
- while (node && (node.kind === 169 || ts.isBindingPattern(node))) {
- node = node.parent;
+ ts.createCaseBlock = createCaseBlock;
+ function updateCaseBlock(node, clauses) {
+ if (node.clauses !== clauses) {
+ return updateNode(createCaseBlock(clauses, node), node);
}
return node;
}
- function getCombinedModifierFlags(node) {
- node = walkUpBindingElementsAndPatterns(node);
- var flags = ts.getModifierFlags(node);
- if (node.kind === 218) {
- node = node.parent;
- }
- if (node && node.kind === 219) {
- flags |= ts.getModifierFlags(node);
- node = node.parent;
- }
- if (node && node.kind === 200) {
- flags |= ts.getModifierFlags(node);
- }
- return flags;
+ ts.updateCaseBlock = updateCaseBlock;
+ function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
+ var node = createNode(221, location, flags);
+ node.decorators = decorators ? createNodeArray(decorators) : undefined;
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.asteriskToken = asteriskToken;
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
+ node.parameters = createNodeArray(parameters);
+ node.type = type;
+ node.body = body;
+ return node;
}
- ts.getCombinedModifierFlags = getCombinedModifierFlags;
- function getCombinedNodeFlags(node) {
- node = walkUpBindingElementsAndPatterns(node);
- var flags = node.flags;
- if (node.kind === 218) {
- node = node.parent;
- }
- if (node && node.kind === 219) {
- flags |= node.flags;
- node = node.parent;
- }
- if (node && node.kind === 200) {
- flags |= node.flags;
+ ts.createFunctionDeclaration = createFunctionDeclaration;
+ function updateFunctionDeclaration(node, decorators, modifiers, name, typeParameters, parameters, type, body) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {
+ return updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);
}
- return flags;
- }
- ts.getCombinedNodeFlags = getCombinedNodeFlags;
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var NodeConstructor;
- var SourceFileConstructor;
- function createNode(kind, location, flags) {
- var ConstructorForKind = kind === 256
- ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))
- : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()));
- var node = location
- ? new ConstructorForKind(kind, location.pos, location.end)
- : new ConstructorForKind(kind, -1, -1);
- node.flags = flags | 8;
return node;
}
- function updateNode(updated, original) {
- if (updated !== original) {
- setOriginalNode(updated, original);
- if (original.startsOnNewLine) {
- updated.startsOnNewLine = true;
- }
- ts.aggregateTransformFlags(updated);
- }
- return updated;
+ ts.updateFunctionDeclaration = updateFunctionDeclaration;
+ function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) {
+ var node = createNode(222, location);
+ node.decorators = decorators ? createNodeArray(decorators) : undefined;
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.name = name;
+ node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
+ node.heritageClauses = createNodeArray(heritageClauses);
+ node.members = createNodeArray(members);
+ return node;
}
- ts.updateNode = updateNode;
- function createNodeArray(elements, location, hasTrailingComma) {
- if (elements) {
- if (ts.isNodeArray(elements)) {
- return elements;
- }
- }
- else {
- elements = [];
- }
- var array = elements;
- if (location) {
- array.pos = location.pos;
- array.end = location.end;
- }
- else {
- array.pos = -1;
- array.end = -1;
- }
- if (hasTrailingComma) {
- array.hasTrailingComma = true;
+ ts.createClassDeclaration = createClassDeclaration;
+ function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) {
+ return updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, node), node);
}
- return array;
- }
- ts.createNodeArray = createNodeArray;
- function createSynthesizedNode(kind, startsOnNewLine) {
- var node = createNode(kind, undefined);
- node.startsOnNewLine = startsOnNewLine;
return node;
}
- ts.createSynthesizedNode = createSynthesizedNode;
- function createSynthesizedNodeArray(elements) {
- return createNodeArray(elements, undefined);
+ ts.updateClassDeclaration = updateClassDeclaration;
+ function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) {
+ var node = createNode(231, location);
+ node.decorators = decorators ? createNodeArray(decorators) : undefined;
+ node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
+ node.importClause = importClause;
+ node.moduleSpecifier = moduleSpecifier;
+ return node;
}
- ts.createSynthesizedNodeArray = createSynthesizedNodeArray;
- function getSynthesizedClone(node) {
- var clone = createNode(node.kind, undefined, node.flags);
- setOriginalNode(clone, node);
- for (var key in node) {
- if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {
- continue;
- }
- clone[key] = node[key];
+ ts.createImportDeclaration = createImportDeclaration;
+ function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier) {
+ return updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, node), node);
}
- return clone;
+ return node;
}
- ts.getSynthesizedClone = getSynthesizedClone;
- function getMutableClone(node) {
- var clone = getSynthesizedClone(node);
- clone.pos = node.pos;
- clone.end = node.end;
- clone.parent = node.parent;
- return clone;
+ ts.updateImportDeclaration = updateImportDeclaration;
+ function createImportClause(name, namedBindings, location) {
+ var node = createNode(232, location);
+ node.name = name;
+ node.namedBindings = namedBindings;
+ return node;
}
- ts.getMutableClone = getMutableClone;
- function createLiteral(value, location) {
- if (typeof value === "number") {
- var node = createNode(8, location, undefined);
- node.text = value.toString();
- return node;
- }
- else if (typeof value === "boolean") {
- return createNode(value ? 99 : 84, location, undefined);
- }
- else if (typeof value === "string") {
- var node = createNode(9, location, undefined);
- node.text = value;
- return node;
- }
- else if (value) {
- var node = createNode(9, location, undefined);
- node.textSourceNode = value;
- node.text = value.text;
- return node;
+ ts.createImportClause = createImportClause;
+ function updateImportClause(node, name, namedBindings) {
+ if (node.name !== name || node.namedBindings !== namedBindings) {
+ return updateNode(createImportClause(name, namedBindings, node), node);
}
+ return node;
}
- ts.createLiteral = createLiteral;
- var nextAutoGenerateId = 0;
- function createIdentifier(text, location) {
- var node = createNode(69, location);
- node.text = ts.escapeIdentifier(text);
- node.originalKeywordKind = ts.stringToToken(text);
- node.autoGenerateKind = 0;
- node.autoGenerateId = 0;
+ ts.updateImportClause = updateImportClause;
+ function createNamespaceImport(name, location) {
+ var node = createNode(233, location);
+ node.name = name;
return node;
}
- ts.createIdentifier = createIdentifier;
- function createTempVariable(recordTempVariable, location) {
- var name = createNode(69, location);
- name.text = "";
- name.originalKeywordKind = 0;
- name.autoGenerateKind = 1;
- name.autoGenerateId = nextAutoGenerateId;
- nextAutoGenerateId++;
- if (recordTempVariable) {
- recordTempVariable(name);
+ ts.createNamespaceImport = createNamespaceImport;
+ function updateNamespaceImport(node, name) {
+ if (node.name !== name) {
+ return updateNode(createNamespaceImport(name, node), node);
}
- return name;
- }
- ts.createTempVariable = createTempVariable;
- function createLoopVariable(location) {
- var name = createNode(69, location);
- name.text = "";
- name.originalKeywordKind = 0;
- name.autoGenerateKind = 2;
- name.autoGenerateId = nextAutoGenerateId;
- nextAutoGenerateId++;
- return name;
- }
- ts.createLoopVariable = createLoopVariable;
- function createUniqueName(text, location) {
- var name = createNode(69, location);
- name.text = text;
- name.originalKeywordKind = 0;
- name.autoGenerateKind = 3;
- name.autoGenerateId = nextAutoGenerateId;
- nextAutoGenerateId++;
- return name;
- }
- ts.createUniqueName = createUniqueName;
- function getGeneratedNameForNode(node, location) {
- var name = createNode(69, location);
- name.original = node;
- name.text = "";
- name.originalKeywordKind = 0;
- name.autoGenerateKind = 4;
- name.autoGenerateId = nextAutoGenerateId;
- nextAutoGenerateId++;
- return name;
- }
- ts.getGeneratedNameForNode = getGeneratedNameForNode;
- function createToken(token) {
- return createNode(token);
- }
- ts.createToken = createToken;
- function createSuper() {
- var node = createNode(95);
return node;
}
- ts.createSuper = createSuper;
- function createThis(location) {
- var node = createNode(97, location);
+ ts.updateNamespaceImport = updateNamespaceImport;
+ function createNamedImports(elements, location) {
+ var node = createNode(234, location);
+ node.elements = createNodeArray(elements);
return node;
}
- ts.createThis = createThis;
- function createNull() {
- var node = createNode(93);
+ ts.createNamedImports = createNamedImports;
+ function updateNamedImports(node, elements) {
+ if (node.elements !== elements) {
+ return updateNode(createNamedImports(elements, node), node);
+ }
return node;
}
- ts.createNull = createNull;
- function createComputedPropertyName(expression, location) {
- var node = createNode(140, location);
- node.expression = expression;
+ ts.updateNamedImports = updateNamedImports;
+ function createImportSpecifier(propertyName, name, location) {
+ var node = createNode(235, location);
+ node.propertyName = propertyName;
+ node.name = name;
return node;
}
- ts.createComputedPropertyName = createComputedPropertyName;
- function updateComputedPropertyName(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createComputedPropertyName(expression, node), node);
+ ts.createImportSpecifier = createImportSpecifier;
+ function updateImportSpecifier(node, propertyName, name) {
+ if (node.propertyName !== propertyName || node.name !== name) {
+ return updateNode(createImportSpecifier(propertyName, name, node), node);
}
return node;
}
- ts.updateComputedPropertyName = updateComputedPropertyName;
- function createParameter(name, initializer, location) {
- return createParameterDeclaration(undefined, undefined, undefined, name, undefined, undefined, initializer, location);
- }
- ts.createParameter = createParameter;
- function createParameterDeclaration(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) {
- var node = createNode(142, location, flags);
+ ts.updateImportSpecifier = updateImportSpecifier;
+ function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) {
+ var node = createNode(236, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.dotDotDotToken = dotDotDotToken;
- node.name = typeof name === "string" ? createIdentifier(name) : name;
- node.questionToken = questionToken;
- node.type = type;
- node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined;
+ node.isExportEquals = isExportEquals;
+ node.expression = expression;
return node;
}
- ts.createParameterDeclaration = createParameterDeclaration;
- function updateParameterDeclaration(node, decorators, modifiers, name, type, initializer) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {
- return updateNode(createParameterDeclaration(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node);
+ ts.createExportAssignment = createExportAssignment;
+ function updateExportAssignment(node, decorators, modifiers, expression) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression) {
+ return updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression, node), node);
}
return node;
}
- ts.updateParameterDeclaration = updateParameterDeclaration;
- function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) {
- var node = createNode(145, location);
+ ts.updateExportAssignment = updateExportAssignment;
+ function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) {
+ var node = createNode(237, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.name = typeof name === "string" ? createIdentifier(name) : name;
- node.questionToken = questionToken;
- node.type = type;
- node.initializer = initializer;
+ node.exportClause = exportClause;
+ node.moduleSpecifier = moduleSpecifier;
return node;
}
- ts.createProperty = createProperty;
- function updateProperty(node, decorators, modifiers, name, type, initializer) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {
- return updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer, node), node);
+ ts.createExportDeclaration = createExportDeclaration;
+ function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier) {
+ return updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, node), node);
}
return node;
}
- ts.updateProperty = updateProperty;
- function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
- var node = createNode(147, location, flags);
- node.decorators = decorators ? createNodeArray(decorators) : undefined;
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.asteriskToken = asteriskToken;
- node.name = typeof name === "string" ? createIdentifier(name) : name;
- node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
- node.parameters = createNodeArray(parameters);
- node.type = type;
- node.body = body;
+ ts.updateExportDeclaration = updateExportDeclaration;
+ function createNamedExports(elements, location) {
+ var node = createNode(238, location);
+ node.elements = createNodeArray(elements);
return node;
}
- ts.createMethod = createMethod;
- function updateMethod(node, decorators, modifiers, name, typeParameters, parameters, type, body) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {
- return updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);
+ ts.createNamedExports = createNamedExports;
+ function updateNamedExports(node, elements) {
+ if (node.elements !== elements) {
+ return updateNode(createNamedExports(elements, node), node);
}
return node;
}
- ts.updateMethod = updateMethod;
- function createConstructor(decorators, modifiers, parameters, body, location, flags) {
- var node = createNode(148, location, flags);
- node.decorators = decorators ? createNodeArray(decorators) : undefined;
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.typeParameters = undefined;
- node.parameters = createNodeArray(parameters);
- node.type = undefined;
- node.body = body;
+ ts.updateNamedExports = updateNamedExports;
+ function createExportSpecifier(name, propertyName, location) {
+ var node = createNode(239, location);
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName;
return node;
}
- ts.createConstructor = createConstructor;
- function updateConstructor(node, decorators, modifiers, parameters, body) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body) {
- return updateNode(createConstructor(decorators, modifiers, parameters, body, node, node.flags), node);
+ ts.createExportSpecifier = createExportSpecifier;
+ function updateExportSpecifier(node, name, propertyName) {
+ if (node.name !== name || node.propertyName !== propertyName) {
+ return updateNode(createExportSpecifier(name, propertyName, node), node);
}
return node;
}
- ts.updateConstructor = updateConstructor;
- function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) {
- var node = createNode(149, location, flags);
- node.decorators = decorators ? createNodeArray(decorators) : undefined;
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.name = typeof name === "string" ? createIdentifier(name) : name;
- node.typeParameters = undefined;
- node.parameters = createNodeArray(parameters);
- node.type = type;
- node.body = body;
+ ts.updateExportSpecifier = updateExportSpecifier;
+ function createJsxElement(openingElement, children, closingElement, location) {
+ var node = createNode(242, location);
+ node.openingElement = openingElement;
+ node.children = createNodeArray(children);
+ node.closingElement = closingElement;
return node;
}
- ts.createGetAccessor = createGetAccessor;
- function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body) {
- return updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body, node, node.flags), node);
+ ts.createJsxElement = createJsxElement;
+ function updateJsxElement(node, openingElement, children, closingElement) {
+ if (node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement) {
+ return updateNode(createJsxElement(openingElement, children, closingElement, node), node);
}
return node;
}
- ts.updateGetAccessor = updateGetAccessor;
- function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) {
- var node = createNode(150, location, flags);
- node.decorators = decorators ? createNodeArray(decorators) : undefined;
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.name = typeof name === "string" ? createIdentifier(name) : name;
- node.typeParameters = undefined;
- node.parameters = createNodeArray(parameters);
- node.body = body;
+ ts.updateJsxElement = updateJsxElement;
+ function createJsxSelfClosingElement(tagName, attributes, location) {
+ var node = createNode(243, location);
+ node.tagName = tagName;
+ node.attributes = createNodeArray(attributes);
return node;
}
- ts.createSetAccessor = createSetAccessor;
- function updateSetAccessor(node, decorators, modifiers, name, parameters, body) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body) {
- return updateNode(createSetAccessor(decorators, modifiers, name, parameters, body, node, node.flags), node);
+ ts.createJsxSelfClosingElement = createJsxSelfClosingElement;
+ function updateJsxSelfClosingElement(node, tagName, attributes) {
+ if (node.tagName !== tagName || node.attributes !== attributes) {
+ return updateNode(createJsxSelfClosingElement(tagName, attributes, node), node);
}
return node;
}
- ts.updateSetAccessor = updateSetAccessor;
- function createObjectBindingPattern(elements, location) {
- var node = createNode(167, location);
- node.elements = createNodeArray(elements);
+ ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;
+ function createJsxOpeningElement(tagName, attributes, location) {
+ var node = createNode(244, location);
+ node.tagName = tagName;
+ node.attributes = createNodeArray(attributes);
return node;
}
- ts.createObjectBindingPattern = createObjectBindingPattern;
- function updateObjectBindingPattern(node, elements) {
- if (node.elements !== elements) {
- return updateNode(createObjectBindingPattern(elements, node), node);
+ ts.createJsxOpeningElement = createJsxOpeningElement;
+ function updateJsxOpeningElement(node, tagName, attributes) {
+ if (node.tagName !== tagName || node.attributes !== attributes) {
+ return updateNode(createJsxOpeningElement(tagName, attributes, node), node);
}
return node;
}
- ts.updateObjectBindingPattern = updateObjectBindingPattern;
- function createArrayBindingPattern(elements, location) {
- var node = createNode(168, location);
- node.elements = createNodeArray(elements);
+ ts.updateJsxOpeningElement = updateJsxOpeningElement;
+ function createJsxClosingElement(tagName, location) {
+ var node = createNode(245, location);
+ node.tagName = tagName;
return node;
}
- ts.createArrayBindingPattern = createArrayBindingPattern;
- function updateArrayBindingPattern(node, elements) {
- if (node.elements !== elements) {
- return updateNode(createArrayBindingPattern(elements, node), node);
+ ts.createJsxClosingElement = createJsxClosingElement;
+ function updateJsxClosingElement(node, tagName) {
+ if (node.tagName !== tagName) {
+ return updateNode(createJsxClosingElement(tagName, node), node);
}
return node;
}
- ts.updateArrayBindingPattern = updateArrayBindingPattern;
- function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) {
- var node = createNode(169, location);
- node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName;
- node.dotDotDotToken = dotDotDotToken;
- node.name = typeof name === "string" ? createIdentifier(name) : name;
+ ts.updateJsxClosingElement = updateJsxClosingElement;
+ function createJsxAttribute(name, initializer, location) {
+ var node = createNode(246, location);
+ node.name = name;
node.initializer = initializer;
return node;
}
- ts.createBindingElement = createBindingElement;
- function updateBindingElement(node, propertyName, name, initializer) {
- if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) {
- return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node);
+ ts.createJsxAttribute = createJsxAttribute;
+ function updateJsxAttribute(node, name, initializer) {
+ if (node.name !== name || node.initializer !== initializer) {
+ return updateNode(createJsxAttribute(name, initializer, node), node);
}
return node;
}
- ts.updateBindingElement = updateBindingElement;
- function createArrayLiteral(elements, location, multiLine) {
- var node = createNode(170, location);
- node.elements = parenthesizeListElements(createNodeArray(elements));
- if (multiLine) {
- node.multiLine = true;
- }
- return node;
- }
- ts.createArrayLiteral = createArrayLiteral;
- function updateArrayLiteral(node, elements) {
- if (node.elements !== elements) {
- return updateNode(createArrayLiteral(elements, node, node.multiLine), node);
- }
- return node;
- }
- ts.updateArrayLiteral = updateArrayLiteral;
- function createObjectLiteral(properties, location, multiLine) {
- var node = createNode(171, location);
- node.properties = createNodeArray(properties);
- if (multiLine) {
- node.multiLine = true;
- }
+ ts.updateJsxAttribute = updateJsxAttribute;
+ function createJsxSpreadAttribute(expression, location) {
+ var node = createNode(247, location);
+ node.expression = expression;
return node;
}
- ts.createObjectLiteral = createObjectLiteral;
- function updateObjectLiteral(node, properties) {
- if (node.properties !== properties) {
- return updateNode(createObjectLiteral(properties, node, node.multiLine), node);
+ ts.createJsxSpreadAttribute = createJsxSpreadAttribute;
+ function updateJsxSpreadAttribute(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createJsxSpreadAttribute(expression, node), node);
}
return node;
}
- ts.updateObjectLiteral = updateObjectLiteral;
- function createPropertyAccess(expression, name, location, flags) {
- var node = createNode(172, location, flags);
- node.expression = parenthesizeForAccess(expression);
- (node.emitNode || (node.emitNode = {})).flags |= 1048576;
- node.name = typeof name === "string" ? createIdentifier(name) : name;
+ ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;
+ function createJsxExpression(expression, location) {
+ var node = createNode(248, location);
+ node.expression = expression;
return node;
}
- ts.createPropertyAccess = createPropertyAccess;
- function updatePropertyAccess(node, expression, name) {
- if (node.expression !== expression || node.name !== name) {
- var propertyAccess = createPropertyAccess(expression, name, node, node.flags);
- (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node);
- return updateNode(propertyAccess, node);
+ ts.createJsxExpression = createJsxExpression;
+ function updateJsxExpression(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createJsxExpression(expression, node), node);
}
return node;
}
- ts.updatePropertyAccess = updatePropertyAccess;
- function createElementAccess(expression, index, location) {
- var node = createNode(173, location);
- node.expression = parenthesizeForAccess(expression);
- node.argumentExpression = typeof index === "number" ? createLiteral(index) : index;
+ ts.updateJsxExpression = updateJsxExpression;
+ function createHeritageClause(token, types, location) {
+ var node = createNode(251, location);
+ node.token = token;
+ node.types = createNodeArray(types);
return node;
}
- ts.createElementAccess = createElementAccess;
- function updateElementAccess(node, expression, argumentExpression) {
- if (node.expression !== expression || node.argumentExpression !== argumentExpression) {
- return updateNode(createElementAccess(expression, argumentExpression, node), node);
+ ts.createHeritageClause = createHeritageClause;
+ function updateHeritageClause(node, types) {
+ if (node.types !== types) {
+ return updateNode(createHeritageClause(node.token, types, node), node);
}
return node;
}
- ts.updateElementAccess = updateElementAccess;
- function createCall(expression, typeArguments, argumentsArray, location, flags) {
- var node = createNode(174, location, flags);
- node.expression = parenthesizeForAccess(expression);
- if (typeArguments) {
- node.typeArguments = createNodeArray(typeArguments);
- }
- node.arguments = parenthesizeListElements(createNodeArray(argumentsArray));
+ ts.updateHeritageClause = updateHeritageClause;
+ function createCaseClause(expression, statements, location) {
+ var node = createNode(249, location);
+ node.expression = parenthesizeExpressionForList(expression);
+ node.statements = createNodeArray(statements);
return node;
}
- ts.createCall = createCall;
- function updateCall(node, expression, typeArguments, argumentsArray) {
- if (expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments) {
- return updateNode(createCall(expression, typeArguments, argumentsArray, node, node.flags), node);
+ ts.createCaseClause = createCaseClause;
+ function updateCaseClause(node, expression, statements) {
+ if (node.expression !== expression || node.statements !== statements) {
+ return updateNode(createCaseClause(expression, statements, node), node);
}
return node;
}
- ts.updateCall = updateCall;
- function createNew(expression, typeArguments, argumentsArray, location, flags) {
- var node = createNode(175, location, flags);
- node.expression = parenthesizeForNew(expression);
- node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;
- node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;
+ ts.updateCaseClause = updateCaseClause;
+ function createDefaultClause(statements, location) {
+ var node = createNode(250, location);
+ node.statements = createNodeArray(statements);
return node;
}
- ts.createNew = createNew;
- function updateNew(node, expression, typeArguments, argumentsArray) {
- if (node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray) {
- return updateNode(createNew(expression, typeArguments, argumentsArray, node, node.flags), node);
+ ts.createDefaultClause = createDefaultClause;
+ function updateDefaultClause(node, statements) {
+ if (node.statements !== statements) {
+ return updateNode(createDefaultClause(statements, node), node);
}
return node;
}
- ts.updateNew = updateNew;
- function createTaggedTemplate(tag, template, location) {
- var node = createNode(176, location);
- node.tag = parenthesizeForAccess(tag);
- node.template = template;
+ ts.updateDefaultClause = updateDefaultClause;
+ function createCatchClause(variableDeclaration, block, location) {
+ var node = createNode(252, location);
+ node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration;
+ node.block = block;
return node;
}
- ts.createTaggedTemplate = createTaggedTemplate;
- function updateTaggedTemplate(node, tag, template) {
- if (node.tag !== tag || node.template !== template) {
- return updateNode(createTaggedTemplate(tag, template, node), node);
+ ts.createCatchClause = createCatchClause;
+ function updateCatchClause(node, variableDeclaration, block) {
+ if (node.variableDeclaration !== variableDeclaration || node.block !== block) {
+ return updateNode(createCatchClause(variableDeclaration, block, node), node);
}
return node;
}
- ts.updateTaggedTemplate = updateTaggedTemplate;
- function createParen(expression, location) {
- var node = createNode(178, location);
- node.expression = expression;
+ ts.updateCatchClause = updateCatchClause;
+ function createPropertyAssignment(name, initializer, location) {
+ var node = createNode(253, location);
+ node.name = typeof name === "string" ? createIdentifier(name) : name;
+ node.questionToken = undefined;
+ node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;
return node;
}
- ts.createParen = createParen;
- function updateParen(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createParen(expression, node), node);
+ ts.createPropertyAssignment = createPropertyAssignment;
+ function updatePropertyAssignment(node, name, initializer) {
+ if (node.name !== name || node.initializer !== initializer) {
+ return updateNode(createPropertyAssignment(name, initializer, node), node);
}
return node;
}
- ts.updateParen = updateParen;
- function createFunctionExpression(asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
- var node = createNode(179, location, flags);
- node.modifiers = undefined;
- node.asteriskToken = asteriskToken;
+ ts.updatePropertyAssignment = updatePropertyAssignment;
+ function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) {
+ var node = createNode(254, location);
node.name = typeof name === "string" ? createIdentifier(name) : name;
- node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
- node.parameters = createNodeArray(parameters);
- node.type = type;
- node.body = body;
+ node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;
return node;
}
- ts.createFunctionExpression = createFunctionExpression;
- function updateFunctionExpression(node, name, typeParameters, parameters, type, body) {
- if (node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {
- return updateNode(createFunctionExpression(node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);
+ ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment;
+ function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) {
+ if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) {
+ return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node);
}
return node;
}
- ts.updateFunctionExpression = updateFunctionExpression;
- function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) {
- var node = createNode(180, location, flags);
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
- node.parameters = createNodeArray(parameters);
- node.type = type;
- node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(34);
- node.body = parenthesizeConciseBody(body);
- return node;
- }
- ts.createArrowFunction = createArrowFunction;
- function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) {
- if (node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {
- return updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body, node, node.flags), node);
+ ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;
+ function updateSourceFileNode(node, statements) {
+ if (node.statements !== statements) {
+ var updated = createNode(256, node, node.flags);
+ updated.statements = createNodeArray(statements);
+ updated.endOfFileToken = node.endOfFileToken;
+ updated.fileName = node.fileName;
+ updated.path = node.path;
+ updated.text = node.text;
+ if (node.amdDependencies !== undefined)
+ updated.amdDependencies = node.amdDependencies;
+ if (node.moduleName !== undefined)
+ updated.moduleName = node.moduleName;
+ if (node.referencedFiles !== undefined)
+ updated.referencedFiles = node.referencedFiles;
+ if (node.typeReferenceDirectives !== undefined)
+ updated.typeReferenceDirectives = node.typeReferenceDirectives;
+ if (node.languageVariant !== undefined)
+ updated.languageVariant = node.languageVariant;
+ if (node.isDeclarationFile !== undefined)
+ updated.isDeclarationFile = node.isDeclarationFile;
+ if (node.renamedDependencies !== undefined)
+ updated.renamedDependencies = node.renamedDependencies;
+ if (node.hasNoDefaultLib !== undefined)
+ updated.hasNoDefaultLib = node.hasNoDefaultLib;
+ if (node.languageVersion !== undefined)
+ updated.languageVersion = node.languageVersion;
+ if (node.scriptKind !== undefined)
+ updated.scriptKind = node.scriptKind;
+ if (node.externalModuleIndicator !== undefined)
+ updated.externalModuleIndicator = node.externalModuleIndicator;
+ if (node.commonJsModuleIndicator !== undefined)
+ updated.commonJsModuleIndicator = node.commonJsModuleIndicator;
+ if (node.identifiers !== undefined)
+ updated.identifiers = node.identifiers;
+ if (node.nodeCount !== undefined)
+ updated.nodeCount = node.nodeCount;
+ if (node.identifierCount !== undefined)
+ updated.identifierCount = node.identifierCount;
+ if (node.symbolCount !== undefined)
+ updated.symbolCount = node.symbolCount;
+ if (node.parseDiagnostics !== undefined)
+ updated.parseDiagnostics = node.parseDiagnostics;
+ if (node.bindDiagnostics !== undefined)
+ updated.bindDiagnostics = node.bindDiagnostics;
+ if (node.lineMap !== undefined)
+ updated.lineMap = node.lineMap;
+ if (node.classifiableNames !== undefined)
+ updated.classifiableNames = node.classifiableNames;
+ if (node.resolvedModules !== undefined)
+ updated.resolvedModules = node.resolvedModules;
+ if (node.resolvedTypeReferenceDirectiveNames !== undefined)
+ updated.resolvedTypeReferenceDirectiveNames = node.resolvedTypeReferenceDirectiveNames;
+ if (node.imports !== undefined)
+ updated.imports = node.imports;
+ if (node.moduleAugmentations !== undefined)
+ updated.moduleAugmentations = node.moduleAugmentations;
+ if (node.externalHelpersModuleName !== undefined)
+ updated.externalHelpersModuleName = node.externalHelpersModuleName;
+ return updateNode(updated, node);
}
return node;
}
- ts.updateArrowFunction = updateArrowFunction;
- function createDelete(expression, location) {
- var node = createNode(181, location);
- node.expression = parenthesizePrefixOperand(expression);
- return node;
- }
- ts.createDelete = createDelete;
- function updateDelete(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createDelete(expression, node), expression);
- }
+ ts.updateSourceFileNode = updateSourceFileNode;
+ function createNotEmittedStatement(original) {
+ var node = createNode(287, original);
+ node.original = original;
return node;
}
- ts.updateDelete = updateDelete;
- function createTypeOf(expression, location) {
- var node = createNode(182, location);
- node.expression = parenthesizePrefixOperand(expression);
+ ts.createNotEmittedStatement = createNotEmittedStatement;
+ function createPartiallyEmittedExpression(expression, original, location) {
+ var node = createNode(288, location || original);
+ node.expression = expression;
+ node.original = original;
return node;
}
- ts.createTypeOf = createTypeOf;
- function updateTypeOf(node, expression) {
+ ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression;
+ function updatePartiallyEmittedExpression(node, expression) {
if (node.expression !== expression) {
- return updateNode(createTypeOf(expression, node), expression);
+ return updateNode(createPartiallyEmittedExpression(expression, node.original, node), node);
}
return node;
}
- ts.updateTypeOf = updateTypeOf;
- function createVoid(expression, location) {
- var node = createNode(183, location);
- node.expression = parenthesizePrefixOperand(expression);
- return node;
- }
- ts.createVoid = createVoid;
- function updateVoid(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createVoid(expression, node), node);
- }
- return node;
+ ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
+ function createComma(left, right) {
+ return createBinary(left, 25, right);
}
- ts.updateVoid = updateVoid;
- function createAwait(expression, location) {
- var node = createNode(184, location);
- node.expression = parenthesizePrefixOperand(expression);
- return node;
+ ts.createComma = createComma;
+ function createLessThan(left, right, location) {
+ return createBinary(left, 26, right, location);
}
- ts.createAwait = createAwait;
- function updateAwait(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createAwait(expression, node), node);
- }
- return node;
+ ts.createLessThan = createLessThan;
+ function createAssignment(left, right, location) {
+ return createBinary(left, 57, right, location);
}
- ts.updateAwait = updateAwait;
- function createPrefix(operator, operand, location) {
- var node = createNode(185, location);
- node.operator = operator;
- node.operand = parenthesizePrefixOperand(operand);
- return node;
+ ts.createAssignment = createAssignment;
+ function createStrictEquality(left, right) {
+ return createBinary(left, 33, right);
}
- ts.createPrefix = createPrefix;
- function updatePrefix(node, operand) {
- if (node.operand !== operand) {
- return updateNode(createPrefix(node.operator, operand, node), node);
- }
- return node;
+ ts.createStrictEquality = createStrictEquality;
+ function createStrictInequality(left, right) {
+ return createBinary(left, 34, right);
}
- ts.updatePrefix = updatePrefix;
- function createPostfix(operand, operator, location) {
- var node = createNode(186, location);
- node.operand = parenthesizePostfixOperand(operand);
- node.operator = operator;
- return node;
+ ts.createStrictInequality = createStrictInequality;
+ function createAdd(left, right) {
+ return createBinary(left, 36, right);
}
- ts.createPostfix = createPostfix;
- function updatePostfix(node, operand) {
- if (node.operand !== operand) {
- return updateNode(createPostfix(operand, node.operator, node), node);
- }
- return node;
+ ts.createAdd = createAdd;
+ function createSubtract(left, right) {
+ return createBinary(left, 37, right);
}
- ts.updatePostfix = updatePostfix;
- function createBinary(left, operator, right, location) {
- var operatorToken = typeof operator === "number" ? createToken(operator) : operator;
- var operatorKind = operatorToken.kind;
- var node = createNode(187, location);
- node.left = parenthesizeBinaryOperand(operatorKind, left, true, undefined);
- node.operatorToken = operatorToken;
- node.right = parenthesizeBinaryOperand(operatorKind, right, false, node.left);
- return node;
+ ts.createSubtract = createSubtract;
+ function createPostfixIncrement(operand, location) {
+ return createPostfix(operand, 42, location);
}
- ts.createBinary = createBinary;
- function updateBinary(node, left, right) {
- if (node.left !== left || node.right !== right) {
- return updateNode(createBinary(left, node.operatorToken, right, node), node);
- }
- return node;
+ ts.createPostfixIncrement = createPostfixIncrement;
+ function createLogicalAnd(left, right) {
+ return createBinary(left, 52, right);
}
- ts.updateBinary = updateBinary;
- function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) {
- var node = createNode(188, location);
- node.condition = condition;
- node.questionToken = questionToken;
- node.whenTrue = whenTrue;
- node.colonToken = colonToken;
- node.whenFalse = whenFalse;
- return node;
+ ts.createLogicalAnd = createLogicalAnd;
+ function createLogicalOr(left, right) {
+ return createBinary(left, 53, right);
}
- ts.createConditional = createConditional;
- function updateConditional(node, condition, whenTrue, whenFalse) {
- if (node.condition !== condition || node.whenTrue !== whenTrue || node.whenFalse !== whenFalse) {
- return updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse, node), node);
- }
- return node;
+ ts.createLogicalOr = createLogicalOr;
+ function createLogicalNot(operand) {
+ return createPrefix(50, operand);
}
- ts.updateConditional = updateConditional;
- function createTemplateExpression(head, templateSpans, location) {
- var node = createNode(189, location);
- node.head = head;
- node.templateSpans = createNodeArray(templateSpans);
- return node;
+ ts.createLogicalNot = createLogicalNot;
+ function createVoidZero() {
+ return createVoid(createLiteral(0));
}
- ts.createTemplateExpression = createTemplateExpression;
- function updateTemplateExpression(node, head, templateSpans) {
- if (node.head !== head || node.templateSpans !== templateSpans) {
- return updateNode(createTemplateExpression(head, templateSpans, node), node);
+ ts.createVoidZero = createVoidZero;
+ function createMemberAccessForPropertyName(target, memberName, location) {
+ if (ts.isComputedPropertyName(memberName)) {
+ return createElementAccess(target, memberName.expression, location);
}
- return node;
- }
- ts.updateTemplateExpression = updateTemplateExpression;
- function createYield(asteriskToken, expression, location) {
- var node = createNode(190, location);
- node.asteriskToken = asteriskToken;
- node.expression = expression;
- return node;
- }
- ts.createYield = createYield;
- function updateYield(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createYield(node.asteriskToken, expression, node), node);
+ else {
+ var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location);
+ (expression.emitNode || (expression.emitNode = {})).flags |= 2048;
+ return expression;
}
- return node;
}
- ts.updateYield = updateYield;
- function createSpread(expression, location) {
- var node = createNode(191, location);
- node.expression = parenthesizeExpressionForList(expression);
- return node;
+ ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName;
+ function createRestParameter(name) {
+ return createParameterDeclaration(undefined, undefined, createToken(23), name, undefined, undefined, undefined);
}
- ts.createSpread = createSpread;
- function updateSpread(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createSpread(expression, node), node);
- }
- return node;
+ ts.createRestParameter = createRestParameter;
+ function createFunctionCall(func, thisArg, argumentsList, location) {
+ return createCall(createPropertyAccess(func, "call"), undefined, [
+ thisArg
+ ].concat(argumentsList), location);
}
- ts.updateSpread = updateSpread;
- function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) {
- var node = createNode(192, location);
- node.decorators = undefined;
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.name = name;
- node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
- node.heritageClauses = createNodeArray(heritageClauses);
- node.members = createNodeArray(members);
- return node;
+ ts.createFunctionCall = createFunctionCall;
+ function createFunctionApply(func, thisArg, argumentsExpression, location) {
+ return createCall(createPropertyAccess(func, "apply"), undefined, [
+ thisArg,
+ argumentsExpression
+ ], location);
}
- ts.createClassExpression = createClassExpression;
- function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) {
- if (node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) {
- return updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members, node), node);
+ ts.createFunctionApply = createFunctionApply;
+ function createArraySlice(array, start) {
+ var argumentsList = [];
+ if (start !== undefined) {
+ argumentsList.push(typeof start === "number" ? createLiteral(start) : start);
}
- return node;
- }
- ts.updateClassExpression = updateClassExpression;
- function createOmittedExpression(location) {
- var node = createNode(193, location);
- return node;
+ return createCall(createPropertyAccess(array, "slice"), undefined, argumentsList);
}
- ts.createOmittedExpression = createOmittedExpression;
- function createExpressionWithTypeArguments(typeArguments, expression, location) {
- var node = createNode(194, location);
- node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;
- node.expression = parenthesizeForAccess(expression);
- return node;
+ ts.createArraySlice = createArraySlice;
+ function createArrayConcat(array, values) {
+ return createCall(createPropertyAccess(array, "concat"), undefined, values);
}
- ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments;
- function updateExpressionWithTypeArguments(node, typeArguments, expression) {
- if (node.typeArguments !== typeArguments || node.expression !== expression) {
- return updateNode(createExpressionWithTypeArguments(typeArguments, expression, node), node);
- }
- return node;
+ ts.createArrayConcat = createArrayConcat;
+ function createMathPow(left, right, location) {
+ return createCall(createPropertyAccess(createIdentifier("Math"), "pow"), undefined, [left, right], location);
}
- ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;
- function createTemplateSpan(expression, literal, location) {
- var node = createNode(197, location);
- node.expression = expression;
- node.literal = literal;
- return node;
+ ts.createMathPow = createMathPow;
+ function createReactNamespace(reactNamespace, parent) {
+ var react = createIdentifier(reactNamespace || "React");
+ react.flags &= ~8;
+ react.parent = parent;
+ return react;
}
- ts.createTemplateSpan = createTemplateSpan;
- function updateTemplateSpan(node, expression, literal) {
- if (node.expression !== expression || node.literal !== literal) {
- return updateNode(createTemplateSpan(expression, literal, node), node);
+ function createReactCreateElement(reactNamespace, tagName, props, children, parentElement, location) {
+ var argumentsList = [tagName];
+ if (props) {
+ argumentsList.push(props);
}
- return node;
- }
- ts.updateTemplateSpan = updateTemplateSpan;
- function createBlock(statements, location, multiLine, flags) {
- var block = createNode(199, location, flags);
- block.statements = createNodeArray(statements);
- if (multiLine) {
- block.multiLine = true;
+ if (children && children.length > 0) {
+ if (!props) {
+ argumentsList.push(createNull());
+ }
+ if (children.length > 1) {
+ for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
+ var child = children_1[_i];
+ child.startsOnNewLine = true;
+ argumentsList.push(child);
+ }
+ }
+ else {
+ argumentsList.push(children[0]);
+ }
}
- return block;
+ return createCall(createPropertyAccess(createReactNamespace(reactNamespace, parentElement), "createElement"), undefined, argumentsList, location);
}
- ts.createBlock = createBlock;
- function updateBlock(node, statements) {
- if (statements !== node.statements) {
- return updateNode(createBlock(statements, node, node.multiLine, node.flags), node);
- }
- return node;
+ ts.createReactCreateElement = createReactCreateElement;
+ function createLetDeclarationList(declarations, location) {
+ return createVariableDeclarationList(declarations, location, 1);
}
- ts.updateBlock = updateBlock;
- function createVariableStatement(modifiers, declarationList, location, flags) {
- var node = createNode(200, location, flags);
- node.decorators = undefined;
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
- return node;
- }
- ts.createVariableStatement = createVariableStatement;
- function updateVariableStatement(node, modifiers, declarationList) {
- if (node.modifiers !== modifiers || node.declarationList !== declarationList) {
- return updateNode(createVariableStatement(modifiers, declarationList, node, node.flags), node);
- }
- return node;
- }
- ts.updateVariableStatement = updateVariableStatement;
- function createVariableDeclarationList(declarations, location, flags) {
- var node = createNode(219, location, flags);
- node.declarations = createNodeArray(declarations);
- return node;
+ ts.createLetDeclarationList = createLetDeclarationList;
+ function createConstDeclarationList(declarations, location) {
+ return createVariableDeclarationList(declarations, location, 2);
}
- ts.createVariableDeclarationList = createVariableDeclarationList;
- function updateVariableDeclarationList(node, declarations) {
- if (node.declarations !== declarations) {
- return updateNode(createVariableDeclarationList(declarations, node, node.flags), node);
- }
- return node;
+ ts.createConstDeclarationList = createConstDeclarationList;
+ function createHelperName(externalHelpersModuleName, name) {
+ return externalHelpersModuleName
+ ? createPropertyAccess(externalHelpersModuleName, name)
+ : createIdentifier(name);
}
- ts.updateVariableDeclarationList = updateVariableDeclarationList;
- function createVariableDeclaration(name, type, initializer, location, flags) {
- var node = createNode(218, location, flags);
- node.name = typeof name === "string" ? createIdentifier(name) : name;
- node.type = type;
- node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;
- return node;
+ ts.createHelperName = createHelperName;
+ function createExtendsHelper(externalHelpersModuleName, name) {
+ return createCall(createHelperName(externalHelpersModuleName, "__extends"), undefined, [
+ name,
+ createIdentifier("_super")
+ ]);
}
- ts.createVariableDeclaration = createVariableDeclaration;
- function updateVariableDeclaration(node, name, type, initializer) {
- if (node.name !== name || node.type !== type || node.initializer !== initializer) {
- return updateNode(createVariableDeclaration(name, type, initializer, node, node.flags), node);
- }
- return node;
+ ts.createExtendsHelper = createExtendsHelper;
+ function createAssignHelper(externalHelpersModuleName, attributesSegments) {
+ return createCall(createHelperName(externalHelpersModuleName, "__assign"), undefined, attributesSegments);
}
- ts.updateVariableDeclaration = updateVariableDeclaration;
- function createEmptyStatement(location) {
- return createNode(201, location);
+ ts.createAssignHelper = createAssignHelper;
+ function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) {
+ return createCall(createHelperName(externalHelpersModuleName, "__param"), undefined, [
+ createLiteral(parameterOffset),
+ expression
+ ], location);
}
- ts.createEmptyStatement = createEmptyStatement;
- function createStatement(expression, location, flags) {
- var node = createNode(202, location, flags);
- node.expression = parenthesizeExpressionForExpressionStatement(expression);
- return node;
+ ts.createParamHelper = createParamHelper;
+ function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) {
+ return createCall(createHelperName(externalHelpersModuleName, "__metadata"), undefined, [
+ createLiteral(metadataKey),
+ metadataValue
+ ]);
}
- ts.createStatement = createStatement;
- function updateStatement(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createStatement(expression, node, node.flags), node);
+ ts.createMetadataHelper = createMetadataHelper;
+ function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) {
+ var argumentsArray = [];
+ argumentsArray.push(createArrayLiteral(decoratorExpressions, undefined, true));
+ argumentsArray.push(target);
+ if (memberName) {
+ argumentsArray.push(memberName);
+ if (descriptor) {
+ argumentsArray.push(descriptor);
+ }
}
- return node;
+ return createCall(createHelperName(externalHelpersModuleName, "__decorate"), undefined, argumentsArray, location);
}
- ts.updateStatement = updateStatement;
- function createIf(expression, thenStatement, elseStatement, location) {
- var node = createNode(203, location);
- node.expression = expression;
- node.thenStatement = thenStatement;
- node.elseStatement = elseStatement;
- return node;
+ ts.createDecorateHelper = createDecorateHelper;
+ function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) {
+ var generatorFunc = createFunctionExpression(undefined, createToken(38), undefined, undefined, [], undefined, body);
+ (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152;
+ return createCall(createHelperName(externalHelpersModuleName, "__awaiter"), undefined, [
+ createThis(),
+ hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(),
+ promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(),
+ generatorFunc
+ ]);
}
- ts.createIf = createIf;
- function updateIf(node, expression, thenStatement, elseStatement) {
- if (node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement) {
- return updateNode(createIf(expression, thenStatement, elseStatement, node), node);
- }
- return node;
+ ts.createAwaiterHelper = createAwaiterHelper;
+ function createHasOwnProperty(target, propertyName) {
+ return createCall(createPropertyAccess(target, "hasOwnProperty"), undefined, [propertyName]);
}
- ts.updateIf = updateIf;
- function createDo(statement, expression, location) {
- var node = createNode(204, location);
- node.statement = statement;
- node.expression = expression;
- return node;
+ ts.createHasOwnProperty = createHasOwnProperty;
+ function createObjectCreate(prototype) {
+ return createCall(createPropertyAccess(createIdentifier("Object"), "create"), undefined, [prototype]);
}
- ts.createDo = createDo;
- function updateDo(node, statement, expression) {
- if (node.statement !== statement || node.expression !== expression) {
- return updateNode(createDo(statement, expression, node), node);
- }
- return node;
+ function createGeti(target) {
+ return createArrowFunction(undefined, undefined, [createParameter("name")], undefined, undefined, createElementAccess(target, createIdentifier("name")));
}
- ts.updateDo = updateDo;
- function createWhile(expression, statement, location) {
- var node = createNode(205, location);
- node.expression = expression;
- node.statement = statement;
- return node;
+ function createSeti(target) {
+ return createArrowFunction(undefined, undefined, [
+ createParameter("name"),
+ createParameter("value")
+ ], undefined, undefined, createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value")));
}
- ts.createWhile = createWhile;
- function updateWhile(node, expression, statement) {
- if (node.expression !== expression || node.statement !== statement) {
- return updateNode(createWhile(expression, statement, node), node);
- }
- return node;
+ function createAdvancedAsyncSuperHelper() {
+ var createCache = createVariableStatement(undefined, createConstDeclarationList([
+ createVariableDeclaration("cache", undefined, createObjectCreate(createNull()))
+ ]));
+ var getter = createGetAccessor(undefined, undefined, "value", [], undefined, createBlock([
+ createReturn(createCall(createIdentifier("geti"), undefined, [createIdentifier("name")]))
+ ]));
+ var setter = createSetAccessor(undefined, undefined, "value", [createParameter("v")], createBlock([
+ createStatement(createCall(createIdentifier("seti"), undefined, [
+ createIdentifier("name"),
+ createIdentifier("v")
+ ]))
+ ]));
+ var getOrCreateAccessorsForName = createReturn(createArrowFunction(undefined, undefined, [createParameter("name")], undefined, undefined, createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([
+ getter,
+ setter
+ ]))))));
+ return createVariableStatement(undefined, createConstDeclarationList([
+ createVariableDeclaration("_super", undefined, createCall(createParen(createFunctionExpression(undefined, undefined, undefined, undefined, [
+ createParameter("geti"),
+ createParameter("seti")
+ ], undefined, createBlock([
+ createCache,
+ getOrCreateAccessorsForName
+ ]))), undefined, [
+ createGeti(createSuper()),
+ createSeti(createSuper())
+ ]))
+ ]));
}
- ts.updateWhile = updateWhile;
- function createFor(initializer, condition, incrementor, statement, location) {
- var node = createNode(206, location, undefined);
- node.initializer = initializer;
- node.condition = condition;
- node.incrementor = incrementor;
- node.statement = statement;
- return node;
+ ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper;
+ function createSimpleAsyncSuperHelper() {
+ return createVariableStatement(undefined, createConstDeclarationList([
+ createVariableDeclaration("_super", undefined, createGeti(createSuper()))
+ ]));
}
- ts.createFor = createFor;
- function updateFor(node, initializer, condition, incrementor, statement) {
- if (node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement) {
- return updateNode(createFor(initializer, condition, incrementor, statement, node), node);
+ ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper;
+ function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
+ var target = skipParentheses(node);
+ switch (target.kind) {
+ case 70:
+ return cacheIdentifiers;
+ case 98:
+ case 8:
+ case 9:
+ return false;
+ case 171:
+ var elements = target.elements;
+ if (elements.length === 0) {
+ return false;
+ }
+ return true;
+ case 172:
+ return target.properties.length > 0;
+ default:
+ return true;
}
- return node;
- }
- ts.updateFor = updateFor;
- function createForIn(initializer, expression, statement, location) {
- var node = createNode(207, location);
- node.initializer = initializer;
- node.expression = expression;
- node.statement = statement;
- return node;
}
- ts.createForIn = createForIn;
- function updateForIn(node, initializer, expression, statement) {
- if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) {
- return updateNode(createForIn(initializer, expression, statement, node), node);
+ function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) {
+ var callee = skipOuterExpressions(expression, 7);
+ var thisArg;
+ var target;
+ if (ts.isSuperProperty(callee)) {
+ thisArg = createThis();
+ target = callee;
}
- return node;
+ else if (callee.kind === 96) {
+ thisArg = createThis();
+ target = languageVersion < 2 ? createIdentifier("_super", callee) : callee;
+ }
+ else {
+ switch (callee.kind) {
+ case 173: {
+ if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
+ thisArg = createTempVariable(recordTempVariable);
+ target = createPropertyAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.name, callee);
+ }
+ else {
+ thisArg = callee.expression;
+ target = callee;
+ }
+ break;
+ }
+ case 174: {
+ if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
+ thisArg = createTempVariable(recordTempVariable);
+ target = createElementAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.argumentExpression, callee);
+ }
+ else {
+ thisArg = callee.expression;
+ target = callee;
+ }
+ break;
+ }
+ default: {
+ thisArg = createVoidZero();
+ target = parenthesizeForAccess(expression);
+ break;
+ }
+ }
+ }
+ return { target: target, thisArg: thisArg };
}
- ts.updateForIn = updateForIn;
- function createForOf(initializer, expression, statement, location) {
- var node = createNode(208, location);
- node.initializer = initializer;
- node.expression = expression;
- node.statement = statement;
- return node;
+ ts.createCallBinding = createCallBinding;
+ function inlineExpressions(expressions) {
+ return ts.reduceLeft(expressions, createComma);
}
- ts.createForOf = createForOf;
- function updateForOf(node, initializer, expression, statement) {
- if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) {
- return updateNode(createForOf(initializer, expression, statement, node), node);
+ ts.inlineExpressions = inlineExpressions;
+ function createExpressionFromEntityName(node) {
+ if (ts.isQualifiedName(node)) {
+ var left = createExpressionFromEntityName(node.left);
+ var right = getMutableClone(node.right);
+ return createPropertyAccess(left, right, node);
}
- return node;
- }
- ts.updateForOf = updateForOf;
- function createContinue(label, location) {
- var node = createNode(209, location);
- if (label) {
- node.label = label;
+ else {
+ return getMutableClone(node);
}
- return node;
}
- ts.createContinue = createContinue;
- function updateContinue(node, label) {
- if (node.label !== label) {
- return updateNode(createContinue(label, node), node);
+ ts.createExpressionFromEntityName = createExpressionFromEntityName;
+ function createExpressionForPropertyName(memberName) {
+ if (ts.isIdentifier(memberName)) {
+ return createLiteral(memberName, undefined);
}
- return node;
- }
- ts.updateContinue = updateContinue;
- function createBreak(label, location) {
- var node = createNode(210, location);
- if (label) {
- node.label = label;
+ else if (ts.isComputedPropertyName(memberName)) {
+ return getMutableClone(memberName.expression);
}
- return node;
- }
- ts.createBreak = createBreak;
- function updateBreak(node, label) {
- if (node.label !== label) {
- return updateNode(createBreak(label, node), node);
+ else {
+ return getMutableClone(memberName);
}
- return node;
- }
- ts.updateBreak = updateBreak;
- function createReturn(expression, location) {
- var node = createNode(211, location);
- node.expression = expression;
- return node;
}
- ts.createReturn = createReturn;
- function updateReturn(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createReturn(expression, node), node);
+ ts.createExpressionForPropertyName = createExpressionForPropertyName;
+ function createExpressionForObjectLiteralElementLike(node, property, receiver) {
+ switch (property.kind) {
+ case 150:
+ case 151:
+ return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine);
+ case 253:
+ return createExpressionForPropertyAssignment(property, receiver);
+ case 254:
+ return createExpressionForShorthandPropertyAssignment(property, receiver);
+ case 148:
+ return createExpressionForMethodDeclaration(property, receiver);
}
- return node;
- }
- ts.updateReturn = updateReturn;
- function createWith(expression, statement, location) {
- var node = createNode(212, location);
- node.expression = expression;
- node.statement = statement;
- return node;
}
- ts.createWith = createWith;
- function updateWith(node, expression, statement) {
- if (node.expression !== expression || node.statement !== statement) {
- return updateNode(createWith(expression, statement, node), node);
+ ts.createExpressionForObjectLiteralElementLike = createExpressionForObjectLiteralElementLike;
+ function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) {
+ var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
+ if (property === firstAccessor) {
+ var properties_1 = [];
+ if (getAccessor) {
+ var getterFunction = createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body, getAccessor);
+ setOriginalNode(getterFunction, getAccessor);
+ var getter = createPropertyAssignment("get", getterFunction);
+ properties_1.push(getter);
+ }
+ if (setAccessor) {
+ var setterFunction = createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body, setAccessor);
+ setOriginalNode(setterFunction, setAccessor);
+ var setter = createPropertyAssignment("set", setterFunction);
+ properties_1.push(setter);
+ }
+ properties_1.push(createPropertyAssignment("enumerable", createLiteral(true)));
+ properties_1.push(createPropertyAssignment("configurable", createLiteral(true)));
+ var expression = createCall(createPropertyAccess(createIdentifier("Object"), "defineProperty"), undefined, [
+ receiver,
+ createExpressionForPropertyName(property.name),
+ createObjectLiteral(properties_1, undefined, multiLine)
+ ], firstAccessor);
+ return ts.aggregateTransformFlags(expression);
}
- return node;
- }
- ts.updateWith = updateWith;
- function createSwitch(expression, caseBlock, location) {
- var node = createNode(213, location);
- node.expression = parenthesizeExpressionForList(expression);
- node.caseBlock = caseBlock;
- return node;
+ return undefined;
}
- ts.createSwitch = createSwitch;
- function updateSwitch(node, expression, caseBlock) {
- if (node.expression !== expression || node.caseBlock !== caseBlock) {
- return updateNode(createSwitch(expression, caseBlock, node), node);
- }
- return node;
+ function createExpressionForPropertyAssignment(property, receiver) {
+ return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer, property), property));
}
- ts.updateSwitch = updateSwitch;
- function createLabel(label, statement, location) {
- var node = createNode(214, location);
- node.label = typeof label === "string" ? createIdentifier(label) : label;
- node.statement = statement;
- return node;
+ function createExpressionForShorthandPropertyAssignment(property, receiver) {
+ return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), getSynthesizedClone(property.name), property), property));
}
- ts.createLabel = createLabel;
- function updateLabel(node, label, statement) {
- if (node.label !== label || node.statement !== statement) {
- return updateNode(createLabel(label, statement, node), node);
- }
- return node;
+ function createExpressionForMethodDeclaration(method, receiver) {
+ return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method));
}
- ts.updateLabel = updateLabel;
- function createThrow(expression, location) {
- var node = createNode(215, location);
- node.expression = expression;
- return node;
+ function isUseStrictPrologue(node) {
+ return node.expression.text === "use strict";
}
- ts.createThrow = createThrow;
- function updateThrow(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createThrow(expression, node), node);
+ function addPrologueDirectives(target, source, ensureUseStrict, visitor) {
+ ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array");
+ var foundUseStrict = false;
+ var statementOffset = 0;
+ var numStatements = source.length;
+ while (statementOffset < numStatements) {
+ var statement = source[statementOffset];
+ if (ts.isPrologueDirective(statement)) {
+ if (isUseStrictPrologue(statement)) {
+ foundUseStrict = true;
+ }
+ target.push(statement);
+ }
+ else {
+ break;
+ }
+ statementOffset++;
}
- return node;
- }
- ts.updateThrow = updateThrow;
- function createTry(tryBlock, catchClause, finallyBlock, location) {
- var node = createNode(216, location);
- node.tryBlock = tryBlock;
- node.catchClause = catchClause;
- node.finallyBlock = finallyBlock;
- return node;
- }
- ts.createTry = createTry;
- function updateTry(node, tryBlock, catchClause, finallyBlock) {
- if (node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock) {
- return updateNode(createTry(tryBlock, catchClause, finallyBlock, node), node);
+ if (ensureUseStrict && !foundUseStrict) {
+ target.push(startOnNewLine(createStatement(createLiteral("use strict"))));
}
- return node;
- }
- ts.updateTry = updateTry;
- function createCaseBlock(clauses, location) {
- var node = createNode(227, location);
- node.clauses = createNodeArray(clauses);
- return node;
- }
- ts.createCaseBlock = createCaseBlock;
- function updateCaseBlock(node, clauses) {
- if (node.clauses !== clauses) {
- return updateNode(createCaseBlock(clauses, node), node);
+ while (statementOffset < numStatements) {
+ var statement = source[statementOffset];
+ if (getEmitFlags(statement) & 8388608) {
+ target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);
+ }
+ else {
+ break;
+ }
+ statementOffset++;
}
- return node;
+ return statementOffset;
}
- ts.updateCaseBlock = updateCaseBlock;
- function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
- var node = createNode(220, location, flags);
- node.decorators = decorators ? createNodeArray(decorators) : undefined;
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.asteriskToken = asteriskToken;
- node.name = typeof name === "string" ? createIdentifier(name) : name;
- node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
- node.parameters = createNodeArray(parameters);
- node.type = type;
- node.body = body;
+ ts.addPrologueDirectives = addPrologueDirectives;
+ function ensureUseStrict(node) {
+ var foundUseStrict = false;
+ for (var _i = 0, _a = node.statements; _i < _a.length; _i++) {
+ var statement = _a[_i];
+ if (ts.isPrologueDirective(statement)) {
+ if (isUseStrictPrologue(statement)) {
+ foundUseStrict = true;
+ break;
+ }
+ }
+ else {
+ break;
+ }
+ }
+ if (!foundUseStrict) {
+ var statements = [];
+ statements.push(startOnNewLine(createStatement(createLiteral("use strict"))));
+ return updateSourceFileNode(node, statements.concat(node.statements));
+ }
return node;
}
- ts.createFunctionDeclaration = createFunctionDeclaration;
- function updateFunctionDeclaration(node, decorators, modifiers, name, typeParameters, parameters, type, body) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {
- return updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);
+ ts.ensureUseStrict = ensureUseStrict;
+ function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
+ var skipped = skipPartiallyEmittedExpressions(operand);
+ if (skipped.kind === 179) {
+ return operand;
}
- return node;
+ return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)
+ ? createParen(operand)
+ : operand;
}
- ts.updateFunctionDeclaration = updateFunctionDeclaration;
- function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) {
- var node = createNode(221, location);
- node.decorators = decorators ? createNodeArray(decorators) : undefined;
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.name = name;
- node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
- node.heritageClauses = createNodeArray(heritageClauses);
- node.members = createNodeArray(members);
- return node;
- }
- ts.createClassDeclaration = createClassDeclaration;
- function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) {
- return updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, node), node);
+ ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand;
+ function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
+ var binaryOperatorPrecedence = ts.getOperatorPrecedence(188, binaryOperator);
+ var binaryOperatorAssociativity = ts.getOperatorAssociativity(188, binaryOperator);
+ var emittedOperand = skipPartiallyEmittedExpressions(operand);
+ var operandPrecedence = ts.getExpressionPrecedence(emittedOperand);
+ switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) {
+ case -1:
+ if (!isLeftSideOfBinary
+ && binaryOperatorAssociativity === 1
+ && operand.kind === 191) {
+ return false;
+ }
+ return true;
+ case 1:
+ return false;
+ case 0:
+ if (isLeftSideOfBinary) {
+ return binaryOperatorAssociativity === 1;
+ }
+ else {
+ if (ts.isBinaryExpression(emittedOperand)
+ && emittedOperand.operatorToken.kind === binaryOperator) {
+ if (operatorHasAssociativeProperty(binaryOperator)) {
+ return false;
+ }
+ if (binaryOperator === 36) {
+ var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0;
+ if (ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) {
+ return false;
+ }
+ }
+ }
+ var operandAssociativity = ts.getExpressionAssociativity(emittedOperand);
+ return operandAssociativity === 0;
+ }
}
- return node;
}
- ts.updateClassDeclaration = updateClassDeclaration;
- function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) {
- var node = createNode(230, location);
- node.decorators = decorators ? createNodeArray(decorators) : undefined;
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.importClause = importClause;
- node.moduleSpecifier = moduleSpecifier;
- return node;
+ function operatorHasAssociativeProperty(binaryOperator) {
+ return binaryOperator === 38
+ || binaryOperator === 48
+ || binaryOperator === 47
+ || binaryOperator === 49;
}
- ts.createImportDeclaration = createImportDeclaration;
- function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier) {
- return updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, node), node);
+ function getLiteralKindOfBinaryPlusOperand(node) {
+ node = skipPartiallyEmittedExpressions(node);
+ if (ts.isLiteralKind(node.kind)) {
+ return node.kind;
}
- return node;
- }
- ts.updateImportDeclaration = updateImportDeclaration;
- function createImportClause(name, namedBindings, location) {
- var node = createNode(231, location);
- node.name = name;
- node.namedBindings = namedBindings;
- return node;
- }
- ts.createImportClause = createImportClause;
- function updateImportClause(node, name, namedBindings) {
- if (node.name !== name || node.namedBindings !== namedBindings) {
- return updateNode(createImportClause(name, namedBindings, node), node);
+ if (node.kind === 188 && node.operatorToken.kind === 36) {
+ if (node.cachedLiteralKind !== undefined) {
+ return node.cachedLiteralKind;
+ }
+ var leftKind = getLiteralKindOfBinaryPlusOperand(node.left);
+ var literalKind = ts.isLiteralKind(leftKind)
+ && leftKind === getLiteralKindOfBinaryPlusOperand(node.right)
+ ? leftKind
+ : 0;
+ node.cachedLiteralKind = literalKind;
+ return literalKind;
}
- return node;
- }
- ts.updateImportClause = updateImportClause;
- function createNamespaceImport(name, location) {
- var node = createNode(232, location);
- node.name = name;
- return node;
+ return 0;
}
- ts.createNamespaceImport = createNamespaceImport;
- function updateNamespaceImport(node, name) {
- if (node.name !== name) {
- return updateNode(createNamespaceImport(name, node), node);
+ function parenthesizeForNew(expression) {
+ var emittedExpression = skipPartiallyEmittedExpressions(expression);
+ switch (emittedExpression.kind) {
+ case 175:
+ return createParen(expression);
+ case 176:
+ return emittedExpression.arguments
+ ? expression
+ : createParen(expression);
}
- return node;
- }
- ts.updateNamespaceImport = updateNamespaceImport;
- function createNamedImports(elements, location) {
- var node = createNode(233, location);
- node.elements = createNodeArray(elements);
- return node;
+ return parenthesizeForAccess(expression);
}
- ts.createNamedImports = createNamedImports;
- function updateNamedImports(node, elements) {
- if (node.elements !== elements) {
- return updateNode(createNamedImports(elements, node), node);
+ ts.parenthesizeForNew = parenthesizeForNew;
+ function parenthesizeForAccess(expression) {
+ var emittedExpression = skipPartiallyEmittedExpressions(expression);
+ if (ts.isLeftHandSideExpression(emittedExpression)
+ && (emittedExpression.kind !== 176 || emittedExpression.arguments)
+ && emittedExpression.kind !== 8) {
+ return expression;
}
- return node;
+ return createParen(expression, expression);
}
- ts.updateNamedImports = updateNamedImports;
- function createImportSpecifier(propertyName, name, location) {
- var node = createNode(234, location);
- node.propertyName = propertyName;
- node.name = name;
- return node;
+ ts.parenthesizeForAccess = parenthesizeForAccess;
+ function parenthesizePostfixOperand(operand) {
+ return ts.isLeftHandSideExpression(operand)
+ ? operand
+ : createParen(operand, operand);
}
- ts.createImportSpecifier = createImportSpecifier;
- function updateImportSpecifier(node, propertyName, name) {
- if (node.propertyName !== propertyName || node.name !== name) {
- return updateNode(createImportSpecifier(propertyName, name, node), node);
+ ts.parenthesizePostfixOperand = parenthesizePostfixOperand;
+ function parenthesizePrefixOperand(operand) {
+ return ts.isUnaryExpression(operand)
+ ? operand
+ : createParen(operand, operand);
+ }
+ ts.parenthesizePrefixOperand = parenthesizePrefixOperand;
+ function parenthesizeListElements(elements) {
+ var result;
+ for (var i = 0; i < elements.length; i++) {
+ var element = parenthesizeExpressionForList(elements[i]);
+ if (result !== undefined || element !== elements[i]) {
+ if (result === undefined) {
+ result = elements.slice(0, i);
+ }
+ result.push(element);
+ }
}
- return node;
+ if (result !== undefined) {
+ return createNodeArray(result, elements, elements.hasTrailingComma);
+ }
+ return elements;
}
- ts.updateImportSpecifier = updateImportSpecifier;
- function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) {
- var node = createNode(235, location);
- node.decorators = decorators ? createNodeArray(decorators) : undefined;
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.isExportEquals = isExportEquals;
- node.expression = expression;
- return node;
+ function parenthesizeExpressionForList(expression) {
+ var emittedExpression = skipPartiallyEmittedExpressions(expression);
+ var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);
+ var commaPrecedence = ts.getOperatorPrecedence(188, 25);
+ return expressionPrecedence > commaPrecedence
+ ? expression
+ : createParen(expression, expression);
}
- ts.createExportAssignment = createExportAssignment;
- function updateExportAssignment(node, decorators, modifiers, expression) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression) {
- return updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression, node), node);
+ ts.parenthesizeExpressionForList = parenthesizeExpressionForList;
+ function parenthesizeExpressionForExpressionStatement(expression) {
+ var emittedExpression = skipPartiallyEmittedExpressions(expression);
+ if (ts.isCallExpression(emittedExpression)) {
+ var callee = emittedExpression.expression;
+ var kind = skipPartiallyEmittedExpressions(callee).kind;
+ if (kind === 180 || kind === 181) {
+ var mutableCall = getMutableClone(emittedExpression);
+ mutableCall.expression = createParen(callee, callee);
+ return recreatePartiallyEmittedExpressions(expression, mutableCall);
+ }
}
- return node;
- }
- ts.updateExportAssignment = updateExportAssignment;
- function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) {
- var node = createNode(236, location);
- node.decorators = decorators ? createNodeArray(decorators) : undefined;
- node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
- node.exportClause = exportClause;
- node.moduleSpecifier = moduleSpecifier;
- return node;
+ else {
+ var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind;
+ if (leftmostExpressionKind === 172 || leftmostExpressionKind === 180) {
+ return createParen(expression, expression);
+ }
+ }
+ return expression;
}
- ts.createExportDeclaration = createExportDeclaration;
- function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier) {
- return updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, node), node);
+ ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement;
+ function recreatePartiallyEmittedExpressions(originalOuterExpression, newInnerExpression) {
+ if (ts.isPartiallyEmittedExpression(originalOuterExpression)) {
+ var clone_1 = getMutableClone(originalOuterExpression);
+ clone_1.expression = recreatePartiallyEmittedExpressions(clone_1.expression, newInnerExpression);
+ return clone_1;
}
- return node;
+ return newInnerExpression;
}
- ts.updateExportDeclaration = updateExportDeclaration;
- function createNamedExports(elements, location) {
- var node = createNode(237, location);
- node.elements = createNodeArray(elements);
- return node;
+ function getLeftmostExpression(node) {
+ while (true) {
+ switch (node.kind) {
+ case 187:
+ node = node.operand;
+ continue;
+ case 188:
+ node = node.left;
+ continue;
+ case 189:
+ node = node.condition;
+ continue;
+ case 175:
+ case 174:
+ case 173:
+ node = node.expression;
+ continue;
+ case 288:
+ node = node.expression;
+ continue;
+ }
+ return node;
+ }
}
- ts.createNamedExports = createNamedExports;
- function updateNamedExports(node, elements) {
- if (node.elements !== elements) {
- return updateNode(createNamedExports(elements, node), node);
+ function parenthesizeConciseBody(body) {
+ var emittedBody = skipPartiallyEmittedExpressions(body);
+ if (emittedBody.kind === 172) {
+ return createParen(body, body);
}
- return node;
+ return body;
}
- ts.updateNamedExports = updateNamedExports;
- function createExportSpecifier(name, propertyName, location) {
- var node = createNode(238, location);
- node.name = typeof name === "string" ? createIdentifier(name) : name;
- node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName;
+ ts.parenthesizeConciseBody = parenthesizeConciseBody;
+ (function (OuterExpressionKinds) {
+ OuterExpressionKinds[OuterExpressionKinds["Parentheses"] = 1] = "Parentheses";
+ OuterExpressionKinds[OuterExpressionKinds["Assertions"] = 2] = "Assertions";
+ OuterExpressionKinds[OuterExpressionKinds["PartiallyEmittedExpressions"] = 4] = "PartiallyEmittedExpressions";
+ OuterExpressionKinds[OuterExpressionKinds["All"] = 7] = "All";
+ })(ts.OuterExpressionKinds || (ts.OuterExpressionKinds = {}));
+ var OuterExpressionKinds = ts.OuterExpressionKinds;
+ function skipOuterExpressions(node, kinds) {
+ if (kinds === void 0) { kinds = 7; }
+ var previousNode;
+ do {
+ previousNode = node;
+ if (kinds & 1) {
+ node = skipParentheses(node);
+ }
+ if (kinds & 2) {
+ node = skipAssertions(node);
+ }
+ if (kinds & 4) {
+ node = skipPartiallyEmittedExpressions(node);
+ }
+ } while (previousNode !== node);
return node;
}
- ts.createExportSpecifier = createExportSpecifier;
- function updateExportSpecifier(node, name, propertyName) {
- if (node.name !== name || node.propertyName !== propertyName) {
- return updateNode(createExportSpecifier(name, propertyName, node), node);
+ ts.skipOuterExpressions = skipOuterExpressions;
+ function skipParentheses(node) {
+ while (node.kind === 179) {
+ node = node.expression;
}
return node;
}
- ts.updateExportSpecifier = updateExportSpecifier;
- function createJsxElement(openingElement, children, closingElement, location) {
- var node = createNode(241, location);
- node.openingElement = openingElement;
- node.children = createNodeArray(children);
- node.closingElement = closingElement;
+ ts.skipParentheses = skipParentheses;
+ function skipAssertions(node) {
+ while (ts.isAssertionExpression(node)) {
+ node = node.expression;
+ }
return node;
}
- ts.createJsxElement = createJsxElement;
- function updateJsxElement(node, openingElement, children, closingElement) {
- if (node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement) {
- return updateNode(createJsxElement(openingElement, children, closingElement, node), node);
+ ts.skipAssertions = skipAssertions;
+ function skipPartiallyEmittedExpressions(node) {
+ while (node.kind === 288) {
+ node = node.expression;
}
return node;
}
- ts.updateJsxElement = updateJsxElement;
- function createJsxSelfClosingElement(tagName, attributes, location) {
- var node = createNode(242, location);
- node.tagName = tagName;
- node.attributes = createNodeArray(attributes);
+ ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;
+ function startOnNewLine(node) {
+ node.startsOnNewLine = true;
return node;
}
- ts.createJsxSelfClosingElement = createJsxSelfClosingElement;
- function updateJsxSelfClosingElement(node, tagName, attributes) {
- if (node.tagName !== tagName || node.attributes !== attributes) {
- return updateNode(createJsxSelfClosingElement(tagName, attributes, node), node);
+ ts.startOnNewLine = startOnNewLine;
+ function setOriginalNode(node, original) {
+ node.original = original;
+ if (original) {
+ var emitNode = original.emitNode;
+ if (emitNode)
+ node.emitNode = mergeEmitNode(emitNode, node.emitNode);
}
return node;
}
- ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;
- function createJsxOpeningElement(tagName, attributes, location) {
- var node = createNode(243, location);
- node.tagName = tagName;
- node.attributes = createNodeArray(attributes);
- return node;
+ ts.setOriginalNode = setOriginalNode;
+ function mergeEmitNode(sourceEmitNode, destEmitNode) {
+ var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges;
+ if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges))
+ destEmitNode = {};
+ if (flags)
+ destEmitNode.flags = flags;
+ if (commentRange)
+ destEmitNode.commentRange = commentRange;
+ if (sourceMapRange)
+ destEmitNode.sourceMapRange = sourceMapRange;
+ if (tokenSourceMapRanges)
+ destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges);
+ return destEmitNode;
}
- ts.createJsxOpeningElement = createJsxOpeningElement;
- function updateJsxOpeningElement(node, tagName, attributes) {
- if (node.tagName !== tagName || node.attributes !== attributes) {
- return updateNode(createJsxOpeningElement(tagName, attributes, node), node);
- }
- return node;
+ function mergeTokenSourceMapRanges(sourceRanges, destRanges) {
+ if (!destRanges)
+ destRanges = ts.createMap();
+ ts.copyProperties(sourceRanges, destRanges);
+ return destRanges;
}
- ts.updateJsxOpeningElement = updateJsxOpeningElement;
- function createJsxClosingElement(tagName, location) {
- var node = createNode(245, location);
- node.tagName = tagName;
- return node;
+ function disposeEmitNodes(sourceFile) {
+ sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile));
+ var emitNode = sourceFile && sourceFile.emitNode;
+ var annotatedNodes = emitNode && emitNode.annotatedNodes;
+ if (annotatedNodes) {
+ for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) {
+ var node = annotatedNodes_1[_i];
+ node.emitNode = undefined;
+ }
+ }
}
- ts.createJsxClosingElement = createJsxClosingElement;
- function updateJsxClosingElement(node, tagName) {
- if (node.tagName !== tagName) {
- return updateNode(createJsxClosingElement(tagName, node), node);
+ ts.disposeEmitNodes = disposeEmitNodes;
+ function getOrCreateEmitNode(node) {
+ if (!node.emitNode) {
+ if (ts.isParseTreeNode(node)) {
+ if (node.kind === 256) {
+ return node.emitNode = { annotatedNodes: [node] };
+ }
+ var sourceFile = ts.getSourceFileOfNode(node);
+ getOrCreateEmitNode(sourceFile).annotatedNodes.push(node);
+ }
+ node.emitNode = {};
}
- return node;
+ return node.emitNode;
}
- ts.updateJsxClosingElement = updateJsxClosingElement;
- function createJsxAttribute(name, initializer, location) {
- var node = createNode(246, location);
- node.name = name;
- node.initializer = initializer;
- return node;
+ function getEmitFlags(node) {
+ var emitNode = node.emitNode;
+ return emitNode && emitNode.flags;
}
- ts.createJsxAttribute = createJsxAttribute;
- function updateJsxAttribute(node, name, initializer) {
- if (node.name !== name || node.initializer !== initializer) {
- return updateNode(createJsxAttribute(name, initializer, node), node);
- }
+ ts.getEmitFlags = getEmitFlags;
+ function setEmitFlags(node, emitFlags) {
+ getOrCreateEmitNode(node).flags = emitFlags;
return node;
}
- ts.updateJsxAttribute = updateJsxAttribute;
- function createJsxSpreadAttribute(expression, location) {
- var node = createNode(247, location);
- node.expression = expression;
+ ts.setEmitFlags = setEmitFlags;
+ function setSourceMapRange(node, range) {
+ getOrCreateEmitNode(node).sourceMapRange = range;
return node;
}
- ts.createJsxSpreadAttribute = createJsxSpreadAttribute;
- function updateJsxSpreadAttribute(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createJsxSpreadAttribute(expression, node), node);
- }
+ ts.setSourceMapRange = setSourceMapRange;
+ function setTokenSourceMapRange(node, token, range) {
+ var emitNode = getOrCreateEmitNode(node);
+ var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap());
+ tokenSourceMapRanges[token] = range;
return node;
}
- ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;
- function createJsxExpression(expression, location) {
- var node = createNode(248, location);
- node.expression = expression;
+ ts.setTokenSourceMapRange = setTokenSourceMapRange;
+ function setCommentRange(node, range) {
+ getOrCreateEmitNode(node).commentRange = range;
return node;
}
- ts.createJsxExpression = createJsxExpression;
- function updateJsxExpression(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createJsxExpression(expression, node), node);
- }
- return node;
+ ts.setCommentRange = setCommentRange;
+ function getCommentRange(node) {
+ var emitNode = node.emitNode;
+ return (emitNode && emitNode.commentRange) || node;
}
- ts.updateJsxExpression = updateJsxExpression;
- function createHeritageClause(token, types, location) {
- var node = createNode(251, location);
- node.token = token;
- node.types = createNodeArray(types);
- return node;
+ ts.getCommentRange = getCommentRange;
+ function getSourceMapRange(node) {
+ var emitNode = node.emitNode;
+ return (emitNode && emitNode.sourceMapRange) || node;
}
- ts.createHeritageClause = createHeritageClause;
- function updateHeritageClause(node, types) {
- if (node.types !== types) {
- return updateNode(createHeritageClause(node.token, types, node), node);
- }
- return node;
+ ts.getSourceMapRange = getSourceMapRange;
+ function getTokenSourceMapRange(node, token) {
+ var emitNode = node.emitNode;
+ var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
+ return tokenSourceMapRanges && tokenSourceMapRanges[token];
}
- ts.updateHeritageClause = updateHeritageClause;
- function createCaseClause(expression, statements, location) {
- var node = createNode(249, location);
- node.expression = parenthesizeExpressionForList(expression);
- node.statements = createNodeArray(statements);
+ ts.getTokenSourceMapRange = getTokenSourceMapRange;
+ function getConstantValue(node) {
+ var emitNode = node.emitNode;
+ return emitNode && emitNode.constantValue;
+ }
+ ts.getConstantValue = getConstantValue;
+ function setConstantValue(node, value) {
+ var emitNode = getOrCreateEmitNode(node);
+ emitNode.constantValue = value;
return node;
}
- ts.createCaseClause = createCaseClause;
- function updateCaseClause(node, expression, statements) {
- if (node.expression !== expression || node.statements !== statements) {
- return updateNode(createCaseClause(expression, statements, node), node);
+ ts.setConstantValue = setConstantValue;
+ function setTextRange(node, location) {
+ if (location) {
+ node.pos = location.pos;
+ node.end = location.end;
}
return node;
}
- ts.updateCaseClause = updateCaseClause;
- function createDefaultClause(statements, location) {
- var node = createNode(250, location);
- node.statements = createNodeArray(statements);
+ ts.setTextRange = setTextRange;
+ function setNodeFlags(node, flags) {
+ node.flags = flags;
return node;
}
- ts.createDefaultClause = createDefaultClause;
- function updateDefaultClause(node, statements) {
- if (node.statements !== statements) {
- return updateNode(createDefaultClause(statements, node), node);
- }
+ ts.setNodeFlags = setNodeFlags;
+ function setMultiLine(node, multiLine) {
+ node.multiLine = multiLine;
return node;
}
- ts.updateDefaultClause = updateDefaultClause;
- function createCatchClause(variableDeclaration, block, location) {
- var node = createNode(252, location);
- node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration;
- node.block = block;
- return node;
+ ts.setMultiLine = setMultiLine;
+ function setHasTrailingComma(nodes, hasTrailingComma) {
+ nodes.hasTrailingComma = hasTrailingComma;
+ return nodes;
}
- ts.createCatchClause = createCatchClause;
- function updateCatchClause(node, variableDeclaration, block) {
- if (node.variableDeclaration !== variableDeclaration || node.block !== block) {
- return updateNode(createCatchClause(variableDeclaration, block, node), node);
+ ts.setHasTrailingComma = setHasTrailingComma;
+ function getLocalNameForExternalImport(node, sourceFile) {
+ var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
+ if (namespaceDeclaration && !ts.isDefaultImport(node)) {
+ var name_9 = namespaceDeclaration.name;
+ return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
}
- return node;
- }
- ts.updateCatchClause = updateCatchClause;
- function createPropertyAssignment(name, initializer, location) {
- var node = createNode(253, location);
- node.name = typeof name === "string" ? createIdentifier(name) : name;
- node.questionToken = undefined;
- node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;
- return node;
- }
- ts.createPropertyAssignment = createPropertyAssignment;
- function updatePropertyAssignment(node, name, initializer) {
- if (node.name !== name || node.initializer !== initializer) {
- return updateNode(createPropertyAssignment(name, initializer, node), node);
+ if (node.kind === 231 && node.importClause) {
+ return getGeneratedNameForNode(node);
}
- return node;
- }
- ts.updatePropertyAssignment = updatePropertyAssignment;
- function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) {
- var node = createNode(254, location);
- node.name = typeof name === "string" ? createIdentifier(name) : name;
- node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;
- return node;
- }
- ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment;
- function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) {
- if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) {
- return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node);
+ if (node.kind === 237 && node.moduleSpecifier) {
+ return getGeneratedNameForNode(node);
}
- return node;
+ return undefined;
}
- ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;
- function updateSourceFileNode(node, statements) {
- if (node.statements !== statements) {
- var updated = createNode(256, node, node.flags);
- updated.statements = createNodeArray(statements);
- updated.endOfFileToken = node.endOfFileToken;
- updated.fileName = node.fileName;
- updated.path = node.path;
- updated.text = node.text;
- if (node.amdDependencies !== undefined)
- updated.amdDependencies = node.amdDependencies;
- if (node.moduleName !== undefined)
- updated.moduleName = node.moduleName;
- if (node.referencedFiles !== undefined)
- updated.referencedFiles = node.referencedFiles;
- if (node.typeReferenceDirectives !== undefined)
- updated.typeReferenceDirectives = node.typeReferenceDirectives;
- if (node.languageVariant !== undefined)
- updated.languageVariant = node.languageVariant;
- if (node.isDeclarationFile !== undefined)
- updated.isDeclarationFile = node.isDeclarationFile;
- if (node.renamedDependencies !== undefined)
- updated.renamedDependencies = node.renamedDependencies;
- if (node.hasNoDefaultLib !== undefined)
- updated.hasNoDefaultLib = node.hasNoDefaultLib;
- if (node.languageVersion !== undefined)
- updated.languageVersion = node.languageVersion;
- if (node.scriptKind !== undefined)
- updated.scriptKind = node.scriptKind;
- if (node.externalModuleIndicator !== undefined)
- updated.externalModuleIndicator = node.externalModuleIndicator;
- if (node.commonJsModuleIndicator !== undefined)
- updated.commonJsModuleIndicator = node.commonJsModuleIndicator;
- if (node.identifiers !== undefined)
- updated.identifiers = node.identifiers;
- if (node.nodeCount !== undefined)
- updated.nodeCount = node.nodeCount;
- if (node.identifierCount !== undefined)
- updated.identifierCount = node.identifierCount;
- if (node.symbolCount !== undefined)
- updated.symbolCount = node.symbolCount;
- if (node.parseDiagnostics !== undefined)
- updated.parseDiagnostics = node.parseDiagnostics;
- if (node.bindDiagnostics !== undefined)
- updated.bindDiagnostics = node.bindDiagnostics;
- if (node.lineMap !== undefined)
- updated.lineMap = node.lineMap;
- if (node.classifiableNames !== undefined)
- updated.classifiableNames = node.classifiableNames;
- if (node.resolvedModules !== undefined)
- updated.resolvedModules = node.resolvedModules;
- if (node.resolvedTypeReferenceDirectiveNames !== undefined)
- updated.resolvedTypeReferenceDirectiveNames = node.resolvedTypeReferenceDirectiveNames;
- if (node.imports !== undefined)
- updated.imports = node.imports;
- if (node.moduleAugmentations !== undefined)
- updated.moduleAugmentations = node.moduleAugmentations;
- if (node.externalHelpersModuleName !== undefined)
- updated.externalHelpersModuleName = node.externalHelpersModuleName;
- return updateNode(updated, node);
+ ts.getLocalNameForExternalImport = getLocalNameForExternalImport;
+ function getExternalModuleNameLiteral(importNode, sourceFile, host, resolver, compilerOptions) {
+ var moduleName = ts.getExternalModuleName(importNode);
+ if (moduleName.kind === 9) {
+ return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions)
+ || tryRenameExternalModule(moduleName, sourceFile)
+ || getSynthesizedClone(moduleName);
}
- return node;
- }
- ts.updateSourceFileNode = updateSourceFileNode;
- function createNotEmittedStatement(original) {
- var node = createNode(287, original);
- node.original = original;
- return node;
- }
- ts.createNotEmittedStatement = createNotEmittedStatement;
- function createPartiallyEmittedExpression(expression, original, location) {
- var node = createNode(288, location || original);
- node.expression = expression;
- node.original = original;
- return node;
+ return undefined;
}
- ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression;
- function updatePartiallyEmittedExpression(node, expression) {
- if (node.expression !== expression) {
- return updateNode(createPartiallyEmittedExpression(expression, node.original, node), node);
+ ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral;
+ function tryRenameExternalModule(moduleName, sourceFile) {
+ if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) {
+ return createLiteral(sourceFile.renamedDependencies[moduleName.text]);
}
- return node;
- }
- ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
- function createComma(left, right) {
- return createBinary(left, 24, right);
- }
- ts.createComma = createComma;
- function createLessThan(left, right, location) {
- return createBinary(left, 25, right, location);
- }
- ts.createLessThan = createLessThan;
- function createAssignment(left, right, location) {
- return createBinary(left, 56, right, location);
- }
- ts.createAssignment = createAssignment;
- function createStrictEquality(left, right) {
- return createBinary(left, 32, right);
- }
- ts.createStrictEquality = createStrictEquality;
- function createStrictInequality(left, right) {
- return createBinary(left, 33, right);
- }
- ts.createStrictInequality = createStrictInequality;
- function createAdd(left, right) {
- return createBinary(left, 35, right);
- }
- ts.createAdd = createAdd;
- function createSubtract(left, right) {
- return createBinary(left, 36, right);
- }
- ts.createSubtract = createSubtract;
- function createPostfixIncrement(operand, location) {
- return createPostfix(operand, 41, location);
- }
- ts.createPostfixIncrement = createPostfixIncrement;
- function createLogicalAnd(left, right) {
- return createBinary(left, 51, right);
- }
- ts.createLogicalAnd = createLogicalAnd;
- function createLogicalOr(left, right) {
- return createBinary(left, 52, right);
- }
- ts.createLogicalOr = createLogicalOr;
- function createLogicalNot(operand) {
- return createPrefix(49, operand);
- }
- ts.createLogicalNot = createLogicalNot;
- function createVoidZero() {
- return createVoid(createLiteral(0));
+ return undefined;
}
- ts.createVoidZero = createVoidZero;
- function createMemberAccessForPropertyName(target, memberName, location) {
- if (ts.isComputedPropertyName(memberName)) {
- return createElementAccess(target, memberName.expression, location);
+ function tryGetModuleNameFromFile(file, host, options) {
+ if (!file) {
+ return undefined;
}
- else {
- var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location);
- (expression.emitNode || (expression.emitNode = {})).flags |= 2048;
- return expression;
+ if (file.moduleName) {
+ return createLiteral(file.moduleName);
}
- }
- ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName;
- function createRestParameter(name) {
- return createParameterDeclaration(undefined, undefined, createToken(22), name, undefined, undefined, undefined);
- }
- ts.createRestParameter = createRestParameter;
- function createFunctionCall(func, thisArg, argumentsList, location) {
- return createCall(createPropertyAccess(func, "call"), undefined, [
- thisArg
- ].concat(argumentsList), location);
- }
- ts.createFunctionCall = createFunctionCall;
- function createFunctionApply(func, thisArg, argumentsExpression, location) {
- return createCall(createPropertyAccess(func, "apply"), undefined, [
- thisArg,
- argumentsExpression
- ], location);
- }
- ts.createFunctionApply = createFunctionApply;
- function createArraySlice(array, start) {
- var argumentsList = [];
- if (start !== undefined) {
- argumentsList.push(typeof start === "number" ? createLiteral(start) : start);
+ if (!ts.isDeclarationFile(file) && (options.out || options.outFile)) {
+ return createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName));
}
- return createCall(createPropertyAccess(array, "slice"), undefined, argumentsList);
- }
- ts.createArraySlice = createArraySlice;
- function createArrayConcat(array, values) {
- return createCall(createPropertyAccess(array, "concat"), undefined, values);
- }
- ts.createArrayConcat = createArrayConcat;
- function createMathPow(left, right, location) {
- return createCall(createPropertyAccess(createIdentifier("Math"), "pow"), undefined, [left, right], location);
+ return undefined;
}
- ts.createMathPow = createMathPow;
- function createReactNamespace(reactNamespace, parent) {
- var react = createIdentifier(reactNamespace || "React");
- react.flags &= ~8;
- react.parent = parent;
- return react;
+ ts.tryGetModuleNameFromFile = tryGetModuleNameFromFile;
+ function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) {
+ return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);
}
- function createReactCreateElement(reactNamespace, tagName, props, children, parentElement, location) {
- var argumentsList = [tagName];
- if (props) {
- argumentsList.push(props);
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var NodeConstructor;
+ var TokenConstructor;
+ var IdentifierConstructor;
+ var SourceFileConstructor;
+ function createNode(kind, pos, end) {
+ if (kind === 256) {
+ return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
}
- if (children && children.length > 0) {
- if (!props) {
- argumentsList.push(createNull());
- }
- if (children.length > 1) {
- for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
- var child = children_1[_i];
- child.startsOnNewLine = true;
- argumentsList.push(child);
- }
- }
- else {
- argumentsList.push(children[0]);
- }
+ else if (kind === 70) {
+ return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
}
- return createCall(createPropertyAccess(createReactNamespace(reactNamespace, parentElement), "createElement"), undefined, argumentsList, location);
- }
- ts.createReactCreateElement = createReactCreateElement;
- function createLetDeclarationList(declarations, location) {
- return createVariableDeclarationList(declarations, location, 1);
- }
- ts.createLetDeclarationList = createLetDeclarationList;
- function createConstDeclarationList(declarations, location) {
- return createVariableDeclarationList(declarations, location, 2);
- }
- ts.createConstDeclarationList = createConstDeclarationList;
- function createHelperName(externalHelpersModuleName, name) {
- return externalHelpersModuleName
- ? createPropertyAccess(externalHelpersModuleName, name)
- : createIdentifier(name);
- }
- ts.createHelperName = createHelperName;
- function createExtendsHelper(externalHelpersModuleName, name) {
- return createCall(createHelperName(externalHelpersModuleName, "__extends"), undefined, [
- name,
- createIdentifier("_super")
- ]);
- }
- ts.createExtendsHelper = createExtendsHelper;
- function createAssignHelper(externalHelpersModuleName, attributesSegments) {
- return createCall(createHelperName(externalHelpersModuleName, "__assign"), undefined, attributesSegments);
- }
- ts.createAssignHelper = createAssignHelper;
- function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) {
- return createCall(createHelperName(externalHelpersModuleName, "__param"), undefined, [
- createLiteral(parameterOffset),
- expression
- ], location);
- }
- ts.createParamHelper = createParamHelper;
- function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) {
- return createCall(createHelperName(externalHelpersModuleName, "__metadata"), undefined, [
- createLiteral(metadataKey),
- metadataValue
- ]);
- }
- ts.createMetadataHelper = createMetadataHelper;
- function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) {
- var argumentsArray = [];
- argumentsArray.push(createArrayLiteral(decoratorExpressions, undefined, true));
- argumentsArray.push(target);
- if (memberName) {
- argumentsArray.push(memberName);
- if (descriptor) {
- argumentsArray.push(descriptor);
- }
+ else if (kind < 140) {
+ return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
}
- return createCall(createHelperName(externalHelpersModuleName, "__decorate"), undefined, argumentsArray, location);
- }
- ts.createDecorateHelper = createDecorateHelper;
- function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) {
- var generatorFunc = createFunctionExpression(createToken(37), undefined, undefined, [], undefined, body);
- (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152;
- return createCall(createHelperName(externalHelpersModuleName, "__awaiter"), undefined, [
- createThis(),
- hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(),
- promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(),
- generatorFunc
- ]);
- }
- ts.createAwaiterHelper = createAwaiterHelper;
- function createHasOwnProperty(target, propertyName) {
- return createCall(createPropertyAccess(target, "hasOwnProperty"), undefined, [propertyName]);
- }
- ts.createHasOwnProperty = createHasOwnProperty;
- function createObjectCreate(prototype) {
- return createCall(createPropertyAccess(createIdentifier("Object"), "create"), undefined, [prototype]);
- }
- function createGeti(target) {
- return createArrowFunction(undefined, undefined, [createParameter("name")], undefined, undefined, createElementAccess(target, createIdentifier("name")));
- }
- function createSeti(target) {
- return createArrowFunction(undefined, undefined, [
- createParameter("name"),
- createParameter("value")
- ], undefined, undefined, createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value")));
- }
- function createAdvancedAsyncSuperHelper() {
- var createCache = createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("cache", undefined, createObjectCreate(createNull()))
- ]));
- var getter = createGetAccessor(undefined, undefined, "value", [], undefined, createBlock([
- createReturn(createCall(createIdentifier("geti"), undefined, [createIdentifier("name")]))
- ]));
- var setter = createSetAccessor(undefined, undefined, "value", [createParameter("v")], createBlock([
- createStatement(createCall(createIdentifier("seti"), undefined, [
- createIdentifier("name"),
- createIdentifier("v")
- ]))
- ]));
- var getOrCreateAccessorsForName = createReturn(createArrowFunction(undefined, undefined, [createParameter("name")], undefined, undefined, createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([
- getter,
- setter
- ]))))));
- return createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("_super", undefined, createCall(createParen(createFunctionExpression(undefined, undefined, undefined, [
- createParameter("geti"),
- createParameter("seti")
- ], undefined, createBlock([
- createCache,
- getOrCreateAccessorsForName
- ]))), undefined, [
- createGeti(createSuper()),
- createSeti(createSuper())
- ]))
- ]));
- }
- ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper;
- function createSimpleAsyncSuperHelper() {
- return createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("_super", undefined, createGeti(createSuper()))
- ]));
- }
- ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper;
- function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
- var target = skipParentheses(node);
- switch (target.kind) {
- case 69:
- return cacheIdentifiers;
- case 97:
- case 8:
- case 9:
- return false;
- case 170:
- var elements = target.elements;
- if (elements.length === 0) {
- return false;
- }
- return true;
- case 171:
- return target.properties.length > 0;
- default:
- return true;
+ else {
+ return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
}
}
- function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) {
- var callee = skipOuterExpressions(expression, 7);
- var thisArg;
- var target;
- if (ts.isSuperProperty(callee)) {
- thisArg = createThis();
- target = callee;
+ ts.createNode = createNode;
+ function visitNode(cbNode, node) {
+ if (node) {
+ return cbNode(node);
}
- else if (callee.kind === 95) {
- thisArg = createThis();
- target = languageVersion < 2 ? createIdentifier("_super", callee) : callee;
+ }
+ function visitNodeArray(cbNodes, nodes) {
+ if (nodes) {
+ return cbNodes(nodes);
}
- else {
- switch (callee.kind) {
- case 172: {
- if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
- thisArg = createTempVariable(recordTempVariable);
- target = createPropertyAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.name, callee);
- }
- else {
- thisArg = callee.expression;
- target = callee;
- }
- break;
- }
- case 173: {
- if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
- thisArg = createTempVariable(recordTempVariable);
- target = createElementAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.argumentExpression, callee);
- }
- else {
- thisArg = callee.expression;
- target = callee;
- }
- break;
- }
- default: {
- thisArg = createVoidZero();
- target = parenthesizeForAccess(expression);
- break;
+ }
+ function visitEachNode(cbNode, nodes) {
+ if (nodes) {
+ for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
+ var node = nodes_1[_i];
+ var result = cbNode(node);
+ if (result) {
+ return result;
}
}
}
- return { target: target, thisArg: thisArg };
- }
- ts.createCallBinding = createCallBinding;
- function inlineExpressions(expressions) {
- return ts.reduceLeft(expressions, createComma);
- }
- ts.inlineExpressions = inlineExpressions;
- function createExpressionFromEntityName(node) {
- if (ts.isQualifiedName(node)) {
- var left = createExpressionFromEntityName(node.left);
- var right = getMutableClone(node.right);
- return createPropertyAccess(left, right, node);
- }
- else {
- return getMutableClone(node);
- }
}
- ts.createExpressionFromEntityName = createExpressionFromEntityName;
- function createExpressionForPropertyName(memberName) {
- if (ts.isIdentifier(memberName)) {
- return createLiteral(memberName, undefined);
- }
- else if (ts.isComputedPropertyName(memberName)) {
- return getMutableClone(memberName.expression);
- }
- else {
- return getMutableClone(memberName);
+ function forEachChild(node, cbNode, cbNodeArray) {
+ if (!node) {
+ return;
}
- }
- ts.createExpressionForPropertyName = createExpressionForPropertyName;
- function createExpressionForObjectLiteralElementLike(node, property, receiver) {
- switch (property.kind) {
+ var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode;
+ var cbNodes = cbNodeArray || cbNode;
+ switch (node.kind) {
+ case 140:
+ return visitNode(cbNode, node.left) ||
+ visitNode(cbNode, node.right);
+ case 142:
+ return visitNode(cbNode, node.name) ||
+ visitNode(cbNode, node.constraint) ||
+ visitNode(cbNode, node.expression);
+ case 254:
+ return visitNodes(cbNodes, node.decorators) ||
+ visitNodes(cbNodes, node.modifiers) ||
+ visitNode(cbNode, node.name) ||
+ visitNode(cbNode, node.questionToken) ||
+ visitNode(cbNode, node.equalsToken) ||
+ visitNode(cbNode, node.objectAssignmentInitializer);
+ case 143:
+ case 146:
+ case 145:
+ case 253:
+ case 219:
+ case 170:
+ 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 157:
+ case 158:
+ case 152:
+ case 153:
+ case 154:
+ return visitNodes(cbNodes, node.decorators) ||
+ visitNodes(cbNodes, node.modifiers) ||
+ visitNodes(cbNodes, node.typeParameters) ||
+ visitNodes(cbNodes, node.parameters) ||
+ visitNode(cbNode, node.type);
+ case 148:
+ case 147:
case 149:
case 150:
- return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine);
- case 253:
- return createExpressionForPropertyAssignment(property, receiver);
- case 254:
- return createExpressionForShorthandPropertyAssignment(property, receiver);
- case 147:
- return createExpressionForMethodDeclaration(property, receiver);
+ case 151:
+ case 180:
+ case 221:
+ case 181:
+ 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 156:
+ return visitNode(cbNode, node.typeName) ||
+ visitNodes(cbNodes, node.typeArguments);
+ case 155:
+ return visitNode(cbNode, node.parameterName) ||
+ visitNode(cbNode, node.type);
+ case 159:
+ return visitNode(cbNode, node.exprName);
+ case 160:
+ return visitNodes(cbNodes, node.members);
+ case 161:
+ return visitNode(cbNode, node.elementType);
+ case 162:
+ return visitNodes(cbNodes, node.elementTypes);
+ case 163:
+ case 164:
+ return visitNodes(cbNodes, node.types);
+ case 165:
+ return visitNode(cbNode, node.type);
+ case 167:
+ return visitNode(cbNode, node.literal);
+ case 168:
+ case 169:
+ return visitNodes(cbNodes, node.elements);
+ case 171:
+ return visitNodes(cbNodes, node.elements);
+ case 172:
+ return visitNodes(cbNodes, node.properties);
+ case 173:
+ return visitNode(cbNode, node.expression) ||
+ visitNode(cbNode, node.name);
+ case 174:
+ return visitNode(cbNode, node.expression) ||
+ visitNode(cbNode, node.argumentExpression);
+ case 175:
+ case 176:
+ return visitNode(cbNode, node.expression) ||
+ visitNodes(cbNodes, node.typeArguments) ||
+ visitNodes(cbNodes, node.arguments);
+ case 177:
+ return visitNode(cbNode, node.tag) ||
+ visitNode(cbNode, node.template);
+ case 178:
+ return visitNode(cbNode, node.type) ||
+ visitNode(cbNode, node.expression);
+ case 179:
+ return visitNode(cbNode, node.expression);
+ case 182:
+ return visitNode(cbNode, node.expression);
+ case 183:
+ return visitNode(cbNode, node.expression);
+ case 184:
+ return visitNode(cbNode, node.expression);
+ case 186:
+ return visitNode(cbNode, node.operand);
+ case 191:
+ return visitNode(cbNode, node.asteriskToken) ||
+ visitNode(cbNode, node.expression);
+ case 185:
+ return visitNode(cbNode, node.expression);
+ case 187:
+ return visitNode(cbNode, node.operand);
+ case 188:
+ return visitNode(cbNode, node.left) ||
+ visitNode(cbNode, node.operatorToken) ||
+ visitNode(cbNode, node.right);
+ case 196:
+ return visitNode(cbNode, node.expression) ||
+ visitNode(cbNode, node.type);
+ case 197:
+ return visitNode(cbNode, node.expression);
+ case 189:
+ return visitNode(cbNode, node.condition) ||
+ visitNode(cbNode, node.questionToken) ||
+ visitNode(cbNode, node.whenTrue) ||
+ visitNode(cbNode, node.colonToken) ||
+ visitNode(cbNode, node.whenFalse);
+ case 192:
+ return visitNode(cbNode, node.expression);
+ case 200:
+ case 227:
+ return visitNodes(cbNodes, node.statements);
+ case 256:
+ return visitNodes(cbNodes, node.statements) ||
+ visitNode(cbNode, node.endOfFileToken);
+ case 201:
+ return visitNodes(cbNodes, node.decorators) ||
+ visitNodes(cbNodes, node.modifiers) ||
+ visitNode(cbNode, node.declarationList);
+ case 220:
+ return visitNodes(cbNodes, node.declarations);
+ case 203:
+ return visitNode(cbNode, node.expression);
+ case 204:
+ return visitNode(cbNode, node.expression) ||
+ visitNode(cbNode, node.thenStatement) ||
+ visitNode(cbNode, node.elseStatement);
+ case 205:
+ return visitNode(cbNode, node.statement) ||
+ visitNode(cbNode, node.expression);
+ case 206:
+ return visitNode(cbNode, node.expression) ||
+ visitNode(cbNode, node.statement);
+ case 207:
+ return visitNode(cbNode, node.initializer) ||
+ visitNode(cbNode, node.condition) ||
+ visitNode(cbNode, node.incrementor) ||
+ visitNode(cbNode, node.statement);
+ case 208:
+ return visitNode(cbNode, node.initializer) ||
+ visitNode(cbNode, node.expression) ||
+ visitNode(cbNode, node.statement);
+ case 209:
+ return visitNode(cbNode, node.initializer) ||
+ visitNode(cbNode, node.expression) ||
+ visitNode(cbNode, node.statement);
+ case 210:
+ case 211:
+ return visitNode(cbNode, node.label);
+ case 212:
+ return visitNode(cbNode, node.expression);
+ case 213:
+ return visitNode(cbNode, node.expression) ||
+ visitNode(cbNode, node.statement);
+ case 214:
+ return visitNode(cbNode, node.expression) ||
+ visitNode(cbNode, node.caseBlock);
+ case 228:
+ return visitNodes(cbNodes, node.clauses);
+ case 249:
+ return visitNode(cbNode, node.expression) ||
+ visitNodes(cbNodes, node.statements);
+ case 250:
+ return visitNodes(cbNodes, node.statements);
+ case 215:
+ return visitNode(cbNode, node.label) ||
+ visitNode(cbNode, node.statement);
+ case 216:
+ return visitNode(cbNode, node.expression);
+ case 217:
+ return visitNode(cbNode, node.tryBlock) ||
+ visitNode(cbNode, node.catchClause) ||
+ visitNode(cbNode, node.finallyBlock);
+ case 252:
+ return visitNode(cbNode, node.variableDeclaration) ||
+ visitNode(cbNode, node.block);
+ case 144:
+ return visitNode(cbNode, node.expression);
+ case 222:
+ case 193:
+ 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 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 224:
+ return visitNodes(cbNodes, node.decorators) ||
+ visitNodes(cbNodes, node.modifiers) ||
+ visitNode(cbNode, node.name) ||
+ visitNodes(cbNodes, node.typeParameters) ||
+ visitNode(cbNode, node.type);
+ case 225:
+ return visitNodes(cbNodes, node.decorators) ||
+ visitNodes(cbNodes, node.modifiers) ||
+ visitNode(cbNode, node.name) ||
+ visitNodes(cbNodes, node.members);
+ case 255:
+ return visitNode(cbNode, node.name) ||
+ visitNode(cbNode, node.initializer);
+ case 226:
+ return visitNodes(cbNodes, node.decorators) ||
+ visitNodes(cbNodes, node.modifiers) ||
+ visitNode(cbNode, node.name) ||
+ visitNode(cbNode, node.body);
+ case 230:
+ return visitNodes(cbNodes, node.decorators) ||
+ visitNodes(cbNodes, node.modifiers) ||
+ visitNode(cbNode, node.name) ||
+ visitNode(cbNode, node.moduleReference);
+ case 231:
+ return visitNodes(cbNodes, node.decorators) ||
+ visitNodes(cbNodes, node.modifiers) ||
+ visitNode(cbNode, node.importClause) ||
+ visitNode(cbNode, node.moduleSpecifier);
+ case 232:
+ return visitNode(cbNode, node.name) ||
+ visitNode(cbNode, node.namedBindings);
+ case 229:
+ return visitNode(cbNode, node.name);
+ case 233:
+ return visitNode(cbNode, node.name);
+ case 234:
+ case 238:
+ return visitNodes(cbNodes, node.elements);
+ case 237:
+ return visitNodes(cbNodes, node.decorators) ||
+ visitNodes(cbNodes, node.modifiers) ||
+ visitNode(cbNode, node.exportClause) ||
+ visitNode(cbNode, node.moduleSpecifier);
+ case 235:
+ case 239:
+ return visitNode(cbNode, node.propertyName) ||
+ visitNode(cbNode, node.name);
+ case 236:
+ return visitNodes(cbNodes, node.decorators) ||
+ visitNodes(cbNodes, node.modifiers) ||
+ visitNode(cbNode, node.expression);
+ case 190:
+ return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans);
+ case 198:
+ return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
+ case 141:
+ return visitNode(cbNode, node.expression);
+ case 251:
+ return visitNodes(cbNodes, node.types);
+ case 195:
+ return visitNode(cbNode, node.expression) ||
+ visitNodes(cbNodes, node.typeArguments);
+ case 241:
+ return visitNode(cbNode, node.expression);
+ case 240:
+ return visitNodes(cbNodes, node.decorators);
+ case 242:
+ return visitNode(cbNode, node.openingElement) ||
+ visitNodes(cbNodes, node.children) ||
+ visitNode(cbNode, node.closingElement);
+ case 243:
+ case 244:
+ return visitNode(cbNode, node.tagName) ||
+ visitNodes(cbNodes, node.attributes);
+ case 246:
+ return visitNode(cbNode, node.name) ||
+ visitNode(cbNode, node.initializer);
+ case 247:
+ return visitNode(cbNode, node.expression);
+ case 248:
+ return visitNode(cbNode, node.expression);
+ case 245:
+ return visitNode(cbNode, node.tagName);
+ case 257:
+ return visitNode(cbNode, node.type);
+ case 261:
+ return visitNodes(cbNodes, node.types);
+ case 262:
+ return visitNodes(cbNodes, node.types);
+ case 260:
+ return visitNode(cbNode, node.elementType);
+ case 264:
+ return visitNode(cbNode, node.type);
+ case 263:
+ return visitNode(cbNode, node.type);
+ case 265:
+ return visitNode(cbNode, node.literal);
+ case 267:
+ return visitNode(cbNode, node.name) ||
+ visitNodes(cbNodes, node.typeArguments);
+ case 268:
+ return visitNode(cbNode, node.type);
+ case 269:
+ return visitNodes(cbNodes, node.parameters) ||
+ visitNode(cbNode, node.type);
+ case 270:
+ return visitNode(cbNode, node.type);
+ case 271:
+ return visitNode(cbNode, node.type);
+ case 272:
+ return visitNode(cbNode, node.type);
+ case 266:
+ return visitNode(cbNode, node.name) ||
+ visitNode(cbNode, node.type);
+ case 273:
+ return visitNodes(cbNodes, node.tags);
+ case 275:
+ return visitNode(cbNode, node.preParameterName) ||
+ visitNode(cbNode, node.typeExpression) ||
+ visitNode(cbNode, node.postParameterName);
+ case 276:
+ return visitNode(cbNode, node.typeExpression);
+ case 277:
+ return visitNode(cbNode, node.typeExpression);
+ case 278:
+ return visitNodes(cbNodes, node.typeParameters);
+ case 279:
+ return visitNode(cbNode, node.typeExpression) ||
+ visitNode(cbNode, node.name) ||
+ visitNode(cbNode, node.jsDocTypeLiteral);
+ case 281:
+ return visitNodes(cbNodes, node.jsDocPropertyTags);
+ case 280:
+ return visitNode(cbNode, node.typeExpression) ||
+ visitNode(cbNode, node.name);
+ case 288:
+ return visitNode(cbNode, node.expression);
+ case 282:
+ return visitNode(cbNode, node.literal);
}
}
- ts.createExpressionForObjectLiteralElementLike = createExpressionForObjectLiteralElementLike;
- function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) {
- var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
- if (property === firstAccessor) {
- var properties_1 = [];
- if (getAccessor) {
- var getterFunction = createFunctionExpression(undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body, getAccessor);
- setOriginalNode(getterFunction, getAccessor);
- var getter = createPropertyAssignment("get", getterFunction);
- properties_1.push(getter);
- }
- if (setAccessor) {
- var setterFunction = createFunctionExpression(undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body, setAccessor);
- setOriginalNode(setterFunction, setAccessor);
- var setter = createPropertyAssignment("set", setterFunction);
- properties_1.push(setter);
- }
- properties_1.push(createPropertyAssignment("enumerable", createLiteral(true)));
- properties_1.push(createPropertyAssignment("configurable", createLiteral(true)));
- var expression = createCall(createPropertyAccess(createIdentifier("Object"), "defineProperty"), undefined, [
- receiver,
- createExpressionForPropertyName(property.name),
- createObjectLiteral(properties_1, undefined, multiLine)
- ], firstAccessor);
- return ts.aggregateTransformFlags(expression);
- }
- return undefined;
+ ts.forEachChild = forEachChild;
+ function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) {
+ if (setParentNodes === void 0) { setParentNodes = false; }
+ ts.performance.mark("beforeParse");
+ var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind);
+ ts.performance.mark("afterParse");
+ ts.performance.measure("Parse", "beforeParse", "afterParse");
+ return result;
}
- function createExpressionForPropertyAssignment(property, receiver) {
- return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer, property), property));
+ ts.createSourceFile = createSourceFile;
+ function isExternalModule(file) {
+ return file.externalModuleIndicator !== undefined;
}
- function createExpressionForShorthandPropertyAssignment(property, receiver) {
- return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), getSynthesizedClone(property.name), property), property));
+ ts.isExternalModule = isExternalModule;
+ function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {
+ return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
}
- function createExpressionForMethodDeclaration(method, receiver) {
- return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method));
+ ts.updateSourceFile = updateSourceFile;
+ function parseIsolatedJSDocComment(content, start, length) {
+ var result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length);
+ if (result && result.jsDoc) {
+ Parser.fixupParentReferences(result.jsDoc);
+ }
+ return result;
}
- function isUseStrictPrologue(node) {
- return node.expression.text === "use strict";
+ ts.parseIsolatedJSDocComment = parseIsolatedJSDocComment;
+ function parseJSDocTypeExpressionForTests(content, start, length) {
+ return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length);
}
- function addPrologueDirectives(target, source, ensureUseStrict, visitor) {
- ts.Debug.assert(target.length === 0, "PrologueDirectives should be at the first statement in the target statements array");
- var foundUseStrict = false;
- var statementOffset = 0;
- var numStatements = source.length;
- while (statementOffset < numStatements) {
- var statement = source[statementOffset];
- if (ts.isPrologueDirective(statement)) {
- if (isUseStrictPrologue(statement)) {
- foundUseStrict = true;
- }
- target.push(statement);
- }
- else {
- if (ensureUseStrict && !foundUseStrict) {
- target.push(startOnNewLine(createStatement(createLiteral("use strict"))));
- foundUseStrict = true;
- }
- if (getEmitFlags(statement) & 8388608) {
- target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);
- }
- else {
- break;
- }
+ ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
+ var Parser;
+ (function (Parser) {
+ var scanner = ts.createScanner(4, true);
+ var disallowInAndDecoratorContext = 32768 | 131072;
+ var NodeConstructor;
+ var TokenConstructor;
+ var IdentifierConstructor;
+ var SourceFileConstructor;
+ var sourceFile;
+ var parseDiagnostics;
+ var syntaxCursor;
+ var currentToken;
+ var sourceText;
+ var nodeCount;
+ var identifiers;
+ var identifierCount;
+ var parsingContext;
+ var contextFlags;
+ var parseErrorBeforeNextFinishedNode = false;
+ function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) {
+ scriptKind = ts.ensureScriptKind(fileName, scriptKind);
+ initializeState(sourceText, languageVersion, syntaxCursor, scriptKind);
+ var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind);
+ clearState();
+ return result;
+ }
+ Parser.parseSourceFile = parseSourceFile;
+ function getLanguageVariant(scriptKind) {
+ return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 ? 1 : 0;
+ }
+ function initializeState(_sourceText, languageVersion, _syntaxCursor, scriptKind) {
+ NodeConstructor = ts.objectAllocator.getNodeConstructor();
+ TokenConstructor = ts.objectAllocator.getTokenConstructor();
+ IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
+ SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
+ sourceText = _sourceText;
+ syntaxCursor = _syntaxCursor;
+ parseDiagnostics = [];
+ parsingContext = 0;
+ identifiers = ts.createMap();
+ identifierCount = 0;
+ nodeCount = 0;
+ contextFlags = scriptKind === 1 || scriptKind === 2 ? 1048576 : 0;
+ parseErrorBeforeNextFinishedNode = false;
+ scanner.setText(sourceText);
+ scanner.setOnError(scanError);
+ scanner.setScriptTarget(languageVersion);
+ scanner.setLanguageVariant(getLanguageVariant(scriptKind));
+ }
+ function clearState() {
+ scanner.setText("");
+ scanner.setOnError(undefined);
+ parseDiagnostics = undefined;
+ sourceFile = undefined;
+ identifiers = undefined;
+ syntaxCursor = undefined;
+ sourceText = undefined;
+ }
+ function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {
+ sourceFile = createSourceFile(fileName, languageVersion, scriptKind);
+ sourceFile.flags = contextFlags;
+ nextToken();
+ processReferenceComments(sourceFile);
+ sourceFile.statements = parseList(0, parseStatement);
+ ts.Debug.assert(token() === 1);
+ sourceFile.endOfFileToken = parseTokenNode();
+ setExternalModuleIndicator(sourceFile);
+ sourceFile.nodeCount = nodeCount;
+ sourceFile.identifierCount = identifierCount;
+ sourceFile.identifiers = identifiers;
+ sourceFile.parseDiagnostics = parseDiagnostics;
+ if (setParentNodes) {
+ fixupParentReferences(sourceFile);
}
- statementOffset++;
+ return sourceFile;
}
- return statementOffset;
- }
- ts.addPrologueDirectives = addPrologueDirectives;
- function ensureUseStrict(node) {
- var foundUseStrict = false;
- for (var _i = 0, _a = node.statements; _i < _a.length; _i++) {
- var statement = _a[_i];
- if (ts.isPrologueDirective(statement)) {
- if (isUseStrictPrologue(statement)) {
- foundUseStrict = true;
- break;
+ function addJSDocComment(node) {
+ var comments = ts.getJsDocCommentsFromText(node, sourceFile.text);
+ if (comments) {
+ for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {
+ var comment = comments_2[_i];
+ var jsDoc = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos);
+ if (!jsDoc) {
+ continue;
+ }
+ if (!node.jsDocComments) {
+ node.jsDocComments = [];
+ }
+ node.jsDocComments.push(jsDoc);
}
}
- else {
- break;
- }
- }
- if (!foundUseStrict) {
- var statements = [];
- statements.push(startOnNewLine(createStatement(createLiteral("use strict"))));
- return updateSourceFileNode(node, statements.concat(node.statements));
- }
- return node;
- }
- ts.ensureUseStrict = ensureUseStrict;
- function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
- var skipped = skipPartiallyEmittedExpressions(operand);
- if (skipped.kind === 178) {
- return operand;
+ return node;
}
- return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)
- ? createParen(operand)
- : operand;
- }
- ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand;
- function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
- var binaryOperatorPrecedence = ts.getOperatorPrecedence(187, binaryOperator);
- var binaryOperatorAssociativity = ts.getOperatorAssociativity(187, binaryOperator);
- var emittedOperand = skipPartiallyEmittedExpressions(operand);
- var operandPrecedence = ts.getExpressionPrecedence(emittedOperand);
- switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) {
- case -1:
- if (!isLeftSideOfBinary
- && binaryOperatorAssociativity === 1
- && operand.kind === 190) {
- return false;
- }
- return true;
- case 1:
- return false;
- case 0:
- if (isLeftSideOfBinary) {
- return binaryOperatorAssociativity === 1;
- }
- else {
- if (ts.isBinaryExpression(emittedOperand)
- && emittedOperand.operatorToken.kind === binaryOperator) {
- if (operatorHasAssociativeProperty(binaryOperator)) {
- return false;
- }
- if (binaryOperator === 35) {
- var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0;
- if (ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) {
- return false;
- }
+ function fixupParentReferences(rootNode) {
+ var parent = rootNode;
+ forEachChild(rootNode, visitNode);
+ return;
+ function visitNode(n) {
+ if (n.parent !== parent) {
+ n.parent = parent;
+ var saveParent = parent;
+ parent = n;
+ forEachChild(n, visitNode);
+ if (n.jsDocComments) {
+ for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) {
+ var jsDocComment = _a[_i];
+ jsDocComment.parent = n;
+ parent = jsDocComment;
+ forEachChild(jsDocComment, visitNode);
}
}
- var operandAssociativity = ts.getExpressionAssociativity(emittedOperand);
- return operandAssociativity === 0;
+ parent = saveParent;
}
+ }
}
- }
- function operatorHasAssociativeProperty(binaryOperator) {
- return binaryOperator === 37
- || binaryOperator === 47
- || binaryOperator === 46
- || binaryOperator === 48;
- }
- function getLiteralKindOfBinaryPlusOperand(node) {
- node = skipPartiallyEmittedExpressions(node);
- if (ts.isLiteralKind(node.kind)) {
- return node.kind;
+ Parser.fixupParentReferences = fixupParentReferences;
+ function createSourceFile(fileName, languageVersion, scriptKind) {
+ var sourceFile = new SourceFileConstructor(256, 0, sourceText.length);
+ nodeCount++;
+ sourceFile.text = sourceText;
+ sourceFile.bindDiagnostics = [];
+ sourceFile.languageVersion = languageVersion;
+ sourceFile.fileName = ts.normalizePath(fileName);
+ sourceFile.languageVariant = getLanguageVariant(scriptKind);
+ sourceFile.isDeclarationFile = ts.fileExtensionIs(sourceFile.fileName, ".d.ts");
+ sourceFile.scriptKind = scriptKind;
+ return sourceFile;
}
- if (node.kind === 187 && node.operatorToken.kind === 35) {
- if (node.cachedLiteralKind !== undefined) {
- return node.cachedLiteralKind;
+ function setContextFlag(val, flag) {
+ if (val) {
+ contextFlags |= flag;
+ }
+ else {
+ contextFlags &= ~flag;
}
- var leftKind = getLiteralKindOfBinaryPlusOperand(node.left);
- var literalKind = ts.isLiteralKind(leftKind)
- && leftKind === getLiteralKindOfBinaryPlusOperand(node.right)
- ? leftKind
- : 0;
- node.cachedLiteralKind = literalKind;
- return literalKind;
}
- return 0;
- }
- function parenthesizeForNew(expression) {
- var emittedExpression = skipPartiallyEmittedExpressions(expression);
- switch (emittedExpression.kind) {
- case 174:
- return createParen(expression);
- case 175:
- return emittedExpression.arguments
- ? expression
- : createParen(expression);
+ function setDisallowInContext(val) {
+ setContextFlag(val, 32768);
}
- return parenthesizeForAccess(expression);
- }
- ts.parenthesizeForNew = parenthesizeForNew;
- function parenthesizeForAccess(expression) {
- var emittedExpression = skipPartiallyEmittedExpressions(expression);
- if (ts.isLeftHandSideExpression(emittedExpression)
- && (emittedExpression.kind !== 175 || emittedExpression.arguments)
- && emittedExpression.kind !== 8) {
- return expression;
+ function setYieldContext(val) {
+ setContextFlag(val, 65536);
}
- return createParen(expression, expression);
- }
- ts.parenthesizeForAccess = parenthesizeForAccess;
- function parenthesizePostfixOperand(operand) {
- return ts.isLeftHandSideExpression(operand)
- ? operand
- : createParen(operand, operand);
- }
- ts.parenthesizePostfixOperand = parenthesizePostfixOperand;
- function parenthesizePrefixOperand(operand) {
- return ts.isUnaryExpression(operand)
- ? operand
- : createParen(operand, operand);
- }
- ts.parenthesizePrefixOperand = parenthesizePrefixOperand;
- function parenthesizeListElements(elements) {
- var result;
- for (var i = 0; i < elements.length; i++) {
- var element = parenthesizeExpressionForList(elements[i]);
- if (result !== undefined || element !== elements[i]) {
- if (result === undefined) {
- result = elements.slice(0, i);
- }
- result.push(element);
- }
+ function setDecoratorContext(val) {
+ setContextFlag(val, 131072);
}
- if (result !== undefined) {
- return createNodeArray(result, elements, elements.hasTrailingComma);
+ function setAwaitContext(val) {
+ setContextFlag(val, 262144);
}
- return elements;
- }
- function parenthesizeExpressionForList(expression) {
- var emittedExpression = skipPartiallyEmittedExpressions(expression);
- var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);
- var commaPrecedence = ts.getOperatorPrecedence(187, 24);
- return expressionPrecedence > commaPrecedence
- ? expression
- : createParen(expression, expression);
- }
- ts.parenthesizeExpressionForList = parenthesizeExpressionForList;
- function parenthesizeExpressionForExpressionStatement(expression) {
- var emittedExpression = skipPartiallyEmittedExpressions(expression);
- if (ts.isCallExpression(emittedExpression)) {
- var callee = emittedExpression.expression;
- var kind = skipPartiallyEmittedExpressions(callee).kind;
- if (kind === 179 || kind === 180) {
- var mutableCall = getMutableClone(emittedExpression);
- mutableCall.expression = createParen(callee, callee);
- return recreatePartiallyEmittedExpressions(expression, mutableCall);
+ function doOutsideOfContext(context, func) {
+ var contextFlagsToClear = context & contextFlags;
+ if (contextFlagsToClear) {
+ setContextFlag(false, contextFlagsToClear);
+ var result = func();
+ setContextFlag(true, contextFlagsToClear);
+ return result;
}
+ return func();
}
- else {
- var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind;
- if (leftmostExpressionKind === 171 || leftmostExpressionKind === 179) {
- return createParen(expression, expression);
+ function doInsideOfContext(context, func) {
+ var contextFlagsToSet = context & ~contextFlags;
+ if (contextFlagsToSet) {
+ setContextFlag(true, contextFlagsToSet);
+ var result = func();
+ setContextFlag(false, contextFlagsToSet);
+ return result;
}
+ return func();
}
- return expression;
- }
- ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement;
- function recreatePartiallyEmittedExpressions(originalOuterExpression, newInnerExpression) {
- if (ts.isPartiallyEmittedExpression(originalOuterExpression)) {
- var clone_1 = getMutableClone(originalOuterExpression);
- clone_1.expression = recreatePartiallyEmittedExpressions(clone_1.expression, newInnerExpression);
- return clone_1;
- }
- return newInnerExpression;
- }
- function getLeftmostExpression(node) {
- while (true) {
- switch (node.kind) {
- case 186:
- node = node.operand;
- continue;
- case 187:
- node = node.left;
- continue;
- case 188:
- node = node.condition;
- continue;
- case 174:
- case 173:
- case 172:
- node = node.expression;
- continue;
- case 288:
- node = node.expression;
- continue;
- }
- return node;
+ function allowInAnd(func) {
+ return doOutsideOfContext(32768, func);
}
- }
- function parenthesizeConciseBody(body) {
- var emittedBody = skipPartiallyEmittedExpressions(body);
- if (emittedBody.kind === 171) {
- return createParen(body, body);
+ function disallowInAnd(func) {
+ return doInsideOfContext(32768, func);
}
- return body;
- }
- ts.parenthesizeConciseBody = parenthesizeConciseBody;
- function skipOuterExpressions(node, kinds) {
- if (kinds === void 0) { kinds = 7; }
- var previousNode;
- do {
- previousNode = node;
- if (kinds & 1) {
- node = skipParentheses(node);
- }
- if (kinds & 2) {
- node = skipAssertions(node);
- }
- if (kinds & 4) {
- node = skipPartiallyEmittedExpressions(node);
- }
- } while (previousNode !== node);
- return node;
- }
- ts.skipOuterExpressions = skipOuterExpressions;
- function skipParentheses(node) {
- while (node.kind === 178) {
- node = node.expression;
+ function doInYieldContext(func) {
+ return doInsideOfContext(65536, func);
}
- return node;
- }
- ts.skipParentheses = skipParentheses;
- function skipAssertions(node) {
- while (ts.isAssertionExpression(node)) {
- node = node.expression;
+ function doInDecoratorContext(func) {
+ return doInsideOfContext(131072, func);
}
- return node;
- }
- ts.skipAssertions = skipAssertions;
- function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 288) {
- node = node.expression;
+ function doInAwaitContext(func) {
+ return doInsideOfContext(262144, func);
}
- return node;
- }
- ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;
- function startOnNewLine(node) {
- node.startsOnNewLine = true;
- return node;
- }
- ts.startOnNewLine = startOnNewLine;
- function setOriginalNode(node, original) {
- node.original = original;
- if (original) {
- var emitNode = original.emitNode;
- if (emitNode)
- node.emitNode = mergeEmitNode(emitNode, node.emitNode);
+ function doOutsideOfAwaitContext(func) {
+ return doOutsideOfContext(262144, func);
}
- return node;
- }
- ts.setOriginalNode = setOriginalNode;
- function mergeEmitNode(sourceEmitNode, destEmitNode) {
- var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges;
- if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges))
- destEmitNode = {};
- if (flags)
- destEmitNode.flags = flags;
- if (commentRange)
- destEmitNode.commentRange = commentRange;
- if (sourceMapRange)
- destEmitNode.sourceMapRange = sourceMapRange;
- if (tokenSourceMapRanges)
- destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges);
- return destEmitNode;
- }
- function mergeTokenSourceMapRanges(sourceRanges, destRanges) {
- if (!destRanges)
- destRanges = ts.createMap();
- ts.copyProperties(sourceRanges, destRanges);
- return destRanges;
- }
- function disposeEmitNodes(sourceFile) {
- sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile));
- var emitNode = sourceFile && sourceFile.emitNode;
- var annotatedNodes = emitNode && emitNode.annotatedNodes;
- if (annotatedNodes) {
- for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) {
- var node = annotatedNodes_1[_i];
- node.emitNode = undefined;
- }
+ function doInYieldAndAwaitContext(func) {
+ return doInsideOfContext(65536 | 262144, func);
}
- }
- ts.disposeEmitNodes = disposeEmitNodes;
- function getOrCreateEmitNode(node) {
- if (!node.emitNode) {
- if (ts.isParseTreeNode(node)) {
- if (node.kind === 256) {
- return node.emitNode = { annotatedNodes: [node] };
- }
- var sourceFile = ts.getSourceFileOfNode(node);
- getOrCreateEmitNode(sourceFile).annotatedNodes.push(node);
- }
- node.emitNode = {};
+ function inContext(flags) {
+ return (contextFlags & flags) !== 0;
}
- return node.emitNode;
- }
- function getEmitFlags(node) {
- var emitNode = node.emitNode;
- return emitNode && emitNode.flags;
- }
- ts.getEmitFlags = getEmitFlags;
- function setEmitFlags(node, emitFlags) {
- getOrCreateEmitNode(node).flags = emitFlags;
- return node;
- }
- ts.setEmitFlags = setEmitFlags;
- function setSourceMapRange(node, range) {
- getOrCreateEmitNode(node).sourceMapRange = range;
- return node;
- }
- ts.setSourceMapRange = setSourceMapRange;
- function setTokenSourceMapRange(node, token, range) {
- var emitNode = getOrCreateEmitNode(node);
- var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap());
- tokenSourceMapRanges[token] = range;
- return node;
- }
- ts.setTokenSourceMapRange = setTokenSourceMapRange;
- function setCommentRange(node, range) {
- getOrCreateEmitNode(node).commentRange = range;
- return node;
- }
- ts.setCommentRange = setCommentRange;
- function getCommentRange(node) {
- var emitNode = node.emitNode;
- return (emitNode && emitNode.commentRange) || node;
- }
- ts.getCommentRange = getCommentRange;
- function getSourceMapRange(node) {
- var emitNode = node.emitNode;
- return (emitNode && emitNode.sourceMapRange) || node;
- }
- ts.getSourceMapRange = getSourceMapRange;
- function getTokenSourceMapRange(node, token) {
- var emitNode = node.emitNode;
- var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
- return tokenSourceMapRanges && tokenSourceMapRanges[token];
- }
- ts.getTokenSourceMapRange = getTokenSourceMapRange;
- function getConstantValue(node) {
- var emitNode = node.emitNode;
- return emitNode && emitNode.constantValue;
- }
- ts.getConstantValue = getConstantValue;
- function setConstantValue(node, value) {
- var emitNode = getOrCreateEmitNode(node);
- emitNode.constantValue = value;
- return node;
- }
- ts.setConstantValue = setConstantValue;
- function setTextRange(node, location) {
- if (location) {
- node.pos = location.pos;
- node.end = location.end;
+ function inYieldContext() {
+ return inContext(65536);
}
- return node;
- }
- ts.setTextRange = setTextRange;
- function setNodeFlags(node, flags) {
- node.flags = flags;
- return node;
- }
- ts.setNodeFlags = setNodeFlags;
- function setMultiLine(node, multiLine) {
- node.multiLine = multiLine;
- return node;
- }
- ts.setMultiLine = setMultiLine;
- function setHasTrailingComma(nodes, hasTrailingComma) {
- nodes.hasTrailingComma = hasTrailingComma;
- return nodes;
- }
- ts.setHasTrailingComma = setHasTrailingComma;
- function getLocalNameForExternalImport(node, sourceFile) {
- var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
- if (namespaceDeclaration && !ts.isDefaultImport(node)) {
- var name_12 = namespaceDeclaration.name;
- return ts.isGeneratedIdentifier(name_12) ? name_12 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
+ function inDisallowInContext() {
+ return inContext(32768);
}
- if (node.kind === 230 && node.importClause) {
- return getGeneratedNameForNode(node);
+ function inDecoratorContext() {
+ return inContext(131072);
}
- if (node.kind === 236 && node.moduleSpecifier) {
- return getGeneratedNameForNode(node);
+ function inAwaitContext() {
+ return inContext(262144);
}
- return undefined;
- }
- ts.getLocalNameForExternalImport = getLocalNameForExternalImport;
- function getExternalModuleNameLiteral(importNode, sourceFile, host, resolver, compilerOptions) {
- var moduleName = ts.getExternalModuleName(importNode);
- if (moduleName.kind === 9) {
- return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions)
- || tryRenameExternalModule(moduleName, sourceFile)
- || getSynthesizedClone(moduleName);
+ function parseErrorAtCurrentToken(message, arg0) {
+ var start = scanner.getTokenPos();
+ var length = scanner.getTextPos() - start;
+ parseErrorAtPosition(start, length, message, arg0);
}
- return undefined;
- }
- ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral;
- function tryRenameExternalModule(moduleName, sourceFile) {
- if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) {
- return createLiteral(sourceFile.renamedDependencies[moduleName.text]);
+ function parseErrorAtPosition(start, length, message, arg0) {
+ var lastError = ts.lastOrUndefined(parseDiagnostics);
+ if (!lastError || start !== lastError.start) {
+ parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0));
+ }
+ parseErrorBeforeNextFinishedNode = true;
}
- return undefined;
- }
- function tryGetModuleNameFromFile(file, host, options) {
- if (!file) {
- return undefined;
+ function scanError(message, length) {
+ var pos = scanner.getTextPos();
+ parseErrorAtPosition(pos, length || 0, message);
}
- if (file.moduleName) {
- return createLiteral(file.moduleName);
+ function getNodePos() {
+ return scanner.getStartPos();
}
- if (!ts.isDeclarationFile(file) && (options.out || options.outFile)) {
- return createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName));
+ function getNodeEnd() {
+ return scanner.getStartPos();
}
- return undefined;
- }
- ts.tryGetModuleNameFromFile = tryGetModuleNameFromFile;
- function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) {
- return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);
- }
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var NodeConstructor;
- var TokenConstructor;
- var IdentifierConstructor;
- var SourceFileConstructor;
- function createNode(kind, pos, end) {
- if (kind === 256) {
- return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
+ function token() {
+ return currentToken;
}
- else if (kind === 69) {
- return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
+ function nextToken() {
+ return currentToken = scanner.scan();
}
- else if (kind < 139) {
- return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
+ function reScanGreaterToken() {
+ return currentToken = scanner.reScanGreaterToken();
}
- else {
- return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
+ function reScanSlashToken() {
+ return currentToken = scanner.reScanSlashToken();
}
- }
- ts.createNode = createNode;
- function visitNode(cbNode, node) {
- if (node) {
- return cbNode(node);
+ function reScanTemplateToken() {
+ return currentToken = scanner.reScanTemplateToken();
}
- }
- function visitNodeArray(cbNodes, nodes) {
- if (nodes) {
- return cbNodes(nodes);
+ function scanJsxIdentifier() {
+ return currentToken = scanner.scanJsxIdentifier();
}
- }
- function visitEachNode(cbNode, nodes) {
- if (nodes) {
- for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
- var node = nodes_1[_i];
- var result = cbNode(node);
- if (result) {
- return result;
- }
- }
+ function scanJsxText() {
+ return currentToken = scanner.scanJsxToken();
}
- }
- function forEachChild(node, cbNode, cbNodeArray) {
- if (!node) {
- return;
+ function scanJsxAttributeValue() {
+ return currentToken = scanner.scanJsxAttributeValue();
}
- var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode;
- var cbNodes = cbNodeArray || cbNode;
- switch (node.kind) {
- case 139:
- return visitNode(cbNode, node.left) ||
- visitNode(cbNode, node.right);
- case 141:
- return visitNode(cbNode, node.name) ||
- visitNode(cbNode, node.constraint) ||
- visitNode(cbNode, node.expression);
- case 254:
- return visitNodes(cbNodes, node.decorators) ||
- visitNodes(cbNodes, node.modifiers) ||
- visitNode(cbNode, node.name) ||
- visitNode(cbNode, node.questionToken) ||
- visitNode(cbNode, node.equalsToken) ||
- visitNode(cbNode, node.objectAssignmentInitializer);
- case 142:
- case 145:
- case 144:
- case 253:
- case 218:
- case 169:
- 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 156:
- case 157:
- case 151:
- case 152:
- case 153:
- return visitNodes(cbNodes, node.decorators) ||
- visitNodes(cbNodes, node.modifiers) ||
- visitNodes(cbNodes, node.typeParameters) ||
- visitNodes(cbNodes, node.parameters) ||
- visitNode(cbNode, node.type);
- case 147:
- case 146:
- case 148:
- case 149:
- case 150:
- case 179:
- case 220:
- case 180:
- 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 155:
- return visitNode(cbNode, node.typeName) ||
- visitNodes(cbNodes, node.typeArguments);
- case 154:
- return visitNode(cbNode, node.parameterName) ||
- visitNode(cbNode, node.type);
- case 158:
- return visitNode(cbNode, node.exprName);
- case 159:
- return visitNodes(cbNodes, node.members);
- case 160:
- return visitNode(cbNode, node.elementType);
- case 161:
- return visitNodes(cbNodes, node.elementTypes);
- case 162:
- case 163:
- return visitNodes(cbNodes, node.types);
- case 164:
- return visitNode(cbNode, node.type);
- case 166:
- return visitNode(cbNode, node.literal);
- case 167:
- case 168:
- return visitNodes(cbNodes, node.elements);
- case 170:
- return visitNodes(cbNodes, node.elements);
- case 171:
- return visitNodes(cbNodes, node.properties);
- case 172:
- return visitNode(cbNode, node.expression) ||
- visitNode(cbNode, node.name);
- case 173:
- return visitNode(cbNode, node.expression) ||
- visitNode(cbNode, node.argumentExpression);
- case 174:
- case 175:
- return visitNode(cbNode, node.expression) ||
- visitNodes(cbNodes, node.typeArguments) ||
- visitNodes(cbNodes, node.arguments);
- case 176:
- return visitNode(cbNode, node.tag) ||
- visitNode(cbNode, node.template);
- case 177:
- return visitNode(cbNode, node.type) ||
- visitNode(cbNode, node.expression);
- case 178:
- return visitNode(cbNode, node.expression);
- case 181:
- return visitNode(cbNode, node.expression);
- case 182:
- return visitNode(cbNode, node.expression);
- case 183:
- return visitNode(cbNode, node.expression);
- case 185:
- return visitNode(cbNode, node.operand);
- case 190:
- return visitNode(cbNode, node.asteriskToken) ||
- visitNode(cbNode, node.expression);
- case 184:
- return visitNode(cbNode, node.expression);
- case 186:
- return visitNode(cbNode, node.operand);
- case 187:
- return visitNode(cbNode, node.left) ||
- visitNode(cbNode, node.operatorToken) ||
- visitNode(cbNode, node.right);
- case 195:
- return visitNode(cbNode, node.expression) ||
- visitNode(cbNode, node.type);
- case 196:
- return visitNode(cbNode, node.expression);
- case 188:
- return visitNode(cbNode, node.condition) ||
- visitNode(cbNode, node.questionToken) ||
- visitNode(cbNode, node.whenTrue) ||
- visitNode(cbNode, node.colonToken) ||
- visitNode(cbNode, node.whenFalse);
- case 191:
- return visitNode(cbNode, node.expression);
- case 199:
- case 226:
- return visitNodes(cbNodes, node.statements);
- case 256:
- return visitNodes(cbNodes, node.statements) ||
- visitNode(cbNode, node.endOfFileToken);
- case 200:
- return visitNodes(cbNodes, node.decorators) ||
- visitNodes(cbNodes, node.modifiers) ||
- visitNode(cbNode, node.declarationList);
- case 219:
- return visitNodes(cbNodes, node.declarations);
- case 202:
- return visitNode(cbNode, node.expression);
- case 203:
- return visitNode(cbNode, node.expression) ||
- visitNode(cbNode, node.thenStatement) ||
- visitNode(cbNode, node.elseStatement);
- case 204:
- return visitNode(cbNode, node.statement) ||
- visitNode(cbNode, node.expression);
- case 205:
- return visitNode(cbNode, node.expression) ||
- visitNode(cbNode, node.statement);
- case 206:
- return visitNode(cbNode, node.initializer) ||
- visitNode(cbNode, node.condition) ||
- visitNode(cbNode, node.incrementor) ||
- visitNode(cbNode, node.statement);
- case 207:
- return visitNode(cbNode, node.initializer) ||
- visitNode(cbNode, node.expression) ||
- visitNode(cbNode, node.statement);
- case 208:
- return visitNode(cbNode, node.initializer) ||
- visitNode(cbNode, node.expression) ||
- visitNode(cbNode, node.statement);
- case 209:
- case 210:
- return visitNode(cbNode, node.label);
- case 211:
- return visitNode(cbNode, node.expression);
- case 212:
- return visitNode(cbNode, node.expression) ||
- visitNode(cbNode, node.statement);
- case 213:
- return visitNode(cbNode, node.expression) ||
- visitNode(cbNode, node.caseBlock);
- case 227:
- return visitNodes(cbNodes, node.clauses);
- case 249:
- return visitNode(cbNode, node.expression) ||
- visitNodes(cbNodes, node.statements);
- case 250:
- return visitNodes(cbNodes, node.statements);
- case 214:
- return visitNode(cbNode, node.label) ||
- visitNode(cbNode, node.statement);
- case 215:
- return visitNode(cbNode, node.expression);
- case 216:
- return visitNode(cbNode, node.tryBlock) ||
- visitNode(cbNode, node.catchClause) ||
- visitNode(cbNode, node.finallyBlock);
- case 252:
- return visitNode(cbNode, node.variableDeclaration) ||
- visitNode(cbNode, node.block);
- case 143:
- return visitNode(cbNode, node.expression);
- case 221:
- case 192:
- 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 222:
- 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 visitNodes(cbNodes, node.decorators) ||
- visitNodes(cbNodes, node.modifiers) ||
- visitNode(cbNode, node.name) ||
- visitNodes(cbNodes, node.typeParameters) ||
- visitNode(cbNode, node.type);
- case 224:
- return visitNodes(cbNodes, node.decorators) ||
- visitNodes(cbNodes, node.modifiers) ||
- visitNode(cbNode, node.name) ||
- visitNodes(cbNodes, node.members);
- case 255:
- return visitNode(cbNode, node.name) ||
- visitNode(cbNode, node.initializer);
- case 225:
- return visitNodes(cbNodes, node.decorators) ||
- visitNodes(cbNodes, node.modifiers) ||
- visitNode(cbNode, node.name) ||
- visitNode(cbNode, node.body);
- case 229:
- return visitNodes(cbNodes, node.decorators) ||
- visitNodes(cbNodes, node.modifiers) ||
- visitNode(cbNode, node.name) ||
- visitNode(cbNode, node.moduleReference);
- case 230:
- return visitNodes(cbNodes, node.decorators) ||
- visitNodes(cbNodes, node.modifiers) ||
- visitNode(cbNode, node.importClause) ||
- visitNode(cbNode, node.moduleSpecifier);
- case 231:
- return visitNode(cbNode, node.name) ||
- visitNode(cbNode, node.namedBindings);
- case 228:
- return visitNode(cbNode, node.name);
- case 232:
- return visitNode(cbNode, node.name);
- case 233:
- case 237:
- return visitNodes(cbNodes, node.elements);
- case 236:
- return visitNodes(cbNodes, node.decorators) ||
- visitNodes(cbNodes, node.modifiers) ||
- visitNode(cbNode, node.exportClause) ||
- visitNode(cbNode, node.moduleSpecifier);
- case 234:
- case 238:
- return visitNode(cbNode, node.propertyName) ||
- visitNode(cbNode, node.name);
- case 235:
- return visitNodes(cbNodes, node.decorators) ||
- visitNodes(cbNodes, node.modifiers) ||
- visitNode(cbNode, node.expression);
- case 189:
- return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans);
- case 197:
- return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
- case 140:
- return visitNode(cbNode, node.expression);
- case 251:
- return visitNodes(cbNodes, node.types);
- case 194:
- return visitNode(cbNode, node.expression) ||
- visitNodes(cbNodes, node.typeArguments);
- case 240:
- return visitNode(cbNode, node.expression);
- case 239:
- return visitNodes(cbNodes, node.decorators);
- case 241:
- return visitNode(cbNode, node.openingElement) ||
- visitNodes(cbNodes, node.children) ||
- visitNode(cbNode, node.closingElement);
- case 242:
- case 243:
- return visitNode(cbNode, node.tagName) ||
- visitNodes(cbNodes, node.attributes);
- case 246:
- return visitNode(cbNode, node.name) ||
- visitNode(cbNode, node.initializer);
- case 247:
- return visitNode(cbNode, node.expression);
- case 248:
- return visitNode(cbNode, node.expression);
- case 245:
- return visitNode(cbNode, node.tagName);
- case 257:
- return visitNode(cbNode, node.type);
- case 261:
- return visitNodes(cbNodes, node.types);
- case 262:
- return visitNodes(cbNodes, node.types);
- case 260:
- return visitNode(cbNode, node.elementType);
- case 264:
- return visitNode(cbNode, node.type);
- case 263:
- return visitNode(cbNode, node.type);
- case 265:
- return visitNode(cbNode, node.literal);
- case 267:
- return visitNode(cbNode, node.name) ||
- visitNodes(cbNodes, node.typeArguments);
- case 268:
- return visitNode(cbNode, node.type);
- case 269:
- return visitNodes(cbNodes, node.parameters) ||
- visitNode(cbNode, node.type);
- case 270:
- return visitNode(cbNode, node.type);
- case 271:
- return visitNode(cbNode, node.type);
- case 272:
- return visitNode(cbNode, node.type);
- case 266:
- return visitNode(cbNode, node.name) ||
- visitNode(cbNode, node.type);
- case 273:
- return visitNodes(cbNodes, node.tags);
- case 275:
- return visitNode(cbNode, node.preParameterName) ||
- visitNode(cbNode, node.typeExpression) ||
- visitNode(cbNode, node.postParameterName);
- case 276:
- return visitNode(cbNode, node.typeExpression);
- case 277:
- return visitNode(cbNode, node.typeExpression);
- case 278:
- return visitNodes(cbNodes, node.typeParameters);
- case 279:
- return visitNode(cbNode, node.typeExpression) ||
- visitNode(cbNode, node.name) ||
- visitNode(cbNode, node.jsDocTypeLiteral);
- case 281:
- return visitNodes(cbNodes, node.jsDocPropertyTags);
- case 280:
- return visitNode(cbNode, node.typeExpression) ||
- visitNode(cbNode, node.name);
- case 288:
- return visitNode(cbNode, node.expression);
- case 282:
- return visitNode(cbNode, node.literal);
- }
- }
- ts.forEachChild = forEachChild;
- function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) {
- if (setParentNodes === void 0) { setParentNodes = false; }
- ts.performance.mark("beforeParse");
- var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind);
- ts.performance.mark("afterParse");
- ts.performance.measure("Parse", "beforeParse", "afterParse");
- return result;
- }
- ts.createSourceFile = createSourceFile;
- function isExternalModule(file) {
- return file.externalModuleIndicator !== undefined;
- }
- ts.isExternalModule = isExternalModule;
- function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {
- return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
- }
- ts.updateSourceFile = updateSourceFile;
- function parseIsolatedJSDocComment(content, start, length) {
- var result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length);
- if (result && result.jsDoc) {
- Parser.fixupParentReferences(result.jsDoc);
- }
- return result;
- }
- ts.parseIsolatedJSDocComment = parseIsolatedJSDocComment;
- function parseJSDocTypeExpressionForTests(content, start, length) {
- return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length);
- }
- ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
- var Parser;
- (function (Parser) {
- var scanner = ts.createScanner(2, true);
- var disallowInAndDecoratorContext = 32768 | 131072;
- var NodeConstructor;
- var TokenConstructor;
- var IdentifierConstructor;
- var SourceFileConstructor;
- var sourceFile;
- var parseDiagnostics;
- var syntaxCursor;
- var currentToken;
- var sourceText;
- var nodeCount;
- var identifiers;
- var identifierCount;
- var parsingContext;
- var contextFlags;
- var parseErrorBeforeNextFinishedNode = false;
- function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) {
- scriptKind = ts.ensureScriptKind(fileName, scriptKind);
- initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind);
- var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind);
- clearState();
+ function speculationHelper(callback, isLookAhead) {
+ var saveToken = currentToken;
+ var saveParseDiagnosticsLength = parseDiagnostics.length;
+ var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
+ var saveContextFlags = contextFlags;
+ var result = isLookAhead
+ ? scanner.lookAhead(callback)
+ : scanner.tryScan(callback);
+ ts.Debug.assert(saveContextFlags === contextFlags);
+ if (!result || isLookAhead) {
+ currentToken = saveToken;
+ parseDiagnostics.length = saveParseDiagnosticsLength;
+ parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;
+ }
return result;
}
- Parser.parseSourceFile = parseSourceFile;
- function getLanguageVariant(scriptKind) {
- return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 ? 1 : 0;
- }
- function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
- NodeConstructor = ts.objectAllocator.getNodeConstructor();
- TokenConstructor = ts.objectAllocator.getTokenConstructor();
- IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
- SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
- sourceText = _sourceText;
- syntaxCursor = _syntaxCursor;
- parseDiagnostics = [];
- parsingContext = 0;
- identifiers = ts.createMap();
- identifierCount = 0;
- nodeCount = 0;
- contextFlags = scriptKind === 1 || scriptKind === 2 ? 1048576 : 0;
- parseErrorBeforeNextFinishedNode = false;
- scanner.setText(sourceText);
- scanner.setOnError(scanError);
- scanner.setScriptTarget(languageVersion);
- scanner.setLanguageVariant(getLanguageVariant(scriptKind));
+ function lookAhead(callback) {
+ return speculationHelper(callback, true);
}
- function clearState() {
- scanner.setText("");
- scanner.setOnError(undefined);
- parseDiagnostics = undefined;
- sourceFile = undefined;
- identifiers = undefined;
- syntaxCursor = undefined;
- sourceText = undefined;
+ function tryParse(callback) {
+ return speculationHelper(callback, false);
}
- function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {
- sourceFile = createSourceFile(fileName, languageVersion, scriptKind);
- sourceFile.flags = contextFlags;
- nextToken();
- processReferenceComments(sourceFile);
- sourceFile.statements = parseList(0, parseStatement);
- ts.Debug.assert(token() === 1);
- sourceFile.endOfFileToken = parseTokenNode();
- setExternalModuleIndicator(sourceFile);
- sourceFile.nodeCount = nodeCount;
- sourceFile.identifierCount = identifierCount;
- sourceFile.identifiers = identifiers;
- sourceFile.parseDiagnostics = parseDiagnostics;
- if (setParentNodes) {
- fixupParentReferences(sourceFile);
+ function isIdentifier() {
+ if (token() === 70) {
+ return true;
}
- return sourceFile;
+ if (token() === 115 && inYieldContext()) {
+ return false;
+ }
+ if (token() === 120 && inAwaitContext()) {
+ return false;
+ }
+ return token() > 106;
}
- function addJSDocComment(node) {
- var comments = ts.getJsDocCommentsFromText(node, sourceFile.text);
- if (comments) {
- for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {
- var comment = comments_2[_i];
- var jsDoc = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos);
- if (!jsDoc) {
- continue;
- }
- if (!node.jsDocComments) {
- node.jsDocComments = [];
- }
- node.jsDocComments.push(jsDoc);
+ function parseExpected(kind, diagnosticMessage, shouldAdvance) {
+ if (shouldAdvance === void 0) { shouldAdvance = true; }
+ if (token() === kind) {
+ if (shouldAdvance) {
+ nextToken();
}
+ return true;
}
- return node;
- }
- function fixupParentReferences(rootNode) {
- var parent = rootNode;
- forEachChild(rootNode, visitNode);
- return;
- function visitNode(n) {
- if (n.parent !== parent) {
- n.parent = parent;
- var saveParent = parent;
- parent = n;
- forEachChild(n, visitNode);
- if (n.jsDocComments) {
- for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- jsDocComment.parent = n;
- parent = jsDocComment;
- forEachChild(jsDocComment, visitNode);
- }
- }
- parent = saveParent;
- }
- }
- }
- Parser.fixupParentReferences = fixupParentReferences;
- function createSourceFile(fileName, languageVersion, scriptKind) {
- var sourceFile = new SourceFileConstructor(256, 0, sourceText.length);
- nodeCount++;
- sourceFile.text = sourceText;
- sourceFile.bindDiagnostics = [];
- sourceFile.languageVersion = languageVersion;
- sourceFile.fileName = ts.normalizePath(fileName);
- sourceFile.languageVariant = getLanguageVariant(scriptKind);
- sourceFile.isDeclarationFile = ts.fileExtensionIs(sourceFile.fileName, ".d.ts");
- sourceFile.scriptKind = scriptKind;
- return sourceFile;
- }
- function setContextFlag(val, flag) {
- if (val) {
- contextFlags |= flag;
- }
- else {
- contextFlags &= ~flag;
- }
- }
- function setDisallowInContext(val) {
- setContextFlag(val, 32768);
- }
- function setYieldContext(val) {
- setContextFlag(val, 65536);
- }
- function setDecoratorContext(val) {
- setContextFlag(val, 131072);
- }
- function setAwaitContext(val) {
- setContextFlag(val, 262144);
- }
- function doOutsideOfContext(context, func) {
- var contextFlagsToClear = context & contextFlags;
- if (contextFlagsToClear) {
- setContextFlag(false, contextFlagsToClear);
- var result = func();
- setContextFlag(true, contextFlagsToClear);
- return result;
- }
- return func();
- }
- function doInsideOfContext(context, func) {
- var contextFlagsToSet = context & ~contextFlags;
- if (contextFlagsToSet) {
- setContextFlag(true, contextFlagsToSet);
- var result = func();
- setContextFlag(false, contextFlagsToSet);
- return result;
- }
- return func();
- }
- function allowInAnd(func) {
- return doOutsideOfContext(32768, func);
- }
- function disallowInAnd(func) {
- return doInsideOfContext(32768, func);
- }
- function doInYieldContext(func) {
- return doInsideOfContext(65536, func);
- }
- function doInDecoratorContext(func) {
- return doInsideOfContext(131072, func);
- }
- function doInAwaitContext(func) {
- return doInsideOfContext(262144, func);
- }
- function doOutsideOfAwaitContext(func) {
- return doOutsideOfContext(262144, func);
- }
- function doInYieldAndAwaitContext(func) {
- return doInsideOfContext(65536 | 262144, func);
- }
- function inContext(flags) {
- return (contextFlags & flags) !== 0;
- }
- function inYieldContext() {
- return inContext(65536);
- }
- function inDisallowInContext() {
- return inContext(32768);
- }
- function inDecoratorContext() {
- return inContext(131072);
- }
- function inAwaitContext() {
- return inContext(262144);
- }
- function parseErrorAtCurrentToken(message, arg0) {
- var start = scanner.getTokenPos();
- var length = scanner.getTextPos() - start;
- parseErrorAtPosition(start, length, message, arg0);
- }
- function parseErrorAtPosition(start, length, message, arg0) {
- var lastError = ts.lastOrUndefined(parseDiagnostics);
- if (!lastError || start !== lastError.start) {
- parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0));
- }
- parseErrorBeforeNextFinishedNode = true;
- }
- function scanError(message, length) {
- var pos = scanner.getTextPos();
- parseErrorAtPosition(pos, length || 0, message);
- }
- function getNodePos() {
- return scanner.getStartPos();
- }
- function getNodeEnd() {
- return scanner.getStartPos();
- }
- function token() {
- return currentToken;
- }
- function nextToken() {
- return currentToken = scanner.scan();
- }
- function reScanGreaterToken() {
- return currentToken = scanner.reScanGreaterToken();
- }
- function reScanSlashToken() {
- return currentToken = scanner.reScanSlashToken();
- }
- function reScanTemplateToken() {
- return currentToken = scanner.reScanTemplateToken();
- }
- function scanJsxIdentifier() {
- return currentToken = scanner.scanJsxIdentifier();
- }
- function scanJsxText() {
- return currentToken = scanner.scanJsxToken();
- }
- function scanJsxAttributeValue() {
- return currentToken = scanner.scanJsxAttributeValue();
- }
- function speculationHelper(callback, isLookAhead) {
- var saveToken = currentToken;
- var saveParseDiagnosticsLength = parseDiagnostics.length;
- var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
- var saveContextFlags = contextFlags;
- var result = isLookAhead
- ? scanner.lookAhead(callback)
- : scanner.tryScan(callback);
- ts.Debug.assert(saveContextFlags === contextFlags);
- if (!result || isLookAhead) {
- currentToken = saveToken;
- parseDiagnostics.length = saveParseDiagnosticsLength;
- parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;
- }
- return result;
- }
- function lookAhead(callback) {
- return speculationHelper(callback, true);
- }
- function tryParse(callback) {
- return speculationHelper(callback, false);
- }
- function isIdentifier() {
- if (token() === 69) {
- return true;
- }
- if (token() === 114 && inYieldContext()) {
- return false;
- }
- if (token() === 119 && inAwaitContext()) {
- return false;
- }
- return token() > 105;
- }
- function parseExpected(kind, diagnosticMessage, shouldAdvance) {
- if (shouldAdvance === void 0) { shouldAdvance = true; }
- if (token() === kind) {
- if (shouldAdvance) {
- nextToken();
- }
- return true;
- }
- if (diagnosticMessage) {
- parseErrorAtCurrentToken(diagnosticMessage);
- }
- else {
- parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
- }
- return false;
+ if (diagnosticMessage) {
+ parseErrorAtCurrentToken(diagnosticMessage);
+ }
+ else {
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
+ }
+ return false;
}
function parseOptional(t) {
if (token() === t) {
@@ -13176,20 +12663,20 @@ var ts;
return finishNode(node);
}
function canParseSemicolon() {
- if (token() === 23) {
+ if (token() === 24) {
return true;
}
- return token() === 16 || token() === 1 || scanner.hasPrecedingLineBreak();
+ return token() === 17 || token() === 1 || scanner.hasPrecedingLineBreak();
}
function parseSemicolon() {
if (canParseSemicolon()) {
- if (token() === 23) {
+ if (token() === 24) {
nextToken();
}
return true;
}
else {
- return parseExpected(23);
+ return parseExpected(24);
}
}
function createNode(kind, pos) {
@@ -13197,8 +12684,8 @@ var ts;
if (!(pos >= 0)) {
pos = scanner.getStartPos();
}
- return kind >= 139 ? new NodeConstructor(kind, pos, pos) :
- kind === 69 ? new IdentifierConstructor(kind, pos, pos) :
+ return kind >= 140 ? new NodeConstructor(kind, pos, pos) :
+ kind === 70 ? new IdentifierConstructor(kind, pos, pos) :
new TokenConstructor(kind, pos, pos);
}
function createNodeArray(elements, pos) {
@@ -13239,15 +12726,15 @@ var ts;
function createIdentifier(isIdentifier, diagnosticMessage) {
identifierCount++;
if (isIdentifier) {
- var node = createNode(69);
- if (token() !== 69) {
+ var node = createNode(70);
+ if (token() !== 70) {
node.originalKeywordKind = token();
}
node.text = internIdentifier(scanner.getTokenValue());
nextToken();
return finishNode(node);
}
- return createMissingNode(69, false, diagnosticMessage || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(70, false, diagnosticMessage || ts.Diagnostics.Identifier_expected);
}
function parseIdentifier(diagnosticMessage) {
return createIdentifier(isIdentifier(), diagnosticMessage);
@@ -13264,7 +12751,7 @@ var ts;
if (token() === 9 || token() === 8) {
return parseLiteralNode(true);
}
- if (allowComputedPropertyNames && token() === 19) {
+ if (allowComputedPropertyNames && token() === 20) {
return parseComputedPropertyName();
}
return parseIdentifierName();
@@ -13279,10 +12766,10 @@ var ts;
return token() === 9 || token() === 8 || ts.tokenIsIdentifierOrKeyword(token());
}
function parseComputedPropertyName() {
- var node = createNode(140);
- parseExpected(19);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(141);
parseExpected(20);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(21);
return finishNode(node);
}
function parseContextualModifier(t) {
@@ -13296,20 +12783,20 @@ var ts;
return canFollowModifier();
}
function nextTokenCanFollowModifier() {
- if (token() === 74) {
- return nextToken() === 81;
+ if (token() === 75) {
+ return nextToken() === 82;
}
- if (token() === 82) {
+ if (token() === 83) {
nextToken();
- if (token() === 77) {
+ if (token() === 78) {
return lookAhead(nextTokenIsClassOrFunctionOrAsync);
}
- return token() !== 37 && token() !== 116 && token() !== 15 && canFollowModifier();
+ return token() !== 38 && token() !== 117 && token() !== 16 && canFollowModifier();
}
- if (token() === 77) {
+ if (token() === 78) {
return nextTokenIsClassOrFunctionOrAsync();
}
- if (token() === 113) {
+ if (token() === 114) {
nextToken();
return canFollowModifier();
}
@@ -13319,16 +12806,16 @@ var ts;
return ts.isModifierKind(token()) && tryParse(nextTokenCanFollowModifier);
}
function canFollowModifier() {
- return token() === 19
- || token() === 15
- || token() === 37
- || token() === 22
+ return token() === 20
+ || token() === 16
+ || token() === 38
+ || token() === 23
|| isLiteralPropertyName();
}
function nextTokenIsClassOrFunctionOrAsync() {
nextToken();
- return token() === 73 || token() === 87 ||
- (token() === 118 && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
+ return token() === 74 || token() === 88 ||
+ (token() === 119 && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
}
function isListElement(parsingContext, inErrorRecovery) {
var node = currentNode(parsingContext);
@@ -13339,21 +12826,21 @@ var ts;
case 0:
case 1:
case 3:
- return !(token() === 23 && inErrorRecovery) && isStartOfStatement();
+ return !(token() === 24 && inErrorRecovery) && isStartOfStatement();
case 2:
- return token() === 71 || token() === 77;
+ return token() === 72 || token() === 78;
case 4:
return lookAhead(isTypeMemberStart);
case 5:
- return lookAhead(isClassMemberStart) || (token() === 23 && !inErrorRecovery);
+ return lookAhead(isClassMemberStart) || (token() === 24 && !inErrorRecovery);
case 6:
- return token() === 19 || isLiteralPropertyName();
+ return token() === 20 || isLiteralPropertyName();
case 12:
- return token() === 19 || token() === 37 || isLiteralPropertyName();
+ return token() === 20 || token() === 38 || isLiteralPropertyName();
case 9:
- return token() === 19 || isLiteralPropertyName();
+ return token() === 20 || isLiteralPropertyName();
case 7:
- if (token() === 15) {
+ if (token() === 16) {
return lookAhead(isValidHeritageClauseObjectLiteral);
}
if (!inErrorRecovery) {
@@ -13365,23 +12852,23 @@ var ts;
case 8:
return isIdentifierOrPattern();
case 10:
- return token() === 24 || token() === 22 || isIdentifierOrPattern();
+ return token() === 25 || token() === 23 || isIdentifierOrPattern();
case 17:
return isIdentifier();
case 11:
case 15:
- return token() === 24 || token() === 22 || isStartOfExpression();
+ return token() === 25 || token() === 23 || isStartOfExpression();
case 16:
return isStartOfParameter();
case 18:
case 19:
- return token() === 24 || isStartOfType();
+ return token() === 25 || isStartOfType();
case 20:
return isHeritageClause();
case 21:
return ts.tokenIsIdentifierOrKeyword(token());
case 13:
- return ts.tokenIsIdentifierOrKeyword(token()) || token() === 15;
+ return ts.tokenIsIdentifierOrKeyword(token()) || token() === 16;
case 14:
return true;
case 22:
@@ -13394,10 +12881,10 @@ var ts;
ts.Debug.fail("Non-exhaustive case in 'isListElement'.");
}
function isValidHeritageClauseObjectLiteral() {
- ts.Debug.assert(token() === 15);
- if (nextToken() === 16) {
+ ts.Debug.assert(token() === 16);
+ if (nextToken() === 17) {
var next = nextToken();
- return next === 24 || next === 15 || next === 83 || next === 106;
+ return next === 25 || next === 16 || next === 84 || next === 107;
}
return true;
}
@@ -13410,8 +12897,8 @@ var ts;
return ts.tokenIsIdentifierOrKeyword(token());
}
function isHeritageClauseExtendsOrImplementsKeyword() {
- if (token() === 106 ||
- token() === 83) {
+ if (token() === 107 ||
+ token() === 84) {
return lookAhead(nextTokenIsStartOfExpression);
}
return false;
@@ -13433,39 +12920,39 @@ var ts;
case 12:
case 9:
case 21:
- return token() === 16;
+ return token() === 17;
case 3:
- return token() === 16 || token() === 71 || token() === 77;
+ return token() === 17 || token() === 72 || token() === 78;
case 7:
- return token() === 15 || token() === 83 || token() === 106;
+ return token() === 16 || token() === 84 || token() === 107;
case 8:
return isVariableDeclaratorListTerminator();
case 17:
- return token() === 27 || token() === 17 || token() === 15 || token() === 83 || token() === 106;
+ return token() === 28 || token() === 18 || token() === 16 || token() === 84 || token() === 107;
case 11:
- return token() === 18 || token() === 23;
+ return token() === 19 || token() === 24;
case 15:
case 19:
case 10:
- return token() === 20;
+ return token() === 21;
case 16:
- return token() === 18 || token() === 20;
+ return token() === 19 || token() === 21;
case 18:
- return token() !== 24;
+ return token() !== 25;
case 20:
- return token() === 15 || token() === 16;
+ return token() === 16 || token() === 17;
case 13:
- return token() === 27 || token() === 39;
+ return token() === 28 || token() === 40;
case 14:
- return token() === 25 && lookAhead(nextTokenIsSlash);
+ return token() === 26 && lookAhead(nextTokenIsSlash);
case 22:
- return token() === 18 || token() === 54 || token() === 16;
+ return token() === 19 || token() === 55 || token() === 17;
case 23:
- return token() === 27 || token() === 16;
+ return token() === 28 || token() === 17;
case 25:
- return token() === 20 || token() === 16;
+ return token() === 21 || token() === 17;
case 24:
- return token() === 16;
+ return token() === 17;
}
}
function isVariableDeclaratorListTerminator() {
@@ -13475,7 +12962,7 @@ var ts;
if (isInOrOfKeyword(token())) {
return true;
}
- if (token() === 34) {
+ if (token() === 35) {
return true;
}
return false;
@@ -13579,17 +13066,17 @@ var ts;
function isReusableClassMember(node) {
if (node) {
switch (node.kind) {
- case 148:
- case 153:
case 149:
+ case 154:
case 150:
- case 145:
- case 198:
+ case 151:
+ case 146:
+ case 199:
return true;
- case 147:
+ case 148:
var methodDeclaration = node;
- var nameIsConstructor = methodDeclaration.name.kind === 69 &&
- methodDeclaration.name.originalKeywordKind === 121;
+ var nameIsConstructor = methodDeclaration.name.kind === 70 &&
+ methodDeclaration.name.originalKeywordKind === 122;
return !nameIsConstructor;
}
}
@@ -13608,35 +13095,35 @@ var ts;
function isReusableStatement(node) {
if (node) {
switch (node.kind) {
- case 220:
+ case 221:
+ case 201:
case 200:
- case 199:
+ case 204:
case 203:
- case 202:
- case 215:
+ case 216:
+ case 212:
+ case 214:
case 211:
- case 213:
case 210:
+ case 208:
case 209:
case 207:
- case 208:
case 206:
- case 205:
- case 212:
- case 201:
- case 216:
- case 214:
- case 204:
+ case 213:
+ case 202:
case 217:
+ case 215:
+ case 205:
+ case 218:
+ case 231:
case 230:
- case 229:
+ case 237:
case 236:
- case 235:
- case 225:
- case 221:
+ case 226:
case 222:
- case 224:
case 223:
+ case 225:
+ case 224:
return true;
}
}
@@ -13648,25 +13135,25 @@ var ts;
function isReusableTypeMember(node) {
if (node) {
switch (node.kind) {
- case 152:
- case 146:
case 153:
- case 144:
- case 151:
+ case 147:
+ case 154:
+ case 145:
+ case 152:
return true;
}
}
return false;
}
function isReusableVariableDeclaration(node) {
- if (node.kind !== 218) {
+ if (node.kind !== 219) {
return false;
}
var variableDeclarator = node;
return variableDeclarator.initializer === undefined;
}
function isReusableParameter(node) {
- if (node.kind !== 142) {
+ if (node.kind !== 143) {
return false;
}
var parameter = node;
@@ -13720,15 +13207,15 @@ var ts;
if (isListElement(kind, false)) {
result.push(parseListElement(kind, parseElement));
commaStart = scanner.getTokenPos();
- if (parseOptional(24)) {
+ if (parseOptional(25)) {
continue;
}
commaStart = -1;
if (isListTerminator(kind)) {
break;
}
- parseExpected(24);
- if (considerSemicolonAsDelimiter && token() === 23 && !scanner.hasPrecedingLineBreak()) {
+ parseExpected(25);
+ if (considerSemicolonAsDelimiter && token() === 24 && !scanner.hasPrecedingLineBreak()) {
nextToken();
}
continue;
@@ -13760,8 +13247,8 @@ var ts;
}
function parseEntityName(allowReservedWords, diagnosticMessage) {
var entity = parseIdentifier(diagnosticMessage);
- while (parseOptional(21)) {
- var node = createNode(139, entity.pos);
+ while (parseOptional(22)) {
+ var node = createNode(140, entity.pos);
node.left = entity;
node.right = parseRightSideOfDot(allowReservedWords);
entity = finishNode(node);
@@ -13772,33 +13259,33 @@ var ts;
if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token())) {
var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
if (matchesPattern) {
- return createMissingNode(69, true, ts.Diagnostics.Identifier_expected);
+ return createMissingNode(70, true, ts.Diagnostics.Identifier_expected);
}
}
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTemplateExpression() {
- var template = createNode(189);
+ var template = createNode(190);
template.head = parseTemplateHead();
- ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind");
+ ts.Debug.assert(template.head.kind === 13, "Template head has wrong token kind");
var templateSpans = createNodeArray();
do {
templateSpans.push(parseTemplateSpan());
- } while (ts.lastOrUndefined(templateSpans).literal.kind === 13);
+ } while (ts.lastOrUndefined(templateSpans).literal.kind === 14);
templateSpans.end = getNodeEnd();
template.templateSpans = templateSpans;
return finishNode(template);
}
function parseTemplateSpan() {
- var span = createNode(197);
+ var span = createNode(198);
span.expression = allowInAnd(parseExpression);
var literal;
- if (token() === 16) {
+ if (token() === 17) {
reScanTemplateToken();
literal = parseTemplateMiddleOrTemplateTail();
}
else {
- literal = parseExpectedToken(14, false, ts.Diagnostics._0_expected, ts.tokenToString(16));
+ literal = parseExpectedToken(15, false, ts.Diagnostics._0_expected, ts.tokenToString(17));
}
span.literal = literal;
return finishNode(span);
@@ -13808,12 +13295,12 @@ var ts;
}
function parseTemplateHead() {
var fragment = parseLiteralLikeNode(token(), false);
- ts.Debug.assert(fragment.kind === 12, "Template head has wrong token kind");
+ ts.Debug.assert(fragment.kind === 13, "Template head has wrong token kind");
return fragment;
}
function parseTemplateMiddleOrTemplateTail() {
var fragment = parseLiteralLikeNode(token(), false);
- ts.Debug.assert(fragment.kind === 13 || fragment.kind === 14, "Template fragment has wrong token kind");
+ ts.Debug.assert(fragment.kind === 14 || fragment.kind === 15, "Template fragment has wrong token kind");
return fragment;
}
function parseLiteralLikeNode(kind, internName) {
@@ -13838,35 +13325,35 @@ var ts;
}
function parseTypeReference() {
var typeName = parseEntityName(false, ts.Diagnostics.Type_expected);
- var node = createNode(155, typeName.pos);
+ var node = createNode(156, typeName.pos);
node.typeName = typeName;
- if (!scanner.hasPrecedingLineBreak() && token() === 25) {
- node.typeArguments = parseBracketedList(18, parseType, 25, 27);
+ if (!scanner.hasPrecedingLineBreak() && token() === 26) {
+ node.typeArguments = parseBracketedList(18, parseType, 26, 28);
}
return finishNode(node);
}
function parseThisTypePredicate(lhs) {
nextToken();
- var node = createNode(154, lhs.pos);
+ var node = createNode(155, lhs.pos);
node.parameterName = lhs;
node.type = parseType();
return finishNode(node);
}
function parseThisTypeNode() {
- var node = createNode(165);
+ var node = createNode(166);
nextToken();
return finishNode(node);
}
function parseTypeQuery() {
- var node = createNode(158);
- parseExpected(101);
+ var node = createNode(159);
+ parseExpected(102);
node.exprName = parseEntityName(true);
return finishNode(node);
}
function parseTypeParameter() {
- var node = createNode(141);
+ var node = createNode(142);
node.name = parseIdentifier();
- if (parseOptional(83)) {
+ if (parseOptional(84)) {
if (isStartOfType() || !isStartOfExpression()) {
node.constraint = parseType();
}
@@ -13877,34 +13364,34 @@ var ts;
return finishNode(node);
}
function parseTypeParameters() {
- if (token() === 25) {
- return parseBracketedList(17, parseTypeParameter, 25, 27);
+ if (token() === 26) {
+ return parseBracketedList(17, parseTypeParameter, 26, 28);
}
}
function parseParameterType() {
- if (parseOptional(54)) {
+ if (parseOptional(55)) {
return parseType();
}
return undefined;
}
function isStartOfParameter() {
- return token() === 22 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 55 || token() === 97;
+ return token() === 23 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 || token() === 98;
}
function parseParameter() {
- var node = createNode(142);
- if (token() === 97) {
+ var node = createNode(143);
+ if (token() === 98) {
node.name = createIdentifier(true, undefined);
node.type = parseParameterType();
return finishNode(node);
}
node.decorators = parseDecorators();
node.modifiers = parseModifiers();
- node.dotDotDotToken = parseOptionalToken(22);
+ node.dotDotDotToken = parseOptionalToken(23);
node.name = parseIdentifierOrPattern();
if (ts.getFullWidth(node.name) === 0 && !ts.hasModifiers(node) && ts.isModifierKind(token())) {
nextToken();
}
- node.questionToken = parseOptionalToken(53);
+ node.questionToken = parseOptionalToken(54);
node.type = parseParameterType();
node.initializer = parseBindingElementInitializer(true);
return addJSDocComment(finishNode(node));
@@ -13916,7 +13403,7 @@ var ts;
return parseInitializer(true);
}
function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) {
- var returnTokenRequired = returnToken === 34;
+ var returnTokenRequired = returnToken === 35;
signature.typeParameters = parseTypeParameters();
signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList);
if (returnTokenRequired) {
@@ -13928,7 +13415,7 @@ var ts;
}
}
function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) {
- if (parseExpected(17)) {
+ if (parseExpected(18)) {
var savedYieldContext = inYieldContext();
var savedAwaitContext = inAwaitContext();
setYieldContext(yieldContext);
@@ -13936,7 +13423,7 @@ var ts;
var result = parseDelimitedList(16, parseParameter);
setYieldContext(savedYieldContext);
setAwaitContext(savedAwaitContext);
- if (!parseExpected(18) && requireCompleteParameterList) {
+ if (!parseExpected(19) && requireCompleteParameterList) {
return undefined;
}
return result;
@@ -13944,29 +13431,29 @@ var ts;
return requireCompleteParameterList ? undefined : createMissingList();
}
function parseTypeMemberSemicolon() {
- if (parseOptional(24)) {
+ if (parseOptional(25)) {
return;
}
parseSemicolon();
}
function parseSignatureMember(kind) {
var node = createNode(kind);
- if (kind === 152) {
- parseExpected(92);
+ if (kind === 153) {
+ parseExpected(93);
}
- fillSignature(54, false, false, false, node);
+ fillSignature(55, false, false, false, node);
parseTypeMemberSemicolon();
return addJSDocComment(finishNode(node));
}
function isIndexSignature() {
- if (token() !== 19) {
+ if (token() !== 20) {
return false;
}
return lookAhead(isUnambiguouslyIndexSignature);
}
function isUnambiguouslyIndexSignature() {
nextToken();
- if (token() === 22 || token() === 20) {
+ if (token() === 23 || token() === 21) {
return true;
}
if (ts.isModifierKind(token())) {
@@ -13981,43 +13468,43 @@ var ts;
else {
nextToken();
}
- if (token() === 54 || token() === 24) {
+ if (token() === 55 || token() === 25) {
return true;
}
- if (token() !== 53) {
+ if (token() !== 54) {
return false;
}
nextToken();
- return token() === 54 || token() === 24 || token() === 20;
+ return token() === 55 || token() === 25 || token() === 21;
}
function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(153, fullStart);
+ var node = createNode(154, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- node.parameters = parseBracketedList(16, parseParameter, 19, 20);
+ node.parameters = parseBracketedList(16, parseParameter, 20, 21);
node.type = parseTypeAnnotation();
parseTypeMemberSemicolon();
return finishNode(node);
}
function parsePropertyOrMethodSignature(fullStart, modifiers) {
var name = parsePropertyName();
- var questionToken = parseOptionalToken(53);
- if (token() === 17 || token() === 25) {
- var method = createNode(146, fullStart);
+ var questionToken = parseOptionalToken(54);
+ if (token() === 18 || token() === 26) {
+ var method = createNode(147, fullStart);
method.modifiers = modifiers;
method.name = name;
method.questionToken = questionToken;
- fillSignature(54, false, false, false, method);
+ fillSignature(55, false, false, false, method);
parseTypeMemberSemicolon();
return addJSDocComment(finishNode(method));
}
else {
- var property = createNode(144, fullStart);
+ var property = createNode(145, fullStart);
property.modifiers = modifiers;
property.name = name;
property.questionToken = questionToken;
property.type = parseTypeAnnotation();
- if (token() === 56) {
+ if (token() === 57) {
property.initializer = parseNonParameterInitializer();
}
parseTypeMemberSemicolon();
@@ -14026,14 +13513,14 @@ var ts;
}
function isTypeMemberStart() {
var idToken;
- if (token() === 17 || token() === 25) {
+ if (token() === 18 || token() === 26) {
return true;
}
while (ts.isModifierKind(token())) {
idToken = token();
nextToken();
}
- if (token() === 19) {
+ if (token() === 20) {
return true;
}
if (isLiteralPropertyName()) {
@@ -14041,22 +13528,22 @@ var ts;
nextToken();
}
if (idToken) {
- return token() === 17 ||
- token() === 25 ||
- token() === 53 ||
+ return token() === 18 ||
+ token() === 26 ||
token() === 54 ||
- token() === 24 ||
+ token() === 55 ||
+ token() === 25 ||
canParseSemicolon();
}
return false;
}
function parseTypeMember() {
- if (token() === 17 || token() === 25) {
- return parseSignatureMember(151);
- }
- if (token() === 92 && lookAhead(isStartOfConstructSignature)) {
+ if (token() === 18 || token() === 26) {
return parseSignatureMember(152);
}
+ if (token() === 93 && lookAhead(isStartOfConstructSignature)) {
+ return parseSignatureMember(153);
+ }
var fullStart = getNodePos();
var modifiers = parseModifiers();
if (isIndexSignature()) {
@@ -14066,18 +13553,18 @@ var ts;
}
function isStartOfConstructSignature() {
nextToken();
- return token() === 17 || token() === 25;
+ return token() === 18 || token() === 26;
}
function parseTypeLiteral() {
- var node = createNode(159);
+ var node = createNode(160);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
function parseObjectTypeMembers() {
var members;
- if (parseExpected(15)) {
+ if (parseExpected(16)) {
members = parseList(4, parseTypeMember);
- parseExpected(16);
+ parseExpected(17);
}
else {
members = createMissingList();
@@ -14085,31 +13572,31 @@ var ts;
return members;
}
function parseTupleType() {
- var node = createNode(161);
- node.elementTypes = parseBracketedList(19, parseType, 19, 20);
+ var node = createNode(162);
+ node.elementTypes = parseBracketedList(19, parseType, 20, 21);
return finishNode(node);
}
function parseParenthesizedType() {
- var node = createNode(164);
- parseExpected(17);
- node.type = parseType();
+ var node = createNode(165);
parseExpected(18);
+ node.type = parseType();
+ parseExpected(19);
return finishNode(node);
}
function parseFunctionOrConstructorType(kind) {
var node = createNode(kind);
- if (kind === 157) {
- parseExpected(92);
+ if (kind === 158) {
+ parseExpected(93);
}
- fillSignature(34, false, false, false, node);
+ fillSignature(35, false, false, false, node);
return finishNode(node);
}
function parseKeywordAndNoDot() {
var node = parseTokenNode();
- return token() === 21 ? undefined : node;
+ return token() === 22 ? undefined : node;
}
function parseLiteralTypeNode() {
- var node = createNode(166);
+ var node = createNode(167);
node.literal = parseSimpleUnaryExpression();
finishNode(node);
return node;
@@ -14119,41 +13606,41 @@ var ts;
}
function parseNonArrayType() {
switch (token()) {
- case 117:
- case 132:
- case 130:
- case 120:
+ case 118:
case 133:
- case 135:
- case 127:
+ case 131:
+ case 121:
+ case 134:
+ case 136:
+ case 128:
var node = tryParse(parseKeywordAndNoDot);
return node || parseTypeReference();
case 9:
case 8:
- case 99:
- case 84:
+ case 100:
+ case 85:
return parseLiteralTypeNode();
- case 36:
+ case 37:
return lookAhead(nextTokenIsNumericLiteral) ? parseLiteralTypeNode() : parseTypeReference();
- case 103:
- case 93:
+ case 104:
+ case 94:
return parseTokenNode();
- case 97: {
+ case 98: {
var thisKeyword = parseThisTypeNode();
- if (token() === 124 && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 125 && !scanner.hasPrecedingLineBreak()) {
return parseThisTypePredicate(thisKeyword);
}
else {
return thisKeyword;
}
}
- case 101:
+ case 102:
return parseTypeQuery();
- case 15:
+ case 16:
return parseTypeLiteral();
- case 19:
+ case 20:
return parseTupleType();
- case 17:
+ case 18:
return parseParenthesizedType();
default:
return parseTypeReference();
@@ -14161,29 +13648,29 @@ var ts;
}
function isStartOfType() {
switch (token()) {
- case 117:
- case 132:
- case 130:
- case 120:
+ case 118:
case 133:
- case 103:
- case 135:
+ case 131:
+ case 121:
+ case 134:
+ case 104:
+ case 136:
+ case 94:
+ case 98:
+ case 102:
+ case 128:
+ case 16:
+ case 20:
+ case 26:
case 93:
- case 97:
- case 101:
- case 127:
- case 15:
- case 19:
- case 25:
- case 92:
case 9:
case 8:
- case 99:
- case 84:
+ case 100:
+ case 85:
return true;
- case 36:
+ case 37:
return lookAhead(nextTokenIsNumericLiteral);
- case 17:
+ case 18:
return lookAhead(isStartOfParenthesizedOrFunctionType);
default:
return isIdentifier();
@@ -14191,13 +13678,13 @@ var ts;
}
function isStartOfParenthesizedOrFunctionType() {
nextToken();
- return token() === 18 || isStartOfParameter() || isStartOfType();
+ return token() === 19 || isStartOfParameter() || isStartOfType();
}
function parseArrayTypeOrHigher() {
var type = parseNonArrayType();
- while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) {
- parseExpected(20);
- var node = createNode(160, type.pos);
+ while (!scanner.hasPrecedingLineBreak() && parseOptional(20)) {
+ parseExpected(21);
+ var node = createNode(161, type.pos);
node.elementType = type;
type = finishNode(node);
}
@@ -14218,26 +13705,26 @@ var ts;
return type;
}
function parseIntersectionTypeOrHigher() {
- return parseUnionOrIntersectionType(163, parseArrayTypeOrHigher, 46);
+ return parseUnionOrIntersectionType(164, parseArrayTypeOrHigher, 47);
}
function parseUnionTypeOrHigher() {
- return parseUnionOrIntersectionType(162, parseIntersectionTypeOrHigher, 47);
+ return parseUnionOrIntersectionType(163, parseIntersectionTypeOrHigher, 48);
}
function isStartOfFunctionType() {
- if (token() === 25) {
+ if (token() === 26) {
return true;
}
- return token() === 17 && lookAhead(isUnambiguouslyStartOfFunctionType);
+ return token() === 18 && lookAhead(isUnambiguouslyStartOfFunctionType);
}
function skipParameterStart() {
if (ts.isModifierKind(token())) {
parseModifiers();
}
- if (isIdentifier() || token() === 97) {
+ if (isIdentifier() || token() === 98) {
nextToken();
return true;
}
- if (token() === 19 || token() === 15) {
+ if (token() === 20 || token() === 16) {
var previousErrorCount = parseDiagnostics.length;
parseIdentifierOrPattern();
return previousErrorCount === parseDiagnostics.length;
@@ -14246,17 +13733,17 @@ var ts;
}
function isUnambiguouslyStartOfFunctionType() {
nextToken();
- if (token() === 18 || token() === 22) {
+ if (token() === 19 || token() === 23) {
return true;
}
if (skipParameterStart()) {
- if (token() === 54 || token() === 24 ||
- token() === 53 || token() === 56) {
+ if (token() === 55 || token() === 25 ||
+ token() === 54 || token() === 57) {
return true;
}
- if (token() === 18) {
+ if (token() === 19) {
nextToken();
- if (token() === 34) {
+ if (token() === 35) {
return true;
}
}
@@ -14267,7 +13754,7 @@ var ts;
var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
var type = parseType();
if (typePredicateVariable) {
- var node = createNode(154, typePredicateVariable.pos);
+ var node = createNode(155, typePredicateVariable.pos);
node.parameterName = typePredicateVariable;
node.type = type;
return finishNode(node);
@@ -14278,7 +13765,7 @@ var ts;
}
function parseTypePredicatePrefix() {
var id = parseIdentifier();
- if (token() === 124 && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 125 && !scanner.hasPrecedingLineBreak()) {
nextToken();
return id;
}
@@ -14288,36 +13775,36 @@ var ts;
}
function parseTypeWorker() {
if (isStartOfFunctionType()) {
- return parseFunctionOrConstructorType(156);
- }
- if (token() === 92) {
return parseFunctionOrConstructorType(157);
}
+ if (token() === 93) {
+ return parseFunctionOrConstructorType(158);
+ }
return parseUnionTypeOrHigher();
}
function parseTypeAnnotation() {
- return parseOptional(54) ? parseType() : undefined;
+ return parseOptional(55) ? parseType() : undefined;
}
function isStartOfLeftHandSideExpression() {
switch (token()) {
- case 97:
- case 95:
- case 93:
- case 99:
- case 84:
+ case 98:
+ case 96:
+ case 94:
+ case 100:
+ case 85:
case 8:
case 9:
- case 11:
case 12:
- case 17:
- case 19:
- case 15:
- case 87:
- case 73:
- case 92:
- case 39:
- case 61:
- case 69:
+ case 13:
+ case 18:
+ case 20:
+ case 16:
+ case 88:
+ case 74:
+ case 93:
+ case 40:
+ case 62:
+ case 70:
return true;
default:
return isIdentifier();
@@ -14328,18 +13815,18 @@ var ts;
return true;
}
switch (token()) {
- case 35:
case 36:
+ case 37:
+ case 51:
case 50:
- case 49:
- case 78:
- case 101:
- case 103:
- case 41:
+ case 79:
+ case 102:
+ case 104:
case 42:
- case 25:
- case 119:
- case 114:
+ case 43:
+ case 26:
+ case 120:
+ case 115:
return true;
default:
if (isBinaryOperator()) {
@@ -14349,10 +13836,10 @@ var ts;
}
}
function isStartOfExpressionStatement() {
- return token() !== 15 &&
- token() !== 87 &&
- token() !== 73 &&
- token() !== 55 &&
+ return token() !== 16 &&
+ token() !== 88 &&
+ token() !== 74 &&
+ token() !== 56 &&
isStartOfExpression();
}
function parseExpression() {
@@ -14362,7 +13849,7 @@ var ts;
}
var expr = parseAssignmentExpressionOrHigher();
var operatorToken;
- while ((operatorToken = parseOptionalToken(24))) {
+ while ((operatorToken = parseOptionalToken(25))) {
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher());
}
if (saveDecoratorContext) {
@@ -14371,12 +13858,12 @@ var ts;
return expr;
}
function parseInitializer(inParameter) {
- if (token() !== 56) {
- if (scanner.hasPrecedingLineBreak() || (inParameter && token() === 15) || !isStartOfExpression()) {
+ if (token() !== 57) {
+ if (scanner.hasPrecedingLineBreak() || (inParameter && token() === 16) || !isStartOfExpression()) {
return undefined;
}
}
- parseExpected(56);
+ parseExpected(57);
return parseAssignmentExpressionOrHigher();
}
function parseAssignmentExpressionOrHigher() {
@@ -14388,7 +13875,7 @@ var ts;
return arrowExpression;
}
var expr = parseBinaryExpressionOrHigher(0);
- if (expr.kind === 69 && token() === 34) {
+ if (expr.kind === 70 && token() === 35) {
return parseSimpleArrowFunctionExpression(expr);
}
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
@@ -14397,7 +13884,7 @@ var ts;
return parseConditionalExpressionRest(expr);
}
function isYieldExpression() {
- if (token() === 114) {
+ if (token() === 115) {
if (inYieldContext()) {
return true;
}
@@ -14410,11 +13897,11 @@ var ts;
return !scanner.hasPrecedingLineBreak() && isIdentifier();
}
function parseYieldExpression() {
- var node = createNode(190);
+ var node = createNode(191);
nextToken();
if (!scanner.hasPrecedingLineBreak() &&
- (token() === 37 || isStartOfExpression())) {
- node.asteriskToken = parseOptionalToken(37);
+ (token() === 38 || isStartOfExpression())) {
+ node.asteriskToken = parseOptionalToken(38);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
@@ -14423,21 +13910,21 @@ var ts;
}
}
function parseSimpleArrowFunctionExpression(identifier, asyncModifier) {
- ts.Debug.assert(token() === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
+ ts.Debug.assert(token() === 35, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
var node;
if (asyncModifier) {
- node = createNode(180, asyncModifier.pos);
+ node = createNode(181, asyncModifier.pos);
node.modifiers = asyncModifier;
}
else {
- node = createNode(180, identifier.pos);
+ node = createNode(181, identifier.pos);
}
- var parameter = createNode(142, identifier.pos);
+ var parameter = createNode(143, identifier.pos);
parameter.name = identifier;
finishNode(parameter);
node.parameters = createNodeArray([parameter], parameter.pos);
node.parameters.end = parameter.end;
- node.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>");
+ node.equalsGreaterThanToken = parseExpectedToken(35, false, ts.Diagnostics._0_expected, "=>");
node.body = parseArrowFunctionExpressionBody(!!asyncModifier);
return addJSDocComment(finishNode(node));
}
@@ -14454,78 +13941,78 @@ var ts;
}
var isAsync = !!(ts.getModifierFlags(arrowFunction) & 256);
var lastToken = token();
- arrowFunction.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>");
- arrowFunction.body = (lastToken === 34 || lastToken === 15)
+ arrowFunction.equalsGreaterThanToken = parseExpectedToken(35, false, ts.Diagnostics._0_expected, "=>");
+ arrowFunction.body = (lastToken === 35 || lastToken === 16)
? parseArrowFunctionExpressionBody(isAsync)
: parseIdentifier();
return addJSDocComment(finishNode(arrowFunction));
}
function isParenthesizedArrowFunctionExpression() {
- if (token() === 17 || token() === 25 || token() === 118) {
+ if (token() === 18 || token() === 26 || token() === 119) {
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
- if (token() === 34) {
+ if (token() === 35) {
return 1;
}
return 0;
}
function isParenthesizedArrowFunctionExpressionWorker() {
- if (token() === 118) {
+ if (token() === 119) {
nextToken();
if (scanner.hasPrecedingLineBreak()) {
return 0;
}
- if (token() !== 17 && token() !== 25) {
+ if (token() !== 18 && token() !== 26) {
return 0;
}
}
var first = token();
var second = nextToken();
- if (first === 17) {
- if (second === 18) {
+ if (first === 18) {
+ if (second === 19) {
var third = nextToken();
switch (third) {
- case 34:
- case 54:
- case 15:
+ case 35:
+ case 55:
+ case 16:
return 1;
default:
return 0;
}
}
- if (second === 19 || second === 15) {
+ if (second === 20 || second === 16) {
return 2;
}
- if (second === 22) {
+ if (second === 23) {
return 1;
}
if (!isIdentifier()) {
return 0;
}
- if (nextToken() === 54) {
+ if (nextToken() === 55) {
return 1;
}
return 2;
}
else {
- ts.Debug.assert(first === 25);
+ ts.Debug.assert(first === 26);
if (!isIdentifier()) {
return 0;
}
if (sourceFile.languageVariant === 1) {
var isArrowFunctionInJsx = lookAhead(function () {
var third = nextToken();
- if (third === 83) {
+ if (third === 84) {
var fourth = nextToken();
switch (fourth) {
- case 56:
- case 27:
+ case 57:
+ case 28:
return false;
default:
return true;
}
}
- else if (third === 24) {
+ else if (third === 25) {
return true;
}
return false;
@@ -14542,7 +14029,7 @@ var ts;
return parseParenthesizedArrowFunctionExpressionHead(false);
}
function tryParseAsyncSimpleArrowFunctionExpression() {
- if (token() === 118) {
+ if (token() === 119) {
var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker);
if (isUnParenthesizedAsyncArrowFunction === 1) {
var asyncModifier = parseModifiersForArrowFunction();
@@ -14553,38 +14040,38 @@ var ts;
return undefined;
}
function isUnParenthesizedAsyncArrowFunctionWorker() {
- if (token() === 118) {
+ if (token() === 119) {
nextToken();
- if (scanner.hasPrecedingLineBreak() || token() === 34) {
+ if (scanner.hasPrecedingLineBreak() || token() === 35) {
return 0;
}
var expr = parseBinaryExpressionOrHigher(0);
- if (!scanner.hasPrecedingLineBreak() && expr.kind === 69 && token() === 34) {
+ if (!scanner.hasPrecedingLineBreak() && expr.kind === 70 && token() === 35) {
return 1;
}
}
return 0;
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {
- var node = createNode(180);
+ var node = createNode(181);
node.modifiers = parseModifiersForArrowFunction();
var isAsync = !!(ts.getModifierFlags(node) & 256);
- fillSignature(54, false, isAsync, !allowAmbiguity, node);
+ fillSignature(55, false, isAsync, !allowAmbiguity, node);
if (!node.parameters) {
return undefined;
}
- if (!allowAmbiguity && token() !== 34 && token() !== 15) {
+ if (!allowAmbiguity && token() !== 35 && token() !== 16) {
return undefined;
}
return node;
}
function parseArrowFunctionExpressionBody(isAsync) {
- if (token() === 15) {
+ if (token() === 16) {
return parseFunctionBlock(false, isAsync, false);
}
- if (token() !== 23 &&
- token() !== 87 &&
- token() !== 73 &&
+ if (token() !== 24 &&
+ token() !== 88 &&
+ token() !== 74 &&
isStartOfStatement() &&
!isStartOfExpressionStatement()) {
return parseFunctionBlock(false, isAsync, true);
@@ -14594,15 +14081,15 @@ var ts;
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
}
function parseConditionalExpressionRest(leftOperand) {
- var questionToken = parseOptionalToken(53);
+ var questionToken = parseOptionalToken(54);
if (!questionToken) {
return leftOperand;
}
- var node = createNode(188, leftOperand.pos);
+ var node = createNode(189, leftOperand.pos);
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
- node.colonToken = parseExpectedToken(54, false, ts.Diagnostics._0_expected, ts.tokenToString(54));
+ node.colonToken = parseExpectedToken(55, false, ts.Diagnostics._0_expected, ts.tokenToString(55));
node.whenFalse = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
@@ -14611,22 +14098,22 @@ var ts;
return parseBinaryExpressionRest(precedence, leftOperand);
}
function isInOrOfKeyword(t) {
- return t === 90 || t === 138;
+ return t === 91 || t === 139;
}
function parseBinaryExpressionRest(precedence, leftOperand) {
while (true) {
reScanGreaterToken();
var newPrecedence = getBinaryOperatorPrecedence();
- var consumeCurrentOperator = token() === 38 ?
+ var consumeCurrentOperator = token() === 39 ?
newPrecedence >= precedence :
newPrecedence > precedence;
if (!consumeCurrentOperator) {
break;
}
- if (token() === 90 && inDisallowInContext()) {
+ if (token() === 91 && inDisallowInContext()) {
break;
}
- if (token() === 116) {
+ if (token() === 117) {
if (scanner.hasPrecedingLineBreak()) {
break;
}
@@ -14642,92 +14129,92 @@ var ts;
return leftOperand;
}
function isBinaryOperator() {
- if (inDisallowInContext() && token() === 90) {
+ if (inDisallowInContext() && token() === 91) {
return false;
}
return getBinaryOperatorPrecedence() > 0;
}
function getBinaryOperatorPrecedence() {
switch (token()) {
- case 52:
+ case 53:
return 1;
- case 51:
+ case 52:
return 2;
- case 47:
- return 3;
case 48:
+ return 3;
+ case 49:
return 4;
- case 46:
+ case 47:
return 5;
- case 30:
case 31:
case 32:
case 33:
+ case 34:
return 6;
- case 25:
- case 27:
+ case 26:
case 28:
case 29:
+ case 30:
+ case 92:
case 91:
- case 90:
- case 116:
+ case 117:
return 7;
- case 43:
case 44:
case 45:
+ case 46:
return 8;
- case 35:
case 36:
- return 9;
case 37:
- case 39:
+ return 9;
+ case 38:
case 40:
+ case 41:
return 10;
- case 38:
+ case 39:
return 11;
}
return -1;
}
function makeBinaryExpression(left, operatorToken, right) {
- var node = createNode(187, left.pos);
+ var node = createNode(188, left.pos);
node.left = left;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
function makeAsExpression(left, right) {
- var node = createNode(195, left.pos);
+ var node = createNode(196, left.pos);
node.expression = left;
node.type = right;
return finishNode(node);
}
function parsePrefixUnaryExpression() {
- var node = createNode(185);
+ var node = createNode(186);
node.operator = token();
nextToken();
node.operand = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseDeleteExpression() {
- var node = createNode(181);
+ var node = createNode(182);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseTypeOfExpression() {
- var node = createNode(182);
+ var node = createNode(183);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseVoidExpression() {
- var node = createNode(183);
+ var node = createNode(184);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function isAwaitExpression() {
- if (token() === 119) {
+ if (token() === 120) {
if (inAwaitContext()) {
return true;
}
@@ -14736,7 +14223,7 @@ var ts;
return false;
}
function parseAwaitExpression() {
- var node = createNode(184);
+ var node = createNode(185);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
@@ -14744,15 +14231,15 @@ var ts;
function parseUnaryExpressionOrHigher() {
if (isUpdateExpression()) {
var incrementExpression = parseIncrementExpression();
- return token() === 38 ?
+ return token() === 39 ?
parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) :
incrementExpression;
}
var unaryOperator = token();
var simpleUnaryExpression = parseSimpleUnaryExpression();
- if (token() === 38) {
+ if (token() === 39) {
var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);
- if (simpleUnaryExpression.kind === 177) {
+ if (simpleUnaryExpression.kind === 178) {
parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
}
else {
@@ -14763,20 +14250,20 @@ var ts;
}
function parseSimpleUnaryExpression() {
switch (token()) {
- case 35:
case 36:
+ case 37:
+ case 51:
case 50:
- case 49:
return parsePrefixUnaryExpression();
- case 78:
+ case 79:
return parseDeleteExpression();
- case 101:
+ case 102:
return parseTypeOfExpression();
- case 103:
+ case 104:
return parseVoidExpression();
- case 25:
+ case 26:
return parseTypeAssertion();
- case 119:
+ case 120:
if (isAwaitExpression()) {
return parseAwaitExpression();
}
@@ -14786,16 +14273,16 @@ var ts;
}
function isUpdateExpression() {
switch (token()) {
- case 35:
case 36:
+ case 37:
+ case 51:
case 50:
- case 49:
- case 78:
- case 101:
- case 103:
- case 119:
+ case 79:
+ case 102:
+ case 104:
+ case 120:
return false;
- case 25:
+ case 26:
if (sourceFile.languageVariant !== 1) {
return false;
}
@@ -14804,20 +14291,20 @@ var ts;
}
}
function parseIncrementExpression() {
- if (token() === 41 || token() === 42) {
- var node = createNode(185);
+ if (token() === 42 || token() === 43) {
+ var node = createNode(186);
node.operator = token();
nextToken();
node.operand = parseLeftHandSideExpressionOrHigher();
return finishNode(node);
}
- else if (sourceFile.languageVariant === 1 && token() === 25 && lookAhead(nextTokenIsIdentifierOrKeyword)) {
+ else if (sourceFile.languageVariant === 1 && token() === 26 && lookAhead(nextTokenIsIdentifierOrKeyword)) {
return parseJsxElementOrSelfClosingElement(true);
}
var expression = parseLeftHandSideExpressionOrHigher();
ts.Debug.assert(ts.isLeftHandSideExpression(expression));
- if ((token() === 41 || token() === 42) && !scanner.hasPrecedingLineBreak()) {
- var node = createNode(186, expression.pos);
+ if ((token() === 42 || token() === 43) && !scanner.hasPrecedingLineBreak()) {
+ var node = createNode(187, expression.pos);
node.operand = expression;
node.operator = token();
nextToken();
@@ -14826,7 +14313,7 @@ var ts;
return expression;
}
function parseLeftHandSideExpressionOrHigher() {
- var expression = token() === 95
+ var expression = token() === 96
? parseSuperExpression()
: parseMemberExpressionOrHigher();
return parseCallExpressionRest(expression);
@@ -14837,12 +14324,12 @@ var ts;
}
function parseSuperExpression() {
var expression = parseTokenNode();
- if (token() === 17 || token() === 21 || token() === 19) {
+ if (token() === 18 || token() === 22 || token() === 20) {
return expression;
}
- var node = createNode(172, expression.pos);
+ var node = createNode(173, expression.pos);
node.expression = expression;
- parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
+ parseExpectedToken(22, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(true);
return finishNode(node);
}
@@ -14850,10 +14337,10 @@ var ts;
if (lhs.kind !== rhs.kind) {
return false;
}
- if (lhs.kind === 69) {
+ if (lhs.kind === 70) {
return lhs.text === rhs.text;
}
- if (lhs.kind === 97) {
+ if (lhs.kind === 98) {
return true;
}
return lhs.name.text === rhs.name.text &&
@@ -14862,8 +14349,8 @@ var ts;
function parseJsxElementOrSelfClosingElement(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext);
var result;
- if (opening.kind === 243) {
- var node = createNode(241, opening.pos);
+ if (opening.kind === 244) {
+ var node = createNode(242, opening.pos);
node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement.tagName);
node.closingElement = parseJsxClosingElement(inExpressionContext);
@@ -14873,18 +14360,18 @@ var ts;
result = finishNode(node);
}
else {
- ts.Debug.assert(opening.kind === 242);
+ ts.Debug.assert(opening.kind === 243);
result = opening;
}
- if (inExpressionContext && token() === 25) {
+ if (inExpressionContext && token() === 26) {
var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
- var badNode = createNode(187, result.pos);
+ var badNode = createNode(188, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
- badNode.operatorToken = createMissingNode(24, false, undefined);
+ badNode.operatorToken = createMissingNode(25, false, undefined);
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
return badNode;
}
@@ -14892,17 +14379,17 @@ var ts;
return result;
}
function parseJsxText() {
- var node = createNode(244, scanner.getStartPos());
+ var node = createNode(10, scanner.getStartPos());
currentToken = scanner.scanJsxToken();
return finishNode(node);
}
function parseJsxChild() {
switch (token()) {
- case 244:
+ case 10:
return parseJsxText();
- case 15:
+ case 16:
return parseJsxExpression(false);
- case 25:
+ case 26:
return parseJsxElementOrSelfClosingElement(false);
}
ts.Debug.fail("Unknown JSX child kind " + token());
@@ -14913,7 +14400,7 @@ var ts;
parsingContext |= 1 << 14;
while (true) {
currentToken = scanner.reScanJsxToken();
- if (token() === 26) {
+ if (token() === 27) {
break;
}
else if (token() === 1) {
@@ -14928,24 +14415,24 @@ var ts;
}
function parseJsxOpeningOrSelfClosingElement(inExpressionContext) {
var fullStart = scanner.getStartPos();
- parseExpected(25);
+ parseExpected(26);
var tagName = parseJsxElementName();
var attributes = parseList(13, parseJsxAttribute);
var node;
- if (token() === 27) {
- node = createNode(243, fullStart);
+ if (token() === 28) {
+ node = createNode(244, fullStart);
scanJsxText();
}
else {
- parseExpected(39);
+ parseExpected(40);
if (inExpressionContext) {
- parseExpected(27);
+ parseExpected(28);
}
else {
- parseExpected(27, undefined, false);
+ parseExpected(28, undefined, false);
scanJsxText();
}
- node = createNode(242, fullStart);
+ node = createNode(243, fullStart);
}
node.tagName = tagName;
node.attributes = attributes;
@@ -14953,10 +14440,10 @@ var ts;
}
function parseJsxElementName() {
scanJsxIdentifier();
- var expression = token() === 97 ?
+ var expression = token() === 98 ?
parseTokenNode() : parseIdentifierName();
- while (parseOptional(21)) {
- var propertyAccess = createNode(172, expression.pos);
+ while (parseOptional(22)) {
+ var propertyAccess = createNode(173, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(true);
expression = finishNode(propertyAccess);
@@ -14965,27 +14452,27 @@ var ts;
}
function parseJsxExpression(inExpressionContext) {
var node = createNode(248);
- parseExpected(15);
- if (token() !== 16) {
+ parseExpected(16);
+ if (token() !== 17) {
node.expression = parseAssignmentExpressionOrHigher();
}
if (inExpressionContext) {
- parseExpected(16);
+ parseExpected(17);
}
else {
- parseExpected(16, undefined, false);
+ parseExpected(17, undefined, false);
scanJsxText();
}
return finishNode(node);
}
function parseJsxAttribute() {
- if (token() === 15) {
+ if (token() === 16) {
return parseJsxSpreadAttribute();
}
scanJsxIdentifier();
var node = createNode(246);
node.name = parseIdentifierName();
- if (token() === 56) {
+ if (token() === 57) {
switch (scanJsxAttributeValue()) {
case 9:
node.initializer = parseLiteralNode();
@@ -14999,68 +14486,68 @@ var ts;
}
function parseJsxSpreadAttribute() {
var node = createNode(247);
- parseExpected(15);
- parseExpected(22);
- node.expression = parseExpression();
parseExpected(16);
+ parseExpected(23);
+ node.expression = parseExpression();
+ parseExpected(17);
return finishNode(node);
}
function parseJsxClosingElement(inExpressionContext) {
var node = createNode(245);
- parseExpected(26);
+ parseExpected(27);
node.tagName = parseJsxElementName();
if (inExpressionContext) {
- parseExpected(27);
+ parseExpected(28);
}
else {
- parseExpected(27, undefined, false);
+ parseExpected(28, undefined, false);
scanJsxText();
}
return finishNode(node);
}
function parseTypeAssertion() {
- var node = createNode(177);
- parseExpected(25);
+ var node = createNode(178);
+ parseExpected(26);
node.type = parseType();
- parseExpected(27);
+ parseExpected(28);
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseMemberExpressionRest(expression) {
while (true) {
- var dotToken = parseOptionalToken(21);
+ var dotToken = parseOptionalToken(22);
if (dotToken) {
- var propertyAccess = createNode(172, expression.pos);
+ var propertyAccess = createNode(173, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(true);
expression = finishNode(propertyAccess);
continue;
}
- if (token() === 49 && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 50 && !scanner.hasPrecedingLineBreak()) {
nextToken();
- var nonNullExpression = createNode(196, expression.pos);
+ var nonNullExpression = createNode(197, expression.pos);
nonNullExpression.expression = expression;
expression = finishNode(nonNullExpression);
continue;
}
- if (!inDecoratorContext() && parseOptional(19)) {
- var indexedAccess = createNode(173, expression.pos);
+ if (!inDecoratorContext() && parseOptional(20)) {
+ var indexedAccess = createNode(174, expression.pos);
indexedAccess.expression = expression;
- if (token() !== 20) {
+ if (token() !== 21) {
indexedAccess.argumentExpression = allowInAnd(parseExpression);
if (indexedAccess.argumentExpression.kind === 9 || indexedAccess.argumentExpression.kind === 8) {
var literal = indexedAccess.argumentExpression;
literal.text = internIdentifier(literal.text);
}
}
- parseExpected(20);
+ parseExpected(21);
expression = finishNode(indexedAccess);
continue;
}
- if (token() === 11 || token() === 12) {
- var tagExpression = createNode(176, expression.pos);
+ if (token() === 12 || token() === 13) {
+ var tagExpression = createNode(177, expression.pos);
tagExpression.tag = expression;
- tagExpression.template = token() === 11
+ tagExpression.template = token() === 12
? parseLiteralNode()
: parseTemplateExpression();
expression = finishNode(tagExpression);
@@ -15072,20 +14559,20 @@ var ts;
function parseCallExpressionRest(expression) {
while (true) {
expression = parseMemberExpressionRest(expression);
- if (token() === 25) {
+ if (token() === 26) {
var typeArguments = tryParse(parseTypeArgumentsInExpression);
if (!typeArguments) {
return expression;
}
- var callExpr = createNode(174, expression.pos);
+ var callExpr = createNode(175, expression.pos);
callExpr.expression = expression;
callExpr.typeArguments = typeArguments;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
continue;
}
- else if (token() === 17) {
- var callExpr = createNode(174, expression.pos);
+ else if (token() === 18) {
+ var callExpr = createNode(175, expression.pos);
callExpr.expression = expression;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
@@ -15095,17 +14582,17 @@ var ts;
}
}
function parseArgumentList() {
- parseExpected(17);
- var result = parseDelimitedList(11, parseArgumentExpression);
parseExpected(18);
+ var result = parseDelimitedList(11, parseArgumentExpression);
+ parseExpected(19);
return result;
}
function parseTypeArgumentsInExpression() {
- if (!parseOptional(25)) {
+ if (!parseOptional(26)) {
return undefined;
}
var typeArguments = parseDelimitedList(18, parseType);
- if (!parseExpected(27)) {
+ if (!parseExpected(28)) {
return undefined;
}
return typeArguments && canFollowTypeArgumentsInExpression()
@@ -15114,27 +14601,27 @@ var ts;
}
function canFollowTypeArgumentsInExpression() {
switch (token()) {
- case 17:
- case 21:
case 18:
- case 20:
+ case 22:
+ case 19:
+ case 21:
+ case 55:
+ case 24:
case 54:
- case 23:
- case 53:
- case 30:
- case 32:
case 31:
case 33:
- case 51:
+ case 32:
+ case 34:
case 52:
- case 48:
- case 46:
+ case 53:
+ case 49:
case 47:
- case 16:
+ case 48:
+ case 17:
case 1:
return true;
- case 24:
- case 15:
+ case 25:
+ case 16:
default:
return false;
}
@@ -15143,80 +14630,80 @@ var ts;
switch (token()) {
case 8:
case 9:
- case 11:
+ case 12:
return parseLiteralNode();
- case 97:
- case 95:
- case 93:
- case 99:
- case 84:
+ case 98:
+ case 96:
+ case 94:
+ case 100:
+ case 85:
return parseTokenNode();
- case 17:
+ case 18:
return parseParenthesizedExpression();
- case 19:
+ case 20:
return parseArrayLiteralExpression();
- case 15:
+ case 16:
return parseObjectLiteralExpression();
- case 118:
+ case 119:
if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) {
break;
}
return parseFunctionExpression();
- case 73:
+ case 74:
return parseClassExpression();
- case 87:
+ case 88:
return parseFunctionExpression();
- case 92:
+ case 93:
return parseNewExpression();
- case 39:
- case 61:
- if (reScanSlashToken() === 10) {
+ case 40:
+ case 62:
+ if (reScanSlashToken() === 11) {
return parseLiteralNode();
}
break;
- case 12:
+ case 13:
return parseTemplateExpression();
}
return parseIdentifier(ts.Diagnostics.Expression_expected);
}
function parseParenthesizedExpression() {
- var node = createNode(178);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(179);
parseExpected(18);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
return finishNode(node);
}
function parseSpreadElement() {
- var node = createNode(191);
- parseExpected(22);
+ var node = createNode(192);
+ parseExpected(23);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
function parseArgumentOrArrayLiteralElement() {
- return token() === 22 ? parseSpreadElement() :
- token() === 24 ? createNode(193) :
+ return token() === 23 ? parseSpreadElement() :
+ token() === 25 ? createNode(194) :
parseAssignmentExpressionOrHigher();
}
function parseArgumentExpression() {
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
}
function parseArrayLiteralExpression() {
- var node = createNode(170);
- parseExpected(19);
+ var node = createNode(171);
+ parseExpected(20);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
}
node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement);
- parseExpected(20);
+ parseExpected(21);
return finishNode(node);
}
function tryParseAccessorDeclaration(fullStart, decorators, modifiers) {
- if (parseContextualModifier(123)) {
- return parseAccessorDeclaration(149, fullStart, decorators, modifiers);
- }
- else if (parseContextualModifier(131)) {
+ if (parseContextualModifier(124)) {
return parseAccessorDeclaration(150, fullStart, decorators, modifiers);
}
+ else if (parseContextualModifier(132)) {
+ return parseAccessorDeclaration(151, fullStart, decorators, modifiers);
+ }
return undefined;
}
function parseObjectLiteralElement() {
@@ -15227,19 +14714,19 @@ var ts;
if (accessor) {
return accessor;
}
- var asteriskToken = parseOptionalToken(37);
+ var asteriskToken = parseOptionalToken(38);
var tokenIsIdentifier = isIdentifier();
var propertyName = parsePropertyName();
- var questionToken = parseOptionalToken(53);
- if (asteriskToken || token() === 17 || token() === 25) {
+ var questionToken = parseOptionalToken(54);
+ if (asteriskToken || token() === 18 || token() === 26) {
return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken);
}
- var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 24 || token() === 16 || token() === 56);
+ var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57);
if (isShorthandPropertyAssignment) {
var shorthandDeclaration = createNode(254, fullStart);
shorthandDeclaration.name = propertyName;
shorthandDeclaration.questionToken = questionToken;
- var equalsToken = parseOptionalToken(56);
+ var equalsToken = parseOptionalToken(57);
if (equalsToken) {
shorthandDeclaration.equalsToken = equalsToken;
shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
@@ -15251,19 +14738,19 @@ var ts;
propertyAssignment.modifiers = modifiers;
propertyAssignment.name = propertyName;
propertyAssignment.questionToken = questionToken;
- parseExpected(54);
+ parseExpected(55);
propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
return addJSDocComment(finishNode(propertyAssignment));
}
}
function parseObjectLiteralExpression() {
- var node = createNode(171);
- parseExpected(15);
+ var node = createNode(172);
+ parseExpected(16);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
}
node.properties = parseDelimitedList(12, parseObjectLiteralElement, true);
- parseExpected(16);
+ parseExpected(17);
return finishNode(node);
}
function parseFunctionExpression() {
@@ -15271,10 +14758,10 @@ var ts;
if (saveDecoratorContext) {
setDecoratorContext(false);
}
- var node = createNode(179);
+ var node = createNode(180);
node.modifiers = parseModifiers();
- parseExpected(87);
- node.asteriskToken = parseOptionalToken(37);
+ parseExpected(88);
+ node.asteriskToken = parseOptionalToken(38);
var isGenerator = !!node.asteriskToken;
var isAsync = !!(ts.getModifierFlags(node) & 256);
node.name =
@@ -15282,7 +14769,7 @@ var ts;
isGenerator ? doInYieldContext(parseOptionalIdentifier) :
isAsync ? doInAwaitContext(parseOptionalIdentifier) :
parseOptionalIdentifier();
- fillSignature(54, isGenerator, isAsync, false, node);
+ fillSignature(55, isGenerator, isAsync, false, node);
node.body = parseFunctionBlock(isGenerator, isAsync, false);
if (saveDecoratorContext) {
setDecoratorContext(true);
@@ -15293,23 +14780,23 @@ var ts;
return isIdentifier() ? parseIdentifier() : undefined;
}
function parseNewExpression() {
- var node = createNode(175);
- parseExpected(92);
+ var node = createNode(176);
+ parseExpected(93);
node.expression = parseMemberExpressionOrHigher();
node.typeArguments = tryParse(parseTypeArgumentsInExpression);
- if (node.typeArguments || token() === 17) {
+ if (node.typeArguments || token() === 18) {
node.arguments = parseArgumentList();
}
return finishNode(node);
}
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
- var node = createNode(199);
- if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) {
+ var node = createNode(200);
+ if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) {
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
}
node.statements = parseList(1, parseStatement);
- parseExpected(16);
+ parseExpected(17);
}
else {
node.statements = createMissingList();
@@ -15334,47 +14821,47 @@ var ts;
return block;
}
function parseEmptyStatement() {
- var node = createNode(201);
- parseExpected(23);
+ var node = createNode(202);
+ parseExpected(24);
return finishNode(node);
}
function parseIfStatement() {
- var node = createNode(203);
- parseExpected(88);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(204);
+ parseExpected(89);
parseExpected(18);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
node.thenStatement = parseStatement();
- node.elseStatement = parseOptional(80) ? parseStatement() : undefined;
+ node.elseStatement = parseOptional(81) ? parseStatement() : undefined;
return finishNode(node);
}
function parseDoStatement() {
- var node = createNode(204);
- parseExpected(79);
+ var node = createNode(205);
+ parseExpected(80);
node.statement = parseStatement();
- parseExpected(104);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ parseExpected(105);
parseExpected(18);
- parseOptional(23);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
+ parseOptional(24);
return finishNode(node);
}
function parseWhileStatement() {
- var node = createNode(205);
- parseExpected(104);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(206);
+ parseExpected(105);
parseExpected(18);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
node.statement = parseStatement();
return finishNode(node);
}
function parseForOrForInOrForOfStatement() {
var pos = getNodePos();
- parseExpected(86);
- parseExpected(17);
+ parseExpected(87);
+ parseExpected(18);
var initializer = undefined;
- if (token() !== 23) {
- if (token() === 102 || token() === 108 || token() === 74) {
+ if (token() !== 24) {
+ if (token() === 103 || token() === 109 || token() === 75) {
initializer = parseVariableDeclarationList(true);
}
else {
@@ -15382,32 +14869,32 @@ var ts;
}
}
var forOrForInOrForOfStatement;
- if (parseOptional(90)) {
- var forInStatement = createNode(207, pos);
+ if (parseOptional(91)) {
+ var forInStatement = createNode(208, pos);
forInStatement.initializer = initializer;
forInStatement.expression = allowInAnd(parseExpression);
- parseExpected(18);
+ parseExpected(19);
forOrForInOrForOfStatement = forInStatement;
}
- else if (parseOptional(138)) {
- var forOfStatement = createNode(208, pos);
+ else if (parseOptional(139)) {
+ var forOfStatement = createNode(209, pos);
forOfStatement.initializer = initializer;
forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);
- parseExpected(18);
+ parseExpected(19);
forOrForInOrForOfStatement = forOfStatement;
}
else {
- var forStatement = createNode(206, pos);
+ var forStatement = createNode(207, pos);
forStatement.initializer = initializer;
- parseExpected(23);
- if (token() !== 23 && token() !== 18) {
+ parseExpected(24);
+ if (token() !== 24 && token() !== 19) {
forStatement.condition = allowInAnd(parseExpression);
}
- parseExpected(23);
- if (token() !== 18) {
+ parseExpected(24);
+ if (token() !== 19) {
forStatement.incrementor = allowInAnd(parseExpression);
}
- parseExpected(18);
+ parseExpected(19);
forOrForInOrForOfStatement = forStatement;
}
forOrForInOrForOfStatement.statement = parseStatement();
@@ -15415,7 +14902,7 @@ var ts;
}
function parseBreakOrContinueStatement(kind) {
var node = createNode(kind);
- parseExpected(kind === 210 ? 70 : 75);
+ parseExpected(kind === 211 ? 71 : 76);
if (!canParseSemicolon()) {
node.label = parseIdentifier();
}
@@ -15423,8 +14910,8 @@ var ts;
return finishNode(node);
}
function parseReturnStatement() {
- var node = createNode(211);
- parseExpected(94);
+ var node = createNode(212);
+ parseExpected(95);
if (!canParseSemicolon()) {
node.expression = allowInAnd(parseExpression);
}
@@ -15432,90 +14919,90 @@ var ts;
return finishNode(node);
}
function parseWithStatement() {
- var node = createNode(212);
- parseExpected(105);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(213);
+ parseExpected(106);
parseExpected(18);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
node.statement = parseStatement();
return finishNode(node);
}
function parseCaseClause() {
var node = createNode(249);
- parseExpected(71);
+ parseExpected(72);
node.expression = allowInAnd(parseExpression);
- parseExpected(54);
+ parseExpected(55);
node.statements = parseList(3, parseStatement);
return finishNode(node);
}
function parseDefaultClause() {
var node = createNode(250);
- parseExpected(77);
- parseExpected(54);
+ parseExpected(78);
+ parseExpected(55);
node.statements = parseList(3, parseStatement);
return finishNode(node);
}
function parseCaseOrDefaultClause() {
- return token() === 71 ? parseCaseClause() : parseDefaultClause();
+ return token() === 72 ? parseCaseClause() : parseDefaultClause();
}
function parseSwitchStatement() {
- var node = createNode(213);
- parseExpected(96);
- parseExpected(17);
- node.expression = allowInAnd(parseExpression);
+ var node = createNode(214);
+ parseExpected(97);
parseExpected(18);
- var caseBlock = createNode(227, scanner.getStartPos());
- parseExpected(15);
- caseBlock.clauses = parseList(2, parseCaseOrDefaultClause);
+ node.expression = allowInAnd(parseExpression);
+ parseExpected(19);
+ var caseBlock = createNode(228, scanner.getStartPos());
parseExpected(16);
+ caseBlock.clauses = parseList(2, parseCaseOrDefaultClause);
+ parseExpected(17);
node.caseBlock = finishNode(caseBlock);
return finishNode(node);
}
function parseThrowStatement() {
- var node = createNode(215);
- parseExpected(98);
+ var node = createNode(216);
+ parseExpected(99);
node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);
parseSemicolon();
return finishNode(node);
}
function parseTryStatement() {
- var node = createNode(216);
- parseExpected(100);
+ var node = createNode(217);
+ parseExpected(101);
node.tryBlock = parseBlock(false);
- node.catchClause = token() === 72 ? parseCatchClause() : undefined;
- if (!node.catchClause || token() === 85) {
- parseExpected(85);
+ node.catchClause = token() === 73 ? parseCatchClause() : undefined;
+ if (!node.catchClause || token() === 86) {
+ parseExpected(86);
node.finallyBlock = parseBlock(false);
}
return finishNode(node);
}
function parseCatchClause() {
var result = createNode(252);
- parseExpected(72);
- if (parseExpected(17)) {
+ parseExpected(73);
+ if (parseExpected(18)) {
result.variableDeclaration = parseVariableDeclaration();
}
- parseExpected(18);
+ parseExpected(19);
result.block = parseBlock(false);
return finishNode(result);
}
function parseDebuggerStatement() {
- var node = createNode(217);
- parseExpected(76);
+ var node = createNode(218);
+ parseExpected(77);
parseSemicolon();
return finishNode(node);
}
function parseExpressionOrLabeledStatement() {
var fullStart = scanner.getStartPos();
var expression = allowInAnd(parseExpression);
- if (expression.kind === 69 && parseOptional(54)) {
- var labeledStatement = createNode(214, fullStart);
+ if (expression.kind === 70 && parseOptional(55)) {
+ var labeledStatement = createNode(215, fullStart);
labeledStatement.label = expression;
labeledStatement.statement = parseStatement();
return addJSDocComment(finishNode(labeledStatement));
}
else {
- var expressionStatement = createNode(202, fullStart);
+ var expressionStatement = createNode(203, fullStart);
expressionStatement.expression = expression;
parseSemicolon();
return addJSDocComment(finishNode(expressionStatement));
@@ -15527,7 +15014,7 @@ var ts;
}
function nextTokenIsFunctionKeywordOnSameLine() {
nextToken();
- return token() === 87 && !scanner.hasPrecedingLineBreak();
+ return token() === 88 && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() {
nextToken();
@@ -15536,47 +15023,47 @@ var ts;
function isDeclaration() {
while (true) {
switch (token()) {
- case 102:
- case 108:
+ case 103:
+ case 109:
+ case 75:
+ case 88:
case 74:
- case 87:
- case 73:
- case 81:
+ case 82:
return true;
- case 107:
- case 134:
+ case 108:
+ case 135:
return nextTokenIsIdentifierOnSameLine();
- case 125:
case 126:
+ case 127:
return nextTokenIsIdentifierOrStringLiteralOnSameLine();
- case 115:
- case 118:
- case 122:
- case 110:
+ case 116:
+ case 119:
+ case 123:
case 111:
case 112:
- case 128:
+ case 113:
+ case 129:
nextToken();
if (scanner.hasPrecedingLineBreak()) {
return false;
}
continue;
- case 137:
+ case 138:
nextToken();
- return token() === 15 || token() === 69 || token() === 82;
- case 89:
+ return token() === 16 || token() === 70 || token() === 83;
+ case 90:
nextToken();
- return token() === 9 || token() === 37 ||
- token() === 15 || ts.tokenIsIdentifierOrKeyword(token());
- case 82:
+ return token() === 9 || token() === 38 ||
+ token() === 16 || ts.tokenIsIdentifierOrKeyword(token());
+ case 83:
nextToken();
- if (token() === 56 || token() === 37 ||
- token() === 15 || token() === 77 ||
- token() === 116) {
+ if (token() === 57 || token() === 38 ||
+ token() === 16 || token() === 78 ||
+ token() === 117) {
return true;
}
continue;
- case 113:
+ case 114:
nextToken();
continue;
default:
@@ -15589,46 +15076,46 @@ var ts;
}
function isStartOfStatement() {
switch (token()) {
- case 55:
- case 23:
- case 15:
- case 102:
- case 108:
- case 87:
- case 73:
- case 81:
+ case 56:
+ case 24:
+ case 16:
+ case 103:
+ case 109:
case 88:
- case 79:
- case 104:
- case 86:
- case 75:
- case 70:
- case 94:
- case 105:
- case 96:
- case 98:
- case 100:
- case 76:
- case 72:
- case 85:
- return true;
case 74:
case 82:
case 89:
+ case 80:
+ case 105:
+ case 87:
+ case 76:
+ case 71:
+ case 95:
+ case 106:
+ case 97:
+ case 99:
+ case 101:
+ case 77:
+ case 73:
+ case 86:
+ return true;
+ case 75:
+ case 83:
+ case 90:
return isStartOfDeclaration();
- case 118:
- case 122:
- case 107:
- case 125:
+ case 119:
+ case 123:
+ case 108:
case 126:
- case 134:
- case 137:
+ case 127:
+ case 135:
+ case 138:
return true;
- case 112:
- case 110:
- case 111:
case 113:
- case 128:
+ case 111:
+ case 112:
+ case 114:
+ case 129:
return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
default:
return isStartOfExpression();
@@ -15636,73 +15123,73 @@ var ts;
}
function nextTokenIsIdentifierOrStartOfDestructuring() {
nextToken();
- return isIdentifier() || token() === 15 || token() === 19;
+ return isIdentifier() || token() === 16 || token() === 20;
}
function isLetDeclaration() {
return lookAhead(nextTokenIsIdentifierOrStartOfDestructuring);
}
function parseStatement() {
switch (token()) {
- case 23:
+ case 24:
return parseEmptyStatement();
- case 15:
+ case 16:
return parseBlock(false);
- case 102:
+ case 103:
return parseVariableStatement(scanner.getStartPos(), undefined, undefined);
- case 108:
+ case 109:
if (isLetDeclaration()) {
return parseVariableStatement(scanner.getStartPos(), undefined, undefined);
}
break;
- case 87:
+ case 88:
return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined);
- case 73:
+ case 74:
return parseClassDeclaration(scanner.getStartPos(), undefined, undefined);
- case 88:
+ case 89:
return parseIfStatement();
- case 79:
+ case 80:
return parseDoStatement();
- case 104:
+ case 105:
return parseWhileStatement();
- case 86:
+ case 87:
return parseForOrForInOrForOfStatement();
- case 75:
- return parseBreakOrContinueStatement(209);
- case 70:
+ case 76:
return parseBreakOrContinueStatement(210);
- case 94:
+ case 71:
+ return parseBreakOrContinueStatement(211);
+ case 95:
return parseReturnStatement();
- case 105:
+ case 106:
return parseWithStatement();
- case 96:
+ case 97:
return parseSwitchStatement();
- case 98:
+ case 99:
return parseThrowStatement();
- case 100:
- case 72:
- case 85:
+ case 101:
+ case 73:
+ case 86:
return parseTryStatement();
- case 76:
+ case 77:
return parseDebuggerStatement();
- case 55:
+ case 56:
return parseDeclaration();
- case 118:
- case 107:
- case 134:
- case 125:
+ case 119:
+ case 108:
+ case 135:
case 126:
- case 122:
- case 74:
- case 81:
+ case 127:
+ case 123:
+ case 75:
case 82:
- case 89:
- case 110:
+ case 83:
+ case 90:
case 111:
case 112:
- case 115:
case 113:
- case 128:
- case 137:
+ case 116:
+ case 114:
+ case 129:
+ case 138:
if (isStartOfDeclaration()) {
return parseDeclaration();
}
@@ -15715,40 +15202,40 @@ var ts;
var decorators = parseDecorators();
var modifiers = parseModifiers();
switch (token()) {
- case 102:
- case 108:
- case 74:
+ case 103:
+ case 109:
+ case 75:
return parseVariableStatement(fullStart, decorators, modifiers);
- case 87:
+ case 88:
return parseFunctionDeclaration(fullStart, decorators, modifiers);
- case 73:
+ case 74:
return parseClassDeclaration(fullStart, decorators, modifiers);
- case 107:
+ case 108:
return parseInterfaceDeclaration(fullStart, decorators, modifiers);
- case 134:
+ case 135:
return parseTypeAliasDeclaration(fullStart, decorators, modifiers);
- case 81:
+ case 82:
return parseEnumDeclaration(fullStart, decorators, modifiers);
- case 137:
- case 125:
+ case 138:
case 126:
+ case 127:
return parseModuleDeclaration(fullStart, decorators, modifiers);
- case 89:
+ case 90:
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
- case 82:
+ case 83:
nextToken();
switch (token()) {
- case 77:
- case 56:
+ case 78:
+ case 57:
return parseExportAssignment(fullStart, decorators, modifiers);
- case 116:
+ case 117:
return parseNamespaceExportDeclaration(fullStart, decorators, modifiers);
default:
return parseExportDeclaration(fullStart, decorators, modifiers);
}
default:
if (decorators || modifiers) {
- var node = createMissingNode(239, true, ts.Diagnostics.Declaration_expected);
+ var node = createMissingNode(240, true, ts.Diagnostics.Declaration_expected);
node.pos = fullStart;
node.decorators = decorators;
node.modifiers = modifiers;
@@ -15761,31 +15248,31 @@ var ts;
return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 9);
}
function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) {
- if (token() !== 15 && canParseSemicolon()) {
+ if (token() !== 16 && canParseSemicolon()) {
parseSemicolon();
return;
}
return parseFunctionBlock(isGenerator, isAsync, false, diagnosticMessage);
}
function parseArrayBindingElement() {
- if (token() === 24) {
- return createNode(193);
+ if (token() === 25) {
+ return createNode(194);
}
- var node = createNode(169);
- node.dotDotDotToken = parseOptionalToken(22);
+ var node = createNode(170);
+ node.dotDotDotToken = parseOptionalToken(23);
node.name = parseIdentifierOrPattern();
node.initializer = parseBindingElementInitializer(false);
return finishNode(node);
}
function parseObjectBindingElement() {
- var node = createNode(169);
+ var node = createNode(170);
var tokenIsIdentifier = isIdentifier();
var propertyName = parsePropertyName();
- if (tokenIsIdentifier && token() !== 54) {
+ if (tokenIsIdentifier && token() !== 55) {
node.name = propertyName;
}
else {
- parseExpected(54);
+ parseExpected(55);
node.propertyName = propertyName;
node.name = parseIdentifierOrPattern();
}
@@ -15793,33 +15280,33 @@ var ts;
return finishNode(node);
}
function parseObjectBindingPattern() {
- var node = createNode(167);
- parseExpected(15);
- node.elements = parseDelimitedList(9, parseObjectBindingElement);
+ var node = createNode(168);
parseExpected(16);
+ node.elements = parseDelimitedList(9, parseObjectBindingElement);
+ parseExpected(17);
return finishNode(node);
}
function parseArrayBindingPattern() {
- var node = createNode(168);
- parseExpected(19);
- node.elements = parseDelimitedList(10, parseArrayBindingElement);
+ var node = createNode(169);
parseExpected(20);
+ node.elements = parseDelimitedList(10, parseArrayBindingElement);
+ parseExpected(21);
return finishNode(node);
}
function isIdentifierOrPattern() {
- return token() === 15 || token() === 19 || isIdentifier();
+ return token() === 16 || token() === 20 || isIdentifier();
}
function parseIdentifierOrPattern() {
- if (token() === 19) {
+ if (token() === 20) {
return parseArrayBindingPattern();
}
- if (token() === 15) {
+ if (token() === 16) {
return parseObjectBindingPattern();
}
return parseIdentifier();
}
function parseVariableDeclaration() {
- var node = createNode(218);
+ var node = createNode(219);
node.name = parseIdentifierOrPattern();
node.type = parseTypeAnnotation();
if (!isInOrOfKeyword(token())) {
@@ -15828,21 +15315,21 @@ var ts;
return finishNode(node);
}
function parseVariableDeclarationList(inForStatementInitializer) {
- var node = createNode(219);
+ var node = createNode(220);
switch (token()) {
- case 102:
+ case 103:
break;
- case 108:
+ case 109:
node.flags |= 1;
break;
- case 74:
+ case 75:
node.flags |= 2;
break;
default:
ts.Debug.fail();
}
nextToken();
- if (token() === 138 && lookAhead(canFollowContextualOfKeyword)) {
+ if (token() === 139 && lookAhead(canFollowContextualOfKeyword)) {
node.declarations = createMissingList();
}
else {
@@ -15854,10 +15341,10 @@ var ts;
return finishNode(node);
}
function canFollowContextualOfKeyword() {
- return nextTokenIsIdentifier() && nextToken() === 18;
+ return nextTokenIsIdentifier() && nextToken() === 19;
}
function parseVariableStatement(fullStart, decorators, modifiers) {
- var node = createNode(200, fullStart);
+ var node = createNode(201, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
node.declarationList = parseVariableDeclarationList(false);
@@ -15865,29 +15352,29 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseFunctionDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(220, fullStart);
+ var node = createNode(221, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(87);
- node.asteriskToken = parseOptionalToken(37);
+ parseExpected(88);
+ node.asteriskToken = parseOptionalToken(38);
node.name = ts.hasModifier(node, 512) ? parseOptionalIdentifier() : parseIdentifier();
var isGenerator = !!node.asteriskToken;
var isAsync = ts.hasModifier(node, 256);
- fillSignature(54, isGenerator, isAsync, false, node);
+ fillSignature(55, isGenerator, isAsync, false, node);
node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected);
return addJSDocComment(finishNode(node));
}
function parseConstructorDeclaration(pos, decorators, modifiers) {
- var node = createNode(148, pos);
+ var node = createNode(149, pos);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(121);
- fillSignature(54, false, false, false, node);
+ parseExpected(122);
+ fillSignature(55, false, false, false, node);
node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected);
return addJSDocComment(finishNode(node));
}
function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) {
- var method = createNode(147, fullStart);
+ var method = createNode(148, fullStart);
method.decorators = decorators;
method.modifiers = modifiers;
method.asteriskToken = asteriskToken;
@@ -15895,12 +15382,12 @@ var ts;
method.questionToken = questionToken;
var isGenerator = !!asteriskToken;
var isAsync = ts.hasModifier(method, 256);
- fillSignature(54, isGenerator, isAsync, false, method);
+ fillSignature(55, isGenerator, isAsync, false, method);
method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage);
return addJSDocComment(finishNode(method));
}
function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) {
- var property = createNode(145, fullStart);
+ var property = createNode(146, fullStart);
property.decorators = decorators;
property.modifiers = modifiers;
property.name = name;
@@ -15913,10 +15400,10 @@ var ts;
return addJSDocComment(finishNode(property));
}
function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) {
- var asteriskToken = parseOptionalToken(37);
+ var asteriskToken = parseOptionalToken(38);
var name = parsePropertyName();
- var questionToken = parseOptionalToken(53);
- if (asteriskToken || token() === 17 || token() === 25) {
+ var questionToken = parseOptionalToken(54);
+ if (asteriskToken || token() === 18 || token() === 26) {
return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected);
}
else {
@@ -15931,17 +15418,17 @@ var ts;
node.decorators = decorators;
node.modifiers = modifiers;
node.name = parsePropertyName();
- fillSignature(54, false, false, false, node);
+ fillSignature(55, false, false, false, node);
node.body = parseFunctionBlockOrSemicolon(false, false);
return addJSDocComment(finishNode(node));
}
function isClassMemberModifier(idToken) {
switch (idToken) {
- case 112:
- case 110:
- case 111:
case 113:
- case 128:
+ case 111:
+ case 112:
+ case 114:
+ case 129:
return true;
default:
return false;
@@ -15949,7 +15436,7 @@ var ts;
}
function isClassMemberStart() {
var idToken;
- if (token() === 55) {
+ if (token() === 56) {
return true;
}
while (ts.isModifierKind(token())) {
@@ -15959,26 +15446,26 @@ var ts;
}
nextToken();
}
- if (token() === 37) {
+ if (token() === 38) {
return true;
}
if (isLiteralPropertyName()) {
idToken = token();
nextToken();
}
- if (token() === 19) {
+ if (token() === 20) {
return true;
}
if (idToken !== undefined) {
- if (!ts.isKeyword(idToken) || idToken === 131 || idToken === 123) {
+ if (!ts.isKeyword(idToken) || idToken === 132 || idToken === 124) {
return true;
}
switch (token()) {
- case 17:
- case 25:
+ case 18:
+ case 26:
+ case 55:
+ case 57:
case 54:
- case 56:
- case 53:
return true;
default:
return canParseSemicolon();
@@ -15990,10 +15477,10 @@ var ts;
var decorators;
while (true) {
var decoratorStart = getNodePos();
- if (!parseOptional(55)) {
+ if (!parseOptional(56)) {
break;
}
- var decorator = createNode(143, decoratorStart);
+ var decorator = createNode(144, decoratorStart);
decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);
finishNode(decorator);
if (!decorators) {
@@ -16013,7 +15500,7 @@ var ts;
while (true) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
- if (token() === 74 && permitInvalidConstAsModifier) {
+ if (token() === 75 && permitInvalidConstAsModifier) {
if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {
break;
}
@@ -16038,7 +15525,7 @@ var ts;
}
function parseModifiersForArrowFunction() {
var modifiers;
- if (token() === 118) {
+ if (token() === 119) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
nextToken();
@@ -16049,8 +15536,8 @@ var ts;
return modifiers;
}
function parseClassElement() {
- if (token() === 23) {
- var result = createNode(198);
+ if (token() === 24) {
+ var result = createNode(199);
nextToken();
return finishNode(result);
}
@@ -16061,7 +15548,7 @@ var ts;
if (accessor) {
return accessor;
}
- if (token() === 121) {
+ if (token() === 122) {
return parseConstructorDeclaration(fullStart, decorators, modifiers);
}
if (isIndexSignature()) {
@@ -16070,33 +15557,33 @@ var ts;
if (ts.tokenIsIdentifierOrKeyword(token()) ||
token() === 9 ||
token() === 8 ||
- token() === 37 ||
- token() === 19) {
+ token() === 38 ||
+ token() === 20) {
return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);
}
if (decorators || modifiers) {
- var name_13 = createMissingNode(69, true, ts.Diagnostics.Declaration_expected);
- return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, undefined);
+ var name_10 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected);
+ return parsePropertyDeclaration(fullStart, decorators, modifiers, name_10, undefined);
}
ts.Debug.fail("Should not have attempted to parse class member declaration.");
}
function parseClassExpression() {
- return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 192);
+ return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 193);
}
function parseClassDeclaration(fullStart, decorators, modifiers) {
- return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 221);
+ return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 222);
}
function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) {
var node = createNode(kind, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(73);
+ parseExpected(74);
node.name = parseNameOfClassDeclarationOrExpression();
node.typeParameters = parseTypeParameters();
- node.heritageClauses = parseHeritageClauses(true);
- if (parseExpected(15)) {
+ node.heritageClauses = parseHeritageClauses();
+ if (parseExpected(16)) {
node.members = parseClassMembers();
- parseExpected(16);
+ parseExpected(17);
}
else {
node.members = createMissingList();
@@ -16109,16 +15596,16 @@ var ts;
: undefined;
}
function isImplementsClause() {
- return token() === 106 && lookAhead(nextTokenIsIdentifierOrKeyword);
+ return token() === 107 && lookAhead(nextTokenIsIdentifierOrKeyword);
}
- function parseHeritageClauses(isClassHeritageClause) {
+ function parseHeritageClauses() {
if (isHeritageClause()) {
return parseList(20, parseHeritageClause);
}
return undefined;
}
function parseHeritageClause() {
- if (token() === 83 || token() === 106) {
+ if (token() === 84 || token() === 107) {
var node = createNode(251);
node.token = token();
nextToken();
@@ -16128,38 +15615,38 @@ var ts;
return undefined;
}
function parseExpressionWithTypeArguments() {
- var node = createNode(194);
+ var node = createNode(195);
node.expression = parseLeftHandSideExpressionOrHigher();
- if (token() === 25) {
- node.typeArguments = parseBracketedList(18, parseType, 25, 27);
+ if (token() === 26) {
+ node.typeArguments = parseBracketedList(18, parseType, 26, 28);
}
return finishNode(node);
}
function isHeritageClause() {
- return token() === 83 || token() === 106;
+ return token() === 84 || token() === 107;
}
function parseClassMembers() {
return parseList(5, parseClassElement);
}
function parseInterfaceDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(222, fullStart);
+ var node = createNode(223, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(107);
+ parseExpected(108);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
- node.heritageClauses = parseHeritageClauses(false);
+ node.heritageClauses = parseHeritageClauses();
node.members = parseObjectTypeMembers();
return addJSDocComment(finishNode(node));
}
function parseTypeAliasDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(223, fullStart);
+ var node = createNode(224, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(134);
+ parseExpected(135);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
- parseExpected(56);
+ parseExpected(57);
node.type = parseType();
parseSemicolon();
return addJSDocComment(finishNode(node));
@@ -16171,14 +15658,14 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseEnumDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(224, fullStart);
+ var node = createNode(225, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(81);
+ parseExpected(82);
node.name = parseIdentifier();
- if (parseExpected(15)) {
+ if (parseExpected(16)) {
node.members = parseDelimitedList(6, parseEnumMember);
- parseExpected(16);
+ parseExpected(17);
}
else {
node.members = createMissingList();
@@ -16186,10 +15673,10 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseModuleBlock() {
- var node = createNode(226, scanner.getStartPos());
- if (parseExpected(15)) {
+ var node = createNode(227, scanner.getStartPos());
+ if (parseExpected(16)) {
node.statements = parseList(1, parseStatement);
- parseExpected(16);
+ parseExpected(17);
}
else {
node.statements = createMissingList();
@@ -16197,29 +15684,29 @@ var ts;
return finishNode(node);
}
function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) {
- var node = createNode(225, fullStart);
+ var node = createNode(226, fullStart);
var namespaceFlag = flags & 16;
node.decorators = decorators;
node.modifiers = modifiers;
node.flags |= flags;
node.name = parseIdentifier();
- node.body = parseOptional(21)
+ node.body = parseOptional(22)
? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 4 | namespaceFlag)
: parseModuleBlock();
return addJSDocComment(finishNode(node));
}
function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(225, fullStart);
+ var node = createNode(226, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- if (token() === 137) {
+ if (token() === 138) {
node.name = parseIdentifier();
node.flags |= 512;
}
else {
node.name = parseLiteralNode(true);
}
- if (token() === 15) {
+ if (token() === 16) {
node.body = parseModuleBlock();
}
else {
@@ -16229,14 +15716,14 @@ var ts;
}
function parseModuleDeclaration(fullStart, decorators, modifiers) {
var flags = 0;
- if (token() === 137) {
+ if (token() === 138) {
return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);
}
- else if (parseOptional(126)) {
+ else if (parseOptional(127)) {
flags |= 16;
}
else {
- parseExpected(125);
+ parseExpected(126);
if (token() === 9) {
return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);
}
@@ -16244,63 +15731,63 @@ var ts;
return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags);
}
function isExternalModuleReference() {
- return token() === 129 &&
+ return token() === 130 &&
lookAhead(nextTokenIsOpenParen);
}
function nextTokenIsOpenParen() {
- return nextToken() === 17;
+ return nextToken() === 18;
}
function nextTokenIsSlash() {
- return nextToken() === 39;
+ return nextToken() === 40;
}
function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) {
- var exportDeclaration = createNode(228, fullStart);
+ var exportDeclaration = createNode(229, fullStart);
exportDeclaration.decorators = decorators;
exportDeclaration.modifiers = modifiers;
- parseExpected(116);
- parseExpected(126);
+ parseExpected(117);
+ parseExpected(127);
exportDeclaration.name = parseIdentifier();
- parseExpected(23);
+ parseExpected(24);
return finishNode(exportDeclaration);
}
function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) {
- parseExpected(89);
+ parseExpected(90);
var afterImportPos = scanner.getStartPos();
var identifier;
if (isIdentifier()) {
identifier = parseIdentifier();
- if (token() !== 24 && token() !== 136) {
- var importEqualsDeclaration = createNode(229, fullStart);
+ if (token() !== 25 && token() !== 137) {
+ var importEqualsDeclaration = createNode(230, fullStart);
importEqualsDeclaration.decorators = decorators;
importEqualsDeclaration.modifiers = modifiers;
importEqualsDeclaration.name = identifier;
- parseExpected(56);
+ parseExpected(57);
importEqualsDeclaration.moduleReference = parseModuleReference();
parseSemicolon();
return addJSDocComment(finishNode(importEqualsDeclaration));
}
}
- var importDeclaration = createNode(230, fullStart);
+ var importDeclaration = createNode(231, fullStart);
importDeclaration.decorators = decorators;
importDeclaration.modifiers = modifiers;
if (identifier ||
- token() === 37 ||
- token() === 15) {
+ token() === 38 ||
+ token() === 16) {
importDeclaration.importClause = parseImportClause(identifier, afterImportPos);
- parseExpected(136);
+ parseExpected(137);
}
importDeclaration.moduleSpecifier = parseModuleSpecifier();
parseSemicolon();
return finishNode(importDeclaration);
}
function parseImportClause(identifier, fullStart) {
- var importClause = createNode(231, fullStart);
+ var importClause = createNode(232, fullStart);
if (identifier) {
importClause.name = identifier;
}
if (!importClause.name ||
- parseOptional(24)) {
- importClause.namedBindings = token() === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(233);
+ parseOptional(25)) {
+ importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(234);
}
return finishNode(importClause);
}
@@ -16310,11 +15797,11 @@ var ts;
: parseEntityName(false);
}
function parseExternalModuleReference() {
- var node = createNode(240);
- parseExpected(129);
- parseExpected(17);
- node.expression = parseModuleSpecifier();
+ var node = createNode(241);
+ parseExpected(130);
parseExpected(18);
+ node.expression = parseModuleSpecifier();
+ parseExpected(19);
return finishNode(node);
}
function parseModuleSpecifier() {
@@ -16328,22 +15815,22 @@ var ts;
}
}
function parseNamespaceImport() {
- var namespaceImport = createNode(232);
- parseExpected(37);
- parseExpected(116);
+ var namespaceImport = createNode(233);
+ parseExpected(38);
+ parseExpected(117);
namespaceImport.name = parseIdentifier();
return finishNode(namespaceImport);
}
function parseNamedImportsOrExports(kind) {
var node = createNode(kind);
- node.elements = parseBracketedList(21, kind === 233 ? parseImportSpecifier : parseExportSpecifier, 15, 16);
+ node.elements = parseBracketedList(21, kind === 234 ? parseImportSpecifier : parseExportSpecifier, 16, 17);
return finishNode(node);
}
function parseExportSpecifier() {
- return parseImportOrExportSpecifier(238);
+ return parseImportOrExportSpecifier(239);
}
function parseImportSpecifier() {
- return parseImportOrExportSpecifier(234);
+ return parseImportOrExportSpecifier(235);
}
function parseImportOrExportSpecifier(kind) {
var node = createNode(kind);
@@ -16351,9 +15838,9 @@ var ts;
var checkIdentifierStart = scanner.getTokenPos();
var checkIdentifierEnd = scanner.getTextPos();
var identifierName = parseIdentifierName();
- if (token() === 116) {
+ if (token() === 117) {
node.propertyName = identifierName;
- parseExpected(116);
+ parseExpected(117);
checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
checkIdentifierStart = scanner.getTokenPos();
checkIdentifierEnd = scanner.getTextPos();
@@ -16362,23 +15849,23 @@ var ts;
else {
node.name = identifierName;
}
- if (kind === 234 && checkIdentifierIsKeyword) {
+ if (kind === 235 && checkIdentifierIsKeyword) {
parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected);
}
return finishNode(node);
}
function parseExportDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(236, fullStart);
+ var node = createNode(237, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- if (parseOptional(37)) {
- parseExpected(136);
+ if (parseOptional(38)) {
+ parseExpected(137);
node.moduleSpecifier = parseModuleSpecifier();
}
else {
- node.exportClause = parseNamedImportsOrExports(237);
- if (token() === 136 || (token() === 9 && !scanner.hasPrecedingLineBreak())) {
- parseExpected(136);
+ node.exportClause = parseNamedImportsOrExports(238);
+ if (token() === 137 || (token() === 9 && !scanner.hasPrecedingLineBreak())) {
+ parseExpected(137);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -16386,14 +15873,14 @@ var ts;
return finishNode(node);
}
function parseExportAssignment(fullStart, decorators, modifiers) {
- var node = createNode(235, fullStart);
+ var node = createNode(236, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- if (parseOptional(56)) {
+ if (parseOptional(57)) {
node.isExportEquals = true;
}
else {
- parseExpected(77);
+ parseExpected(78);
}
node.expression = parseAssignmentExpressionOrHigher();
parseSemicolon();
@@ -16465,36 +15952,72 @@ var ts;
function setExternalModuleIndicator(sourceFile) {
sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) {
return ts.hasModifier(node, 1)
- || node.kind === 229 && node.moduleReference.kind === 240
- || node.kind === 230
- || node.kind === 235
+ || node.kind === 230 && node.moduleReference.kind === 241
+ || node.kind === 231
|| node.kind === 236
+ || node.kind === 237
? node
: undefined;
});
}
+ var ParsingContext;
+ (function (ParsingContext) {
+ ParsingContext[ParsingContext["SourceElements"] = 0] = "SourceElements";
+ ParsingContext[ParsingContext["BlockStatements"] = 1] = "BlockStatements";
+ ParsingContext[ParsingContext["SwitchClauses"] = 2] = "SwitchClauses";
+ ParsingContext[ParsingContext["SwitchClauseStatements"] = 3] = "SwitchClauseStatements";
+ ParsingContext[ParsingContext["TypeMembers"] = 4] = "TypeMembers";
+ ParsingContext[ParsingContext["ClassMembers"] = 5] = "ClassMembers";
+ ParsingContext[ParsingContext["EnumMembers"] = 6] = "EnumMembers";
+ ParsingContext[ParsingContext["HeritageClauseElement"] = 7] = "HeritageClauseElement";
+ ParsingContext[ParsingContext["VariableDeclarations"] = 8] = "VariableDeclarations";
+ ParsingContext[ParsingContext["ObjectBindingElements"] = 9] = "ObjectBindingElements";
+ ParsingContext[ParsingContext["ArrayBindingElements"] = 10] = "ArrayBindingElements";
+ ParsingContext[ParsingContext["ArgumentExpressions"] = 11] = "ArgumentExpressions";
+ ParsingContext[ParsingContext["ObjectLiteralMembers"] = 12] = "ObjectLiteralMembers";
+ ParsingContext[ParsingContext["JsxAttributes"] = 13] = "JsxAttributes";
+ ParsingContext[ParsingContext["JsxChildren"] = 14] = "JsxChildren";
+ ParsingContext[ParsingContext["ArrayLiteralMembers"] = 15] = "ArrayLiteralMembers";
+ ParsingContext[ParsingContext["Parameters"] = 16] = "Parameters";
+ ParsingContext[ParsingContext["TypeParameters"] = 17] = "TypeParameters";
+ ParsingContext[ParsingContext["TypeArguments"] = 18] = "TypeArguments";
+ ParsingContext[ParsingContext["TupleElementTypes"] = 19] = "TupleElementTypes";
+ ParsingContext[ParsingContext["HeritageClauses"] = 20] = "HeritageClauses";
+ ParsingContext[ParsingContext["ImportOrExportSpecifiers"] = 21] = "ImportOrExportSpecifiers";
+ ParsingContext[ParsingContext["JSDocFunctionParameters"] = 22] = "JSDocFunctionParameters";
+ ParsingContext[ParsingContext["JSDocTypeArguments"] = 23] = "JSDocTypeArguments";
+ ParsingContext[ParsingContext["JSDocRecordMembers"] = 24] = "JSDocRecordMembers";
+ ParsingContext[ParsingContext["JSDocTupleTypes"] = 25] = "JSDocTupleTypes";
+ ParsingContext[ParsingContext["Count"] = 26] = "Count";
+ })(ParsingContext || (ParsingContext = {}));
+ var Tristate;
+ (function (Tristate) {
+ Tristate[Tristate["False"] = 0] = "False";
+ Tristate[Tristate["True"] = 1] = "True";
+ Tristate[Tristate["Unknown"] = 2] = "Unknown";
+ })(Tristate || (Tristate = {}));
var JSDocParser;
(function (JSDocParser) {
function isJSDocType() {
switch (token()) {
- case 37:
- case 53:
- case 17:
- case 19:
- case 49:
- case 15:
- case 87:
- case 22:
- case 92:
- case 97:
+ case 38:
+ case 54:
+ case 18:
+ case 20:
+ case 50:
+ case 16:
+ case 88:
+ case 23:
+ case 93:
+ case 98:
return true;
}
return ts.tokenIsIdentifierOrKeyword(token());
}
JSDocParser.isJSDocType = isJSDocType;
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState("file.js", content, 2, undefined, 1);
- sourceFile = createSourceFile("file.js", 2, 1);
+ initializeState(content, 4, undefined, 1);
+ sourceFile = createSourceFile("file.js", 4, 1);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -16505,21 +16028,21 @@ var ts;
JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
function parseJSDocTypeExpression() {
var result = createNode(257, scanner.getTokenPos());
- parseExpected(15);
- result.type = parseJSDocTopLevelType();
parseExpected(16);
+ result.type = parseJSDocTopLevelType();
+ parseExpected(17);
fixupParentReferences(result);
return finishNode(result);
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseJSDocTopLevelType() {
var type = parseJSDocType();
- if (token() === 47) {
+ if (token() === 48) {
var unionType = createNode(261, type.pos);
unionType.types = parseJSDocTypeList(type);
type = finishNode(unionType);
}
- if (token() === 56) {
+ if (token() === 57) {
var optionalType = createNode(268, type.pos);
nextToken();
optionalType.type = type;
@@ -16530,20 +16053,20 @@ var ts;
function parseJSDocType() {
var type = parseBasicTypeExpression();
while (true) {
- if (token() === 19) {
+ if (token() === 20) {
var arrayType = createNode(260, type.pos);
arrayType.elementType = type;
nextToken();
- parseExpected(20);
+ parseExpected(21);
type = finishNode(arrayType);
}
- else if (token() === 53) {
+ else if (token() === 54) {
var nullableType = createNode(263, type.pos);
nullableType.type = type;
nextToken();
type = finishNode(nullableType);
}
- else if (token() === 49) {
+ else if (token() === 50) {
var nonNullableType = createNode(264, type.pos);
nonNullableType.type = type;
nextToken();
@@ -16557,40 +16080,40 @@ var ts;
}
function parseBasicTypeExpression() {
switch (token()) {
- case 37:
+ case 38:
return parseJSDocAllType();
- case 53:
+ case 54:
return parseJSDocUnknownOrNullableType();
- case 17:
+ case 18:
return parseJSDocUnionType();
- case 19:
+ case 20:
return parseJSDocTupleType();
- case 49:
+ case 50:
return parseJSDocNonNullableType();
- case 15:
+ case 16:
return parseJSDocRecordType();
- case 87:
+ case 88:
return parseJSDocFunctionType();
- case 22:
+ case 23:
return parseJSDocVariadicType();
- case 92:
+ case 93:
return parseJSDocConstructorType();
- case 97:
+ case 98:
return parseJSDocThisType();
- case 117:
- case 132:
- case 130:
- case 120:
+ case 118:
case 133:
- case 103:
- case 93:
- case 135:
- case 127:
+ case 131:
+ case 121:
+ case 134:
+ case 104:
+ case 94:
+ case 136:
+ case 128:
return parseTokenNode();
case 9:
case 8:
- case 99:
- case 84:
+ case 100:
+ case 85:
return parseJSDocLiteralType();
}
return parseJSDocTypeReference();
@@ -16598,14 +16121,14 @@ var ts;
function parseJSDocThisType() {
var result = createNode(272);
nextToken();
- parseExpected(54);
+ parseExpected(55);
result.type = parseJSDocType();
return finishNode(result);
}
function parseJSDocConstructorType() {
var result = createNode(271);
nextToken();
- parseExpected(54);
+ parseExpected(55);
result.type = parseJSDocType();
return finishNode(result);
}
@@ -16618,33 +16141,33 @@ var ts;
function parseJSDocFunctionType() {
var result = createNode(269);
nextToken();
- parseExpected(17);
+ parseExpected(18);
result.parameters = parseDelimitedList(22, parseJSDocParameter);
checkForTrailingComma(result.parameters);
- parseExpected(18);
- if (token() === 54) {
+ parseExpected(19);
+ if (token() === 55) {
nextToken();
result.type = parseJSDocType();
}
return finishNode(result);
}
function parseJSDocParameter() {
- var parameter = createNode(142);
+ var parameter = createNode(143);
parameter.type = parseJSDocType();
- if (parseOptional(56)) {
- parameter.questionToken = createNode(56);
+ if (parseOptional(57)) {
+ parameter.questionToken = createNode(57);
}
return finishNode(parameter);
}
function parseJSDocTypeReference() {
var result = createNode(267);
result.name = parseSimplePropertyName();
- if (token() === 25) {
+ if (token() === 26) {
result.typeArguments = parseTypeArguments();
}
else {
- while (parseOptional(21)) {
- if (token() === 25) {
+ while (parseOptional(22)) {
+ if (token() === 26) {
result.typeArguments = parseTypeArguments();
break;
}
@@ -16660,7 +16183,7 @@ var ts;
var typeArguments = parseDelimitedList(23, parseJSDocType);
checkForTrailingComma(typeArguments);
checkForEmptyTypeArgumentList(typeArguments);
- parseExpected(27);
+ parseExpected(28);
return typeArguments;
}
function checkForEmptyTypeArgumentList(typeArguments) {
@@ -16671,7 +16194,7 @@ var ts;
}
}
function parseQualifiedName(left) {
- var result = createNode(139, left.pos);
+ var result = createNode(140, left.pos);
result.left = left;
result.right = parseIdentifierName();
return finishNode(result);
@@ -16692,7 +16215,7 @@ var ts;
nextToken();
result.types = parseDelimitedList(25, parseJSDocType);
checkForTrailingComma(result.types);
- parseExpected(20);
+ parseExpected(21);
return finishNode(result);
}
function checkForTrailingComma(list) {
@@ -16705,13 +16228,13 @@ var ts;
var result = createNode(261);
nextToken();
result.types = parseJSDocTypeList(parseJSDocType());
- parseExpected(18);
+ parseExpected(19);
return finishNode(result);
}
function parseJSDocTypeList(firstType) {
ts.Debug.assert(!!firstType);
var types = createNodeArray([firstType], firstType.pos);
- while (parseOptional(47)) {
+ while (parseOptional(48)) {
types.push(parseJSDocType());
}
types.end = scanner.getStartPos();
@@ -16730,12 +16253,12 @@ var ts;
function parseJSDocUnknownOrNullableType() {
var pos = scanner.getStartPos();
nextToken();
- if (token() === 24 ||
- token() === 16 ||
- token() === 18 ||
- token() === 27 ||
- token() === 56 ||
- token() === 47) {
+ if (token() === 25 ||
+ token() === 17 ||
+ token() === 19 ||
+ token() === 28 ||
+ token() === 57 ||
+ token() === 48) {
var result = createNode(259, pos);
return finishNode(result);
}
@@ -16746,7 +16269,7 @@ var ts;
}
}
function parseIsolatedJSDocComment(content, start, length) {
- initializeState("file.js", content, 2, undefined, 1);
+ initializeState(content, 4, undefined, 1);
sourceFile = { languageVariant: 0, text: content };
var jsDoc = parseJSDocCommentWorker(start, length);
var diagnostics = parseDiagnostics;
@@ -16768,6 +16291,12 @@ var ts;
return comment;
}
JSDocParser.parseJSDocComment = parseJSDocComment;
+ var JSDocState;
+ (function (JSDocState) {
+ JSDocState[JSDocState["BeginningOfLine"] = 0] = "BeginningOfLine";
+ JSDocState[JSDocState["SawAsterisk"] = 1] = "SawAsterisk";
+ JSDocState[JSDocState["SavingComments"] = 2] = "SavingComments";
+ })(JSDocState || (JSDocState = {}));
function parseJSDocCommentWorker(start, length) {
var content = sourceText;
start = start || 0;
@@ -16804,7 +16333,7 @@ var ts;
}
while (token() !== 1) {
switch (token()) {
- case 55:
+ case 56:
if (state === 0 || state === 1) {
removeTrailingNewlines(comments);
parseTag(indent);
@@ -16822,7 +16351,7 @@ var ts;
state = 0;
indent = 0;
break;
- case 37:
+ case 38:
var asterisk = scanner.getTokenText();
if (state === 1) {
state = 2;
@@ -16833,7 +16362,7 @@ var ts;
indent += asterisk.length;
}
break;
- case 69:
+ case 70:
pushComment(scanner.getTokenText());
state = 2;
break;
@@ -16890,8 +16419,8 @@ var ts;
}
}
function parseTag(indent) {
- ts.Debug.assert(token() === 55);
- var atToken = createNode(55, scanner.getTokenPos());
+ ts.Debug.assert(token() === 56);
+ var atToken = createNode(56, scanner.getTokenPos());
atToken.end = scanner.getTextPos();
nextJSDocToken();
var tagName = parseJSDocIdentifierName();
@@ -16942,7 +16471,7 @@ var ts;
comments.push(text);
indent += text.length;
}
- while (token() !== 55 && token() !== 1) {
+ while (token() !== 56 && token() !== 1) {
switch (token()) {
case 4:
if (state >= 1) {
@@ -16951,7 +16480,7 @@ var ts;
}
indent = 0;
break;
- case 55:
+ case 56:
break;
case 5:
if (state === 2) {
@@ -16965,7 +16494,7 @@ var ts;
indent += whitespace.length;
}
break;
- case 37:
+ case 38:
if (state === 0) {
state = 1;
indent += scanner.getTokenText().length;
@@ -16976,7 +16505,7 @@ var ts;
pushComment(scanner.getTokenText());
break;
}
- if (token() === 55) {
+ if (token() === 56) {
break;
}
nextJSDocToken();
@@ -17004,7 +16533,7 @@ var ts;
function tryParseTypeExpression() {
return tryParse(function () {
skipWhitespace();
- if (token() !== 15) {
+ if (token() !== 16) {
return undefined;
}
return parseJSDocTypeExpression();
@@ -17015,14 +16544,14 @@ var ts;
skipWhitespace();
var name;
var isBracketed;
- if (parseOptionalToken(19)) {
+ if (parseOptionalToken(20)) {
name = parseJSDocIdentifierName();
skipWhitespace();
isBracketed = true;
- if (parseOptionalToken(56)) {
+ if (parseOptionalToken(57)) {
parseExpression();
}
- parseExpected(20);
+ parseExpected(21);
}
else if (ts.tokenIsIdentifierOrKeyword(token())) {
name = parseJSDocIdentifierName();
@@ -17099,9 +16628,9 @@ var ts;
if (typeExpression) {
if (typeExpression.type.kind === 267) {
var jsDocTypeReference = typeExpression.type;
- if (jsDocTypeReference.name.kind === 69) {
- var name_14 = jsDocTypeReference.name;
- if (name_14.text === "Object") {
+ if (jsDocTypeReference.name.kind === 70) {
+ var name_11 = jsDocTypeReference.name;
+ if (name_11.text === "Object") {
typedefTag.jsDocTypeLiteral = scanChildTags();
}
}
@@ -17123,7 +16652,7 @@ var ts;
while (token() !== 1 && !parentTagTerminated) {
nextJSDocToken();
switch (token()) {
- case 55:
+ case 56:
if (canParseTag) {
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
if (!parentTagTerminated) {
@@ -17137,13 +16666,13 @@ var ts;
canParseTag = true;
seenAsterisk = false;
break;
- case 37:
+ case 38:
if (seenAsterisk) {
canParseTag = false;
}
seenAsterisk = true;
break;
- case 69:
+ case 70:
canParseTag = false;
case 1:
break;
@@ -17154,8 +16683,8 @@ var ts;
}
}
function tryParseChildTag(parentTag) {
- ts.Debug.assert(token() === 55);
- var atToken = createNode(55, scanner.getStartPos());
+ ts.Debug.assert(token() === 56);
+ var atToken = createNode(56, scanner.getStartPos());
atToken.end = scanner.getTextPos();
nextJSDocToken();
var tagName = parseJSDocIdentifierName();
@@ -17187,17 +16716,17 @@ var ts;
}
var typeParameters = createNodeArray();
while (true) {
- var name_15 = parseJSDocIdentifierName();
+ var name_12 = parseJSDocIdentifierName();
skipWhitespace();
- if (!name_15) {
+ if (!name_12) {
parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var typeParameter = createNode(141, name_15.pos);
- typeParameter.name = name_15;
+ var typeParameter = createNode(142, name_12.pos);
+ typeParameter.name = name_12;
finishNode(typeParameter);
typeParameters.push(typeParameter);
- if (token() === 24) {
+ if (token() === 25) {
nextJSDocToken();
skipWhitespace();
}
@@ -17226,7 +16755,7 @@ var ts;
}
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
- var result = createNode(69, pos);
+ var result = createNode(70, pos);
result.text = content.substring(pos, end);
finishNode(result, end);
nextJSDocToken();
@@ -17297,8 +16826,8 @@ var ts;
array._children = undefined;
array.pos += delta;
array.end += delta;
- for (var _i = 0, array_8 = array; _i < array_8.length; _i++) {
- var node = array_8[_i];
+ for (var _i = 0, array_9 = array; _i < array_9.length; _i++) {
+ var node = array_9[_i];
visitNode(node);
}
}
@@ -17307,7 +16836,7 @@ var ts;
switch (node.kind) {
case 9:
case 8:
- case 69:
+ case 70:
return true;
}
return false;
@@ -17370,8 +16899,8 @@ var ts;
array.intersectsChange = true;
array._children = undefined;
adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
- for (var _i = 0, array_9 = array; _i < array_9.length; _i++) {
- var node = array_9[_i];
+ for (var _i = 0, array_10 = array; _i < array_10.length; _i++) {
+ var node = array_10[_i];
visitNode(node);
}
return;
@@ -17519,21 +17048,31 @@ var ts;
}
}
}
+ var InvalidPosition;
+ (function (InvalidPosition) {
+ InvalidPosition[InvalidPosition["Value"] = -1] = "Value";
+ })(InvalidPosition || (InvalidPosition = {}));
})(IncrementalParser || (IncrementalParser = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
+ (function (ModuleInstanceState) {
+ ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated";
+ ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated";
+ ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly";
+ })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {}));
+ var ModuleInstanceState = ts.ModuleInstanceState;
function getModuleInstanceState(node) {
- if (node.kind === 222 || node.kind === 223) {
+ if (node.kind === 223 || node.kind === 224) {
return 0;
}
else if (ts.isConstEnumDeclaration(node)) {
return 2;
}
- else if ((node.kind === 230 || node.kind === 229) && !(ts.hasModifier(node, 1))) {
+ else if ((node.kind === 231 || node.kind === 230) && !(ts.hasModifier(node, 1))) {
return 0;
}
- else if (node.kind === 226) {
+ else if (node.kind === 227) {
var state_1 = 0;
ts.forEachChild(node, function (n) {
switch (getModuleInstanceState(n)) {
@@ -17549,7 +17088,7 @@ var ts;
});
return state_1;
}
- else if (node.kind === 225) {
+ else if (node.kind === 226) {
var body = node.body;
return body ? getModuleInstanceState(body) : 1;
}
@@ -17558,6 +17097,18 @@ var ts;
}
}
ts.getModuleInstanceState = getModuleInstanceState;
+ var ContainerFlags;
+ (function (ContainerFlags) {
+ ContainerFlags[ContainerFlags["None"] = 0] = "None";
+ ContainerFlags[ContainerFlags["IsContainer"] = 1] = "IsContainer";
+ ContainerFlags[ContainerFlags["IsBlockScopedContainer"] = 2] = "IsBlockScopedContainer";
+ ContainerFlags[ContainerFlags["IsControlFlowContainer"] = 4] = "IsControlFlowContainer";
+ ContainerFlags[ContainerFlags["IsFunctionLike"] = 8] = "IsFunctionLike";
+ ContainerFlags[ContainerFlags["IsFunctionExpression"] = 16] = "IsFunctionExpression";
+ ContainerFlags[ContainerFlags["HasLocals"] = 32] = "HasLocals";
+ ContainerFlags[ContainerFlags["IsInterface"] = 64] = "IsInterface";
+ ContainerFlags[ContainerFlags["IsObjectLiteralOrClassExpressionMethod"] = 128] = "IsObjectLiteralOrClassExpressionMethod";
+ })(ContainerFlags || (ContainerFlags = {}));
var binder = createBinder();
function bindSourceFile(file, options) {
ts.performance.mark("beforeBind");
@@ -17655,7 +17206,7 @@ var ts;
if (symbolFlags & 107455) {
var valueDeclaration = symbol.valueDeclaration;
if (!valueDeclaration ||
- (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 225)) {
+ (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 226)) {
symbol.valueDeclaration = node;
}
}
@@ -17665,7 +17216,7 @@ var ts;
if (ts.isAmbientModule(node)) {
return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\"";
}
- if (node.name.kind === 140) {
+ if (node.name.kind === 141) {
var nameExpression = node.name.expression;
if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
return nameExpression.text;
@@ -17676,21 +17227,21 @@ var ts;
return node.name.text;
}
switch (node.kind) {
- case 148:
+ case 149:
return "__constructor";
- case 156:
- case 151:
- return "__call";
case 157:
case 152:
- return "__new";
+ return "__call";
+ case 158:
case 153:
+ return "__new";
+ case 154:
return "__index";
- case 236:
+ case 237:
return "__export";
- case 235:
+ case 236:
return node.isExportEquals ? "export=" : "default";
- case 187:
+ case 188:
switch (ts.getSpecialPropertyAssignmentKind(node)) {
case 2:
return "export=";
@@ -17702,12 +17253,12 @@ var ts;
}
ts.Debug.fail("Unknown binary declaration kind");
break;
- case 220:
case 221:
+ case 222:
return ts.hasModifier(node, 512) ? "default" : undefined;
case 269:
return ts.isJSDocConstructSignature(node) ? "__new" : "__call";
- case 142:
+ case 143:
ts.Debug.assert(node.parent.kind === 269);
var functionType = node.parent;
var index = ts.indexOf(functionType.parameters, node);
@@ -17715,10 +17266,10 @@ var ts;
case 279:
var parentNode = node.parent && node.parent.parent;
var nameFromParentNode = void 0;
- if (parentNode && parentNode.kind === 200) {
+ if (parentNode && parentNode.kind === 201) {
if (parentNode.declarationList.declarations.length > 0) {
var nameIdentifier = parentNode.declarationList.declarations[0].name;
- if (nameIdentifier.kind === 69) {
+ if (nameIdentifier.kind === 70) {
nameFromParentNode = nameIdentifier.text;
}
}
@@ -17759,7 +17310,7 @@ var ts;
}
else {
if (symbol.declarations && symbol.declarations.length &&
- (isDefaultExport || (node.kind === 235 && !node.isExportEquals))) {
+ (isDefaultExport || (node.kind === 236 && !node.isExportEquals))) {
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
}
}
@@ -17779,7 +17330,7 @@ var ts;
function declareModuleMember(node, symbolFlags, symbolExcludes) {
var hasExportModifier = ts.getCombinedModifierFlags(node) & 1;
if (symbolFlags & 8388608) {
- if (node.kind === 238 || (node.kind === 229 && hasExportModifier)) {
+ if (node.kind === 239 || (node.kind === 230 && hasExportModifier)) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
}
else {
@@ -17896,64 +17447,64 @@ var ts;
return;
}
switch (node.kind) {
- case 205:
+ case 206:
bindWhileStatement(node);
break;
- case 204:
+ case 205:
bindDoStatement(node);
break;
- case 206:
+ case 207:
bindForStatement(node);
break;
- case 207:
case 208:
+ case 209:
bindForInOrForOfStatement(node);
break;
- case 203:
+ case 204:
bindIfStatement(node);
break;
- case 211:
- case 215:
+ case 212:
+ case 216:
bindReturnOrThrow(node);
break;
+ case 211:
case 210:
- case 209:
bindBreakOrContinueStatement(node);
break;
- case 216:
+ case 217:
bindTryStatement(node);
break;
- case 213:
+ case 214:
bindSwitchStatement(node);
break;
- case 227:
+ case 228:
bindCaseBlock(node);
break;
case 249:
bindCaseClause(node);
break;
- case 214:
+ case 215:
bindLabeledStatement(node);
break;
- case 185:
+ case 186:
bindPrefixUnaryExpressionFlow(node);
break;
- case 186:
+ case 187:
bindPostfixUnaryExpressionFlow(node);
break;
- case 187:
+ case 188:
bindBinaryExpressionFlow(node);
break;
- case 181:
+ case 182:
bindDeleteExpressionFlow(node);
break;
- case 188:
+ case 189:
bindConditionalExpressionFlow(node);
break;
- case 218:
+ case 219:
bindVariableDeclarationFlow(node);
break;
- case 174:
+ case 175:
bindCallExpressionFlow(node);
break;
default:
@@ -17963,25 +17514,25 @@ var ts;
}
function isNarrowingExpression(expr) {
switch (expr.kind) {
- case 69:
- case 97:
- case 172:
+ case 70:
+ case 98:
+ case 173:
return isNarrowableReference(expr);
- case 174:
+ case 175:
return hasNarrowableArgument(expr);
- case 178:
+ case 179:
return isNarrowingExpression(expr.expression);
- case 187:
+ case 188:
return isNarrowingBinaryExpression(expr);
- case 185:
- return expr.operator === 49 && isNarrowingExpression(expr.operand);
+ case 186:
+ return expr.operator === 50 && isNarrowingExpression(expr.operand);
}
return false;
}
function isNarrowableReference(expr) {
- return expr.kind === 69 ||
- expr.kind === 97 ||
- expr.kind === 172 && isNarrowableReference(expr.expression);
+ return expr.kind === 70 ||
+ expr.kind === 98 ||
+ expr.kind === 173 && isNarrowableReference(expr.expression);
}
function hasNarrowableArgument(expr) {
if (expr.arguments) {
@@ -17992,41 +17543,41 @@ var ts;
}
}
}
- if (expr.expression.kind === 172 &&
+ if (expr.expression.kind === 173 &&
isNarrowableReference(expr.expression.expression)) {
return true;
}
return false;
}
function isNarrowingTypeofOperands(expr1, expr2) {
- return expr1.kind === 182 && isNarrowableOperand(expr1.expression) && expr2.kind === 9;
+ return expr1.kind === 183 && isNarrowableOperand(expr1.expression) && expr2.kind === 9;
}
function isNarrowingBinaryExpression(expr) {
switch (expr.operatorToken.kind) {
- case 56:
+ case 57:
return isNarrowableReference(expr.left);
- case 30:
case 31:
case 32:
case 33:
+ case 34:
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
- case 91:
+ case 92:
return isNarrowableOperand(expr.left);
- case 24:
+ case 25:
return isNarrowingExpression(expr.right);
}
return false;
}
function isNarrowableOperand(expr) {
switch (expr.kind) {
- case 178:
+ case 179:
return isNarrowableOperand(expr.expression);
- case 187:
+ case 188:
switch (expr.operatorToken.kind) {
- case 56:
+ case 57:
return isNarrowableOperand(expr.left);
- case 24:
+ case 25:
return isNarrowableOperand(expr.right);
}
}
@@ -18045,7 +17596,7 @@ var ts;
};
}
function setFlowNodeReferenced(flow) {
- flow.flags |= flow.flags & 256 ? 512 : 256;
+ flow.flags |= flow.flags & 512 ? 1024 : 512;
}
function addAntecedent(label, antecedent) {
if (!(antecedent.flags & 1) && !ts.contains(label.antecedents, antecedent)) {
@@ -18060,8 +17611,8 @@ var ts;
if (!expression) {
return flags & 32 ? antecedent : unreachableFlow;
}
- if (expression.kind === 99 && flags & 64 ||
- expression.kind === 84 && flags & 32) {
+ if (expression.kind === 100 && flags & 64 ||
+ expression.kind === 85 && flags & 32) {
return unreachableFlow;
}
if (!isNarrowingExpression(expression)) {
@@ -18095,6 +17646,14 @@ var ts;
node: node
};
}
+ function createFlowArrayMutation(antecedent, node) {
+ setFlowNodeReferenced(antecedent);
+ return {
+ flags: 256,
+ antecedent: antecedent,
+ node: node
+ };
+ }
function finishFlowLabel(flow) {
var antecedents = flow.antecedents;
if (!antecedents) {
@@ -18108,34 +17667,34 @@ var ts;
function isStatementCondition(node) {
var parent = node.parent;
switch (parent.kind) {
- case 203:
- case 205:
case 204:
- return parent.expression === node;
case 206:
- case 188:
+ case 205:
+ return parent.expression === node;
+ case 207:
+ case 189:
return parent.condition === node;
}
return false;
}
function isLogicalExpression(node) {
while (true) {
- if (node.kind === 178) {
+ if (node.kind === 179) {
node = node.expression;
}
- else if (node.kind === 185 && node.operator === 49) {
+ else if (node.kind === 186 && node.operator === 50) {
node = node.operand;
}
else {
- return node.kind === 187 && (node.operatorToken.kind === 51 ||
- node.operatorToken.kind === 52);
+ return node.kind === 188 && (node.operatorToken.kind === 52 ||
+ node.operatorToken.kind === 53);
}
}
}
function isTopLevelLogicalExpression(node) {
- while (node.parent.kind === 178 ||
- node.parent.kind === 185 &&
- node.parent.operator === 49) {
+ while (node.parent.kind === 179 ||
+ node.parent.kind === 186 &&
+ node.parent.operator === 50) {
node = node.parent;
}
return !isStatementCondition(node) && !isLogicalExpression(node.parent);
@@ -18208,7 +17767,7 @@ var ts;
bind(node.expression);
addAntecedent(postLoopLabel, currentFlow);
bind(node.initializer);
- if (node.initializer.kind !== 219) {
+ if (node.initializer.kind !== 220) {
bindAssignmentTargetFlow(node.initializer);
}
bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
@@ -18230,7 +17789,7 @@ var ts;
}
function bindReturnOrThrow(node) {
bind(node.expression);
- if (node.kind === 211) {
+ if (node.kind === 212) {
hasExplicitReturn = true;
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
@@ -18250,7 +17809,7 @@ var ts;
return undefined;
}
function bindbreakOrContinueFlow(node, breakTarget, continueTarget) {
- var flowLabel = node.kind === 210 ? breakTarget : continueTarget;
+ var flowLabel = node.kind === 211 ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
currentFlow = unreachableFlow;
@@ -18270,21 +17829,32 @@ var ts;
}
}
function bindTryStatement(node) {
- var postFinallyLabel = createBranchLabel();
+ var preFinallyLabel = createBranchLabel();
var preTryFlow = currentFlow;
bind(node.tryBlock);
- addAntecedent(postFinallyLabel, currentFlow);
+ addAntecedent(preFinallyLabel, currentFlow);
+ var flowAfterTry = currentFlow;
+ var flowAfterCatch = unreachableFlow;
if (node.catchClause) {
currentFlow = preTryFlow;
bind(node.catchClause);
- addAntecedent(postFinallyLabel, currentFlow);
+ addAntecedent(preFinallyLabel, currentFlow);
+ flowAfterCatch = currentFlow;
}
if (node.finallyBlock) {
- currentFlow = preTryFlow;
+ addAntecedent(preFinallyLabel, preTryFlow);
+ currentFlow = finishFlowLabel(preFinallyLabel);
bind(node.finallyBlock);
+ if (!(currentFlow.flags & 1)) {
+ if ((flowAfterTry.flags & 1) && (flowAfterCatch.flags & 1)) {
+ currentFlow = flowAfterTry === reportedUnreachableFlow || flowAfterCatch === reportedUnreachableFlow
+ ? reportedUnreachableFlow
+ : unreachableFlow;
+ }
+ }
}
- if (!node.finallyBlock || !(currentFlow.flags & 1)) {
- currentFlow = finishFlowLabel(postFinallyLabel);
+ else {
+ currentFlow = finishFlowLabel(preFinallyLabel);
}
}
function bindSwitchStatement(node) {
@@ -18361,7 +17931,7 @@ var ts;
currentFlow = finishFlowLabel(postStatementLabel);
}
function bindDestructuringTargetFlow(node) {
- if (node.kind === 187 && node.operatorToken.kind === 56) {
+ if (node.kind === 188 && node.operatorToken.kind === 57) {
bindAssignmentTargetFlow(node.left);
}
else {
@@ -18372,10 +17942,10 @@ var ts;
if (isNarrowableReference(node)) {
currentFlow = createFlowAssignment(currentFlow, node);
}
- else if (node.kind === 170) {
+ else if (node.kind === 171) {
for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
var e = _a[_i];
- if (e.kind === 191) {
+ if (e.kind === 192) {
bindAssignmentTargetFlow(e.expression);
}
else {
@@ -18383,7 +17953,7 @@ var ts;
}
}
}
- else if (node.kind === 171) {
+ else if (node.kind === 172) {
for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
var p = _c[_b];
if (p.kind === 253) {
@@ -18397,7 +17967,7 @@ var ts;
}
function bindLogicalExpression(node, trueTarget, falseTarget) {
var preRightLabel = createBranchLabel();
- if (node.operatorToken.kind === 51) {
+ if (node.operatorToken.kind === 52) {
bindCondition(node.left, preRightLabel, falseTarget);
}
else {
@@ -18408,7 +17978,7 @@ var ts;
bindCondition(node.right, trueTarget, falseTarget);
}
function bindPrefixUnaryExpressionFlow(node) {
- if (node.operator === 49) {
+ if (node.operator === 50) {
var saveTrueTarget = currentTrueTarget;
currentTrueTarget = currentFalseTarget;
currentFalseTarget = saveTrueTarget;
@@ -18418,20 +17988,20 @@ var ts;
}
else {
ts.forEachChild(node, bind);
- if (node.operator === 41 || node.operator === 42) {
+ if (node.operator === 42 || node.operator === 43) {
bindAssignmentTargetFlow(node.operand);
}
}
}
function bindPostfixUnaryExpressionFlow(node) {
ts.forEachChild(node, bind);
- if (node.operator === 41 || node.operator === 42) {
+ if (node.operator === 42 || node.operator === 43) {
bindAssignmentTargetFlow(node.operand);
}
}
function bindBinaryExpressionFlow(node) {
var operator = node.operatorToken.kind;
- if (operator === 51 || operator === 52) {
+ if (operator === 52 || operator === 53) {
if (isTopLevelLogicalExpression(node)) {
var postExpressionLabel = createBranchLabel();
bindLogicalExpression(node, postExpressionLabel, postExpressionLabel);
@@ -18443,14 +18013,20 @@ var ts;
}
else {
ts.forEachChild(node, bind);
- if (operator === 56 && !ts.isAssignmentTarget(node)) {
+ if (operator === 57 && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
+ if (node.left.kind === 174) {
+ var elementAccess = node.left;
+ if (isNarrowableOperand(elementAccess.expression)) {
+ currentFlow = createFlowArrayMutation(currentFlow, node);
+ }
+ }
}
}
}
function bindDeleteExpressionFlow(node) {
ts.forEachChild(node, bind);
- if (node.expression.kind === 172) {
+ if (node.expression.kind === 173) {
bindAssignmentTargetFlow(node.expression);
}
}
@@ -18481,16 +18057,16 @@ var ts;
}
function bindVariableDeclarationFlow(node) {
ts.forEachChild(node, bind);
- if (node.initializer || node.parent.parent.kind === 207 || node.parent.parent.kind === 208) {
+ if (node.initializer || node.parent.parent.kind === 208 || node.parent.parent.kind === 209) {
bindInitializedVariableFlow(node);
}
}
function bindCallExpressionFlow(node) {
var expr = node.expression;
- while (expr.kind === 178) {
+ while (expr.kind === 179) {
expr = expr.expression;
}
- if (expr.kind === 179 || expr.kind === 180) {
+ if (expr.kind === 180 || expr.kind === 181) {
ts.forEach(node.typeArguments, bind);
ts.forEach(node.arguments, bind);
bind(node.expression);
@@ -18498,54 +18074,60 @@ var ts;
else {
ts.forEachChild(node, bind);
}
+ if (node.expression.kind === 173) {
+ var propertyAccess = node.expression;
+ if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {
+ currentFlow = createFlowArrayMutation(currentFlow, node);
+ }
+ }
}
function getContainerFlags(node) {
switch (node.kind) {
- case 192:
- case 221:
- case 224:
- case 171:
- case 159:
+ case 193:
+ case 222:
+ case 225:
+ case 172:
+ case 160:
case 281:
case 265:
return 1;
- case 222:
+ case 223:
return 1 | 64;
case 269:
- case 225:
- case 223:
+ case 226:
+ case 224:
return 1 | 32;
case 256:
return 1 | 4 | 32;
- case 147:
+ case 148:
if (ts.isObjectLiteralOrClassExpressionMethod(node)) {
return 1 | 4 | 32 | 8 | 128;
}
- case 148:
- case 220:
- case 146:
case 149:
+ case 221:
+ case 147:
case 150:
case 151:
case 152:
case 153:
- case 156:
+ case 154:
case 157:
+ case 158:
return 1 | 4 | 32 | 8;
- case 179:
case 180:
+ case 181:
return 1 | 4 | 32 | 8 | 16;
- case 226:
+ case 227:
return 4;
- case 145:
+ case 146:
return node.initializer ? 4 : 0;
case 252:
- case 206:
case 207:
case 208:
- case 227:
+ case 209:
+ case 228:
return 2;
- case 199:
+ case 200:
return ts.isFunctionLike(node.parent) ? 0 : 2;
}
return 0;
@@ -18561,36 +18143,36 @@ var ts;
}
function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) {
switch (container.kind) {
- case 225:
+ case 226:
return declareModuleMember(node, symbolFlags, symbolExcludes);
case 256:
return declareSourceFileMember(node, symbolFlags, symbolExcludes);
- case 192:
- case 221:
+ case 193:
+ case 222:
return declareClassMember(node, symbolFlags, symbolExcludes);
- case 224:
+ case 225:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
- case 159:
- case 171:
- case 222:
+ case 160:
+ case 172:
+ case 223:
case 265:
case 281:
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
- case 156:
case 157:
- case 151:
+ case 158:
case 152:
case 153:
- case 147:
- case 146:
+ case 154:
case 148:
+ case 147:
case 149:
case 150:
- case 220:
- case 179:
+ case 151:
+ case 221:
case 180:
+ case 181:
case 269:
- case 223:
+ case 224:
return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);
}
}
@@ -18606,10 +18188,10 @@ var ts;
}
function hasExportDeclarations(node) {
var body = node.kind === 256 ? node : node.body;
- if (body && (body.kind === 256 || body.kind === 226)) {
+ if (body && (body.kind === 256 || body.kind === 227)) {
for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {
var stat = _a[_i];
- if (stat.kind === 236 || stat.kind === 235) {
+ if (stat.kind === 237 || stat.kind === 236) {
return true;
}
}
@@ -18681,15 +18263,20 @@ var ts;
typeLiteralSymbol.members[symbol.name] = symbol;
}
function bindObjectLiteralExpression(node) {
+ var ElementKind;
+ (function (ElementKind) {
+ ElementKind[ElementKind["Property"] = 1] = "Property";
+ ElementKind[ElementKind["Accessor"] = 2] = "Accessor";
+ })(ElementKind || (ElementKind = {}));
if (inStrictMode) {
var seen = ts.createMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.name.kind !== 69) {
+ if (prop.name.kind !== 70) {
continue;
}
var identifier = prop.name;
- var currentKind = prop.kind === 253 || prop.kind === 254 || prop.kind === 147
+ var currentKind = prop.kind === 253 || prop.kind === 254 || prop.kind === 148
? 1
: 2;
var existingKind = seen[identifier.text];
@@ -18711,7 +18298,7 @@ var ts;
}
function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {
switch (blockScopeContainer.kind) {
- case 225:
+ case 226:
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
case 256:
@@ -18732,8 +18319,8 @@ var ts;
}
function checkStrictModeIdentifier(node) {
if (inStrictMode &&
- node.originalKeywordKind >= 106 &&
- node.originalKeywordKind <= 114 &&
+ node.originalKeywordKind >= 107 &&
+ node.originalKeywordKind <= 115 &&
!ts.isIdentifierName(node) &&
!ts.isInAmbientContext(node)) {
if (!file.parseDiagnostics.length) {
@@ -18761,17 +18348,17 @@ var ts;
}
}
function checkStrictModeDeleteExpression(node) {
- if (inStrictMode && node.expression.kind === 69) {
+ if (inStrictMode && node.expression.kind === 70) {
var span_2 = ts.getErrorSpanForNode(file, node.expression);
file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_2.start, span_2.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode));
}
}
function isEvalOrArgumentsIdentifier(node) {
- return node.kind === 69 &&
+ return node.kind === 70 &&
(node.text === "eval" || node.text === "arguments");
}
function checkStrictModeEvalOrArguments(contextNode, name) {
- if (name && name.kind === 69) {
+ if (name && name.kind === 70) {
var identifier = name;
if (isEvalOrArgumentsIdentifier(identifier)) {
var span_3 = ts.getErrorSpanForNode(file, name);
@@ -18805,7 +18392,7 @@ var ts;
function checkStrictModeFunctionDeclaration(node) {
if (languageVersion < 2) {
if (blockScopeContainer.kind !== 256 &&
- blockScopeContainer.kind !== 225 &&
+ blockScopeContainer.kind !== 226 &&
!ts.isFunctionLike(blockScopeContainer)) {
var errorSpan = ts.getErrorSpanForNode(file, node);
file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node)));
@@ -18824,7 +18411,7 @@ var ts;
}
function checkStrictModePrefixUnaryExpression(node) {
if (inStrictMode) {
- if (node.operator === 41 || node.operator === 42) {
+ if (node.operator === 42 || node.operator === 43) {
checkStrictModeEvalOrArguments(node, node.operand);
}
}
@@ -18848,7 +18435,7 @@ var ts;
node.parent = parent;
var saveInStrictMode = inStrictMode;
bindWorker(node);
- if (node.kind > 138) {
+ if (node.kind > 139) {
var saveParent = parent;
parent = node;
var containerFlags = getContainerFlags(node);
@@ -18885,18 +18472,18 @@ var ts;
}
function bindWorker(node) {
switch (node.kind) {
- case 69:
- case 97:
+ case 70:
+ case 98:
if (currentFlow && (ts.isExpression(node) || parent.kind === 254)) {
node.flowNode = currentFlow;
}
return checkStrictModeIdentifier(node);
- case 172:
+ case 173:
if (currentFlow && isNarrowableReference(node)) {
node.flowNode = currentFlow;
}
break;
- case 187:
+ case 188:
if (ts.isInJavaScriptFile(node)) {
var specialKind = ts.getSpecialPropertyAssignmentKind(node);
switch (specialKind) {
@@ -18921,30 +18508,30 @@ var ts;
return checkStrictModeBinaryExpression(node);
case 252:
return checkStrictModeCatchClause(node);
- case 181:
+ case 182:
return checkStrictModeDeleteExpression(node);
case 8:
return checkStrictModeNumericLiteral(node);
- case 186:
+ case 187:
return checkStrictModePostfixUnaryExpression(node);
- case 185:
+ case 186:
return checkStrictModePrefixUnaryExpression(node);
- case 212:
+ case 213:
return checkStrictModeWithStatement(node);
- case 165:
+ case 166:
seenThisKeyword = true;
return;
- case 154:
+ case 155:
return checkTypePredicate(node);
- case 141:
- return declareSymbolAndAddToSymbolTable(node, 262144, 530920);
case 142:
+ return declareSymbolAndAddToSymbolTable(node, 262144, 530920);
+ case 143:
return bindParameter(node);
- case 218:
- case 169:
+ case 219:
+ case 170:
return bindVariableDeclarationOrBindingElement(node);
+ case 146:
case 145:
- case 144:
case 266:
return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0);
case 280:
@@ -18957,82 +18544,82 @@ var ts;
case 247:
emitFlags |= 16384;
return;
- case 151:
case 152:
case 153:
+ case 154:
return declareSymbolAndAddToSymbolTable(node, 131072, 0);
+ case 148:
case 147:
- case 146:
return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263);
- case 220:
+ case 221:
return bindFunctionDeclaration(node);
- case 148:
- return declareSymbolAndAddToSymbolTable(node, 16384, 0);
case 149:
- return bindPropertyOrMethodOrAccessor(node, 32768, 41919);
+ return declareSymbolAndAddToSymbolTable(node, 16384, 0);
case 150:
+ return bindPropertyOrMethodOrAccessor(node, 32768, 41919);
+ case 151:
return bindPropertyOrMethodOrAccessor(node, 65536, 74687);
- case 156:
case 157:
+ case 158:
case 269:
return bindFunctionOrConstructorType(node);
- case 159:
+ case 160:
case 281:
case 265:
return bindAnonymousDeclaration(node, 2048, "__type");
- case 171:
+ case 172:
return bindObjectLiteralExpression(node);
- case 179:
case 180:
+ case 181:
return bindFunctionExpression(node);
- case 174:
+ case 175:
if (ts.isInJavaScriptFile(node)) {
bindCallExpression(node);
}
break;
- case 192:
- case 221:
+ case 193:
+ case 222:
inStrictMode = true;
return bindClassLikeDeclaration(node);
- case 222:
+ case 223:
return bindBlockScopedDeclaration(node, 64, 792968);
case 279:
- case 223:
- return bindBlockScopedDeclaration(node, 524288, 793064);
case 224:
- return bindEnumDeclaration(node);
+ return bindBlockScopedDeclaration(node, 524288, 793064);
case 225:
+ return bindEnumDeclaration(node);
+ case 226:
return bindModuleDeclaration(node);
- case 229:
- case 232:
- case 234:
- case 238:
+ case 230:
+ case 233:
+ case 235:
+ case 239:
return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608);
- case 228:
+ case 229:
return bindNamespaceExportDeclaration(node);
- case 231:
+ case 232:
return bindImportClause(node);
- case 236:
+ case 237:
return bindExportDeclaration(node);
- case 235:
+ case 236:
return bindExportAssignment(node);
case 256:
updateStrictModeStatementList(node.statements);
return bindSourceFileIfExternalModule();
- case 199:
+ case 200:
if (!ts.isFunctionLike(node.parent)) {
return;
}
- case 226:
+ case 227:
return updateStrictModeStatementList(node.statements);
}
}
function checkTypePredicate(node) {
var parameterName = node.parameterName, type = node.type;
- if (parameterName && parameterName.kind === 69) {
+ if (parameterName && parameterName.kind === 70) {
checkStrictModeIdentifier(parameterName);
}
- if (parameterName && parameterName.kind === 165) {
+ if (parameterName && parameterName.kind === 166) {
seenThisKeyword = true;
}
bind(type);
@@ -19051,7 +18638,7 @@ var ts;
bindAnonymousDeclaration(node, 8388608, getDeclarationName(node));
}
else {
- var flags = node.kind === 235 && ts.exportAssignmentIsAlias(node)
+ var flags = node.kind === 236 && ts.exportAssignmentIsAlias(node)
? 8388608
: 4;
declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16);
@@ -19095,7 +18682,9 @@ var ts;
function setCommonJsModuleIndicator(node) {
if (!file.commonJsModuleIndicator) {
file.commonJsModuleIndicator = node;
- bindSourceFileAsExternalModule();
+ if (!file.externalModuleIndicator) {
+ bindSourceFileAsExternalModule();
+ }
}
}
function bindExportsPropertyAssignment(node) {
@@ -19108,11 +18697,11 @@ var ts;
}
function bindThisPropertyAssignment(node) {
ts.Debug.assert(ts.isInJavaScriptFile(node));
- if (container.kind === 220 || container.kind === 179) {
+ if (container.kind === 221 || container.kind === 180) {
container.symbol.members = container.symbol.members || ts.createMap();
declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4);
}
- else if (container.kind === 148) {
+ else if (container.kind === 149) {
var saveContainer = container;
container = container.parent;
var symbol = bindPropertyOrMethodOrAccessor(node, 4, 0);
@@ -19152,7 +18741,7 @@ var ts;
emitFlags |= 2048;
}
}
- if (node.kind === 221) {
+ if (node.kind === 222) {
bindBlockScopedDeclaration(node, 32, 899519);
}
else {
@@ -19270,15 +18859,15 @@ var ts;
return false;
}
if (currentFlow === unreachableFlow) {
- var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 201) ||
- node.kind === 221 ||
- (node.kind === 225 && shouldReportErrorOnModuleDeclaration(node)) ||
- (node.kind === 224 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums));
+ var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 202) ||
+ node.kind === 222 ||
+ (node.kind === 226 && shouldReportErrorOnModuleDeclaration(node)) ||
+ (node.kind === 225 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums));
if (reportError) {
currentFlow = reportedUnreachableFlow;
var reportUnreachableCode = !options.allowUnreachableCode &&
!ts.isInAmbientContext(node) &&
- (node.kind !== 200 ||
+ (node.kind !== 201 ||
ts.getCombinedNodeFlags(node.declarationList) & 3 ||
ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; }));
if (reportUnreachableCode) {
@@ -19292,52 +18881,54 @@ var ts;
function computeTransformFlagsForNode(node, subtreeFlags) {
var kind = node.kind;
switch (kind) {
- case 174:
+ case 175:
return computeCallExpression(node, subtreeFlags);
- case 225:
+ case 176:
+ return computeNewExpression(node, subtreeFlags);
+ case 226:
return computeModuleDeclaration(node, subtreeFlags);
- case 178:
+ case 179:
return computeParenthesizedExpression(node, subtreeFlags);
- case 187:
+ case 188:
return computeBinaryExpression(node, subtreeFlags);
- case 202:
+ case 203:
return computeExpressionStatement(node, subtreeFlags);
- case 142:
+ case 143:
return computeParameter(node, subtreeFlags);
- case 180:
+ case 181:
return computeArrowFunction(node, subtreeFlags);
- case 179:
+ case 180:
return computeFunctionExpression(node, subtreeFlags);
- case 220:
+ case 221:
return computeFunctionDeclaration(node, subtreeFlags);
- case 218:
- return computeVariableDeclaration(node, subtreeFlags);
case 219:
+ return computeVariableDeclaration(node, subtreeFlags);
+ case 220:
return computeVariableDeclarationList(node, subtreeFlags);
- case 200:
+ case 201:
return computeVariableStatement(node, subtreeFlags);
- case 214:
+ case 215:
return computeLabeledStatement(node, subtreeFlags);
- case 221:
+ case 222:
return computeClassDeclaration(node, subtreeFlags);
- case 192:
+ case 193:
return computeClassExpression(node, subtreeFlags);
case 251:
return computeHeritageClause(node, subtreeFlags);
- case 194:
+ case 195:
return computeExpressionWithTypeArguments(node, subtreeFlags);
- case 148:
+ case 149:
return computeConstructor(node, subtreeFlags);
- case 145:
+ case 146:
return computePropertyDeclaration(node, subtreeFlags);
- case 147:
+ case 148:
return computeMethod(node, subtreeFlags);
- case 149:
case 150:
+ case 151:
return computeAccessor(node, subtreeFlags);
- case 229:
+ case 230:
return computeImportEquals(node, subtreeFlags);
- case 172:
+ case 173:
return computePropertyAccess(node, subtreeFlags);
default:
return computeOther(node, kind, subtreeFlags);
@@ -19348,40 +18939,54 @@ var ts;
var transformFlags = subtreeFlags;
var expression = node.expression;
var expressionKind = expression.kind;
- if (subtreeFlags & 262144
+ if (node.typeArguments) {
+ transformFlags |= 3;
+ }
+ if (subtreeFlags & 1048576
|| isSuperOrSuperProperty(expression, expressionKind)) {
- transformFlags |= 192;
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~537133909;
+ return transformFlags & ~537922901;
}
function isSuperOrSuperProperty(node, kind) {
switch (kind) {
- case 95:
+ case 96:
return true;
- case 172:
case 173:
+ case 174:
var expression = node.expression;
var expressionKind = expression.kind;
- return expressionKind === 95;
+ return expressionKind === 96;
}
return false;
}
+ function computeNewExpression(node, subtreeFlags) {
+ var transformFlags = subtreeFlags;
+ if (node.typeArguments) {
+ transformFlags |= 3;
+ }
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 768;
+ }
+ node.transformFlags = transformFlags | 536870912;
+ return transformFlags & ~537922901;
+ }
function computeBinaryExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
- if (operatorTokenKind === 56
- && (leftKind === 171
- || leftKind === 170)) {
- transformFlags |= 192 | 256;
+ if (operatorTokenKind === 57
+ && (leftKind === 172
+ || leftKind === 171)) {
+ transformFlags |= 768 | 1024;
}
- else if (operatorTokenKind === 38
- || operatorTokenKind === 60) {
- transformFlags |= 48;
+ else if (operatorTokenKind === 39
+ || operatorTokenKind === 61) {
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeParameter(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -19389,35 +18994,35 @@ var ts;
var name = node.name;
var initializer = node.initializer;
var dotDotDotToken = node.dotDotDotToken;
- if (node.questionToken) {
- transformFlags |= 3;
- }
- if (subtreeFlags & 2048 || ts.isThisIdentifier(name)) {
+ if (node.questionToken
+ || node.type
+ || subtreeFlags & 8192
+ || ts.isThisIdentifier(name)) {
transformFlags |= 3;
}
if (modifierFlags & 92) {
- transformFlags |= 3 | 131072;
+ transformFlags |= 3 | 524288;
}
- if (subtreeFlags & 2097152 || initializer || dotDotDotToken) {
- transformFlags |= 192 | 65536;
+ if (subtreeFlags & 8388608 || initializer || dotDotDotToken) {
+ transformFlags |= 768 | 262144;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~538968917;
+ return transformFlags & ~545262933;
}
function computeParenthesizedExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var expression = node.expression;
var expressionKind = expression.kind;
var expressionTransformFlags = expression.transformFlags;
- if (expressionKind === 195
- || expressionKind === 177) {
+ if (expressionKind === 196
+ || expressionKind === 178) {
transformFlags |= 3;
}
- if (expressionTransformFlags & 256) {
- transformFlags |= 256;
+ if (expressionTransformFlags & 1024) {
+ transformFlags |= 1024;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeClassDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -19426,36 +19031,38 @@ var ts;
transformFlags = 3;
}
else {
- transformFlags = subtreeFlags | 192;
- if ((subtreeFlags & 137216)
- || (modifierFlags & 1)) {
+ transformFlags = subtreeFlags | 768;
+ if ((subtreeFlags & 548864)
+ || (modifierFlags & 1)
+ || node.typeParameters) {
transformFlags |= 3;
}
- if (subtreeFlags & 32768) {
- transformFlags |= 8192;
+ if (subtreeFlags & 131072) {
+ transformFlags |= 32768;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~537590613;
+ return transformFlags & ~539749717;
}
function computeClassExpression(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 192;
- if (subtreeFlags & 137216) {
+ var transformFlags = subtreeFlags | 768;
+ if (subtreeFlags & 548864
+ || node.typeParameters) {
transformFlags |= 3;
}
- if (subtreeFlags & 32768) {
- transformFlags |= 8192;
+ if (subtreeFlags & 131072) {
+ transformFlags |= 32768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~537590613;
+ return transformFlags & ~539749717;
}
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
- case 83:
- transformFlags |= 192;
+ case 84:
+ transformFlags |= 768;
break;
- case 106:
+ case 107:
transformFlags |= 3;
break;
default:
@@ -19463,135 +19070,148 @@ var ts;
break;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeExpressionWithTypeArguments(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 192;
+ var transformFlags = subtreeFlags | 768;
if (node.typeArguments) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeConstructor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- var body = node.body;
- if (body === undefined) {
+ if (ts.hasModifier(node, 2270)
+ || !node.body) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550593365;
+ return transformFlags & ~591760725;
}
function computeMethod(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 192;
- var modifierFlags = ts.getModifierFlags(node);
- var body = node.body;
- var typeParameters = node.typeParameters;
- var asteriskToken = node.asteriskToken;
- if (!body
- || typeParameters
- || (modifierFlags & (256 | 128))
- || (subtreeFlags & 2048)) {
+ var transformFlags = subtreeFlags | 768;
+ if (node.decorators
+ || ts.hasModifier(node, 2270)
+ || node.typeParameters
+ || node.type
+ || !node.body) {
transformFlags |= 3;
}
- if (asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 1536;
+ if (ts.hasModifier(node, 256)) {
+ transformFlags |= 48;
+ }
+ if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
+ transformFlags |= 6144;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550593365;
+ return transformFlags & ~591760725;
}
function computeAccessor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- var modifierFlags = ts.getModifierFlags(node);
- var body = node.body;
- if (!body
- || (modifierFlags & (256 | 128))
- || (subtreeFlags & 2048)) {
+ if (node.decorators
+ || ts.hasModifier(node, 2270)
+ || node.type
+ || !node.body) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550593365;
+ return transformFlags & ~591760725;
}
function computePropertyDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags | 3;
if (node.initializer) {
- transformFlags |= 4096;
+ transformFlags |= 16384;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeFunctionDeclaration(node, subtreeFlags) {
var transformFlags;
var modifierFlags = ts.getModifierFlags(node);
var body = node.body;
- var asteriskToken = node.asteriskToken;
if (!body || (modifierFlags & 2)) {
transformFlags = 3;
}
else {
- transformFlags = subtreeFlags | 8388608;
+ transformFlags = subtreeFlags | 33554432;
if (modifierFlags & 1) {
- transformFlags |= 3 | 192;
+ transformFlags |= 3 | 768;
}
- if (modifierFlags & 256) {
+ if (modifierFlags & 2270
+ || node.typeParameters
+ || node.type) {
transformFlags |= 3;
}
- if (subtreeFlags & 81920) {
- transformFlags |= 192;
+ if (modifierFlags & 256) {
+ transformFlags |= 48;
+ }
+ if (subtreeFlags & 327680) {
+ transformFlags |= 768;
}
- if (asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 1536;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
+ transformFlags |= 6144;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550726485;
+ return transformFlags & ~592293205;
}
function computeFunctionExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- var modifierFlags = ts.getModifierFlags(node);
- var asteriskToken = node.asteriskToken;
- if (modifierFlags & 256) {
+ if (ts.hasModifier(node, 2270)
+ || node.typeParameters
+ || node.type) {
transformFlags |= 3;
}
- if (subtreeFlags & 81920) {
- transformFlags |= 192;
+ if (ts.hasModifier(node, 256)) {
+ transformFlags |= 48;
+ }
+ if (subtreeFlags & 327680) {
+ transformFlags |= 768;
}
- if (asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 1536;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
+ transformFlags |= 6144;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550726485;
+ return transformFlags & ~592293205;
}
function computeArrowFunction(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 192;
- var modifierFlags = ts.getModifierFlags(node);
- if (modifierFlags & 256) {
+ var transformFlags = subtreeFlags | 768;
+ if (ts.hasModifier(node, 2270)
+ || node.typeParameters
+ || node.type) {
transformFlags |= 3;
}
- if (subtreeFlags & 8192) {
- transformFlags |= 16384;
+ if (ts.hasModifier(node, 256)) {
+ transformFlags |= 48;
+ }
+ if (subtreeFlags & 32768) {
+ transformFlags |= 65536;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~550710101;
+ return transformFlags & ~592227669;
}
function computePropertyAccess(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var expression = node.expression;
var expressionKind = expression.kind;
- if (expressionKind === 95) {
- transformFlags |= 8192;
+ if (expressionKind === 96) {
+ transformFlags |= 32768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeVariableDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var nameKind = node.name.kind;
- if (nameKind === 167 || nameKind === 168) {
- transformFlags |= 192 | 2097152;
+ if (nameKind === 168 || nameKind === 169) {
+ transformFlags |= 768 | 8388608;
+ }
+ if (node.type) {
+ transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeVariableStatement(node, subtreeFlags) {
var transformFlags;
@@ -19603,23 +19223,23 @@ var ts;
else {
transformFlags = subtreeFlags;
if (modifierFlags & 1) {
- transformFlags |= 192 | 3;
+ transformFlags |= 768 | 3;
}
- if (declarationListTransformFlags & 2097152) {
- transformFlags |= 192;
+ if (declarationListTransformFlags & 8388608) {
+ transformFlags |= 768;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeLabeledStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (subtreeFlags & 1048576
+ if (subtreeFlags & 4194304
&& ts.isIterationStatement(node, true)) {
- transformFlags |= 192;
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeImportEquals(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -19627,15 +19247,15 @@ var ts;
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeExpressionStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (node.expression.transformFlags & 256) {
- transformFlags |= 192;
+ if (node.expression.transformFlags & 1024) {
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536871765;
+ return transformFlags & ~536874325;
}
function computeModuleDeclaration(node, subtreeFlags) {
var transformFlags = 3;
@@ -19644,77 +19264,78 @@ var ts;
transformFlags |= subtreeFlags;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~546335573;
+ return transformFlags & ~574729557;
}
function computeVariableDeclarationList(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 8388608;
- if (subtreeFlags & 2097152) {
- transformFlags |= 192;
+ var transformFlags = subtreeFlags | 33554432;
+ if (subtreeFlags & 8388608) {
+ transformFlags |= 768;
}
if (node.flags & 3) {
- transformFlags |= 192 | 1048576;
+ transformFlags |= 768 | 4194304;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~538968917;
+ return transformFlags & ~545262933;
}
function computeOther(node, kind, subtreeFlags) {
var transformFlags = subtreeFlags;
- var excludeFlags = 536871765;
+ var excludeFlags = 536874325;
switch (kind) {
- case 112:
- case 110:
+ case 119:
+ case 185:
+ transformFlags |= 48;
+ break;
+ case 113:
case 111:
- case 115:
- case 122:
- case 118:
- case 74:
- case 184:
- case 224:
+ case 112:
+ case 116:
+ case 123:
+ case 75:
+ case 225:
case 255:
- case 177:
- case 195:
+ case 178:
case 196:
- case 128:
+ case 197:
+ case 129:
transformFlags |= 3;
break;
- case 241:
case 242:
case 243:
case 244:
+ case 10:
case 245:
case 246:
case 247:
case 248:
transformFlags |= 12;
break;
- case 82:
- transformFlags |= 192 | 3;
+ case 83:
+ transformFlags |= 768 | 3;
break;
- case 77:
- case 11:
+ case 78:
case 12:
case 13:
case 14:
- case 189:
- case 176:
+ case 15:
+ case 190:
+ case 177:
case 254:
- case 208:
- transformFlags |= 192;
+ case 209:
+ transformFlags |= 768;
break;
- case 190:
- transformFlags |= 192 | 4194304;
+ case 191:
+ transformFlags |= 768 | 16777216;
break;
- case 117:
- case 130:
- case 127:
- case 132:
- case 120:
+ case 118:
+ case 131:
+ case 128:
case 133:
- case 103:
- case 141:
- case 144:
- case 146:
- case 151:
+ case 121:
+ case 134:
+ case 104:
+ case 142:
+ case 145:
+ case 147:
case 152:
case 153:
case 154:
@@ -19728,68 +19349,69 @@ var ts;
case 162:
case 163:
case 164:
- case 222:
- case 223:
case 165:
+ case 223:
+ case 224:
case 166:
+ case 167:
transformFlags = 3;
excludeFlags = -3;
break;
- case 140:
- transformFlags |= 524288;
- if (subtreeFlags & 8192) {
- transformFlags |= 32768;
+ case 141:
+ transformFlags |= 2097152;
+ if (subtreeFlags & 32768) {
+ transformFlags |= 131072;
}
break;
- case 191:
- transformFlags |= 262144;
+ case 192:
+ transformFlags |= 1048576;
break;
- case 95:
- transformFlags |= 192;
+ case 96:
+ transformFlags |= 768;
break;
- case 97:
- transformFlags |= 8192;
+ case 98:
+ transformFlags |= 32768;
break;
- case 167:
case 168:
- transformFlags |= 192 | 2097152;
+ case 169:
+ transformFlags |= 768 | 8388608;
break;
- case 143:
- transformFlags |= 3 | 2048;
+ case 144:
+ transformFlags |= 3 | 8192;
break;
- case 171:
- excludeFlags = 537430869;
- if (subtreeFlags & 524288) {
- transformFlags |= 192;
+ case 172:
+ excludeFlags = 539110741;
+ if (subtreeFlags & 2097152) {
+ transformFlags |= 768;
}
- if (subtreeFlags & 32768) {
- transformFlags |= 8192;
+ if (subtreeFlags & 131072) {
+ transformFlags |= 32768;
}
break;
- case 170:
- case 175:
- excludeFlags = 537133909;
- if (subtreeFlags & 262144) {
- transformFlags |= 192;
+ case 171:
+ case 176:
+ excludeFlags = 537922901;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 768;
}
break;
- case 204:
case 205:
case 206:
case 207:
- if (subtreeFlags & 1048576) {
- transformFlags |= 192;
+ case 208:
+ if (subtreeFlags & 4194304) {
+ transformFlags |= 768;
}
break;
case 256:
- if (subtreeFlags & 16384) {
- transformFlags |= 192;
+ if (subtreeFlags & 65536) {
+ transformFlags |= 768;
}
break;
- case 211:
- case 209:
+ case 212:
case 210:
- transformFlags |= 8388608;
+ case 211:
+ transformFlags |= 33554432;
break;
}
node.transformFlags = transformFlags | 536870912;
@@ -19889,6 +19511,7 @@ var ts;
var intersectionTypes = ts.createMap();
var stringLiteralTypes = ts.createMap();
var numericLiteralTypes = ts.createMap();
+ var evolvingArrayTypes = [];
var unknownSymbol = createSymbol(4 | 67108864, "unknown");
var resolvingSymbol = createSymbol(67108864, "__resolving__");
var anyType = createIntrinsicType(1, "any");
@@ -19932,6 +19555,7 @@ var ts;
var globalBooleanType;
var globalRegExpType;
var anyArrayType;
+ var autoArrayType;
var anyReadonlyArrayType;
var getGlobalTemplateStringsArrayType;
var getGlobalESSymbolType;
@@ -19972,6 +19596,66 @@ var ts;
var potentialThisCollisions = [];
var awaitedTypeStack = [];
var diagnostics = ts.createDiagnosticCollection();
+ var TypeFacts;
+ (function (TypeFacts) {
+ TypeFacts[TypeFacts["None"] = 0] = "None";
+ TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
+ TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
+ TypeFacts[TypeFacts["TypeofEQBoolean"] = 4] = "TypeofEQBoolean";
+ TypeFacts[TypeFacts["TypeofEQSymbol"] = 8] = "TypeofEQSymbol";
+ TypeFacts[TypeFacts["TypeofEQObject"] = 16] = "TypeofEQObject";
+ TypeFacts[TypeFacts["TypeofEQFunction"] = 32] = "TypeofEQFunction";
+ TypeFacts[TypeFacts["TypeofEQHostObject"] = 64] = "TypeofEQHostObject";
+ TypeFacts[TypeFacts["TypeofNEString"] = 128] = "TypeofNEString";
+ TypeFacts[TypeFacts["TypeofNENumber"] = 256] = "TypeofNENumber";
+ TypeFacts[TypeFacts["TypeofNEBoolean"] = 512] = "TypeofNEBoolean";
+ TypeFacts[TypeFacts["TypeofNESymbol"] = 1024] = "TypeofNESymbol";
+ TypeFacts[TypeFacts["TypeofNEObject"] = 2048] = "TypeofNEObject";
+ TypeFacts[TypeFacts["TypeofNEFunction"] = 4096] = "TypeofNEFunction";
+ TypeFacts[TypeFacts["TypeofNEHostObject"] = 8192] = "TypeofNEHostObject";
+ TypeFacts[TypeFacts["EQUndefined"] = 16384] = "EQUndefined";
+ TypeFacts[TypeFacts["EQNull"] = 32768] = "EQNull";
+ TypeFacts[TypeFacts["EQUndefinedOrNull"] = 65536] = "EQUndefinedOrNull";
+ TypeFacts[TypeFacts["NEUndefined"] = 131072] = "NEUndefined";
+ TypeFacts[TypeFacts["NENull"] = 262144] = "NENull";
+ TypeFacts[TypeFacts["NEUndefinedOrNull"] = 524288] = "NEUndefinedOrNull";
+ TypeFacts[TypeFacts["Truthy"] = 1048576] = "Truthy";
+ TypeFacts[TypeFacts["Falsy"] = 2097152] = "Falsy";
+ TypeFacts[TypeFacts["Discriminatable"] = 4194304] = "Discriminatable";
+ TypeFacts[TypeFacts["All"] = 8388607] = "All";
+ TypeFacts[TypeFacts["BaseStringStrictFacts"] = 933633] = "BaseStringStrictFacts";
+ TypeFacts[TypeFacts["BaseStringFacts"] = 3145473] = "BaseStringFacts";
+ TypeFacts[TypeFacts["StringStrictFacts"] = 4079361] = "StringStrictFacts";
+ TypeFacts[TypeFacts["StringFacts"] = 4194049] = "StringFacts";
+ TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 3030785] = "EmptyStringStrictFacts";
+ TypeFacts[TypeFacts["EmptyStringFacts"] = 3145473] = "EmptyStringFacts";
+ TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 1982209] = "NonEmptyStringStrictFacts";
+ TypeFacts[TypeFacts["NonEmptyStringFacts"] = 4194049] = "NonEmptyStringFacts";
+ TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 933506] = "BaseNumberStrictFacts";
+ TypeFacts[TypeFacts["BaseNumberFacts"] = 3145346] = "BaseNumberFacts";
+ TypeFacts[TypeFacts["NumberStrictFacts"] = 4079234] = "NumberStrictFacts";
+ TypeFacts[TypeFacts["NumberFacts"] = 4193922] = "NumberFacts";
+ TypeFacts[TypeFacts["ZeroStrictFacts"] = 3030658] = "ZeroStrictFacts";
+ TypeFacts[TypeFacts["ZeroFacts"] = 3145346] = "ZeroFacts";
+ TypeFacts[TypeFacts["NonZeroStrictFacts"] = 1982082] = "NonZeroStrictFacts";
+ TypeFacts[TypeFacts["NonZeroFacts"] = 4193922] = "NonZeroFacts";
+ TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 933252] = "BaseBooleanStrictFacts";
+ TypeFacts[TypeFacts["BaseBooleanFacts"] = 3145092] = "BaseBooleanFacts";
+ TypeFacts[TypeFacts["BooleanStrictFacts"] = 4078980] = "BooleanStrictFacts";
+ TypeFacts[TypeFacts["BooleanFacts"] = 4193668] = "BooleanFacts";
+ TypeFacts[TypeFacts["FalseStrictFacts"] = 3030404] = "FalseStrictFacts";
+ TypeFacts[TypeFacts["FalseFacts"] = 3145092] = "FalseFacts";
+ TypeFacts[TypeFacts["TrueStrictFacts"] = 1981828] = "TrueStrictFacts";
+ TypeFacts[TypeFacts["TrueFacts"] = 4193668] = "TrueFacts";
+ TypeFacts[TypeFacts["SymbolStrictFacts"] = 1981320] = "SymbolStrictFacts";
+ TypeFacts[TypeFacts["SymbolFacts"] = 4193160] = "SymbolFacts";
+ TypeFacts[TypeFacts["ObjectStrictFacts"] = 6166480] = "ObjectStrictFacts";
+ TypeFacts[TypeFacts["ObjectFacts"] = 8378320] = "ObjectFacts";
+ TypeFacts[TypeFacts["FunctionStrictFacts"] = 6164448] = "FunctionStrictFacts";
+ TypeFacts[TypeFacts["FunctionFacts"] = 8376288] = "FunctionFacts";
+ TypeFacts[TypeFacts["UndefinedFacts"] = 2457472] = "UndefinedFacts";
+ TypeFacts[TypeFacts["NullFacts"] = 2340752] = "NullFacts";
+ })(TypeFacts || (TypeFacts = {}));
var typeofEQFacts = ts.createMap({
"string": 1,
"number": 2,
@@ -20014,6 +19698,13 @@ var ts;
var identityRelation = ts.createMap();
var enumRelation = ts.createMap();
var _displayBuilder;
+ var TypeSystemPropertyName;
+ (function (TypeSystemPropertyName) {
+ TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
+ TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
+ })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
var builtinGlobals = ts.createMap();
builtinGlobals[undefinedSymbol.name] = undefinedSymbol;
initializeTypeChecker();
@@ -20098,7 +19789,7 @@ var ts;
target.flags |= source.flags;
if (source.valueDeclaration &&
(!target.valueDeclaration ||
- (target.valueDeclaration.kind === 225 && source.valueDeclaration.kind !== 225))) {
+ (target.valueDeclaration.kind === 226 && source.valueDeclaration.kind !== 226))) {
target.valueDeclaration = source.valueDeclaration;
}
ts.forEach(source.declarations, function (node) {
@@ -20233,24 +19924,24 @@ var ts;
return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile);
}
if (declaration.pos <= usage.pos) {
- return declaration.kind !== 218 ||
+ return declaration.kind !== 219 ||
!isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
}
return isUsedInFunctionOrNonStaticProperty(declaration, usage);
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
var container = ts.getEnclosingBlockScopeContainer(declaration);
switch (declaration.parent.parent.kind) {
- case 200:
- case 206:
- case 208:
+ case 201:
+ case 207:
+ case 209:
if (isSameScopeDescendentOf(usage, declaration, container)) {
return true;
}
break;
}
switch (declaration.parent.parent.kind) {
- case 207:
case 208:
+ case 209:
if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) {
return true;
}
@@ -20268,7 +19959,7 @@ var ts;
return true;
}
var initializerOfNonStaticProperty = current.parent &&
- current.parent.kind === 145 &&
+ current.parent.kind === 146 &&
(ts.getModifierFlags(current.parent) & 32) === 0 &&
current.parent.initializer === current;
if (initializerOfNonStaticProperty) {
@@ -20294,15 +19985,15 @@ var ts;
if (meaning & result.flags & 793064 && lastLocation.kind !== 273) {
useResult = result.flags & 262144
? lastLocation === location.type ||
- lastLocation.kind === 142 ||
- lastLocation.kind === 141
+ lastLocation.kind === 143 ||
+ lastLocation.kind === 142
: false;
}
if (meaning & 107455 && result.flags & 1) {
useResult =
- lastLocation.kind === 142 ||
+ lastLocation.kind === 143 ||
(lastLocation === location.type &&
- result.valueDeclaration.kind === 142);
+ result.valueDeclaration.kind === 143);
}
}
if (useResult) {
@@ -20318,7 +20009,7 @@ var ts;
if (!ts.isExternalOrCommonJsModule(location))
break;
isInExternalModule = true;
- case 225:
+ case 226:
var moduleExports = getSymbolOfNode(location).exports;
if (location.kind === 256 || ts.isAmbientModule(location)) {
if (result = moduleExports["default"]) {
@@ -20330,7 +20021,7 @@ var ts;
}
if (moduleExports[name] &&
moduleExports[name].flags === 8388608 &&
- ts.getDeclarationOfKind(moduleExports[name], 238)) {
+ ts.getDeclarationOfKind(moduleExports[name], 239)) {
break;
}
}
@@ -20338,13 +20029,13 @@ var ts;
break loop;
}
break;
- case 224:
+ case 225:
if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) {
break loop;
}
break;
+ case 146:
case 145:
- case 144:
if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
@@ -20354,9 +20045,9 @@ var ts;
}
}
break;
- case 221:
- case 192:
case 222:
+ case 193:
+ case 223:
if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) {
if (lastLocation && ts.getModifierFlags(lastLocation) & 32) {
error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
@@ -20364,7 +20055,7 @@ var ts;
}
break loop;
}
- if (location.kind === 192 && meaning & 32) {
+ if (location.kind === 193 && meaning & 32) {
var className = location.name;
if (className && name === className.text) {
result = location.symbol;
@@ -20372,28 +20063,28 @@ var ts;
}
}
break;
- case 140:
+ case 141:
grandparent = location.parent.parent;
- if (ts.isClassLike(grandparent) || grandparent.kind === 222) {
+ if (ts.isClassLike(grandparent) || grandparent.kind === 223) {
if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
return undefined;
}
}
break;
- case 147:
- case 146:
case 148:
+ case 147:
case 149:
case 150:
- case 220:
- case 180:
+ case 151:
+ case 221:
+ case 181:
if (meaning & 3 && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
- case 179:
+ case 180:
if (meaning & 3 && name === "arguments") {
result = argumentsSymbol;
break loop;
@@ -20406,8 +20097,8 @@ var ts;
}
}
break;
- case 143:
- if (location.parent && location.parent.kind === 142) {
+ case 144:
+ if (location.parent && location.parent.kind === 143) {
location = location.parent;
}
if (location.parent && ts.isClassElement(location.parent)) {
@@ -20449,7 +20140,7 @@ var ts;
}
if (result && isInExternalModule && (meaning & 107455) === 107455) {
var decls = result.declarations;
- if (decls && decls.length === 1 && decls[0].kind === 228) {
+ if (decls && decls.length === 1 && decls[0].kind === 229) {
error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name);
}
}
@@ -20457,7 +20148,7 @@ var ts;
return result;
}
function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {
- if ((errorLocation.kind === 69 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) {
+ if ((errorLocation.kind === 70 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) {
return false;
}
var container = ts.getThisContainer(errorLocation, true);
@@ -20495,10 +20186,10 @@ var ts;
}
function getEntityNameForExtendingInterface(node) {
switch (node.kind) {
- case 69:
- case 172:
+ case 70:
+ case 173:
return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;
- case 194:
+ case 195:
ts.Debug.assert(ts.isEntityNameExpression(node.expression));
return node.expression;
default:
@@ -20519,7 +20210,7 @@ var ts;
ts.Debug.assert((result.flags & 2) !== 0);
var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; });
ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
- if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 218), errorLocation)) {
+ if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 219), errorLocation)) {
error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name));
}
}
@@ -20536,10 +20227,10 @@ var ts;
}
function getAnyImportSyntax(node) {
if (ts.isAliasSymbolDeclaration(node)) {
- if (node.kind === 229) {
+ if (node.kind === 230) {
return node;
}
- while (node && node.kind !== 230) {
+ while (node && node.kind !== 231) {
node = node.parent;
}
return node;
@@ -20549,10 +20240,10 @@ var ts;
return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });
}
function getTargetOfImportEqualsDeclaration(node) {
- if (node.moduleReference.kind === 240) {
+ if (node.moduleReference.kind === 241) {
return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));
}
- return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node);
+ return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference);
}
function getTargetOfImportClause(node) {
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
@@ -20610,28 +20301,28 @@ var ts;
var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);
if (targetSymbol) {
- var name_16 = specifier.propertyName || specifier.name;
- if (name_16.text) {
+ var name_13 = specifier.propertyName || specifier.name;
+ if (name_13.text) {
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
return moduleSymbol;
}
var symbolFromVariable = void 0;
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) {
- symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text);
+ symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_13.text);
}
else {
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text);
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, name_13.text);
}
symbolFromVariable = resolveSymbol(symbolFromVariable);
- var symbolFromModule = getExportOfModule(targetSymbol, name_16.text);
- if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") {
+ var symbolFromModule = getExportOfModule(targetSymbol, name_13.text);
+ if (!symbolFromModule && allowSyntheticDefaultImports && name_13.text === "default") {
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);
}
var symbol = symbolFromModule && symbolFromVariable ?
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
symbolFromModule || symbolFromVariable;
if (!symbol) {
- error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16));
+ error(name_13, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_13));
}
return symbol;
}
@@ -20653,19 +20344,19 @@ var ts;
}
function getTargetOfAliasDeclaration(node) {
switch (node.kind) {
- case 229:
+ case 230:
return getTargetOfImportEqualsDeclaration(node);
- case 231:
- return getTargetOfImportClause(node);
case 232:
+ return getTargetOfImportClause(node);
+ case 233:
return getTargetOfNamespaceImport(node);
- case 234:
+ case 235:
return getTargetOfImportSpecifier(node);
- case 238:
+ case 239:
return getTargetOfExportSpecifier(node);
- case 235:
+ case 236:
return getTargetOfExportAssignment(node);
- case 228:
+ case 229:
return getTargetOfNamespaceExportDeclaration(node);
}
}
@@ -20709,10 +20400,10 @@ var ts;
links.referenced = true;
var node = getDeclarationOfAliasSymbol(symbol);
ts.Debug.assert(!!node);
- if (node.kind === 235) {
+ if (node.kind === 236) {
checkExpressionCached(node.expression);
}
- else if (node.kind === 238) {
+ else if (node.kind === 239) {
checkExpressionCached(node.propertyName || node.name);
}
else if (ts.isInternalModuleImportEqualsDeclaration(node)) {
@@ -20720,15 +20411,15 @@ var ts;
}
}
}
- function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration, dontResolveAlias) {
- if (entityName.kind === 69 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
+ function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
+ if (entityName.kind === 70 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
- if (entityName.kind === 69 || entityName.parent.kind === 139) {
+ if (entityName.kind === 70 || entityName.parent.kind === 140) {
return resolveEntityName(entityName, 1920, false, dontResolveAlias);
}
else {
- ts.Debug.assert(entityName.parent.kind === 229);
+ ts.Debug.assert(entityName.parent.kind === 230);
return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias);
}
}
@@ -20740,16 +20431,16 @@ var ts;
return undefined;
}
var symbol;
- if (name.kind === 69) {
+ if (name.kind === 70) {
var message = meaning === 1920 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
symbol = resolveName(location || name, name.text, meaning, ignoreErrors ? undefined : message, name);
if (!symbol) {
return undefined;
}
}
- else if (name.kind === 139 || name.kind === 172) {
- var left = name.kind === 139 ? name.left : name.expression;
- var right = name.kind === 139 ? name.right : name.name;
+ else if (name.kind === 140 || name.kind === 173) {
+ var left = name.kind === 140 ? name.left : name.expression;
+ var right = name.kind === 140 ? name.right : name.name;
var namespace = resolveEntityName(left, 1920, ignoreErrors, false, location);
if (!namespace || ts.nodeIsMissing(right)) {
return undefined;
@@ -20932,7 +20623,7 @@ var ts;
var members = node.members;
for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
var member = members_1[_i];
- if (member.kind === 148 && ts.nodeIsPresent(member.body)) {
+ if (member.kind === 149 && ts.nodeIsPresent(member.body)) {
return member;
}
}
@@ -21006,7 +20697,7 @@ var ts;
if (!ts.isExternalOrCommonJsModule(location_1)) {
break;
}
- case 225:
+ case 226:
if (result = callback(getSymbolOfNode(location_1).exports)) {
return result;
}
@@ -21039,7 +20730,7 @@ var ts;
return ts.forEachProperty(symbols, function (symbolFromSymbolTable) {
if (symbolFromSymbolTable.flags & 8388608
&& symbolFromSymbolTable.name !== "export="
- && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238)) {
+ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 239)) {
if (!useOnlyExternalAliasing ||
ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) {
var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
@@ -21070,7 +20761,7 @@ var ts;
if (symbolFromSymbolTable === symbol) {
return true;
}
- symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
+ symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 239)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
if (symbolFromSymbolTable.flags & meaning) {
qualify = true;
return true;
@@ -21084,10 +20775,10 @@ var ts;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
switch (declaration.kind) {
- case 145:
- case 147:
- case 149:
+ case 146:
+ case 148:
case 150:
+ case 151:
continue;
default:
return false;
@@ -21109,7 +20800,7 @@ var ts;
return {
accessibility: 1,
errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),
- errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1920) : undefined
+ errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1920) : undefined,
};
}
return hasAccessibleDeclarations;
@@ -21130,7 +20821,7 @@ var ts;
}
return {
accessibility: 1,
- errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning)
+ errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),
};
}
return { accessibility: 0 };
@@ -21177,11 +20868,11 @@ var ts;
}
function isEntityNameVisible(entityName, enclosingDeclaration) {
var meaning;
- if (entityName.parent.kind === 158 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
+ if (entityName.parent.kind === 159 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
meaning = 107455 | 1048576;
}
- else if (entityName.kind === 139 || entityName.kind === 172 ||
- entityName.parent.kind === 229) {
+ else if (entityName.kind === 140 || entityName.kind === 173 ||
+ entityName.parent.kind === 230) {
meaning = 1920;
}
else {
@@ -21273,10 +20964,10 @@ var ts;
function getTypeAliasForTypeLiteral(type) {
if (type.symbol && type.symbol.flags & 2048) {
var node = type.symbol.declarations[0].parent;
- while (node.kind === 164) {
+ while (node.kind === 165) {
node = node.parent;
}
- if (node.kind === 223) {
+ if (node.kind === 224) {
return getSymbolOfNode(node);
}
}
@@ -21284,7 +20975,7 @@ var ts;
}
function isTopLevelInExternalModuleAugmentation(node) {
return node && node.parent &&
- node.parent.kind === 226 &&
+ node.parent.kind === 227 &&
ts.isExternalModuleAugmentation(node.parent.parent);
}
function literalTypeToString(type) {
@@ -21298,10 +20989,10 @@ var ts;
return ts.declarationNameToString(declaration.name);
}
switch (declaration.kind) {
- case 192:
+ case 193:
return "(Anonymous class)";
- case 179:
case 180:
+ case 181:
return "(Anonymous function)";
}
}
@@ -21315,17 +21006,17 @@ var ts;
var firstChar = symbolName.charCodeAt(0);
var needsElementAccess = !ts.isIdentifierStart(firstChar, languageVersion);
if (needsElementAccess) {
- writePunctuation(writer, 19);
+ writePunctuation(writer, 20);
if (ts.isSingleOrDoubleQuote(firstChar)) {
writer.writeStringLiteral(symbolName);
}
else {
writer.writeSymbol(symbolName, symbol);
}
- writePunctuation(writer, 20);
+ writePunctuation(writer, 21);
}
else {
- writePunctuation(writer, 21);
+ writePunctuation(writer, 22);
writer.writeSymbol(symbolName, symbol);
}
}
@@ -21401,7 +21092,7 @@ var ts;
}
else if (type.flags & 256) {
buildSymbolDisplay(getParentOfSymbol(type.symbol), writer, enclosingDeclaration, 793064, 0, nextFlags);
- writePunctuation(writer, 21);
+ writePunctuation(writer, 22);
appendSymbolNameOnly(type.symbol, writer);
}
else if (type.flags & (32768 | 65536 | 16 | 16384)) {
@@ -21422,23 +21113,23 @@ var ts;
writer.writeStringLiteral(literalTypeToString(type));
}
else {
- writePunctuation(writer, 15);
+ writePunctuation(writer, 16);
writeSpace(writer);
- writePunctuation(writer, 22);
+ writePunctuation(writer, 23);
writeSpace(writer);
- writePunctuation(writer, 16);
+ writePunctuation(writer, 17);
}
}
function writeTypeList(types, delimiter) {
for (var i = 0; i < types.length; i++) {
if (i > 0) {
- if (delimiter !== 24) {
+ if (delimiter !== 25) {
writeSpace(writer);
}
writePunctuation(writer, delimiter);
writeSpace(writer);
}
- writeType(types[i], delimiter === 24 ? 0 : 64);
+ writeType(types[i], delimiter === 25 ? 0 : 64);
}
}
function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) {
@@ -21446,29 +21137,29 @@ var ts;
buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793064, 0, flags);
}
if (pos < end) {
- writePunctuation(writer, 25);
+ writePunctuation(writer, 26);
writeType(typeArguments[pos], 256);
pos++;
while (pos < end) {
- writePunctuation(writer, 24);
+ writePunctuation(writer, 25);
writeSpace(writer);
writeType(typeArguments[pos], 0);
pos++;
}
- writePunctuation(writer, 27);
+ writePunctuation(writer, 28);
}
}
function writeTypeReference(type, flags) {
var typeArguments = type.typeArguments || emptyArray;
if (type.target === globalArrayType && !(flags & 1)) {
writeType(typeArguments[0], 64);
- writePunctuation(writer, 19);
writePunctuation(writer, 20);
+ writePunctuation(writer, 21);
}
else if (type.target.flags & 262144) {
- writePunctuation(writer, 19);
- writeTypeList(type.typeArguments.slice(0, getTypeReferenceArity(type)), 24);
writePunctuation(writer, 20);
+ writeTypeList(type.typeArguments.slice(0, getTypeReferenceArity(type)), 25);
+ writePunctuation(writer, 21);
}
else {
var outerTypeParameters = type.target.outerTypeParameters;
@@ -21483,7 +21174,7 @@ var ts;
} while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_9);
if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {
writeSymbolTypeReference(parent_9, typeArguments, start, i, flags);
- writePunctuation(writer, 21);
+ writePunctuation(writer, 22);
}
}
}
@@ -21493,16 +21184,16 @@ var ts;
}
function writeUnionOrIntersectionType(type, flags) {
if (flags & 64) {
- writePunctuation(writer, 17);
+ writePunctuation(writer, 18);
}
if (type.flags & 524288) {
- writeTypeList(formatUnionTypes(type.types), 47);
+ writeTypeList(formatUnionTypes(type.types), 48);
}
else {
- writeTypeList(type.types, 46);
+ writeTypeList(type.types, 47);
}
if (flags & 64) {
- writePunctuation(writer, 18);
+ writePunctuation(writer, 19);
}
}
function writeAnonymousType(type, flags) {
@@ -21520,7 +21211,7 @@ var ts;
buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793064, 0, flags);
}
else {
- writeKeyword(writer, 117);
+ writeKeyword(writer, 118);
}
}
else {
@@ -21541,7 +21232,7 @@ var ts;
var isNonLocalFunctionSymbol = !!(symbol.flags & 16) &&
(symbol.parent ||
ts.forEach(symbol.declarations, function (declaration) {
- return declaration.parent.kind === 256 || declaration.parent.kind === 226;
+ return declaration.parent.kind === 256 || declaration.parent.kind === 227;
}));
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
return !!(flags & 2) ||
@@ -21550,37 +21241,37 @@ var ts;
}
}
function writeTypeOfSymbol(type, typeFormatFlags) {
- writeKeyword(writer, 101);
+ writeKeyword(writer, 102);
writeSpace(writer);
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags);
}
function writeIndexSignature(info, keyword) {
if (info) {
if (info.isReadonly) {
- writeKeyword(writer, 128);
+ writeKeyword(writer, 129);
writeSpace(writer);
}
- writePunctuation(writer, 19);
+ writePunctuation(writer, 20);
writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x");
- writePunctuation(writer, 54);
+ writePunctuation(writer, 55);
writeSpace(writer);
writeKeyword(writer, keyword);
- writePunctuation(writer, 20);
- writePunctuation(writer, 54);
+ writePunctuation(writer, 21);
+ writePunctuation(writer, 55);
writeSpace(writer);
writeType(info.type, 0);
- writePunctuation(writer, 23);
+ writePunctuation(writer, 24);
writer.writeLine();
}
}
function writePropertyWithModifiers(prop) {
if (isReadonlySymbol(prop)) {
- writeKeyword(writer, 128);
+ writeKeyword(writer, 129);
writeSpace(writer);
}
buildSymbolDisplay(prop, writer);
if (prop.flags & 536870912) {
- writePunctuation(writer, 53);
+ writePunctuation(writer, 54);
}
}
function shouldAddParenthesisAroundFunctionType(callSignature, flags) {
@@ -21598,53 +21289,53 @@ var ts;
var resolved = resolveStructuredTypeMembers(type);
if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
if (!resolved.callSignatures.length && !resolved.constructSignatures.length) {
- writePunctuation(writer, 15);
writePunctuation(writer, 16);
+ writePunctuation(writer, 17);
return;
}
if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
var parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags);
if (parenthesizeSignature) {
- writePunctuation(writer, 17);
+ writePunctuation(writer, 18);
}
buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack);
if (parenthesizeSignature) {
- writePunctuation(writer, 18);
+ writePunctuation(writer, 19);
}
return;
}
if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
if (flags & 64) {
- writePunctuation(writer, 17);
+ writePunctuation(writer, 18);
}
- writeKeyword(writer, 92);
+ writeKeyword(writer, 93);
writeSpace(writer);
buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack);
if (flags & 64) {
- writePunctuation(writer, 18);
+ writePunctuation(writer, 19);
}
return;
}
}
var saveInObjectTypeLiteral = inObjectTypeLiteral;
inObjectTypeLiteral = true;
- writePunctuation(writer, 15);
+ writePunctuation(writer, 16);
writer.writeLine();
writer.increaseIndent();
for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) {
var signature = _a[_i];
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack);
- writePunctuation(writer, 23);
+ writePunctuation(writer, 24);
writer.writeLine();
}
for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) {
var signature = _c[_b];
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, 1, symbolStack);
- writePunctuation(writer, 23);
+ writePunctuation(writer, 24);
writer.writeLine();
}
- writeIndexSignature(resolved.stringIndexInfo, 132);
- writeIndexSignature(resolved.numberIndexInfo, 130);
+ writeIndexSignature(resolved.stringIndexInfo, 133);
+ writeIndexSignature(resolved.numberIndexInfo, 131);
for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) {
var p = _e[_d];
var t = getTypeOfSymbol(p);
@@ -21654,21 +21345,21 @@ var ts;
var signature = signatures_1[_f];
writePropertyWithModifiers(p);
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack);
- writePunctuation(writer, 23);
+ writePunctuation(writer, 24);
writer.writeLine();
}
}
else {
writePropertyWithModifiers(p);
- writePunctuation(writer, 54);
+ writePunctuation(writer, 55);
writeSpace(writer);
writeType(t, 0);
- writePunctuation(writer, 23);
+ writePunctuation(writer, 24);
writer.writeLine();
}
}
writer.decreaseIndent();
- writePunctuation(writer, 16);
+ writePunctuation(writer, 17);
inObjectTypeLiteral = saveInObjectTypeLiteral;
}
}
@@ -21683,7 +21374,7 @@ var ts;
var constraint = getConstraintOfTypeParameter(tp);
if (constraint) {
writeSpace(writer);
- writeKeyword(writer, 83);
+ writeKeyword(writer, 84);
writeSpace(writer);
buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack);
}
@@ -21691,7 +21382,7 @@ var ts;
function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) {
var parameterNode = p.valueDeclaration;
if (ts.isRestParameter(parameterNode)) {
- writePunctuation(writer, 22);
+ writePunctuation(writer, 23);
}
if (ts.isBindingPattern(parameterNode.name)) {
buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack);
@@ -21700,36 +21391,36 @@ var ts;
appendSymbolNameOnly(p, writer);
}
if (isOptionalParameter(parameterNode)) {
- writePunctuation(writer, 53);
+ writePunctuation(writer, 54);
}
- writePunctuation(writer, 54);
+ writePunctuation(writer, 55);
writeSpace(writer);
buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack);
}
function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) {
- if (bindingPattern.kind === 167) {
- writePunctuation(writer, 15);
- buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });
+ if (bindingPattern.kind === 168) {
writePunctuation(writer, 16);
+ buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });
+ writePunctuation(writer, 17);
}
- else if (bindingPattern.kind === 168) {
- writePunctuation(writer, 19);
+ else if (bindingPattern.kind === 169) {
+ writePunctuation(writer, 20);
var elements = bindingPattern.elements;
buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });
if (elements && elements.hasTrailingComma) {
- writePunctuation(writer, 24);
+ writePunctuation(writer, 25);
}
- writePunctuation(writer, 20);
+ writePunctuation(writer, 21);
}
}
function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) {
if (ts.isOmittedExpression(bindingElement)) {
return;
}
- ts.Debug.assert(bindingElement.kind === 169);
+ ts.Debug.assert(bindingElement.kind === 170);
if (bindingElement.propertyName) {
writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol);
- writePunctuation(writer, 54);
+ writePunctuation(writer, 55);
writeSpace(writer);
}
if (ts.isBindingPattern(bindingElement.name)) {
@@ -21737,75 +21428,75 @@ var ts;
}
else {
if (bindingElement.dotDotDotToken) {
- writePunctuation(writer, 22);
+ writePunctuation(writer, 23);
}
appendSymbolNameOnly(bindingElement.symbol, writer);
}
}
function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) {
if (typeParameters && typeParameters.length) {
- writePunctuation(writer, 25);
+ writePunctuation(writer, 26);
buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); });
- writePunctuation(writer, 27);
+ writePunctuation(writer, 28);
}
}
function buildDisplayForCommaSeparatedList(list, writer, action) {
for (var i = 0; i < list.length; i++) {
if (i > 0) {
- writePunctuation(writer, 24);
+ writePunctuation(writer, 25);
writeSpace(writer);
}
action(list[i]);
}
}
- function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) {
+ function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration) {
if (typeParameters && typeParameters.length) {
- writePunctuation(writer, 25);
- var flags_1 = 256;
+ writePunctuation(writer, 26);
+ var flags = 256;
for (var i = 0; i < typeParameters.length; i++) {
if (i > 0) {
- writePunctuation(writer, 24);
+ writePunctuation(writer, 25);
writeSpace(writer);
- flags_1 = 0;
+ flags = 0;
}
- buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags_1);
+ buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags);
}
- writePunctuation(writer, 27);
+ writePunctuation(writer, 28);
}
}
function buildDisplayForParametersAndDelimiters(thisParameter, parameters, writer, enclosingDeclaration, flags, symbolStack) {
- writePunctuation(writer, 17);
+ writePunctuation(writer, 18);
if (thisParameter) {
buildParameterDisplay(thisParameter, writer, enclosingDeclaration, flags, symbolStack);
}
for (var i = 0; i < parameters.length; i++) {
if (i > 0 || thisParameter) {
- writePunctuation(writer, 24);
+ writePunctuation(writer, 25);
writeSpace(writer);
}
buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, symbolStack);
}
- writePunctuation(writer, 18);
+ writePunctuation(writer, 19);
}
function buildTypePredicateDisplay(predicate, writer, enclosingDeclaration, flags, symbolStack) {
if (ts.isIdentifierTypePredicate(predicate)) {
writer.writeParameter(predicate.parameterName);
}
else {
- writeKeyword(writer, 97);
+ writeKeyword(writer, 98);
}
writeSpace(writer);
- writeKeyword(writer, 124);
+ writeKeyword(writer, 125);
writeSpace(writer);
buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack);
}
function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) {
if (flags & 8) {
writeSpace(writer);
- writePunctuation(writer, 34);
+ writePunctuation(writer, 35);
}
else {
- writePunctuation(writer, 54);
+ writePunctuation(writer, 55);
}
writeSpace(writer);
if (signature.typePredicate) {
@@ -21818,7 +21509,7 @@ var ts;
}
function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind, symbolStack) {
if (kind === 1) {
- writeKeyword(writer, 92);
+ writeKeyword(writer, 93);
writeSpace(writer);
}
if (signature.target && (flags & 32)) {
@@ -21854,63 +21545,63 @@ var ts;
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 169:
+ case 170:
return isDeclarationVisible(node.parent.parent);
- case 218:
+ case 219:
if (ts.isBindingPattern(node.name) &&
!node.name.elements.length) {
return false;
}
- case 225:
- case 221:
+ case 226:
case 222:
case 223:
- case 220:
case 224:
- case 229:
+ case 221:
+ case 225:
+ case 230:
if (ts.isExternalModuleAugmentation(node)) {
return true;
}
var parent_10 = getDeclarationContainer(node);
if (!(ts.getCombinedModifierFlags(node) & 1) &&
- !(node.kind !== 229 && parent_10.kind !== 256 && ts.isInAmbientContext(parent_10))) {
+ !(node.kind !== 230 && parent_10.kind !== 256 && ts.isInAmbientContext(parent_10))) {
return isGlobalSourceFile(parent_10);
}
return isDeclarationVisible(parent_10);
+ case 146:
case 145:
- case 144:
- case 149:
case 150:
+ case 151:
+ case 148:
case 147:
- case 146:
if (ts.getModifierFlags(node) & (8 | 16)) {
return false;
}
- case 148:
- case 152:
- case 151:
+ case 149:
case 153:
- case 142:
- case 226:
- case 156:
+ case 152:
+ case 154:
+ case 143:
+ case 227:
case 157:
- case 159:
- case 155:
+ case 158:
case 160:
+ case 156:
case 161:
case 162:
case 163:
case 164:
+ case 165:
return isDeclarationVisible(node.parent);
- case 231:
case 232:
- case 234:
+ case 233:
+ case 235:
return false;
- case 141:
+ case 142:
case 256:
- case 228:
+ case 229:
return true;
- case 235:
+ case 236:
return false;
default:
return false;
@@ -21919,10 +21610,10 @@ var ts;
}
function collectLinkedAliases(node) {
var exportSymbol;
- if (node.parent && node.parent.kind === 235) {
+ if (node.parent && node.parent.kind === 236) {
exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node);
}
- else if (node.parent.kind === 238) {
+ else if (node.parent.kind === 239) {
var exportSpecifier = node.parent;
exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ?
getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) :
@@ -22001,12 +21692,12 @@ var ts;
node = ts.getRootDeclaration(node);
while (node) {
switch (node.kind) {
- case 218:
case 219:
+ case 220:
+ case 235:
case 234:
case 233:
case 232:
- case 231:
node = node.parent;
break;
default:
@@ -22034,12 +21725,12 @@ var ts;
}
function getTextOfPropertyName(name) {
switch (name.kind) {
- case 69:
+ case 70:
return name.text;
case 9:
case 8:
return name.text;
- case 140:
+ case 141:
if (ts.isStringOrNumericLiteral(name.expression.kind)) {
return name.expression.text;
}
@@ -22047,7 +21738,7 @@ var ts;
return undefined;
}
function isComputedNonLiteralName(name) {
- return name.kind === 140 && !ts.isStringOrNumericLiteral(name.expression.kind);
+ return name.kind === 141 && !ts.isStringOrNumericLiteral(name.expression.kind);
}
function getTypeForBindingElement(declaration) {
var pattern = declaration.parent;
@@ -22062,20 +21753,20 @@ var ts;
return parentType;
}
var type;
- if (pattern.kind === 167) {
- var name_17 = declaration.propertyName || declaration.name;
- if (isComputedNonLiteralName(name_17)) {
+ if (pattern.kind === 168) {
+ var name_14 = declaration.propertyName || declaration.name;
+ if (isComputedNonLiteralName(name_14)) {
return anyType;
}
if (declaration.initializer) {
getContextualType(declaration.initializer);
}
- var text = getTextOfPropertyName(name_17);
+ var text = getTextOfPropertyName(name_14);
type = getTypeOfPropertyOfType(parentType, text) ||
isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) ||
getIndexTypeOfType(parentType, 0);
if (!type) {
- error(name_17, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_17));
+ error(name_14, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_14));
return unknownType;
}
}
@@ -22118,15 +21809,15 @@ var ts;
if (typeTag && typeTag.typeExpression) {
return typeTag.typeExpression.type;
}
- if (declaration.kind === 218 &&
- declaration.parent.kind === 219 &&
- declaration.parent.parent.kind === 200) {
+ if (declaration.kind === 219 &&
+ declaration.parent.kind === 220 &&
+ declaration.parent.parent.kind === 201) {
var annotation = ts.getJSDocTypeTag(declaration.parent.parent);
if (annotation && annotation.typeExpression) {
return annotation.typeExpression.type;
}
}
- else if (declaration.kind === 142) {
+ else if (declaration.kind === 143) {
var paramTag = ts.getCorrespondingJSDocParameterTag(declaration);
if (paramTag && paramTag.typeExpression) {
return paramTag.typeExpression.type;
@@ -22134,9 +21825,13 @@ var ts;
}
return undefined;
}
- function isAutoVariableInitializer(initializer) {
- var expr = initializer && ts.skipParentheses(initializer);
- return !expr || expr.kind === 93 || expr.kind === 69 && getResolvedSymbol(expr) === undefinedSymbol;
+ function isNullOrUndefined(node) {
+ var expr = ts.skipParentheses(node);
+ return expr.kind === 94 || expr.kind === 70 && getResolvedSymbol(expr) === undefinedSymbol;
+ }
+ function isEmptyArrayLiteral(node) {
+ var expr = ts.skipParentheses(node);
+ return expr.kind === 171 && expr.elements.length === 0;
}
function addOptionality(type, optional) {
return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type;
@@ -22148,10 +21843,10 @@ var ts;
return type;
}
}
- if (declaration.parent.parent.kind === 207) {
+ if (declaration.parent.parent.kind === 208) {
return stringType;
}
- if (declaration.parent.parent.kind === 208) {
+ if (declaration.parent.parent.kind === 209) {
return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType;
}
if (ts.isBindingPattern(declaration.parent)) {
@@ -22160,15 +21855,19 @@ var ts;
if (declaration.type) {
return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality);
}
- if (declaration.kind === 218 && !ts.isBindingPattern(declaration.name) &&
- !(ts.getCombinedNodeFlags(declaration) & 2) && !(ts.getCombinedModifierFlags(declaration) & 1) &&
- !ts.isInAmbientContext(declaration) && isAutoVariableInitializer(declaration.initializer)) {
- return autoType;
+ if (declaration.kind === 219 && !ts.isBindingPattern(declaration.name) &&
+ !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) {
+ if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
+ return autoType;
+ }
+ if (declaration.initializer && isEmptyArrayLiteral(declaration.initializer)) {
+ return autoArrayType;
+ }
}
- if (declaration.kind === 142) {
+ if (declaration.kind === 143) {
var func = declaration.parent;
- if (func.kind === 150 && !ts.hasDynamicName(func)) {
- var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 149);
+ if (func.kind === 151 && !ts.hasDynamicName(func)) {
+ var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 150);
if (getter) {
var getterSignature = getSignatureFromDeclaration(getter);
var thisParameter = getAccessorThisParameter(func);
@@ -22181,8 +21880,7 @@ var ts;
}
var type = void 0;
if (declaration.symbol.name === "this") {
- var thisParameter = getContextualThisParameter(func);
- type = thisParameter ? getTypeOfSymbol(thisParameter) : undefined;
+ type = getContextualThisParameterType(func);
}
else {
type = getContextuallyTypedParameterType(declaration);
@@ -22255,7 +21953,7 @@ var ts;
return result;
}
function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {
- return pattern.kind === 167
+ return pattern.kind === 168
? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
}
@@ -22280,7 +21978,7 @@ var ts;
}
function declarationBelongsToPrivateAmbientMember(declaration) {
var root = ts.getRootDeclaration(declaration);
- var memberDeclaration = root.kind === 142 ? root.parent : root;
+ var memberDeclaration = root.kind === 143 ? root.parent : root;
return isPrivateWithinAmbient(memberDeclaration);
}
function getTypeOfVariableOrParameterOrProperty(symbol) {
@@ -22293,7 +21991,7 @@ var ts;
if (declaration.parent.kind === 252) {
return links.type = anyType;
}
- if (declaration.kind === 235) {
+ if (declaration.kind === 236) {
return links.type = checkExpression(declaration.expression);
}
if (declaration.flags & 1048576 && declaration.kind === 280 && declaration.typeExpression) {
@@ -22303,15 +22001,15 @@ var ts;
return unknownType;
}
var type = void 0;
- if (declaration.kind === 187 ||
- declaration.kind === 172 && declaration.parent.kind === 187) {
+ if (declaration.kind === 188 ||
+ declaration.kind === 173 && declaration.parent.kind === 188) {
if (declaration.flags & 1048576) {
var typeTag = ts.getJSDocTypeTag(declaration.parent);
if (typeTag && typeTag.typeExpression) {
return links.type = getTypeFromTypeNode(typeTag.typeExpression.type);
}
}
- var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 187 ?
+ var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 188 ?
checkExpressionCached(decl.right) :
checkExpressionCached(decl.parent.right); });
type = getUnionType(declaredTypes, true);
@@ -22337,7 +22035,7 @@ var ts;
}
function getAnnotatedAccessorType(accessor) {
if (accessor) {
- if (accessor.kind === 149) {
+ if (accessor.kind === 150) {
return accessor.type && getTypeFromTypeNode(accessor.type);
}
else {
@@ -22357,8 +22055,8 @@ var ts;
function getTypeOfAccessors(symbol) {
var links = getSymbolLinks(symbol);
if (!links.type) {
- var getter = ts.getDeclarationOfKind(symbol, 149);
- var setter = ts.getDeclarationOfKind(symbol, 150);
+ var getter = ts.getDeclarationOfKind(symbol, 150);
+ var setter = ts.getDeclarationOfKind(symbol, 151);
if (getter && getter.flags & 1048576) {
var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter);
if (jsDocType) {
@@ -22399,7 +22097,7 @@ var ts;
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
- var getter_1 = ts.getDeclarationOfKind(symbol, 149);
+ var getter_1 = ts.getDeclarationOfKind(symbol, 150);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
@@ -22410,7 +22108,7 @@ var ts;
function getTypeOfFuncClassEnumModule(symbol) {
var links = getSymbolLinks(symbol);
if (!links.type) {
- if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModuleSymbol(symbol)) {
+ if (symbol.valueDeclaration.kind === 226 && ts.isShorthandAmbientModuleSymbol(symbol)) {
links.type = anyType;
}
else {
@@ -22495,9 +22193,9 @@ var ts;
if (!node) {
return typeParameters;
}
- if (node.kind === 221 || node.kind === 192 ||
- node.kind === 220 || node.kind === 179 ||
- node.kind === 147 || node.kind === 180) {
+ if (node.kind === 222 || node.kind === 193 ||
+ node.kind === 221 || node.kind === 180 ||
+ node.kind === 148 || node.kind === 181) {
var declarations = node.typeParameters;
if (declarations) {
return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations);
@@ -22506,15 +22204,15 @@ var ts;
}
}
function getOuterTypeParametersOfClassOrInterface(symbol) {
- var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 222);
+ var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 223);
return appendOuterTypeParameters(undefined, declaration);
}
function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) {
var result;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var node = _a[_i];
- if (node.kind === 222 || node.kind === 221 ||
- node.kind === 192 || node.kind === 223) {
+ if (node.kind === 223 || node.kind === 222 ||
+ node.kind === 193 || node.kind === 224) {
var declaration = node;
if (declaration.typeParameters) {
result = appendTypeParameters(result, declaration.typeParameters);
@@ -22640,7 +22338,7 @@ var ts;
type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;
for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 222 && ts.getInterfaceBaseTypeNodes(declaration)) {
+ if (declaration.kind === 223 && ts.getInterfaceBaseTypeNodes(declaration)) {
for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {
var node = _c[_b];
var baseType = getTypeFromTypeNode(node);
@@ -22669,7 +22367,7 @@ var ts;
function isIndependentInterface(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 222) {
+ if (declaration.kind === 223) {
if (declaration.flags & 64) {
return false;
}
@@ -22731,7 +22429,7 @@ var ts;
}
}
else {
- declaration = ts.getDeclarationOfKind(symbol, 223);
+ declaration = ts.getDeclarationOfKind(symbol, 224);
type = getTypeFromTypeNode(declaration.type, symbol, typeParameters);
}
if (popTypeResolution()) {
@@ -22755,14 +22453,14 @@ var ts;
return !ts.isInAmbientContext(member);
}
return expr.kind === 8 ||
- expr.kind === 185 && expr.operator === 36 &&
+ expr.kind === 186 && expr.operator === 37 &&
expr.operand.kind === 8 ||
- expr.kind === 69 && !!symbol.exports[expr.text];
+ expr.kind === 70 && !!symbol.exports[expr.text];
}
function enumHasLiteralMembers(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 224) {
+ if (declaration.kind === 225) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
if (!isLiteralEnumMember(symbol, member)) {
@@ -22790,7 +22488,7 @@ var ts;
var memberTypes = ts.createMap();
for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 224) {
+ if (declaration.kind === 225) {
computeEnumMemberValues(declaration);
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
@@ -22828,7 +22526,7 @@ var ts;
if (!links.declaredType) {
var type = createType(16384);
type.symbol = symbol;
- if (!ts.getDeclarationOfKind(symbol, 141).constraint) {
+ if (!ts.getDeclarationOfKind(symbol, 142).constraint) {
type.constraint = noConstraintType;
}
links.declaredType = type;
@@ -22877,20 +22575,20 @@ var ts;
}
function isIndependentType(node) {
switch (node.kind) {
- case 117:
- case 132:
- case 130:
- case 120:
+ case 118:
case 133:
- case 103:
- case 135:
- case 93:
- case 127:
- case 166:
+ case 131:
+ case 121:
+ case 134:
+ case 104:
+ case 136:
+ case 94:
+ case 128:
+ case 167:
return true;
- case 160:
+ case 161:
return isIndependentType(node.elementType);
- case 155:
+ case 156:
return isIndependentTypeReference(node);
}
return false;
@@ -22899,7 +22597,7 @@ var ts;
return node.type && isIndependentType(node.type) || !node.type && !node.initializer;
}
function isIndependentFunctionLikeDeclaration(node) {
- if (node.kind !== 148 && (!node.type || !isIndependentType(node.type))) {
+ if (node.kind !== 149 && (!node.type || !isIndependentType(node.type))) {
return false;
}
for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
@@ -22915,12 +22613,12 @@ var ts;
var declaration = symbol.declarations[0];
if (declaration) {
switch (declaration.kind) {
+ case 146:
case 145:
- case 144:
return isIndependentVariableLikeDeclaration(declaration);
- case 147:
- case 146:
case 148:
+ case 147:
+ case 149:
return isIndependentFunctionLikeDeclaration(declaration);
}
}
@@ -23486,7 +23184,7 @@ var ts;
return false;
}
function createTypePredicateFromTypePredicateNode(node) {
- if (node.parameterName.kind === 69) {
+ if (node.parameterName.kind === 70) {
var parameterName = node.parameterName;
return {
kind: 1,
@@ -23525,7 +23223,7 @@ var ts;
else {
parameters.push(paramSymbol);
}
- if (param.type && param.type.kind === 166) {
+ if (param.type && param.type.kind === 167) {
hasLiteralTypes = true;
}
if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) {
@@ -23537,10 +23235,10 @@ var ts;
minArgumentCount = -1;
}
}
- if ((declaration.kind === 149 || declaration.kind === 150) &&
+ if ((declaration.kind === 150 || declaration.kind === 151) &&
!ts.hasDynamicName(declaration) &&
(!hasThisParameter || !thisParameter)) {
- var otherKind = declaration.kind === 149 ? 150 : 149;
+ var otherKind = declaration.kind === 150 ? 151 : 150;
var other = ts.getDeclarationOfKind(declaration.symbol, otherKind);
if (other) {
thisParameter = getAnnotatedAccessorThisParameter(other);
@@ -23552,24 +23250,21 @@ var ts;
if (isJSConstructSignature) {
minArgumentCount--;
}
- if (!thisParameter && ts.isObjectLiteralMethod(declaration)) {
- thisParameter = getContextualThisParameter(declaration);
- }
- var classType = declaration.kind === 148 ?
+ var classType = declaration.kind === 149 ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
: undefined;
var typeParameters = classType ? classType.localTypeParameters :
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) :
getTypeParametersFromJSDocTemplate(declaration);
- var returnType = getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType);
- var typePredicate = declaration.type && declaration.type.kind === 154 ?
+ var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType);
+ var typePredicate = declaration.type && declaration.type.kind === 155 ?
createTypePredicateFromTypePredicateNode(declaration.type) :
undefined;
links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes);
}
return links.resolvedSignature;
}
- function getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType) {
+ function getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType) {
if (isJSConstructSignature) {
return getTypeFromTypeNode(declaration.parameters[0].type);
}
@@ -23585,8 +23280,8 @@ var ts;
return type;
}
}
- if (declaration.kind === 149 && !ts.hasDynamicName(declaration)) {
- var setter = ts.getDeclarationOfKind(declaration.symbol, 150);
+ if (declaration.kind === 150 && !ts.hasDynamicName(declaration)) {
+ var setter = ts.getDeclarationOfKind(declaration.symbol, 151);
return getAnnotatedAccessorType(setter);
}
if (ts.nodeIsMissing(declaration.body)) {
@@ -23600,19 +23295,19 @@ var ts;
for (var i = 0, len = symbol.declarations.length; i < len; i++) {
var node = symbol.declarations[i];
switch (node.kind) {
- case 156:
case 157:
- case 220:
- case 147:
- case 146:
+ case 158:
+ case 221:
case 148:
- case 151:
+ case 147:
+ case 149:
case 152:
case 153:
- case 149:
+ case 154:
case 150:
- case 179:
+ case 151:
case 180:
+ case 181:
case 269:
if (i > 0 && node.body) {
var previous = symbol.declarations[i - 1];
@@ -23693,7 +23388,7 @@ var ts;
}
function getOrCreateTypeFromSignature(signature) {
if (!signature.isolatedSignatureType) {
- var isConstructor = signature.declaration.kind === 148 || signature.declaration.kind === 152;
+ var isConstructor = signature.declaration.kind === 149 || signature.declaration.kind === 153;
var type = createObjectType(2097152);
type.members = emptySymbols;
type.properties = emptyArray;
@@ -23707,7 +23402,7 @@ var ts;
return symbol.members["__index"];
}
function getIndexDeclarationOfSymbol(symbol, kind) {
- var syntaxKind = kind === 1 ? 130 : 132;
+ var syntaxKind = kind === 1 ? 131 : 133;
var indexSymbol = getIndexSymbol(symbol);
if (indexSymbol) {
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
@@ -23734,7 +23429,7 @@ var ts;
return undefined;
}
function getConstraintDeclaration(type) {
- return ts.getDeclarationOfKind(type.symbol, 141).constraint;
+ return ts.getDeclarationOfKind(type.symbol, 142).constraint;
}
function hasConstraintReferenceTo(type, target) {
var checked;
@@ -23767,7 +23462,7 @@ var ts;
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
}
function getParentSymbolOfTypeParameter(typeParameter) {
- return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 141).parent);
+ return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 142).parent);
}
function getTypeListId(types) {
var result = "";
@@ -23867,11 +23562,11 @@ var ts;
}
function getTypeReferenceName(node) {
switch (node.kind) {
- case 155:
+ case 156:
return node.typeName;
case 267:
return node.name;
- case 194:
+ case 195:
var expr = node.expression;
if (ts.isEntityNameExpression(expr)) {
return expr;
@@ -23879,7 +23574,7 @@ var ts;
}
return undefined;
}
- function resolveTypeReferenceName(node, typeReferenceName) {
+ function resolveTypeReferenceName(typeReferenceName) {
if (!typeReferenceName) {
return unknownSymbol;
}
@@ -23907,11 +23602,11 @@ var ts;
var type = void 0;
if (node.kind === 267) {
var typeReferenceName = getTypeReferenceName(node);
- symbol = resolveTypeReferenceName(node, typeReferenceName);
+ symbol = resolveTypeReferenceName(typeReferenceName);
type = getTypeReferenceType(node, symbol);
}
else {
- var typeNameOrExpression = node.kind === 155
+ var typeNameOrExpression = node.kind === 156
? node.typeName
: ts.isEntityNameExpression(node.expression)
? node.expression
@@ -23940,9 +23635,9 @@ var ts;
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
switch (declaration.kind) {
- case 221:
case 222:
- case 224:
+ case 223:
+ case 225:
return declaration;
}
}
@@ -24317,9 +24012,9 @@ var ts;
function getThisType(node) {
var container = ts.getThisContainer(node, false);
var parent = container && container.parent;
- if (parent && (ts.isClassLike(parent) || parent.kind === 222)) {
+ if (parent && (ts.isClassLike(parent) || parent.kind === 223)) {
if (!(ts.getModifierFlags(container) & 32) &&
- (container.kind !== 148 || ts.isNodeDescendantOf(node, container.body))) {
+ (container.kind !== 149 || ts.isNodeDescendantOf(node, container.body))) {
return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
}
}
@@ -24338,25 +24033,25 @@ var ts;
}
function getTypeFromTypeNode(node, aliasSymbol, aliasTypeArguments) {
switch (node.kind) {
- case 117:
+ case 118:
case 258:
case 259:
return anyType;
- case 132:
+ case 133:
return stringType;
- case 130:
+ case 131:
return numberType;
- case 120:
+ case 121:
return booleanType;
- case 133:
+ case 134:
return esSymbolType;
- case 103:
+ case 104:
return voidType;
- case 135:
+ case 136:
return undefinedType;
- case 93:
+ case 94:
return nullType;
- case 127:
+ case 128:
return neverType;
case 283:
return nullType;
@@ -24364,33 +24059,33 @@ var ts;
return undefinedType;
case 285:
return neverType;
- case 165:
- case 97:
- return getTypeFromThisTypeNode(node);
case 166:
+ case 98:
+ return getTypeFromThisTypeNode(node);
+ case 167:
return getTypeFromLiteralTypeNode(node);
case 282:
return getTypeFromLiteralTypeNode(node.literal);
- case 155:
+ case 156:
case 267:
return getTypeFromTypeReference(node);
- case 154:
+ case 155:
return booleanType;
- case 194:
+ case 195:
return getTypeFromTypeReference(node);
- case 158:
+ case 159:
return getTypeFromTypeQueryNode(node);
- case 160:
+ case 161:
case 260:
return getTypeFromArrayTypeNode(node);
- case 161:
- return getTypeFromTupleTypeNode(node);
case 162:
+ return getTypeFromTupleTypeNode(node);
+ case 163:
case 261:
return getTypeFromUnionTypeNode(node, aliasSymbol, aliasTypeArguments);
- case 163:
- return getTypeFromIntersectionTypeNode(node, aliasSymbol, aliasTypeArguments);
case 164:
+ return getTypeFromIntersectionTypeNode(node, aliasSymbol, aliasTypeArguments);
+ case 165:
case 263:
case 264:
case 271:
@@ -24399,14 +24094,14 @@ var ts;
return getTypeFromTypeNode(node.type);
case 265:
return getTypeFromTypeNode(node.literal);
- case 156:
case 157:
- case 159:
+ case 158:
+ case 160:
case 281:
case 269:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node, aliasSymbol, aliasTypeArguments);
- case 69:
- case 139:
+ case 70:
+ case 140:
var symbol = getSymbolAtLocation(node);
return symbol && getDeclaredTypeOfSymbol(symbol);
case 262:
@@ -24562,23 +24257,23 @@ var ts;
var node = symbol.declarations[0].parent;
while (node) {
switch (node.kind) {
- case 156:
case 157:
- case 220:
- case 147:
- case 146:
+ case 158:
+ case 221:
case 148:
- case 151:
+ case 147:
+ case 149:
case 152:
case 153:
- case 149:
+ case 154:
case 150:
- case 179:
+ case 151:
case 180:
- case 221:
- case 192:
+ case 181:
case 222:
+ case 193:
case 223:
+ case 224:
var declaration = node;
if (declaration.typeParameters) {
for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) {
@@ -24588,14 +24283,14 @@ var ts;
}
}
}
- if (ts.isClassLike(node) || node.kind === 222) {
+ if (ts.isClassLike(node) || node.kind === 223) {
var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;
if (thisType && ts.contains(mappedTypes, thisType)) {
return true;
}
}
break;
- case 225:
+ case 226:
case 256:
return false;
}
@@ -24630,35 +24325,43 @@ var ts;
return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration);
}
function isContextSensitive(node) {
- ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 148 || ts.isObjectLiteralMethod(node));
switch (node.kind) {
- case 179:
case 180:
+ case 181:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 171:
+ case 172:
return ts.forEach(node.properties, isContextSensitive);
- case 170:
+ case 171:
return ts.forEach(node.elements, isContextSensitive);
- case 188:
+ case 189:
return isContextSensitive(node.whenTrue) ||
isContextSensitive(node.whenFalse);
- case 187:
- return node.operatorToken.kind === 52 &&
+ case 188:
+ return node.operatorToken.kind === 53 &&
(isContextSensitive(node.left) || isContextSensitive(node.right));
case 253:
return isContextSensitive(node.initializer);
+ case 148:
case 147:
- case 146:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 178:
+ case 179:
return isContextSensitive(node.expression);
}
return false;
}
function isContextSensitiveFunctionLikeDeclaration(node) {
- var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; });
- var isNullaryArrow = node.kind === 180 && !node.parameters.length;
- return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow;
+ if (node.typeParameters) {
+ return false;
+ }
+ if (ts.forEach(node.parameters, function (p) { return !p.type; })) {
+ return true;
+ }
+ if (node.kind === 181) {
+ return false;
+ }
+ var parameter = ts.firstOrUndefined(node.parameters);
+ return !(parameter && ts.parameterIsThisKeyword(parameter));
}
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
@@ -25078,8 +24781,8 @@ var ts;
}
if (source.flags & 524288 && target.flags & 524288 ||
source.flags & 1048576 && target.flags & 1048576) {
- if (result = eachTypeRelatedToSomeType(source, target, false)) {
- if (result &= eachTypeRelatedToSomeType(target, source, false)) {
+ if (result = eachTypeRelatedToSomeType(source, target)) {
+ if (result &= eachTypeRelatedToSomeType(target, source)) {
return result;
}
}
@@ -25130,7 +24833,7 @@ var ts;
}
return false;
}
- function eachTypeRelatedToSomeType(source, target, reportErrors) {
+ function eachTypeRelatedToSomeType(source, target) {
var result = -1;
var sourceTypes = source.types;
for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) {
@@ -25727,7 +25430,7 @@ var ts;
type.flags & 64 ? numberType :
type.flags & 128 ? booleanType :
type.flags & 256 ? type.baseType :
- type.flags & 524288 && !(type.flags & 16) ? getUnionType(ts.map(type.types, getBaseTypeOfLiteralType)) :
+ type.flags & 524288 && !(type.flags & 16) ? getUnionType(ts.sameMap(type.types, getBaseTypeOfLiteralType)) :
type;
}
function getWidenedLiteralType(type) {
@@ -25735,7 +25438,7 @@ var ts;
type.flags & 64 && type.flags & 16777216 ? numberType :
type.flags & 128 ? booleanType :
type.flags & 256 ? type.baseType :
- type.flags & 524288 && !(type.flags & 16) ? getUnionType(ts.map(type.types, getWidenedLiteralType)) :
+ type.flags & 524288 && !(type.flags & 16) ? getUnionType(ts.sameMap(type.types, getWidenedLiteralType)) :
type;
}
function isTupleType(type) {
@@ -25846,10 +25549,10 @@ var ts;
return getWidenedTypeOfObjectLiteral(type);
}
if (type.flags & 524288) {
- return getUnionType(ts.map(type.types, getWidenedConstituentType));
+ return getUnionType(ts.sameMap(type.types, getWidenedConstituentType));
}
if (isArrayType(type) || isTupleType(type)) {
- return createTypeReference(type.target, ts.map(type.typeArguments, getWidenedType));
+ return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
}
}
return type;
@@ -25890,25 +25593,25 @@ var ts;
var typeAsString = typeToString(getWidenedType(type));
var diagnostic;
switch (declaration.kind) {
+ case 146:
case 145:
- case 144:
diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type;
break;
- case 142:
+ case 143:
diagnostic = declaration.dotDotDotToken ?
ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type :
ts.Diagnostics.Parameter_0_implicitly_has_an_1_type;
break;
- case 169:
+ case 170:
diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;
break;
- case 220:
+ case 221:
+ case 148:
case 147:
- case 146:
- case 149:
case 150:
- case 179:
+ case 151:
case 180:
+ case 181:
if (!declaration.name) {
error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
@@ -25953,7 +25656,7 @@ var ts;
signature: signature,
inferUnionTypes: inferUnionTypes,
inferences: inferences,
- inferredTypes: new Array(signature.typeParameters.length)
+ inferredTypes: new Array(signature.typeParameters.length),
};
}
function createTypeInferencesObject() {
@@ -25961,7 +25664,7 @@ var ts;
primary: undefined,
secondary: undefined,
topLevel: true,
- isFixed: false
+ isFixed: false,
};
}
function couldContainTypeParameters(type) {
@@ -26202,7 +25905,7 @@ var ts;
var widenLiteralTypes = context.inferences[index].topLevel &&
!hasPrimitiveConstraint(signature.typeParameters[index]) &&
(context.inferences[index].isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), signature.typeParameters[index]));
- var baseInferences = widenLiteralTypes ? ts.map(inferences, getWidenedLiteralType) : inferences;
+ var baseInferences = widenLiteralTypes ? ts.sameMap(inferences, getWidenedLiteralType) : inferences;
var unionOrSuperType = context.inferUnionTypes ? getUnionType(baseInferences, true) : getCommonSupertype(baseInferences);
inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : unknownType;
inferenceSucceeded = !!unionOrSuperType;
@@ -26243,10 +25946,10 @@ var ts;
function isInTypeQuery(node) {
while (node) {
switch (node.kind) {
- case 158:
+ case 159:
return true;
- case 69:
- case 139:
+ case 70:
+ case 140:
node = node.parent;
continue;
default:
@@ -26256,14 +25959,14 @@ var ts;
ts.Debug.fail("should not get here");
}
function getFlowCacheKey(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
var symbol = getResolvedSymbol(node);
return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined;
}
- if (node.kind === 97) {
+ if (node.kind === 98) {
return "0";
}
- if (node.kind === 172) {
+ if (node.kind === 173) {
var key = getFlowCacheKey(node.expression);
return key && key + "." + node.name.text;
}
@@ -26271,31 +25974,31 @@ var ts;
}
function getLeftmostIdentifierOrThis(node) {
switch (node.kind) {
- case 69:
- case 97:
+ case 70:
+ case 98:
return node;
- case 172:
+ case 173:
return getLeftmostIdentifierOrThis(node.expression);
}
return undefined;
}
function isMatchingReference(source, target) {
switch (source.kind) {
- case 69:
- return target.kind === 69 && getResolvedSymbol(source) === getResolvedSymbol(target) ||
- (target.kind === 218 || target.kind === 169) &&
+ case 70:
+ return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) ||
+ (target.kind === 219 || target.kind === 170) &&
getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);
- case 97:
- return target.kind === 97;
- case 172:
- return target.kind === 172 &&
+ case 98:
+ return target.kind === 98;
+ case 173:
+ return target.kind === 173 &&
source.name.text === target.name.text &&
isMatchingReference(source.expression, target.expression);
}
return false;
}
function containsMatchingReference(source, target) {
- while (source.kind === 172) {
+ while (source.kind === 173) {
source = source.expression;
if (isMatchingReference(source, target)) {
return true;
@@ -26304,15 +26007,15 @@ var ts;
return false;
}
function containsMatchingReferenceDiscriminant(source, target) {
- return target.kind === 172 &&
+ return target.kind === 173 &&
containsMatchingReference(source, target.expression) &&
isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text);
}
function getDeclaredTypeOfReference(expr) {
- if (expr.kind === 69) {
+ if (expr.kind === 70) {
return getTypeOfSymbol(getResolvedSymbol(expr));
}
- if (expr.kind === 172) {
+ if (expr.kind === 173) {
var type = getDeclaredTypeOfReference(expr.expression);
return type && getTypeOfPropertyOfType(type, expr.name.text);
}
@@ -26342,7 +26045,7 @@ var ts;
}
}
}
- if (callExpression.expression.kind === 172 &&
+ if (callExpression.expression.kind === 173 &&
isOrContainsMatchingReference(reference, callExpression.expression.expression)) {
return true;
}
@@ -26468,7 +26171,7 @@ var ts;
return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType);
}
function getAssignedTypeOfBinaryExpression(node) {
- return node.parent.kind === 170 || node.parent.kind === 253 ?
+ return node.parent.kind === 171 || node.parent.kind === 253 ?
getTypeWithDefault(getAssignedType(node), node.right) :
checkExpression(node.right);
}
@@ -26487,17 +26190,17 @@ var ts;
function getAssignedType(node) {
var parent = node.parent;
switch (parent.kind) {
- case 207:
- return stringType;
case 208:
+ return stringType;
+ case 209:
return checkRightHandSideOfForOf(parent.expression) || unknownType;
- case 187:
+ case 188:
return getAssignedTypeOfBinaryExpression(parent);
- case 181:
+ case 182:
return undefinedType;
- case 170:
+ case 171:
return getAssignedTypeOfArrayLiteralElement(parent, node);
- case 191:
+ case 192:
return getAssignedTypeOfSpreadElement(parent);
case 253:
return getAssignedTypeOfPropertyAssignment(parent);
@@ -26509,7 +26212,7 @@ var ts;
function getInitialTypeOfBindingElement(node) {
var pattern = node.parent;
var parentType = getInitialType(pattern.parent);
- var type = pattern.kind === 167 ?
+ var type = pattern.kind === 168 ?
getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :
!node.dotDotDotToken ?
getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) :
@@ -26524,38 +26227,51 @@ var ts;
if (node.initializer) {
return getTypeOfInitializer(node.initializer);
}
- if (node.parent.parent.kind === 207) {
+ if (node.parent.parent.kind === 208) {
return stringType;
}
- if (node.parent.parent.kind === 208) {
+ if (node.parent.parent.kind === 209) {
return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType;
}
return unknownType;
}
function getInitialType(node) {
- return node.kind === 218 ?
+ return node.kind === 219 ?
getInitialTypeOfVariableDeclaration(node) :
getInitialTypeOfBindingElement(node);
}
function getInitialOrAssignedType(node) {
- return node.kind === 218 || node.kind === 169 ?
+ return node.kind === 219 || node.kind === 170 ?
getInitialType(node) :
getAssignedType(node);
}
+ function isEmptyArrayAssignment(node) {
+ return node.kind === 219 && node.initializer &&
+ isEmptyArrayLiteral(node.initializer) ||
+ node.kind !== 170 && node.parent.kind === 188 &&
+ isEmptyArrayLiteral(node.parent.right);
+ }
function getReferenceCandidate(node) {
switch (node.kind) {
- case 178:
+ case 179:
return getReferenceCandidate(node.expression);
- case 187:
+ case 188:
switch (node.operatorToken.kind) {
- case 56:
+ case 57:
return getReferenceCandidate(node.left);
- case 24:
+ case 25:
return getReferenceCandidate(node.right);
}
}
return node;
}
+ function getReferenceRoot(node) {
+ var parent = node.parent;
+ return parent.kind === 179 ||
+ parent.kind === 188 && parent.operatorToken.kind === 57 && parent.left === node ||
+ parent.kind === 188 && parent.operatorToken.kind === 25 && parent.right === node ?
+ getReferenceRoot(parent) : node;
+ }
function getTypeOfSwitchClause(clause) {
if (clause.kind === 249) {
var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression));
@@ -26626,24 +26342,88 @@ var ts;
function createFlowType(type, incomplete) {
return incomplete ? { flags: 0, type: type } : type;
}
+ function createEvolvingArrayType(elementType) {
+ var result = createObjectType(2097152);
+ result.elementType = elementType;
+ return result;
+ }
+ function getEvolvingArrayType(elementType) {
+ return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType));
+ }
+ function addEvolvingArrayElementType(evolvingArrayType, node) {
+ var elementType = getBaseTypeOfLiteralType(checkExpression(node));
+ return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
+ }
+ function isEvolvingArrayType(type) {
+ return !!(type.flags & 2097152 && type.elementType);
+ }
+ function createFinalArrayType(elementType) {
+ return elementType.flags & 8192 ?
+ autoArrayType :
+ createArrayType(elementType.flags & 524288 ?
+ getUnionType(elementType.types, true) :
+ elementType);
+ }
+ function getFinalArrayType(evolvingArrayType) {
+ return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType));
+ }
+ function finalizeEvolvingArrayType(type) {
+ return isEvolvingArrayType(type) ? getFinalArrayType(type) : type;
+ }
+ function getElementTypeOfEvolvingArrayType(type) {
+ return isEvolvingArrayType(type) ? type.elementType : neverType;
+ }
+ function isEvolvingArrayTypeList(types) {
+ var hasEvolvingArrayType = false;
+ for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
+ var t = types_12[_i];
+ if (!(t.flags & 8192)) {
+ if (!isEvolvingArrayType(t)) {
+ return false;
+ }
+ hasEvolvingArrayType = true;
+ }
+ }
+ return hasEvolvingArrayType;
+ }
+ function getUnionOrEvolvingArrayType(types, subtypeReduction) {
+ return isEvolvingArrayTypeList(types) ?
+ getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType))) :
+ getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
+ }
+ function isEvolvingArrayOperationTarget(node) {
+ var root = getReferenceRoot(node);
+ var parent = root.parent;
+ var isLengthPushOrUnshift = parent.kind === 173 && (parent.name.text === "length" ||
+ parent.parent.kind === 175 && ts.isPushOrUnshiftIdentifier(parent.name));
+ var isElementAssignment = parent.kind === 174 &&
+ parent.expression === root &&
+ parent.parent.kind === 188 &&
+ parent.parent.operatorToken.kind === 57 &&
+ parent.parent.left === parent &&
+ !ts.isAssignmentTarget(parent.parent) &&
+ isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 | 2048);
+ return isLengthPushOrUnshift || isElementAssignment;
+ }
function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) {
var key;
if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 4178943)) {
return declaredType;
}
var initialType = assumeInitialized ? declaredType :
- declaredType === autoType ? undefinedType :
+ declaredType === autoType || declaredType === autoArrayType ? undefinedType :
includeFalsyTypes(declaredType, 2048);
var visitedFlowStart = visitedFlowCount;
- var result = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode));
+ var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode));
visitedFlowCount = visitedFlowStart;
- if (reference.parent.kind === 196 && getTypeWithFacts(result, 524288).flags & 8192) {
+ var resultType = isEvolvingArrayType(evolvedType) && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType);
+ if (reference.parent.kind === 197 && getTypeWithFacts(resultType, 524288).flags & 8192) {
return declaredType;
}
- return result;
+ return resultType;
function getTypeAtFlowNode(flow) {
while (true) {
- if (flow.flags & 512) {
+ if (flow.flags & 1024) {
for (var i = visitedFlowStart; i < visitedFlowCount; i++) {
if (visitedFlowNodes[i] === flow) {
return visitedFlowTypes[i];
@@ -26673,18 +26453,25 @@ var ts;
getTypeAtFlowBranchLabel(flow) :
getTypeAtFlowLoopLabel(flow);
}
+ else if (flow.flags & 256) {
+ type = getTypeAtFlowArrayMutation(flow);
+ if (!type) {
+ flow = flow.antecedent;
+ continue;
+ }
+ }
else if (flow.flags & 2) {
var container = flow.container;
- if (container && container !== flowContainer && reference.kind !== 172) {
+ if (container && container !== flowContainer && reference.kind !== 173) {
flow = container.flowNode;
continue;
}
type = initialType;
}
else {
- type = declaredType;
+ type = convertAutoToAny(declaredType);
}
- if (flow.flags & 512) {
+ if (flow.flags & 1024) {
visitedFlowNodes[visitedFlowCount] = flow;
visitedFlowTypes[visitedFlowCount] = type;
visitedFlowCount++;
@@ -26695,30 +26482,70 @@ var ts;
function getTypeAtFlowAssignment(flow) {
var node = flow.node;
if (isMatchingReference(reference, node)) {
- if (node.parent.kind === 185 || node.parent.kind === 186) {
+ if (node.parent.kind === 186 || node.parent.kind === 187) {
var flowType = getTypeAtFlowNode(flow.antecedent);
return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType));
}
- return declaredType === autoType ? getBaseTypeOfLiteralType(getInitialOrAssignedType(node)) :
- declaredType.flags & 524288 ? getAssignmentReducedType(declaredType, getInitialOrAssignedType(node)) :
- declaredType;
+ if (declaredType === autoType || declaredType === autoArrayType) {
+ if (isEmptyArrayAssignment(node)) {
+ return getEvolvingArrayType(neverType);
+ }
+ var assignedType = getBaseTypeOfLiteralType(getInitialOrAssignedType(node));
+ return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
+ }
+ if (declaredType.flags & 524288) {
+ return getAssignmentReducedType(declaredType, getInitialOrAssignedType(node));
+ }
+ return declaredType;
}
if (containsMatchingReference(reference, node)) {
return declaredType;
}
return undefined;
}
+ function getTypeAtFlowArrayMutation(flow) {
+ var node = flow.node;
+ var expr = node.kind === 175 ?
+ node.expression.expression :
+ node.left.expression;
+ if (isMatchingReference(reference, getReferenceCandidate(expr))) {
+ var flowType = getTypeAtFlowNode(flow.antecedent);
+ var type = getTypeFromFlowType(flowType);
+ if (isEvolvingArrayType(type)) {
+ var evolvedType_1 = type;
+ if (node.kind === 175) {
+ for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
+ var arg = _a[_i];
+ evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);
+ }
+ }
+ else {
+ var indexType = checkExpression(node.left.argumentExpression);
+ if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 | 2048)) {
+ evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right);
+ }
+ }
+ return evolvedType_1 === type ? flowType : createFlowType(evolvedType_1, isIncomplete(flowType));
+ }
+ return flowType;
+ }
+ return undefined;
+ }
function getTypeAtFlowCondition(flow) {
var flowType = getTypeAtFlowNode(flow.antecedent);
var type = getTypeFromFlowType(flowType);
- if (!(type.flags & 8192)) {
- var assumeTrue = (flow.flags & 32) !== 0;
- type = narrowType(type, flow.expression, assumeTrue);
- if (type.flags & 8192 && isIncomplete(flowType)) {
- type = silentNeverType;
- }
+ if (type.flags & 8192) {
+ return flowType;
}
- return createFlowType(type, isIncomplete(flowType));
+ var assumeTrue = (flow.flags & 32) !== 0;
+ var nonEvolvingType = finalizeEvolvingArrayType(type);
+ var narrowedType = narrowType(nonEvolvingType, flow.expression, assumeTrue);
+ if (narrowedType === nonEvolvingType) {
+ return flowType;
+ }
+ var incomplete = isIncomplete(flowType);
+ var resultType = incomplete && narrowedType.flags & 8192 ? silentNeverType : narrowedType;
+ return createFlowType(resultType, incomplete);
}
function getTypeAtSwitchClause(flow) {
var flowType = getTypeAtFlowNode(flow.antecedent);
@@ -26753,7 +26580,7 @@ var ts;
seenIncomplete = true;
}
}
- return createFlowType(getUnionType(antecedentTypes, subtypeReduction), seenIncomplete);
+ return createFlowType(getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction), seenIncomplete);
}
function getTypeAtFlowLoopLabel(flow) {
var id = getFlowNodeId(flow);
@@ -26765,8 +26592,8 @@ var ts;
return cache[key];
}
for (var i = flowLoopStart; i < flowLoopCount; i++) {
- if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key) {
- return createFlowType(getUnionType(flowLoopTypes[i]), true);
+ if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) {
+ return createFlowType(getUnionOrEvolvingArrayType(flowLoopTypes[i], false), true);
}
}
var antecedentTypes = [];
@@ -26797,14 +26624,14 @@ var ts;
break;
}
}
- var result = getUnionType(antecedentTypes, subtypeReduction);
+ var result = getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction);
if (isIncomplete(firstAntecedentType)) {
return createFlowType(result, true);
}
return cache[key] = result;
}
function isMatchingReferenceDiscriminant(expr) {
- return expr.kind === 172 &&
+ return expr.kind === 173 &&
declaredType.flags & 524288 &&
isMatchingReference(reference, expr.expression) &&
isDiscriminantProperty(declaredType, expr.name.text);
@@ -26829,19 +26656,19 @@ var ts;
}
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
switch (expr.operatorToken.kind) {
- case 56:
+ case 57:
return narrowTypeByTruthiness(type, expr.left, assumeTrue);
- case 30:
case 31:
case 32:
case 33:
+ case 34:
var operator_1 = expr.operatorToken.kind;
var left_1 = getReferenceCandidate(expr.left);
var right_1 = getReferenceCandidate(expr.right);
- if (left_1.kind === 182 && right_1.kind === 9) {
+ if (left_1.kind === 183 && right_1.kind === 9) {
return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);
}
- if (right_1.kind === 182 && left_1.kind === 9) {
+ if (right_1.kind === 183 && left_1.kind === 9) {
return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);
}
if (isMatchingReference(reference, left_1)) {
@@ -26860,9 +26687,9 @@ var ts;
return declaredType;
}
break;
- case 91:
+ case 92:
return narrowTypeByInstanceof(type, expr, assumeTrue);
- case 24:
+ case 25:
return narrowType(type, expr.right, assumeTrue);
}
return type;
@@ -26871,7 +26698,7 @@ var ts;
if (type.flags & 1) {
return type;
}
- if (operator === 31 || operator === 33) {
+ if (operator === 32 || operator === 34) {
assumeTrue = !assumeTrue;
}
var valueType = checkExpression(value);
@@ -26879,10 +26706,10 @@ var ts;
if (!strictNullChecks) {
return type;
}
- var doubleEquals = operator === 30 || operator === 31;
+ var doubleEquals = operator === 31 || operator === 32;
var facts = doubleEquals ?
assumeTrue ? 65536 : 524288 :
- value.kind === 93 ?
+ value.kind === 94 ?
assumeTrue ? 32768 : 262144 :
assumeTrue ? 16384 : 131072;
return getTypeWithFacts(type, facts);
@@ -26908,7 +26735,7 @@ var ts;
}
return type;
}
- if (operator === 31 || operator === 33) {
+ if (operator === 32 || operator === 34) {
assumeTrue = !assumeTrue;
}
if (assumeTrue && !(type.flags & 524288)) {
@@ -27019,7 +26846,7 @@ var ts;
}
else {
var invokedExpression = skipParenthesizedNodes(callExpression.expression);
- if (invokedExpression.kind === 173 || invokedExpression.kind === 172) {
+ if (invokedExpression.kind === 174 || invokedExpression.kind === 173) {
var accessExpression = invokedExpression;
var possibleReference = skipParenthesizedNodes(accessExpression.expression);
if (isMatchingReference(reference, possibleReference)) {
@@ -27034,18 +26861,18 @@ var ts;
}
function narrowType(type, expr, assumeTrue) {
switch (expr.kind) {
- case 69:
- case 97:
- case 172:
+ case 70:
+ case 98:
+ case 173:
return narrowTypeByTruthiness(type, expr, assumeTrue);
- case 174:
+ case 175:
return narrowTypeByTypePredicate(type, expr, assumeTrue);
- case 178:
+ case 179:
return narrowType(type, expr.expression, assumeTrue);
- case 187:
+ case 188:
return narrowTypeByBinaryExpression(type, expr, assumeTrue);
- case 185:
- if (expr.operator === 49) {
+ case 186:
+ if (expr.operator === 50) {
return narrowType(type, expr.operand, !assumeTrue);
}
break;
@@ -27054,7 +26881,7 @@ var ts;
}
}
function getTypeOfSymbolAtLocation(symbol, location) {
- if (location.kind === 69) {
+ if (location.kind === 70) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
}
@@ -27068,7 +26895,7 @@ var ts;
return getTypeOfSymbol(symbol);
}
function skipParenthesizedNodes(expression) {
- while (expression.kind === 178) {
+ while (expression.kind === 179) {
expression = expression.expression;
}
return expression;
@@ -27077,9 +26904,9 @@ var ts;
while (true) {
node = node.parent;
if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||
- node.kind === 226 ||
+ node.kind === 227 ||
node.kind === 256 ||
- node.kind === 145) {
+ node.kind === 146) {
return node;
}
}
@@ -27107,10 +26934,10 @@ var ts;
}
}
function markParameterAssignments(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
if (ts.isAssignmentTarget(node)) {
var symbol = getResolvedSymbol(node);
- if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 142) {
+ if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 143) {
symbol.isAssigned = true;
}
}
@@ -27119,12 +26946,15 @@ var ts;
ts.forEachChild(node, markParameterAssignments);
}
}
+ function isConstVariable(symbol) {
+ return symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 && getTypeOfSymbol(symbol) !== autoArrayType;
+ }
function checkIdentifier(node) {
var symbol = getResolvedSymbol(node);
if (symbol === argumentsSymbol) {
var container = ts.getContainingFunction(node);
if (languageVersion < 2) {
- if (container.kind === 180) {
+ if (container.kind === 181) {
error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
}
else if (ts.hasModifier(container, 256)) {
@@ -27142,7 +26972,7 @@ var ts;
if (localOrExportSymbol.flags & 32) {
var declaration_1 = localOrExportSymbol.valueDeclaration;
if (languageVersion === 2
- && declaration_1.kind === 221
+ && declaration_1.kind === 222
&& ts.nodeIsDecorated(declaration_1)) {
var container = ts.getContainingClass(node);
while (container !== undefined) {
@@ -27154,11 +26984,11 @@ var ts;
container = ts.getContainingClass(container);
}
}
- else if (declaration_1.kind === 192) {
+ else if (declaration_1.kind === 193) {
var container = ts.getThisContainer(node, false);
while (container !== undefined) {
if (container.parent === declaration_1) {
- if (container.kind === 145 && ts.hasModifier(container, 32)) {
+ if (container.kind === 146 && ts.hasModifier(container, 32)) {
getNodeLinks(declaration_1).flags |= 8388608;
getNodeLinks(node).flags |= 16777216;
}
@@ -27176,28 +27006,26 @@ var ts;
if (!(localOrExportSymbol.flags & 3) || ts.isAssignmentTarget(node) || !declaration) {
return type;
}
- var isParameter = ts.getRootDeclaration(declaration).kind === 142;
+ var isParameter = ts.getRootDeclaration(declaration).kind === 143;
var declarationContainer = getControlFlowContainer(declaration);
var flowContainer = getControlFlowContainer(node);
var isOuterVariable = flowContainer !== declarationContainer;
- while (flowContainer !== declarationContainer &&
- (flowContainer.kind === 179 ||
- flowContainer.kind === 180 ||
- ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
- (isReadonlySymbol(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 180 ||
+ flowContainer.kind === 181 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
+ (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
var assumeInitialized = isParameter || isOuterVariable ||
- type !== autoType && (!strictNullChecks || (type.flags & 1) !== 0) ||
+ type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0) ||
ts.isInAmbientContext(declaration);
var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
- if (type === autoType) {
- if (flowType === autoType) {
+ if (type === autoType || type === autoArrayType) {
+ if (flowType === autoType || flowType === autoArrayType) {
if (compilerOptions.noImplicitAny) {
- error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_any_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol));
- error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(anyType));
+ error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType));
+ error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
}
- return anyType;
+ return convertAutoToAny(flowType);
}
}
else if (!assumeInitialized && !(getFalsyFlags(type) & 2048) && getFalsyFlags(flowType) & 2048) {
@@ -27237,8 +27065,8 @@ var ts;
if (usedInFunction) {
getNodeLinks(current).flags |= 65536;
}
- if (container.kind === 206 &&
- ts.getAncestor(symbol.valueDeclaration, 219).parent === container &&
+ if (container.kind === 207 &&
+ ts.getAncestor(symbol.valueDeclaration, 220).parent === container &&
isAssignedInBodyOfForStatement(node, container)) {
getNodeLinks(symbol.valueDeclaration).flags |= 2097152;
}
@@ -27250,16 +27078,16 @@ var ts;
}
function isAssignedInBodyOfForStatement(node, container) {
var current = node;
- while (current.parent.kind === 178) {
+ while (current.parent.kind === 179) {
current = current.parent;
}
var isAssigned = false;
if (ts.isAssignmentTarget(current)) {
isAssigned = true;
}
- else if ((current.parent.kind === 185 || current.parent.kind === 186)) {
+ else if ((current.parent.kind === 186 || current.parent.kind === 187)) {
var expr = current.parent;
- isAssigned = expr.operator === 41 || expr.operator === 42;
+ isAssigned = expr.operator === 42 || expr.operator === 43;
}
if (!isAssigned) {
return false;
@@ -27276,7 +27104,7 @@ var ts;
}
function captureLexicalThis(node, container) {
getNodeLinks(node).flags |= 2;
- if (container.kind === 145 || container.kind === 148) {
+ if (container.kind === 146 || container.kind === 149) {
var classNode = container.parent;
getNodeLinks(classNode).flags |= 4;
}
@@ -27310,7 +27138,7 @@ var ts;
function checkThisExpression(node) {
var container = ts.getThisContainer(node, true);
var needToCaptureLexicalThis = false;
- if (container.kind === 148) {
+ if (container.kind === 149) {
var containingClassDecl = container.parent;
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl);
if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) {
@@ -27320,29 +27148,29 @@ var ts;
}
}
}
- if (container.kind === 180) {
+ if (container.kind === 181) {
container = ts.getThisContainer(container, false);
needToCaptureLexicalThis = (languageVersion < 2);
}
switch (container.kind) {
- case 225:
+ case 226:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
break;
- case 224:
+ case 225:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
break;
- case 148:
+ case 149:
if (isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
}
break;
+ case 146:
case 145:
- case 144:
if (ts.getModifierFlags(container) & 32) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);
}
break;
- case 140:
+ case 141:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
break;
}
@@ -27351,7 +27179,7 @@ var ts;
}
if (ts.isFunctionLike(container) &&
(!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) {
- if (container.kind === 179 &&
+ if (container.kind === 180 &&
ts.isInJavaScriptFile(container.parent) &&
ts.getSpecialPropertyAssignmentKind(container.parent) === 3) {
var className = container.parent
@@ -27363,7 +27191,7 @@ var ts;
return getInferredClassType(classSymbol);
}
}
- var thisType = getThisTypeOfDeclaration(container);
+ var thisType = getThisTypeOfDeclaration(container) || getContextualThisParameterType(container);
if (thisType) {
return thisType;
}
@@ -27395,18 +27223,18 @@ var ts;
}
function isInConstructorArgumentInitializer(node, constructorDecl) {
for (var n = node; n && n !== constructorDecl; n = n.parent) {
- if (n.kind === 142) {
+ if (n.kind === 143) {
return true;
}
}
return false;
}
function checkSuperExpression(node) {
- var isCallExpression = node.parent.kind === 174 && node.parent.expression === node;
+ var isCallExpression = node.parent.kind === 175 && node.parent.expression === node;
var container = ts.getSuperContainer(node, true);
var needToCaptureLexicalThis = false;
if (!isCallExpression) {
- while (container && container.kind === 180) {
+ while (container && container.kind === 181) {
container = ts.getSuperContainer(container, true);
needToCaptureLexicalThis = languageVersion < 2;
}
@@ -27415,16 +27243,16 @@ var ts;
var nodeCheckFlag = 0;
if (!canUseSuperExpression) {
var current = node;
- while (current && current !== container && current.kind !== 140) {
+ while (current && current !== container && current.kind !== 141) {
current = current.parent;
}
- if (current && current.kind === 140) {
+ if (current && current.kind === 141) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
}
else if (isCallExpression) {
error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
}
- else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 171)) {
+ else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 172)) {
error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
}
else {
@@ -27439,7 +27267,7 @@ var ts;
nodeCheckFlag = 256;
}
getNodeLinks(node).flags |= nodeCheckFlag;
- if (container.kind === 147 && ts.getModifierFlags(container) & 256) {
+ if (container.kind === 148 && ts.getModifierFlags(container) & 256) {
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
getNodeLinks(container).flags |= 4096;
}
@@ -27450,7 +27278,7 @@ var ts;
if (needToCaptureLexicalThis) {
captureLexicalThis(node.parent, container);
}
- if (container.parent.kind === 171) {
+ if (container.parent.kind === 172) {
if (languageVersion < 2) {
error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
return unknownType;
@@ -27468,7 +27296,7 @@ var ts;
}
return unknownType;
}
- if (container.kind === 148 && isInConstructorArgumentInitializer(node, container)) {
+ if (container.kind === 149 && isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
return unknownType;
}
@@ -27480,35 +27308,38 @@ var ts;
return false;
}
if (isCallExpression) {
- return container.kind === 148;
+ return container.kind === 149;
}
else {
- if (ts.isClassLike(container.parent) || container.parent.kind === 171) {
+ if (ts.isClassLike(container.parent) || container.parent.kind === 172) {
if (ts.getModifierFlags(container) & 32) {
- return container.kind === 147 ||
- container.kind === 146 ||
- container.kind === 149 ||
- container.kind === 150;
+ return container.kind === 148 ||
+ container.kind === 147 ||
+ container.kind === 150 ||
+ container.kind === 151;
}
else {
- return container.kind === 147 ||
- container.kind === 146 ||
- container.kind === 149 ||
+ return container.kind === 148 ||
+ container.kind === 147 ||
container.kind === 150 ||
+ container.kind === 151 ||
+ container.kind === 146 ||
container.kind === 145 ||
- container.kind === 144 ||
- container.kind === 148;
+ container.kind === 149;
}
}
}
return false;
}
}
- function getContextualThisParameter(func) {
- if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 180) {
+ function getContextualThisParameterType(func) {
+ if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 181) {
var contextualSignature = getContextualSignature(func);
if (contextualSignature) {
- return contextualSignature.thisParameter;
+ var thisParameter = contextualSignature.thisParameter;
+ if (thisParameter) {
+ return getTypeOfSymbol(thisParameter);
+ }
}
}
return undefined;
@@ -27558,7 +27389,7 @@ var ts;
if (declaration.type) {
return getTypeFromTypeNode(declaration.type);
}
- if (declaration.kind === 142) {
+ if (declaration.kind === 143) {
var type = getContextuallyTypedParameterType(declaration);
if (type) {
return type;
@@ -27569,11 +27400,11 @@ var ts;
}
if (ts.isBindingPattern(declaration.parent)) {
var parentDeclaration = declaration.parent.parent;
- var name_18 = declaration.propertyName || declaration.name;
+ var name_15 = declaration.propertyName || declaration.name;
if (ts.isVariableLike(parentDeclaration) &&
parentDeclaration.type &&
- !ts.isBindingPattern(name_18)) {
- var text = getTextOfPropertyName(name_18);
+ !ts.isBindingPattern(name_15)) {
+ var text = getTextOfPropertyName(name_15);
if (text) {
return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text);
}
@@ -27610,7 +27441,7 @@ var ts;
}
function isInParameterInitializerBeforeContainingFunction(node) {
while (node.parent && !ts.isFunctionLike(node.parent)) {
- if (node.parent.kind === 142 && node.parent.initializer === node) {
+ if (node.parent.kind === 143 && node.parent.initializer === node) {
return true;
}
node = node.parent;
@@ -27619,8 +27450,8 @@ var ts;
}
function getContextualReturnType(functionDecl) {
if (functionDecl.type ||
- functionDecl.kind === 148 ||
- functionDecl.kind === 149 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 150))) {
+ functionDecl.kind === 149 ||
+ functionDecl.kind === 150 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 151))) {
return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl));
}
var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
@@ -27639,7 +27470,7 @@ var ts;
return undefined;
}
function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
- if (template.parent.kind === 176) {
+ if (template.parent.kind === 177) {
return getContextualTypeForArgument(template.parent, substitutionExpression);
}
return undefined;
@@ -27647,7 +27478,7 @@ var ts;
function getContextualTypeForBinaryOperand(node) {
var binaryExpression = node.parent;
var operator = binaryExpression.operatorToken.kind;
- if (operator >= 56 && operator <= 68) {
+ if (operator >= 57 && operator <= 69) {
if (ts.getSpecialPropertyAssignmentKind(binaryExpression) !== 0) {
return undefined;
}
@@ -27655,14 +27486,14 @@ var ts;
return checkExpression(binaryExpression.left);
}
}
- else if (operator === 52) {
+ else if (operator === 53) {
var type = getContextualType(binaryExpression);
if (!type && node === binaryExpression.right) {
type = checkExpression(binaryExpression.left);
}
return type;
}
- else if (operator === 51 || operator === 24) {
+ else if (operator === 52 || operator === 25) {
if (node === binaryExpression.right) {
return getContextualType(binaryExpression);
}
@@ -27676,8 +27507,8 @@ var ts;
var types = type.types;
var mappedType;
var mappedTypes;
- for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
- var current = types_12[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var current = types_13[_i];
var t = mapper(current);
if (t) {
if (!mappedType) {
@@ -27771,36 +27602,36 @@ var ts;
}
var parent = node.parent;
switch (parent.kind) {
- case 218:
- case 142:
+ case 219:
+ case 143:
+ case 146:
case 145:
- case 144:
- case 169:
+ case 170:
return getContextualTypeForInitializerExpression(node);
- case 180:
- case 211:
+ case 181:
+ case 212:
return getContextualTypeForReturnExpression(node);
- case 190:
+ case 191:
return getContextualTypeForYieldOperand(parent);
- case 174:
case 175:
+ case 176:
return getContextualTypeForArgument(parent, node);
- case 177:
- case 195:
+ case 178:
+ case 196:
return getTypeFromTypeNode(parent.type);
- case 187:
+ case 188:
return getContextualTypeForBinaryOperand(node);
case 253:
case 254:
return getContextualTypeForObjectLiteralElement(parent);
- case 170:
+ case 171:
return getContextualTypeForElementExpression(node);
- case 188:
+ case 189:
return getContextualTypeForConditionalOperand(node);
- case 197:
- ts.Debug.assert(parent.parent.kind === 189);
+ case 198:
+ ts.Debug.assert(parent.parent.kind === 190);
return getContextualTypeForSubstitutionExpression(parent.parent, node);
- case 178:
+ case 179:
return getContextualType(parent);
case 248:
return getContextualType(parent);
@@ -27820,7 +27651,7 @@ var ts;
}
}
function isFunctionExpressionOrArrowFunction(node) {
- return node.kind === 179 || node.kind === 180;
+ return node.kind === 180 || node.kind === 181;
}
function getContextualSignatureForFunctionLikeDeclaration(node) {
return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node)
@@ -27833,7 +27664,7 @@ var ts;
getApparentTypeOfContextualType(node);
}
function getContextualSignature(node) {
- ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 148 || ts.isObjectLiteralMethod(node));
var type = getContextualTypeForFunctionLikeDeclaration(node);
if (!type) {
return undefined;
@@ -27843,8 +27674,8 @@ var ts;
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var current = types_13[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var current = types_14[_i];
var signature = getNonGenericSignature(current);
if (signature) {
if (!signatureList) {
@@ -27874,8 +27705,8 @@ var ts;
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false);
}
function hasDefaultValue(node) {
- return (node.kind === 169 && !!node.initializer) ||
- (node.kind === 187 && node.operatorToken.kind === 56);
+ return (node.kind === 170 && !!node.initializer) ||
+ (node.kind === 188 && node.operatorToken.kind === 57);
}
function checkArrayLiteral(node, contextualMapper) {
var elements = node.elements;
@@ -27884,7 +27715,7 @@ var ts;
var inDestructuringPattern = ts.isAssignmentTarget(node);
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
var e = elements_1[_i];
- if (inDestructuringPattern && e.kind === 191) {
+ if (inDestructuringPattern && e.kind === 192) {
var restArrayType = checkExpression(e.expression, contextualMapper);
var restElementType = getIndexTypeOfType(restArrayType, 1) ||
(languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined);
@@ -27896,7 +27727,7 @@ var ts;
var type = checkExpressionForMutableLocation(e, contextualMapper);
elementTypes.push(type);
}
- hasSpreadElement = hasSpreadElement || e.kind === 191;
+ hasSpreadElement = hasSpreadElement || e.kind === 192;
}
if (!hasSpreadElement) {
if (inDestructuringPattern && elementTypes.length) {
@@ -27907,7 +27738,7 @@ var ts;
var contextualType = getApparentTypeOfContextualType(node);
if (contextualType && contextualTypeIsTupleLikeType(contextualType)) {
var pattern = contextualType.pattern;
- if (pattern && (pattern.kind === 168 || pattern.kind === 170)) {
+ if (pattern && (pattern.kind === 169 || pattern.kind === 171)) {
var patternElements = pattern.elements;
for (var i = elementTypes.length; i < patternElements.length; i++) {
var patternElement = patternElements[i];
@@ -27915,7 +27746,7 @@ var ts;
elementTypes.push(contextualType.typeArguments[i]);
}
else {
- if (patternElement.kind !== 193) {
+ if (patternElement.kind !== 194) {
error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
elementTypes.push(unknownType);
@@ -27932,7 +27763,7 @@ var ts;
strictNullChecks ? neverType : undefinedWideningType);
}
function isNumericName(name) {
- return name.kind === 140 ? isNumericComputedName(name) : isNumericLiteralName(name.text);
+ return name.kind === 141 ? isNumericComputedName(name) : isNumericLiteralName(name.text);
}
function isNumericComputedName(name) {
return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 340);
@@ -27976,7 +27807,7 @@ var ts;
var propertiesArray = [];
var contextualType = getApparentTypeOfContextualType(node);
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
- (contextualType.pattern.kind === 167 || contextualType.pattern.kind === 171);
+ (contextualType.pattern.kind === 168 || contextualType.pattern.kind === 172);
var typeFlags = 0;
var patternWithComputedProperties = false;
var hasComputedStringProperty = false;
@@ -27991,7 +27822,7 @@ var ts;
if (memberDecl.kind === 253) {
type = checkPropertyAssignment(memberDecl, contextualMapper);
}
- else if (memberDecl.kind === 147) {
+ else if (memberDecl.kind === 148) {
type = checkObjectLiteralMethod(memberDecl, contextualMapper);
}
else {
@@ -28030,7 +27861,7 @@ var ts;
member = prop;
}
else {
- ts.Debug.assert(memberDecl.kind === 149 || memberDecl.kind === 150);
+ ts.Debug.assert(memberDecl.kind === 150 || memberDecl.kind === 151);
checkAccessorDeclaration(memberDecl);
}
if (ts.hasDynamicName(memberDecl)) {
@@ -28089,10 +27920,10 @@ var ts;
case 248:
checkJsxExpression(child);
break;
- case 241:
+ case 242:
checkJsxElement(child);
break;
- case 242:
+ case 243:
checkJsxSelfClosingElement(child);
break;
}
@@ -28103,7 +27934,7 @@ var ts;
return name.indexOf("-") < 0;
}
function isJsxIntrinsicIdentifier(tagName) {
- if (tagName.kind === 172 || tagName.kind === 97) {
+ if (tagName.kind === 173 || tagName.kind === 98) {
return false;
}
else {
@@ -28206,7 +28037,7 @@ var ts;
return unknownType;
}
}
- return getUnionType(signatures.map(getReturnTypeOfSignature), true);
+ return getUnionType(ts.map(signatures, getReturnTypeOfSignature), true);
}
function getJsxElementPropertiesName() {
var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1920, undefined);
@@ -28235,7 +28066,7 @@ var ts;
}
if (elemType.flags & 524288) {
var types = elemType.types;
- return getUnionType(types.map(function (type) {
+ return getUnionType(ts.map(types, function (type) {
return getResolvedJsxType(node, type, elemClassType);
}), true);
}
@@ -28411,7 +28242,7 @@ var ts;
}
}
function getDeclarationKindFromSymbol(s) {
- return s.valueDeclaration ? s.valueDeclaration.kind : 145;
+ return s.valueDeclaration ? s.valueDeclaration.kind : 146;
}
function getDeclarationModifierFlagsFromSymbol(s) {
return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0;
@@ -28422,11 +28253,11 @@ var ts;
function checkClassPropertyAccess(node, left, type, prop) {
var flags = getDeclarationModifierFlagsFromSymbol(prop);
var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop));
- var errorNode = node.kind === 172 || node.kind === 218 ?
+ var errorNode = node.kind === 173 || node.kind === 219 ?
node.name :
node.right;
- if (left.kind === 95) {
- if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 147) {
+ if (left.kind === 96) {
+ if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 148) {
error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);
return false;
}
@@ -28446,7 +28277,7 @@ var ts;
}
return true;
}
- if (left.kind === 95) {
+ if (left.kind === 96) {
return true;
}
var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) {
@@ -28520,7 +28351,7 @@ var ts;
checkClassPropertyAccess(node, left, apparentType, prop);
}
var propType = getTypeOfSymbol(prop);
- if (node.kind !== 172 || ts.isAssignmentTarget(node) ||
+ if (node.kind !== 173 || ts.isAssignmentTarget(node) ||
!(prop.flags & (3 | 4 | 98304)) &&
!(prop.flags & 8192 && propType.flags & 524288)) {
return propType;
@@ -28542,7 +28373,7 @@ var ts;
}
}
function isValidPropertyAccess(node, propertyName) {
- var left = node.kind === 172
+ var left = node.kind === 173
? node.expression
: node.left;
var type = checkExpression(left);
@@ -28556,13 +28387,13 @@ var ts;
}
function getForInVariableSymbol(node) {
var initializer = node.initializer;
- if (initializer.kind === 219) {
+ if (initializer.kind === 220) {
var variable = initializer.declarations[0];
if (variable && !ts.isBindingPattern(variable.name)) {
return getSymbolOfNode(variable);
}
}
- else if (initializer.kind === 69) {
+ else if (initializer.kind === 70) {
return getResolvedSymbol(initializer);
}
return undefined;
@@ -28572,13 +28403,13 @@ var ts;
}
function isForInVariableForNumericPropertyNames(expr) {
var e = skipParenthesizedNodes(expr);
- if (e.kind === 69) {
+ if (e.kind === 70) {
var symbol = getResolvedSymbol(e);
if (symbol.flags & 3) {
var child = expr;
var node = expr.parent;
while (node) {
- if (node.kind === 207 &&
+ if (node.kind === 208 &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
hasNumericPropertyNames(checkExpression(node.expression))) {
@@ -28594,7 +28425,7 @@ var ts;
function checkIndexedAccess(node) {
if (!node.argumentExpression) {
var sourceFile = ts.getSourceFileOfNode(node);
- if (node.parent.kind === 175 && node.parent.expression === node) {
+ if (node.parent.kind === 176 && node.parent.expression === node) {
var start = ts.skipTrivia(sourceFile.text, node.expression.end);
var end = node.end;
grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);
@@ -28617,15 +28448,15 @@ var ts;
return unknownType;
}
if (node.argumentExpression) {
- var name_19 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType);
- if (name_19 !== undefined) {
- var prop = getPropertyOfType(objectType, name_19);
+ var name_16 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType);
+ if (name_16 !== undefined) {
+ var prop = getPropertyOfType(objectType, name_16);
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_19, symbolToString(objectType.symbol));
+ error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_16, symbolToString(objectType.symbol));
return unknownType;
}
}
@@ -28658,7 +28489,7 @@ var ts;
if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) {
return indexArgumentExpression.text;
}
- if (indexArgumentExpression.kind === 173 || indexArgumentExpression.kind === 172) {
+ if (indexArgumentExpression.kind === 174 || indexArgumentExpression.kind === 173) {
var value = getConstantValue(indexArgumentExpression);
if (value !== undefined) {
return value.toString();
@@ -28701,10 +28532,10 @@ var ts;
return true;
}
function resolveUntypedCall(node) {
- if (node.kind === 176) {
+ if (node.kind === 177) {
checkExpression(node.template);
}
- else if (node.kind !== 143) {
+ else if (node.kind !== 144) {
ts.forEach(node.arguments, function (argument) {
checkExpression(argument);
});
@@ -28755,7 +28586,7 @@ var ts;
function getSpreadArgumentIndex(args) {
for (var i = 0; i < args.length; i++) {
var arg = args[i];
- if (arg && arg.kind === 191) {
+ if (arg && arg.kind === 192) {
return i;
}
}
@@ -28768,11 +28599,11 @@ var ts;
var callIsIncomplete;
var isDecorator;
var spreadArgIndex = -1;
- if (node.kind === 176) {
+ if (node.kind === 177) {
var tagExpression = node;
argCount = args.length;
typeArguments = undefined;
- if (tagExpression.template.kind === 189) {
+ if (tagExpression.template.kind === 190) {
var templateExpression = tagExpression.template;
var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans);
ts.Debug.assert(lastSpan !== undefined);
@@ -28780,11 +28611,11 @@ var ts;
}
else {
var templateLiteral = tagExpression.template;
- ts.Debug.assert(templateLiteral.kind === 11);
+ ts.Debug.assert(templateLiteral.kind === 12);
callIsIncomplete = !!templateLiteral.isUnterminated;
}
}
- else if (node.kind === 143) {
+ else if (node.kind === 144) {
isDecorator = true;
typeArguments = undefined;
argCount = getEffectiveArgumentCount(node, undefined, signature);
@@ -28792,7 +28623,7 @@ var ts;
else {
var callExpression = node;
if (!callExpression.arguments) {
- ts.Debug.assert(callExpression.kind === 175);
+ ts.Debug.assert(callExpression.kind === 176);
return signature.minArgumentCount === 0;
}
argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
@@ -28851,9 +28682,9 @@ var ts;
var argCount = getEffectiveArgumentCount(node, args, signature);
for (var i = 0; i < argCount; i++) {
var arg = getEffectiveArgument(node, args, i);
- if (arg === undefined || arg.kind !== 193) {
+ if (arg === undefined || arg.kind !== 194) {
var paramType = getTypeAtPosition(signature, i);
- var argType = getEffectiveArgumentType(node, i, arg);
+ var argType = getEffectiveArgumentType(node, i);
if (argType === undefined) {
var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper;
argType = checkExpressionWithContextualType(arg, paramType, mapper);
@@ -28898,7 +28729,7 @@ var ts;
}
function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) {
var thisType = getThisTypeOfSignature(signature);
- if (thisType && thisType !== voidType && node.kind !== 175) {
+ if (thisType && thisType !== voidType && node.kind !== 176) {
var thisArgumentNode = getThisArgumentOfCall(node);
var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;
var errorNode = reportErrors ? (thisArgumentNode || node) : undefined;
@@ -28911,9 +28742,9 @@ var ts;
var argCount = getEffectiveArgumentCount(node, args, signature);
for (var i = 0; i < argCount; i++) {
var arg = getEffectiveArgument(node, args, i);
- if (arg === undefined || arg.kind !== 193) {
+ if (arg === undefined || arg.kind !== 194) {
var paramType = getTypeAtPosition(signature, i);
- var argType = getEffectiveArgumentType(node, i, arg);
+ var argType = getEffectiveArgumentType(node, i);
if (argType === undefined) {
argType = checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);
}
@@ -28926,28 +28757,28 @@ var ts;
return true;
}
function getThisArgumentOfCall(node) {
- if (node.kind === 174) {
+ if (node.kind === 175) {
var callee = node.expression;
- if (callee.kind === 172) {
+ if (callee.kind === 173) {
return callee.expression;
}
- else if (callee.kind === 173) {
+ else if (callee.kind === 174) {
return callee.expression;
}
}
}
function getEffectiveCallArguments(node) {
var args;
- if (node.kind === 176) {
+ if (node.kind === 177) {
var template = node.template;
args = [undefined];
- if (template.kind === 189) {
+ if (template.kind === 190) {
ts.forEach(template.templateSpans, function (span) {
args.push(span.expression);
});
}
}
- else if (node.kind === 143) {
+ else if (node.kind === 144) {
return undefined;
}
else {
@@ -28956,21 +28787,21 @@ var ts;
return args;
}
function getEffectiveArgumentCount(node, args, signature) {
- if (node.kind === 143) {
+ if (node.kind === 144) {
switch (node.parent.kind) {
- case 221:
- case 192:
+ case 222:
+ case 193:
return 1;
- case 145:
+ case 146:
return 2;
- case 147:
- case 149:
+ case 148:
case 150:
+ case 151:
if (languageVersion === 0) {
return 2;
}
return signature.parameters.length >= 3 ? 3 : 2;
- case 142:
+ case 143:
return 3;
}
}
@@ -28979,48 +28810,48 @@ var ts;
}
}
function getEffectiveDecoratorFirstArgumentType(node) {
- if (node.kind === 221) {
+ if (node.kind === 222) {
var classSymbol = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol);
}
- if (node.kind === 142) {
+ if (node.kind === 143) {
node = node.parent;
- if (node.kind === 148) {
+ if (node.kind === 149) {
var classSymbol = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol);
}
}
- if (node.kind === 145 ||
- node.kind === 147 ||
- node.kind === 149 ||
- node.kind === 150) {
+ if (node.kind === 146 ||
+ node.kind === 148 ||
+ node.kind === 150 ||
+ node.kind === 151) {
return getParentTypeOfClassElement(node);
}
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
}
function getEffectiveDecoratorSecondArgumentType(node) {
- if (node.kind === 221) {
+ if (node.kind === 222) {
ts.Debug.fail("Class decorators should not have a second synthetic argument.");
return unknownType;
}
- if (node.kind === 142) {
+ if (node.kind === 143) {
node = node.parent;
- if (node.kind === 148) {
+ if (node.kind === 149) {
return anyType;
}
}
- if (node.kind === 145 ||
- node.kind === 147 ||
- node.kind === 149 ||
- node.kind === 150) {
+ if (node.kind === 146 ||
+ node.kind === 148 ||
+ node.kind === 150 ||
+ node.kind === 151) {
var element = node;
switch (element.name.kind) {
- case 69:
+ case 70:
case 8:
case 9:
return getLiteralTypeForText(32, element.name.text);
- case 140:
+ case 141:
var nameType = checkComputedPropertyName(element.name);
if (isTypeOfKind(nameType, 512)) {
return nameType;
@@ -29037,20 +28868,20 @@ var ts;
return unknownType;
}
function getEffectiveDecoratorThirdArgumentType(node) {
- if (node.kind === 221) {
+ if (node.kind === 222) {
ts.Debug.fail("Class decorators should not have a third synthetic argument.");
return unknownType;
}
- if (node.kind === 142) {
+ if (node.kind === 143) {
return numberType;
}
- if (node.kind === 145) {
+ if (node.kind === 146) {
ts.Debug.fail("Property decorators should not have a third synthetic argument.");
return unknownType;
}
- if (node.kind === 147 ||
- node.kind === 149 ||
- node.kind === 150) {
+ if (node.kind === 148 ||
+ node.kind === 150 ||
+ node.kind === 151) {
var propertyType = getTypeOfNode(node);
return createTypedPropertyDescriptorType(propertyType);
}
@@ -29070,27 +28901,27 @@ var ts;
ts.Debug.fail("Decorators should not have a fourth synthetic argument.");
return unknownType;
}
- function getEffectiveArgumentType(node, argIndex, arg) {
- if (node.kind === 143) {
+ function getEffectiveArgumentType(node, argIndex) {
+ if (node.kind === 144) {
return getEffectiveDecoratorArgumentType(node, argIndex);
}
- else if (argIndex === 0 && node.kind === 176) {
+ else if (argIndex === 0 && node.kind === 177) {
return getGlobalTemplateStringsArrayType();
}
return undefined;
}
function getEffectiveArgument(node, args, argIndex) {
- if (node.kind === 143 ||
- (argIndex === 0 && node.kind === 176)) {
+ if (node.kind === 144 ||
+ (argIndex === 0 && node.kind === 177)) {
return undefined;
}
return args[argIndex];
}
function getEffectiveArgumentErrorNode(node, argIndex, arg) {
- if (node.kind === 143) {
+ if (node.kind === 144) {
return node.expression;
}
- else if (argIndex === 0 && node.kind === 176) {
+ else if (argIndex === 0 && node.kind === 177) {
return node.template;
}
else {
@@ -29098,12 +28929,12 @@ var ts;
}
}
function resolveCall(node, signatures, candidatesOutArray, headMessage) {
- var isTaggedTemplate = node.kind === 176;
- var isDecorator = node.kind === 143;
+ var isTaggedTemplate = node.kind === 177;
+ var isDecorator = node.kind === 144;
var typeArguments;
if (!isTaggedTemplate && !isDecorator) {
typeArguments = node.typeArguments;
- if (node.expression.kind !== 95) {
+ if (node.expression.kind !== 96) {
ts.forEach(typeArguments, checkSourceElement);
}
}
@@ -29129,7 +28960,7 @@ var ts;
var candidateForTypeArgumentError;
var resultOfFailedInference;
var result;
- var signatureHelpTrailingComma = candidatesOutArray && node.kind === 174 && node.arguments.hasTrailingComma;
+ var signatureHelpTrailingComma = candidatesOutArray && node.kind === 175 && node.arguments.hasTrailingComma;
if (candidates.length > 1) {
result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma);
}
@@ -29244,7 +29075,7 @@ var ts;
}
}
function resolveCallExpression(node, candidatesOutArray) {
- if (node.expression.kind === 95) {
+ if (node.expression.kind === 96) {
var superType = checkSuperExpression(node.expression);
if (superType !== unknownType) {
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node));
@@ -29397,16 +29228,16 @@ var ts;
}
function getDiagnosticHeadMessageForDecoratorResolution(node) {
switch (node.parent.kind) {
- case 221:
- case 192:
+ case 222:
+ case 193:
return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;
- case 142:
+ case 143:
return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;
- case 145:
+ case 146:
return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;
- case 147:
- case 149:
+ case 148:
case 150:
+ case 151:
return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;
}
}
@@ -29433,13 +29264,13 @@ var ts;
}
function resolveSignature(node, candidatesOutArray) {
switch (node.kind) {
- case 174:
- return resolveCallExpression(node, candidatesOutArray);
case 175:
- return resolveNewExpression(node, candidatesOutArray);
+ return resolveCallExpression(node, candidatesOutArray);
case 176:
+ return resolveNewExpression(node, candidatesOutArray);
+ case 177:
return resolveTaggedTemplateExpression(node, candidatesOutArray);
- case 143:
+ case 144:
return resolveDecorator(node, candidatesOutArray);
}
ts.Debug.fail("Branch in 'resolveSignature' should be unreachable.");
@@ -29468,17 +29299,17 @@ var ts;
function checkCallExpression(node) {
checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments);
var signature = getResolvedSignature(node);
- if (node.expression.kind === 95) {
+ if (node.expression.kind === 96) {
return voidType;
}
- if (node.kind === 175) {
+ if (node.kind === 176) {
var declaration = signature.declaration;
if (declaration &&
- declaration.kind !== 148 &&
- declaration.kind !== 152 &&
- declaration.kind !== 157 &&
+ declaration.kind !== 149 &&
+ declaration.kind !== 153 &&
+ declaration.kind !== 158 &&
!ts.isJSDocConstructSignature(declaration)) {
- var funcSymbol = node.expression.kind === 69 ?
+ var funcSymbol = node.expression.kind === 70 ?
getResolvedSymbol(node.expression) :
checkExpression(node.expression).symbol;
if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) {
@@ -29490,7 +29321,9 @@ var ts;
return anyType;
}
}
- if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node, true)) {
+ if (ts.isInJavaScriptFile(node) &&
+ ts.isRequireCall(node, true) &&
+ !resolveName(node.expression, node.expression.text, 107455, undefined, undefined)) {
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
}
return getReturnTypeOfSignature(signature);
@@ -29530,21 +29363,36 @@ var ts;
}
function assignContextualParameterTypes(signature, context, mapper) {
var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0);
+ if (isInferentialContext(mapper)) {
+ for (var i = 0; i < len; i++) {
+ var declaration = signature.parameters[i].valueDeclaration;
+ if (declaration.type) {
+ inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i));
+ }
+ }
+ }
if (context.thisParameter) {
- if (!signature.thisParameter) {
- signature.thisParameter = createTransientSymbol(context.thisParameter, undefined);
+ var parameter = signature.thisParameter;
+ if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) {
+ if (!parameter) {
+ signature.thisParameter = createTransientSymbol(context.thisParameter, undefined);
+ }
+ assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper);
}
- assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper);
}
for (var i = 0; i < len; i++) {
var parameter = signature.parameters[i];
- var contextualParameterType = getTypeAtPosition(context, i);
- assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
+ if (!parameter.valueDeclaration.type) {
+ var contextualParameterType = getTypeAtPosition(context, i);
+ assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
+ }
}
if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) {
var parameter = ts.lastOrUndefined(signature.parameters);
- var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters));
- assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
+ if (!parameter.valueDeclaration.type) {
+ var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters));
+ assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
+ }
}
}
function assignBindingElementTypes(node) {
@@ -29552,7 +29400,7 @@ var ts;
for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (!ts.isOmittedExpression(element)) {
- if (element.name.kind === 69) {
+ if (element.name.kind === 70) {
getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
}
assignBindingElementTypes(element);
@@ -29565,8 +29413,8 @@ var ts;
if (!links.type) {
links.type = instantiateType(contextualType, mapper);
if (links.type === emptyObjectType &&
- (parameter.valueDeclaration.name.kind === 167 ||
- parameter.valueDeclaration.name.kind === 168)) {
+ (parameter.valueDeclaration.name.kind === 168 ||
+ parameter.valueDeclaration.name.kind === 169)) {
links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name);
}
assignBindingElementTypes(parameter.valueDeclaration);
@@ -29605,7 +29453,7 @@ var ts;
}
var isAsync = ts.isAsyncFunctionLike(func);
var type;
- if (func.body.kind !== 199) {
+ if (func.body.kind !== 200) {
type = checkExpressionCached(func.body, contextualMapper);
if (isAsync) {
type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);
@@ -29684,7 +29532,7 @@ var ts;
return false;
}
var lastStatement = ts.lastOrUndefined(func.body.statements);
- if (lastStatement && lastStatement.kind === 213 && isExhaustiveSwitchStatement(lastStatement)) {
+ if (lastStatement && lastStatement.kind === 214 && isExhaustiveSwitchStatement(lastStatement)) {
return false;
}
return true;
@@ -29713,7 +29561,7 @@ var ts;
}
});
if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever ||
- func.kind === 179 || func.kind === 180)) {
+ func.kind === 180 || func.kind === 181)) {
return undefined;
}
if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) {
@@ -29730,7 +29578,7 @@ var ts;
if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) {
return;
}
- if (ts.nodeIsMissing(func.body) || func.body.kind !== 199 || !functionHasImplicitReturn(func)) {
+ if (ts.nodeIsMissing(func.body) || func.body.kind !== 200 || !functionHasImplicitReturn(func)) {
return;
}
var hasExplicitReturn = func.flags & 256;
@@ -29757,9 +29605,9 @@ var ts;
}
}
function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) {
- ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 148 || ts.isObjectLiteralMethod(node));
var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
- if (!hasGrammarError && node.kind === 179) {
+ if (!hasGrammarError && node.kind === 180) {
checkGrammarForGenerator(node);
}
if (contextualMapper === identityMapper && isContextSensitive(node)) {
@@ -29793,14 +29641,14 @@ var ts;
}
}
}
- if (produceDiagnostics && node.kind !== 147) {
+ if (produceDiagnostics && node.kind !== 148) {
checkCollisionWithCapturedSuperVariable(node, node.name);
checkCollisionWithCapturedThisVariable(node, node.name);
}
return type;
}
function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {
- ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 148 || ts.isObjectLiteralMethod(node));
var isAsync = ts.isAsyncFunctionLike(node);
var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));
if (!node.asteriskToken) {
@@ -29810,7 +29658,7 @@ var ts;
if (!node.type) {
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
- if (node.body.kind === 199) {
+ if (node.body.kind === 200) {
checkSourceElement(node.body);
}
else {
@@ -29845,10 +29693,10 @@ var ts;
function isReferenceToReadonlyEntity(expr, symbol) {
if (isReadonlySymbol(symbol)) {
if (symbol.flags & 4 &&
- (expr.kind === 172 || expr.kind === 173) &&
- expr.expression.kind === 97) {
+ (expr.kind === 173 || expr.kind === 174) &&
+ expr.expression.kind === 98) {
var func = ts.getContainingFunction(expr);
- if (!(func && func.kind === 148))
+ if (!(func && func.kind === 149))
return true;
return !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent);
}
@@ -29857,13 +29705,13 @@ var ts;
return false;
}
function isReferenceThroughNamespaceImport(expr) {
- if (expr.kind === 172 || expr.kind === 173) {
+ if (expr.kind === 173 || expr.kind === 174) {
var node = skipParenthesizedNodes(expr.expression);
- if (node.kind === 69) {
+ if (node.kind === 70) {
var symbol = getNodeLinks(node).resolvedSymbol;
if (symbol.flags & 8388608) {
var declaration = getDeclarationOfAliasSymbol(symbol);
- return declaration && declaration.kind === 232;
+ return declaration && declaration.kind === 233;
}
}
}
@@ -29871,7 +29719,7 @@ var ts;
}
function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) {
var node = skipParenthesizedNodes(expr);
- if (node.kind !== 69 && node.kind !== 172 && node.kind !== 173) {
+ if (node.kind !== 70 && node.kind !== 173 && node.kind !== 174) {
error(expr, invalidReferenceMessage);
return false;
}
@@ -29879,7 +29727,7 @@ var ts;
var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
if (symbol) {
if (symbol !== unknownSymbol && symbol !== argumentsSymbol) {
- if (node.kind === 69 && !(symbol.flags & 3)) {
+ if (node.kind === 70 && !(symbol.flags & 3)) {
error(expr, invalidReferenceMessage);
return false;
}
@@ -29889,7 +29737,7 @@ var ts;
}
}
}
- else if (node.kind === 173) {
+ else if (node.kind === 174) {
if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) {
error(expr, constantVariableMessage);
return false;
@@ -29926,24 +29774,24 @@ var ts;
if (operandType === silentNeverType) {
return silentNeverType;
}
- if (node.operator === 36 && node.operand.kind === 8) {
+ if (node.operator === 37 && node.operand.kind === 8) {
return getFreshTypeOfLiteralType(getLiteralTypeForText(64, "" + -node.operand.text));
}
switch (node.operator) {
- case 35:
case 36:
- case 50:
+ case 37:
+ case 51:
if (maybeTypeOfKind(operandType, 512)) {
error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
}
return numberType;
- case 49:
+ case 50:
var facts = getTypeFacts(operandType) & (1048576 | 2097152);
return facts === 1048576 ? falseType :
facts === 2097152 ? trueType :
booleanType;
- case 41:
case 42:
+ case 43:
var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);
if (ok) {
checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property);
@@ -29969,8 +29817,8 @@ var ts;
}
if (type.flags & 1572864) {
var types = type.types;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var t = types_14[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -29984,8 +29832,8 @@ var ts;
}
if (type.flags & 524288) {
var types = type.types;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var t = types_15[_i];
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var t = types_16[_i];
if (!isTypeOfKind(t, kind)) {
return false;
}
@@ -29994,8 +29842,8 @@ var ts;
}
if (type.flags & 1048576) {
var types = type.types;
- for (var _a = 0, types_16 = types; _a < types_16.length; _a++) {
- var t = types_16[_a];
+ for (var _a = 0, types_17 = types; _a < types_17.length; _a++) {
+ var t = types_17[_a];
if (isTypeOfKind(t, kind)) {
return true;
}
@@ -30033,24 +29881,24 @@ var ts;
}
return booleanType;
}
- function checkObjectLiteralAssignment(node, sourceType, contextualMapper) {
+ function checkObjectLiteralAssignment(node, sourceType) {
var properties = node.properties;
for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
var p = properties_4[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, contextualMapper);
+ checkObjectLiteralDestructuringPropertyAssignment(sourceType, p);
}
return sourceType;
}
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, contextualMapper) {
+ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) {
if (property.kind === 253 || property.kind === 254) {
- var name_20 = property.name;
- if (name_20.kind === 140) {
- checkComputedPropertyName(name_20);
+ var name_17 = property.name;
+ if (name_17.kind === 141) {
+ checkComputedPropertyName(name_17);
}
- if (isComputedNonLiteralName(name_20)) {
+ if (isComputedNonLiteralName(name_17)) {
return undefined;
}
- var text = getTextOfPropertyName(name_20);
+ var text = getTextOfPropertyName(name_17);
var type = isTypeAny(objectLiteralType)
? objectLiteralType
: getTypeOfPropertyOfType(objectLiteralType, text) ||
@@ -30065,7 +29913,7 @@ var ts;
}
}
else {
- error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20));
+ error(name_17, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_17));
}
}
else {
@@ -30083,8 +29931,8 @@ var ts;
function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) {
var elements = node.elements;
var element = elements[elementIndex];
- if (element.kind !== 193) {
- if (element.kind !== 191) {
+ if (element.kind !== 194) {
+ if (element.kind !== 192) {
var propName = "" + elementIndex;
var type = isTypeAny(sourceType)
? sourceType
@@ -30110,7 +29958,7 @@ var ts;
}
else {
var restExpression = element.expression;
- if (restExpression.kind === 187 && restExpression.operatorToken.kind === 56) {
+ if (restExpression.kind === 188 && restExpression.operatorToken.kind === 57) {
error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
}
else {
@@ -30137,14 +29985,14 @@ var ts;
else {
target = exprOrAssignment;
}
- if (target.kind === 187 && target.operatorToken.kind === 56) {
+ if (target.kind === 188 && target.operatorToken.kind === 57) {
checkBinaryExpression(target, contextualMapper);
target = target.left;
}
- if (target.kind === 171) {
- return checkObjectLiteralAssignment(target, sourceType, contextualMapper);
+ if (target.kind === 172) {
+ return checkObjectLiteralAssignment(target, sourceType);
}
- if (target.kind === 170) {
+ if (target.kind === 171) {
return checkArrayLiteralAssignment(target, sourceType, contextualMapper);
}
return checkReferenceAssignment(target, sourceType, contextualMapper);
@@ -30159,49 +30007,49 @@ var ts;
function isSideEffectFree(node) {
node = ts.skipParentheses(node);
switch (node.kind) {
- case 69:
+ case 70:
case 9:
- case 10:
- case 176:
- case 189:
case 11:
+ case 177:
+ case 190:
+ case 12:
case 8:
- case 99:
- case 84:
- case 93:
- case 135:
- case 179:
- case 192:
+ case 100:
+ case 85:
+ case 94:
+ case 136:
case 180:
- case 170:
+ case 193:
+ case 181:
case 171:
- case 182:
- case 196:
+ case 172:
+ case 183:
+ case 197:
+ case 243:
case 242:
- case 241:
return true;
- case 188:
+ case 189:
return isSideEffectFree(node.whenTrue) &&
isSideEffectFree(node.whenFalse);
- case 187:
+ case 188:
if (ts.isAssignmentOperator(node.operatorToken.kind)) {
return false;
}
return isSideEffectFree(node.left) &&
isSideEffectFree(node.right);
- case 185:
case 186:
+ case 187:
switch (node.operator) {
- case 49:
- case 35:
- case 36:
case 50:
+ case 36:
+ case 37:
+ case 51:
return true;
}
return false;
- case 183:
- case 177:
- case 195:
+ case 184:
+ case 178:
+ case 196:
default:
return false;
}
@@ -30221,34 +30069,34 @@ var ts;
}
function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) {
var operator = operatorToken.kind;
- if (operator === 56 && (left.kind === 171 || left.kind === 170)) {
+ if (operator === 57 && (left.kind === 172 || left.kind === 171)) {
return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper);
}
var leftType = checkExpression(left, contextualMapper);
var rightType = checkExpression(right, contextualMapper);
switch (operator) {
- case 37:
case 38:
- case 59:
- case 60:
case 39:
+ case 60:
case 61:
case 40:
case 62:
- case 36:
- case 58:
- case 43:
+ case 41:
case 63:
+ case 37:
+ case 59:
case 44:
case 64:
case 45:
case 65:
- case 47:
- case 67:
- case 48:
- case 68:
case 46:
case 66:
+ case 48:
+ case 68:
+ case 49:
+ case 69:
+ case 47:
+ case 67:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -30272,8 +30120,8 @@ var ts;
}
}
return numberType;
- case 35:
- case 57:
+ case 36:
+ case 58:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -30302,24 +30150,24 @@ var ts;
reportOperatorError();
return anyType;
}
- if (operator === 57) {
+ if (operator === 58) {
checkAssignmentOperator(resultType);
}
return resultType;
- case 25:
- case 27:
+ case 26:
case 28:
case 29:
+ case 30:
if (checkForDisallowedESSymbolOperand(operator)) {
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
reportOperatorError();
}
}
return booleanType;
- case 30:
case 31:
case 32:
case 33:
+ case 34:
var leftIsLiteral = isLiteralType(leftType);
var rightIsLiteral = isLiteralType(rightType);
if (!leftIsLiteral || !rightIsLiteral) {
@@ -30330,22 +30178,22 @@ var ts;
reportOperatorError();
}
return booleanType;
- case 91:
+ case 92:
return checkInstanceOfExpression(left, right, leftType, rightType);
- case 90:
+ case 91:
return checkInExpression(left, right, leftType, rightType);
- case 51:
+ case 52:
return getTypeFacts(leftType) & 1048576 ?
includeFalsyTypes(rightType, getFalsyFlags(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType))) :
leftType;
- case 52:
+ case 53:
return getTypeFacts(leftType) & 2097152 ?
getBestChoiceType(removeDefinitelyFalsyTypes(leftType), rightType) :
leftType;
- case 56:
+ case 57:
checkAssignmentOperator(rightType);
return getRegularTypeOfObjectLiteral(rightType);
- case 24:
+ case 25:
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) {
error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
}
@@ -30363,21 +30211,21 @@ var ts;
}
function getSuggestedBooleanOperator(operator) {
switch (operator) {
+ case 48:
+ case 68:
+ return 53;
+ case 49:
+ case 69:
+ return 34;
case 47:
case 67:
return 52;
- case 48:
- case 68:
- return 33;
- case 46:
- case 66:
- return 51;
default:
return undefined;
}
}
function checkAssignmentOperator(valueType) {
- if (produceDiagnostics && operator >= 56 && operator <= 68) {
+ if (produceDiagnostics && operator >= 57 && operator <= 69) {
var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property);
if (ok) {
checkTypeAssignableTo(valueType, leftType, left, undefined);
@@ -30449,9 +30297,9 @@ var ts;
return getFreshTypeOfLiteralType(getLiteralTypeForText(32, node.text));
case 8:
return getFreshTypeOfLiteralType(getLiteralTypeForText(64, node.text));
- case 99:
+ case 100:
return trueType;
- case 84:
+ case 85:
return falseType;
}
}
@@ -30480,7 +30328,7 @@ var ts;
}
function isTypeAssertion(node) {
node = skipParenthesizedNodes(node);
- return node.kind === 177 || node.kind === 195;
+ return node.kind === 178 || node.kind === 196;
}
function checkDeclarationInitializer(declaration) {
var type = checkExpressionCached(declaration.initializer);
@@ -30506,14 +30354,14 @@ var ts;
return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type);
}
function checkPropertyAssignment(node, contextualMapper) {
- if (node.name.kind === 140) {
+ if (node.name.kind === 141) {
checkComputedPropertyName(node.name);
}
return checkExpressionForMutableLocation(node.initializer, contextualMapper);
}
function checkObjectLiteralMethod(node, contextualMapper) {
checkGrammarMethod(node);
- if (node.name.kind === 140) {
+ if (node.name.kind === 141) {
checkComputedPropertyName(node.name);
}
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);
@@ -30536,7 +30384,7 @@ var ts;
}
function checkExpression(node, contextualMapper) {
var type;
- if (node.kind === 139) {
+ if (node.kind === 140) {
type = checkQualifiedName(node);
}
else {
@@ -30544,9 +30392,9 @@ var ts;
type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);
}
if (isConstEnumObjectType(type)) {
- var ok = (node.parent.kind === 172 && node.parent.expression === node) ||
- (node.parent.kind === 173 && node.parent.expression === node) ||
- ((node.kind === 69 || node.kind === 139) && isInRightSideOfImportOrExportAssignment(node));
+ var ok = (node.parent.kind === 173 && node.parent.expression === node) ||
+ (node.parent.kind === 174 && node.parent.expression === node) ||
+ ((node.kind === 70 || node.kind === 140) && 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);
}
@@ -30555,79 +30403,79 @@ var ts;
}
function checkExpressionWorker(node, contextualMapper) {
switch (node.kind) {
- case 69:
+ case 70:
return checkIdentifier(node);
- case 97:
+ case 98:
return checkThisExpression(node);
- case 95:
+ case 96:
return checkSuperExpression(node);
- case 93:
+ case 94:
return nullWideningType;
case 9:
case 8:
- case 99:
- case 84:
+ case 100:
+ case 85:
return checkLiteralExpression(node);
- case 189:
+ case 190:
return checkTemplateExpression(node);
- case 11:
+ case 12:
return stringType;
- case 10:
+ case 11:
return globalRegExpType;
- case 170:
- return checkArrayLiteral(node, contextualMapper);
case 171:
- return checkObjectLiteral(node, contextualMapper);
+ return checkArrayLiteral(node, contextualMapper);
case 172:
- return checkPropertyAccessExpression(node);
+ return checkObjectLiteral(node, contextualMapper);
case 173:
- return checkIndexedAccess(node);
+ return checkPropertyAccessExpression(node);
case 174:
+ return checkIndexedAccess(node);
case 175:
- return checkCallExpression(node);
case 176:
+ return checkCallExpression(node);
+ case 177:
return checkTaggedTemplateExpression(node);
- case 178:
+ case 179:
return checkExpression(node.expression, contextualMapper);
- case 192:
+ case 193:
return checkClassExpression(node);
- case 179:
case 180:
+ case 181:
return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);
- case 182:
+ case 183:
return checkTypeOfExpression(node);
- case 177:
- case 195:
- return checkAssertion(node);
+ case 178:
case 196:
+ return checkAssertion(node);
+ case 197:
return checkNonNullAssertion(node);
- case 181:
+ case 182:
return checkDeleteExpression(node);
- case 183:
- return checkVoidExpression(node);
case 184:
- return checkAwaitExpression(node);
+ return checkVoidExpression(node);
case 185:
- return checkPrefixUnaryExpression(node);
+ return checkAwaitExpression(node);
case 186:
- return checkPostfixUnaryExpression(node);
+ return checkPrefixUnaryExpression(node);
case 187:
- return checkBinaryExpression(node, contextualMapper);
+ return checkPostfixUnaryExpression(node);
case 188:
+ return checkBinaryExpression(node, contextualMapper);
+ case 189:
return checkConditionalExpression(node, contextualMapper);
- case 191:
+ case 192:
return checkSpreadElementExpression(node, contextualMapper);
- case 193:
+ case 194:
return undefinedWideningType;
- case 190:
+ case 191:
return checkYieldExpression(node);
case 248:
return checkJsxExpression(node);
- case 241:
- return checkJsxElement(node);
case 242:
- return checkJsxSelfClosingElement(node);
+ return checkJsxElement(node);
case 243:
+ return checkJsxSelfClosingElement(node);
+ case 244:
ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement");
}
return unknownType;
@@ -30648,7 +30496,7 @@ var ts;
var func = ts.getContainingFunction(node);
if (ts.getModifierFlags(node) & 92) {
func = ts.getContainingFunction(node);
- if (!(func.kind === 148 && ts.nodeIsPresent(func.body))) {
+ if (!(func.kind === 149 && ts.nodeIsPresent(func.body))) {
error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
}
}
@@ -30659,7 +30507,7 @@ var ts;
if (ts.indexOf(func.parameters, node) !== 0) {
error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter);
}
- if (func.kind === 148 || func.kind === 152 || func.kind === 157) {
+ if (func.kind === 149 || func.kind === 153 || func.kind === 158) {
error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);
}
}
@@ -30671,15 +30519,15 @@ var ts;
if (!node.asteriskToken || !node.body) {
return false;
}
- return node.kind === 147 ||
- node.kind === 220 ||
- node.kind === 179;
+ return node.kind === 148 ||
+ node.kind === 221 ||
+ node.kind === 180;
}
function getTypePredicateParameterIndex(parameterList, parameter) {
if (parameterList) {
for (var i = 0; i < parameterList.length; i++) {
var param = parameterList[i];
- if (param.name.kind === 69 &&
+ if (param.name.kind === 70 &&
param.name.text === parameter.text) {
return i;
}
@@ -30714,9 +30562,9 @@ var ts;
else if (parameterName) {
var hasReportedError = false;
for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) {
- var name_21 = _a[_i].name;
- if (ts.isBindingPattern(name_21) &&
- checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) {
+ var name_18 = _a[_i].name;
+ if (ts.isBindingPattern(name_18) &&
+ checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_18, parameterName, typePredicate.parameterName)) {
hasReportedError = true;
break;
}
@@ -30729,13 +30577,13 @@ var ts;
}
function getTypePredicateParent(node) {
switch (node.parent.kind) {
+ case 181:
+ case 152:
+ case 221:
case 180:
- case 151:
- case 220:
- case 179:
- case 156:
+ case 157:
+ case 148:
case 147:
- case 146:
var parent_12 = node.parent;
if (node === parent_12.type) {
return parent_12;
@@ -30748,27 +30596,27 @@ var ts;
if (ts.isOmittedExpression(element)) {
continue;
}
- var name_22 = element.name;
- if (name_22.kind === 69 &&
- name_22.text === predicateVariableName) {
+ var name_19 = element.name;
+ if (name_19.kind === 70 &&
+ name_19.text === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name_22.kind === 168 ||
- name_22.kind === 167) {
- if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) {
+ else if (name_19.kind === 169 ||
+ name_19.kind === 168) {
+ if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_19, predicateVariableNode, predicateVariableName)) {
return true;
}
}
}
}
function checkSignatureDeclaration(node) {
- if (node.kind === 153) {
+ if (node.kind === 154) {
checkGrammarIndexSignature(node);
}
- else if (node.kind === 156 || node.kind === 220 || node.kind === 157 ||
- node.kind === 151 || node.kind === 148 ||
- node.kind === 152) {
+ else if (node.kind === 157 || node.kind === 221 || node.kind === 158 ||
+ node.kind === 152 || node.kind === 149 ||
+ node.kind === 153) {
checkGrammarFunctionLikeDeclaration(node);
}
checkTypeParameters(node.typeParameters);
@@ -30780,10 +30628,10 @@ var ts;
checkCollisionWithArgumentsInGeneratedCode(node);
if (compilerOptions.noImplicitAny && !node.type) {
switch (node.kind) {
- case 152:
+ case 153:
error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
- case 151:
+ case 152:
error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
}
@@ -30810,11 +30658,17 @@ var ts;
}
}
function checkClassForDuplicateDeclarations(node) {
+ var Accessor;
+ (function (Accessor) {
+ Accessor[Accessor["Getter"] = 1] = "Getter";
+ Accessor[Accessor["Setter"] = 2] = "Setter";
+ Accessor[Accessor["Property"] = 3] = "Property";
+ })(Accessor || (Accessor = {}));
var instanceNames = ts.createMap();
var staticNames = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 148) {
+ if (member.kind === 149) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param)) {
@@ -30823,18 +30677,18 @@ var ts;
}
}
else {
- var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 113; });
+ var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114; });
var names = isStatic ? staticNames : instanceNames;
var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name);
if (memberName) {
switch (member.kind) {
- case 149:
+ case 150:
addName(names, member.name, memberName, 1);
break;
- case 150:
+ case 151:
addName(names, member.name, memberName, 2);
break;
- case 145:
+ case 146:
addName(names, member.name, memberName, 3);
break;
}
@@ -30860,12 +30714,12 @@ var ts;
var names = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind == 144) {
+ if (member.kind == 145) {
var memberName = void 0;
switch (member.name.kind) {
case 9:
case 8:
- case 69:
+ case 70:
memberName = member.name.text;
break;
default:
@@ -30882,7 +30736,7 @@ var ts;
}
}
function checkTypeForDuplicateIndexSignatures(node) {
- if (node.kind === 222) {
+ if (node.kind === 223) {
var nodeSymbol = getSymbolOfNode(node);
if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) {
return;
@@ -30897,7 +30751,7 @@ var ts;
var declaration = decl;
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
switch (declaration.parameters[0].type.kind) {
- case 132:
+ case 133:
if (!seenStringIndexer) {
seenStringIndexer = true;
}
@@ -30905,7 +30759,7 @@ var ts;
error(declaration, ts.Diagnostics.Duplicate_string_index_signature);
}
break;
- case 130:
+ case 131:
if (!seenNumericIndexer) {
seenNumericIndexer = true;
}
@@ -30961,15 +30815,15 @@ var ts;
return ts.forEachChild(n, containsSuperCall);
}
function markThisReferencesAsErrors(n) {
- if (n.kind === 97) {
+ if (n.kind === 98) {
error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
}
- else if (n.kind !== 179 && n.kind !== 220) {
+ else if (n.kind !== 180 && n.kind !== 221) {
ts.forEachChild(n, markThisReferencesAsErrors);
}
}
function isInstancePropertyWithInitializer(n) {
- return n.kind === 145 &&
+ return n.kind === 146 &&
!(ts.getModifierFlags(n) & 32) &&
!!n.initializer;
}
@@ -30989,7 +30843,7 @@ var ts;
var superCallStatement = void 0;
for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
var statement = statements_2[_i];
- if (statement.kind === 202 && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 203 && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
}
@@ -31012,18 +30866,18 @@ var ts;
checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name);
checkDecorators(node);
checkSignatureDeclaration(node);
- if (node.kind === 149) {
+ if (node.kind === 150) {
if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128)) {
if (!(node.flags & 256)) {
error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
}
}
}
- if (node.name.kind === 140) {
+ if (node.name.kind === 141) {
checkComputedPropertyName(node.name);
}
if (!ts.hasDynamicName(node)) {
- var otherKind = node.kind === 149 ? 150 : 149;
+ var otherKind = node.kind === 150 ? 151 : 150;
var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind);
if (otherAccessor) {
if ((ts.getModifierFlags(node) & 28) !== (ts.getModifierFlags(otherAccessor) & 28)) {
@@ -31037,11 +30891,11 @@ var ts;
}
}
var returnType = getTypeOfAccessors(getSymbolOfNode(node));
- if (node.kind === 149) {
+ if (node.kind === 150) {
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
}
}
- if (node.parent.kind !== 171) {
+ if (node.parent.kind !== 172) {
checkSourceElement(node.body);
registerForUnusedIdentifiersCheck(node);
}
@@ -31127,9 +30981,9 @@ var ts;
}
function getEffectiveDeclarationFlags(n, flagsToCheck) {
var flags = ts.getCombinedModifierFlags(n);
- if (n.parent.kind !== 222 &&
- n.parent.kind !== 221 &&
- n.parent.kind !== 192 &&
+ if (n.parent.kind !== 223 &&
+ n.parent.kind !== 222 &&
+ n.parent.kind !== 193 &&
ts.isInAmbientContext(n)) {
if (!(flags & 2)) {
flags |= 1;
@@ -31206,7 +31060,7 @@ var ts;
if (subsequentNode.kind === node.kind) {
var errorNode_1 = subsequentNode.name || subsequentNode;
if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) {
- var reportError = (node.kind === 147 || node.kind === 146) &&
+ var reportError = (node.kind === 148 || node.kind === 147) &&
(ts.getModifierFlags(node) & 32) !== (ts.getModifierFlags(subsequentNode) & 32);
if (reportError) {
var diagnostic = ts.getModifierFlags(node) & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static;
@@ -31239,11 +31093,11 @@ var ts;
var current = declarations_4[_i];
var node = current;
var inAmbientContext = ts.isInAmbientContext(node);
- var inAmbientContextOrInterface = node.parent.kind === 222 || node.parent.kind === 159 || inAmbientContext;
+ var inAmbientContextOrInterface = node.parent.kind === 223 || node.parent.kind === 160 || inAmbientContext;
if (inAmbientContextOrInterface) {
previousDeclaration = undefined;
}
- if (node.kind === 220 || node.kind === 147 || node.kind === 146 || node.kind === 148) {
+ if (node.kind === 221 || node.kind === 148 || node.kind === 147 || node.kind === 149) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
allNodeFlags &= currentNodeFlags;
@@ -31354,16 +31208,16 @@ var ts;
}
function getDeclarationSpaces(d) {
switch (d.kind) {
- case 222:
+ case 223:
return 2097152;
- case 225:
+ case 226:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0
? 4194304 | 1048576
: 4194304;
- case 221:
- case 224:
+ case 222:
+ case 225:
return 2097152 | 1048576;
- case 229:
+ case 230:
var result_2 = 0;
var target = resolveAlias(getSymbolOfNode(d));
ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); });
@@ -31511,22 +31365,22 @@ var ts;
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
var errorInfo;
switch (node.parent.kind) {
- case 221:
+ case 222:
var classSymbol = getSymbolOfNode(node.parent);
var classConstructorType = getTypeOfSymbol(classSymbol);
expectedReturnType = getUnionType([classConstructorType, voidType]);
break;
- case 142:
+ case 143:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
break;
- case 145:
+ case 146:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
break;
- case 147:
- case 149:
+ case 148:
case 150:
+ case 151:
var methodType = getTypeOfNode(node.parent);
var descriptorType = createTypedPropertyDescriptorType(methodType);
expectedReturnType = getUnionType([descriptorType, voidType]);
@@ -31535,9 +31389,9 @@ var ts;
checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo);
}
function checkTypeNodeAsExpression(node) {
- if (node && node.kind === 155) {
+ if (node && node.kind === 156) {
var root = getFirstIdentifier(node.typeName);
- var meaning = root.parent.kind === 155 ? 793064 : 1920;
+ var meaning = root.parent.kind === 156 ? 793064 : 1920;
var rootSymbol = resolveName(root, root.text, meaning | 8388608, undefined, undefined);
if (rootSymbol && rootSymbol.flags & 8388608) {
var aliasTarget = resolveAlias(rootSymbol);
@@ -31571,20 +31425,20 @@ var ts;
}
if (compilerOptions.emitDecoratorMetadata) {
switch (node.kind) {
- case 221:
+ case 222:
var constructor = ts.getFirstConstructorWithBody(node);
if (constructor) {
checkParameterTypeAnnotationsAsExpressions(constructor);
}
break;
- case 147:
- case 149:
+ case 148:
case 150:
+ case 151:
checkParameterTypeAnnotationsAsExpressions(node);
checkReturnTypeAnnotationAsExpression(node);
break;
- case 145:
- case 142:
+ case 146:
+ case 143:
checkTypeAnnotationAsExpression(node);
break;
}
@@ -31604,7 +31458,7 @@ var ts;
checkDecorators(node);
checkSignatureDeclaration(node);
var isAsync = ts.isAsyncFunctionLike(node);
- if (node.name && node.name.kind === 140) {
+ if (node.name && node.name.kind === 141) {
checkComputedPropertyName(node.name);
}
if (!ts.hasDynamicName(node)) {
@@ -31647,42 +31501,42 @@ var ts;
var node = deferredUnusedIdentifierNodes_1[_i];
switch (node.kind) {
case 256:
- case 225:
+ case 226:
checkUnusedModuleMembers(node);
break;
- case 221:
- case 192:
+ case 222:
+ case 193:
checkUnusedClassMembers(node);
checkUnusedTypeParameters(node);
break;
- case 222:
+ case 223:
checkUnusedTypeParameters(node);
break;
- case 199:
- case 227:
- case 206:
+ case 200:
+ case 228:
case 207:
case 208:
+ case 209:
checkUnusedLocalsAndParameters(node);
break;
- case 148:
- case 179:
- case 220:
- case 180:
- case 147:
case 149:
+ case 180:
+ case 221:
+ case 181:
+ case 148:
case 150:
+ case 151:
if (node.body) {
checkUnusedLocalsAndParameters(node);
}
checkUnusedTypeParameters(node);
break;
- case 146:
- case 151:
+ case 147:
case 152:
case 153:
- case 156:
+ case 154:
case 157:
+ case 158:
checkUnusedTypeParameters(node);
break;
}
@@ -31691,11 +31545,11 @@ var ts;
}
}
function checkUnusedLocalsAndParameters(node) {
- if (node.parent.kind !== 222 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) {
+ if (node.parent.kind !== 223 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) {
var _loop_1 = function (key) {
var local = node.locals[key];
if (!local.isReferenced) {
- if (local.valueDeclaration && local.valueDeclaration.kind === 142) {
+ if (local.valueDeclaration && local.valueDeclaration.kind === 143) {
var parameter = local.valueDeclaration;
if (compilerOptions.noUnusedParameters &&
!ts.isParameterPropertyDeclaration(parameter) &&
@@ -31715,19 +31569,19 @@ var ts;
}
}
function parameterNameStartsWithUnderscore(parameter) {
- return parameter.name && parameter.name.kind === 69 && parameter.name.text.charCodeAt(0) === 95;
+ return parameter.name && parameter.name.kind === 70 && parameter.name.text.charCodeAt(0) === 95;
}
function checkUnusedClassMembers(node) {
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
if (node.members) {
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 147 || member.kind === 145) {
+ if (member.kind === 148 || member.kind === 146) {
if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8) {
error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name);
}
}
- else if (member.kind === 148) {
+ else if (member.kind === 149) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8) {
@@ -31772,7 +31626,7 @@ var ts;
}
}
function checkBlock(node) {
- if (node.kind === 199) {
+ if (node.kind === 200) {
checkGrammarStatementInAmbientContext(node);
}
ts.forEach(node.statements, checkSourceElement);
@@ -31794,19 +31648,19 @@ var ts;
if (!(identifier && identifier.text === name)) {
return false;
}
- if (node.kind === 145 ||
- node.kind === 144 ||
+ if (node.kind === 146 ||
+ node.kind === 145 ||
+ node.kind === 148 ||
node.kind === 147 ||
- node.kind === 146 ||
- node.kind === 149 ||
- node.kind === 150) {
+ node.kind === 150 ||
+ node.kind === 151) {
return false;
}
if (ts.isInAmbientContext(node)) {
return false;
}
var root = ts.getRootDeclaration(node);
- if (root.kind === 142 && ts.nodeIsMissing(root.parent.body)) {
+ if (root.kind === 143 && ts.nodeIsMissing(root.parent.body)) {
return false;
}
return true;
@@ -31820,7 +31674,7 @@ var ts;
var current = node;
while (current) {
if (getNodeCheckFlags(current) & 4) {
- var isDeclaration_1 = node.kind !== 69;
+ var isDeclaration_1 = node.kind !== 70;
if (isDeclaration_1) {
error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
}
@@ -31841,7 +31695,7 @@ var ts;
return;
}
if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) {
- var isDeclaration_2 = node.kind !== 69;
+ var isDeclaration_2 = node.kind !== 70;
if (isDeclaration_2) {
error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference);
}
@@ -31851,13 +31705,13 @@ var ts;
}
}
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
- if (modulekind >= ts.ModuleKind.ES6) {
+ if (modulekind >= ts.ModuleKind.ES2015) {
return;
}
if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
return;
}
- if (node.kind === 225 && ts.getModuleInstanceState(node) !== 1) {
+ if (node.kind === 226 && ts.getModuleInstanceState(node) !== 1) {
return;
}
var parent = getDeclarationContainer(node);
@@ -31869,7 +31723,7 @@ var ts;
if (!needCollisionCheckForIdentifier(node, name, "Promise")) {
return;
}
- if (node.kind === 225 && ts.getModuleInstanceState(node) !== 1) {
+ if (node.kind === 226 && ts.getModuleInstanceState(node) !== 1) {
return;
}
var parent = getDeclarationContainer(node);
@@ -31881,7 +31735,7 @@ var ts;
if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) {
return;
}
- if (node.kind === 218 && !node.initializer) {
+ if (node.kind === 219 && !node.initializer) {
return;
}
var symbol = getSymbolOfNode(node);
@@ -31891,25 +31745,25 @@ var ts;
localDeclarationSymbol !== symbol &&
localDeclarationSymbol.flags & 2) {
if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) {
- var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 219);
- var container = varDeclList.parent.kind === 200 && varDeclList.parent.parent
+ var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 220);
+ var container = varDeclList.parent.kind === 201 && varDeclList.parent.parent
? varDeclList.parent.parent
: undefined;
var namesShareScope = container &&
- (container.kind === 199 && ts.isFunctionLike(container.parent) ||
+ (container.kind === 200 && ts.isFunctionLike(container.parent) ||
+ container.kind === 227 ||
container.kind === 226 ||
- container.kind === 225 ||
container.kind === 256);
if (!namesShareScope) {
- var name_23 = symbolToString(localDeclarationSymbol);
- error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23);
+ var name_20 = symbolToString(localDeclarationSymbol);
+ error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_20, name_20);
}
}
}
}
}
function checkParameterInitializer(node) {
- if (ts.getRootDeclaration(node).kind !== 142) {
+ if (ts.getRootDeclaration(node).kind !== 143) {
return;
}
var func = ts.getContainingFunction(node);
@@ -31918,10 +31772,10 @@ var ts;
if (ts.isTypeNode(n) || ts.isDeclarationName(n)) {
return;
}
- if (n.kind === 172) {
+ if (n.kind === 173) {
return visit(n.expression);
}
- else if (n.kind === 69) {
+ else if (n.kind === 70) {
var symbol = resolveName(n, n.text, 107455 | 8388608, undefined, undefined);
if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) {
return;
@@ -31932,7 +31786,7 @@ var ts;
}
var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
if (enclosingContainer === func) {
- if (symbol.valueDeclaration.kind === 142) {
+ if (symbol.valueDeclaration.kind === 143) {
if (symbol.valueDeclaration.pos < node.pos) {
return;
}
@@ -31941,7 +31795,7 @@ var ts;
if (ts.isFunctionLike(current.parent)) {
return;
}
- if (current.parent.kind === 145 &&
+ if (current.parent.kind === 146 &&
!(ts.hasModifier(current.parent, 32)) &&
ts.isClassLike(current.parent.parent)) {
return;
@@ -31958,25 +31812,25 @@ var ts;
}
}
function convertAutoToAny(type) {
- return type === autoType ? anyType : type;
+ return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
}
function checkVariableLikeDeclaration(node) {
checkDecorators(node);
checkSourceElement(node.type);
- if (node.name.kind === 140) {
+ if (node.name.kind === 141) {
checkComputedPropertyName(node.name);
if (node.initializer) {
checkExpressionCached(node.initializer);
}
}
- if (node.kind === 169) {
- if (node.propertyName && node.propertyName.kind === 140) {
+ if (node.kind === 170) {
+ if (node.propertyName && node.propertyName.kind === 141) {
checkComputedPropertyName(node.propertyName);
}
var parent_13 = node.parent.parent;
var parentType = getTypeForBindingElementParent(parent_13);
- var name_24 = node.propertyName || node.name;
- var property = getPropertyOfType(parentType, getTextOfPropertyName(name_24));
+ var name_21 = node.propertyName || node.name;
+ var property = getPropertyOfType(parentType, getTextOfPropertyName(name_21));
if (parent_13.initializer && property && getParentOfSymbol(property)) {
checkClassPropertyAccess(parent_13, parent_13.initializer, parentType, property);
}
@@ -31984,12 +31838,12 @@ var ts;
if (ts.isBindingPattern(node.name)) {
ts.forEach(node.name.elements, checkSourceElement);
}
- if (node.initializer && ts.getRootDeclaration(node).kind === 142 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
+ if (node.initializer && ts.getRootDeclaration(node).kind === 143 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
return;
}
if (ts.isBindingPattern(node.name)) {
- if (node.initializer && node.parent.parent.kind !== 207) {
+ if (node.initializer && node.parent.parent.kind !== 208) {
checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined);
checkParameterInitializer(node);
}
@@ -31998,7 +31852,7 @@ var ts;
var symbol = getSymbolOfNode(node);
var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol));
if (node === symbol.valueDeclaration) {
- if (node.initializer && node.parent.parent.kind !== 207) {
+ if (node.initializer && node.parent.parent.kind !== 208) {
checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined);
checkParameterInitializer(node);
}
@@ -32016,9 +31870,9 @@ var ts;
error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));
}
}
- if (node.kind !== 145 && node.kind !== 144) {
+ if (node.kind !== 146 && node.kind !== 145) {
checkExportsOnMergedDeclarations(node);
- if (node.kind === 218 || node.kind === 169) {
+ if (node.kind === 219 || node.kind === 170) {
checkVarDeclaredNamesNotShadowed(node);
}
checkCollisionWithCapturedSuperVariable(node, node.name);
@@ -32028,8 +31882,8 @@ var ts;
}
}
function areDeclarationFlagsIdentical(left, right) {
- if ((left.kind === 142 && right.kind === 218) ||
- (left.kind === 218 && right.kind === 142)) {
+ if ((left.kind === 143 && right.kind === 219) ||
+ (left.kind === 219 && right.kind === 143)) {
return true;
}
if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) {
@@ -32056,7 +31910,7 @@ var ts;
ts.forEach(node.declarationList.declarations, checkSourceElement);
}
function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) {
- if (node.modifiers && node.parent.kind === 171) {
+ if (node.modifiers && node.parent.kind === 172) {
if (ts.isAsyncFunctionLike(node)) {
if (node.modifiers.length > 1) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);
@@ -32075,7 +31929,7 @@ var ts;
checkGrammarStatementInAmbientContext(node);
checkExpression(node.expression);
checkSourceElement(node.thenStatement);
- if (node.thenStatement.kind === 201) {
+ if (node.thenStatement.kind === 202) {
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
}
checkSourceElement(node.elseStatement);
@@ -32092,12 +31946,12 @@ var ts;
}
function checkForStatement(node) {
if (!checkGrammarStatementInAmbientContext(node)) {
- if (node.initializer && node.initializer.kind === 219) {
+ if (node.initializer && node.initializer.kind === 220) {
checkGrammarVariableDeclarationList(node.initializer);
}
}
if (node.initializer) {
- if (node.initializer.kind === 219) {
+ if (node.initializer.kind === 220) {
ts.forEach(node.initializer.declarations, checkVariableDeclaration);
}
else {
@@ -32115,13 +31969,13 @@ var ts;
}
function checkForOfStatement(node) {
checkGrammarForInOrForOfStatement(node);
- if (node.initializer.kind === 219) {
+ if (node.initializer.kind === 220) {
checkForInOrForOfVariableDeclaration(node);
}
else {
var varExpr = node.initializer;
var iteratedType = checkRightHandSideOfForOf(node.expression);
- if (varExpr.kind === 170 || varExpr.kind === 171) {
+ if (varExpr.kind === 171 || varExpr.kind === 172) {
checkDestructuringAssignment(varExpr, iteratedType || unknownType);
}
else {
@@ -32139,7 +31993,7 @@ var ts;
}
function checkForInStatement(node) {
checkGrammarForInOrForOfStatement(node);
- if (node.initializer.kind === 219) {
+ if (node.initializer.kind === 220) {
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);
@@ -32149,7 +32003,7 @@ var ts;
else {
var varExpr = node.initializer;
var leftType = checkExpression(varExpr);
- if (varExpr.kind === 170 || varExpr.kind === 171) {
+ if (varExpr.kind === 171 || varExpr.kind === 172) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34)) {
@@ -32322,7 +32176,7 @@ var ts;
checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node);
}
function isGetAccessorWithAnnotatedSetAccessor(node) {
- return !!(node.kind === 149 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 150)));
+ return !!(node.kind === 150 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 151)));
}
function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType;
@@ -32344,12 +32198,12 @@ var ts;
if (func.asteriskToken) {
return;
}
- if (func.kind === 150) {
+ if (func.kind === 151) {
if (node.expression) {
error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value);
}
}
- else if (func.kind === 148) {
+ else if (func.kind === 149) {
if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) {
error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
}
@@ -32367,7 +32221,7 @@ var ts;
}
}
}
- else if (func.kind !== 148 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) {
+ else if (func.kind !== 149 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) {
error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);
}
}
@@ -32424,7 +32278,7 @@ var ts;
if (ts.isFunctionLike(current)) {
break;
}
- if (current.kind === 214 && current.label.text === node.label.text) {
+ if (current.kind === 215 && 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;
@@ -32450,7 +32304,7 @@ var ts;
var catchClause = node.catchClause;
if (catchClause) {
if (catchClause.variableDeclaration) {
- if (catchClause.variableDeclaration.name.kind !== 69) {
+ if (catchClause.variableDeclaration.name.kind !== 70) {
grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier);
}
else if (catchClause.variableDeclaration.type) {
@@ -32518,7 +32372,7 @@ var ts;
return;
}
var errorNode;
- if (prop.valueDeclaration.name.kind === 140 || prop.parent === containingType.symbol) {
+ if (prop.valueDeclaration.name.kind === 141 || prop.parent === containingType.symbol) {
errorNode = prop.valueDeclaration;
}
else if (indexDeclaration) {
@@ -32569,7 +32423,7 @@ var ts;
var firstDecl;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 221 || declaration.kind === 222) {
+ if (declaration.kind === 222 || declaration.kind === 223) {
if (!firstDecl) {
firstDecl = declaration;
}
@@ -32706,7 +32560,7 @@ var ts;
if (derived === base) {
var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol);
if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128))) {
- if (derivedClassDecl.kind === 192) {
+ if (derivedClassDecl.kind === 193) {
error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
@@ -32750,7 +32604,7 @@ var ts;
}
}
function isAccessor(kind) {
- return kind === 149 || kind === 150;
+ return kind === 150 || kind === 151;
}
function areTypeParametersIdentical(list1, list2) {
if (!list1 && !list2) {
@@ -32817,7 +32671,7 @@ var ts;
checkExportsOnMergedDeclarations(node);
var symbol = getSymbolOfNode(node);
checkTypeParameterListsIdentical(node, symbol);
- var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 222);
+ var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 223);
if (node === firstInterfaceDecl) {
var type = getDeclaredTypeOfSymbol(symbol);
var typeWithThis = getTypeWithThisArgument(type);
@@ -32912,18 +32766,18 @@ var ts;
return value;
function evalConstant(e) {
switch (e.kind) {
- case 185:
+ case 186:
var value_1 = evalConstant(e.operand);
if (value_1 === undefined) {
return undefined;
}
switch (e.operator) {
- case 35: return value_1;
- case 36: return -value_1;
- case 50: return ~value_1;
+ case 36: return value_1;
+ case 37: return -value_1;
+ case 51: return ~value_1;
}
return undefined;
- case 187:
+ case 188:
var left = evalConstant(e.left);
if (left === undefined) {
return undefined;
@@ -32933,37 +32787,37 @@ var ts;
return undefined;
}
switch (e.operatorToken.kind) {
- case 47: return left | right;
- case 46: return left & right;
- case 44: return left >> right;
- case 45: return left >>> right;
- case 43: return left << right;
- case 48: return left ^ right;
- case 37: return left * right;
- case 39: return left / right;
- case 35: return left + right;
- case 36: return left - right;
- case 40: return left % right;
+ case 48: return left | right;
+ case 47: return left & right;
+ case 45: return left >> right;
+ case 46: return left >>> right;
+ case 44: return left << right;
+ case 49: return left ^ right;
+ case 38: return left * right;
+ case 40: return left / right;
+ case 36: return left + right;
+ case 37: return left - right;
+ case 41: return left % right;
}
return undefined;
case 8:
return +e.text;
- case 178:
+ case 179:
return evalConstant(e.expression);
- case 69:
+ case 70:
+ case 174:
case 173:
- case 172:
var member = initializer.parent;
var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent));
var enumType_1;
var propertyName = void 0;
- if (e.kind === 69) {
+ if (e.kind === 70) {
enumType_1 = currentType;
propertyName = e.text;
}
else {
var expression = void 0;
- if (e.kind === 173) {
+ if (e.kind === 174) {
if (e.argumentExpression === undefined ||
e.argumentExpression.kind !== 9) {
return undefined;
@@ -32977,10 +32831,10 @@ var ts;
}
var current = expression;
while (current) {
- if (current.kind === 69) {
+ if (current.kind === 70) {
break;
}
- else if (current.kind === 172) {
+ else if (current.kind === 173) {
current = current.expression;
}
else {
@@ -33040,7 +32894,7 @@ var ts;
}
var seenEnumMissingInitialInitializer_1 = false;
ts.forEach(enumSymbol.declarations, function (declaration) {
- if (declaration.kind !== 224) {
+ if (declaration.kind !== 225) {
return false;
}
var enumDeclaration = declaration;
@@ -33063,8 +32917,8 @@ var ts;
var declarations = symbol.declarations;
for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
var declaration = declarations_5[_i];
- if ((declaration.kind === 221 ||
- (declaration.kind === 220 && ts.nodeIsPresent(declaration.body))) &&
+ if ((declaration.kind === 222 ||
+ (declaration.kind === 221 && ts.nodeIsPresent(declaration.body))) &&
!ts.isInAmbientContext(declaration)) {
return declaration;
}
@@ -33123,7 +32977,7 @@ var ts;
error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
}
}
- var mergedClass = ts.getDeclarationOfKind(symbol, 221);
+ var mergedClass = ts.getDeclarationOfKind(symbol, 222);
if (mergedClass &&
inSameLexicalScope(node, mergedClass)) {
getNodeLinks(node).flags |= 32768;
@@ -33166,36 +33020,36 @@ var ts;
}
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
switch (node.kind) {
- case 200:
+ case 201:
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
checkModuleAugmentationElement(decl, isGlobalAugmentation);
}
break;
- case 235:
case 236:
+ case 237:
grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
- case 229:
case 230:
+ case 231:
grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
- case 169:
- case 218:
- var name_25 = node.name;
- if (ts.isBindingPattern(name_25)) {
- for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) {
+ case 170:
+ case 219:
+ var name_22 = node.name;
+ if (ts.isBindingPattern(name_22)) {
+ for (var _b = 0, _c = name_22.elements; _b < _c.length; _b++) {
var el = _c[_b];
checkModuleAugmentationElement(el, isGlobalAugmentation);
}
break;
}
- case 221:
- case 224:
- case 220:
case 222:
case 225:
+ case 221:
case 223:
+ case 226:
+ case 224:
if (isGlobalAugmentation) {
return;
}
@@ -33211,17 +33065,17 @@ var ts;
}
function getFirstIdentifier(node) {
switch (node.kind) {
- case 69:
+ case 70:
return node;
- case 139:
+ case 140:
do {
node = node.left;
- } while (node.kind !== 69);
+ } while (node.kind !== 70);
return node;
- case 172:
+ case 173:
do {
node = node.expression;
- } while (node.kind !== 69);
+ } while (node.kind !== 70);
return node;
}
}
@@ -33231,9 +33085,9 @@ var ts;
error(moduleName, ts.Diagnostics.String_literal_expected);
return false;
}
- var inAmbientExternalModule = node.parent.kind === 226 && ts.isAmbientModule(node.parent.parent);
+ var inAmbientExternalModule = node.parent.kind === 227 && ts.isAmbientModule(node.parent.parent);
if (node.parent.kind !== 256 && !inAmbientExternalModule) {
- error(moduleName, node.kind === 236 ?
+ error(moduleName, node.kind === 237 ?
ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
return false;
@@ -33254,7 +33108,7 @@ var ts;
(symbol.flags & 793064 ? 793064 : 0) |
(symbol.flags & 1920 ? 1920 : 0);
if (target.flags & excludedMeanings) {
- var message = node.kind === 238 ?
+ var message = node.kind === 239 ?
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));
@@ -33281,7 +33135,7 @@ var ts;
checkImportBinding(importClause);
}
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 232) {
+ if (importClause.namedBindings.kind === 233) {
checkImportBinding(importClause.namedBindings);
}
else {
@@ -33316,7 +33170,7 @@ var ts;
}
}
else {
- if (modulekind === ts.ModuleKind.ES6 && !ts.isInAmbientContext(node)) {
+ if (modulekind === ts.ModuleKind.ES2015 && !ts.isInAmbientContext(node)) {
grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
}
}
@@ -33332,7 +33186,7 @@ var ts;
if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {
if (node.exportClause) {
ts.forEach(node.exportClause.elements, checkExportSpecifier);
- var inAmbientExternalModule = node.parent.kind === 226 && ts.isAmbientModule(node.parent.parent);
+ var inAmbientExternalModule = node.parent.kind === 227 && ts.isAmbientModule(node.parent.parent);
if (node.parent.kind !== 256 && !inAmbientExternalModule) {
error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
}
@@ -33346,7 +33200,7 @@ var ts;
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
- var isInAppropriateContext = node.parent.kind === 256 || node.parent.kind === 226 || node.parent.kind === 225;
+ var isInAppropriateContext = node.parent.kind === 256 || node.parent.kind === 227 || node.parent.kind === 226;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
@@ -33370,14 +33224,14 @@ var ts;
return;
}
var container = node.parent.kind === 256 ? node.parent : node.parent.parent;
- if (container.kind === 225 && !ts.isAmbientModule(container)) {
+ if (container.kind === 226 && !ts.isAmbientModule(container)) {
error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
return;
}
if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) {
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
- if (node.expression.kind === 69) {
+ if (node.expression.kind === 70) {
markExportAsReferenced(node);
}
else {
@@ -33385,7 +33239,7 @@ var ts;
}
checkExternalModuleExports(container);
if (node.isExportEquals && !ts.isInAmbientContext(node)) {
- if (modulekind === ts.ModuleKind.ES6) {
+ if (modulekind === ts.ModuleKind.ES2015) {
grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead);
}
else if (modulekind === ts.ModuleKind.System) {
@@ -33437,7 +33291,7 @@ var ts;
links.exportsChecked = true;
}
function isNotOverload(declaration) {
- return (declaration.kind !== 220 && declaration.kind !== 147) ||
+ return (declaration.kind !== 221 && declaration.kind !== 148) ||
!!declaration.body;
}
}
@@ -33448,118 +33302,118 @@ var ts;
var kind = node.kind;
if (cancellationToken) {
switch (kind) {
- case 225:
- case 221:
+ case 226:
case 222:
- case 220:
+ case 223:
+ case 221:
cancellationToken.throwIfCancellationRequested();
}
}
switch (kind) {
- case 141:
- return checkTypeParameter(node);
case 142:
+ return checkTypeParameter(node);
+ case 143:
return checkParameter(node);
+ case 146:
case 145:
- case 144:
return checkPropertyDeclaration(node);
- case 156:
case 157:
- case 151:
+ case 158:
case 152:
- return checkSignatureDeclaration(node);
case 153:
return checkSignatureDeclaration(node);
+ case 154:
+ return checkSignatureDeclaration(node);
+ case 148:
case 147:
- case 146:
return checkMethodDeclaration(node);
- case 148:
- return checkConstructorDeclaration(node);
case 149:
+ return checkConstructorDeclaration(node);
case 150:
+ case 151:
return checkAccessorDeclaration(node);
- case 155:
+ case 156:
return checkTypeReferenceNode(node);
- case 154:
+ case 155:
return checkTypePredicate(node);
- case 158:
- return checkTypeQuery(node);
case 159:
- return checkTypeLiteral(node);
+ return checkTypeQuery(node);
case 160:
- return checkArrayType(node);
+ return checkTypeLiteral(node);
case 161:
- return checkTupleType(node);
+ return checkArrayType(node);
case 162:
+ return checkTupleType(node);
case 163:
- return checkUnionOrIntersectionType(node);
case 164:
+ return checkUnionOrIntersectionType(node);
+ case 165:
return checkSourceElement(node.type);
- case 220:
+ case 221:
return checkFunctionDeclaration(node);
- case 199:
- case 226:
- return checkBlock(node);
case 200:
+ case 227:
+ return checkBlock(node);
+ case 201:
return checkVariableStatement(node);
- case 202:
- return checkExpressionStatement(node);
case 203:
- return checkIfStatement(node);
+ return checkExpressionStatement(node);
case 204:
- return checkDoStatement(node);
+ return checkIfStatement(node);
case 205:
- return checkWhileStatement(node);
+ return checkDoStatement(node);
case 206:
- return checkForStatement(node);
+ return checkWhileStatement(node);
case 207:
- return checkForInStatement(node);
+ return checkForStatement(node);
case 208:
- return checkForOfStatement(node);
+ return checkForInStatement(node);
case 209:
+ return checkForOfStatement(node);
case 210:
- return checkBreakOrContinueStatement(node);
case 211:
- return checkReturnStatement(node);
+ return checkBreakOrContinueStatement(node);
case 212:
- return checkWithStatement(node);
+ return checkReturnStatement(node);
case 213:
- return checkSwitchStatement(node);
+ return checkWithStatement(node);
case 214:
- return checkLabeledStatement(node);
+ return checkSwitchStatement(node);
case 215:
- return checkThrowStatement(node);
+ return checkLabeledStatement(node);
case 216:
+ return checkThrowStatement(node);
+ case 217:
return checkTryStatement(node);
- case 218:
+ case 219:
return checkVariableDeclaration(node);
- case 169:
+ case 170:
return checkBindingElement(node);
- case 221:
- return checkClassDeclaration(node);
case 222:
- return checkInterfaceDeclaration(node);
+ return checkClassDeclaration(node);
case 223:
- return checkTypeAliasDeclaration(node);
+ return checkInterfaceDeclaration(node);
case 224:
- return checkEnumDeclaration(node);
+ return checkTypeAliasDeclaration(node);
case 225:
+ return checkEnumDeclaration(node);
+ case 226:
return checkModuleDeclaration(node);
- case 230:
+ case 231:
return checkImportDeclaration(node);
- case 229:
+ case 230:
return checkImportEqualsDeclaration(node);
- case 236:
+ case 237:
return checkExportDeclaration(node);
- case 235:
+ case 236:
return checkExportAssignment(node);
- case 201:
+ case 202:
checkGrammarStatementInAmbientContext(node);
return;
- case 217:
+ case 218:
checkGrammarStatementInAmbientContext(node);
return;
- case 239:
+ case 240:
return checkMissingDeclaration(node);
}
}
@@ -33572,17 +33426,17 @@ var ts;
for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) {
var node = deferredNodes_1[_i];
switch (node.kind) {
- case 179:
case 180:
+ case 181:
+ case 148:
case 147:
- case 146:
checkFunctionExpressionOrObjectLiteralMethodDeferred(node);
break;
- case 149:
case 150:
+ case 151:
checkAccessorDeferred(node);
break;
- case 192:
+ case 193:
checkClassExpressionDeferred(node);
break;
}
@@ -33654,7 +33508,7 @@ var ts;
function isInsideWithStatementBody(node) {
if (node) {
while (node.parent) {
- if (node.parent.kind === 212 && node.parent.statement === node) {
+ if (node.parent.kind === 213 && node.parent.statement === node) {
return true;
}
node = node.parent;
@@ -33680,24 +33534,24 @@ var ts;
if (!ts.isExternalOrCommonJsModule(location)) {
break;
}
- case 225:
+ case 226:
copySymbols(getSymbolOfNode(location).exports, meaning & 8914931);
break;
- case 224:
+ case 225:
copySymbols(getSymbolOfNode(location).exports, meaning & 8);
break;
- case 192:
+ case 193:
var className = location.name;
if (className) {
copySymbol(location.symbol, meaning);
}
- case 221:
case 222:
+ case 223:
if (!(memberFlags & 32)) {
copySymbols(getSymbolOfNode(location).members, meaning & 793064);
}
break;
- case 179:
+ case 180:
var funcName = location.name;
if (funcName) {
copySymbol(location.symbol, meaning);
@@ -33730,33 +33584,33 @@ var ts;
}
}
function isTypeDeclarationName(name) {
- return name.kind === 69 &&
+ return name.kind === 70 &&
isTypeDeclaration(name.parent) &&
name.parent.name === name;
}
function isTypeDeclaration(node) {
switch (node.kind) {
- case 141:
- case 221:
+ case 142:
case 222:
case 223:
case 224:
+ case 225:
return true;
}
}
function isTypeReferenceIdentifier(entityName) {
var node = entityName;
- while (node.parent && node.parent.kind === 139) {
+ while (node.parent && node.parent.kind === 140) {
node = node.parent;
}
- return node.parent && (node.parent.kind === 155 || node.parent.kind === 267);
+ return node.parent && (node.parent.kind === 156 || node.parent.kind === 267);
}
function isHeritageClauseElementIdentifier(entityName) {
var node = entityName;
- while (node.parent && node.parent.kind === 172) {
+ while (node.parent && node.parent.kind === 173) {
node = node.parent;
}
- return node.parent && node.parent.kind === 194;
+ return node.parent && node.parent.kind === 195;
}
function forEachEnclosingClass(node, callback) {
var result;
@@ -33773,13 +33627,13 @@ var ts;
return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });
}
function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {
- while (nodeOnRightSide.parent.kind === 139) {
+ while (nodeOnRightSide.parent.kind === 140) {
nodeOnRightSide = nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 229) {
+ if (nodeOnRightSide.parent.kind === 230) {
return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 235) {
+ if (nodeOnRightSide.parent.kind === 236) {
return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent;
}
return undefined;
@@ -33791,7 +33645,7 @@ var ts;
if (ts.isDeclarationName(entityName)) {
return getSymbolOfNode(entityName.parent);
}
- if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 172) {
+ if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 173) {
var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent);
switch (specialPropertyAssignmentKind) {
case 1:
@@ -33803,20 +33657,20 @@ var ts;
default:
}
}
- if (entityName.parent.kind === 235 && ts.isEntityNameExpression(entityName)) {
+ if (entityName.parent.kind === 236 && ts.isEntityNameExpression(entityName)) {
return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608);
}
- if (entityName.kind !== 172 && isInRightSideOfImportOrExportAssignment(entityName)) {
- var importEqualsDeclaration = ts.getAncestor(entityName, 229);
+ if (entityName.kind !== 173 && isInRightSideOfImportOrExportAssignment(entityName)) {
+ var importEqualsDeclaration = ts.getAncestor(entityName, 230);
ts.Debug.assert(importEqualsDeclaration !== undefined);
- return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importEqualsDeclaration, true);
+ return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true);
}
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
if (isHeritageClauseElementIdentifier(entityName)) {
var meaning = 0;
- if (entityName.parent.kind === 194) {
+ if (entityName.parent.kind === 195) {
meaning = 793064;
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
meaning |= 107455;
@@ -33832,20 +33686,20 @@ var ts;
if (ts.nodeIsMissing(entityName)) {
return undefined;
}
- if (entityName.kind === 69) {
+ if (entityName.kind === 70) {
if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) {
return getIntrinsicTagSymbol(entityName.parent);
}
return resolveEntityName(entityName, 107455, false, true);
}
- else if (entityName.kind === 172) {
+ else if (entityName.kind === 173) {
var symbol = getNodeLinks(entityName).resolvedSymbol;
if (!symbol) {
checkPropertyAccessExpression(entityName);
}
return getNodeLinks(entityName).resolvedSymbol;
}
- else if (entityName.kind === 139) {
+ else if (entityName.kind === 140) {
var symbol = getNodeLinks(entityName).resolvedSymbol;
if (!symbol) {
checkQualifiedName(entityName);
@@ -33854,13 +33708,13 @@ var ts;
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = (entityName.parent.kind === 155 || entityName.parent.kind === 267) ? 793064 : 1920;
+ var meaning = (entityName.parent.kind === 156 || entityName.parent.kind === 267) ? 793064 : 1920;
return resolveEntityName(entityName, meaning, false, true);
}
else if (entityName.parent.kind === 246) {
return getJsxAttributePropertySymbol(entityName.parent);
}
- if (entityName.parent.kind === 154) {
+ if (entityName.parent.kind === 155) {
return resolveEntityName(entityName, 1);
}
return undefined;
@@ -33878,12 +33732,12 @@ var ts;
else if (ts.isLiteralComputedPropertyDeclarationName(node)) {
return getSymbolOfNode(node.parent.parent);
}
- if (node.kind === 69) {
+ if (node.kind === 70) {
if (isInRightSideOfImportOrExportAssignment(node)) {
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
}
- else if (node.parent.kind === 169 &&
- node.parent.parent.kind === 167 &&
+ else if (node.parent.kind === 170 &&
+ node.parent.parent.kind === 168 &&
node === node.parent.propertyName) {
var typeOfPattern = getTypeOfNode(node.parent.parent);
var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text);
@@ -33893,11 +33747,11 @@ var ts;
}
}
switch (node.kind) {
- case 69:
- case 172:
- case 139:
+ case 70:
+ case 173:
+ case 140:
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
- case 97:
+ case 98:
var container = ts.getThisContainer(node, false);
if (ts.isFunctionLike(container)) {
var sig = getSignatureFromDeclaration(container);
@@ -33905,21 +33759,21 @@ var ts;
return sig.thisParameter;
}
}
- case 95:
+ case 96:
var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node);
return type.symbol;
- case 165:
+ case 166:
return getTypeFromTypeNode(node).symbol;
- case 121:
+ case 122:
var constructorDeclaration = node.parent;
- if (constructorDeclaration && constructorDeclaration.kind === 148) {
+ if (constructorDeclaration && constructorDeclaration.kind === 149) {
return constructorDeclaration.parent.symbol;
}
return undefined;
case 9:
if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) &&
ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
- ((node.parent.kind === 230 || node.parent.kind === 236) &&
+ ((node.parent.kind === 231 || node.parent.kind === 237) &&
node.parent.moduleSpecifier === node)) {
return resolveExternalModuleName(node, node);
}
@@ -33927,7 +33781,7 @@ var ts;
return resolveExternalModuleName(node, node);
}
case 8:
- if (node.parent.kind === 173 && node.parent.argumentExpression === node) {
+ if (node.parent.kind === 174 && node.parent.argumentExpression === node) {
var objectType = checkExpression(node.parent.expression);
if (objectType === unknownType)
return undefined;
@@ -33991,12 +33845,12 @@ var ts;
return unknownType;
}
function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {
- ts.Debug.assert(expr.kind === 171 || expr.kind === 170);
- if (expr.parent.kind === 208) {
+ ts.Debug.assert(expr.kind === 172 || expr.kind === 171);
+ if (expr.parent.kind === 209) {
var iteratedType = checkRightHandSideOfForOf(expr.parent.expression);
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
- if (expr.parent.kind === 187) {
+ if (expr.parent.kind === 188) {
var iteratedType = checkExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
@@ -34004,7 +33858,7 @@ var ts;
var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);
return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent);
}
- ts.Debug.assert(expr.parent.kind === 170);
+ ts.Debug.assert(expr.parent.kind === 171);
var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);
var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType;
return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType);
@@ -34040,9 +33894,9 @@ var ts;
function getRootSymbols(symbol) {
if (symbol.flags & 268435456) {
var symbols_3 = [];
- var name_26 = symbol.name;
+ var name_23 = symbol.name;
ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) {
- var symbol = getPropertyOfType(t, name_26);
+ var symbol = getPropertyOfType(t, name_23);
if (symbol) {
symbols_3.push(symbol);
}
@@ -34145,7 +33999,7 @@ var ts;
else if (nodeLinks_1.flags & 131072) {
var isDeclaredInLoop = nodeLinks_1.flags & 262144;
var inLoopInitializer = ts.isIterationStatement(container, false);
- var inLoopBodyBlock = container.kind === 199 && ts.isIterationStatement(container.parent, false);
+ var inLoopBodyBlock = container.kind === 200 && ts.isIterationStatement(container.parent, false);
links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));
}
else {
@@ -34185,18 +34039,18 @@ var ts;
return true;
}
switch (node.kind) {
- case 229:
- case 231:
+ case 230:
case 232:
- case 234:
- case 238:
+ case 233:
+ case 235:
+ case 239:
return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);
- case 236:
+ case 237:
var exportClause = node.exportClause;
return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration);
- case 235:
+ case 236:
return node.expression
- && node.expression.kind === 69
+ && node.expression.kind === 70
? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)
: true;
}
@@ -34428,7 +34282,7 @@ var ts;
if (!fileToDirective) {
return undefined;
}
- var meaning = (node.kind === 172) || (node.kind === 69 && isInTypeQuery(node))
+ var meaning = (node.kind === 173) || (node.kind === 70 && isInTypeQuery(node))
? 107455 | 1048576
: 793064 | 1920;
var symbol = resolveEntityName(node, meaning, true);
@@ -34575,6 +34429,7 @@ var ts;
getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; });
}
anyArrayType = createArrayType(anyType);
+ autoArrayType = createArrayType(autoType);
var symbol = getGlobalSymbol("ReadonlyArray", 793064, undefined);
globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1);
anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;
@@ -34634,14 +34489,14 @@ var ts;
return false;
}
if (!ts.nodeCanBeDecorated(node)) {
- if (node.kind === 147 && !ts.nodeIsPresent(node.body)) {
+ if (node.kind === 148 && !ts.nodeIsPresent(node.body)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);
}
else {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);
}
}
- else if (node.kind === 149 || node.kind === 150) {
+ else if (node.kind === 150 || node.kind === 151) {
var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
@@ -34658,28 +34513,28 @@ var ts;
var flags = 0;
for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 128) {
- if (node.kind === 144 || node.kind === 146) {
+ if (modifier.kind !== 129) {
+ if (node.kind === 145 || node.kind === 147) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));
}
- if (node.kind === 153) {
+ if (node.kind === 154) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));
}
}
switch (modifier.kind) {
- case 74:
- if (node.kind !== 224 && node.parent.kind === 221) {
- return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74));
+ case 75:
+ if (node.kind !== 225 && node.parent.kind === 222) {
+ return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75));
}
break;
+ case 113:
case 112:
case 111:
- case 110:
var text = visibilityToString(ts.modifierToFlag(modifier.kind));
- if (modifier.kind === 111) {
+ if (modifier.kind === 112) {
lastProtected = modifier;
}
- else if (modifier.kind === 110) {
+ else if (modifier.kind === 111) {
lastPrivate = modifier;
}
if (flags & 28) {
@@ -34694,11 +34549,11 @@ var ts;
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
}
- else if (node.parent.kind === 226 || node.parent.kind === 256) {
+ else if (node.parent.kind === 227 || node.parent.kind === 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
}
else if (flags & 128) {
- if (modifier.kind === 110) {
+ if (modifier.kind === 111) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract");
}
else {
@@ -34707,7 +34562,7 @@ var ts;
}
flags |= ts.modifierToFlag(modifier.kind);
break;
- case 113:
+ case 114:
if (flags & 32) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static");
}
@@ -34717,10 +34572,10 @@ var ts;
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
}
- else if (node.parent.kind === 226 || node.parent.kind === 256) {
+ else if (node.parent.kind === 227 || node.parent.kind === 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
}
- else if (node.kind === 142) {
+ else if (node.kind === 143) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
}
else if (flags & 128) {
@@ -34729,17 +34584,17 @@ var ts;
flags |= 32;
lastStatic = modifier;
break;
- case 128:
+ case 129:
if (flags & 64) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly");
}
- else if (node.kind !== 145 && node.kind !== 144 && node.kind !== 153 && node.kind !== 142) {
+ else if (node.kind !== 146 && node.kind !== 145 && node.kind !== 154 && node.kind !== 143) {
return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
}
flags |= 64;
lastReadonly = modifier;
break;
- case 82:
+ case 83:
if (flags & 1) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export");
}
@@ -34752,45 +34607,45 @@ var ts;
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
}
- else if (node.parent.kind === 221) {
+ else if (node.parent.kind === 222) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
}
- else if (node.kind === 142) {
+ else if (node.kind === 143) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
}
flags |= 1;
break;
- case 122:
+ case 123:
if (flags & 2) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare");
}
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.parent.kind === 221) {
+ else if (node.parent.kind === 222) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
}
- else if (node.kind === 142) {
+ else if (node.kind === 143) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
}
- else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 226) {
+ else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 227) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
}
flags |= 2;
lastDeclare = modifier;
break;
- case 115:
+ case 116:
if (flags & 128) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract");
}
- if (node.kind !== 221) {
- if (node.kind !== 147 &&
- node.kind !== 145 &&
- node.kind !== 149 &&
- node.kind !== 150) {
+ if (node.kind !== 222) {
+ if (node.kind !== 148 &&
+ node.kind !== 146 &&
+ node.kind !== 150 &&
+ node.kind !== 151) {
return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
}
- if (!(node.parent.kind === 221 && ts.getModifierFlags(node.parent) & 128)) {
+ if (!(node.parent.kind === 222 && ts.getModifierFlags(node.parent) & 128)) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
}
if (flags & 32) {
@@ -34802,14 +34657,14 @@ var ts;
}
flags |= 128;
break;
- case 118:
+ case 119:
if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
}
else if (flags & 2 || ts.isInAmbientContext(node.parent)) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.kind === 142) {
+ else if (node.kind === 143) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
}
flags |= 256;
@@ -34817,7 +34672,7 @@ var ts;
break;
}
}
- if (node.kind === 148) {
+ if (node.kind === 149) {
if (flags & 32) {
return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
}
@@ -34832,13 +34687,13 @@ var ts;
}
return;
}
- else if ((node.kind === 230 || node.kind === 229) && flags & 2) {
+ else if ((node.kind === 231 || node.kind === 230) && flags & 2) {
return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
}
- else if (node.kind === 142 && (flags & 92) && ts.isBindingPattern(node.name)) {
+ else if (node.kind === 143 && (flags & 92) && ts.isBindingPattern(node.name)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
}
- else if (node.kind === 142 && (flags & 92) && node.dotDotDotToken) {
+ else if (node.kind === 143 && (flags & 92) && node.dotDotDotToken) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
}
if (flags & 256) {
@@ -34854,38 +34709,38 @@ var ts;
}
function shouldReportBadModifier(node) {
switch (node.kind) {
- case 149:
case 150:
- case 148:
+ case 151:
+ case 149:
+ case 146:
case 145:
- case 144:
+ case 148:
case 147:
- case 146:
- case 153:
- case 225:
+ case 154:
+ case 226:
+ case 231:
case 230:
- case 229:
+ case 237:
case 236:
- case 235:
- case 179:
case 180:
- case 142:
+ case 181:
+ case 143:
return false;
default:
- if (node.parent.kind === 226 || node.parent.kind === 256) {
+ if (node.parent.kind === 227 || node.parent.kind === 256) {
return false;
}
switch (node.kind) {
- case 220:
- return nodeHasAnyModifiersExcept(node, 118);
case 221:
- return nodeHasAnyModifiersExcept(node, 115);
+ return nodeHasAnyModifiersExcept(node, 119);
case 222:
- case 200:
+ return nodeHasAnyModifiersExcept(node, 116);
case 223:
- return true;
+ case 201:
case 224:
- return nodeHasAnyModifiersExcept(node, 74);
+ return true;
+ case 225:
+ return nodeHasAnyModifiersExcept(node, 75);
default:
ts.Debug.fail();
return false;
@@ -34897,10 +34752,10 @@ var ts;
}
function checkGrammarAsyncModifier(node, asyncModifier) {
switch (node.kind) {
- case 147:
- case 220:
- case 179:
+ case 148:
+ case 221:
case 180:
+ case 181:
if (!node.asteriskToken) {
return false;
}
@@ -34916,7 +34771,7 @@ var ts;
return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Trailing_comma_not_allowed);
}
}
- function checkGrammarTypeParameterList(node, typeParameters, file) {
+ function checkGrammarTypeParameterList(typeParameters, file) {
if (checkGrammarForDisallowedTrailingComma(typeParameters)) {
return true;
}
@@ -34958,11 +34813,11 @@ var ts;
}
function checkGrammarFunctionLikeDeclaration(node) {
var file = ts.getSourceFileOfNode(node);
- return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) ||
+ return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) ||
checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);
}
function checkGrammarArrowFunction(node, file) {
- if (node.kind === 180) {
+ if (node.kind === 181) {
var arrowFunction = node;
var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line;
@@ -34997,7 +34852,7 @@ var ts;
if (!parameter.type) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
- if (parameter.type.kind !== 132 && parameter.type.kind !== 130) {
+ if (parameter.type.kind !== 133 && parameter.type.kind !== 131) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);
}
if (!node.type) {
@@ -35024,7 +34879,7 @@ var ts;
var sourceFile = ts.getSourceFileOfNode(node);
for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
var arg = args_4[_i];
- if (arg.kind === 193) {
+ if (arg.kind === 194) {
return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
}
}
@@ -35050,7 +34905,7 @@ var ts;
if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 83) {
+ if (heritageClause.token === 84) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
@@ -35063,7 +34918,7 @@ var ts;
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 106);
+ ts.Debug.assert(heritageClause.token === 107);
if (seenImplementsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);
}
@@ -35078,14 +34933,14 @@ var ts;
if (node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 83) {
+ if (heritageClause.token === 84) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 106);
+ ts.Debug.assert(heritageClause.token === 107);
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);
}
checkGrammarHeritageClause(heritageClause);
@@ -35094,19 +34949,19 @@ var ts;
return false;
}
function checkGrammarComputedPropertyName(node) {
- if (node.kind !== 140) {
+ if (node.kind !== 141) {
return false;
}
var computedPropertyName = node;
- if (computedPropertyName.expression.kind === 187 && computedPropertyName.expression.operatorToken.kind === 24) {
+ if (computedPropertyName.expression.kind === 188 && computedPropertyName.expression.operatorToken.kind === 25) {
return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
}
}
function checkGrammarForGenerator(node) {
if (node.asteriskToken) {
- ts.Debug.assert(node.kind === 220 ||
- node.kind === 179 ||
- node.kind === 147);
+ ts.Debug.assert(node.kind === 221 ||
+ node.kind === 180 ||
+ node.kind === 148);
if (ts.isInAmbientContext(node)) {
return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
}
@@ -35118,7 +34973,7 @@ var ts;
}
}
}
- function checkGrammarForInvalidQuestionMark(node, questionToken, message) {
+ function checkGrammarForInvalidQuestionMark(questionToken, message) {
if (questionToken) {
return grammarErrorOnNode(questionToken, message);
}
@@ -35131,9 +34986,9 @@ var ts;
var GetOrSetAccessor = GetAccessor | SetAccessor;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- var name_27 = prop.name;
- if (name_27.kind === 140) {
- checkGrammarComputedPropertyName(name_27);
+ var name_24 = prop.name;
+ if (name_24.kind === 141) {
+ checkGrammarComputedPropertyName(name_24);
}
if (prop.kind === 254 && !inDestructuring && prop.objectAssignmentInitializer) {
return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
@@ -35141,32 +34996,32 @@ var ts;
if (prop.modifiers) {
for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) {
var mod = _c[_b];
- if (mod.kind !== 118 || prop.kind !== 147) {
+ if (mod.kind !== 119 || prop.kind !== 148) {
grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));
}
}
}
var currentKind = void 0;
if (prop.kind === 253 || prop.kind === 254) {
- checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
- if (name_27.kind === 8) {
- checkGrammarNumericLiteral(name_27);
+ checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
+ if (name_24.kind === 8) {
+ checkGrammarNumericLiteral(name_24);
}
currentKind = Property;
}
- else if (prop.kind === 147) {
+ else if (prop.kind === 148) {
currentKind = Property;
}
- else if (prop.kind === 149) {
+ else if (prop.kind === 150) {
currentKind = GetAccessor;
}
- else if (prop.kind === 150) {
+ else if (prop.kind === 151) {
currentKind = SetAccessor;
}
else {
ts.Debug.fail("Unexpected syntax kind:" + prop.kind);
}
- var effectiveName = ts.getPropertyNameForPropertyNameNode(name_27);
+ var effectiveName = ts.getPropertyNameForPropertyNameNode(name_24);
if (effectiveName === undefined) {
continue;
}
@@ -35176,18 +35031,18 @@ var ts;
else {
var existingKind = seen[effectiveName];
if (currentKind === Property && existingKind === Property) {
- grammarErrorOnNode(name_27, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_27));
+ grammarErrorOnNode(name_24, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_24));
}
else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) {
if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) {
seen[effectiveName] = currentKind | existingKind;
}
else {
- return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
+ return grammarErrorOnNode(name_24, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
}
}
else {
- return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
+ return grammarErrorOnNode(name_24, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
}
}
}
@@ -35200,12 +35055,12 @@ var ts;
continue;
}
var jsxAttr = attr;
- var name_28 = jsxAttr.name;
- if (!seen[name_28.text]) {
- seen[name_28.text] = true;
+ var name_25 = jsxAttr.name;
+ if (!seen[name_25.text]) {
+ seen[name_25.text] = true;
}
else {
- return grammarErrorOnNode(name_28, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
+ return grammarErrorOnNode(name_25, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
var initializer = jsxAttr.initializer;
if (initializer && initializer.kind === 248 && !initializer.expression) {
@@ -35217,7 +35072,7 @@ var ts;
if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {
return true;
}
- if (forInOrOfStatement.initializer.kind === 219) {
+ if (forInOrOfStatement.initializer.kind === 220) {
var variableList = forInOrOfStatement.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
var declarations = variableList.declarations;
@@ -35225,20 +35080,20 @@ var ts;
return false;
}
if (declarations.length > 1) {
- var diagnostic = forInOrOfStatement.kind === 207
+ var diagnostic = forInOrOfStatement.kind === 208
? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
: ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
}
var firstDeclaration = declarations[0];
if (firstDeclaration.initializer) {
- var diagnostic = forInOrOfStatement.kind === 207
+ var diagnostic = forInOrOfStatement.kind === 208
? 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 === 207
+ var diagnostic = forInOrOfStatement.kind === 208
? 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);
@@ -35262,11 +35117,11 @@ var ts;
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 149 ?
+ return grammarErrorOnNode(accessor.name, kind === 150 ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 150) {
+ else if (kind === 151) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
@@ -35285,10 +35140,10 @@ var ts;
}
}
function doesAccessorHaveCorrectParameterCount(accessor) {
- return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 149 ? 0 : 1);
+ return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 150 ? 0 : 1);
}
function getAccessorThisParameter(accessor) {
- if (accessor.parameters.length === (accessor.kind === 149 ? 1 : 2)) {
+ if (accessor.parameters.length === (accessor.kind === 150 ? 1 : 2)) {
return ts.getThisParameter(accessor);
}
}
@@ -35303,8 +35158,8 @@ var ts;
checkGrammarForGenerator(node)) {
return true;
}
- if (node.parent.kind === 171) {
- if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
+ if (node.parent.kind === 172) {
+ if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
return true;
}
else if (node.body === undefined) {
@@ -35319,10 +35174,10 @@ var ts;
return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol);
}
}
- else if (node.parent.kind === 222) {
+ else if (node.parent.kind === 223) {
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 === 159) {
+ else if (node.parent.kind === 160) {
return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol);
}
}
@@ -35333,9 +35188,9 @@ var ts;
return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);
}
switch (current.kind) {
- case 214:
+ case 215:
if (node.label && current.label.text === node.label.text) {
- var isMisplacedContinueLabel = node.kind === 209
+ var isMisplacedContinueLabel = node.kind === 210
&& !ts.isIterationStatement(current.statement, true);
if (isMisplacedContinueLabel) {
return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);
@@ -35343,8 +35198,8 @@ var ts;
return false;
}
break;
- case 213:
- if (node.kind === 210 && !node.label) {
+ case 214:
+ if (node.kind === 211 && !node.label) {
return false;
}
break;
@@ -35357,13 +35212,13 @@ var ts;
current = current.parent;
}
if (node.label) {
- var message = node.kind === 210
+ var message = node.kind === 211
? 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 === 210
+ var message = node.kind === 211
? 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);
@@ -35375,7 +35230,7 @@ var ts;
if (node !== ts.lastOrUndefined(elements)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);
}
- if (node.name.kind === 168 || node.name.kind === 167) {
+ if (node.name.kind === 169 || node.name.kind === 168) {
return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);
}
if (node.initializer) {
@@ -35385,11 +35240,11 @@ var ts;
}
function isStringOrNumberLiteralExpression(expr) {
return expr.kind === 9 || expr.kind === 8 ||
- expr.kind === 185 && expr.operator === 36 &&
+ expr.kind === 186 && expr.operator === 37 &&
expr.operand.kind === 8;
}
function checkGrammarVariableDeclaration(node) {
- if (node.parent.parent.kind !== 207 && node.parent.parent.kind !== 208) {
+ if (node.parent.parent.kind !== 208 && node.parent.parent.kind !== 209) {
if (ts.isInAmbientContext(node)) {
if (node.initializer) {
if (ts.isConst(node) && !node.type) {
@@ -35420,8 +35275,8 @@ var ts;
return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);
}
function checkGrammarNameInLetOrConstDeclarations(name) {
- if (name.kind === 69) {
- if (name.originalKeywordKind === 108) {
+ if (name.kind === 70) {
+ if (name.originalKeywordKind === 109) {
return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);
}
}
@@ -35446,15 +35301,15 @@ var ts;
}
function allowLetAndConstDeclarations(parent) {
switch (parent.kind) {
- case 203:
case 204:
case 205:
- case 212:
case 206:
+ case 213:
case 207:
case 208:
+ case 209:
return false;
- case 214:
+ case 215:
return allowLetAndConstDeclarations(parent.parent);
}
return true;
@@ -35509,7 +35364,7 @@ var ts;
return true;
}
}
- else if (node.parent.kind === 222) {
+ else if (node.parent.kind === 223) {
if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) {
return true;
}
@@ -35517,7 +35372,7 @@ var ts;
return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);
}
}
- else if (node.parent.kind === 159) {
+ else if (node.parent.kind === 160) {
if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) {
return true;
}
@@ -35530,13 +35385,13 @@ var ts;
}
}
function checkGrammarTopLevelElementForRequiredDeclareModifier(node) {
- if (node.kind === 222 ||
- node.kind === 223 ||
+ if (node.kind === 223 ||
+ node.kind === 224 ||
+ node.kind === 231 ||
node.kind === 230 ||
- node.kind === 229 ||
+ node.kind === 237 ||
node.kind === 236 ||
- node.kind === 235 ||
- node.kind === 228 ||
+ node.kind === 229 ||
ts.getModifierFlags(node) & (2 | 1 | 512)) {
return false;
}
@@ -35545,7 +35400,7 @@ var ts;
function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {
for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
var decl = _a[_i];
- if (ts.isDeclaration(decl) || decl.kind === 200) {
+ if (ts.isDeclaration(decl) || decl.kind === 201) {
if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {
return true;
}
@@ -35564,7 +35419,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 === 199 || node.parent.kind === 226 || node.parent.kind === 256) {
+ if (node.parent.kind === 200 || node.parent.kind === 227 || node.parent.kind === 256) {
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);
@@ -35603,46 +35458,46 @@ var ts;
(function (ts) {
;
var nodeEdgeTraversalMap = ts.createMap((_a = {},
- _a[139] = [
+ _a[140] = [
{ name: "left", test: ts.isEntityName },
{ name: "right", test: ts.isIdentifier }
],
- _a[143] = [
+ _a[144] = [
{ name: "expression", test: ts.isLeftHandSideExpression }
],
- _a[177] = [
+ _a[178] = [
{ name: "type", test: ts.isTypeNode },
{ name: "expression", test: ts.isUnaryExpression }
],
- _a[195] = [
+ _a[196] = [
{ name: "expression", test: ts.isExpression },
{ name: "type", test: ts.isTypeNode }
],
- _a[196] = [
+ _a[197] = [
{ name: "expression", test: ts.isLeftHandSideExpression }
],
- _a[224] = [
+ _a[225] = [
{ name: "decorators", test: ts.isDecorator },
{ name: "modifiers", test: ts.isModifier },
{ name: "name", test: ts.isIdentifier },
{ name: "members", test: ts.isEnumMember }
],
- _a[225] = [
+ _a[226] = [
{ name: "decorators", test: ts.isDecorator },
{ name: "modifiers", test: ts.isModifier },
{ name: "name", test: ts.isModuleName },
{ name: "body", test: ts.isModuleBody }
],
- _a[226] = [
+ _a[227] = [
{ name: "statements", test: ts.isStatement }
],
- _a[229] = [
+ _a[230] = [
{ name: "decorators", test: ts.isDecorator },
{ name: "modifiers", test: ts.isModifier },
{ name: "name", test: ts.isIdentifier },
{ name: "moduleReference", test: ts.isModuleReference }
],
- _a[240] = [
+ _a[241] = [
{ name: "expression", test: ts.isExpression, optional: true }
],
_a[255] = [
@@ -35658,41 +35513,41 @@ var ts;
return initial;
}
var kind = node.kind;
- if ((kind > 0 && kind <= 138)) {
+ if ((kind > 0 && kind <= 139)) {
return initial;
}
- if ((kind >= 154 && kind <= 166)) {
+ if ((kind >= 155 && kind <= 167)) {
return initial;
}
var result = initial;
switch (node.kind) {
- case 198:
- case 201:
- case 193:
- case 217:
+ case 199:
+ case 202:
+ case 194:
+ case 218:
case 287:
break;
- case 140:
+ case 141:
result = reduceNode(node.expression, f, result);
break;
- case 142:
+ case 143:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 143:
+ case 144:
result = reduceNode(node.expression, f, result);
break;
- case 145:
+ case 146:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 147:
+ case 148:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -35701,12 +35556,12 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 148:
+ case 149:
result = ts.reduceLeft(node.modifiers, f, result);
result = ts.reduceLeft(node.parameters, f, result);
result = reduceNode(node.body, f, result);
break;
- case 149:
+ case 150:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -35714,51 +35569,51 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 150:
+ case 151:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = ts.reduceLeft(node.parameters, f, result);
result = reduceNode(node.body, f, result);
break;
- case 167:
case 168:
+ case 169:
result = ts.reduceLeft(node.elements, f, result);
break;
- case 169:
+ case 170:
result = reduceNode(node.propertyName, f, result);
result = reduceNode(node.name, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 170:
+ case 171:
result = ts.reduceLeft(node.elements, f, result);
break;
- case 171:
+ case 172:
result = ts.reduceLeft(node.properties, f, result);
break;
- case 172:
+ case 173:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.name, f, result);
break;
- case 173:
+ case 174:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.argumentExpression, f, result);
break;
- case 174:
+ case 175:
result = reduceNode(node.expression, f, result);
result = ts.reduceLeft(node.typeArguments, f, result);
result = ts.reduceLeft(node.arguments, f, result);
break;
- case 175:
+ case 176:
result = reduceNode(node.expression, f, result);
result = ts.reduceLeft(node.typeArguments, f, result);
result = ts.reduceLeft(node.arguments, f, result);
break;
- case 176:
+ case 177:
result = reduceNode(node.tag, f, result);
result = reduceNode(node.template, f, result);
break;
- case 179:
+ case 180:
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = ts.reduceLeft(node.typeParameters, f, result);
@@ -35766,117 +35621,117 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 180:
+ case 181:
result = ts.reduceLeft(node.modifiers, f, result);
result = ts.reduceLeft(node.typeParameters, f, result);
result = ts.reduceLeft(node.parameters, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 178:
- case 181:
+ case 179:
case 182:
case 183:
case 184:
- case 190:
+ case 185:
case 191:
- case 196:
+ case 192:
+ case 197:
result = reduceNode(node.expression, f, result);
break;
- case 185:
case 186:
+ case 187:
result = reduceNode(node.operand, f, result);
break;
- case 187:
+ case 188:
result = reduceNode(node.left, f, result);
result = reduceNode(node.right, f, result);
break;
- case 188:
+ case 189:
result = reduceNode(node.condition, f, result);
result = reduceNode(node.whenTrue, f, result);
result = reduceNode(node.whenFalse, f, result);
break;
- case 189:
+ case 190:
result = reduceNode(node.head, f, result);
result = ts.reduceLeft(node.templateSpans, f, result);
break;
- case 192:
+ case 193:
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = ts.reduceLeft(node.typeParameters, f, result);
result = ts.reduceLeft(node.heritageClauses, f, result);
result = ts.reduceLeft(node.members, f, result);
break;
- case 194:
+ case 195:
result = reduceNode(node.expression, f, result);
result = ts.reduceLeft(node.typeArguments, f, result);
break;
- case 197:
+ case 198:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.literal, f, result);
break;
- case 199:
+ case 200:
result = ts.reduceLeft(node.statements, f, result);
break;
- case 200:
+ case 201:
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.declarationList, f, result);
break;
- case 202:
+ case 203:
result = reduceNode(node.expression, f, result);
break;
- case 203:
+ case 204:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.thenStatement, f, result);
result = reduceNode(node.elseStatement, f, result);
break;
- case 204:
+ case 205:
result = reduceNode(node.statement, f, result);
result = reduceNode(node.expression, f, result);
break;
- case 205:
- case 212:
+ case 206:
+ case 213:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 206:
+ case 207:
result = reduceNode(node.initializer, f, result);
result = reduceNode(node.condition, f, result);
result = reduceNode(node.incrementor, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 207:
case 208:
+ case 209:
result = reduceNode(node.initializer, f, result);
result = reduceNode(node.expression, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 211:
- case 215:
+ case 212:
+ case 216:
result = reduceNode(node.expression, f, result);
break;
- case 213:
+ case 214:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.caseBlock, f, result);
break;
- case 214:
+ case 215:
result = reduceNode(node.label, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 216:
+ case 217:
result = reduceNode(node.tryBlock, f, result);
result = reduceNode(node.catchClause, f, result);
result = reduceNode(node.finallyBlock, f, result);
break;
- case 218:
+ case 219:
result = reduceNode(node.name, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 219:
+ case 220:
result = ts.reduceLeft(node.declarations, f, result);
break;
- case 220:
+ case 221:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -35885,7 +35740,7 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 221:
+ case 222:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -35893,49 +35748,49 @@ var ts;
result = ts.reduceLeft(node.heritageClauses, f, result);
result = ts.reduceLeft(node.members, f, result);
break;
- case 227:
+ case 228:
result = ts.reduceLeft(node.clauses, f, result);
break;
- case 230:
+ case 231:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.importClause, f, result);
result = reduceNode(node.moduleSpecifier, f, result);
break;
- case 231:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.namedBindings, f, result);
- break;
case 232:
result = reduceNode(node.name, f, result);
+ result = reduceNode(node.namedBindings, f, result);
break;
case 233:
- case 237:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNode(node.name, f, result);
break;
case 234:
case 238:
+ result = ts.reduceLeft(node.elements, f, result);
+ break;
+ case 235:
+ case 239:
result = reduceNode(node.propertyName, f, result);
result = reduceNode(node.name, f, result);
break;
- case 235:
+ case 236:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.expression, f, result);
break;
- case 236:
+ case 237:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.exportClause, f, result);
result = reduceNode(node.moduleSpecifier, f, result);
break;
- case 241:
+ case 242:
result = reduceNode(node.openingElement, f, result);
result = ts.reduceLeft(node.children, f, result);
result = reduceNode(node.closingElement, f, result);
break;
- case 242:
case 243:
+ case 244:
result = reduceNode(node.tagName, f, result);
result = ts.reduceLeft(node.attributes, f, result);
break;
@@ -36078,153 +35933,153 @@ var ts;
return undefined;
}
var kind = node.kind;
- if ((kind > 0 && kind <= 138)) {
+ if ((kind > 0 && kind <= 139)) {
return node;
}
- if ((kind >= 154 && kind <= 166)) {
+ if ((kind >= 155 && kind <= 167)) {
return node;
}
switch (node.kind) {
- case 198:
- case 201:
- case 193:
- case 217:
+ case 199:
+ case 202:
+ case 194:
+ case 218:
return node;
- case 140:
+ case 141:
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
- case 142:
+ case 143:
return ts.updateParameterDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
- case 145:
+ case 146:
return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
- case 147:
- return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
case 148:
- return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
case 149:
- return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
case 150:
+ return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ case 151:
return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
- case 167:
- return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));
case 168:
- return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));
+ return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));
case 169:
- return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));
+ return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));
case 170:
- return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));
+ return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));
case 171:
- return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike));
+ return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));
case 172:
- return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
+ return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike));
case 173:
- return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
+ return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
case 174:
- return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));
+ return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
case 175:
- return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));
+ return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));
case 176:
+ return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));
+ case 177:
return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));
- case 178:
- return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
case 179:
- return ts.updateFunctionExpression(node, visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
case 180:
- return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, true), context.endLexicalEnvironment()));
+ return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
case 181:
- return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, true), context.endLexicalEnvironment()));
case 182:
- return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
case 183:
- return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
case 184:
+ return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 185:
return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));
- case 187:
+ case 188:
return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression));
- case 185:
- return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
case 186:
+ return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
+ case 187:
return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 188:
- return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression));
case 189:
- return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan));
+ return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression));
case 190:
- return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan));
case 191:
- return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression));
case 192:
+ return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 193:
return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));
- case 194:
+ case 195:
return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 197:
+ case 198:
return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));
- case 199:
- return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement));
case 200:
+ return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement));
+ case 201:
return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));
- case 202:
- return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression));
case 203:
- return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock));
+ return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression));
case 204:
- return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock));
case 205:
- return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
case 206:
- return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 207:
- return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 208:
- return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 209:
- return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true));
+ return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 210:
- return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true));
+ return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true));
case 211:
- return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true));
+ return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true));
case 212:
- return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true));
case 213:
- return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
+ return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 214:
- return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
+ return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
case 215:
- return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));
case 216:
+ return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 217:
return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true));
- case 218:
- return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
case 219:
- return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));
+ return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
case 220:
- return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));
case 221:
+ return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ case 222:
return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));
- case 227:
+ case 228:
return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause));
- case 230:
- return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
case 231:
- return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true));
+ return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
case 232:
- return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
+ return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true));
case 233:
- return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier));
+ return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
case 234:
- return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier));
+ return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier));
case 235:
- return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier));
case 236:
- return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true));
+ return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
case 237:
- return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier));
+ return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true));
case 238:
+ return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier));
+ case 239:
return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier));
- case 241:
- return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
case 242:
- return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));
+ return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
case 243:
+ return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));
+ case 244:
return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));
case 245:
return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));
@@ -36325,67 +36180,67 @@ var ts;
return transformFlags | aggregateTransformFlagsForNode(child);
}
function getTransformFlagsSubtreeExclusions(kind) {
- if (kind >= 154 && kind <= 166) {
+ if (kind >= 155 && kind <= 167) {
return -3;
}
switch (kind) {
- case 174:
case 175:
- case 170:
- return 537133909;
- case 225:
- return 546335573;
- case 142:
- return 538968917;
+ case 176:
+ case 171:
+ return 537922901;
+ case 226:
+ return 574729557;
+ case 143:
+ return 545262933;
+ case 181:
+ return 592227669;
case 180:
- return 550710101;
- case 179:
- case 220:
- return 550726485;
- case 219:
- return 538968917;
case 221:
- case 192:
- return 537590613;
- case 148:
- return 550593365;
- case 147:
+ return 592293205;
+ case 220:
+ return 545262933;
+ case 222:
+ case 193:
+ return 539749717;
case 149:
+ return 591760725;
+ case 148:
case 150:
- return 550593365;
- case 117:
- case 130:
- case 127:
- case 132:
- case 120:
- case 133:
- case 103:
- case 141:
- case 144:
- case 146:
case 151:
+ return 591760725;
+ case 118:
+ case 131:
+ case 128:
+ case 133:
+ case 121:
+ case 134:
+ case 104:
+ case 142:
+ case 145:
+ case 147:
case 152:
case 153:
- case 222:
+ case 154:
case 223:
+ case 224:
return -3;
- case 171:
- return 537430869;
+ case 172:
+ return 539110741;
default:
- return 536871765;
+ return 536874325;
}
}
var Debug;
(function (Debug) {
Debug.failNotOptional = Debug.shouldAssert(1)
? function (message) { return Debug.assert(false, message || "Node not optional."); }
- : function (message) { };
+ : function () { };
Debug.failBadSyntaxKind = Debug.shouldAssert(1)
? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); }
- : function (node, message) { };
+ : function () { };
Debug.assertNode = Debug.shouldAssert(1)
? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
- : function (node, test, message) { };
+ : function () { };
function getFunctionName(func) {
if (typeof func !== "function") {
return "";
@@ -36423,7 +36278,7 @@ var ts;
else if (ts.nodeIsSynthesized(node)) {
location = value;
}
- flattenDestructuring(context, node, value, location, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, visitor);
if (needsValue) {
expressions.push(value);
}
@@ -36443,9 +36298,9 @@ var ts;
}
}
ts.flattenDestructuringAssignment = flattenDestructuringAssignment;
- function flattenParameterDestructuring(context, node, value, visitor) {
+ function flattenParameterDestructuring(node, value, visitor) {
var declarations = [];
- flattenDestructuring(context, node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
return declarations;
function emitAssignment(name, value, location) {
var declaration = ts.createVariableDeclaration(name, undefined, value, location);
@@ -36460,10 +36315,10 @@ var ts;
}
}
ts.flattenParameterDestructuring = flattenParameterDestructuring;
- function flattenVariableDestructuring(context, node, value, visitor, recordTempVariable) {
+ function flattenVariableDestructuring(node, value, visitor, recordTempVariable) {
var declarations = [];
var pendingAssignments;
- flattenDestructuring(context, node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
return declarations;
function emitAssignment(name, value, location, original) {
if (pendingAssignments) {
@@ -36495,9 +36350,9 @@ var ts;
}
}
ts.flattenVariableDestructuring = flattenVariableDestructuring;
- function flattenVariableDestructuringToExpression(context, node, recordTempVariable, nameSubstitution, visitor) {
+ function flattenVariableDestructuringToExpression(node, recordTempVariable, nameSubstitution, visitor) {
var pendingAssignments = [];
- flattenDestructuring(context, node, undefined, node, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, undefined, node, emitAssignment, emitTempVariableAssignment, visitor);
var expression = ts.inlineExpressions(pendingAssignments);
ts.aggregateTransformFlags(expression);
return expression;
@@ -36519,7 +36374,7 @@ var ts;
}
}
ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression;
- function flattenDestructuring(context, root, value, location, emitAssignment, emitTempVariableAssignment, visitor) {
+ function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, visitor) {
if (value && visitor) {
value = ts.visitNode(value, visitor, ts.isExpression);
}
@@ -36540,7 +36395,7 @@ var ts;
}
target = bindingTarget.name;
}
- else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 56) {
+ else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57) {
var initializer = visitor
? ts.visitNode(bindingTarget.right, visitor, ts.isExpression)
: bindingTarget.right;
@@ -36550,17 +36405,17 @@ var ts;
else {
target = bindingTarget;
}
- if (target.kind === 171) {
+ if (target.kind === 172) {
emitObjectLiteralAssignment(target, value, location);
}
- else if (target.kind === 170) {
+ else if (target.kind === 171) {
emitArrayLiteralAssignment(target, value, location);
}
else {
- var name_29 = ts.getMutableClone(target);
- ts.setSourceMapRange(name_29, target);
- ts.setCommentRange(name_29, target);
- emitAssignment(name_29, value, location, undefined);
+ var name_26 = ts.getMutableClone(target);
+ ts.setSourceMapRange(name_26, target);
+ ts.setCommentRange(name_26, target);
+ emitAssignment(name_26, value, location, undefined);
}
}
function emitObjectLiteralAssignment(target, value, location) {
@@ -36585,8 +36440,8 @@ var ts;
}
for (var i = 0; i < numElements; i++) {
var e = elements[i];
- if (e.kind !== 193) {
- if (e.kind !== 191) {
+ if (e.kind !== 194) {
+ if (e.kind !== 192) {
emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e);
}
else if (i === numElements - 1) {
@@ -36615,7 +36470,7 @@ var ts;
if (ts.isOmittedExpression(element)) {
continue;
}
- else if (name.kind === 167) {
+ else if (name.kind === 168) {
var propName = element.propertyName || element.name;
emitBindingElement(element, createDestructuringPropertyAccess(value, propName));
}
@@ -36635,7 +36490,7 @@ var ts;
}
function createDefaultValueCheck(value, defaultValue, location) {
value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(53), defaultValue, ts.createToken(54), value);
+ return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54), defaultValue, ts.createToken(55), value);
}
function createDestructuringPropertyAccess(expression, propertyName) {
if (ts.isComputedPropertyName(propertyName)) {
@@ -36673,6 +36528,12 @@ var ts;
var ts;
(function (ts) {
var USE_NEW_TYPE_METADATA_FORMAT = false;
+ var TypeScriptSubstitutionFlags;
+ (function (TypeScriptSubstitutionFlags) {
+ TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["ClassAliases"] = 1] = "ClassAliases";
+ TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NamespaceExports"] = 2] = "NamespaceExports";
+ TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NonQualifiedEnumMembers"] = 8] = "NonQualifiedEnumMembers";
+ })(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {}));
function transformTypeScript(context) {
var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
@@ -36683,8 +36544,8 @@ var ts;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableSubstitution(172);
context.enableSubstitution(173);
+ context.enableSubstitution(174);
var currentSourceFile;
var currentNamespace;
var currentNamespaceContainerName;
@@ -36694,7 +36555,6 @@ var ts;
var enabledSubstitutions;
var classAliases;
var applicableSubstitutions;
- var currentSuperContainer;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
@@ -36728,15 +36588,32 @@ var ts;
}
return node;
}
+ function sourceElementVisitor(node) {
+ return saveStateAndInvoke(node, sourceElementVisitorWorker);
+ }
+ function sourceElementVisitorWorker(node) {
+ switch (node.kind) {
+ case 231:
+ return visitImportDeclaration(node);
+ case 230:
+ return visitImportEqualsDeclaration(node);
+ case 236:
+ return visitExportAssignment(node);
+ case 237:
+ return visitExportDeclaration(node);
+ default:
+ return visitorWorker(node);
+ }
+ }
function namespaceElementVisitor(node) {
return saveStateAndInvoke(node, namespaceElementVisitorWorker);
}
function namespaceElementVisitorWorker(node) {
- if (node.kind === 236 ||
- node.kind === 230 ||
+ if (node.kind === 237 ||
node.kind === 231 ||
- (node.kind === 229 &&
- node.moduleReference.kind === 240)) {
+ node.kind === 232 ||
+ (node.kind === 230 &&
+ node.moduleReference.kind === 241)) {
return undefined;
}
else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) {
@@ -36752,15 +36629,15 @@ var ts;
}
function classElementVisitorWorker(node) {
switch (node.kind) {
- case 148:
- return undefined;
- case 145:
- case 153:
case 149:
+ return undefined;
+ case 146:
+ case 154:
case 150:
- case 147:
+ case 151:
+ case 148:
return visitorWorker(node);
- case 198:
+ case 199:
return node;
default:
ts.Debug.failBadSyntaxKind(node);
@@ -36772,84 +36649,87 @@ var ts;
return ts.createNotEmittedStatement(node);
}
switch (node.kind) {
- case 82:
- case 77:
+ case 83:
+ case 78:
return currentNamespace ? undefined : node;
- case 112:
- case 110:
+ case 113:
case 111:
- case 115:
- case 118:
- case 74:
- case 122:
- case 128:
- case 160:
+ case 112:
+ case 116:
+ case 75:
+ case 123:
+ case 129:
case 161:
- case 159:
- case 154:
- case 141:
- case 117:
- case 120:
- case 132:
- case 130:
- case 127:
- case 103:
+ case 162:
+ case 160:
+ case 155:
+ case 142:
+ case 118:
+ case 121:
case 133:
+ case 131:
+ case 128:
+ case 104:
+ case 134:
+ case 158:
case 157:
+ case 159:
case 156:
- case 158:
- case 155:
- case 162:
case 163:
case 164:
case 165:
case 166:
- case 153:
- case 143:
+ case 167:
+ case 154:
+ case 144:
+ case 224:
+ case 146:
+ case 149:
+ return visitConstructor(node);
case 223:
- case 145:
- case 148:
- return undefined;
- case 222:
return ts.createNotEmittedStatement(node);
- case 221:
+ case 222:
return visitClassDeclaration(node);
- case 192:
+ case 193:
return visitClassExpression(node);
case 251:
return visitHeritageClause(node);
- case 194:
+ case 195:
return visitExpressionWithTypeArguments(node);
- case 147:
+ case 148:
return visitMethodDeclaration(node);
- case 149:
- return visitGetAccessor(node);
case 150:
+ return visitGetAccessor(node);
+ case 151:
return visitSetAccessor(node);
- case 220:
+ case 221:
return visitFunctionDeclaration(node);
- case 179:
- return visitFunctionExpression(node);
case 180:
+ return visitFunctionExpression(node);
+ case 181:
return visitArrowFunction(node);
- case 142:
+ case 143:
return visitParameter(node);
- case 178:
+ case 179:
return visitParenthesizedExpression(node);
- case 177:
- case 195:
- return visitAssertionExpression(node);
+ case 178:
case 196:
+ return visitAssertionExpression(node);
+ case 175:
+ return visitCallExpression(node);
+ case 176:
+ return visitNewExpression(node);
+ case 197:
return visitNonNullExpression(node);
- case 224:
+ case 225:
return visitEnumDeclaration(node);
- case 184:
- return visitAwaitExpression(node);
- case 200:
+ case 201:
return visitVariableStatement(node);
- case 225:
+ case 219:
+ return visitVariableDeclaration(node);
+ case 226:
return visitModuleDeclaration(node);
- case 229:
+ case 230:
return visitImportEqualsDeclaration(node);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -36859,14 +36739,14 @@ var ts;
function onBeforeVisitNode(node) {
switch (node.kind) {
case 256:
+ case 228:
case 227:
- case 226:
- case 199:
+ case 200:
currentScope = node;
currentScopeFirstDeclarationsOfName = undefined;
break;
+ case 222:
case 221:
- case 220:
if (ts.hasModifier(node, 2)) {
break;
}
@@ -36891,14 +36771,14 @@ var ts;
externalHelpersModuleImport.flags &= ~8;
statements.push(externalHelpersModuleImport);
currentSourceFileExternalHelpersModuleName = externalHelpersModuleName;
- ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
currentSourceFileExternalHelpersModuleName = undefined;
node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
node.externalHelpersModuleName = externalHelpersModuleName;
}
else {
- node = ts.visitEachChild(node, visitor, context);
+ node = ts.visitEachChild(node, sourceElementVisitor, context);
}
ts.setEmitFlags(node, 1 | ts.getEmitFlags(node));
return node;
@@ -36938,7 +36818,7 @@ var ts;
classAlias = addClassDeclarationHeadWithDecorators(statements, node, name, hasExtendsClause);
}
if (staticProperties.length) {
- addInitializedPropertyStatements(statements, node, staticProperties, getLocalName(node, true));
+ addInitializedPropertyStatements(statements, staticProperties, getLocalName(node, true));
}
addClassElementDecorationStatements(statements, node, false);
addClassElementDecorationStatements(statements, node, true);
@@ -36984,7 +36864,7 @@ var ts;
function visitClassExpression(node) {
var staticProperties = getInitializedProperties(node, true);
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
- var members = transformClassMembers(node, heritageClauses !== undefined);
+ var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 84; }));
var classExpression = ts.setOriginalNode(ts.createClassExpression(undefined, node.name, undefined, heritageClauses, members, node), node);
if (staticProperties.length > 0) {
var expressions = [];
@@ -36995,7 +36875,7 @@ var ts;
}
ts.setEmitFlags(classExpression, 524288 | ts.getEmitFlags(classExpression));
expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression)));
- ts.addRange(expressions, generateInitializedPropertyExpressions(node, staticProperties, temp));
+ ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp));
expressions.push(ts.startOnNewLine(temp));
return ts.inlineExpressions(expressions);
}
@@ -37012,13 +36892,13 @@ var ts;
}
function transformConstructor(node, hasExtendsClause) {
var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty);
- var hasParameterPropertyAssignments = node.transformFlags & 131072;
+ var hasParameterPropertyAssignments = node.transformFlags & 524288;
var constructor = ts.getFirstConstructorWithBody(node);
if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) {
return ts.visitEachChild(constructor, visitor, context);
}
var parameters = transformConstructorParameters(constructor);
- var body = transformConstructorBody(node, constructor, hasExtendsClause, parameters);
+ var body = transformConstructorBody(node, constructor, hasExtendsClause);
return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor));
}
function transformConstructorParameters(constructor) {
@@ -37026,7 +36906,7 @@ var ts;
? ts.visitNodes(constructor.parameters, visitor, ts.isParameter)
: [];
}
- function transformConstructorBody(node, constructor, hasExtendsClause, parameters) {
+ function transformConstructorBody(node, constructor, hasExtendsClause) {
var statements = [];
var indexOfFirstStatement = 0;
startLexicalEnvironment();
@@ -37039,7 +36919,7 @@ var ts;
statements.push(ts.createStatement(ts.createCall(ts.createSuper(), undefined, [ts.createSpread(ts.createIdentifier("arguments"))])));
}
var properties = getInitializedProperties(node, false);
- addInitializedPropertyStatements(statements, node, properties, ts.createThis());
+ addInitializedPropertyStatements(statements, properties, ts.createThis());
if (constructor) {
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement));
}
@@ -37054,7 +36934,7 @@ var ts;
return index;
}
var statement = statements[index];
- if (statement.kind === 202 && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 203 && ts.isSuperCall(statement.expression)) {
result.push(ts.visitNode(statement, visitor, ts.isStatement));
return index + 1;
}
@@ -37088,24 +36968,24 @@ var ts;
return isInitializedProperty(member, false);
}
function isInitializedProperty(member, isStatic) {
- return member.kind === 145
+ return member.kind === 146
&& isStatic === ts.hasModifier(member, 32)
&& member.initializer !== undefined;
}
- function addInitializedPropertyStatements(statements, node, properties, receiver) {
+ function addInitializedPropertyStatements(statements, properties, receiver) {
for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
var property = properties_7[_i];
- var statement = ts.createStatement(transformInitializedProperty(node, property, receiver));
+ var statement = ts.createStatement(transformInitializedProperty(property, receiver));
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
ts.setCommentRange(statement, property);
statements.push(statement);
}
}
- function generateInitializedPropertyExpressions(node, properties, receiver) {
+ function generateInitializedPropertyExpressions(properties, receiver) {
var expressions = [];
for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {
var property = properties_8[_i];
- var expression = transformInitializedProperty(node, property, receiver);
+ var expression = transformInitializedProperty(property, receiver);
expression.startsOnNewLine = true;
ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));
ts.setCommentRange(expression, property);
@@ -37113,7 +36993,7 @@ var ts;
}
return expressions;
}
- function transformInitializedProperty(node, property, receiver) {
+ function transformInitializedProperty(property, receiver) {
var propertyName = visitPropertyNameOfClassElement(property);
var initializer = ts.visitNode(property.initializer, visitor, ts.isExpression);
var memberAccess = ts.createMemberAccessForPropertyName(receiver, propertyName, propertyName);
@@ -37161,12 +37041,12 @@ var ts;
}
function getAllDecoratorsOfClassElement(node, member) {
switch (member.kind) {
- case 149:
case 150:
+ case 151:
return getAllDecoratorsOfAccessors(node, member);
- case 147:
+ case 148:
return getAllDecoratorsOfMethod(member);
- case 145:
+ case 146:
return getAllDecoratorsOfProperty(member);
default:
return undefined;
@@ -37244,7 +37124,7 @@ var ts;
var prefix = getClassMemberPrefix(node, member);
var memberName = getExpressionForPropertyName(member, true);
var descriptor = languageVersion > 0
- ? member.kind === 145
+ ? member.kind === 146
? ts.createVoidZero()
: ts.createNull()
: undefined;
@@ -37332,43 +37212,43 @@ var ts;
}
function shouldAddTypeMetadata(node) {
var kind = node.kind;
- return kind === 147
- || kind === 149
+ return kind === 148
|| kind === 150
- || kind === 145;
+ || kind === 151
+ || kind === 146;
}
function shouldAddReturnTypeMetadata(node) {
- return node.kind === 147;
+ return node.kind === 148;
}
function shouldAddParamTypesMetadata(node) {
var kind = node.kind;
- return kind === 221
- || kind === 192
- || kind === 147
- || kind === 149
- || kind === 150;
+ return kind === 222
+ || kind === 193
+ || kind === 148
+ || kind === 150
+ || kind === 151;
}
function serializeTypeOfNode(node) {
switch (node.kind) {
- case 145:
- case 142:
- case 149:
- return serializeTypeNode(node.type);
+ case 146:
+ case 143:
case 150:
+ return serializeTypeNode(node.type);
+ case 151:
return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node));
- case 221:
- case 192:
- case 147:
+ case 222:
+ case 193:
+ case 148:
return ts.createIdentifier("Function");
default:
return ts.createVoidZero();
}
}
function getRestParameterElementType(node) {
- if (node && node.kind === 160) {
+ if (node && node.kind === 161) {
return node.elementType;
}
- else if (node && node.kind === 155) {
+ else if (node && node.kind === 156) {
return ts.singleOrUndefined(node.typeArguments);
}
else {
@@ -37414,52 +37294,52 @@ var ts;
return ts.createIdentifier("Object");
}
switch (node.kind) {
- case 103:
+ case 104:
return ts.createVoidZero();
- case 164:
+ case 165:
return serializeTypeNode(node.type);
- case 156:
case 157:
+ case 158:
return ts.createIdentifier("Function");
- case 160:
case 161:
+ case 162:
return ts.createIdentifier("Array");
- case 154:
- case 120:
+ case 155:
+ case 121:
return ts.createIdentifier("Boolean");
- case 132:
+ case 133:
return ts.createIdentifier("String");
- case 166:
+ case 167:
switch (node.literal.kind) {
case 9:
return ts.createIdentifier("String");
case 8:
return ts.createIdentifier("Number");
- case 99:
- case 84:
+ case 100:
+ case 85:
return ts.createIdentifier("Boolean");
default:
ts.Debug.failBadSyntaxKind(node.literal);
break;
}
break;
- case 130:
+ case 131:
return ts.createIdentifier("Number");
- case 133:
+ case 134:
return languageVersion < 2
? getGlobalSymbolNameWithFallback()
: ts.createIdentifier("Symbol");
- case 155:
+ case 156:
return serializeTypeReferenceNode(node);
+ case 164:
case 163:
- case 162:
{
var unionOrIntersection = node;
var serializedUnion = void 0;
for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) {
var typeNode = _a[_i];
var serializedIndividual = serializeTypeNode(typeNode);
- if (serializedIndividual.kind !== 69) {
+ if (serializedIndividual.kind !== 70) {
serializedUnion = undefined;
break;
}
@@ -37476,10 +37356,10 @@ var ts;
return serializedUnion;
}
}
- case 158:
case 159:
- case 117:
- case 165:
+ case 160:
+ case 118:
+ case 166:
break;
default:
ts.Debug.failBadSyntaxKind(node);
@@ -37520,22 +37400,22 @@ var ts;
}
function serializeEntityNameAsExpression(node, useFallback) {
switch (node.kind) {
- case 69:
- var name_30 = ts.getMutableClone(node);
- name_30.flags &= ~8;
- name_30.original = undefined;
- name_30.parent = currentScope;
+ case 70:
+ var name_27 = ts.getMutableClone(node);
+ name_27.flags &= ~8;
+ name_27.original = undefined;
+ name_27.parent = currentScope;
if (useFallback) {
- return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_30), ts.createLiteral("undefined")), name_30);
+ return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_27), ts.createLiteral("undefined")), name_27);
}
- return name_30;
- case 139:
+ return name_27;
+ case 140:
return serializeQualifiedNameAsExpression(node, useFallback);
}
}
function serializeQualifiedNameAsExpression(node, useFallback) {
var left;
- if (node.left.kind === 69) {
+ if (node.left.kind === 70) {
left = serializeEntityNameAsExpression(node.left, useFallback);
}
else if (useFallback) {
@@ -37548,7 +37428,7 @@ var ts;
return ts.createPropertyAccess(left, node.right);
}
function getGlobalSymbolNameWithFallback() {
- return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(53), ts.createIdentifier("Symbol"), ts.createToken(54), ts.createIdentifier("Object"));
+ return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54), ts.createIdentifier("Symbol"), ts.createToken(55), ts.createIdentifier("Object"));
}
function getExpressionForPropertyName(member, generateNameForComputedPropertyName) {
var name = member.name;
@@ -37580,9 +37460,9 @@ var ts;
}
}
function visitHeritageClause(node) {
- if (node.token === 83) {
+ if (node.token === 84) {
var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1);
- return ts.createHeritageClause(83, types, node);
+ return ts.createHeritageClause(84, types, node);
}
return undefined;
}
@@ -37593,6 +37473,12 @@ var ts;
function shouldEmitFunctionLikeDeclaration(node) {
return !ts.nodeIsMissing(node.body);
}
+ function visitConstructor(node) {
+ if (!shouldEmitFunctionLikeDeclaration(node)) {
+ return undefined;
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitMethodDeclaration(node) {
if (!shouldEmitFunctionLikeDeclaration(node)) {
return undefined;
@@ -37643,36 +37529,33 @@ var ts;
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
+ var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
ts.setOriginalNode(func, node);
return func;
}
function visitArrowFunction(node) {
- var func = ts.createArrowFunction(undefined, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
+ var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
ts.setOriginalNode(func, node);
return func;
}
function transformFunctionBody(node) {
- if (ts.isAsyncFunctionLike(node)) {
- return transformAsyncFunctionBody(node);
- }
return transformFunctionBodyWorker(node.body);
}
function transformFunctionBodyWorker(body, start) {
if (start === void 0) { start = 0; }
var savedCurrentScope = currentScope;
+ var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
currentScope = body;
+ currentScopeFirstDeclarationsOfName = ts.createMap();
startLexicalEnvironment();
var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
var visited = ts.updateBlock(body, statements);
var declarations = endLexicalEnvironment();
currentScope = savedCurrentScope;
+ currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
}
function transformConciseBody(node) {
- if (ts.isAsyncFunctionLike(node)) {
- return transformAsyncFunctionBody(node);
- }
return transformConciseBodyWorker(node.body, false);
}
function transformConciseBodyWorker(body, forceBlockFunctionBody) {
@@ -37694,42 +37577,6 @@ var ts;
}
}
}
- function getPromiseConstructor(type) {
- var typeName = ts.getEntityNameFromTypeNode(type);
- if (typeName && ts.isEntityName(typeName)) {
- var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
- if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
- || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
- return typeName;
- }
- }
- return undefined;
- }
- function transformAsyncFunctionBody(node) {
- var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(node.type) : undefined;
- var isArrowFunction = node.kind === 180;
- var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0;
- if (!isArrowFunction) {
- var statements = [];
- var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor);
- statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
- var block = ts.createBlock(statements, node.body, true);
- if (languageVersion >= 2) {
- if (resolver.getNodeCheckFlags(node) & 4096) {
- enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 8);
- }
- else if (resolver.getNodeCheckFlags(node) & 2048) {
- enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 4);
- }
- }
- return block;
- }
- else {
- return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, true));
- }
- }
function visitParameter(node) {
if (ts.parameterIsThisKeyword(node)) {
return undefined;
@@ -37756,14 +37603,14 @@ var ts;
function transformInitializedVariable(node) {
var name = node.name;
if (ts.isBindingPattern(name)) {
- return ts.flattenVariableDestructuringToExpression(context, node, hoistVariableDeclaration, getNamespaceMemberNameWithSourceMapsAndWithoutComments, visitor);
+ return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, getNamespaceMemberNameWithSourceMapsAndWithoutComments, visitor);
}
else {
return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node);
}
}
- function visitAwaitExpression(node) {
- return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node);
+ function visitVariableDeclaration(node) {
+ return ts.updateVariableDeclaration(node, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
}
function visitParenthesizedExpression(node) {
var innerExpression = ts.skipOuterExpressions(node.expression, ~2);
@@ -37781,6 +37628,12 @@ var ts;
var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression);
return ts.createPartiallyEmittedExpression(expression, node);
}
+ function visitCallExpression(node) {
+ return ts.updateCall(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));
+ }
+ function visitNewExpression(node) {
+ return ts.updateNew(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));
+ }
function shouldEmitEnumDeclaration(node) {
return !ts.isConst(node)
|| compilerOptions.preserveConstEnums
@@ -37812,7 +37665,7 @@ var ts;
var parameterName = getNamespaceParameterName(node);
var containerName = getNamespaceContainerName(node);
var exportName = getExportName(node);
- var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()))]), node);
+ var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()))]), node);
ts.setOriginalNode(enumStatement, node);
ts.setEmitFlags(enumStatement, emitFlags);
statements.push(enumStatement);
@@ -37855,7 +37708,7 @@ var ts;
}
function isES6ExportedDeclaration(node) {
return isExternalModuleExport(node)
- && moduleKind === ts.ModuleKind.ES6;
+ && moduleKind === ts.ModuleKind.ES2015;
}
function recordEmittedDeclarationInScope(node) {
var name = node.symbol && node.symbol.name;
@@ -37870,9 +37723,9 @@ var ts;
}
function isFirstEmittedDeclarationInScope(node) {
if (currentScopeFirstDeclarationsOfName) {
- var name_31 = node.symbol && node.symbol.name;
- if (name_31) {
- return currentScopeFirstDeclarationsOfName[name_31] === node;
+ var name_28 = node.symbol && node.symbol.name;
+ if (name_28) {
+ return currentScopeFirstDeclarationsOfName[name_28] === node;
}
}
return false;
@@ -37887,7 +37740,7 @@ var ts;
ts.createVariableDeclaration(getDeclarationName(node, false, true))
]);
ts.setOriginalNode(statement, node);
- if (node.kind === 224) {
+ if (node.kind === 225) {
ts.setSourceMapRange(statement.declarationList, node);
}
else {
@@ -37920,7 +37773,7 @@ var ts;
var localName = getLocalName(node);
moduleArg = ts.createAssignment(localName, moduleArg);
}
- var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg]), node);
+ var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg]), node);
ts.setOriginalNode(moduleStatement, node);
ts.setEmitFlags(moduleStatement, emitFlags);
statements.push(moduleStatement);
@@ -37938,7 +37791,7 @@ var ts;
var statementsLocation;
var blockLocation;
var body = node.body;
- if (body.kind === 226) {
+ if (body.kind === 227) {
ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement));
statementsLocation = body.statements;
blockLocation = body;
@@ -37961,17 +37814,67 @@ var ts;
currentNamespace = savedCurrentNamespace;
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true);
- if (body.kind !== 226) {
+ if (body.kind !== 227) {
ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152);
}
return block;
}
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {
- if (moduleDeclaration.body.kind === 225) {
+ if (moduleDeclaration.body.kind === 226) {
var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);
return recursiveInnerModule || moduleDeclaration.body;
}
}
+ function visitImportDeclaration(node) {
+ if (!node.importClause) {
+ return node;
+ }
+ var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause, true);
+ return importClause
+ ? ts.updateImportDeclaration(node, undefined, undefined, importClause, node.moduleSpecifier)
+ : undefined;
+ }
+ function visitImportClause(node) {
+ var name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined;
+ var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings, true);
+ return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined;
+ }
+ function visitNamedImportBindings(node) {
+ if (node.kind === 233) {
+ return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
+ }
+ else {
+ var elements = ts.visitNodes(node.elements, visitImportSpecifier, ts.isImportSpecifier);
+ return ts.some(elements) ? ts.updateNamedImports(node, elements) : undefined;
+ }
+ }
+ function visitImportSpecifier(node) {
+ return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
+ }
+ function visitExportAssignment(node) {
+ return resolver.isValueAliasDeclaration(node)
+ ? ts.visitEachChild(node, visitor, context)
+ : undefined;
+ }
+ function visitExportDeclaration(node) {
+ if (!node.exportClause) {
+ return resolver.moduleExportsSomeValue(node.moduleSpecifier) ? node : undefined;
+ }
+ if (!resolver.isValueAliasDeclaration(node)) {
+ return undefined;
+ }
+ var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports, true);
+ return exportClause
+ ? ts.updateExportDeclaration(node, undefined, undefined, exportClause, node.moduleSpecifier)
+ : undefined;
+ }
+ function visitNamedExports(node) {
+ var elements = ts.visitNodes(node.elements, visitExportSpecifier, ts.isExportSpecifier);
+ return ts.some(elements) ? ts.updateNamedExports(node, elements) : undefined;
+ }
+ function visitExportSpecifier(node) {
+ return resolver.isValueAliasDeclaration(node) ? node : undefined;
+ }
function shouldEmitImportEqualsDeclaration(node) {
return resolver.isReferencedAliasDeclaration(node)
|| (!ts.isExternalModule(currentSourceFile)
@@ -37979,7 +37882,9 @@ var ts;
}
function visitImportEqualsDeclaration(node) {
if (ts.isExternalModuleImportEqualsDeclaration(node)) {
- return ts.visitEachChild(node, visitor, context);
+ return resolver.isReferencedAliasDeclaration(node)
+ ? ts.visitEachChild(node, visitor, context)
+ : undefined;
}
if (!shouldEmitImportEqualsDeclaration(node)) {
return undefined;
@@ -38063,7 +37968,7 @@ var ts;
}
function getDeclarationName(node, allowComments, allowSourceMaps, emitFlags) {
if (node.name) {
- var name_32 = ts.getMutableClone(node.name);
+ var name_29 = ts.getMutableClone(node.name);
emitFlags |= ts.getEmitFlags(node.name);
if (!allowSourceMaps) {
emitFlags |= 1536;
@@ -38072,9 +37977,9 @@ var ts;
emitFlags |= 49152;
}
if (emitFlags) {
- ts.setEmitFlags(name_32, emitFlags);
+ ts.setEmitFlags(name_29, emitFlags);
}
- return name_32;
+ return name_29;
}
else {
return ts.getGeneratedNameForNode(node);
@@ -38091,57 +37996,32 @@ var ts;
function enableSubstitutionForNonQualifiedEnumMembers() {
if ((enabledSubstitutions & 8) === 0) {
enabledSubstitutions |= 8;
- context.enableSubstitution(69);
- }
- }
- function enableSubstitutionForAsyncMethodsWithSuper() {
- if ((enabledSubstitutions & 4) === 0) {
- enabledSubstitutions |= 4;
- context.enableSubstitution(174);
- context.enableSubstitution(172);
- context.enableSubstitution(173);
- context.enableEmitNotification(221);
- context.enableEmitNotification(147);
- context.enableEmitNotification(149);
- context.enableEmitNotification(150);
- context.enableEmitNotification(148);
+ context.enableSubstitution(70);
}
}
function enableSubstitutionForClassAliases() {
if ((enabledSubstitutions & 1) === 0) {
enabledSubstitutions |= 1;
- context.enableSubstitution(69);
+ context.enableSubstitution(70);
classAliases = ts.createMap();
}
}
function enableSubstitutionForNamespaceExports() {
if ((enabledSubstitutions & 2) === 0) {
enabledSubstitutions |= 2;
- context.enableSubstitution(69);
+ context.enableSubstitution(70);
context.enableSubstitution(254);
- context.enableEmitNotification(225);
+ context.enableEmitNotification(226);
}
}
- function isSuperContainer(node) {
- var kind = node.kind;
- return kind === 221
- || kind === 148
- || kind === 147
- || kind === 149
- || kind === 150;
- }
function isTransformedModuleDeclaration(node) {
- return ts.getOriginalNode(node).kind === 225;
+ return ts.getOriginalNode(node).kind === 226;
}
function isTransformedEnumDeclaration(node) {
- return ts.getOriginalNode(node).kind === 224;
+ return ts.getOriginalNode(node).kind === 225;
}
function onEmitNode(emitContext, node, emitCallback) {
var savedApplicableSubstitutions = applicableSubstitutions;
- var savedCurrentSuperContainer = currentSuperContainer;
- if (enabledSubstitutions & 4 && isSuperContainer(node)) {
- currentSuperContainer = node;
- }
if (enabledSubstitutions & 2 && isTransformedModuleDeclaration(node)) {
applicableSubstitutions |= 2;
}
@@ -38150,7 +38030,6 @@ var ts;
}
previousOnEmitNode(emitContext, node, emitCallback);
applicableSubstitutions = savedApplicableSubstitutions;
- currentSuperContainer = savedCurrentSuperContainer;
}
function onSubstituteNode(emitContext, node) {
node = previousOnSubstituteNode(emitContext, node);
@@ -38164,31 +38043,26 @@ var ts;
}
function substituteShorthandPropertyAssignment(node) {
if (enabledSubstitutions & 2) {
- var name_33 = node.name;
- var exportedName = trySubstituteNamespaceExportedName(name_33);
+ var name_30 = node.name;
+ var exportedName = trySubstituteNamespaceExportedName(name_30);
if (exportedName) {
if (node.objectAssignmentInitializer) {
var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer);
- return ts.createPropertyAssignment(name_33, initializer, node);
+ return ts.createPropertyAssignment(name_30, initializer, node);
}
- return ts.createPropertyAssignment(name_33, exportedName, node);
+ return ts.createPropertyAssignment(name_30, exportedName, node);
}
}
return node;
}
function substituteExpression(node) {
switch (node.kind) {
- case 69:
+ case 70:
return substituteExpressionIdentifier(node);
- case 172:
- return substitutePropertyAccessExpression(node);
case 173:
- return substituteElementAccessExpression(node);
+ return substitutePropertyAccessExpression(node);
case 174:
- if (enabledSubstitutions & 4) {
- return substituteCallExpression(node);
- }
- break;
+ return substituteElementAccessExpression(node);
}
return node;
}
@@ -38218,8 +38092,8 @@ var ts;
if (enabledSubstitutions & applicableSubstitutions && (ts.getEmitFlags(node) & 262144) === 0) {
var container = resolver.getReferencedExportContainer(node, false);
if (container) {
- var substitute = (applicableSubstitutions & 2 && container.kind === 225) ||
- (applicableSubstitutions & 8 && container.kind === 224);
+ var substitute = (applicableSubstitutions & 2 && container.kind === 226) ||
+ (applicableSubstitutions & 8 && container.kind === 225);
if (substitute) {
return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node);
}
@@ -38227,37 +38101,10 @@ var ts;
}
return undefined;
}
- function substituteCallExpression(node) {
- var expression = node.expression;
- if (ts.isSuperProperty(expression)) {
- var flags = getSuperContainerAsyncMethodFlags();
- if (flags) {
- var argumentExpression = ts.isPropertyAccessExpression(expression)
- ? substitutePropertyAccessExpression(expression)
- : substituteElementAccessExpression(expression);
- return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [
- ts.createThis()
- ].concat(node.arguments));
- }
- }
- return node;
- }
function substitutePropertyAccessExpression(node) {
- if (enabledSubstitutions & 4 && node.expression.kind === 95) {
- var flags = getSuperContainerAsyncMethodFlags();
- if (flags) {
- return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node);
- }
- }
return substituteConstantValue(node);
}
function substituteElementAccessExpression(node) {
- if (enabledSubstitutions & 4 && node.expression.kind === 95) {
- var flags = getSuperContainerAsyncMethodFlags();
- if (flags) {
- return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node);
- }
- }
return substituteConstantValue(node);
}
function substituteConstantValue(node) {
@@ -38285,18 +38132,6 @@ var ts;
? resolver.getConstantValue(node)
: undefined;
}
- function createSuperAccessInAsyncMethod(argumentExpression, flags, location) {
- if (flags & 4096) {
- return ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value", location);
- }
- else {
- return ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression], location);
- }
- }
- function getSuperContainerAsyncMethodFlags() {
- return currentSuperContainer !== undefined
- && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 | 4096);
- }
}
ts.transformTypeScript = transformTypeScript;
})(ts || (ts = {}));
@@ -38329,9 +38164,9 @@ var ts;
}
function visitorWorker(node) {
switch (node.kind) {
- case 241:
- return visitJsxElement(node, false);
case 242:
+ return visitJsxElement(node, false);
+ case 243:
return visitJsxSelfClosingElement(node, false);
case 248:
return visitJsxExpression(node);
@@ -38342,13 +38177,13 @@ var ts;
}
function transformJsxChildToExpression(node) {
switch (node.kind) {
- case 244:
+ case 10:
return visitJsxText(node);
case 248:
return visitJsxExpression(node);
- case 241:
- return visitJsxElement(node, true);
case 242:
+ return visitJsxElement(node, true);
+ case 243:
return visitJsxSelfClosingElement(node, true);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -38465,16 +38300,16 @@ var ts;
return decoded === text ? undefined : decoded;
}
function getTagName(node) {
- if (node.kind === 241) {
+ if (node.kind === 242) {
return getTagName(node.openingElement);
}
else {
- var name_34 = node.tagName;
- if (ts.isIdentifier(name_34) && ts.isIntrinsicJsxName(name_34.text)) {
- return ts.createLiteral(name_34.text);
+ var name_31 = node.tagName;
+ if (ts.isIdentifier(name_31) && ts.isIntrinsicJsxName(name_31.text)) {
+ return ts.createLiteral(name_31.text);
}
else {
- return ts.createExpressionFromEntityName(name_34);
+ return ts.createExpressionFromEntityName(name_31);
}
}
}
@@ -38752,13 +38587,30 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- function transformES7(context) {
- var hoistVariableDeclaration = context.hoistVariableDeclaration;
+ function transformES2017(context) {
+ var ES2017SubstitutionFlags;
+ (function (ES2017SubstitutionFlags) {
+ ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper";
+ })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {}));
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ var resolver = context.getEmitResolver();
+ var compilerOptions = context.getCompilerOptions();
+ var languageVersion = ts.getEmitScriptTarget(compilerOptions);
+ var currentSourceFileExternalHelpersModuleName;
+ var enabledSubstitutions;
+ var applicableSubstitutions;
+ var currentSuperContainer;
+ var previousOnEmitNode = context.onEmitNode;
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ context.onEmitNode = onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ var currentScope;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
+ currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName;
return ts.visitEachChild(node, visitor, context);
}
function visitor(node) {
@@ -38768,13 +38620,265 @@ var ts;
else if (node.transformFlags & 32) {
return ts.visitEachChild(node, visitor, context);
}
+ return node;
+ }
+ function visitorWorker(node) {
+ switch (node.kind) {
+ case 119:
+ return undefined;
+ case 185:
+ return visitAwaitExpression(node);
+ case 148:
+ return visitMethodDeclaration(node);
+ case 221:
+ return visitFunctionDeclaration(node);
+ case 180:
+ return visitFunctionExpression(node);
+ case 181:
+ return visitArrowFunction(node);
+ default:
+ ts.Debug.failBadSyntaxKind(node);
+ return node;
+ }
+ }
+ function visitAwaitExpression(node) {
+ return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node);
+ }
+ function visitMethodDeclaration(node) {
+ if (!ts.isAsyncFunctionLike(node)) {
+ return node;
+ }
+ var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
+ ts.setCommentRange(method, node);
+ ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
+ ts.setOriginalNode(method, node);
+ return method;
+ }
+ function visitFunctionDeclaration(node) {
+ if (!ts.isAsyncFunctionLike(node)) {
+ return node;
+ }
+ var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
+ ts.setOriginalNode(func, node);
+ return func;
+ }
+ function visitFunctionExpression(node) {
+ if (!ts.isAsyncFunctionLike(node)) {
+ return node;
+ }
+ if (ts.nodeIsMissing(node.body)) {
+ return ts.createOmittedExpression();
+ }
+ var func = ts.createFunctionExpression(undefined, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
+ ts.setOriginalNode(func, node);
+ return func;
+ }
+ function visitArrowFunction(node) {
+ if (!ts.isAsyncFunctionLike(node)) {
+ return node;
+ }
+ var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
+ ts.setOriginalNode(func, node);
+ return func;
+ }
+ function transformFunctionBody(node) {
+ return transformAsyncFunctionBody(node);
+ }
+ function transformConciseBody(node) {
+ return transformAsyncFunctionBody(node);
+ }
+ function transformFunctionBodyWorker(body, start) {
+ if (start === void 0) { start = 0; }
+ var savedCurrentScope = currentScope;
+ currentScope = body;
+ startLexicalEnvironment();
+ var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
+ var visited = ts.updateBlock(body, statements);
+ var declarations = endLexicalEnvironment();
+ currentScope = savedCurrentScope;
+ return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
+ }
+ function transformAsyncFunctionBody(node) {
+ var nodeType = node.original ? node.original.type : node.type;
+ var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined;
+ var isArrowFunction = node.kind === 181;
+ var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0;
+ if (!isArrowFunction) {
+ var statements = [];
+ var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor);
+ statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ var block = ts.createBlock(statements, node.body, true);
+ if (languageVersion >= 2) {
+ if (resolver.getNodeCheckFlags(node) & 4096) {
+ enableSubstitutionForAsyncMethodsWithSuper();
+ ts.setEmitFlags(block, 8);
+ }
+ else if (resolver.getNodeCheckFlags(node) & 2048) {
+ enableSubstitutionForAsyncMethodsWithSuper();
+ ts.setEmitFlags(block, 4);
+ }
+ }
+ return block;
+ }
+ else {
+ return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, true));
+ }
+ }
+ function transformConciseBodyWorker(body, forceBlockFunctionBody) {
+ if (ts.isBlock(body)) {
+ return transformFunctionBodyWorker(body);
+ }
+ else {
+ startLexicalEnvironment();
+ var visited = ts.visitNode(body, visitor, ts.isConciseBody);
+ var declarations = endLexicalEnvironment();
+ var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
+ if (forceBlockFunctionBody && !ts.isBlock(merged)) {
+ return ts.createBlock([
+ ts.createReturn(merged)
+ ]);
+ }
+ else {
+ return merged;
+ }
+ }
+ }
+ function getPromiseConstructor(type) {
+ var typeName = ts.getEntityNameFromTypeNode(type);
+ if (typeName && ts.isEntityName(typeName)) {
+ var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
+ if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
+ || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
+ return typeName;
+ }
+ }
+ return undefined;
+ }
+ function enableSubstitutionForAsyncMethodsWithSuper() {
+ if ((enabledSubstitutions & 1) === 0) {
+ enabledSubstitutions |= 1;
+ context.enableSubstitution(175);
+ context.enableSubstitution(173);
+ context.enableSubstitution(174);
+ context.enableEmitNotification(222);
+ context.enableEmitNotification(148);
+ context.enableEmitNotification(150);
+ context.enableEmitNotification(151);
+ context.enableEmitNotification(149);
+ }
+ }
+ function substituteExpression(node) {
+ switch (node.kind) {
+ case 173:
+ return substitutePropertyAccessExpression(node);
+ case 174:
+ return substituteElementAccessExpression(node);
+ case 175:
+ if (enabledSubstitutions & 1) {
+ return substituteCallExpression(node);
+ }
+ break;
+ }
+ return node;
+ }
+ function substitutePropertyAccessExpression(node) {
+ if (enabledSubstitutions & 1 && node.expression.kind === 96) {
+ var flags = getSuperContainerAsyncMethodFlags();
+ if (flags) {
+ return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node);
+ }
+ }
+ return node;
+ }
+ function substituteElementAccessExpression(node) {
+ if (enabledSubstitutions & 1 && node.expression.kind === 96) {
+ var flags = getSuperContainerAsyncMethodFlags();
+ if (flags) {
+ return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node);
+ }
+ }
+ return node;
+ }
+ function substituteCallExpression(node) {
+ var expression = node.expression;
+ if (ts.isSuperProperty(expression)) {
+ var flags = getSuperContainerAsyncMethodFlags();
+ if (flags) {
+ var argumentExpression = ts.isPropertyAccessExpression(expression)
+ ? substitutePropertyAccessExpression(expression)
+ : substituteElementAccessExpression(expression);
+ return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [
+ ts.createThis()
+ ].concat(node.arguments));
+ }
+ }
+ return node;
+ }
+ function isSuperContainer(node) {
+ var kind = node.kind;
+ return kind === 222
+ || kind === 149
+ || kind === 148
+ || kind === 150
+ || kind === 151;
+ }
+ function onEmitNode(emitContext, node, emitCallback) {
+ var savedApplicableSubstitutions = applicableSubstitutions;
+ var savedCurrentSuperContainer = currentSuperContainer;
+ if (enabledSubstitutions & 1 && isSuperContainer(node)) {
+ currentSuperContainer = node;
+ }
+ previousOnEmitNode(emitContext, node, emitCallback);
+ applicableSubstitutions = savedApplicableSubstitutions;
+ currentSuperContainer = savedCurrentSuperContainer;
+ }
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (emitContext === 1) {
+ return substituteExpression(node);
+ }
+ return node;
+ }
+ function createSuperAccessInAsyncMethod(argumentExpression, flags, location) {
+ if (flags & 4096) {
+ return ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value", location);
+ }
+ else {
+ return ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression], location);
+ }
+ }
+ function getSuperContainerAsyncMethodFlags() {
+ return currentSuperContainer !== undefined
+ && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 | 4096);
+ }
+ }
+ ts.transformES2017 = transformES2017;
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function transformES2016(context) {
+ var hoistVariableDeclaration = context.hoistVariableDeclaration;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitor(node) {
+ if (node.transformFlags & 64) {
+ return visitorWorker(node);
+ }
+ else if (node.transformFlags & 128) {
+ return ts.visitEachChild(node, visitor, context);
+ }
else {
return node;
}
}
function visitorWorker(node) {
switch (node.kind) {
- case 187:
+ case 188:
return visitBinaryExpression(node);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -38784,7 +38888,7 @@ var ts;
function visitBinaryExpression(node) {
var left = ts.visitNode(node.left, visitor, ts.isExpression);
var right = ts.visitNode(node.right, visitor, ts.isExpression);
- if (node.operatorToken.kind === 60) {
+ if (node.operatorToken.kind === 61) {
var target = void 0;
var value = void 0;
if (ts.isElementAccessExpression(left)) {
@@ -38804,7 +38908,7 @@ var ts;
}
return ts.createAssignment(target, ts.createMathPow(value, right, node), node);
}
- else if (node.operatorToken.kind === 38) {
+ else if (node.operatorToken.kind === 39) {
return ts.createMathPow(left, right, node);
}
else {
@@ -38813,11 +38917,33 @@ var ts;
}
}
}
- ts.transformES7 = transformES7;
+ ts.transformES2016 = transformES2016;
})(ts || (ts = {}));
var ts;
(function (ts) {
- function transformES6(context) {
+ var ES2015SubstitutionFlags;
+ (function (ES2015SubstitutionFlags) {
+ ES2015SubstitutionFlags[ES2015SubstitutionFlags["CapturedThis"] = 1] = "CapturedThis";
+ ES2015SubstitutionFlags[ES2015SubstitutionFlags["BlockScopedBindings"] = 2] = "BlockScopedBindings";
+ })(ES2015SubstitutionFlags || (ES2015SubstitutionFlags = {}));
+ var CopyDirection;
+ (function (CopyDirection) {
+ CopyDirection[CopyDirection["ToOriginal"] = 0] = "ToOriginal";
+ CopyDirection[CopyDirection["ToOutParameter"] = 1] = "ToOutParameter";
+ })(CopyDirection || (CopyDirection = {}));
+ var Jump;
+ (function (Jump) {
+ Jump[Jump["Break"] = 2] = "Break";
+ Jump[Jump["Continue"] = 4] = "Continue";
+ Jump[Jump["Return"] = 8] = "Return";
+ })(Jump || (Jump = {}));
+ var SuperCaptureResult;
+ (function (SuperCaptureResult) {
+ SuperCaptureResult[SuperCaptureResult["NoReplacement"] = 0] = "NoReplacement";
+ SuperCaptureResult[SuperCaptureResult["ReplaceSuperCapture"] = 1] = "ReplaceSuperCapture";
+ SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn";
+ })(SuperCaptureResult || (SuperCaptureResult = {}));
+ function transformES2015(context) {
var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
var previousOnSubstituteNode = context.onSubstituteNode;
@@ -38880,15 +39006,15 @@ var ts;
return visited;
}
function shouldCheckNode(node) {
- return (node.transformFlags & 64) !== 0 ||
- node.kind === 214 ||
+ return (node.transformFlags & 256) !== 0 ||
+ node.kind === 215 ||
(ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node));
}
function visitorWorker(node) {
if (shouldCheckNode(node)) {
return visitJavaScript(node);
}
- else if (node.transformFlags & 128) {
+ else if (node.transformFlags & 512) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -38907,18 +39033,18 @@ var ts;
}
function visitNodesInConvertedLoop(node) {
switch (node.kind) {
- case 211:
+ case 212:
return visitReturnStatement(node);
- case 200:
+ case 201:
return visitVariableStatement(node);
- case 213:
+ case 214:
return visitSwitchStatement(node);
+ case 211:
case 210:
- case 209:
return visitBreakOrContinueStatement(node);
- case 97:
+ case 98:
return visitThisKeyword(node);
- case 69:
+ case 70:
return visitIdentifier(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -38926,74 +39052,74 @@ var ts;
}
function visitJavaScript(node) {
switch (node.kind) {
- case 82:
+ case 83:
return node;
- case 221:
+ case 222:
return visitClassDeclaration(node);
- case 192:
+ case 193:
return visitClassExpression(node);
- case 142:
+ case 143:
return visitParameter(node);
- case 220:
+ case 221:
return visitFunctionDeclaration(node);
- case 180:
+ case 181:
return visitArrowFunction(node);
- case 179:
+ case 180:
return visitFunctionExpression(node);
- case 218:
+ case 219:
return visitVariableDeclaration(node);
- case 69:
+ case 70:
return visitIdentifier(node);
- case 219:
+ case 220:
return visitVariableDeclarationList(node);
- case 214:
+ case 215:
return visitLabeledStatement(node);
- case 204:
- return visitDoStatement(node);
case 205:
- return visitWhileStatement(node);
+ return visitDoStatement(node);
case 206:
- return visitForStatement(node);
+ return visitWhileStatement(node);
case 207:
- return visitForInStatement(node);
+ return visitForStatement(node);
case 208:
+ return visitForInStatement(node);
+ case 209:
return visitForOfStatement(node);
- case 202:
+ case 203:
return visitExpressionStatement(node);
- case 171:
+ case 172:
return visitObjectLiteralExpression(node);
case 254:
return visitShorthandPropertyAssignment(node);
- case 170:
+ case 171:
return visitArrayLiteralExpression(node);
- case 174:
- return visitCallExpression(node);
case 175:
+ return visitCallExpression(node);
+ case 176:
return visitNewExpression(node);
- case 178:
+ case 179:
return visitParenthesizedExpression(node, true);
- case 187:
+ case 188:
return visitBinaryExpression(node, true);
- case 11:
case 12:
case 13:
case 14:
+ case 15:
return visitTemplateLiteral(node);
- case 176:
+ case 177:
return visitTaggedTemplateExpression(node);
- case 189:
- return visitTemplateExpression(node);
case 190:
+ return visitTemplateExpression(node);
+ case 191:
return visitYieldExpression(node);
- case 95:
- return visitSuperKeyword(node);
- case 190:
+ case 96:
+ return visitSuperKeyword();
+ case 191:
return ts.visitEachChild(node, visitor, context);
- case 147:
+ case 148:
return visitMethodDeclaration(node);
case 256:
return visitSourceFileNode(node);
- case 200:
+ case 201:
return visitVariableStatement(node);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -39008,7 +39134,7 @@ var ts;
}
if (ts.isFunctionLike(currentNode)) {
enclosingFunction = currentNode;
- if (currentNode.kind !== 180) {
+ if (currentNode.kind !== 181) {
enclosingNonArrowFunction = currentNode;
if (!(ts.getEmitFlags(currentNode) & 2097152)) {
enclosingNonAsyncFunctionBody = currentNode;
@@ -39016,14 +39142,14 @@ var ts;
}
}
switch (currentNode.kind) {
- case 200:
+ case 201:
enclosingVariableStatement = currentNode;
break;
+ case 220:
case 219:
- case 218:
- case 169:
- case 167:
+ case 170:
case 168:
+ case 169:
break;
default:
enclosingVariableStatement = undefined;
@@ -39051,7 +39177,7 @@ var ts;
}
function visitThisKeyword(node) {
ts.Debug.assert(convertedLoopState !== undefined);
- if (enclosingFunction && enclosingFunction.kind === 180) {
+ if (enclosingFunction && enclosingFunction.kind === 181) {
convertedLoopState.containsLexicalThis = true;
return node;
}
@@ -39071,13 +39197,13 @@ var ts;
}
function visitBreakOrContinueStatement(node) {
if (convertedLoopState) {
- var jump = node.kind === 210 ? 2 : 4;
+ var jump = node.kind === 211 ? 2 : 4;
var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) ||
(!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
if (!canUseBreakOrContinue) {
var labelMarker = void 0;
if (!node.label) {
- if (node.kind === 210) {
+ if (node.kind === 211) {
convertedLoopState.nonLocalJumps |= 2;
labelMarker = "break";
}
@@ -39087,7 +39213,7 @@ var ts;
}
}
else {
- if (node.kind === 210) {
+ if (node.kind === 211) {
labelMarker = "break-" + node.label.text;
setLabeledJump(convertedLoopState, true, node.label.text, labelMarker);
}
@@ -39106,10 +39232,10 @@ var ts;
expr = copyExpr;
}
else {
- expr = ts.createBinary(expr, 24, copyExpr);
+ expr = ts.createBinary(expr, 25, copyExpr);
}
}
- returnExpression = ts.createBinary(expr, 24, returnExpression);
+ returnExpression = ts.createBinary(expr, 25, returnExpression);
}
return ts.createReturn(returnExpression);
}
@@ -39136,7 +39262,7 @@ var ts;
return statement;
}
function isExportModifier(node) {
- return node.kind === 82;
+ return node.kind === 83;
}
function visitClassExpression(node) {
return transformClassLikeDeclarationToExpression(node);
@@ -39146,7 +39272,7 @@ var ts;
enableSubstitutionsForBlockScopedBindings();
}
var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node);
- var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter("_super")] : [], undefined, transformClassBody(node, extendsClauseElement));
+ var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter("_super")] : [], undefined, transformClassBody(node, extendsClauseElement));
if (ts.getEmitFlags(node) & 524288) {
ts.setEmitFlags(classFunction, 524288);
}
@@ -39166,7 +39292,7 @@ var ts;
addExtendsHelperIfNeeded(statements, node, extendsClauseElement);
addConstructor(statements, node, extendsClauseElement);
addClassMembers(statements, node);
- var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentText, node.members.end), 16);
+ var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentText, node.members.end), 17);
var localName = getLocalName(node);
var outer = ts.createPartiallyEmittedExpression(localName);
outer.end = closingBraceLocation.end;
@@ -39236,17 +39362,17 @@ var ts;
return block;
}
function isSufficientlyCoveredByReturnStatements(statement) {
- if (statement.kind === 211) {
+ if (statement.kind === 212) {
return true;
}
- else if (statement.kind === 203) {
+ else if (statement.kind === 204) {
var ifStatement = statement;
if (ifStatement.elseStatement) {
return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement);
}
}
- else if (statement.kind === 199) {
+ else if (statement.kind === 200) {
var lastStatement = ts.lastOrUndefined(statement.statements);
if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
return true;
@@ -39275,7 +39401,7 @@ var ts;
var ctorStatements = ctor.body.statements;
if (statementOffset < ctorStatements.length) {
firstStatement = ctorStatements[statementOffset];
- if (firstStatement.kind === 202 && ts.isSuperCall(firstStatement.expression)) {
+ if (firstStatement.kind === 203 && ts.isSuperCall(firstStatement.expression)) {
var superCall = firstStatement.expression;
superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall);
}
@@ -39311,7 +39437,7 @@ var ts;
}
}
function shouldAddDefaultValueAssignments(node) {
- return (node.transformFlags & 65536) !== 0;
+ return (node.transformFlags & 262144) !== 0;
}
function addDefaultValueAssignmentsIfNeeded(statements, node) {
if (!shouldAddDefaultValueAssignments(node)) {
@@ -39319,22 +39445,22 @@ var ts;
}
for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
var parameter = _a[_i];
- var name_35 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
+ var name_32 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
if (dotDotDotToken) {
continue;
}
- if (ts.isBindingPattern(name_35)) {
- addDefaultValueAssignmentForBindingPattern(statements, parameter, name_35, initializer);
+ if (ts.isBindingPattern(name_32)) {
+ addDefaultValueAssignmentForBindingPattern(statements, parameter, name_32, initializer);
}
else if (initializer) {
- addDefaultValueAssignmentForInitializer(statements, parameter, name_35, initializer);
+ addDefaultValueAssignmentForInitializer(statements, parameter, name_32, initializer);
}
}
}
function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {
var temp = ts.getGeneratedNameForNode(parameter);
if (name.elements.length > 0) {
- statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenParameterDestructuring(context, parameter, temp, visitor))), 8388608));
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor))), 8388608));
}
else if (initializer) {
statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608));
@@ -39350,7 +39476,7 @@ var ts;
statements.push(statement);
}
function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
- return node && node.dotDotDotToken && node.name.kind === 69 && !inConstructorWithSynthesizedSuper;
+ return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper;
}
function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
var parameter = ts.lastOrUndefined(node.parameters);
@@ -39375,7 +39501,7 @@ var ts;
statements.push(forStatement);
}
function addCaptureThisForNodeIfNeeded(statements, node) {
- if (node.transformFlags & 16384 && node.kind !== 180) {
+ if (node.transformFlags & 65536 && node.kind !== 181) {
captureThisForNode(statements, node, ts.createThis());
}
}
@@ -39392,20 +39518,20 @@ var ts;
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 198:
+ case 199:
statements.push(transformSemicolonClassElementToStatement(member));
break;
- case 147:
+ case 148:
statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member));
break;
- case 149:
case 150:
+ case 151:
var accessors = ts.getAllAccessorDeclarations(node.members, member);
if (member === accessors.firstAccessor) {
statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors));
}
break;
- case 148:
+ case 149:
break;
default:
ts.Debug.failBadSyntaxKind(node);
@@ -39445,6 +39571,7 @@ var ts;
if (getAccessor) {
var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined);
ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));
+ ts.setEmitFlags(getterFunction, 16384);
var getter = ts.createPropertyAssignment("get", getterFunction);
ts.setCommentRange(getter, ts.getCommentRange(getAccessor));
properties.push(getter);
@@ -39452,6 +39579,7 @@ var ts;
if (setAccessor) {
var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined);
ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));
+ ts.setEmitFlags(setterFunction, 16384);
var setter = ts.createPropertyAssignment("set", setterFunction);
ts.setCommentRange(setter, ts.getCommentRange(setAccessor));
properties.push(setter);
@@ -39468,7 +39596,7 @@ var ts;
return call;
}
function visitArrowFunction(node) {
- if (node.transformFlags & 8192) {
+ if (node.transformFlags & 32768) {
enableSubstitutionsForCapturedThis();
}
var func = transformFunctionLikeToExpression(node, node, undefined);
@@ -39483,10 +39611,10 @@ var ts;
}
function transformFunctionLikeToExpression(node, location, name) {
var savedContainingNonArrowFunction = enclosingNonArrowFunction;
- if (node.kind !== 180) {
+ if (node.kind !== 181) {
enclosingNonArrowFunction = node;
}
- var expression = ts.setOriginalNode(ts.createFunctionExpression(node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node);
+ var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node);
enclosingNonArrowFunction = savedContainingNonArrowFunction;
return expression;
}
@@ -39516,7 +39644,7 @@ var ts;
}
}
else {
- ts.Debug.assert(node.kind === 180);
+ ts.Debug.assert(node.kind === 181);
statementsLocation = ts.moveRangeEnd(body, -1);
var equalsGreaterThanToken = node.equalsGreaterThanToken;
if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
@@ -39543,16 +39671,16 @@ var ts;
ts.setEmitFlags(block, 32);
}
if (closeBraceLocation) {
- ts.setTokenSourceMapRange(block, 16, closeBraceLocation);
+ ts.setTokenSourceMapRange(block, 17, closeBraceLocation);
}
ts.setOriginalNode(block, node.body);
return block;
}
function visitExpressionStatement(node) {
switch (node.expression.kind) {
- case 178:
+ case 179:
return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false));
- case 187:
+ case 188:
return ts.updateStatement(node, visitBinaryExpression(node.expression, false));
}
return ts.visitEachChild(node, visitor, context);
@@ -39560,9 +39688,9 @@ var ts;
function visitParenthesizedExpression(node, needsDestructuringValue) {
if (needsDestructuringValue) {
switch (node.expression.kind) {
- case 178:
+ case 179:
return ts.createParen(visitParenthesizedExpression(node.expression, true), node);
- case 187:
+ case 188:
return ts.createParen(visitBinaryExpression(node.expression, true), node);
}
}
@@ -39581,16 +39709,16 @@ var ts;
if (decl.initializer) {
var assignment = void 0;
if (ts.isBindingPattern(decl.name)) {
- assignment = ts.flattenVariableDestructuringToExpression(context, decl, hoistVariableDeclaration, undefined, visitor);
+ assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, undefined, visitor);
}
else {
- assignment = ts.createBinary(decl.name, 56, ts.visitNode(decl.initializer, visitor, ts.isExpression));
+ assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression));
}
(assignments || (assignments = [])).push(assignment);
}
}
if (assignments) {
- return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 24, acc); }), node);
+ return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node);
}
else {
return undefined;
@@ -39608,7 +39736,7 @@ var ts;
var declarationList = ts.createVariableDeclarationList(declarations, node);
ts.setOriginalNode(declarationList, node);
ts.setCommentRange(declarationList, node);
- if (node.transformFlags & 2097152
+ if (node.transformFlags & 8388608
&& (ts.isBindingPattern(node.declarations[0].name)
|| ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {
var firstDeclaration = ts.firstOrUndefined(declarations);
@@ -39627,8 +39755,8 @@ var ts;
&& ts.isBlock(enclosingBlockScopeContainer)
&& ts.isIterationStatement(enclosingBlockScopeContainerParent, false));
var emitExplicitInitializer = !emittedAsTopLevel
- && enclosingBlockScopeContainer.kind !== 207
&& enclosingBlockScopeContainer.kind !== 208
+ && enclosingBlockScopeContainer.kind !== 209
&& (!resolver.isDeclarationWithCollidingName(node)
|| (isDeclaredInLoop
&& !isCapturedInFunction
@@ -39651,7 +39779,7 @@ var ts;
if (ts.isBindingPattern(node.name)) {
var recordTempVariablesInLine = !enclosingVariableStatement
|| !ts.hasModifier(enclosingVariableStatement, 1);
- return ts.flattenVariableDestructuring(context, node, undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration);
+ return ts.flattenVariableDestructuring(node, undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -39694,7 +39822,7 @@ var ts;
var initializer = node.initializer;
var statements = [];
var counter = ts.createLoopVariable();
- var rhsReference = expression.kind === 69
+ var rhsReference = expression.kind === 70
? ts.createUniqueName(expression.text)
: ts.createTempVariable(undefined);
if (ts.isVariableDeclarationList(initializer)) {
@@ -39703,7 +39831,7 @@ var ts;
}
var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
- var declarations = ts.flattenVariableDestructuring(context, firstOriginalDeclaration, ts.createElementAccess(rhsReference, counter), visitor);
+ var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, ts.createElementAccess(rhsReference, counter), visitor);
var declarationList = ts.createVariableDeclarationList(declarations, initializer);
ts.setOriginalNode(declarationList, initializer);
var firstDeclaration = declarations[0];
@@ -39759,8 +39887,8 @@ var ts;
var numInitialProperties = numProperties;
for (var i = 0; i < numProperties; i++) {
var property = properties[i];
- if (property.transformFlags & 4194304
- || property.name.kind === 140) {
+ if (property.transformFlags & 16777216
+ || property.name.kind === 141) {
numInitialProperties = i;
break;
}
@@ -39786,7 +39914,7 @@ var ts;
}
visit(node.name);
function visit(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
state.hoistedLocalVariables.push(node);
}
else {
@@ -39815,11 +39943,11 @@ var ts;
var functionName = ts.createUniqueName("_loop");
var loopInitializer;
switch (node.kind) {
- case 206:
case 207:
case 208:
+ case 209:
var initializer = node.initializer;
- if (initializer && initializer.kind === 219) {
+ if (initializer && initializer.kind === 220) {
loopInitializer = initializer;
}
break;
@@ -39858,7 +39986,7 @@ var ts;
}
var isAsyncBlockContainingAwait = enclosingNonArrowFunction
&& (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152) !== 0
- && (node.statement.transformFlags & 4194304) !== 0;
+ && (node.statement.transformFlags & 16777216) !== 0;
var loopBodyFlags = 0;
if (currentState.containsLexicalThis) {
loopBodyFlags |= 256;
@@ -39867,7 +39995,7 @@ var ts;
loopBodyFlags |= 2097152;
}
var convertedLoopVariable = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(isAsyncBlockContainingAwait ? ts.createToken(37) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags))
+ ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(undefined, isAsyncBlockContainingAwait ? ts.createToken(38) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags))
]));
var statements = [convertedLoopVariable];
var extraVariableDeclarations;
@@ -39926,7 +40054,7 @@ var ts;
loop.transformFlags = 0;
ts.aggregateTransformFlags(loop);
}
- statements.push(currentParent.kind === 214
+ statements.push(currentParent.kind === 215
? ts.createLabel(currentParent.label, loop)
: loop);
return statements;
@@ -39934,7 +40062,7 @@ var ts;
function copyOutParameter(outParam, copyDirection) {
var source = copyDirection === 0 ? outParam.outParamName : outParam.originalName;
var target = copyDirection === 0 ? outParam.originalName : outParam.outParamName;
- return ts.createBinary(target, 56, source);
+ return ts.createBinary(target, 57, source);
}
function copyOutParameters(outParams, copyDirection, statements) {
for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {
@@ -39949,7 +40077,7 @@ var ts;
!state.labeledNonLocalBreaks &&
!state.labeledNonLocalContinues;
var call = ts.createCall(loopFunctionExpressionName, undefined, ts.map(parameters, function (p) { return p.name; }));
- var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(37), call) : call;
+ var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(38), call) : call;
if (isSimpleLoop) {
statements.push(ts.createStatement(callResult));
copyOutParameters(state.loopOutParameters, 0, statements);
@@ -39968,10 +40096,10 @@ var ts;
else {
returnStatement = ts.createReturn(ts.createPropertyAccess(loopResultName, "value"));
}
- statements.push(ts.createIf(ts.createBinary(ts.createTypeOf(loopResultName), 32, ts.createLiteral("object")), returnStatement));
+ statements.push(ts.createIf(ts.createBinary(ts.createTypeOf(loopResultName), 33, ts.createLiteral("object")), returnStatement));
}
if (state.nonLocalJumps & 2) {
- statements.push(ts.createIf(ts.createBinary(loopResultName, 32, ts.createLiteral("break")), ts.createBreak()));
+ statements.push(ts.createIf(ts.createBinary(loopResultName, 33, ts.createLiteral("break")), ts.createBreak()));
}
if (state.labeledNonLocalBreaks || state.labeledNonLocalContinues) {
var caseClauses = [];
@@ -40038,21 +40166,21 @@ var ts;
for (var i = start; i < numProperties; i++) {
var property = properties[i];
switch (property.kind) {
- case 149:
case 150:
+ case 151:
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
if (property === accessors.firstAccessor) {
expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine));
}
break;
case 253:
- expressions.push(transformPropertyAssignmentToExpression(node, property, receiver, node.multiLine));
+ expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
case 254:
- expressions.push(transformShorthandPropertyAssignmentToExpression(node, property, receiver, node.multiLine));
+ expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
- case 147:
- expressions.push(transformObjectLiteralMethodDeclarationToExpression(node, property, receiver, node.multiLine));
+ case 148:
+ expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine));
break;
default:
ts.Debug.failBadSyntaxKind(node);
@@ -40060,21 +40188,21 @@ var ts;
}
}
}
- function transformPropertyAssignmentToExpression(node, property, receiver, startsOnNewLine) {
+ function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {
var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), property);
if (startsOnNewLine) {
expression.startsOnNewLine = true;
}
return expression;
}
- function transformShorthandPropertyAssignmentToExpression(node, property, receiver, startsOnNewLine) {
+ function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {
var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), property);
if (startsOnNewLine) {
expression.startsOnNewLine = true;
}
return expression;
}
- function transformObjectLiteralMethodDeclarationToExpression(node, method, receiver, startsOnNewLine) {
+ function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) {
var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined), method);
if (startsOnNewLine) {
expression.startsOnNewLine = true;
@@ -40104,17 +40232,17 @@ var ts;
}
function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- if (node.expression.kind === 95) {
+ if (node.expression.kind === 96) {
ts.setEmitFlags(thisArg, 128);
}
var resultingCall;
- if (node.transformFlags & 262144) {
+ if (node.transformFlags & 1048576) {
resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false));
}
else {
resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node);
}
- if (node.expression.kind === 95) {
+ if (node.expression.kind === 96) {
var actualThis = ts.createThis();
ts.setEmitFlags(actualThis, 128);
var initializer = ts.createLogicalOr(resultingCall, actualThis);
@@ -40125,18 +40253,18 @@ var ts;
return resultingCall;
}
function visitNewExpression(node) {
- ts.Debug.assert((node.transformFlags & 262144) !== 0);
+ ts.Debug.assert((node.transformFlags & 1048576) !== 0);
var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []);
}
function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) {
var numElements = elements.length;
- var segments = ts.flatten(ts.spanMap(elements, partitionSpreadElement, function (partition, visitPartition, start, end) {
+ var segments = ts.flatten(ts.spanMap(elements, partitionSpreadElement, function (partition, visitPartition, _start, end) {
return visitPartition(partition, multiLine, hasTrailingComma && end === numElements);
}));
if (segments.length === 1) {
var firstElement = elements[0];
- return needsUniqueCopy && ts.isSpreadElementExpression(firstElement) && firstElement.expression.kind !== 170
+ return needsUniqueCopy && ts.isSpreadElementExpression(firstElement) && firstElement.expression.kind !== 171
? ts.createArraySlice(segments[0])
: segments[0];
}
@@ -40147,7 +40275,7 @@ var ts;
? visitSpanOfSpreadElements
: visitSpanOfNonSpreadElements;
}
- function visitSpanOfSpreadElements(chunk, multiLine, hasTrailingComma) {
+ function visitSpanOfSpreadElements(chunk) {
return ts.map(chunk, visitExpressionOfSpreadElement);
}
function visitSpanOfNonSpreadElements(chunk, multiLine, hasTrailingComma) {
@@ -40188,7 +40316,7 @@ var ts;
}
function getRawLiteral(node) {
var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
- var isLast = node.kind === 11 || node.kind === 14;
+ var isLast = node.kind === 12 || node.kind === 15;
text = text.substring(1, text.length - (isLast ? 1 : 2));
text = text.replace(/\r\n?/g, "\n");
return ts.createLiteral(text, node);
@@ -40222,11 +40350,11 @@ var ts;
}
}
}
- function visitSuperKeyword(node) {
+ function visitSuperKeyword() {
return enclosingNonAsyncFunctionBody
&& ts.isClassElement(enclosingNonAsyncFunctionBody)
&& !ts.hasModifier(enclosingNonAsyncFunctionBody, 32)
- && currentParent.kind !== 174
+ && currentParent.kind !== 175
? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype")
: ts.createIdentifier("_super");
}
@@ -40253,20 +40381,20 @@ var ts;
function enableSubstitutionsForBlockScopedBindings() {
if ((enabledSubstitutions & 2) === 0) {
enabledSubstitutions |= 2;
- context.enableSubstitution(69);
+ context.enableSubstitution(70);
}
}
function enableSubstitutionsForCapturedThis() {
if ((enabledSubstitutions & 1) === 0) {
enabledSubstitutions |= 1;
- context.enableSubstitution(97);
- context.enableEmitNotification(148);
- context.enableEmitNotification(147);
+ context.enableSubstitution(98);
context.enableEmitNotification(149);
+ context.enableEmitNotification(148);
context.enableEmitNotification(150);
+ context.enableEmitNotification(151);
+ context.enableEmitNotification(181);
context.enableEmitNotification(180);
- context.enableEmitNotification(179);
- context.enableEmitNotification(220);
+ context.enableEmitNotification(221);
}
}
function onSubstituteNode(emitContext, node) {
@@ -40291,10 +40419,10 @@ var ts;
function isNameOfDeclarationWithCollidingName(node) {
var parent = node.parent;
switch (parent.kind) {
- case 169:
- case 221:
- case 224:
- case 218:
+ case 170:
+ case 222:
+ case 225:
+ case 219:
return parent.name === node
&& resolver.isDeclarationWithCollidingName(parent);
}
@@ -40302,9 +40430,9 @@ var ts;
}
function substituteExpression(node) {
switch (node.kind) {
- case 69:
+ case 70:
return substituteExpressionIdentifier(node);
- case 97:
+ case 98:
return substituteThisKeyword(node);
}
return node;
@@ -40331,7 +40459,7 @@ var ts;
}
function getDeclarationName(node, allowComments, allowSourceMaps, emitFlags) {
if (node.name && !ts.isGeneratedIdentifier(node.name)) {
- var name_36 = ts.getMutableClone(node.name);
+ var name_33 = ts.getMutableClone(node.name);
emitFlags |= ts.getEmitFlags(node.name);
if (!allowSourceMaps) {
emitFlags |= 1536;
@@ -40340,9 +40468,9 @@ var ts;
emitFlags |= 49152;
}
if (emitFlags) {
- ts.setEmitFlags(name_36, emitFlags);
+ ts.setEmitFlags(name_33, emitFlags);
}
- return name_36;
+ return name_33;
}
return ts.getGeneratedNameForNode(node);
}
@@ -40359,29 +40487,74 @@ var ts;
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
- if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 202) {
+ if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 203) {
return false;
}
var statementExpression = statement.expression;
- if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 174) {
+ if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 175) {
return false;
}
var callTarget = statementExpression.expression;
- if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 95) {
+ if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 96) {
return false;
}
var callArgument = ts.singleOrUndefined(statementExpression.arguments);
- if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 191) {
+ if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 192) {
return false;
}
var expression = callArgument.expression;
return ts.isIdentifier(expression) && expression === parameter.name;
}
}
- ts.transformES6 = transformES6;
+ ts.transformES2015 = transformES2015;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ var OpCode;
+ (function (OpCode) {
+ OpCode[OpCode["Nop"] = 0] = "Nop";
+ OpCode[OpCode["Statement"] = 1] = "Statement";
+ OpCode[OpCode["Assign"] = 2] = "Assign";
+ OpCode[OpCode["Break"] = 3] = "Break";
+ OpCode[OpCode["BreakWhenTrue"] = 4] = "BreakWhenTrue";
+ OpCode[OpCode["BreakWhenFalse"] = 5] = "BreakWhenFalse";
+ OpCode[OpCode["Yield"] = 6] = "Yield";
+ OpCode[OpCode["YieldStar"] = 7] = "YieldStar";
+ OpCode[OpCode["Return"] = 8] = "Return";
+ OpCode[OpCode["Throw"] = 9] = "Throw";
+ OpCode[OpCode["Endfinally"] = 10] = "Endfinally";
+ })(OpCode || (OpCode = {}));
+ var BlockAction;
+ (function (BlockAction) {
+ BlockAction[BlockAction["Open"] = 0] = "Open";
+ BlockAction[BlockAction["Close"] = 1] = "Close";
+ })(BlockAction || (BlockAction = {}));
+ var CodeBlockKind;
+ (function (CodeBlockKind) {
+ CodeBlockKind[CodeBlockKind["Exception"] = 0] = "Exception";
+ CodeBlockKind[CodeBlockKind["With"] = 1] = "With";
+ CodeBlockKind[CodeBlockKind["Switch"] = 2] = "Switch";
+ CodeBlockKind[CodeBlockKind["Loop"] = 3] = "Loop";
+ CodeBlockKind[CodeBlockKind["Labeled"] = 4] = "Labeled";
+ })(CodeBlockKind || (CodeBlockKind = {}));
+ var ExceptionBlockState;
+ (function (ExceptionBlockState) {
+ ExceptionBlockState[ExceptionBlockState["Try"] = 0] = "Try";
+ ExceptionBlockState[ExceptionBlockState["Catch"] = 1] = "Catch";
+ ExceptionBlockState[ExceptionBlockState["Finally"] = 2] = "Finally";
+ ExceptionBlockState[ExceptionBlockState["Done"] = 3] = "Done";
+ })(ExceptionBlockState || (ExceptionBlockState = {}));
+ var Instruction;
+ (function (Instruction) {
+ Instruction[Instruction["Next"] = 0] = "Next";
+ Instruction[Instruction["Throw"] = 1] = "Throw";
+ Instruction[Instruction["Return"] = 2] = "Return";
+ Instruction[Instruction["Break"] = 3] = "Break";
+ Instruction[Instruction["Yield"] = 4] = "Yield";
+ Instruction[Instruction["YieldStar"] = 5] = "YieldStar";
+ Instruction[Instruction["Catch"] = 6] = "Catch";
+ Instruction[Instruction["Endfinally"] = 7] = "Endfinally";
+ })(Instruction || (Instruction = {}));
var instructionNames = ts.createMap((_a = {},
_a[2] = "return",
_a[3] = "break",
@@ -40427,7 +40600,7 @@ var ts;
if (ts.isDeclarationFile(node)) {
return node;
}
- if (node.transformFlags & 1024) {
+ if (node.transformFlags & 4096) {
currentSourceFile = node;
node = ts.visitEachChild(node, visitor, context);
currentSourceFile = undefined;
@@ -40442,10 +40615,10 @@ var ts;
else if (inGeneratorFunctionBody) {
return visitJavaScriptInGeneratorFunctionBody(node);
}
- else if (transformFlags & 512) {
+ else if (transformFlags & 2048) {
return visitGenerator(node);
}
- else if (transformFlags & 1024) {
+ else if (transformFlags & 4096) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -40454,13 +40627,13 @@ var ts;
}
function visitJavaScriptInStatementContainingYield(node) {
switch (node.kind) {
- case 204:
- return visitDoStatement(node);
case 205:
+ return visitDoStatement(node);
+ case 206:
return visitWhileStatement(node);
- case 213:
- return visitSwitchStatement(node);
case 214:
+ return visitSwitchStatement(node);
+ case 215:
return visitLabeledStatement(node);
default:
return visitJavaScriptInGeneratorFunctionBody(node);
@@ -40468,30 +40641,30 @@ var ts;
}
function visitJavaScriptInGeneratorFunctionBody(node) {
switch (node.kind) {
- case 220:
+ case 221:
return visitFunctionDeclaration(node);
- case 179:
+ case 180:
return visitFunctionExpression(node);
- case 149:
case 150:
+ case 151:
return visitAccessorDeclaration(node);
- case 200:
+ case 201:
return visitVariableStatement(node);
- case 206:
- return visitForStatement(node);
case 207:
+ return visitForStatement(node);
+ case 208:
return visitForInStatement(node);
- case 210:
+ case 211:
return visitBreakStatement(node);
- case 209:
+ case 210:
return visitContinueStatement(node);
- case 211:
+ case 212:
return visitReturnStatement(node);
default:
- if (node.transformFlags & 4194304) {
+ if (node.transformFlags & 16777216) {
return visitJavaScriptContainingYield(node);
}
- else if (node.transformFlags & (1024 | 8388608)) {
+ else if (node.transformFlags & (4096 | 33554432)) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -40501,21 +40674,21 @@ var ts;
}
function visitJavaScriptContainingYield(node) {
switch (node.kind) {
- case 187:
- return visitBinaryExpression(node);
case 188:
+ return visitBinaryExpression(node);
+ case 189:
return visitConditionalExpression(node);
- case 190:
+ case 191:
return visitYieldExpression(node);
- case 170:
- return visitArrayLiteralExpression(node);
case 171:
+ return visitArrayLiteralExpression(node);
+ case 172:
return visitObjectLiteralExpression(node);
- case 173:
- return visitElementAccessExpression(node);
case 174:
- return visitCallExpression(node);
+ return visitElementAccessExpression(node);
case 175:
+ return visitCallExpression(node);
+ case 176:
return visitNewExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -40523,9 +40696,9 @@ var ts;
}
function visitGenerator(node) {
switch (node.kind) {
- case 220:
+ case 221:
return visitFunctionDeclaration(node);
- case 179:
+ case 180:
return visitFunctionExpression(node);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -40555,7 +40728,7 @@ var ts;
}
function visitFunctionExpression(node) {
if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- node = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node);
+ node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node);
}
else {
var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
@@ -40628,7 +40801,7 @@ var ts;
return ts.createBlock(statements, body, body.multiLine);
}
function visitVariableStatement(node) {
- if (node.transformFlags & 4194304) {
+ if (node.transformFlags & 16777216) {
transformAndEmitVariableDeclarationList(node.declarationList);
return undefined;
}
@@ -40658,23 +40831,23 @@ var ts;
}
}
function isCompoundAssignment(kind) {
- return kind >= 57
- && kind <= 68;
+ return kind >= 58
+ && kind <= 69;
}
function getOperatorForCompoundAssignment(kind) {
switch (kind) {
- case 57: return 35;
case 58: return 36;
case 59: return 37;
case 60: return 38;
case 61: return 39;
case 62: return 40;
- case 63: return 43;
+ case 63: return 41;
case 64: return 44;
case 65: return 45;
case 66: return 46;
case 67: return 47;
case 68: return 48;
+ case 69: return 49;
}
}
function visitRightAssociativeBinaryExpression(node) {
@@ -40682,10 +40855,10 @@ var ts;
if (containsYield(right)) {
var target = void 0;
switch (left.kind) {
- case 172:
+ case 173:
target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);
break;
- case 173:
+ case 174:
target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression)));
break;
default:
@@ -40694,7 +40867,7 @@ var ts;
}
var operator = node.operatorToken.kind;
if (isCompoundAssignment(operator)) {
- return ts.createBinary(target, 56, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node);
+ return ts.createBinary(target, 57, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node);
}
else {
return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression));
@@ -40707,7 +40880,7 @@ var ts;
if (ts.isLogicalOperator(node.operatorToken.kind)) {
return visitLogicalBinaryExpression(node);
}
- else if (node.operatorToken.kind === 24) {
+ else if (node.operatorToken.kind === 25) {
return visitCommaExpression(node);
}
var clone_6 = ts.getMutableClone(node);
@@ -40721,7 +40894,7 @@ var ts;
var resultLabel = defineLabel();
var resultLocal = declareLocal();
emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), node.left);
- if (node.operatorToken.kind === 51) {
+ if (node.operatorToken.kind === 52) {
emitBreakWhenFalse(resultLabel, resultLocal, node.left);
}
else {
@@ -40737,7 +40910,7 @@ var ts;
visit(node.right);
return ts.inlineExpressions(pendingExpressions);
function visit(node) {
- if (ts.isBinaryExpression(node) && node.operatorToken.kind === 24) {
+ if (ts.isBinaryExpression(node) && node.operatorToken.kind === 25) {
visit(node.left);
visit(node.right);
}
@@ -40780,7 +40953,7 @@ var ts;
function visitArrayLiteralExpression(node) {
return visitElements(node.elements, node.multiLine);
}
- function visitElements(elements, multiLine) {
+ function visitElements(elements, _multiLine) {
var numInitialElements = countInitialNodesWithoutYield(elements);
var temp = declareLocal();
var hasAssignedTemp = false;
@@ -40841,14 +41014,14 @@ var ts;
function visitCallExpression(node) {
if (ts.forEach(node.arguments, containsYield)) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion, true), target = _a.target, thisArg = _a.thisArg;
- return ts.setOriginalNode(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isLeftHandSideExpression)), thisArg, visitElements(node.arguments, false), node), node);
+ return ts.setOriginalNode(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isLeftHandSideExpression)), thisArg, visitElements(node.arguments), node), node);
}
return ts.visitEachChild(node, visitor, context);
}
function visitNewExpression(node) {
if (ts.forEach(node.arguments, containsYield)) {
var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, false)), undefined, [], node), node);
+ return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)), undefined, [], node), node);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -40877,35 +41050,35 @@ var ts;
}
function transformAndEmitStatementWorker(node) {
switch (node.kind) {
- case 199:
+ case 200:
return transformAndEmitBlock(node);
- case 202:
- return transformAndEmitExpressionStatement(node);
case 203:
- return transformAndEmitIfStatement(node);
+ return transformAndEmitExpressionStatement(node);
case 204:
- return transformAndEmitDoStatement(node);
+ return transformAndEmitIfStatement(node);
case 205:
- return transformAndEmitWhileStatement(node);
+ return transformAndEmitDoStatement(node);
case 206:
- return transformAndEmitForStatement(node);
+ return transformAndEmitWhileStatement(node);
case 207:
+ return transformAndEmitForStatement(node);
+ case 208:
return transformAndEmitForInStatement(node);
- case 209:
- return transformAndEmitContinueStatement(node);
case 210:
- return transformAndEmitBreakStatement(node);
+ return transformAndEmitContinueStatement(node);
case 211:
- return transformAndEmitReturnStatement(node);
+ return transformAndEmitBreakStatement(node);
case 212:
- return transformAndEmitWithStatement(node);
+ return transformAndEmitReturnStatement(node);
case 213:
- return transformAndEmitSwitchStatement(node);
+ return transformAndEmitWithStatement(node);
case 214:
- return transformAndEmitLabeledStatement(node);
+ return transformAndEmitSwitchStatement(node);
case 215:
- return transformAndEmitThrowStatement(node);
+ return transformAndEmitLabeledStatement(node);
case 216:
+ return transformAndEmitThrowStatement(node);
+ case 217:
return transformAndEmitTryStatement(node);
default:
return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true));
@@ -41290,7 +41463,7 @@ var ts;
}
}
function containsYield(node) {
- return node && (node.transformFlags & 4194304) !== 0;
+ return node && (node.transformFlags & 16777216) !== 0;
}
function countInitialNodesWithoutYield(nodes) {
var numNodes = nodes.length;
@@ -41320,9 +41493,9 @@ var ts;
if (ts.isIdentifier(original) && original.parent) {
var declaration = resolver.getReferencedValueDeclaration(original);
if (declaration) {
- var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
- if (name_37) {
- var clone_8 = ts.getMutableClone(name_37);
+ var name_34 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
+ if (name_34) {
+ var clone_8 = ts.getMutableClone(name_34);
ts.setSourceMapRange(clone_8, node);
ts.setCommentRange(clone_8, node);
return clone_8;
@@ -41431,7 +41604,7 @@ var ts;
if (!renamedCatchVariables) {
renamedCatchVariables = ts.createMap();
renamedCatchVariableDeclarations = ts.createMap();
- context.enableSubstitution(69);
+ context.enableSubstitution(70);
}
renamedCatchVariables[text] = true;
renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;
@@ -41630,7 +41803,7 @@ var ts;
}
return expression;
}
- return ts.createNode(193);
+ return ts.createNode(194);
}
function createInstruction(instruction) {
var literal = ts.createLiteral(instruction);
@@ -41718,7 +41891,7 @@ var ts;
var buildResult = buildStatements();
return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"), undefined, [
ts.createThis(),
- ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, [ts.createParameter(state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 4194304)
+ ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 4194304)
]);
}
function buildStatements() {
@@ -41985,6 +42158,51 @@ var ts;
var _a;
})(ts || (ts = {}));
var ts;
+(function (ts) {
+ function transformES5(context) {
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ context.onSubstituteNode = onSubstituteNode;
+ context.enableSubstitution(173);
+ context.enableSubstitution(253);
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ return node;
+ }
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (ts.isPropertyAccessExpression(node)) {
+ return substitutePropertyAccessExpression(node);
+ }
+ else if (ts.isPropertyAssignment(node)) {
+ return substitutePropertyAssignment(node);
+ }
+ return node;
+ }
+ function substitutePropertyAccessExpression(node) {
+ var literalName = trySubstituteReservedName(node.name);
+ if (literalName) {
+ return ts.createElementAccess(node.expression, literalName, node);
+ }
+ return node;
+ }
+ function substitutePropertyAssignment(node) {
+ var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name);
+ if (literalName) {
+ return ts.updatePropertyAssignment(node, literalName, node.initializer);
+ }
+ return node;
+ }
+ function trySubstituteReservedName(name) {
+ var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined);
+ if (token >= 71 && token <= 106) {
+ return ts.createLiteral(name, name);
+ }
+ return undefined;
+ }
+ }
+ ts.transformES5 = transformES5;
+})(ts || (ts = {}));
+var ts;
(function (ts) {
function transformModule(context) {
var transformModuleDelegates = ts.createMap((_a = {},
@@ -42003,10 +42221,10 @@ var ts;
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(69);
- context.enableSubstitution(187);
- context.enableSubstitution(185);
+ context.enableSubstitution(70);
+ context.enableSubstitution(188);
context.enableSubstitution(186);
+ context.enableSubstitution(187);
context.enableSubstitution(254);
context.enableEmitNotification(256);
var currentSourceFile;
@@ -42023,7 +42241,7 @@ var ts;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
currentSourceFile = node;
- (_a = ts.collectExternalModuleInfo(node, resolver), externalImports = _a.externalImports, exportSpecifiers = _a.exportSpecifiers, exportEquals = _a.exportEquals, hasExportStarsToExportValues = _a.hasExportStarsToExportValues, _a);
+ (_a = ts.collectExternalModuleInfo(node), externalImports = _a.externalImports, exportSpecifiers = _a.exportSpecifiers, exportEquals = _a.exportEquals, hasExportStarsToExportValues = _a.hasExportStarsToExportValues, _a);
var transformModule_1 = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];
var updated = transformModule_1(node);
ts.aggregateTransformFlags(updated);
@@ -42068,7 +42286,7 @@ var ts;
ts.createLiteral("require"),
ts.createLiteral("exports")
].concat(aliasedModuleNames, unaliasedModuleNames)),
- ts.createFunctionExpression(undefined, undefined, undefined, [
+ ts.createFunctionExpression(undefined, undefined, undefined, undefined, [
ts.createParameter("require"),
ts.createParameter("exports")
].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node))
@@ -42089,7 +42307,7 @@ var ts;
return body;
}
function addExportEqualsIfNeeded(statements, emitAsReturn) {
- if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) {
+ if (exportEquals) {
if (emitAsReturn) {
var statement = ts.createReturn(exportEquals.expression, exportEquals);
ts.setEmitFlags(statement, 12288 | 49152);
@@ -42104,21 +42322,21 @@ var ts;
}
function visitor(node) {
switch (node.kind) {
- case 230:
+ case 231:
return visitImportDeclaration(node);
- case 229:
+ case 230:
return visitImportEqualsDeclaration(node);
- case 236:
+ case 237:
return visitExportDeclaration(node);
- case 235:
+ case 236:
return visitExportAssignment(node);
- case 200:
+ case 201:
return visitVariableStatement(node);
- case 220:
- return visitFunctionDeclaration(node);
case 221:
+ return visitFunctionDeclaration(node);
+ case 222:
return visitClassDeclaration(node);
- case 202:
+ case 203:
return visitExpressionStatement(node);
default:
return node;
@@ -42194,14 +42412,12 @@ var ts;
}
for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) {
var specifier = _a[_i];
- if (resolver.isValueAliasDeclaration(specifier)) {
- var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name);
- statements.push(ts.createStatement(createExportAssignment(specifier.name, exportedValue), specifier));
- }
+ var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name);
+ statements.push(ts.createStatement(createExportAssignment(specifier.name, exportedValue), specifier));
}
return ts.singleOrMany(statements);
}
- else if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) {
+ else {
return ts.createStatement(ts.createCall(ts.createIdentifier("__export"), undefined, [
moduleKind !== ts.ModuleKind.AMD
? createRequireCall(node)
@@ -42210,14 +42426,12 @@ var ts;
}
}
function visitExportAssignment(node) {
- if (!node.isExportEquals) {
- if (ts.nodeIsSynthesized(node) || resolver.isValueAliasDeclaration(node)) {
- var statements = [];
- addExportDefault(statements, node.expression, node);
- return statements;
- }
+ if (node.isExportEquals) {
+ return undefined;
}
- return undefined;
+ var statements = [];
+ addExportDefault(statements, node.expression, node);
+ return statements;
}
function addExportDefault(statements, expression, location) {
tryAddExportDefaultCompat(statements);
@@ -42248,16 +42462,16 @@ var ts;
else {
var names = ts.reduceEachChild(node, collectExportMembers, []);
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name_38 = names_1[_i];
- addExportMemberAssignments(statements, name_38);
+ var name_35 = names_1[_i];
+ addExportMemberAssignments(statements, name_35);
}
}
}
function collectExportMembers(names, node) {
- if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node) && ts.isDeclaration(node)) {
- var name_39 = node.name;
- if (ts.isIdentifier(name_39)) {
- names.push(name_39);
+ if (ts.isAliasSymbolDeclaration(node) && ts.isDeclaration(node)) {
+ var name_36 = node.name;
+ if (ts.isIdentifier(name_36)) {
+ names.push(name_36);
}
}
return ts.reduceEachChild(node, collectExportMembers, names);
@@ -42280,9 +42494,9 @@ var ts;
}
function visitVariableStatement(node) {
var originalKind = ts.getOriginalNode(node).kind;
- if (originalKind === 225 ||
- originalKind === 224 ||
- originalKind === 221) {
+ if (originalKind === 226 ||
+ originalKind === 225 ||
+ originalKind === 222) {
if (!ts.hasModifier(node, 1)) {
return node;
}
@@ -42328,7 +42542,7 @@ var ts;
function transformInitializedVariable(node) {
var name = node.name;
if (ts.isBindingPattern(name)) {
- return ts.flattenVariableDestructuringToExpression(context, node, hoistVariableDeclaration, getModuleMemberName, visitor);
+ return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, getModuleMemberName, visitor);
}
else {
return ts.createAssignment(getModuleMemberName(name), ts.visitNode(node.initializer, visitor, ts.isExpression));
@@ -42338,7 +42552,8 @@ var ts;
var statements = [];
var name = node.name || ts.getGeneratedNameForNode(node);
if (ts.hasModifier(node, 1)) {
- statements.push(ts.setOriginalNode(ts.createFunctionDeclaration(undefined, undefined, node.asteriskToken, name, undefined, node.parameters, undefined, node.body, node), node));
+ var isAsync = ts.hasModifier(node, 256);
+ statements.push(ts.setOriginalNode(ts.createFunctionDeclaration(undefined, isAsync ? [ts.createNode(119)] : undefined, node.asteriskToken, name, undefined, node.parameters, undefined, node.body, node), node));
addExportMemberAssignment(statements, node);
}
else {
@@ -42367,10 +42582,10 @@ var ts;
function visitExpressionStatement(node) {
var original = ts.getOriginalNode(node);
var origKind = original.kind;
- if (origKind === 224 || origKind === 225) {
+ if (origKind === 225 || origKind === 226) {
return visitExpressionStatementForEnumOrNamespaceDeclaration(node, original);
}
- else if (origKind === 221) {
+ else if (origKind === 222) {
var classDecl = original;
if (classDecl.name) {
var statements = [node];
@@ -42383,8 +42598,8 @@ var ts;
function visitExpressionStatementForEnumOrNamespaceDeclaration(node, original) {
var statements = [node];
if (ts.hasModifier(original, 1) &&
- original.kind === 224 &&
- ts.isFirstDeclarationOfKind(original, 224)) {
+ original.kind === 225 &&
+ ts.isFirstDeclarationOfKind(original, 225)) {
addVarForExportedEnumOrNamespaceDeclaration(statements, original);
}
addExportMemberAssignments(statements, original.name);
@@ -42432,12 +42647,12 @@ var ts;
}
function substituteExpression(node) {
switch (node.kind) {
- case 69:
+ case 70:
return substituteExpressionIdentifier(node);
- case 187:
+ case 188:
return substituteBinaryExpression(node);
+ case 187:
case 186:
- case 185:
return substituteUnaryExpression(node);
}
return node;
@@ -42471,8 +42686,8 @@ var ts;
if (bindingNameExportSpecifiersMap && ts.hasProperty(bindingNameExportSpecifiersMap, operand.text)) {
ts.setEmitFlags(node, 128);
var transformedUnaryExpression = void 0;
- if (node.kind === 186) {
- transformedUnaryExpression = ts.createBinary(operand, ts.createToken(operator === 41 ? 57 : 58), ts.createLiteral(1), node);
+ if (node.kind === 187) {
+ transformedUnaryExpression = ts.createBinary(operand, ts.createToken(operator === 42 ? 58 : 59), ts.createLiteral(1), node);
ts.setEmitFlags(transformedUnaryExpression, 128);
}
var nestedExportAssignment = void 0;
@@ -42504,21 +42719,11 @@ var ts;
var declaration = resolver.getReferencedImportDeclaration(node);
if (declaration) {
if (ts.isImportClause(declaration)) {
- if (languageVersion >= 1) {
- return ts.createPropertyAccess(ts.getGeneratedNameForNode(declaration.parent), ts.createIdentifier("default"), node);
- }
- else {
- return ts.createElementAccess(ts.getGeneratedNameForNode(declaration.parent), ts.createLiteral("default"), node);
- }
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(declaration.parent), ts.createIdentifier("default"), node);
}
else if (ts.isImportSpecifier(declaration)) {
- var name_40 = declaration.propertyName || declaration.name;
- if (name_40.originalKeywordKind === 77 && languageVersion <= 0) {
- return ts.createElementAccess(ts.getGeneratedNameForNode(declaration.parent.parent.parent), ts.createLiteral(name_40.text), node);
- }
- else {
- return ts.createPropertyAccess(ts.getGeneratedNameForNode(declaration.parent.parent.parent), ts.getSynthesizedClone(name_40), node);
- }
+ var name_37 = declaration.propertyName || declaration.name;
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(declaration.parent.parent.parent), ts.getSynthesizedClone(name_37), node);
}
}
}
@@ -42544,9 +42749,7 @@ var ts;
return statement;
}
function createExportAssignment(name, value) {
- return ts.createAssignment(name.originalKeywordKind === 77 && languageVersion === 0
- ? ts.createElementAccess(ts.createIdentifier("exports"), ts.createLiteral(name.text))
- : ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value);
+ return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value);
}
function collectAsynchronousDependencies(node, includeNonAmdDependencies) {
var aliasedModuleNames = [];
@@ -42593,15 +42796,14 @@ var ts;
var compilerOptions = context.getCompilerOptions();
var resolver = context.getEmitResolver();
var host = context.getEmitHost();
- var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var previousOnSubstituteNode = context.onSubstituteNode;
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(69);
- context.enableSubstitution(187);
- context.enableSubstitution(185);
+ context.enableSubstitution(70);
+ context.enableSubstitution(188);
context.enableSubstitution(186);
+ context.enableSubstitution(187);
context.enableEmitNotification(256);
var exportFunctionForFileMap = [];
var currentSourceFile;
@@ -42641,7 +42843,7 @@ var ts;
}
function transformSystemModuleWorker(node) {
ts.Debug.assert(!exportFunctionForFile);
- (_a = ts.collectExternalModuleInfo(node, resolver), externalImports = _a.externalImports, exportSpecifiers = _a.exportSpecifiers, exportEquals = _a.exportEquals, hasExportStarsToExportValues = _a.hasExportStarsToExportValues, _a);
+ (_a = ts.collectExternalModuleInfo(node), externalImports = _a.externalImports, exportSpecifiers = _a.exportSpecifiers, exportEquals = _a.exportEquals, hasExportStarsToExportValues = _a.hasExportStarsToExportValues, _a);
exportFunctionForFile = ts.createUniqueName("exports");
contextObjectForFile = ts.createUniqueName("context");
exportFunctionForFileMap[ts.getOriginalNodeId(node)] = exportFunctionForFile;
@@ -42650,7 +42852,7 @@ var ts;
addSystemModuleBody(statements, node, dependencyGroups);
var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, getNameOfDependencyGroup));
- var body = ts.createFunctionExpression(undefined, undefined, undefined, [
+ var body = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [
ts.createParameter(exportFunctionForFile),
ts.createParameter(contextObjectForFile)
], undefined, ts.setEmitFlags(ts.createBlock(statements, undefined, true), 1));
@@ -42673,7 +42875,7 @@ var ts;
var exportStarFunction = addExportStarIfNeeded(statements);
statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([
ts.createPropertyAssignment("setters", generateSetters(exportStarFunction, dependencyGroups)),
- ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true)))
+ ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true)))
]), true)));
}
function addExportStarIfNeeded(statements) {
@@ -42684,7 +42886,7 @@ var ts;
var hasExportDeclarationWithExportClause = false;
for (var _i = 0, externalImports_2 = externalImports; _i < externalImports_2.length; _i++) {
var externalImport = externalImports_2[_i];
- if (externalImport.kind === 236 && externalImport.exportClause) {
+ if (externalImport.kind === 237 && externalImport.exportClause) {
hasExportDeclarationWithExportClause = true;
break;
}
@@ -42702,7 +42904,7 @@ var ts;
}
for (var _b = 0, externalImports_3 = externalImports; _b < externalImports_3.length; _b++) {
var externalImport = externalImports_3[_b];
- if (externalImport.kind !== 236) {
+ if (externalImport.kind !== 237) {
continue;
}
var exportDecl = externalImport;
@@ -42731,15 +42933,15 @@ var ts;
var entry = _b[_a];
var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile);
switch (entry.kind) {
- case 230:
+ case 231:
if (!entry.importClause) {
break;
}
- case 229:
+ case 230:
ts.Debug.assert(importVariableName !== undefined);
statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName)));
break;
- case 236:
+ case 237:
ts.Debug.assert(importVariableName !== undefined);
if (entry.exportClause) {
var properties = [];
@@ -42755,19 +42957,19 @@ var ts;
break;
}
}
- setters.push(ts.createFunctionExpression(undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, ts.createBlock(statements, undefined, true)));
+ setters.push(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(parameterName)], undefined, ts.createBlock(statements, undefined, true)));
}
return ts.createArrayLiteral(setters, undefined, true);
}
function visitSourceElement(node) {
switch (node.kind) {
- case 230:
+ case 231:
return visitImportDeclaration(node);
- case 229:
+ case 230:
return visitImportEqualsDeclaration(node);
- case 236:
+ case 237:
return visitExportDeclaration(node);
- case 235:
+ case 236:
return visitExportAssignment(node);
default:
return visitNestedNode(node);
@@ -42791,41 +42993,41 @@ var ts;
}
function visitNestedNodeWorker(node) {
switch (node.kind) {
- case 200:
+ case 201:
return visitVariableStatement(node);
- case 220:
- return visitFunctionDeclaration(node);
case 221:
+ return visitFunctionDeclaration(node);
+ case 222:
return visitClassDeclaration(node);
- case 206:
- return visitForStatement(node);
case 207:
- return visitForInStatement(node);
+ return visitForStatement(node);
case 208:
+ return visitForInStatement(node);
+ case 209:
return visitForOfStatement(node);
- case 204:
- return visitDoStatement(node);
case 205:
+ return visitDoStatement(node);
+ case 206:
return visitWhileStatement(node);
- case 214:
+ case 215:
return visitLabeledStatement(node);
- case 212:
- return visitWithStatement(node);
case 213:
+ return visitWithStatement(node);
+ case 214:
return visitSwitchStatement(node);
- case 227:
+ case 228:
return visitCaseBlock(node);
case 249:
return visitCaseClause(node);
case 250:
return visitDefaultClause(node);
- case 216:
+ case 217:
return visitTryStatement(node);
case 252:
return visitCatchClause(node);
- case 199:
+ case 200:
return visitBlock(node);
- case 202:
+ case 203:
return visitExpressionStatement(node);
default:
return node;
@@ -42852,20 +43054,14 @@ var ts;
return undefined;
}
function visitExportSpecifier(specifier) {
- if (resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name)
- || resolver.isValueAliasDeclaration(specifier)) {
- recordExportName(specifier.name);
- return createExportStatement(specifier.name, specifier.propertyName || specifier.name);
- }
- return undefined;
+ recordExportName(specifier.name);
+ return createExportStatement(specifier.name, specifier.propertyName || specifier.name);
}
function visitExportAssignment(node) {
- if (!node.isExportEquals) {
- if (ts.nodeIsSynthesized(node) || resolver.isValueAliasDeclaration(node)) {
- return createExportStatement(ts.createLiteral("default"), node.expression);
- }
+ if (node.isExportEquals) {
+ return undefined;
}
- return undefined;
+ return createExportStatement(ts.createLiteral("default"), node.expression);
}
function visitVariableStatement(node) {
var shouldHoist = ((ts.getCombinedNodeFlags(ts.getOriginalNode(node.declarationList)) & 3) == 0) ||
@@ -42897,16 +43093,17 @@ var ts;
return ts.createAssignment(name, node.initializer);
}
else {
- return ts.flattenVariableDestructuringToExpression(context, node, hoistVariableDeclaration);
+ return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration);
}
}
function visitFunctionDeclaration(node) {
if (ts.hasModifier(node, 1)) {
- var name_41 = node.name || ts.getGeneratedNameForNode(node);
- var newNode = ts.createFunctionDeclaration(undefined, undefined, node.asteriskToken, name_41, undefined, node.parameters, undefined, node.body, node);
+ var name_38 = node.name || ts.getGeneratedNameForNode(node);
+ var isAsync = ts.hasModifier(node, 256);
+ var newNode = ts.createFunctionDeclaration(undefined, isAsync ? [ts.createNode(119)] : undefined, node.asteriskToken, name_38, undefined, node.parameters, undefined, node.body, node);
recordExportedFunctionDeclaration(node);
if (!ts.hasModifier(node, 512)) {
- recordExportName(name_41);
+ recordExportName(name_38);
}
ts.setOriginalNode(newNode, node);
node = newNode;
@@ -42916,14 +43113,14 @@ var ts;
}
function visitExpressionStatement(node) {
var originalNode = ts.getOriginalNode(node);
- if ((originalNode.kind === 225 || originalNode.kind === 224) && ts.hasModifier(originalNode, 1)) {
- var name_42 = getDeclarationName(originalNode);
- if (originalNode.kind === 224) {
- hoistVariableDeclaration(name_42);
+ if ((originalNode.kind === 226 || originalNode.kind === 225) && ts.hasModifier(originalNode, 1)) {
+ var name_39 = getDeclarationName(originalNode);
+ if (originalNode.kind === 225) {
+ hoistVariableDeclaration(name_39);
}
return [
node,
- createExportStatement(name_42, name_42)
+ createExportStatement(name_39, name_39)
];
}
return node;
@@ -42958,7 +43155,7 @@ var ts;
;
return ts.createFor(expressions.length
? ts.inlineExpressions(expressions)
- : ts.createSynthesizedNode(193), node.condition, node.incrementor, ts.visitNode(node.statement, visitNestedNode, ts.isStatement), node);
+ : ts.createSynthesizedNode(194), node.condition, node.incrementor, ts.visitNode(node.statement, visitNestedNode, ts.isStatement), node);
}
else {
return ts.visitEachChild(node, visitNestedNode, context);
@@ -42970,7 +43167,7 @@ var ts;
var name = firstDeclaration.name;
return ts.isIdentifier(name)
? name
- : ts.flattenVariableDestructuringToExpression(context, firstDeclaration, hoistVariableDeclaration);
+ : ts.flattenVariableDestructuringToExpression(firstDeclaration, hoistVariableDeclaration);
}
function visitForInStatement(node) {
var initializer = node.initializer;
@@ -43096,12 +43293,12 @@ var ts;
}
function substituteExpression(node) {
switch (node.kind) {
- case 69:
+ case 70:
return substituteExpressionIdentifier(node);
- case 187:
+ case 188:
return substituteBinaryExpression(node);
- case 185:
case 186:
+ case 187:
return substituteUnaryExpression(node);
}
return node;
@@ -43126,14 +43323,14 @@ var ts;
ts.setEmitFlags(node, 128);
var left = node.left;
switch (left.kind) {
- case 69:
+ case 70:
var exportDeclaration = resolver.getReferencedExportContainer(left);
if (exportDeclaration) {
return createExportExpression(left, node);
}
break;
+ case 172:
case 171:
- case 170:
if (hasExportedReferenceInDestructuringPattern(left)) {
return substituteDestructuring(node);
}
@@ -43147,9 +43344,9 @@ var ts;
}
function hasExportedReferenceInDestructuringPattern(node) {
switch (node.kind) {
- case 69:
+ case 70:
return isExportedBinding(node);
- case 171:
+ case 172:
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var property = _a[_i];
if (hasExportedReferenceInObjectDestructuringElement(property)) {
@@ -43157,7 +43354,7 @@ var ts;
}
}
break;
- case 170:
+ case 171:
for (var _b = 0, _c = node.elements; _b < _c.length; _b++) {
var element = _c[_b];
if (hasExportedReferenceInArrayDestructuringElement(element)) {
@@ -43191,7 +43388,7 @@ var ts;
function hasExportedReferenceInDestructuringElement(node) {
if (ts.isBinaryExpression(node)) {
var left = node.left;
- return node.operatorToken.kind === 56
+ return node.operatorToken.kind === 57
&& isDestructuringPattern(left)
&& hasExportedReferenceInDestructuringPattern(left);
}
@@ -43211,9 +43408,9 @@ var ts;
}
function isDestructuringPattern(node) {
var kind = node.kind;
- return kind === 69
- || kind === 171
- || kind === 170;
+ return kind === 70
+ || kind === 172
+ || kind === 171;
}
function substituteDestructuring(node) {
return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration);
@@ -43222,19 +43419,19 @@ var ts;
var operand = node.operand;
var operator = node.operator;
var substitute = ts.isIdentifier(operand) &&
- (node.kind === 186 ||
- (node.kind === 185 && (operator === 41 || operator === 42)));
+ (node.kind === 187 ||
+ (node.kind === 186 && (operator === 42 || operator === 43)));
if (substitute) {
var exportDeclaration = resolver.getReferencedExportContainer(operand);
if (exportDeclaration) {
var expr = ts.createPrefix(node.operator, operand, node);
ts.setEmitFlags(expr, 128);
var call = createExportExpression(operand, expr);
- if (node.kind === 185) {
+ if (node.kind === 186) {
return call;
}
else {
- return operator === 41
+ return operator === 42
? ts.createSubtract(call, ts.createLiteral(1))
: ts.createAdd(call, ts.createLiteral(1));
}
@@ -43293,12 +43490,7 @@ var ts;
else {
return undefined;
}
- if (name.originalKeywordKind && languageVersion === 0) {
- return ts.createElementAccess(importAlias, ts.createLiteral(name.text));
- }
- else {
- return ts.createPropertyAccess(importAlias, ts.getSynthesizedClone(name));
- }
+ return ts.createPropertyAccess(importAlias, ts.getSynthesizedClone(name));
}
function collectDependencyGroups(externalImports) {
var groupIndices = ts.createMap();
@@ -43369,17 +43561,14 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- function transformES6Module(context) {
+ function transformES2015Module(context) {
var compilerOptions = context.getCompilerOptions();
- var resolver = context.getEmitResolver();
- var currentSourceFile;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- currentSourceFile = node;
return ts.visitEachChild(node, visitor, context);
}
return node;
@@ -43387,115 +43576,33 @@ var ts;
function visitor(node) {
switch (node.kind) {
case 230:
- return visitImportDeclaration(node);
- case 229:
- return visitImportEqualsDeclaration(node);
- case 231:
- return visitImportClause(node);
- case 233:
- case 232:
- return visitNamedBindings(node);
- case 234:
- return visitImportSpecifier(node);
- case 235:
- return visitExportAssignment(node);
+ return undefined;
case 236:
- return visitExportDeclaration(node);
- case 237:
- return visitNamedExports(node);
- case 238:
- return visitExportSpecifier(node);
+ return visitExportAssignment(node);
}
return node;
}
function visitExportAssignment(node) {
- if (node.isExportEquals) {
- return undefined;
- }
- var original = ts.getOriginalNode(node);
- return ts.nodeIsSynthesized(original) || resolver.isValueAliasDeclaration(original) ? node : undefined;
- }
- function visitExportDeclaration(node) {
- if (!node.exportClause) {
- return resolver.moduleExportsSomeValue(node.moduleSpecifier) ? node : undefined;
- }
- if (!resolver.isValueAliasDeclaration(node)) {
- return undefined;
- }
- var newExportClause = ts.visitNode(node.exportClause, visitor, ts.isNamedExports, true);
- if (node.exportClause === newExportClause) {
- return node;
- }
- return newExportClause
- ? ts.createExportDeclaration(undefined, undefined, newExportClause, node.moduleSpecifier)
- : undefined;
- }
- function visitNamedExports(node) {
- var newExports = ts.visitNodes(node.elements, visitor, ts.isExportSpecifier);
- if (node.elements === newExports) {
- return node;
- }
- return newExports.length ? ts.createNamedExports(newExports) : undefined;
- }
- function visitExportSpecifier(node) {
- return resolver.isValueAliasDeclaration(node) ? node : undefined;
- }
- function visitImportEqualsDeclaration(node) {
- return !ts.isExternalModuleImportEqualsDeclaration(node) || resolver.isReferencedAliasDeclaration(node) ? node : undefined;
- }
- function visitImportDeclaration(node) {
- if (node.importClause) {
- var newImportClause = ts.visitNode(node.importClause, visitor, ts.isImportClause);
- if (!newImportClause.name && !newImportClause.namedBindings) {
- return undefined;
- }
- else if (newImportClause !== node.importClause) {
- return ts.createImportDeclaration(undefined, undefined, newImportClause, node.moduleSpecifier);
- }
- }
- return node;
- }
- function visitImportClause(node) {
- var newDefaultImport = node.name;
- if (!resolver.isReferencedAliasDeclaration(node)) {
- newDefaultImport = undefined;
- }
- var newNamedBindings = ts.visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true);
- return newDefaultImport !== node.name || newNamedBindings !== node.namedBindings
- ? ts.createImportClause(newDefaultImport, newNamedBindings)
- : node;
- }
- function visitNamedBindings(node) {
- if (node.kind === 232) {
- return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
- }
- else {
- var newNamedImportElements = ts.visitNodes(node.elements, visitor, ts.isImportSpecifier);
- if (!newNamedImportElements || newNamedImportElements.length == 0) {
- return undefined;
- }
- if (newNamedImportElements === node.elements) {
- return node;
- }
- return ts.createNamedImports(newNamedImportElements);
- }
- }
- function visitImportSpecifier(node) {
- return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
+ return node.isExportEquals ? undefined : node;
}
}
- ts.transformES6Module = transformES6Module;
+ ts.transformES2015Module = transformES2015Module;
})(ts || (ts = {}));
var ts;
(function (ts) {
var moduleTransformerMap = ts.createMap((_a = {},
- _a[ts.ModuleKind.ES6] = ts.transformES6Module,
+ _a[ts.ModuleKind.ES2015] = ts.transformES2015Module,
_a[ts.ModuleKind.System] = ts.transformSystemModule,
_a[ts.ModuleKind.AMD] = ts.transformModule,
_a[ts.ModuleKind.CommonJS] = ts.transformModule,
_a[ts.ModuleKind.UMD] = ts.transformModule,
_a[ts.ModuleKind.None] = ts.transformModule,
_a));
+ var SyntaxKindFeatureFlags;
+ (function (SyntaxKindFeatureFlags) {
+ SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution";
+ SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications";
+ })(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {}));
function getTransformers(compilerOptions) {
var jsx = compilerOptions.jsx;
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
@@ -43506,11 +43613,19 @@ var ts;
if (jsx === 2) {
transformers.push(ts.transformJsx);
}
- transformers.push(ts.transformES7);
+ if (languageVersion < 4) {
+ transformers.push(ts.transformES2017);
+ }
+ if (languageVersion < 3) {
+ transformers.push(ts.transformES2016);
+ }
if (languageVersion < 2) {
- transformers.push(ts.transformES6);
+ transformers.push(ts.transformES2015);
transformers.push(ts.transformGenerators);
}
+ if (languageVersion < 1) {
+ transformers.push(ts.transformES5);
+ }
return transformers;
}
ts.getTransformers = getTransformers;
@@ -43530,7 +43645,7 @@ var ts;
hoistFunctionDeclaration: hoistFunctionDeclaration,
startLexicalEnvironment: startLexicalEnvironment,
endLexicalEnvironment: endLexicalEnvironment,
- onSubstituteNode: function (emitContext, node) { return node; },
+ onSubstituteNode: function (_emitContext, node) { return node; },
enableSubstitution: enableSubstitution,
isSubstitutionEnabled: isSubstitutionEnabled,
onEmitNode: function (node, emitContext, emitCallback) { return emitCallback(node, emitContext); },
@@ -43670,7 +43785,7 @@ var ts;
var isCurrentFileExternalModule;
var reportedDeclarationError = false;
var errorNameNode;
- var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments;
+ var emitJsDocComments = compilerOptions.removeComments ? function () { } : writeJsDocComments;
var emit = compilerOptions.stripInternal ? stripInternal : emitNode;
var noDeclare;
var moduleElementDeclarationEmitInfo = [];
@@ -43714,7 +43829,7 @@ var ts;
var oldWriter = writer;
ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) {
if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) {
- ts.Debug.assert(aliasEmitInfo.node.kind === 230);
+ ts.Debug.assert(aliasEmitInfo.node.kind === 231);
createAndSetNewTextWriterWithSymbolWriter();
ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit));
for (var i = 0; i < aliasEmitInfo.indent; i++) {
@@ -43745,7 +43860,7 @@ var ts;
reportedDeclarationError: reportedDeclarationError,
moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo,
synchronousDeclarationOutput: writer.getText(),
- referencesOutput: referencesOutput
+ referencesOutput: referencesOutput,
};
function hasInternalAnnotation(range) {
var comment = currentText.substring(range.pos, range.end);
@@ -43785,10 +43900,10 @@ var ts;
var oldWriter = writer;
ts.forEach(nodes, function (declaration) {
var nodeToCheck;
- if (declaration.kind === 218) {
+ if (declaration.kind === 219) {
nodeToCheck = declaration.parent.parent;
}
- else if (declaration.kind === 233 || declaration.kind === 234 || declaration.kind === 231) {
+ else if (declaration.kind === 234 || declaration.kind === 235 || declaration.kind === 232) {
ts.Debug.fail("We should be getting ImportDeclaration instead to write");
}
else {
@@ -43799,7 +43914,7 @@ var ts;
moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; });
}
if (moduleElementEmitInfo) {
- if (moduleElementEmitInfo.node.kind === 230) {
+ if (moduleElementEmitInfo.node.kind === 231) {
moduleElementEmitInfo.isVisible = true;
}
else {
@@ -43807,12 +43922,12 @@ var ts;
for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) {
increaseIndent();
}
- if (nodeToCheck.kind === 225) {
+ if (nodeToCheck.kind === 226) {
ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined);
asynchronousSubModuleDeclarationEmitInfo = [];
}
writeModuleElement(nodeToCheck);
- if (nodeToCheck.kind === 225) {
+ if (nodeToCheck.kind === 226) {
moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo;
asynchronousSubModuleDeclarationEmitInfo = undefined;
}
@@ -43924,67 +44039,67 @@ var ts;
}
function emitType(type) {
switch (type.kind) {
- case 117:
- case 132:
- case 130:
- case 120:
+ case 118:
case 133:
- case 103:
- case 135:
- case 93:
- case 127:
- case 165:
+ case 131:
+ case 121:
+ case 134:
+ case 104:
+ case 136:
+ case 94:
+ case 128:
case 166:
+ case 167:
return writeTextOfNode(currentText, type);
- case 194:
+ case 195:
return emitExpressionWithTypeArguments(type);
- case 155:
+ case 156:
return emitTypeReference(type);
- case 158:
+ case 159:
return emitTypeQuery(type);
- case 160:
- return emitArrayType(type);
case 161:
- return emitTupleType(type);
+ return emitArrayType(type);
case 162:
- return emitUnionType(type);
+ return emitTupleType(type);
case 163:
- return emitIntersectionType(type);
+ return emitUnionType(type);
case 164:
+ return emitIntersectionType(type);
+ case 165:
return emitParenType(type);
- case 156:
case 157:
+ case 158:
return emitSignatureDeclarationWithJsDocComments(type);
- case 159:
+ case 160:
return emitTypeLiteral(type);
- case 69:
+ case 70:
return emitEntityName(type);
- case 139:
+ case 140:
return emitEntityName(type);
- case 154:
+ case 155:
return emitTypePredicate(type);
}
function writeEntityName(entityName) {
- if (entityName.kind === 69) {
+ if (entityName.kind === 70) {
writeTextOfNode(currentText, entityName);
}
else {
- var left = entityName.kind === 139 ? entityName.left : entityName.expression;
- var right = entityName.kind === 139 ? entityName.right : entityName.name;
+ var left = entityName.kind === 140 ? entityName.left : entityName.expression;
+ var right = entityName.kind === 140 ? entityName.right : entityName.name;
writeEntityName(left);
write(".");
writeTextOfNode(currentText, right);
}
}
function emitEntityName(entityName) {
- var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 229 ? entityName.parent : enclosingDeclaration);
+ var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 230 ? entityName.parent : enclosingDeclaration);
handleSymbolAccessibilityError(visibilityResult);
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));
writeEntityName(entityName);
}
function emitExpressionWithTypeArguments(node) {
if (ts.isEntityNameExpression(node.expression)) {
- ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 172);
+ ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 173);
emitEntityName(node.expression);
if (node.typeArguments) {
write("<");
@@ -44058,14 +44173,14 @@ var ts;
var count = 0;
while (true) {
count++;
- var name_43 = baseName + "_" + count;
- if (!(name_43 in currentIdentifiers)) {
- return name_43;
+ var name_40 = baseName + "_" + count;
+ if (!(name_40 in currentIdentifiers)) {
+ return name_40;
}
}
}
function emitExportAssignment(node) {
- if (node.expression.kind === 69) {
+ if (node.expression.kind === 70) {
write(node.isExportEquals ? "export = " : "export default ");
writeTextOfNode(currentText, node.expression);
}
@@ -44086,11 +44201,11 @@ var ts;
}
write(";");
writeLine();
- if (node.expression.kind === 69) {
+ if (node.expression.kind === 70) {
var nodes = resolver.collectLinkedAliases(node.expression);
writeAsynchronousModuleElements(nodes);
}
- function getDefaultExportAccessibilityDiagnostic(diagnostic) {
+ function getDefaultExportAccessibilityDiagnostic() {
return {
diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,
errorNode: node
@@ -44104,7 +44219,7 @@ var ts;
if (isModuleElementVisible) {
writeModuleElement(node);
}
- else if (node.kind === 229 ||
+ else if (node.kind === 230 ||
(node.parent.kind === 256 && isCurrentFileExternalModule)) {
var isVisible = void 0;
if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 256) {
@@ -44116,7 +44231,7 @@ var ts;
});
}
else {
- if (node.kind === 230) {
+ if (node.kind === 231) {
var importDeclaration = node;
if (importDeclaration.importClause) {
isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) ||
@@ -44134,23 +44249,23 @@ var ts;
}
function writeModuleElement(node) {
switch (node.kind) {
- case 220:
+ case 221:
return writeFunctionDeclaration(node);
- case 200:
+ case 201:
return writeVariableStatement(node);
- case 222:
+ case 223:
return writeInterfaceDeclaration(node);
- case 221:
+ case 222:
return writeClassDeclaration(node);
- case 223:
- return writeTypeAliasDeclaration(node);
case 224:
- return writeEnumDeclaration(node);
+ return writeTypeAliasDeclaration(node);
case 225:
+ return writeEnumDeclaration(node);
+ case 226:
return writeModuleDeclaration(node);
- case 229:
- return writeImportEqualsDeclaration(node);
case 230:
+ return writeImportEqualsDeclaration(node);
+ case 231:
return writeImportDeclaration(node);
default:
ts.Debug.fail("Unknown symbol kind");
@@ -44165,7 +44280,7 @@ var ts;
if (modifiers & 512) {
write("default ");
}
- else if (node.kind !== 222 && !noDeclare) {
+ else if (node.kind !== 223 && !noDeclare) {
write("declare ");
}
}
@@ -44205,7 +44320,7 @@ var ts;
write(");");
}
writer.writeLine();
- function getImportEntityNameVisibilityError(symbolAccessibilityResult) {
+ function getImportEntityNameVisibilityError() {
return {
diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1,
errorNode: node,
@@ -44215,7 +44330,7 @@ var ts;
}
function isVisibleNamedBinding(namedBindings) {
if (namedBindings) {
- if (namedBindings.kind === 232) {
+ if (namedBindings.kind === 233) {
return resolver.isDeclarationVisible(namedBindings);
}
else {
@@ -44238,7 +44353,7 @@ var ts;
if (currentWriterPos !== writer.getTextPos()) {
write(", ");
}
- if (node.importClause.namedBindings.kind === 232) {
+ if (node.importClause.namedBindings.kind === 233) {
write("* as ");
writeTextOfNode(currentText, node.importClause.namedBindings.name);
}
@@ -44255,13 +44370,13 @@ var ts;
writer.writeLine();
}
function emitExternalModuleSpecifier(parent) {
- resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 225;
+ resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 226;
var moduleSpecifier;
- if (parent.kind === 229) {
+ if (parent.kind === 230) {
var node = parent;
moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node);
}
- else if (parent.kind === 225) {
+ else if (parent.kind === 226) {
moduleSpecifier = parent.name;
}
else {
@@ -44329,7 +44444,7 @@ var ts;
writeTextOfNode(currentText, node.name);
}
}
- while (node.body && node.body.kind !== 226) {
+ while (node.body && node.body.kind !== 227) {
node = node.body;
write(".");
writeTextOfNode(currentText, node.name);
@@ -44363,7 +44478,7 @@ var ts;
write(";");
writeLine();
enclosingDeclaration = prevEnclosingDeclaration;
- function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult) {
+ function getTypeAliasDeclarationVisibilityError() {
return {
diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,
errorNode: node.type,
@@ -44399,7 +44514,7 @@ var ts;
writeLine();
}
function isPrivateMethodTypeParameter(node) {
- return node.parent.kind === 147 && ts.hasModifier(node.parent, 8);
+ return node.parent.kind === 148 && ts.hasModifier(node.parent, 8);
}
function emitTypeParameters(typeParameters) {
function emitTypeParameter(node) {
@@ -44409,49 +44524,49 @@ var ts;
writeTextOfNode(currentText, node.name);
if (node.constraint && !isPrivateMethodTypeParameter(node)) {
write(" extends ");
- if (node.parent.kind === 156 ||
- node.parent.kind === 157 ||
- (node.parent.parent && node.parent.parent.kind === 159)) {
- ts.Debug.assert(node.parent.kind === 147 ||
- node.parent.kind === 146 ||
- node.parent.kind === 156 ||
+ if (node.parent.kind === 157 ||
+ node.parent.kind === 158 ||
+ (node.parent.parent && node.parent.parent.kind === 160)) {
+ ts.Debug.assert(node.parent.kind === 148 ||
+ node.parent.kind === 147 ||
node.parent.kind === 157 ||
- node.parent.kind === 151 ||
- node.parent.kind === 152);
+ node.parent.kind === 158 ||
+ node.parent.kind === 152 ||
+ node.parent.kind === 153);
emitType(node.constraint);
}
else {
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError);
}
}
- function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult) {
+ function getTypeParameterConstraintVisibilityError() {
var diagnosticMessage;
switch (node.parent.kind) {
- case 221:
+ case 222:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
break;
- case 222:
+ case 223:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
- case 152:
+ case 153:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 151:
+ case 152:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
+ case 148:
case 147:
- case 146:
if (ts.hasModifier(node.parent, 32)) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 221) {
+ else if (node.parent.parent.kind === 222) {
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 220:
+ case 221:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
default:
@@ -44479,16 +44594,16 @@ var ts;
if (ts.isEntityNameExpression(node.expression)) {
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError);
}
- else if (!isImplementsList && node.expression.kind === 93) {
+ else if (!isImplementsList && node.expression.kind === 94) {
write("null");
}
else {
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer);
}
- function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
+ function getHeritageClauseVisibilityError() {
var diagnosticMessage;
- if (node.parent.parent.kind === 221) {
+ if (node.parent.parent.kind === 222) {
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;
@@ -44568,17 +44683,17 @@ var ts;
writeLine();
}
function emitVariableDeclaration(node) {
- if (node.kind !== 218 || resolver.isDeclarationVisible(node)) {
+ if (node.kind !== 219 || resolver.isDeclarationVisible(node)) {
if (ts.isBindingPattern(node.name)) {
emitBindingPattern(node.name);
}
else {
writeTextOfNode(currentText, node.name);
- if ((node.kind === 145 || node.kind === 144 ||
- (node.kind === 142 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) {
+ if ((node.kind === 146 || node.kind === 145 ||
+ (node.kind === 143 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) {
write("?");
}
- if ((node.kind === 145 || node.kind === 144) && node.parent.kind === 159) {
+ if ((node.kind === 146 || node.kind === 145) && node.parent.kind === 160) {
emitTypeOfVariableDeclarationFromTypeLiteral(node);
}
else if (resolver.isLiteralConstDeclaration(node)) {
@@ -44591,14 +44706,14 @@ var ts;
}
}
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
- if (node.kind === 218) {
+ if (node.kind === 219) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
}
- else if (node.kind === 145 || node.kind === 144) {
+ else if (node.kind === 146 || node.kind === 145) {
if (ts.hasModifier(node, 32)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
@@ -44606,7 +44721,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 === 221) {
+ else if (node.parent.kind === 222) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -44632,7 +44747,7 @@ var ts;
var elements = [];
for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 193) {
+ if (element.kind !== 194) {
elements.push(element);
}
}
@@ -44698,7 +44813,7 @@ var ts;
accessorWithTypeAnnotation = node;
var type = getTypeAnnotationFromAccessor(node);
if (!type) {
- var anotherAccessor = node.kind === 149 ? accessors.setAccessor : accessors.getAccessor;
+ var anotherAccessor = node.kind === 150 ? accessors.setAccessor : accessors.getAccessor;
type = getTypeAnnotationFromAccessor(anotherAccessor);
if (type) {
accessorWithTypeAnnotation = anotherAccessor;
@@ -44711,7 +44826,7 @@ var ts;
}
function getTypeAnnotationFromAccessor(accessor) {
if (accessor) {
- return accessor.kind === 149
+ return accessor.kind === 150
? accessor.type
: accessor.parameters.length > 0
? accessor.parameters[0].type
@@ -44720,7 +44835,7 @@ var ts;
}
function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
- if (accessorWithTypeAnnotation.kind === 150) {
+ if (accessorWithTypeAnnotation.kind === 151) {
if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
@@ -44766,17 +44881,17 @@ var ts;
}
if (!resolver.isImplementationOfOverload(node)) {
emitJsDocComments(node);
- if (node.kind === 220) {
+ if (node.kind === 221) {
emitModuleElementDeclarationFlags(node);
}
- else if (node.kind === 147 || node.kind === 148) {
+ else if (node.kind === 148 || node.kind === 149) {
emitClassMemberDeclarationFlags(ts.getModifierFlags(node));
}
- if (node.kind === 220) {
+ if (node.kind === 221) {
write("function ");
writeTextOfNode(currentText, node.name);
}
- else if (node.kind === 148) {
+ else if (node.kind === 149) {
write("constructor");
}
else {
@@ -44796,15 +44911,15 @@ var ts;
var prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
var closeParenthesizedFunctionType = false;
- if (node.kind === 153) {
+ if (node.kind === 154) {
emitClassMemberDeclarationFlags(ts.getModifierFlags(node));
write("[");
}
else {
- if (node.kind === 152 || node.kind === 157) {
+ if (node.kind === 153 || node.kind === 158) {
write("new ");
}
- else if (node.kind === 156) {
+ else if (node.kind === 157) {
var currentOutput = writer.getText();
if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") {
closeParenthesizedFunctionType = true;
@@ -44815,20 +44930,20 @@ var ts;
write("(");
}
emitCommaList(node.parameters, emitParameterDeclaration);
- if (node.kind === 153) {
+ if (node.kind === 154) {
write("]");
}
else {
write(")");
}
- var isFunctionTypeOrConstructorType = node.kind === 156 || node.kind === 157;
- if (isFunctionTypeOrConstructorType || node.parent.kind === 159) {
+ var isFunctionTypeOrConstructorType = node.kind === 157 || node.kind === 158;
+ if (isFunctionTypeOrConstructorType || node.parent.kind === 160) {
if (node.type) {
write(isFunctionTypeOrConstructorType ? " => " : ": ");
emitType(node.type);
}
}
- else if (node.kind !== 148 && !ts.hasModifier(node, 8)) {
+ else if (node.kind !== 149 && !ts.hasModifier(node, 8)) {
writeReturnTypeAtSignature(node, getReturnTypeVisibilityError);
}
enclosingDeclaration = prevEnclosingDeclaration;
@@ -44842,23 +44957,23 @@ var ts;
function getReturnTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
switch (node.kind) {
- case 152:
+ case 153:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 151:
+ case 152:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 153:
+ case 154:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
+ case 148:
case 147:
- case 146:
if (ts.hasModifier(node, 32)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
@@ -44866,7 +44981,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 === 221) {
+ else if (node.parent.kind === 222) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -44879,7 +44994,7 @@ var ts;
ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
}
break;
- case 220:
+ case 221:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -44911,9 +45026,9 @@ var ts;
write("?");
}
decreaseIndent();
- if (node.parent.kind === 156 ||
- node.parent.kind === 157 ||
- node.parent.parent.kind === 159) {
+ if (node.parent.kind === 157 ||
+ node.parent.kind === 158 ||
+ node.parent.parent.kind === 160) {
emitTypeOfVariableDeclarationFromTypeLiteral(node);
}
else if (!ts.hasModifier(node.parent, 8)) {
@@ -44929,22 +45044,22 @@ var ts;
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
switch (node.parent.kind) {
- case 148:
+ case 149:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
- case 152:
+ case 153:
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 151:
+ case 152:
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
+ case 148:
case 147:
- case 146:
if (ts.hasModifier(node.parent, 32)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
@@ -44952,7 +45067,7 @@ var ts;
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 221) {
+ else if (node.parent.parent.kind === 222) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -44964,7 +45079,7 @@ var ts;
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
- case 220:
+ case 221:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -44975,12 +45090,12 @@ var ts;
}
}
function emitBindingPattern(bindingPattern) {
- if (bindingPattern.kind === 167) {
+ if (bindingPattern.kind === 168) {
write("{");
emitCommaList(bindingPattern.elements, emitBindingElement);
write("}");
}
- else if (bindingPattern.kind === 168) {
+ else if (bindingPattern.kind === 169) {
write("[");
var elements = bindingPattern.elements;
emitCommaList(elements, emitBindingElement);
@@ -44991,10 +45106,10 @@ var ts;
}
}
function emitBindingElement(bindingElement) {
- if (bindingElement.kind === 193) {
+ if (bindingElement.kind === 194) {
write(" ");
}
- else if (bindingElement.kind === 169) {
+ else if (bindingElement.kind === 170) {
if (bindingElement.propertyName) {
writeTextOfNode(currentText, bindingElement.propertyName);
write(": ");
@@ -45004,7 +45119,7 @@ var ts;
emitBindingPattern(bindingElement.name);
}
else {
- ts.Debug.assert(bindingElement.name.kind === 69);
+ ts.Debug.assert(bindingElement.name.kind === 70);
if (bindingElement.dotDotDotToken) {
write("...");
}
@@ -45016,37 +45131,37 @@ var ts;
}
function emitNode(node) {
switch (node.kind) {
- case 220:
- case 225:
- case 229:
- case 222:
case 221:
+ case 226:
+ case 230:
case 223:
+ case 222:
case 224:
+ case 225:
return emitModuleElement(node, isModuleElementVisible(node));
- case 200:
+ case 201:
return emitModuleElement(node, isVariableStatementVisible(node));
- case 230:
+ case 231:
return emitModuleElement(node, !node.importClause);
- case 236:
+ case 237:
return emitExportDeclaration(node);
+ case 149:
case 148:
case 147:
- case 146:
return writeFunctionDeclaration(node);
- case 152:
- case 151:
case 153:
+ case 152:
+ case 154:
return emitSignatureDeclarationWithJsDocComments(node);
- case 149:
case 150:
+ case 151:
return emitAccessorDeclaration(node);
+ case 146:
case 145:
- case 144:
return emitPropertyDeclaration(node);
case 255:
return emitEnumMemberDeclaration(node);
- case 235:
+ case 236:
return emitExportAssignment(node);
case 256:
return emitSourceFile(node);
@@ -45066,7 +45181,7 @@ var ts;
referencesOutput += "/// " + newLine;
}
return addedBundledEmitReference;
- function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) {
+ function getDeclFileName(emitFileNames, _sourceFiles, isBundledEmit) {
if (isBundledEmit && !addBundledFileReference) {
return;
}
@@ -45131,7 +45246,7 @@ var ts;
emitNodeWithSourceMap: emitNodeWithSourceMap,
emitTokenWithSourceMap: emitTokenWithSourceMap,
getText: getText,
- getSourceMappingURL: getSourceMappingURL
+ getSourceMappingURL: getSourceMappingURL,
};
function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) {
if (disabled) {
@@ -45334,7 +45449,7 @@ var ts;
sources: sourceMapData.sourceMapSources,
names: sourceMapData.sourceMapNames,
mappings: sourceMapData.sourceMapMappings,
- sourcesContent: sourceMapData.sourceMapSourcesContent
+ sourcesContent: sourceMapData.sourceMapSourcesContent,
});
}
function getSourceMappingURL() {
@@ -45398,7 +45513,7 @@ var ts;
setSourceFile: setSourceFile,
emitNodeWithComments: emitNodeWithComments,
emitBodyWithDetachedComments: emitBodyWithDetachedComments,
- emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition
+ emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition,
};
function emitNodeWithComments(emitContext, node, emitCallback) {
if (disabled) {
@@ -45436,7 +45551,7 @@ var ts;
}
if (!skipTrailingComments) {
containerEnd = end;
- if (node.kind === 219) {
+ if (node.kind === 220) {
declarationListContainerEnd = end;
}
}
@@ -45512,7 +45627,7 @@ var ts;
emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos);
}
}
- function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
+ function emitLeadingComment(commentPos, commentEnd, _kind, hasTrailingNewLine, rangePos) {
if (!hasWrittenComment) {
ts.emitNewLineBeforeLeadingCommentOfPosition(currentLineMap, writer, rangePos, commentPos);
hasWrittenComment = true;
@@ -45530,7 +45645,7 @@ var ts;
function emitTrailingComments(pos) {
forEachTrailingCommentToEmit(pos, emitTrailingComment);
}
- function emitTrailingComment(commentPos, commentEnd, kind, hasTrailingNewLine) {
+ function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
if (!writer.isAtStartOfLine()) {
writer.write(" ");
}
@@ -45553,7 +45668,7 @@ var ts;
ts.performance.measure("commentTime", "beforeEmitTrailingCommentsOfPosition");
}
}
- function emitTrailingCommentOfPosition(commentPos, commentEnd, kind, hasTrailingNewLine) {
+ function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
emitPos(commentPos);
ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine);
emitPos(commentEnd);
@@ -45636,8 +45751,14 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ var TempFlags;
+ (function (TempFlags) {
+ TempFlags[TempFlags["Auto"] = 0] = "Auto";
+ TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask";
+ TempFlags[TempFlags["_i"] = 268435456] = "_i";
+ })(TempFlags || (TempFlags = {}));
var id = function (s) { return s; };
- var nullTransformers = [function (ctx) { return id; }];
+ var nullTransformers = [function (_) { return id; }];
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) {
var delimiters = createDelimiterMap();
var brackets = createBracketsMap();
@@ -45815,191 +45936,205 @@ var ts;
function pipelineEmitInIdentifierNameContext(node) {
var kind = node.kind;
switch (kind) {
- case 69:
+ case 70:
return emitIdentifier(node);
}
}
function pipelineEmitInUnspecifiedContext(node) {
var kind = node.kind;
switch (kind) {
- case 12:
case 13:
case 14:
+ case 15:
return emitLiteral(node);
- case 69:
+ case 70:
return emitIdentifier(node);
- case 74:
- case 77:
- case 82:
- case 103:
- case 110:
+ case 75:
+ case 78:
+ case 83:
+ case 104:
case 111:
case 112:
case 113:
- case 115:
+ case 114:
+ case 116:
case 117:
case 118:
+ case 119:
case 120:
+ case 121:
case 122:
- case 130:
+ case 123:
+ case 124:
+ case 125:
+ case 126:
+ case 127:
case 128:
+ case 129:
+ case 130:
+ case 131:
case 132:
case 133:
+ case 134:
+ case 135:
+ case 136:
case 137:
+ case 138:
+ case 139:
writeTokenText(kind);
return;
- case 139:
- return emitQualifiedName(node);
case 140:
- return emitComputedPropertyName(node);
+ return emitQualifiedName(node);
case 141:
- return emitTypeParameter(node);
+ return emitComputedPropertyName(node);
case 142:
- return emitParameter(node);
+ return emitTypeParameter(node);
case 143:
- return emitDecorator(node);
+ return emitParameter(node);
case 144:
- return emitPropertySignature(node);
+ return emitDecorator(node);
case 145:
- return emitPropertyDeclaration(node);
+ return emitPropertySignature(node);
case 146:
- return emitMethodSignature(node);
+ return emitPropertyDeclaration(node);
case 147:
- return emitMethodDeclaration(node);
+ return emitMethodSignature(node);
case 148:
- return emitConstructor(node);
+ return emitMethodDeclaration(node);
case 149:
+ return emitConstructor(node);
case 150:
- return emitAccessorDeclaration(node);
case 151:
- return emitCallSignature(node);
+ return emitAccessorDeclaration(node);
case 152:
- return emitConstructSignature(node);
+ return emitCallSignature(node);
case 153:
- return emitIndexSignature(node);
+ return emitConstructSignature(node);
case 154:
- return emitTypePredicate(node);
+ return emitIndexSignature(node);
case 155:
- return emitTypeReference(node);
+ return emitTypePredicate(node);
case 156:
- return emitFunctionType(node);
+ return emitTypeReference(node);
case 157:
- return emitConstructorType(node);
+ return emitFunctionType(node);
case 158:
- return emitTypeQuery(node);
+ return emitConstructorType(node);
case 159:
- return emitTypeLiteral(node);
+ return emitTypeQuery(node);
case 160:
- return emitArrayType(node);
+ return emitTypeLiteral(node);
case 161:
- return emitTupleType(node);
+ return emitArrayType(node);
case 162:
- return emitUnionType(node);
+ return emitTupleType(node);
case 163:
- return emitIntersectionType(node);
+ return emitUnionType(node);
case 164:
+ return emitIntersectionType(node);
+ case 165:
return emitParenthesizedType(node);
- case 194:
+ case 195:
return emitExpressionWithTypeArguments(node);
- case 165:
- return emitThisType(node);
case 166:
- return emitLiteralType(node);
+ return emitThisType();
case 167:
- return emitObjectBindingPattern(node);
+ return emitLiteralType(node);
case 168:
- return emitArrayBindingPattern(node);
+ return emitObjectBindingPattern(node);
case 169:
+ return emitArrayBindingPattern(node);
+ case 170:
return emitBindingElement(node);
- case 197:
- return emitTemplateSpan(node);
case 198:
- return emitSemicolonClassElement(node);
+ return emitTemplateSpan(node);
case 199:
- return emitBlock(node);
+ return emitSemicolonClassElement();
case 200:
- return emitVariableStatement(node);
+ return emitBlock(node);
case 201:
- return emitEmptyStatement(node);
+ return emitVariableStatement(node);
case 202:
- return emitExpressionStatement(node);
+ return emitEmptyStatement();
case 203:
- return emitIfStatement(node);
+ return emitExpressionStatement(node);
case 204:
- return emitDoStatement(node);
+ return emitIfStatement(node);
case 205:
- return emitWhileStatement(node);
+ return emitDoStatement(node);
case 206:
- return emitForStatement(node);
+ return emitWhileStatement(node);
case 207:
- return emitForInStatement(node);
+ return emitForStatement(node);
case 208:
- return emitForOfStatement(node);
+ return emitForInStatement(node);
case 209:
- return emitContinueStatement(node);
+ return emitForOfStatement(node);
case 210:
- return emitBreakStatement(node);
+ return emitContinueStatement(node);
case 211:
- return emitReturnStatement(node);
+ return emitBreakStatement(node);
case 212:
- return emitWithStatement(node);
+ return emitReturnStatement(node);
case 213:
- return emitSwitchStatement(node);
+ return emitWithStatement(node);
case 214:
- return emitLabeledStatement(node);
+ return emitSwitchStatement(node);
case 215:
- return emitThrowStatement(node);
+ return emitLabeledStatement(node);
case 216:
- return emitTryStatement(node);
+ return emitThrowStatement(node);
case 217:
- return emitDebuggerStatement(node);
+ return emitTryStatement(node);
case 218:
- return emitVariableDeclaration(node);
+ return emitDebuggerStatement(node);
case 219:
- return emitVariableDeclarationList(node);
+ return emitVariableDeclaration(node);
case 220:
- return emitFunctionDeclaration(node);
+ return emitVariableDeclarationList(node);
case 221:
- return emitClassDeclaration(node);
+ return emitFunctionDeclaration(node);
case 222:
- return emitInterfaceDeclaration(node);
+ return emitClassDeclaration(node);
case 223:
- return emitTypeAliasDeclaration(node);
+ return emitInterfaceDeclaration(node);
case 224:
- return emitEnumDeclaration(node);
+ return emitTypeAliasDeclaration(node);
case 225:
- return emitModuleDeclaration(node);
+ return emitEnumDeclaration(node);
case 226:
- return emitModuleBlock(node);
+ return emitModuleDeclaration(node);
case 227:
+ return emitModuleBlock(node);
+ case 228:
return emitCaseBlock(node);
- case 229:
- return emitImportEqualsDeclaration(node);
case 230:
- return emitImportDeclaration(node);
+ return emitImportEqualsDeclaration(node);
case 231:
- return emitImportClause(node);
+ return emitImportDeclaration(node);
case 232:
- return emitNamespaceImport(node);
+ return emitImportClause(node);
case 233:
- return emitNamedImports(node);
+ return emitNamespaceImport(node);
case 234:
- return emitImportSpecifier(node);
+ return emitNamedImports(node);
case 235:
- return emitExportAssignment(node);
+ return emitImportSpecifier(node);
case 236:
- return emitExportDeclaration(node);
+ return emitExportAssignment(node);
case 237:
- return emitNamedExports(node);
+ return emitExportDeclaration(node);
case 238:
- return emitExportSpecifier(node);
+ return emitNamedExports(node);
case 239:
- return;
+ return emitExportSpecifier(node);
case 240:
+ return;
+ case 241:
return emitExternalModuleReference(node);
- case 244:
+ case 10:
return emitJsxText(node);
- case 243:
+ case 244:
return emitJsxOpeningElement(node);
case 245:
return emitJsxClosingElement(node);
@@ -46034,73 +46169,73 @@ var ts;
case 8:
return emitNumericLiteral(node);
case 9:
- case 10:
case 11:
+ case 12:
return emitLiteral(node);
- case 69:
+ case 70:
return emitIdentifier(node);
- case 84:
- case 93:
- case 95:
- case 99:
- case 97:
+ case 85:
+ case 94:
+ case 96:
+ case 100:
+ case 98:
writeTokenText(kind);
return;
- case 170:
- return emitArrayLiteralExpression(node);
case 171:
- return emitObjectLiteralExpression(node);
+ return emitArrayLiteralExpression(node);
case 172:
- return emitPropertyAccessExpression(node);
+ return emitObjectLiteralExpression(node);
case 173:
- return emitElementAccessExpression(node);
+ return emitPropertyAccessExpression(node);
case 174:
- return emitCallExpression(node);
+ return emitElementAccessExpression(node);
case 175:
- return emitNewExpression(node);
+ return emitCallExpression(node);
case 176:
- return emitTaggedTemplateExpression(node);
+ return emitNewExpression(node);
case 177:
- return emitTypeAssertionExpression(node);
+ return emitTaggedTemplateExpression(node);
case 178:
- return emitParenthesizedExpression(node);
+ return emitTypeAssertionExpression(node);
case 179:
- return emitFunctionExpression(node);
+ return emitParenthesizedExpression(node);
case 180:
- return emitArrowFunction(node);
+ return emitFunctionExpression(node);
case 181:
- return emitDeleteExpression(node);
+ return emitArrowFunction(node);
case 182:
- return emitTypeOfExpression(node);
+ return emitDeleteExpression(node);
case 183:
- return emitVoidExpression(node);
+ return emitTypeOfExpression(node);
case 184:
- return emitAwaitExpression(node);
+ return emitVoidExpression(node);
case 185:
- return emitPrefixUnaryExpression(node);
+ return emitAwaitExpression(node);
case 186:
- return emitPostfixUnaryExpression(node);
+ return emitPrefixUnaryExpression(node);
case 187:
- return emitBinaryExpression(node);
+ return emitPostfixUnaryExpression(node);
case 188:
- return emitConditionalExpression(node);
+ return emitBinaryExpression(node);
case 189:
- return emitTemplateExpression(node);
+ return emitConditionalExpression(node);
case 190:
- return emitYieldExpression(node);
+ return emitTemplateExpression(node);
case 191:
- return emitSpreadElementExpression(node);
+ return emitYieldExpression(node);
case 192:
- return emitClassExpression(node);
+ return emitSpreadElementExpression(node);
case 193:
+ return emitClassExpression(node);
+ case 194:
return;
- case 195:
- return emitAsExpression(node);
case 196:
+ return emitAsExpression(node);
+ case 197:
return emitNonNullExpression(node);
- case 241:
- return emitJsxElement(node);
case 242:
+ return emitJsxElement(node);
+ case 243:
return emitJsxSelfClosingElement(node);
case 288:
return emitPartiallyEmittedExpression(node);
@@ -46136,7 +46271,7 @@ var ts;
emit(node.right);
}
function emitEntityName(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
emitExpression(node);
}
else {
@@ -46206,7 +46341,7 @@ var ts;
function emitAccessorDeclaration(node) {
emitDecorators(node, node.decorators);
emitModifiers(node, node.modifiers);
- write(node.kind === 149 ? "get " : "set ");
+ write(node.kind === 150 ? "get " : "set ");
emit(node.name);
emitSignatureAndBody(node, emitSignatureHead);
}
@@ -46234,7 +46369,7 @@ var ts;
emitWithPrefix(": ", node.type);
write(";");
}
- function emitSemicolonClassElement(node) {
+ function emitSemicolonClassElement() {
write(";");
}
function emitTypePredicate(node) {
@@ -46288,7 +46423,7 @@ var ts;
emit(node.type);
write(")");
}
- function emitThisType(node) {
+ function emitThisType() {
write("this");
}
function emitLiteralType(node) {
@@ -46356,7 +46491,7 @@ var ts;
if (!(ts.getEmitFlags(node) & 1048576)) {
var dotRangeStart = node.expression.end;
var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1;
- var dotToken = { kind: 21, pos: dotRangeStart, end: dotRangeEnd };
+ var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd };
indentBeforeDot = needsIndentation(node, node.expression, dotToken);
indentAfterDot = needsIndentation(node, dotToken, node.name);
}
@@ -46371,7 +46506,7 @@ var ts;
function needsDotDotForPropertyAccess(expression) {
if (expression.kind === 8) {
var text = getLiteralTextOfNode(expression);
- return text.indexOf(ts.tokenToString(21)) < 0;
+ return text.indexOf(ts.tokenToString(22)) < 0;
}
else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) {
var constantValue = ts.getConstantValue(expression);
@@ -46388,11 +46523,13 @@ var ts;
}
function emitCallExpression(node) {
emitExpression(node.expression);
+ emitTypeArguments(node, node.typeArguments);
emitExpressionList(node, node.arguments, 1296);
}
function emitNewExpression(node) {
write("new ");
emitExpression(node.expression);
+ emitTypeArguments(node, node.typeArguments);
emitExpressionList(node, node.arguments, 9488);
}
function emitTaggedTemplateExpression(node) {
@@ -46452,16 +46589,16 @@ var ts;
}
function shouldEmitWhitespaceBeforeOperand(node) {
var operand = node.operand;
- return operand.kind === 185
- && ((node.operator === 35 && (operand.operator === 35 || operand.operator === 41))
- || (node.operator === 36 && (operand.operator === 36 || operand.operator === 42)));
+ return operand.kind === 186
+ && ((node.operator === 36 && (operand.operator === 36 || operand.operator === 42))
+ || (node.operator === 37 && (operand.operator === 37 || operand.operator === 43)));
}
function emitPostfixUnaryExpression(node) {
emitExpression(node.operand);
writeTokenText(node.operator);
}
function emitBinaryExpression(node) {
- var isCommaOperator = node.operatorToken.kind !== 24;
+ var isCommaOperator = node.operatorToken.kind !== 25;
var indentBeforeOperator = needsIndentation(node, node.left, node.operatorToken);
var indentAfterOperator = needsIndentation(node, node.operatorToken, node.right);
emitExpression(node.left);
@@ -46522,16 +46659,16 @@ var ts;
emitExpression(node.expression);
emit(node.literal);
}
- function emitBlock(node, format) {
+ function emitBlock(node) {
if (isSingleLineEmptyBlock(node)) {
- writeToken(15, node.pos, node);
+ writeToken(16, node.pos, node);
write(" ");
- writeToken(16, node.statements.end, node);
+ writeToken(17, node.statements.end, node);
}
else {
- writeToken(15, node.pos, node);
+ writeToken(16, node.pos, node);
emitBlockStatements(node);
- writeToken(16, node.statements.end, node);
+ writeToken(17, node.statements.end, node);
}
}
function emitBlockStatements(node) {
@@ -46547,7 +46684,7 @@ var ts;
emit(node.declarationList);
write(";");
}
- function emitEmptyStatement(node) {
+ function emitEmptyStatement() {
write(";");
}
function emitExpressionStatement(node) {
@@ -46555,16 +46692,16 @@ var ts;
write(";");
}
function emitIfStatement(node) {
- var openParenPos = writeToken(88, node.pos, node);
+ var openParenPos = writeToken(89, node.pos, node);
write(" ");
- writeToken(17, openParenPos, node);
+ writeToken(18, openParenPos, node);
emitExpression(node.expression);
- writeToken(18, node.expression.end, node);
+ writeToken(19, node.expression.end, node);
emitEmbeddedStatement(node.thenStatement);
if (node.elseStatement) {
writeLine();
- writeToken(80, node.thenStatement.end, node);
- if (node.elseStatement.kind === 203) {
+ writeToken(81, node.thenStatement.end, node);
+ if (node.elseStatement.kind === 204) {
write(" ");
emit(node.elseStatement);
}
@@ -46593,9 +46730,9 @@ var ts;
emitEmbeddedStatement(node.statement);
}
function emitForStatement(node) {
- var openParenPos = writeToken(86, node.pos);
+ var openParenPos = writeToken(87, node.pos);
write(" ");
- writeToken(17, openParenPos, node);
+ writeToken(18, openParenPos, node);
emitForBinding(node.initializer);
write(";");
emitExpressionWithPrefix(" ", node.condition);
@@ -46605,28 +46742,28 @@ var ts;
emitEmbeddedStatement(node.statement);
}
function emitForInStatement(node) {
- var openParenPos = writeToken(86, node.pos);
+ var openParenPos = writeToken(87, node.pos);
write(" ");
- writeToken(17, openParenPos);
+ writeToken(18, openParenPos);
emitForBinding(node.initializer);
write(" in ");
emitExpression(node.expression);
- writeToken(18, node.expression.end);
+ writeToken(19, node.expression.end);
emitEmbeddedStatement(node.statement);
}
function emitForOfStatement(node) {
- var openParenPos = writeToken(86, node.pos);
+ var openParenPos = writeToken(87, node.pos);
write(" ");
- writeToken(17, openParenPos);
+ writeToken(18, openParenPos);
emitForBinding(node.initializer);
write(" of ");
emitExpression(node.expression);
- writeToken(18, node.expression.end);
+ writeToken(19, node.expression.end);
emitEmbeddedStatement(node.statement);
}
function emitForBinding(node) {
if (node !== undefined) {
- if (node.kind === 219) {
+ if (node.kind === 220) {
emit(node);
}
else {
@@ -46635,17 +46772,17 @@ var ts;
}
}
function emitContinueStatement(node) {
- writeToken(75, node.pos);
+ writeToken(76, node.pos);
emitWithPrefix(" ", node.label);
write(";");
}
function emitBreakStatement(node) {
- writeToken(70, node.pos);
+ writeToken(71, node.pos);
emitWithPrefix(" ", node.label);
write(";");
}
function emitReturnStatement(node) {
- writeToken(94, node.pos, node);
+ writeToken(95, node.pos, node);
emitExpressionWithPrefix(" ", node.expression);
write(";");
}
@@ -46656,11 +46793,11 @@ var ts;
emitEmbeddedStatement(node.statement);
}
function emitSwitchStatement(node) {
- var openParenPos = writeToken(96, node.pos);
+ var openParenPos = writeToken(97, node.pos);
write(" ");
- writeToken(17, openParenPos);
+ writeToken(18, openParenPos);
emitExpression(node.expression);
- writeToken(18, node.expression.end);
+ writeToken(19, node.expression.end);
write(" ");
emit(node.caseBlock);
}
@@ -46685,11 +46822,12 @@ var ts;
}
}
function emitDebuggerStatement(node) {
- writeToken(76, node.pos);
+ writeToken(77, node.pos);
write(";");
}
function emitVariableDeclaration(node) {
emit(node.name);
+ emitWithPrefix(": ", node.type);
emitExpressionWithPrefix(" = ", node.initializer);
}
function emitVariableDeclarationList(node) {
@@ -46716,13 +46854,13 @@ var ts;
}
if (ts.getEmitFlags(node) & 4194304) {
emitSignatureHead(node);
- emitBlockFunctionBody(node, body);
+ emitBlockFunctionBody(body);
}
else {
var savedTempFlags = tempFlags;
tempFlags = 0;
emitSignatureHead(node);
- emitBlockFunctionBody(node, body);
+ emitBlockFunctionBody(body);
tempFlags = savedTempFlags;
}
if (indentedFlag) {
@@ -46745,7 +46883,7 @@ var ts;
emitParameters(node, node.parameters);
emitWithPrefix(": ", node.type);
}
- function shouldEmitBlockFunctionBodyOnSingleLine(parentNode, body) {
+ function shouldEmitBlockFunctionBodyOnSingleLine(body) {
if (ts.getEmitFlags(body) & 32) {
return true;
}
@@ -46769,14 +46907,14 @@ var ts;
}
return true;
}
- function emitBlockFunctionBody(parentNode, body) {
+ function emitBlockFunctionBody(body) {
write(" {");
increaseIndent();
- emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(parentNode, body)
+ emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(body)
? emitBlockFunctionBodyOnSingleLine
: emitBlockFunctionBodyWorker);
decreaseIndent();
- writeToken(16, body.statements.end, body);
+ writeToken(17, body.statements.end, body);
}
function emitBlockFunctionBodyOnSingleLine(body) {
emitBlockFunctionBodyWorker(body, true);
@@ -46854,7 +46992,7 @@ var ts;
write(node.flags & 16 ? "namespace " : "module ");
emit(node.name);
var body = node.body;
- while (body.kind === 225) {
+ while (body.kind === 226) {
write(".");
emit(body.name);
body = body.body;
@@ -46877,9 +47015,9 @@ var ts;
}
}
function emitCaseBlock(node) {
- writeToken(15, node.pos);
+ writeToken(16, node.pos);
emitList(node, node.clauses, 65);
- writeToken(16, node.clauses.end);
+ writeToken(17, node.clauses.end);
}
function emitImportEqualsDeclaration(node) {
emitModifiers(node, node.modifiers);
@@ -46890,7 +47028,7 @@ var ts;
write(";");
}
function emitModuleReference(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
emitExpression(node);
}
else {
@@ -47010,7 +47148,7 @@ var ts;
}
}
function emitJsxTagName(node) {
- if (node.kind === 69) {
+ if (node.kind === 70) {
emitExpression(node);
}
else {
@@ -47048,11 +47186,11 @@ var ts;
}
function emitCatchClause(node) {
writeLine();
- var openParenPos = writeToken(72, node.pos);
+ var openParenPos = writeToken(73, node.pos);
write(" ");
- writeToken(17, openParenPos);
+ writeToken(18, openParenPos);
emit(node.variableDeclaration);
- writeToken(18, node.variableDeclaration ? node.variableDeclaration.end : openParenPos);
+ writeToken(19, node.variableDeclaration ? node.variableDeclaration.end : openParenPos);
write(" ");
emit(node.block);
}
@@ -47159,7 +47297,7 @@ var ts;
paramEmitted = true;
helpersEmitted = true;
}
- if (!awaiterEmitted && node.flags & 8192) {
+ if ((languageVersion < 4) && (!awaiterEmitted && node.flags & 8192)) {
writeLines(awaiterHelper);
if (languageVersion < 2) {
writeLines(generatorHelper);
@@ -47468,7 +47606,7 @@ var ts;
&& !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile);
}
function skipSynthesizedParentheses(node) {
- while (node.kind === 178 && ts.nodeIsSynthesized(node)) {
+ while (node.kind === 179 && ts.nodeIsSynthesized(node)) {
node = node.expression;
}
return node;
@@ -47525,21 +47663,21 @@ var ts;
}
function makeTempVariableName(flags) {
if (flags && !(tempFlags & flags)) {
- var name_44 = flags === 268435456 ? "_i" : "_n";
- if (isUniqueName(name_44)) {
+ var name_41 = flags === 268435456 ? "_i" : "_n";
+ if (isUniqueName(name_41)) {
tempFlags |= flags;
- return name_44;
+ return name_41;
}
}
while (true) {
var count = tempFlags & 268435455;
tempFlags++;
if (count !== 8 && count !== 13) {
- var name_45 = count < 26
+ var name_42 = count < 26
? "_" + String.fromCharCode(97 + count)
: "_" + (count - 26);
- if (isUniqueName(name_45)) {
- return name_45;
+ if (isUniqueName(name_42)) {
+ return name_42;
}
}
}
@@ -47575,19 +47713,19 @@ var ts;
}
function generateNameForNode(node) {
switch (node.kind) {
- case 69:
+ case 70:
return makeUniqueName(getTextOfNode(node));
+ case 226:
case 225:
- case 224:
return generateNameForModuleOrEnum(node);
- case 230:
- case 236:
+ case 231:
+ case 237:
return generateNameForImportOrExportDeclaration(node);
- case 220:
case 221:
- case 235:
+ case 222:
+ case 236:
return generateNameForExportDefault();
- case 192:
+ case 193:
return generateNameForClassExpression();
default:
return makeTempVariableName(0);
@@ -47657,6 +47795,68 @@ var ts;
}
}
ts.emitFiles = emitFiles;
+ var ListFormat;
+ (function (ListFormat) {
+ ListFormat[ListFormat["None"] = 0] = "None";
+ ListFormat[ListFormat["SingleLine"] = 0] = "SingleLine";
+ ListFormat[ListFormat["MultiLine"] = 1] = "MultiLine";
+ ListFormat[ListFormat["PreserveLines"] = 2] = "PreserveLines";
+ ListFormat[ListFormat["LinesMask"] = 3] = "LinesMask";
+ ListFormat[ListFormat["NotDelimited"] = 0] = "NotDelimited";
+ ListFormat[ListFormat["BarDelimited"] = 4] = "BarDelimited";
+ ListFormat[ListFormat["AmpersandDelimited"] = 8] = "AmpersandDelimited";
+ ListFormat[ListFormat["CommaDelimited"] = 16] = "CommaDelimited";
+ ListFormat[ListFormat["DelimitersMask"] = 28] = "DelimitersMask";
+ ListFormat[ListFormat["AllowTrailingComma"] = 32] = "AllowTrailingComma";
+ ListFormat[ListFormat["Indented"] = 64] = "Indented";
+ ListFormat[ListFormat["SpaceBetweenBraces"] = 128] = "SpaceBetweenBraces";
+ ListFormat[ListFormat["SpaceBetweenSiblings"] = 256] = "SpaceBetweenSiblings";
+ ListFormat[ListFormat["Braces"] = 512] = "Braces";
+ ListFormat[ListFormat["Parenthesis"] = 1024] = "Parenthesis";
+ ListFormat[ListFormat["AngleBrackets"] = 2048] = "AngleBrackets";
+ ListFormat[ListFormat["SquareBrackets"] = 4096] = "SquareBrackets";
+ ListFormat[ListFormat["BracketsMask"] = 7680] = "BracketsMask";
+ ListFormat[ListFormat["OptionalIfUndefined"] = 8192] = "OptionalIfUndefined";
+ ListFormat[ListFormat["OptionalIfEmpty"] = 16384] = "OptionalIfEmpty";
+ ListFormat[ListFormat["Optional"] = 24576] = "Optional";
+ ListFormat[ListFormat["PreferNewLine"] = 32768] = "PreferNewLine";
+ ListFormat[ListFormat["NoTrailingNewLine"] = 65536] = "NoTrailingNewLine";
+ ListFormat[ListFormat["NoInterveningComments"] = 131072] = "NoInterveningComments";
+ ListFormat[ListFormat["Modifiers"] = 256] = "Modifiers";
+ ListFormat[ListFormat["HeritageClauses"] = 256] = "HeritageClauses";
+ ListFormat[ListFormat["TypeLiteralMembers"] = 65] = "TypeLiteralMembers";
+ ListFormat[ListFormat["TupleTypeElements"] = 336] = "TupleTypeElements";
+ ListFormat[ListFormat["UnionTypeConstituents"] = 260] = "UnionTypeConstituents";
+ ListFormat[ListFormat["IntersectionTypeConstituents"] = 264] = "IntersectionTypeConstituents";
+ ListFormat[ListFormat["ObjectBindingPatternElements"] = 432] = "ObjectBindingPatternElements";
+ ListFormat[ListFormat["ArrayBindingPatternElements"] = 304] = "ArrayBindingPatternElements";
+ ListFormat[ListFormat["ObjectLiteralExpressionProperties"] = 978] = "ObjectLiteralExpressionProperties";
+ ListFormat[ListFormat["ArrayLiteralExpressionElements"] = 4466] = "ArrayLiteralExpressionElements";
+ ListFormat[ListFormat["CallExpressionArguments"] = 1296] = "CallExpressionArguments";
+ ListFormat[ListFormat["NewExpressionArguments"] = 9488] = "NewExpressionArguments";
+ ListFormat[ListFormat["TemplateExpressionSpans"] = 131072] = "TemplateExpressionSpans";
+ ListFormat[ListFormat["SingleLineBlockStatements"] = 384] = "SingleLineBlockStatements";
+ ListFormat[ListFormat["MultiLineBlockStatements"] = 65] = "MultiLineBlockStatements";
+ ListFormat[ListFormat["VariableDeclarationList"] = 272] = "VariableDeclarationList";
+ ListFormat[ListFormat["SingleLineFunctionBodyStatements"] = 384] = "SingleLineFunctionBodyStatements";
+ ListFormat[ListFormat["MultiLineFunctionBodyStatements"] = 1] = "MultiLineFunctionBodyStatements";
+ ListFormat[ListFormat["ClassHeritageClauses"] = 256] = "ClassHeritageClauses";
+ ListFormat[ListFormat["ClassMembers"] = 65] = "ClassMembers";
+ ListFormat[ListFormat["InterfaceMembers"] = 65] = "InterfaceMembers";
+ ListFormat[ListFormat["EnumMembers"] = 81] = "EnumMembers";
+ ListFormat[ListFormat["CaseBlockClauses"] = 65] = "CaseBlockClauses";
+ ListFormat[ListFormat["NamedImportsOrExportsElements"] = 432] = "NamedImportsOrExportsElements";
+ ListFormat[ListFormat["JsxElementChildren"] = 131072] = "JsxElementChildren";
+ ListFormat[ListFormat["JsxElementAttributes"] = 131328] = "JsxElementAttributes";
+ ListFormat[ListFormat["CaseOrDefaultClauseStatements"] = 81985] = "CaseOrDefaultClauseStatements";
+ ListFormat[ListFormat["HeritageClauseTypes"] = 272] = "HeritageClauseTypes";
+ ListFormat[ListFormat["SourceFileStatements"] = 65537] = "SourceFileStatements";
+ ListFormat[ListFormat["Decorators"] = 24577] = "Decorators";
+ ListFormat[ListFormat["TypeArguments"] = 26960] = "TypeArguments";
+ ListFormat[ListFormat["TypeParameters"] = 26960] = "TypeParameters";
+ ListFormat[ListFormat["Parameters"] = 1360] = "Parameters";
+ ListFormat[ListFormat["IndexSignatureParameters"] = 4432] = "IndexSignatureParameters";
+ })(ListFormat || (ListFormat = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -47876,10 +48076,10 @@ var ts;
var resolutions = [];
var cache = ts.createMap();
for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
- var name_46 = names_2[_i];
- var result = name_46 in cache
- ? cache[name_46]
- : cache[name_46] = loader(name_46, containingFile);
+ var name_43 = names_2[_i];
+ var result = name_43 in cache
+ ? cache[name_43]
+ : cache[name_43] = loader(name_43, containingFile);
resolutions.push(result);
}
return resolutions;
@@ -48110,7 +48310,7 @@ var ts;
getSourceFiles: program.getSourceFiles,
isSourceFileFromExternalLibrary: function (file) { return !!sourceFilesFoundSearchingNodeModules[file.path]; },
writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
- isEmitBlocked: isEmitBlocked
+ isEmitBlocked: isEmitBlocked,
};
}
function getDiagnosticsProducingTypeChecker() {
@@ -48188,7 +48388,7 @@ var ts;
return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
}
}
- function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) {
+ function getSyntacticDiagnosticsForFile(sourceFile) {
return sourceFile.parseDiagnostics;
}
function runWithCancellationToken(func) {
@@ -48209,14 +48409,14 @@ var ts;
ts.Debug.assert(!!sourceFile.bindDiagnostics);
var bindDiagnostics = sourceFile.bindDiagnostics;
var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ?
- getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) :
+ getJavaScriptSemanticDiagnosticsForFile(sourceFile) :
typeChecker.getDiagnostics(sourceFile, cancellationToken);
var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
- return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile);
+ return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile);
});
}
- function getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) {
+ function getJavaScriptSemanticDiagnosticsForFile(sourceFile) {
return runWithCancellationToken(function () {
var diagnostics = [];
walk(sourceFile);
@@ -48226,16 +48426,16 @@ var ts;
return false;
}
switch (node.kind) {
- case 229:
+ case 230:
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));
return true;
- case 235:
+ case 236:
if (node.isExportEquals) {
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));
return true;
}
break;
- case 221:
+ case 222:
var classDeclaration = node;
if (checkModifiers(classDeclaration.modifiers) ||
checkTypeParameters(classDeclaration.typeParameters)) {
@@ -48244,29 +48444,29 @@ var ts;
break;
case 251:
var heritageClause = node;
- if (heritageClause.token === 106) {
+ if (heritageClause.token === 107) {
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
return true;
}
break;
- case 222:
+ case 223:
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
return true;
- case 225:
+ case 226:
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
return true;
- case 223:
+ case 224:
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
return true;
- case 147:
- case 146:
case 148:
+ case 147:
case 149:
case 150:
- case 179:
- case 220:
+ case 151:
case 180:
- case 220:
+ case 221:
+ case 181:
+ case 221:
var functionDeclaration = node;
if (checkModifiers(functionDeclaration.modifiers) ||
checkTypeParameters(functionDeclaration.typeParameters) ||
@@ -48274,20 +48474,20 @@ var ts;
return true;
}
break;
- case 200:
+ case 201:
var variableStatement = node;
if (checkModifiers(variableStatement.modifiers)) {
return true;
}
break;
- case 218:
+ case 219:
var variableDeclaration = node;
if (checkTypeAnnotation(variableDeclaration.type)) {
return true;
}
break;
- case 174:
case 175:
+ case 176:
var expression = node;
if (expression.typeArguments && expression.typeArguments.length > 0) {
var start = expression.typeArguments.pos;
@@ -48295,7 +48495,7 @@ var ts;
return true;
}
break;
- case 142:
+ case 143:
var parameter = node;
if (parameter.modifiers) {
var start = parameter.modifiers.pos;
@@ -48311,12 +48511,12 @@ var ts;
return true;
}
break;
- case 145:
+ case 146:
var propertyDeclaration = node;
if (propertyDeclaration.modifiers) {
for (var _i = 0, _a = propertyDeclaration.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 113) {
+ if (modifier.kind !== 114) {
diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
return true;
}
@@ -48326,14 +48526,14 @@ var ts;
return true;
}
break;
- case 224:
+ case 225:
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
return true;
- case 177:
+ case 178:
var typeAssertionExpression = node;
diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
return true;
- case 143:
+ case 144:
if (!options.experimentalDecorators) {
diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
}
@@ -48361,18 +48561,18 @@ var ts;
for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {
var modifier = modifiers_1[_i];
switch (modifier.kind) {
- case 112:
- case 110:
+ case 113:
case 111:
- case 128:
- case 122:
+ case 112:
+ case 129:
+ case 123:
diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
return true;
- case 113:
- case 82:
- case 74:
- case 77:
- case 115:
+ case 114:
+ case 83:
+ case 75:
+ case 78:
+ case 116:
}
}
}
@@ -48405,7 +48605,7 @@ var ts;
return ts.getBaseFileName(fileName).indexOf(".") >= 0;
}
function processRootFile(fileName, isDefaultLib) {
- processSourceFile(ts.normalizePath(fileName), isDefaultLib, true);
+ processSourceFile(ts.normalizePath(fileName), isDefaultLib);
}
function fileReferenceIsEqualTo(a, b) {
return a.fileName === b.fileName;
@@ -48444,9 +48644,9 @@ var ts;
return;
function collectModuleReferences(node, inAmbientModule) {
switch (node.kind) {
+ case 231:
case 230:
- case 229:
- case 236:
+ case 237:
var moduleNameExpr = ts.getExternalModuleName(node);
if (!moduleNameExpr || moduleNameExpr.kind !== 9) {
break;
@@ -48458,7 +48658,7 @@ var ts;
(imports || (imports = [])).push(moduleNameExpr);
}
break;
- case 225:
+ case 226:
if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) {
var moduleName = node.name;
if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) {
@@ -48485,7 +48685,7 @@ var ts;
}
}
}
- function processSourceFile(fileName, isDefaultLib, isReference, refFile, refPos, refEnd) {
+ function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {
var diagnosticArgument;
var diagnostic;
if (hasExtension(fileName)) {
@@ -48493,7 +48693,7 @@ var ts;
diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;
diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"];
}
- else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) {
+ else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) {
diagnostic = ts.Diagnostics.File_0_not_found;
diagnosticArgument = [fileName];
}
@@ -48503,13 +48703,13 @@ var ts;
}
}
else {
- var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd);
+ var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd);
if (!nonTsFile) {
if (options.allowNonTsExtensions) {
diagnostic = ts.Diagnostics.File_0_not_found;
diagnosticArgument = [fileName];
}
- else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) {
+ else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) {
diagnostic = ts.Diagnostics.File_0_not_found;
fileName += ".ts";
diagnosticArgument = [fileName];
@@ -48533,7 +48733,7 @@ var ts;
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName));
}
}
- function findSourceFile(fileName, path, isDefaultLib, isReference, refFile, refPos, refEnd) {
+ function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) {
if (filesByName.contains(path)) {
var file_1 = filesByName.get(path);
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
@@ -48542,16 +48742,16 @@ var ts;
if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) {
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
if (!options.noResolve) {
- processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
+ processReferencedFiles(file_1, isDefaultLib);
processTypeReferenceDirectives(file_1);
}
modulesWithElidedImports[file_1.path] = false;
- processImportedModules(file_1, ts.getDirectoryPath(fileName));
+ processImportedModules(file_1);
}
else if (file_1 && modulesWithElidedImports[file_1.path]) {
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
modulesWithElidedImports[file_1.path] = false;
- processImportedModules(file_1, ts.getDirectoryPath(fileName));
+ processImportedModules(file_1);
}
}
return file_1;
@@ -48578,12 +48778,11 @@ var ts;
}
}
skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib;
- var basePath = ts.getDirectoryPath(fileName);
if (!options.noResolve) {
- processReferencedFiles(file, basePath, isDefaultLib);
+ processReferencedFiles(file, isDefaultLib);
processTypeReferenceDirectives(file);
}
- processImportedModules(file, basePath);
+ processImportedModules(file);
if (isDefaultLib) {
files.unshift(file);
}
@@ -48593,10 +48792,10 @@ var ts;
}
return file;
}
- function processReferencedFiles(file, basePath, isDefaultLib) {
+ function processReferencedFiles(file, isDefaultLib) {
ts.forEach(file.referencedFiles, function (ref) {
var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
- processSourceFile(referencedFileName, isDefaultLib, true, file, ref.pos, ref.end);
+ processSourceFile(referencedFileName, isDefaultLib, file, ref.pos, ref.end);
});
}
function processTypeReferenceDirectives(file) {
@@ -48618,7 +48817,7 @@ var ts;
var saveResolution = true;
if (resolvedTypeReferenceDirective) {
if (resolvedTypeReferenceDirective.primary) {
- processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd);
+ processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd);
}
else {
if (previousResolution) {
@@ -48629,7 +48828,7 @@ var ts;
saveResolution = false;
}
else {
- processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd);
+ processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd);
}
}
}
@@ -48655,7 +48854,7 @@ var ts;
function getCanonicalFileName(fileName) {
return host.getCanonicalFileName(fileName);
}
- function processImportedModules(file, basePath) {
+ function processImportedModules(file) {
collectExternalModuleReferences(file);
if (file.imports.length || file.moduleAugmentations.length) {
file.resolvedModules = ts.createMap();
@@ -48675,7 +48874,7 @@ var ts;
modulesWithElidedImports[file.path] = true;
}
else if (shouldAddFile) {
- findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
+ findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
}
if (isFromNodeModulesSearch) {
currentNodeModulesDepth--;
@@ -48845,7 +49044,7 @@ var ts;
if (!options.noEmit && !options.suppressOutputPathCheck) {
var emitHost = getEmitHost();
var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined);
- ts.forEachExpectedEmitFile(emitHost, function (emitFileNames, sourceFiles, isBundledEmit) {
+ ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) {
verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1);
verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1);
});
@@ -48854,10 +49053,10 @@ var ts;
if (emitFileName) {
var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName);
if (filesByName.contains(emitFilePath)) {
- createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file);
+ createEmitBlockingDiagnostics(emitFileName, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file);
}
if (emitFilesSeen.contains(emitFilePath)) {
- createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files);
+ createEmitBlockingDiagnostics(emitFileName, ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files);
}
else {
emitFilesSeen.set(emitFilePath, true);
@@ -48865,7 +49064,7 @@ var ts;
}
}
}
- function createEmitBlockingDiagnostics(emitFileName, emitFilePath, message) {
+ function createEmitBlockingDiagnostics(emitFileName, message) {
hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true);
programDiagnostics.add(ts.createCompilerDiagnostic(message, emitFileName));
}
@@ -48874,15299 +49073,17615 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- var ScriptSnapshot;
- (function (ScriptSnapshot) {
- var StringScriptSnapshot = (function () {
- function StringScriptSnapshot(text) {
- this.text = text;
+ ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" };
+ ts.optionDeclarations = [
+ {
+ name: "charset",
+ type: "string",
+ },
+ ts.compileOnSaveCommandLineOption,
+ {
+ name: "declaration",
+ shortName: "d",
+ type: "boolean",
+ description: ts.Diagnostics.Generates_corresponding_d_ts_file,
+ },
+ {
+ name: "declarationDir",
+ type: "string",
+ isFilePath: true,
+ paramType: ts.Diagnostics.DIRECTORY,
+ },
+ {
+ name: "diagnostics",
+ type: "boolean",
+ },
+ {
+ name: "extendedDiagnostics",
+ type: "boolean",
+ experimental: true
+ },
+ {
+ name: "emitBOM",
+ type: "boolean"
+ },
+ {
+ name: "help",
+ shortName: "h",
+ type: "boolean",
+ description: ts.Diagnostics.Print_this_message,
+ },
+ {
+ name: "help",
+ shortName: "?",
+ type: "boolean"
+ },
+ {
+ name: "init",
+ type: "boolean",
+ description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file,
+ },
+ {
+ name: "inlineSourceMap",
+ type: "boolean",
+ },
+ {
+ name: "inlineSources",
+ type: "boolean",
+ },
+ {
+ name: "jsx",
+ type: ts.createMap({
+ "preserve": 1,
+ "react": 2
+ }),
+ paramType: ts.Diagnostics.KIND,
+ description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react,
+ },
+ {
+ name: "reactNamespace",
+ type: "string",
+ description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit
+ },
+ {
+ name: "listFiles",
+ type: "boolean",
+ },
+ {
+ name: "locale",
+ type: "string",
+ },
+ {
+ name: "mapRoot",
+ type: "string",
+ isFilePath: true,
+ description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
+ paramType: ts.Diagnostics.LOCATION,
+ },
+ {
+ name: "module",
+ shortName: "m",
+ type: ts.createMap({
+ "none": ts.ModuleKind.None,
+ "commonjs": ts.ModuleKind.CommonJS,
+ "amd": ts.ModuleKind.AMD,
+ "system": ts.ModuleKind.System,
+ "umd": ts.ModuleKind.UMD,
+ "es6": ts.ModuleKind.ES2015,
+ "es2015": ts.ModuleKind.ES2015,
+ }),
+ description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015,
+ paramType: ts.Diagnostics.KIND,
+ },
+ {
+ name: "newLine",
+ type: ts.createMap({
+ "crlf": 0,
+ "lf": 1
+ }),
+ description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
+ paramType: ts.Diagnostics.NEWLINE,
+ },
+ {
+ name: "noEmit",
+ type: "boolean",
+ description: ts.Diagnostics.Do_not_emit_outputs,
+ },
+ {
+ name: "noEmitHelpers",
+ type: "boolean"
+ },
+ {
+ name: "noEmitOnError",
+ type: "boolean",
+ description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
+ },
+ {
+ name: "noErrorTruncation",
+ type: "boolean"
+ },
+ {
+ name: "noImplicitAny",
+ type: "boolean",
+ description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type,
+ },
+ {
+ name: "noImplicitThis",
+ type: "boolean",
+ description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type,
+ },
+ {
+ name: "noUnusedLocals",
+ type: "boolean",
+ description: ts.Diagnostics.Report_errors_on_unused_locals,
+ },
+ {
+ name: "noUnusedParameters",
+ type: "boolean",
+ description: ts.Diagnostics.Report_errors_on_unused_parameters,
+ },
+ {
+ name: "noLib",
+ type: "boolean",
+ },
+ {
+ name: "noResolve",
+ type: "boolean",
+ },
+ {
+ name: "skipDefaultLibCheck",
+ type: "boolean",
+ },
+ {
+ name: "skipLibCheck",
+ type: "boolean",
+ description: ts.Diagnostics.Skip_type_checking_of_declaration_files,
+ },
+ {
+ name: "out",
+ type: "string",
+ isFilePath: false,
+ paramType: ts.Diagnostics.FILE,
+ },
+ {
+ name: "outFile",
+ type: "string",
+ isFilePath: true,
+ description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,
+ paramType: ts.Diagnostics.FILE,
+ },
+ {
+ name: "outDir",
+ type: "string",
+ isFilePath: true,
+ description: ts.Diagnostics.Redirect_output_structure_to_the_directory,
+ paramType: ts.Diagnostics.DIRECTORY,
+ },
+ {
+ name: "preserveConstEnums",
+ type: "boolean",
+ description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
+ },
+ {
+ name: "pretty",
+ description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental,
+ type: "boolean"
+ },
+ {
+ name: "project",
+ shortName: "p",
+ type: "string",
+ isFilePath: true,
+ description: ts.Diagnostics.Compile_the_project_in_the_given_directory,
+ paramType: ts.Diagnostics.DIRECTORY
+ },
+ {
+ name: "removeComments",
+ type: "boolean",
+ description: ts.Diagnostics.Do_not_emit_comments_to_output,
+ },
+ {
+ name: "rootDir",
+ type: "string",
+ isFilePath: true,
+ paramType: ts.Diagnostics.LOCATION,
+ description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir,
+ },
+ {
+ name: "isolatedModules",
+ type: "boolean",
+ },
+ {
+ name: "sourceMap",
+ type: "boolean",
+ description: ts.Diagnostics.Generates_corresponding_map_file,
+ },
+ {
+ name: "sourceRoot",
+ type: "string",
+ isFilePath: true,
+ description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
+ paramType: ts.Diagnostics.LOCATION,
+ },
+ {
+ name: "suppressExcessPropertyErrors",
+ type: "boolean",
+ description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals,
+ experimental: true
+ },
+ {
+ name: "suppressImplicitAnyIndexErrors",
+ type: "boolean",
+ description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures,
+ },
+ {
+ name: "stripInternal",
+ type: "boolean",
+ description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,
+ experimental: true
+ },
+ {
+ name: "target",
+ shortName: "t",
+ type: ts.createMap({
+ "es3": 0,
+ "es5": 1,
+ "es6": 2,
+ "es2015": 2,
+ "es2016": 3,
+ "es2017": 4,
+ }),
+ description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015,
+ paramType: ts.Diagnostics.VERSION,
+ },
+ {
+ name: "version",
+ shortName: "v",
+ type: "boolean",
+ description: ts.Diagnostics.Print_the_compiler_s_version,
+ },
+ {
+ name: "watch",
+ shortName: "w",
+ type: "boolean",
+ description: ts.Diagnostics.Watch_input_files,
+ },
+ {
+ name: "experimentalDecorators",
+ type: "boolean",
+ description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators
+ },
+ {
+ name: "emitDecoratorMetadata",
+ type: "boolean",
+ experimental: true,
+ description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
+ },
+ {
+ name: "moduleResolution",
+ type: ts.createMap({
+ "node": ts.ModuleResolutionKind.NodeJs,
+ "classic": ts.ModuleResolutionKind.Classic,
+ }),
+ description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,
+ paramType: ts.Diagnostics.STRATEGY,
+ },
+ {
+ name: "allowUnusedLabels",
+ type: "boolean",
+ description: ts.Diagnostics.Do_not_report_errors_on_unused_labels
+ },
+ {
+ name: "noImplicitReturns",
+ type: "boolean",
+ description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value
+ },
+ {
+ name: "noFallthroughCasesInSwitch",
+ type: "boolean",
+ description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement
+ },
+ {
+ name: "allowUnreachableCode",
+ type: "boolean",
+ description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code
+ },
+ {
+ name: "forceConsistentCasingInFileNames",
+ type: "boolean",
+ description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file
+ },
+ {
+ name: "baseUrl",
+ type: "string",
+ isFilePath: true,
+ description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names
+ },
+ {
+ name: "paths",
+ type: "object",
+ isTSConfigOnly: true
+ },
+ {
+ name: "rootDirs",
+ type: "list",
+ isTSConfigOnly: true,
+ element: {
+ name: "rootDirs",
+ type: "string",
+ isFilePath: true
}
- StringScriptSnapshot.prototype.getText = function (start, end) {
- return this.text.substring(start, end);
- };
- StringScriptSnapshot.prototype.getLength = function () {
- return this.text.length;
- };
- StringScriptSnapshot.prototype.getChangeRange = function (oldSnapshot) {
- return undefined;
- };
- return StringScriptSnapshot;
- }());
- function fromString(text) {
- return new StringScriptSnapshot(text);
+ },
+ {
+ name: "typeRoots",
+ type: "list",
+ element: {
+ name: "typeRoots",
+ type: "string",
+ isFilePath: true
+ }
+ },
+ {
+ name: "types",
+ type: "list",
+ element: {
+ name: "types",
+ type: "string"
+ },
+ description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation
+ },
+ {
+ name: "traceResolution",
+ type: "boolean",
+ description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process
+ },
+ {
+ name: "allowJs",
+ type: "boolean",
+ description: ts.Diagnostics.Allow_javascript_files_to_be_compiled
+ },
+ {
+ name: "allowSyntheticDefaultImports",
+ type: "boolean",
+ description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking
+ },
+ {
+ name: "noImplicitUseStrict",
+ type: "boolean",
+ description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output
+ },
+ {
+ name: "maxNodeModuleJsDepth",
+ type: "number",
+ description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files
+ },
+ {
+ name: "listEmittedFiles",
+ type: "boolean"
+ },
+ {
+ name: "lib",
+ type: "list",
+ element: {
+ name: "lib",
+ type: ts.createMap({
+ "es5": "lib.es5.d.ts",
+ "es6": "lib.es2015.d.ts",
+ "es2015": "lib.es2015.d.ts",
+ "es7": "lib.es2016.d.ts",
+ "es2016": "lib.es2016.d.ts",
+ "es2017": "lib.es2017.d.ts",
+ "dom": "lib.dom.d.ts",
+ "dom.iterable": "lib.dom.iterable.d.ts",
+ "webworker": "lib.webworker.d.ts",
+ "scripthost": "lib.scripthost.d.ts",
+ "es2015.core": "lib.es2015.core.d.ts",
+ "es2015.collection": "lib.es2015.collection.d.ts",
+ "es2015.generator": "lib.es2015.generator.d.ts",
+ "es2015.iterable": "lib.es2015.iterable.d.ts",
+ "es2015.promise": "lib.es2015.promise.d.ts",
+ "es2015.proxy": "lib.es2015.proxy.d.ts",
+ "es2015.reflect": "lib.es2015.reflect.d.ts",
+ "es2015.symbol": "lib.es2015.symbol.d.ts",
+ "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts",
+ "es2016.array.include": "lib.es2016.array.include.d.ts",
+ "es2017.object": "lib.es2017.object.d.ts",
+ "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts"
+ }),
+ },
+ description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon
+ },
+ {
+ name: "disableSizeLimit",
+ type: "boolean"
+ },
+ {
+ name: "strictNullChecks",
+ type: "boolean",
+ description: ts.Diagnostics.Enable_strict_null_checks
+ },
+ {
+ name: "importHelpers",
+ type: "boolean",
+ description: ts.Diagnostics.Import_emit_helpers_from_tslib
+ },
+ {
+ name: "alwaysStrict",
+ type: "boolean",
+ description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file
}
- ScriptSnapshot.fromString = fromString;
- })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {}));
- var TextChange = (function () {
- function TextChange() {
+ ];
+ ts.typingOptionDeclarations = [
+ {
+ name: "enableAutoDiscovery",
+ type: "boolean",
+ },
+ {
+ name: "include",
+ type: "list",
+ element: {
+ name: "include",
+ type: "string"
+ }
+ },
+ {
+ name: "exclude",
+ type: "list",
+ element: {
+ name: "exclude",
+ type: "string"
+ }
}
- return TextChange;
- }());
- ts.TextChange = TextChange;
- var HighlightSpanKind;
- (function (HighlightSpanKind) {
- HighlightSpanKind.none = "none";
- HighlightSpanKind.definition = "definition";
- HighlightSpanKind.reference = "reference";
- HighlightSpanKind.writtenReference = "writtenReference";
- })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {}));
- (function (IndentStyle) {
- IndentStyle[IndentStyle["None"] = 0] = "None";
- IndentStyle[IndentStyle["Block"] = 1] = "Block";
- IndentStyle[IndentStyle["Smart"] = 2] = "Smart";
- })(ts.IndentStyle || (ts.IndentStyle = {}));
- var IndentStyle = ts.IndentStyle;
- (function (SymbolDisplayPartKind) {
- SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className";
- SymbolDisplayPartKind[SymbolDisplayPartKind["enumName"] = 2] = "enumName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["fieldName"] = 3] = "fieldName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["interfaceName"] = 4] = "interfaceName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["keyword"] = 5] = "keyword";
- SymbolDisplayPartKind[SymbolDisplayPartKind["lineBreak"] = 6] = "lineBreak";
- SymbolDisplayPartKind[SymbolDisplayPartKind["numericLiteral"] = 7] = "numericLiteral";
- SymbolDisplayPartKind[SymbolDisplayPartKind["stringLiteral"] = 8] = "stringLiteral";
- SymbolDisplayPartKind[SymbolDisplayPartKind["localName"] = 9] = "localName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["methodName"] = 10] = "methodName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["moduleName"] = 11] = "moduleName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["operator"] = 12] = "operator";
- SymbolDisplayPartKind[SymbolDisplayPartKind["parameterName"] = 13] = "parameterName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["propertyName"] = 14] = "propertyName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["punctuation"] = 15] = "punctuation";
- SymbolDisplayPartKind[SymbolDisplayPartKind["space"] = 16] = "space";
- SymbolDisplayPartKind[SymbolDisplayPartKind["text"] = 17] = "text";
- SymbolDisplayPartKind[SymbolDisplayPartKind["typeParameterName"] = 18] = "typeParameterName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["enumMemberName"] = 19] = "enumMemberName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["functionName"] = 20] = "functionName";
- SymbolDisplayPartKind[SymbolDisplayPartKind["regularExpressionLiteral"] = 21] = "regularExpressionLiteral";
- })(ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {}));
- var SymbolDisplayPartKind = ts.SymbolDisplayPartKind;
- (function (TokenClass) {
- TokenClass[TokenClass["Punctuation"] = 0] = "Punctuation";
- TokenClass[TokenClass["Keyword"] = 1] = "Keyword";
- TokenClass[TokenClass["Operator"] = 2] = "Operator";
- TokenClass[TokenClass["Comment"] = 3] = "Comment";
- TokenClass[TokenClass["Whitespace"] = 4] = "Whitespace";
- TokenClass[TokenClass["Identifier"] = 5] = "Identifier";
- TokenClass[TokenClass["NumberLiteral"] = 6] = "NumberLiteral";
- TokenClass[TokenClass["StringLiteral"] = 7] = "StringLiteral";
- TokenClass[TokenClass["RegExpLiteral"] = 8] = "RegExpLiteral";
- })(ts.TokenClass || (ts.TokenClass = {}));
- var TokenClass = ts.TokenClass;
- var ScriptElementKind;
- (function (ScriptElementKind) {
- ScriptElementKind.unknown = "";
- ScriptElementKind.warning = "warning";
- ScriptElementKind.keyword = "keyword";
- ScriptElementKind.scriptElement = "script";
- ScriptElementKind.moduleElement = "module";
- ScriptElementKind.classElement = "class";
- ScriptElementKind.localClassElement = "local class";
- ScriptElementKind.interfaceElement = "interface";
- ScriptElementKind.typeElement = "type";
- ScriptElementKind.enumElement = "enum";
- ScriptElementKind.enumMemberElement = "const";
- ScriptElementKind.variableElement = "var";
- ScriptElementKind.localVariableElement = "local var";
- ScriptElementKind.functionElement = "function";
- ScriptElementKind.localFunctionElement = "local function";
- ScriptElementKind.memberFunctionElement = "method";
- ScriptElementKind.memberGetAccessorElement = "getter";
- ScriptElementKind.memberSetAccessorElement = "setter";
- ScriptElementKind.memberVariableElement = "property";
- ScriptElementKind.constructorImplementationElement = "constructor";
- ScriptElementKind.callSignatureElement = "call";
- ScriptElementKind.indexSignatureElement = "index";
- ScriptElementKind.constructSignatureElement = "construct";
- ScriptElementKind.parameterElement = "parameter";
- ScriptElementKind.typeParameterElement = "type parameter";
- ScriptElementKind.primitiveType = "primitive type";
- ScriptElementKind.label = "label";
- ScriptElementKind.alias = "alias";
- ScriptElementKind.constElement = "const";
- ScriptElementKind.letElement = "let";
- ScriptElementKind.directory = "directory";
- ScriptElementKind.externalModuleName = "external module name";
- })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {}));
- var ScriptElementKindModifier;
- (function (ScriptElementKindModifier) {
- ScriptElementKindModifier.none = "";
- ScriptElementKindModifier.publicMemberModifier = "public";
- ScriptElementKindModifier.privateMemberModifier = "private";
- ScriptElementKindModifier.protectedMemberModifier = "protected";
- ScriptElementKindModifier.exportedModifier = "export";
- ScriptElementKindModifier.ambientModifier = "declare";
- ScriptElementKindModifier.staticModifier = "static";
- ScriptElementKindModifier.abstractModifier = "abstract";
- })(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {}));
- var ClassificationTypeNames = (function () {
- function ClassificationTypeNames() {
- }
- return ClassificationTypeNames;
- }());
- ClassificationTypeNames.comment = "comment";
- ClassificationTypeNames.identifier = "identifier";
- ClassificationTypeNames.keyword = "keyword";
- ClassificationTypeNames.numericLiteral = "number";
- ClassificationTypeNames.operator = "operator";
- ClassificationTypeNames.stringLiteral = "string";
- ClassificationTypeNames.whiteSpace = "whitespace";
- ClassificationTypeNames.text = "text";
- ClassificationTypeNames.punctuation = "punctuation";
- ClassificationTypeNames.className = "class name";
- ClassificationTypeNames.enumName = "enum name";
- ClassificationTypeNames.interfaceName = "interface name";
- ClassificationTypeNames.moduleName = "module name";
- ClassificationTypeNames.typeParameterName = "type parameter name";
- ClassificationTypeNames.typeAliasName = "type alias name";
- ClassificationTypeNames.parameterName = "parameter name";
- ClassificationTypeNames.docCommentTagName = "doc comment tag name";
- ClassificationTypeNames.jsxOpenTagName = "jsx open tag name";
- ClassificationTypeNames.jsxCloseTagName = "jsx close tag name";
- ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name";
- ClassificationTypeNames.jsxAttribute = "jsx attribute";
- ClassificationTypeNames.jsxText = "jsx text";
- ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value";
- ts.ClassificationTypeNames = ClassificationTypeNames;
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- ts.scanner = ts.createScanner(2, true);
- ts.emptyArray = [];
- function getMeaningFromDeclaration(node) {
- switch (node.kind) {
- case 142:
- case 218:
- case 169:
- case 145:
- case 144:
- case 253:
- case 254:
- case 255:
- case 147:
- case 146:
- case 148:
- case 149:
- case 150:
- case 220:
- case 179:
- case 180:
- case 252:
- return 1;
- case 141:
- case 222:
- case 223:
- case 159:
- return 2;
- case 221:
- case 224:
- return 1 | 2;
- case 225:
- if (ts.isAmbientModule(node)) {
- return 4 | 1;
- }
- else if (ts.getModuleInstanceState(node) === 1) {
- return 4 | 1;
- }
- else {
- return 4;
- }
- case 233:
- case 234:
- case 229:
- case 230:
- case 235:
- case 236:
- return 1 | 2 | 4;
- case 256:
- return 4 | 1;
+ ];
+ ts.defaultInitCompilerOptions = {
+ module: ts.ModuleKind.CommonJS,
+ target: 1,
+ noImplicitAny: false,
+ sourceMap: false,
+ };
+ var optionNameMapCache;
+ function getOptionNameMap() {
+ if (optionNameMapCache) {
+ return optionNameMapCache;
}
- return 1 | 2 | 4;
+ var optionNameMap = ts.createMap();
+ var shortOptionNames = ts.createMap();
+ ts.forEach(ts.optionDeclarations, function (option) {
+ optionNameMap[option.name.toLowerCase()] = option;
+ if (option.shortName) {
+ shortOptionNames[option.shortName] = option.name;
+ }
+ });
+ optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames };
+ return optionNameMapCache;
}
- ts.getMeaningFromDeclaration = getMeaningFromDeclaration;
- function getMeaningFromLocation(node) {
- if (node.parent.kind === 235) {
- return 1 | 2 | 4;
- }
- else if (isInRightSideOfImport(node)) {
- return getMeaningFromRightHandSideOfImportEquals(node);
- }
- else if (ts.isDeclarationName(node)) {
- return getMeaningFromDeclaration(node.parent);
- }
- else if (isTypeReference(node)) {
- return 2;
- }
- else if (isNamespaceReference(node)) {
- return 4;
+ ts.getOptionNameMap = getOptionNameMap;
+ function createCompilerDiagnosticForInvalidCustomType(opt) {
+ var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", ");
+ return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType);
+ }
+ ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType;
+ function parseCustomTypeOption(opt, value, errors) {
+ var key = trimString((value || "")).toLowerCase();
+ var map = opt.type;
+ if (key in map) {
+ return map[key];
}
else {
- return 1;
+ errors.push(createCompilerDiagnosticForInvalidCustomType(opt));
}
}
- ts.getMeaningFromLocation = getMeaningFromLocation;
- function getMeaningFromRightHandSideOfImportEquals(node) {
- ts.Debug.assert(node.kind === 69);
- if (node.parent.kind === 139 &&
- node.parent.right === node &&
- node.parent.parent.kind === 229) {
- return 1 | 2 | 4;
+ ts.parseCustomTypeOption = parseCustomTypeOption;
+ function parseListTypeOption(opt, value, errors) {
+ if (value === void 0) { value = ""; }
+ value = trimString(value);
+ if (ts.startsWith(value, "-")) {
+ return undefined;
}
- return 4;
- }
- function isInRightSideOfImport(node) {
- while (node.parent.kind === 139) {
- node = node.parent;
+ if (value === "") {
+ return [];
}
- return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node;
- }
- function isNamespaceReference(node) {
- return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node);
- }
- function isQualifiedNameNamespaceReference(node) {
- var root = node;
- var isLastClause = true;
- if (root.parent.kind === 139) {
- while (root.parent && root.parent.kind === 139) {
- root = root.parent;
- }
- isLastClause = root.right === node;
+ var values = value.split(",");
+ switch (opt.element.type) {
+ case "number":
+ return ts.map(values, parseInt);
+ case "string":
+ return ts.map(values, function (v) { return v || ""; });
+ default:
+ return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; });
}
- return root.parent.kind === 155 && !isLastClause;
}
- function isPropertyAccessNamespaceReference(node) {
- var root = node;
- var isLastClause = true;
- if (root.parent.kind === 172) {
- while (root.parent && root.parent.kind === 172) {
- root = root.parent;
+ ts.parseListTypeOption = parseListTypeOption;
+ function parseCommandLine(commandLine, readFile) {
+ var options = {};
+ var fileNames = [];
+ var errors = [];
+ var _a = getOptionNameMap(), optionNameMap = _a.optionNameMap, shortOptionNames = _a.shortOptionNames;
+ parseStrings(commandLine);
+ return {
+ options: options,
+ fileNames: fileNames,
+ errors: errors
+ };
+ function parseStrings(args) {
+ var i = 0;
+ while (i < args.length) {
+ var s = args[i];
+ i++;
+ if (s.charCodeAt(0) === 64) {
+ parseResponseFile(s.slice(1));
+ }
+ else if (s.charCodeAt(0) === 45) {
+ s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase();
+ if (s in shortOptionNames) {
+ s = shortOptionNames[s];
+ }
+ if (s in optionNameMap) {
+ var opt = optionNameMap[s];
+ if (opt.isTSConfigOnly) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name));
+ }
+ else {
+ if (!args[i] && opt.type !== "boolean") {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name));
+ }
+ switch (opt.type) {
+ case "number":
+ options[opt.name] = parseInt(args[i]);
+ i++;
+ break;
+ case "boolean":
+ options[opt.name] = true;
+ break;
+ case "string":
+ options[opt.name] = args[i] || "";
+ i++;
+ break;
+ case "list":
+ var result = parseListTypeOption(opt, args[i], errors);
+ options[opt.name] = result || [];
+ if (result) {
+ i++;
+ }
+ break;
+ default:
+ options[opt.name] = parseCustomTypeOption(opt, args[i], errors);
+ i++;
+ break;
+ }
+ }
+ }
+ else {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s));
+ }
+ }
+ else {
+ fileNames.push(s);
+ }
}
- isLastClause = root.name === node;
}
- if (!isLastClause && root.parent.kind === 194 && root.parent.parent.kind === 251) {
- var decl = root.parent.parent.parent;
- return (decl.kind === 221 && root.parent.parent.token === 106) ||
- (decl.kind === 222 && root.parent.parent.token === 83);
+ function parseResponseFile(fileName) {
+ var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName);
+ if (!text) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName));
+ return;
+ }
+ var args = [];
+ var pos = 0;
+ while (true) {
+ while (pos < text.length && text.charCodeAt(pos) <= 32)
+ pos++;
+ if (pos >= text.length)
+ break;
+ var start = pos;
+ if (text.charCodeAt(start) === 34) {
+ pos++;
+ while (pos < text.length && text.charCodeAt(pos) !== 34)
+ pos++;
+ if (pos < text.length) {
+ args.push(text.substring(start + 1, pos));
+ pos++;
+ }
+ else {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName));
+ }
+ }
+ else {
+ while (text.charCodeAt(pos) > 32)
+ pos++;
+ args.push(text.substring(start, pos));
+ }
+ }
+ parseStrings(args);
}
- return false;
}
- function isTypeReference(node) {
- if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) {
- node = node.parent;
+ ts.parseCommandLine = parseCommandLine;
+ function readConfigFile(fileName, readFile) {
+ var text = "";
+ try {
+ text = readFile(fileName);
}
- return node.parent.kind === 155 ||
- (node.parent.kind === 194 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) ||
- (node.kind === 97 && !ts.isPartOfExpression(node)) ||
- node.kind === 165;
- }
- function isCallExpressionTarget(node) {
- return isCallOrNewExpressionTarget(node, 174);
- }
- ts.isCallExpressionTarget = isCallExpressionTarget;
- function isNewExpressionTarget(node) {
- return isCallOrNewExpressionTarget(node, 175);
- }
- ts.isNewExpressionTarget = isNewExpressionTarget;
- function isCallOrNewExpressionTarget(node, kind) {
- var target = climbPastPropertyAccess(node);
- return target && target.parent && target.parent.kind === kind && target.parent.expression === target;
- }
- function climbPastPropertyAccess(node) {
- return isRightSideOfPropertyAccess(node) ? node.parent : node;
- }
- ts.climbPastPropertyAccess = climbPastPropertyAccess;
- function getTargetLabel(referenceNode, labelName) {
- while (referenceNode) {
- if (referenceNode.kind === 214 && referenceNode.label.text === labelName) {
- return referenceNode.label;
- }
- referenceNode = referenceNode.parent;
+ catch (e) {
+ return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };
}
- return undefined;
- }
- ts.getTargetLabel = getTargetLabel;
- function isJumpStatementTarget(node) {
- return node.kind === 69 &&
- (node.parent.kind === 210 || node.parent.kind === 209) &&
- node.parent.label === node;
- }
- ts.isJumpStatementTarget = isJumpStatementTarget;
- function isLabelOfLabeledStatement(node) {
- return node.kind === 69 &&
- node.parent.kind === 214 &&
- node.parent.label === node;
- }
- function isLabelName(node) {
- return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node);
- }
- ts.isLabelName = isLabelName;
- function isRightSideOfQualifiedName(node) {
- return node.parent.kind === 139 && node.parent.right === node;
- }
- ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName;
- function isRightSideOfPropertyAccess(node) {
- return node && node.parent && node.parent.kind === 172 && node.parent.name === node;
- }
- ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess;
- function isNameOfModuleDeclaration(node) {
- return node.parent.kind === 225 && node.parent.name === node;
+ return parseConfigFileTextToJson(fileName, text);
}
- ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration;
- function isNameOfFunctionDeclaration(node) {
- return node.kind === 69 &&
- ts.isFunctionLike(node.parent) && node.parent.name === node;
+ ts.readConfigFile = readConfigFile;
+ function parseConfigFileTextToJson(fileName, jsonText, stripComments) {
+ if (stripComments === void 0) { stripComments = true; }
+ try {
+ var jsonTextToParse = stripComments ? removeComments(jsonText) : jsonText;
+ return { config: /\S/.test(jsonTextToParse) ? JSON.parse(jsonTextToParse) : {} };
+ }
+ catch (e) {
+ return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) };
+ }
}
- ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration;
- function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) {
- if (node.kind === 9 || node.kind === 8) {
- switch (node.parent.kind) {
- case 145:
- case 144:
- case 253:
- case 255:
- case 147:
- case 146:
- case 149:
- case 150:
- case 225:
- return node.parent.name === node;
- case 173:
- return node.parent.argumentExpression === node;
- case 140:
- return true;
+ ts.parseConfigFileTextToJson = parseConfigFileTextToJson;
+ function generateTSConfig(options, fileNames) {
+ var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions);
+ var configurations = {
+ compilerOptions: serializeCompilerOptions(compilerOptions)
+ };
+ if (fileNames && fileNames.length) {
+ configurations.files = fileNames;
+ }
+ return configurations;
+ function getCustomTypeMapOfCommandLineOption(optionDefinition) {
+ if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") {
+ return undefined;
+ }
+ else if (optionDefinition.type === "list") {
+ return getCustomTypeMapOfCommandLineOption(optionDefinition.element);
+ }
+ else {
+ return optionDefinition.type;
}
}
- return false;
- }
- ts.isLiteralNameOfPropertyDeclarationOrIndexAccess = isLiteralNameOfPropertyDeclarationOrIndexAccess;
- function isExpressionOfExternalModuleImportEqualsDeclaration(node) {
- return ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) &&
- ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node;
- }
- ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration;
- function isInsideComment(sourceFile, token, position) {
- return position <= token.getStart(sourceFile) &&
- (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) ||
- isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart())));
- function isInsideCommentRange(comments) {
- return ts.forEach(comments, function (comment) {
- if (comment.pos < position && position < comment.end) {
- return true;
+ function getNameOfCompilerOptionValue(value, customTypeMap) {
+ for (var key in customTypeMap) {
+ if (customTypeMap[key] === value) {
+ return key;
}
- else if (position === comment.end) {
- var text = sourceFile.text;
- var width = comment.end - comment.pos;
- if (width <= 2 || text.charCodeAt(comment.pos + 1) === 47) {
- return true;
- }
- else {
- return !(text.charCodeAt(comment.end - 1) === 47 &&
- text.charCodeAt(comment.end - 2) === 42);
+ }
+ return undefined;
+ }
+ function serializeCompilerOptions(options) {
+ var result = ts.createMap();
+ var optionsNameMap = getOptionNameMap().optionNameMap;
+ for (var name_44 in options) {
+ if (ts.hasProperty(options, name_44)) {
+ switch (name_44) {
+ case "init":
+ case "watch":
+ case "version":
+ case "help":
+ case "project":
+ break;
+ default:
+ var value = options[name_44];
+ var optionDefinition = optionsNameMap[name_44.toLowerCase()];
+ if (optionDefinition) {
+ var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);
+ if (!customTypeMap) {
+ result[name_44] = value;
+ }
+ else {
+ if (optionDefinition.type === "list") {
+ var convertedValue = [];
+ for (var _i = 0, _a = value; _i < _a.length; _i++) {
+ var element = _a[_i];
+ convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap));
+ }
+ result[name_44] = convertedValue;
+ }
+ else {
+ result[name_44] = getNameOfCompilerOptionValue(value, customTypeMap);
+ }
+ }
+ }
+ break;
}
}
- return false;
- });
+ }
+ return result;
}
}
- ts.isInsideComment = isInsideComment;
- function getContainerNode(node) {
- while (true) {
- node = node.parent;
- if (!node) {
- return undefined;
- }
- switch (node.kind) {
- case 256:
- case 147:
- case 146:
- case 220:
- case 179:
- case 149:
- case 150:
- case 221:
- case 222:
- case 224:
- case 225:
- return node;
+ ts.generateTSConfig = generateTSConfig;
+ function removeComments(jsonText) {
+ var output = "";
+ var scanner = ts.createScanner(1, false, 0, jsonText);
+ var token;
+ while ((token = scanner.scan()) !== 1) {
+ switch (token) {
+ case 2:
+ case 3:
+ output += scanner.getTokenText().replace(/\S/g, " ");
+ break;
+ default:
+ output += scanner.getTokenText();
+ break;
}
}
+ return output;
}
- ts.getContainerNode = getContainerNode;
- function getNodeKind(node) {
- switch (node.kind) {
- case 256:
- return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement;
- case 225:
- return ts.ScriptElementKind.moduleElement;
- case 221:
- case 192:
- return ts.ScriptElementKind.classElement;
- case 222: return ts.ScriptElementKind.interfaceElement;
- case 223: return ts.ScriptElementKind.typeElement;
- case 224: return ts.ScriptElementKind.enumElement;
- case 218:
- return getKindOfVariableDeclaration(node);
- case 169:
- return getKindOfVariableDeclaration(ts.getRootDeclaration(node));
- case 180:
- case 220:
- case 179:
- return ts.ScriptElementKind.functionElement;
- case 149: return ts.ScriptElementKind.memberGetAccessorElement;
- case 150: return ts.ScriptElementKind.memberSetAccessorElement;
- case 147:
- case 146:
- return ts.ScriptElementKind.memberFunctionElement;
- case 145:
- case 144:
- return ts.ScriptElementKind.memberVariableElement;
- case 153: return ts.ScriptElementKind.indexSignatureElement;
- case 152: return ts.ScriptElementKind.constructSignatureElement;
- case 151: return ts.ScriptElementKind.callSignatureElement;
- case 148: return ts.ScriptElementKind.constructorImplementationElement;
- case 141: return ts.ScriptElementKind.typeParameterElement;
- case 255: return ts.ScriptElementKind.enumMemberElement;
- case 142: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement;
- case 229:
- case 234:
- case 231:
- case 238:
- case 232:
- return ts.ScriptElementKind.alias;
- case 279:
- return ts.ScriptElementKind.typeElement;
- default:
- return ts.ScriptElementKind.unknown;
- }
- function getKindOfVariableDeclaration(v) {
- return ts.isConst(v)
- ? ts.ScriptElementKind.constElement
- : ts.isLet(v)
- ? ts.ScriptElementKind.letElement
- : ts.ScriptElementKind.variableElement;
- }
- }
- ts.getNodeKind = getNodeKind;
- function getStringLiteralTypeForNode(node, typeChecker) {
- var searchNode = node.parent.kind === 166 ? node.parent : node;
- var type = typeChecker.getTypeAtLocation(searchNode);
- if (type && type.flags & 32) {
- return type;
+ function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) {
+ if (existingOptions === void 0) { existingOptions = {}; }
+ if (resolutionStack === void 0) { resolutionStack = []; }
+ var errors = [];
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
+ var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName);
+ if (resolutionStack.indexOf(resolvedPath) >= 0) {
+ return {
+ options: {},
+ fileNames: [],
+ typingOptions: {},
+ raw: json,
+ errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))],
+ wildcardDirectories: {}
+ };
}
- return undefined;
- }
- ts.getStringLiteralTypeForNode = getStringLiteralTypeForNode;
- function isThis(node) {
- switch (node.kind) {
- case 97:
- return true;
- case 69:
- return ts.identifierIsThisKeyword(node) && node.parent.kind === 142;
- default:
- return false;
+ var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
+ var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
+ if (json["extends"]) {
+ var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];
+ if (typeof json["extends"] === "string") {
+ _b = (tryExtendsName(json["extends"]) || [include, exclude, files, baseOptions]), include = _b[0], exclude = _b[1], files = _b[2], baseOptions = _b[3];
+ }
+ else {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string"));
+ }
+ if (include && !json["include"]) {
+ json["include"] = include;
+ }
+ if (exclude && !json["exclude"]) {
+ json["exclude"] = exclude;
+ }
+ if (files && !json["files"]) {
+ json["files"] = files;
+ }
+ options = ts.assign({}, baseOptions, options);
}
- }
- ts.isThis = isThis;
- var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*;
- function getLineStartPositionForPosition(position, sourceFile) {
- var lineStarts = sourceFile.getLineStarts();
- var line = sourceFile.getLineAndCharacterOfPosition(position).line;
- return lineStarts[line];
- }
- ts.getLineStartPositionForPosition = getLineStartPositionForPosition;
- function rangeContainsRange(r1, r2) {
- return startEndContainsRange(r1.pos, r1.end, r2);
- }
- ts.rangeContainsRange = rangeContainsRange;
- function startEndContainsRange(start, end, range) {
- return start <= range.pos && end >= range.end;
- }
- ts.startEndContainsRange = startEndContainsRange;
- function rangeContainsStartEnd(range, start, end) {
- return range.pos <= start && range.end >= end;
- }
- ts.rangeContainsStartEnd = rangeContainsStartEnd;
- function rangeOverlapsWithStartEnd(r1, start, end) {
- return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end);
- }
- ts.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd;
- function startEndOverlapsWithStartEnd(start1, end1, start2, end2) {
- var start = Math.max(start1, start2);
- var end = Math.min(end1, end2);
- return start < end;
- }
- ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd;
- function positionBelongsToNode(candidate, position, sourceFile) {
- return candidate.end > position || !isCompletedNode(candidate, sourceFile);
- }
- ts.positionBelongsToNode = positionBelongsToNode;
- function isCompletedNode(n, sourceFile) {
- if (ts.nodeIsMissing(n)) {
- return false;
+ options = ts.extend(existingOptions, options);
+ options.configFilePath = configFileName;
+ var _c = getFileNames(errors), fileNames = _c.fileNames, wildcardDirectories = _c.wildcardDirectories;
+ var compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
+ return {
+ options: options,
+ fileNames: fileNames,
+ typingOptions: typingOptions,
+ raw: json,
+ errors: errors,
+ wildcardDirectories: wildcardDirectories,
+ compileOnSave: compileOnSave
+ };
+ function tryExtendsName(extendedConfig) {
+ if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted));
+ return;
+ }
+ var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);
+ if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json")) {
+ extendedConfigPath = extendedConfigPath + ".json";
+ if (!host.fileExists(extendedConfigPath)) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ return;
+ }
+ }
+ var extendedResult = readConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
+ if (extendedResult.error) {
+ errors.push(extendedResult.error);
+ return;
+ }
+ var extendedDirname = ts.getDirectoryPath(extendedConfigPath);
+ var relativeDifference = ts.convertToRelativePath(extendedDirname, basePath, getCanonicalFileName);
+ var updatePath = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference, path); };
+ var result = parseJsonConfigFileContent(extendedResult.config, host, extendedDirname, undefined, ts.getBaseFileName(extendedConfigPath), resolutionStack.concat([resolvedPath]));
+ errors.push.apply(errors, result.errors);
+ var _a = ts.map(["include", "exclude", "files"], function (key) {
+ if (!json[key] && extendedResult.config[key]) {
+ return ts.map(extendedResult.config[key], updatePath);
+ }
+ }), include = _a[0], exclude = _a[1], files = _a[2];
+ return [include, exclude, files, result.options];
}
- switch (n.kind) {
- case 221:
- case 222:
- case 224:
- case 171:
- case 167:
- case 159:
- case 199:
- case 226:
- case 227:
- case 233:
- case 237:
- return nodeEndsWith(n, 16, sourceFile);
- case 252:
- return isCompletedNode(n.block, sourceFile);
- case 175:
- if (!n.arguments) {
- return true;
+ function getFileNames(errors) {
+ var fileNames;
+ if (ts.hasProperty(json, "files")) {
+ if (ts.isArray(json["files"])) {
+ fileNames = json["files"];
}
- case 174:
- case 178:
- case 164:
- return nodeEndsWith(n, 18, sourceFile);
- case 156:
- case 157:
- return isCompletedNode(n.type, sourceFile);
- case 148:
- case 149:
- case 150:
- case 220:
- case 179:
- case 147:
- case 146:
- case 152:
- case 151:
- case 180:
- if (n.body) {
- return isCompletedNode(n.body, sourceFile);
+ else {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array"));
}
- if (n.type) {
- return isCompletedNode(n.type, sourceFile);
+ }
+ var includeSpecs;
+ if (ts.hasProperty(json, "include")) {
+ if (ts.isArray(json["include"])) {
+ includeSpecs = json["include"];
}
- return hasChildOfKind(n, 18, sourceFile);
- case 225:
- return n.body && isCompletedNode(n.body, sourceFile);
- case 203:
- if (n.elseStatement) {
- return isCompletedNode(n.elseStatement, sourceFile);
+ else {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "include", "Array"));
}
- return isCompletedNode(n.thenStatement, sourceFile);
- case 202:
- return isCompletedNode(n.expression, sourceFile) ||
- hasChildOfKind(n, 23);
- case 170:
- case 168:
- case 173:
- case 140:
- case 161:
- return nodeEndsWith(n, 20, sourceFile);
- case 153:
- if (n.type) {
- return isCompletedNode(n.type, sourceFile);
+ }
+ var excludeSpecs;
+ if (ts.hasProperty(json, "exclude")) {
+ if (ts.isArray(json["exclude"])) {
+ excludeSpecs = json["exclude"];
}
- return hasChildOfKind(n, 20, sourceFile);
- case 249:
- case 250:
- return false;
- case 206:
- case 207:
- case 208:
- case 205:
- return isCompletedNode(n.statement, sourceFile);
- case 204:
- var hasWhileKeyword = findChildOfKind(n, 104, sourceFile);
- if (hasWhileKeyword) {
- return nodeEndsWith(n, 18, sourceFile);
+ else {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "exclude", "Array"));
}
- return isCompletedNode(n.statement, sourceFile);
- case 158:
- return isCompletedNode(n.exprName, sourceFile);
- case 182:
- case 181:
- case 183:
- case 190:
- case 191:
- var unaryWordExpression = n;
- return isCompletedNode(unaryWordExpression.expression, sourceFile);
- case 176:
- return isCompletedNode(n.template, sourceFile);
- case 189:
- var lastSpan = ts.lastOrUndefined(n.templateSpans);
- return isCompletedNode(lastSpan, sourceFile);
- case 197:
- return ts.nodeIsPresent(n.literal);
- case 236:
- case 230:
- return ts.nodeIsPresent(n.moduleSpecifier);
- case 185:
- return isCompletedNode(n.operand, sourceFile);
- case 187:
- return isCompletedNode(n.right, sourceFile);
- case 188:
- return isCompletedNode(n.whenFalse, sourceFile);
- default:
- return true;
- }
- }
- ts.isCompletedNode = isCompletedNode;
- function nodeEndsWith(n, expectedLastToken, sourceFile) {
- var children = n.getChildren(sourceFile);
- if (children.length) {
- var last = ts.lastOrUndefined(children);
- if (last.kind === expectedLastToken) {
- return true;
}
- else if (last.kind === 23 && children.length !== 1) {
- return children[children.length - 2].kind === expectedLastToken;
+ else if (ts.hasProperty(json, "excludes")) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
+ }
+ else {
+ excludeSpecs = ["node_modules", "bower_components", "jspm_packages"];
+ var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
+ if (outDir) {
+ excludeSpecs.push(outDir);
+ }
+ }
+ if (fileNames === undefined && includeSpecs === undefined) {
+ includeSpecs = ["**/*"];
}
+ return matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors);
}
- return false;
+ var _b;
}
- function findListItemInfo(node) {
- var list = findContainingList(node);
- if (!list) {
- return undefined;
+ ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
+ function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {
+ if (!ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) {
+ return false;
}
- var children = list.getChildren();
- var listItemIndex = ts.indexOf(children, node);
- return {
- listItemIndex: listItemIndex,
- list: list
- };
- }
- ts.findListItemInfo = findListItemInfo;
- function hasChildOfKind(n, kind, sourceFile) {
- return !!findChildOfKind(n, kind, sourceFile);
- }
- ts.hasChildOfKind = hasChildOfKind;
- function findChildOfKind(n, kind, sourceFile) {
- return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; });
- }
- ts.findChildOfKind = findChildOfKind;
- function findContainingList(node) {
- var syntaxList = ts.forEach(node.parent.getChildren(), function (c) {
- if (c.kind === 286 && c.pos <= node.pos && c.end >= node.end) {
- return c;
- }
- });
- ts.Debug.assert(!syntaxList || ts.contains(syntaxList.getChildren(), node));
- return syntaxList;
+ var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption["compileOnSave"], basePath, errors);
+ if (typeof result === "boolean" && result) {
+ return result;
+ }
+ return false;
}
- ts.findContainingList = findContainingList;
- function getTouchingWord(sourceFile, position, includeJsDocComment) {
- if (includeJsDocComment === void 0) { includeJsDocComment = false; }
- return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }, includeJsDocComment);
+ ts.convertCompileOnSaveOptionFromJson = convertCompileOnSaveOptionFromJson;
+ function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) {
+ var errors = [];
+ var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
+ return { options: options, errors: errors };
}
- ts.getTouchingWord = getTouchingWord;
- function getTouchingPropertyName(sourceFile, position, includeJsDocComment) {
- if (includeJsDocComment === void 0) { includeJsDocComment = false; }
- return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }, includeJsDocComment);
+ ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
+ function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) {
+ var errors = [];
+ var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
+ return { options: options, errors: errors };
}
- ts.getTouchingPropertyName = getTouchingPropertyName;
- function getTouchingToken(sourceFile, position, includeItemAtEndPosition, includeJsDocComment) {
- if (includeJsDocComment === void 0) { includeJsDocComment = false; }
- return getTokenAtPositionWorker(sourceFile, position, false, includeItemAtEndPosition, includeJsDocComment);
+ ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
+ function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
+ var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
+ ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }
+ : {};
+ convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
+ return options;
}
- ts.getTouchingToken = getTouchingToken;
- function getTokenAtPosition(sourceFile, position, includeJsDocComment) {
- if (includeJsDocComment === void 0) { includeJsDocComment = false; }
- return getTokenAtPositionWorker(sourceFile, position, true, undefined, includeJsDocComment);
+ function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
+ var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
+ ? { enableAutoDiscovery: true, include: [], exclude: [] }
+ : { enableAutoDiscovery: false, include: [], exclude: [] };
+ convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
+ return options;
}
- ts.getTokenAtPosition = getTokenAtPosition;
- function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition, includeJsDocComment) {
- if (includeJsDocComment === void 0) { includeJsDocComment = false; }
- var current = sourceFile;
- outer: while (true) {
- if (isToken(current)) {
- return current;
- }
- if (includeJsDocComment) {
- var jsDocChildren = ts.filter(current.getChildren(), ts.isJSDocNode);
- for (var _i = 0, jsDocChildren_1 = jsDocChildren; _i < jsDocChildren_1.length; _i++) {
- var jsDocChild = jsDocChildren_1[_i];
- var start = allowPositionInLeadingTrivia ? jsDocChild.getFullStart() : jsDocChild.getStart(sourceFile, includeJsDocComment);
- if (start <= position) {
- var end = jsDocChild.getEnd();
- if (position < end || (position === end && jsDocChild.kind === 1)) {
- current = jsDocChild;
- continue outer;
- }
- else if (includeItemAtEndPosition && end === position) {
- var previousToken = findPrecedingToken(position, sourceFile, jsDocChild);
- if (previousToken && includeItemAtEndPosition(previousToken)) {
- return previousToken;
- }
- }
- }
- }
+ function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {
+ if (!jsonOptions) {
+ return;
+ }
+ var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; });
+ for (var id in jsonOptions) {
+ if (id in optionNameMap) {
+ var opt = optionNameMap[id];
+ defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);
}
- for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) {
- var child = current.getChildAt(i);
- if (ts.isJSDocNode(child)) {
- continue;
- }
- var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, includeJsDocComment);
- if (start <= position) {
- var end = child.getEnd();
- if (position < end || (position === end && child.kind === 1)) {
- current = child;
- continue outer;
- }
- else if (includeItemAtEndPosition && end === position) {
- var previousToken = findPrecedingToken(position, sourceFile, child);
- if (previousToken && includeItemAtEndPosition(previousToken)) {
- return previousToken;
- }
- }
- }
+ else {
+ errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id));
}
- return current;
}
}
- function findTokenOnLeftOfPosition(file, position) {
- var tokenAtPosition = getTokenAtPosition(file, position);
- if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) {
- return tokenAtPosition;
+ function convertJsonOption(opt, value, basePath, errors) {
+ var optType = opt.type;
+ var expectedType = typeof optType === "string" ? optType : "string";
+ if (optType === "list" && ts.isArray(value)) {
+ return convertJsonOptionOfListType(opt, value, basePath, errors);
}
- return findPrecedingToken(position, file);
- }
- ts.findTokenOnLeftOfPosition = findTokenOnLeftOfPosition;
- function findNextToken(previousToken, parent) {
- return find(parent);
- function find(n) {
- if (isToken(n) && n.pos === previousToken.end) {
- return n;
+ else if (typeof value === expectedType) {
+ if (typeof optType !== "string") {
+ return convertJsonOptionOfCustomType(opt, value, errors);
}
- var children = n.getChildren();
- for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
- var child = children_2[_i];
- var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) ||
- (child.pos === previousToken.end);
- if (shouldDiveInChildNode && nodeHasTokens(child)) {
- return find(child);
+ else {
+ if (opt.isFilePath) {
+ value = ts.normalizePath(ts.combinePaths(basePath, value));
+ if (value === "") {
+ value = ".";
+ }
}
}
- return undefined;
+ return value;
+ }
+ else {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType));
}
}
- ts.findNextToken = findNextToken;
- function findPrecedingToken(position, sourceFile, startNode) {
- return find(startNode || sourceFile);
- function findRightmostToken(n) {
- if (isToken(n) || n.kind === 244) {
- return n;
- }
- var children = n.getChildren();
- var candidate = findRightmostChildNodeWithTokens(children, children.length);
- return candidate && findRightmostToken(candidate);
- }
- function find(n) {
- if (isToken(n) || n.kind === 244) {
- return n;
- }
- var children = n.getChildren();
- for (var i = 0, len = children.length; i < len; i++) {
- var child = children[i];
- if (position < child.end && (nodeHasTokens(child) || child.kind === 244)) {
- var start = child.getStart(sourceFile);
- var lookInPreviousChild = (start >= position) ||
- (child.kind === 244 && start === child.end);
- if (lookInPreviousChild) {
- var candidate = findRightmostChildNodeWithTokens(children, i);
- return candidate && findRightmostToken(candidate);
- }
- else {
- return find(child);
- }
- }
- }
- ts.Debug.assert(startNode !== undefined || n.kind === 256);
- if (children.length) {
- var candidate = findRightmostChildNodeWithTokens(children, children.length);
- return candidate && findRightmostToken(candidate);
- }
- }
- function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) {
- for (var i = exclusiveStartPosition - 1; i >= 0; i--) {
- if (nodeHasTokens(children[i])) {
- return children[i];
- }
- }
+ function convertJsonOptionOfCustomType(opt, value, errors) {
+ var key = value.toLowerCase();
+ if (key in opt.type) {
+ return opt.type[key];
}
- }
- ts.findPrecedingToken = findPrecedingToken;
- function isInString(sourceFile, position) {
- var previousToken = findPrecedingToken(position, sourceFile);
- if (previousToken && previousToken.kind === 9) {
- var start = previousToken.getStart();
- var end = previousToken.getEnd();
- if (start < position && position < end) {
- return true;
- }
- if (position === end) {
- return !!previousToken.isUnterminated;
- }
+ else {
+ errors.push(createCompilerDiagnosticForInvalidCustomType(opt));
}
- return false;
- }
- ts.isInString = isInString;
- function isInComment(sourceFile, position) {
- return isInCommentHelper(sourceFile, position, undefined);
}
- ts.isInComment = isInComment;
- function isInsideJsxElementOrAttribute(sourceFile, position) {
- var token = getTokenAtPosition(sourceFile, position);
- if (!token) {
- return false;
- }
- if (token.kind === 244) {
- return true;
- }
- if (token.kind === 25 && token.parent.kind === 244) {
- return true;
- }
- if (token.kind === 25 && token.parent.kind === 248) {
- return true;
- }
- if (token && token.kind === 16 && token.parent.kind === 248) {
- return true;
- }
- if (token.kind === 25 && token.parent.kind === 245) {
- return true;
- }
- return false;
+ function convertJsonOptionOfListType(option, values, basePath, errors) {
+ return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; });
}
- ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute;
- function isInTemplateString(sourceFile, position) {
- var token = getTokenAtPosition(sourceFile, position);
- return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile);
+ function trimString(s) {
+ return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, "");
}
- ts.isInTemplateString = isInTemplateString;
- function isInCommentHelper(sourceFile, position, predicate) {
- var token = getTokenAtPosition(sourceFile, position);
- if (token && position <= token.getStart(sourceFile)) {
- var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
- return predicate ?
- ts.forEach(commentRanges, function (c) { return c.pos < position &&
- (c.kind == 2 ? position <= c.end : position < c.end) &&
- predicate(c); }) :
- ts.forEach(commentRanges, function (c) { return c.pos < position &&
- (c.kind == 2 ? position <= c.end : position < c.end); });
+ var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
+ var invalidMultipleRecursionPatterns = /(^|\/)\*\*\/(.*\/)?\*\*($|\/)/;
+ var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/;
+ var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//;
+ var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
+ function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) {
+ basePath = ts.normalizePath(basePath);
+ var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;
+ var literalFileMap = ts.createMap();
+ var wildcardFileMap = ts.createMap();
+ if (include) {
+ include = validateSpecs(include, errors, false);
}
- return false;
- }
- ts.isInCommentHelper = isInCommentHelper;
- function hasDocComment(sourceFile, position) {
- var token = getTokenAtPosition(sourceFile, position);
- var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
- return ts.forEach(commentRanges, jsDocPrefix);
- function jsDocPrefix(c) {
- var text = sourceFile.text;
- return text.length >= c.pos + 3 && text[c.pos] === "/" && text[c.pos + 1] === "*" && text[c.pos + 2] === "*";
+ if (exclude) {
+ exclude = validateSpecs(exclude, errors, true);
}
- }
- ts.hasDocComment = hasDocComment;
- function getJsDocTagAtPosition(sourceFile, position) {
- var node = ts.getTokenAtPosition(sourceFile, position);
- if (isToken(node)) {
- switch (node.kind) {
- case 102:
- case 108:
- case 74:
- node = node.parent === undefined ? undefined : node.parent.parent;
- break;
- default:
- node = node.parent;
- break;
+ var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames);
+ var supportedExtensions = ts.getSupportedExtensions(options);
+ if (fileNames) {
+ for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {
+ var fileName = fileNames_1[_i];
+ var file = ts.combinePaths(basePath, fileName);
+ literalFileMap[keyMapper(file)] = file;
}
}
- if (node) {
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- if (jsDocComment.tags) {
- for (var _b = 0, _c = jsDocComment.tags; _b < _c.length; _b++) {
- var tag = _c[_b];
- if (tag.pos <= position && position <= tag.end) {
- return tag;
- }
- }
- }
+ if (include && include.length > 0) {
+ for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensions, exclude, include); _a < _b.length; _a++) {
+ var file = _b[_a];
+ if (hasFileWithHigherPriorityExtension(file, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) {
+ continue;
+ }
+ removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper);
+ var key = keyMapper(file);
+ if (!(key in literalFileMap) && !(key in wildcardFileMap)) {
+ wildcardFileMap[key] = file;
}
}
}
- return undefined;
- }
- ts.getJsDocTagAtPosition = getJsDocTagAtPosition;
- function nodeHasTokens(n) {
- return n.getWidth() !== 0;
- }
- function getNodeModifiers(node) {
- var flags = ts.getCombinedModifierFlags(node);
- var result = [];
- if (flags & 8)
- result.push(ts.ScriptElementKindModifier.privateMemberModifier);
- if (flags & 16)
- result.push(ts.ScriptElementKindModifier.protectedMemberModifier);
- if (flags & 4)
- result.push(ts.ScriptElementKindModifier.publicMemberModifier);
- if (flags & 32)
- result.push(ts.ScriptElementKindModifier.staticModifier);
- if (flags & 128)
- result.push(ts.ScriptElementKindModifier.abstractModifier);
- if (flags & 1)
- result.push(ts.ScriptElementKindModifier.exportedModifier);
- if (ts.isInAmbientContext(node))
- result.push(ts.ScriptElementKindModifier.ambientModifier);
- return result.length > 0 ? result.join(",") : ts.ScriptElementKindModifier.none;
- }
- ts.getNodeModifiers = getNodeModifiers;
- function getTypeArgumentOrTypeParameterList(node) {
- if (node.kind === 155 || node.kind === 174) {
- return node.typeArguments;
- }
- if (ts.isFunctionLike(node) || node.kind === 221 || node.kind === 222) {
- return node.typeParameters;
- }
- return undefined;
- }
- ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList;
- function isToken(n) {
- return n.kind >= 0 && n.kind <= 138;
- }
- ts.isToken = isToken;
- function isWord(kind) {
- return kind === 69 || ts.isKeyword(kind);
- }
- ts.isWord = isWord;
- function isPropertyName(kind) {
- return kind === 9 || kind === 8 || isWord(kind);
- }
- function isComment(kind) {
- return kind === 2 || kind === 3;
- }
- ts.isComment = isComment;
- function isStringOrRegularExpressionOrTemplateLiteral(kind) {
- if (kind === 9
- || kind === 10
- || ts.isTemplateLiteralKind(kind)) {
- return true;
- }
- return false;
- }
- ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral;
- function isPunctuation(kind) {
- return 15 <= kind && kind <= 68;
- }
- ts.isPunctuation = isPunctuation;
- function isInsideTemplateLiteral(node, position) {
- return ts.isTemplateLiteralKind(node.kind)
- && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd());
+ var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []);
+ var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []);
+ wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive);
+ return {
+ fileNames: literalFiles.concat(wildcardFiles),
+ wildcardDirectories: wildcardDirectories
+ };
}
- ts.isInsideTemplateLiteral = isInsideTemplateLiteral;
- function isAccessibilityModifier(kind) {
- switch (kind) {
- case 112:
- case 110:
- case 111:
- return true;
+ function validateSpecs(specs, errors, allowTrailingRecursion) {
+ var validSpecs = [];
+ for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) {
+ var spec = specs_2[_i];
+ if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec));
+ }
+ else if (invalidMultipleRecursionPatterns.test(spec)) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0, spec));
+ }
+ else if (invalidDotDotAfterRecursiveWildcardPattern.test(spec)) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec));
+ }
+ else {
+ validSpecs.push(spec);
+ }
}
- return false;
+ return validSpecs;
}
- ts.isAccessibilityModifier = isAccessibilityModifier;
- function compareDataObjects(dst, src) {
- for (var e in dst) {
- if (typeof dst[e] === "object") {
- if (!compareDataObjects(dst[e], src[e])) {
- return false;
+ function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) {
+ var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude");
+ var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i");
+ var wildcardDirectories = ts.createMap();
+ if (include !== undefined) {
+ var recursiveKeys = [];
+ for (var _i = 0, include_1 = include; _i < include_1.length; _i++) {
+ var file = include_1[_i];
+ var name_45 = ts.normalizePath(ts.combinePaths(path, file));
+ if (excludeRegex && excludeRegex.test(name_45)) {
+ continue;
+ }
+ var match = wildcardDirectoryPattern.exec(name_45);
+ if (match) {
+ var key = useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase();
+ var flags = watchRecursivePattern.test(name_45) ? 1 : 0;
+ var existingFlags = wildcardDirectories[key];
+ if (existingFlags === undefined || existingFlags < flags) {
+ wildcardDirectories[key] = flags;
+ if (flags === 1) {
+ recursiveKeys.push(key);
+ }
+ }
}
}
- else if (typeof dst[e] !== "function") {
- if (dst[e] !== src[e]) {
- return false;
+ for (var key in wildcardDirectories) {
+ for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) {
+ var recursiveKey = recursiveKeys_1[_a];
+ if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) {
+ delete wildcardDirectories[key];
+ }
}
}
}
- return true;
+ return wildcardDirectories;
}
- ts.compareDataObjects = compareDataObjects;
- function isArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- if (node.kind === 170 ||
- node.kind === 171) {
- if (node.parent.kind === 187 &&
- node.parent.left === node &&
- node.parent.operatorToken.kind === 56) {
- return true;
- }
- if (node.parent.kind === 208 &&
- node.parent.initializer === node) {
- return true;
- }
- if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 253 ? node.parent.parent : node.parent)) {
+ function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {
+ var extensionPriority = ts.getExtensionPriority(file, extensions);
+ var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority);
+ for (var i = 0; i < adjustedExtensionPriority; i++) {
+ var higherPriorityExtension = extensions[i];
+ var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension));
+ if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) {
return true;
}
}
return false;
}
- ts.isArrayLiteralOrObjectLiteralDestructuringPattern = isArrayLiteralOrObjectLiteralDestructuringPattern;
- function hasTrailingDirectorySeparator(path) {
- var lastCharacter = path.charAt(path.length - 1);
- return lastCharacter === "/" || lastCharacter === "\\";
- }
- ts.hasTrailingDirectorySeparator = hasTrailingDirectorySeparator;
- function isInReferenceComment(sourceFile, position) {
- return isInCommentHelper(sourceFile, position, isReferenceComment);
- function isReferenceComment(c) {
- var commentText = sourceFile.text.substring(c.pos, c.end);
- return tripleSlashDirectivePrefixRegex.test(commentText);
+ function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) {
+ var extensionPriority = ts.getExtensionPriority(file, extensions);
+ var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority);
+ for (var i = nextExtensionPriority; i < extensions.length; i++) {
+ var lowerPriorityExtension = extensions[i];
+ var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension));
+ delete wildcardFiles[lowerPriorityPath];
}
}
- ts.isInReferenceComment = isInReferenceComment;
- function isInNonReferenceComment(sourceFile, position) {
- return isInCommentHelper(sourceFile, position, isNonReferenceComment);
- function isNonReferenceComment(c) {
- var commentText = sourceFile.text.substring(c.pos, c.end);
- return !tripleSlashDirectivePrefixRegex.test(commentText);
- }
+ function addFileToOutput(output, file) {
+ output.push(file);
+ return output;
+ }
+ function caseSensitiveKeyMapper(key) {
+ return key;
+ }
+ function caseInsensitiveKeyMapper(key) {
+ return key.toLowerCase();
}
- ts.isInNonReferenceComment = isInNonReferenceComment;
})(ts || (ts = {}));
+var ts;
(function (ts) {
- function isFirstDeclarationOfSymbolParameter(symbol) {
- return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 142;
- }
- ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter;
- var displayPartWriter = getDisplayPartWriter();
- function getDisplayPartWriter() {
- var displayParts;
- var lineStart;
- var indent;
- resetWriter();
- return {
- displayParts: function () { return displayParts; },
- writeKeyword: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.keyword); },
- writeOperator: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.operator); },
- writePunctuation: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.punctuation); },
- writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); },
- writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); },
- writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); },
- writeSymbol: writeSymbol,
- writeLine: writeLine,
- increaseIndent: function () { indent++; },
- decreaseIndent: function () { indent--; },
- clear: resetWriter,
- trackSymbol: function () { },
- reportInaccessibleThisError: function () { }
- };
- function writeIndent() {
- if (lineStart) {
- var indentString = ts.getIndentString(indent);
- if (indentString) {
- displayParts.push(displayPart(indentString, ts.SymbolDisplayPartKind.space));
- }
- lineStart = false;
+ var ScriptSnapshot;
+ (function (ScriptSnapshot) {
+ var StringScriptSnapshot = (function () {
+ function StringScriptSnapshot(text) {
+ this.text = text;
}
+ StringScriptSnapshot.prototype.getText = function (start, end) {
+ return this.text.substring(start, end);
+ };
+ StringScriptSnapshot.prototype.getLength = function () {
+ return this.text.length;
+ };
+ StringScriptSnapshot.prototype.getChangeRange = function () {
+ return undefined;
+ };
+ return StringScriptSnapshot;
+ }());
+ function fromString(text) {
+ return new StringScriptSnapshot(text);
}
- function writeKind(text, kind) {
- writeIndent();
- displayParts.push(displayPart(text, kind));
- }
- function writeSymbol(text, symbol) {
- writeIndent();
- displayParts.push(symbolPart(text, symbol));
+ ScriptSnapshot.fromString = fromString;
+ })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {}));
+ var TextChange = (function () {
+ function TextChange() {
}
- function writeLine() {
- displayParts.push(lineBreakPart());
- lineStart = true;
+ return TextChange;
+ }());
+ ts.TextChange = TextChange;
+ var HighlightSpanKind;
+ (function (HighlightSpanKind) {
+ HighlightSpanKind.none = "none";
+ HighlightSpanKind.definition = "definition";
+ HighlightSpanKind.reference = "reference";
+ HighlightSpanKind.writtenReference = "writtenReference";
+ })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {}));
+ (function (IndentStyle) {
+ IndentStyle[IndentStyle["None"] = 0] = "None";
+ IndentStyle[IndentStyle["Block"] = 1] = "Block";
+ IndentStyle[IndentStyle["Smart"] = 2] = "Smart";
+ })(ts.IndentStyle || (ts.IndentStyle = {}));
+ var IndentStyle = ts.IndentStyle;
+ (function (SymbolDisplayPartKind) {
+ SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["enumName"] = 2] = "enumName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["fieldName"] = 3] = "fieldName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["interfaceName"] = 4] = "interfaceName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["keyword"] = 5] = "keyword";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["lineBreak"] = 6] = "lineBreak";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["numericLiteral"] = 7] = "numericLiteral";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["stringLiteral"] = 8] = "stringLiteral";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["localName"] = 9] = "localName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["methodName"] = 10] = "methodName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["moduleName"] = 11] = "moduleName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["operator"] = 12] = "operator";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["parameterName"] = 13] = "parameterName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["propertyName"] = 14] = "propertyName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["punctuation"] = 15] = "punctuation";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["space"] = 16] = "space";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["text"] = 17] = "text";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["typeParameterName"] = 18] = "typeParameterName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["enumMemberName"] = 19] = "enumMemberName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["functionName"] = 20] = "functionName";
+ SymbolDisplayPartKind[SymbolDisplayPartKind["regularExpressionLiteral"] = 21] = "regularExpressionLiteral";
+ })(ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {}));
+ var SymbolDisplayPartKind = ts.SymbolDisplayPartKind;
+ (function (OutputFileType) {
+ OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript";
+ OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap";
+ OutputFileType[OutputFileType["Declaration"] = 2] = "Declaration";
+ })(ts.OutputFileType || (ts.OutputFileType = {}));
+ var OutputFileType = ts.OutputFileType;
+ (function (EndOfLineState) {
+ EndOfLineState[EndOfLineState["None"] = 0] = "None";
+ EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia";
+ EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral";
+ EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral";
+ EndOfLineState[EndOfLineState["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate";
+ EndOfLineState[EndOfLineState["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail";
+ EndOfLineState[EndOfLineState["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition";
+ })(ts.EndOfLineState || (ts.EndOfLineState = {}));
+ var EndOfLineState = ts.EndOfLineState;
+ (function (TokenClass) {
+ TokenClass[TokenClass["Punctuation"] = 0] = "Punctuation";
+ TokenClass[TokenClass["Keyword"] = 1] = "Keyword";
+ TokenClass[TokenClass["Operator"] = 2] = "Operator";
+ TokenClass[TokenClass["Comment"] = 3] = "Comment";
+ TokenClass[TokenClass["Whitespace"] = 4] = "Whitespace";
+ TokenClass[TokenClass["Identifier"] = 5] = "Identifier";
+ TokenClass[TokenClass["NumberLiteral"] = 6] = "NumberLiteral";
+ TokenClass[TokenClass["StringLiteral"] = 7] = "StringLiteral";
+ TokenClass[TokenClass["RegExpLiteral"] = 8] = "RegExpLiteral";
+ })(ts.TokenClass || (ts.TokenClass = {}));
+ var TokenClass = ts.TokenClass;
+ var ScriptElementKind;
+ (function (ScriptElementKind) {
+ ScriptElementKind.unknown = "";
+ ScriptElementKind.warning = "warning";
+ ScriptElementKind.keyword = "keyword";
+ ScriptElementKind.scriptElement = "script";
+ ScriptElementKind.moduleElement = "module";
+ ScriptElementKind.classElement = "class";
+ ScriptElementKind.localClassElement = "local class";
+ ScriptElementKind.interfaceElement = "interface";
+ ScriptElementKind.typeElement = "type";
+ ScriptElementKind.enumElement = "enum";
+ ScriptElementKind.enumMemberElement = "const";
+ ScriptElementKind.variableElement = "var";
+ ScriptElementKind.localVariableElement = "local var";
+ ScriptElementKind.functionElement = "function";
+ ScriptElementKind.localFunctionElement = "local function";
+ ScriptElementKind.memberFunctionElement = "method";
+ ScriptElementKind.memberGetAccessorElement = "getter";
+ ScriptElementKind.memberSetAccessorElement = "setter";
+ ScriptElementKind.memberVariableElement = "property";
+ ScriptElementKind.constructorImplementationElement = "constructor";
+ ScriptElementKind.callSignatureElement = "call";
+ ScriptElementKind.indexSignatureElement = "index";
+ ScriptElementKind.constructSignatureElement = "construct";
+ ScriptElementKind.parameterElement = "parameter";
+ ScriptElementKind.typeParameterElement = "type parameter";
+ ScriptElementKind.primitiveType = "primitive type";
+ ScriptElementKind.label = "label";
+ ScriptElementKind.alias = "alias";
+ ScriptElementKind.constElement = "const";
+ ScriptElementKind.letElement = "let";
+ ScriptElementKind.directory = "directory";
+ ScriptElementKind.externalModuleName = "external module name";
+ })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {}));
+ var ScriptElementKindModifier;
+ (function (ScriptElementKindModifier) {
+ ScriptElementKindModifier.none = "";
+ ScriptElementKindModifier.publicMemberModifier = "public";
+ ScriptElementKindModifier.privateMemberModifier = "private";
+ ScriptElementKindModifier.protectedMemberModifier = "protected";
+ ScriptElementKindModifier.exportedModifier = "export";
+ ScriptElementKindModifier.ambientModifier = "declare";
+ ScriptElementKindModifier.staticModifier = "static";
+ ScriptElementKindModifier.abstractModifier = "abstract";
+ })(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {}));
+ var ClassificationTypeNames = (function () {
+ function ClassificationTypeNames() {
}
- function resetWriter() {
- displayParts = [];
- lineStart = true;
- indent = 0;
+ return ClassificationTypeNames;
+ }());
+ ClassificationTypeNames.comment = "comment";
+ ClassificationTypeNames.identifier = "identifier";
+ ClassificationTypeNames.keyword = "keyword";
+ ClassificationTypeNames.numericLiteral = "number";
+ ClassificationTypeNames.operator = "operator";
+ ClassificationTypeNames.stringLiteral = "string";
+ ClassificationTypeNames.whiteSpace = "whitespace";
+ ClassificationTypeNames.text = "text";
+ ClassificationTypeNames.punctuation = "punctuation";
+ ClassificationTypeNames.className = "class name";
+ ClassificationTypeNames.enumName = "enum name";
+ ClassificationTypeNames.interfaceName = "interface name";
+ ClassificationTypeNames.moduleName = "module name";
+ ClassificationTypeNames.typeParameterName = "type parameter name";
+ ClassificationTypeNames.typeAliasName = "type alias name";
+ ClassificationTypeNames.parameterName = "parameter name";
+ ClassificationTypeNames.docCommentTagName = "doc comment tag name";
+ ClassificationTypeNames.jsxOpenTagName = "jsx open tag name";
+ ClassificationTypeNames.jsxCloseTagName = "jsx close tag name";
+ ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name";
+ ClassificationTypeNames.jsxAttribute = "jsx attribute";
+ ClassificationTypeNames.jsxText = "jsx text";
+ ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value";
+ ts.ClassificationTypeNames = ClassificationTypeNames;
+ (function (ClassificationType) {
+ ClassificationType[ClassificationType["comment"] = 1] = "comment";
+ ClassificationType[ClassificationType["identifier"] = 2] = "identifier";
+ ClassificationType[ClassificationType["keyword"] = 3] = "keyword";
+ ClassificationType[ClassificationType["numericLiteral"] = 4] = "numericLiteral";
+ ClassificationType[ClassificationType["operator"] = 5] = "operator";
+ ClassificationType[ClassificationType["stringLiteral"] = 6] = "stringLiteral";
+ ClassificationType[ClassificationType["regularExpressionLiteral"] = 7] = "regularExpressionLiteral";
+ ClassificationType[ClassificationType["whiteSpace"] = 8] = "whiteSpace";
+ ClassificationType[ClassificationType["text"] = 9] = "text";
+ ClassificationType[ClassificationType["punctuation"] = 10] = "punctuation";
+ ClassificationType[ClassificationType["className"] = 11] = "className";
+ ClassificationType[ClassificationType["enumName"] = 12] = "enumName";
+ ClassificationType[ClassificationType["interfaceName"] = 13] = "interfaceName";
+ ClassificationType[ClassificationType["moduleName"] = 14] = "moduleName";
+ ClassificationType[ClassificationType["typeParameterName"] = 15] = "typeParameterName";
+ ClassificationType[ClassificationType["typeAliasName"] = 16] = "typeAliasName";
+ ClassificationType[ClassificationType["parameterName"] = 17] = "parameterName";
+ ClassificationType[ClassificationType["docCommentTagName"] = 18] = "docCommentTagName";
+ ClassificationType[ClassificationType["jsxOpenTagName"] = 19] = "jsxOpenTagName";
+ ClassificationType[ClassificationType["jsxCloseTagName"] = 20] = "jsxCloseTagName";
+ ClassificationType[ClassificationType["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName";
+ ClassificationType[ClassificationType["jsxAttribute"] = 22] = "jsxAttribute";
+ ClassificationType[ClassificationType["jsxText"] = 23] = "jsxText";
+ ClassificationType[ClassificationType["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue";
+ })(ts.ClassificationType || (ts.ClassificationType = {}));
+ var ClassificationType = ts.ClassificationType;
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ ts.scanner = ts.createScanner(4, true);
+ ts.emptyArray = [];
+ (function (SemanticMeaning) {
+ SemanticMeaning[SemanticMeaning["None"] = 0] = "None";
+ SemanticMeaning[SemanticMeaning["Value"] = 1] = "Value";
+ SemanticMeaning[SemanticMeaning["Type"] = 2] = "Type";
+ SemanticMeaning[SemanticMeaning["Namespace"] = 4] = "Namespace";
+ SemanticMeaning[SemanticMeaning["All"] = 7] = "All";
+ })(ts.SemanticMeaning || (ts.SemanticMeaning = {}));
+ var SemanticMeaning = ts.SemanticMeaning;
+ function getMeaningFromDeclaration(node) {
+ switch (node.kind) {
+ case 143:
+ case 219:
+ case 170:
+ case 146:
+ case 145:
+ case 253:
+ case 254:
+ case 255:
+ case 148:
+ case 147:
+ case 149:
+ case 150:
+ case 151:
+ case 221:
+ case 180:
+ case 181:
+ case 252:
+ return 1;
+ case 142:
+ case 223:
+ case 224:
+ case 160:
+ return 2;
+ case 222:
+ case 225:
+ return 1 | 2;
+ case 226:
+ if (ts.isAmbientModule(node)) {
+ return 4 | 1;
+ }
+ else if (ts.getModuleInstanceState(node) === 1) {
+ return 4 | 1;
+ }
+ else {
+ return 4;
+ }
+ case 234:
+ case 235:
+ case 230:
+ case 231:
+ case 236:
+ case 237:
+ return 1 | 2 | 4;
+ case 256:
+ return 4 | 1;
}
+ return 1 | 2 | 4;
}
- function symbolPart(text, symbol) {
- return displayPart(text, displayPartKind(symbol), symbol);
- function displayPartKind(symbol) {
- var flags = symbol.flags;
- if (flags & 3) {
- return isFirstDeclarationOfSymbolParameter(symbol) ? ts.SymbolDisplayPartKind.parameterName : ts.SymbolDisplayPartKind.localName;
- }
- else if (flags & 4) {
- return ts.SymbolDisplayPartKind.propertyName;
- }
- else if (flags & 32768) {
- return ts.SymbolDisplayPartKind.propertyName;
- }
- else if (flags & 65536) {
- return ts.SymbolDisplayPartKind.propertyName;
- }
- else if (flags & 8) {
- return ts.SymbolDisplayPartKind.enumMemberName;
- }
- else if (flags & 16) {
- return ts.SymbolDisplayPartKind.functionName;
- }
- else if (flags & 32) {
- return ts.SymbolDisplayPartKind.className;
- }
- else if (flags & 64) {
- return ts.SymbolDisplayPartKind.interfaceName;
- }
- else if (flags & 384) {
- return ts.SymbolDisplayPartKind.enumName;
- }
- else if (flags & 1536) {
- return ts.SymbolDisplayPartKind.moduleName;
- }
- else if (flags & 8192) {
- return ts.SymbolDisplayPartKind.methodName;
- }
- else if (flags & 262144) {
- return ts.SymbolDisplayPartKind.typeParameterName;
- }
- else if (flags & 524288) {
- return ts.SymbolDisplayPartKind.aliasName;
+ ts.getMeaningFromDeclaration = getMeaningFromDeclaration;
+ function getMeaningFromLocation(node) {
+ if (node.parent.kind === 236) {
+ return 1 | 2 | 4;
+ }
+ else if (isInRightSideOfImport(node)) {
+ return getMeaningFromRightHandSideOfImportEquals(node);
+ }
+ else if (ts.isDeclarationName(node)) {
+ return getMeaningFromDeclaration(node.parent);
+ }
+ else if (isTypeReference(node)) {
+ return 2;
+ }
+ else if (isNamespaceReference(node)) {
+ return 4;
+ }
+ else {
+ return 1;
+ }
+ }
+ ts.getMeaningFromLocation = getMeaningFromLocation;
+ function getMeaningFromRightHandSideOfImportEquals(node) {
+ ts.Debug.assert(node.kind === 70);
+ if (node.parent.kind === 140 &&
+ node.parent.right === node &&
+ node.parent.parent.kind === 230) {
+ return 1 | 2 | 4;
+ }
+ return 4;
+ }
+ function isInRightSideOfImport(node) {
+ while (node.parent.kind === 140) {
+ node = node.parent;
+ }
+ return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node;
+ }
+ function isNamespaceReference(node) {
+ return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node);
+ }
+ function isQualifiedNameNamespaceReference(node) {
+ var root = node;
+ var isLastClause = true;
+ if (root.parent.kind === 140) {
+ while (root.parent && root.parent.kind === 140) {
+ root = root.parent;
}
- else if (flags & 8388608) {
- return ts.SymbolDisplayPartKind.aliasName;
+ isLastClause = root.right === node;
+ }
+ return root.parent.kind === 156 && !isLastClause;
+ }
+ function isPropertyAccessNamespaceReference(node) {
+ var root = node;
+ var isLastClause = true;
+ if (root.parent.kind === 173) {
+ while (root.parent && root.parent.kind === 173) {
+ root = root.parent;
}
- return ts.SymbolDisplayPartKind.text;
+ isLastClause = root.name === node;
+ }
+ if (!isLastClause && root.parent.kind === 195 && root.parent.parent.kind === 251) {
+ var decl = root.parent.parent.parent;
+ return (decl.kind === 222 && root.parent.parent.token === 107) ||
+ (decl.kind === 223 && root.parent.parent.token === 84);
}
+ return false;
}
- ts.symbolPart = symbolPart;
- function displayPart(text, kind, symbol) {
- return {
- text: text,
- kind: ts.SymbolDisplayPartKind[kind]
- };
+ function isTypeReference(node) {
+ if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) {
+ node = node.parent;
+ }
+ return node.parent.kind === 156 ||
+ (node.parent.kind === 195 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) ||
+ (node.kind === 98 && !ts.isPartOfExpression(node)) ||
+ node.kind === 166;
}
- ts.displayPart = displayPart;
- function spacePart() {
- return displayPart(" ", ts.SymbolDisplayPartKind.space);
+ function isCallExpressionTarget(node) {
+ return isCallOrNewExpressionTarget(node, 175);
}
- ts.spacePart = spacePart;
- function keywordPart(kind) {
- return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.keyword);
+ ts.isCallExpressionTarget = isCallExpressionTarget;
+ function isNewExpressionTarget(node) {
+ return isCallOrNewExpressionTarget(node, 176);
}
- ts.keywordPart = keywordPart;
- function punctuationPart(kind) {
- return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.punctuation);
+ ts.isNewExpressionTarget = isNewExpressionTarget;
+ function isCallOrNewExpressionTarget(node, kind) {
+ var target = climbPastPropertyAccess(node);
+ return target && target.parent && target.parent.kind === kind && target.parent.expression === target;
}
- ts.punctuationPart = punctuationPart;
- function operatorPart(kind) {
- return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.operator);
+ function climbPastPropertyAccess(node) {
+ return isRightSideOfPropertyAccess(node) ? node.parent : node;
}
- ts.operatorPart = operatorPart;
- function textOrKeywordPart(text) {
- var kind = ts.stringToToken(text);
- return kind === undefined
- ? textPart(text)
- : keywordPart(kind);
+ ts.climbPastPropertyAccess = climbPastPropertyAccess;
+ function getTargetLabel(referenceNode, labelName) {
+ while (referenceNode) {
+ if (referenceNode.kind === 215 && referenceNode.label.text === labelName) {
+ return referenceNode.label;
+ }
+ referenceNode = referenceNode.parent;
+ }
+ return undefined;
}
- ts.textOrKeywordPart = textOrKeywordPart;
- function textPart(text) {
- return displayPart(text, ts.SymbolDisplayPartKind.text);
+ ts.getTargetLabel = getTargetLabel;
+ function isJumpStatementTarget(node) {
+ return node.kind === 70 &&
+ (node.parent.kind === 211 || node.parent.kind === 210) &&
+ node.parent.label === node;
}
- ts.textPart = textPart;
- var carriageReturnLineFeed = "\r\n";
- function getNewLineOrDefaultFromHost(host) {
- return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed;
+ ts.isJumpStatementTarget = isJumpStatementTarget;
+ function isLabelOfLabeledStatement(node) {
+ return node.kind === 70 &&
+ node.parent.kind === 215 &&
+ node.parent.label === node;
}
- ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost;
- function lineBreakPart() {
- return displayPart("\n", ts.SymbolDisplayPartKind.lineBreak);
+ function isLabelName(node) {
+ return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node);
}
- ts.lineBreakPart = lineBreakPart;
- function mapToDisplayParts(writeDisplayParts) {
- writeDisplayParts(displayPartWriter);
- var result = displayPartWriter.displayParts();
- displayPartWriter.clear();
- return result;
+ ts.isLabelName = isLabelName;
+ function isRightSideOfQualifiedName(node) {
+ return node.parent.kind === 140 && node.parent.right === node;
}
- ts.mapToDisplayParts = mapToDisplayParts;
- function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) {
- return mapToDisplayParts(function (writer) {
- typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
- });
+ ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName;
+ function isRightSideOfPropertyAccess(node) {
+ return node && node.parent && node.parent.kind === 173 && node.parent.name === node;
}
- ts.typeToDisplayParts = typeToDisplayParts;
- function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) {
- return mapToDisplayParts(function (writer) {
- typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags);
- });
+ ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess;
+ function isNameOfModuleDeclaration(node) {
+ return node.parent.kind === 226 && node.parent.name === node;
}
- ts.symbolToDisplayParts = symbolToDisplayParts;
- function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) {
- return mapToDisplayParts(function (writer) {
- typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);
- });
+ ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration;
+ function isNameOfFunctionDeclaration(node) {
+ return node.kind === 70 &&
+ ts.isFunctionLike(node.parent) && node.parent.name === node;
}
- ts.signatureToDisplayParts = signatureToDisplayParts;
- function getDeclaredName(typeChecker, symbol, location) {
- if (isImportOrExportSpecifierName(location)) {
- return location.getText();
- }
- else if (ts.isStringOrNumericLiteral(location.kind) &&
- location.parent.kind === 140) {
- return location.text;
+ ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration;
+ function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) {
+ if (node.kind === 9 || node.kind === 8) {
+ switch (node.parent.kind) {
+ case 146:
+ case 145:
+ case 253:
+ case 255:
+ case 148:
+ case 147:
+ case 150:
+ case 151:
+ case 226:
+ return node.parent.name === node;
+ case 174:
+ return node.parent.argumentExpression === node;
+ case 141:
+ return true;
+ }
}
- var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol);
- var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol);
- return name;
+ return false;
}
- ts.getDeclaredName = getDeclaredName;
- function isImportOrExportSpecifierName(location) {
- return location.parent &&
- (location.parent.kind === 234 || location.parent.kind === 238) &&
- location.parent.propertyName === location;
+ ts.isLiteralNameOfPropertyDeclarationOrIndexAccess = isLiteralNameOfPropertyDeclarationOrIndexAccess;
+ function isExpressionOfExternalModuleImportEqualsDeclaration(node) {
+ return ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) &&
+ ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node;
}
- ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName;
- function stripQuotes(name) {
- var length = name.length;
- if (length >= 2 &&
- name.charCodeAt(0) === name.charCodeAt(length - 1) &&
- (name.charCodeAt(0) === 34 || name.charCodeAt(0) === 39)) {
- return name.substring(1, length - 1);
+ ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration;
+ function isInsideComment(sourceFile, token, position) {
+ return position <= token.getStart(sourceFile) &&
+ (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) ||
+ isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart())));
+ function isInsideCommentRange(comments) {
+ return ts.forEach(comments, function (comment) {
+ if (comment.pos < position && position < comment.end) {
+ return true;
+ }
+ else if (position === comment.end) {
+ var text = sourceFile.text;
+ var width = comment.end - comment.pos;
+ if (width <= 2 || text.charCodeAt(comment.pos + 1) === 47) {
+ return true;
+ }
+ else {
+ return !(text.charCodeAt(comment.end - 1) === 47 &&
+ text.charCodeAt(comment.end - 2) === 42);
+ }
+ }
+ return false;
+ });
}
- ;
- return name;
}
- ts.stripQuotes = stripQuotes;
- function scriptKindIs(fileName, host) {
- var scriptKinds = [];
- for (var _i = 2; _i < arguments.length; _i++) {
- scriptKinds[_i - 2] = arguments[_i];
+ ts.isInsideComment = isInsideComment;
+ function getContainerNode(node) {
+ while (true) {
+ node = node.parent;
+ if (!node) {
+ return undefined;
+ }
+ switch (node.kind) {
+ case 256:
+ case 148:
+ case 147:
+ case 221:
+ case 180:
+ case 150:
+ case 151:
+ case 222:
+ case 223:
+ case 225:
+ case 226:
+ return node;
+ }
}
- var scriptKind = getScriptKind(fileName, host);
- return ts.forEach(scriptKinds, function (k) { return k === scriptKind; });
}
- ts.scriptKindIs = scriptKindIs;
- function getScriptKind(fileName, host) {
- var scriptKind;
- if (host && host.getScriptKind) {
- scriptKind = host.getScriptKind(fileName);
+ ts.getContainerNode = getContainerNode;
+ function getNodeKind(node) {
+ switch (node.kind) {
+ case 256:
+ return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement;
+ case 226:
+ return ts.ScriptElementKind.moduleElement;
+ case 222:
+ case 193:
+ return ts.ScriptElementKind.classElement;
+ case 223: return ts.ScriptElementKind.interfaceElement;
+ case 224: return ts.ScriptElementKind.typeElement;
+ case 225: return ts.ScriptElementKind.enumElement;
+ case 219:
+ return getKindOfVariableDeclaration(node);
+ case 170:
+ return getKindOfVariableDeclaration(ts.getRootDeclaration(node));
+ case 181:
+ case 221:
+ case 180:
+ return ts.ScriptElementKind.functionElement;
+ case 150: return ts.ScriptElementKind.memberGetAccessorElement;
+ case 151: return ts.ScriptElementKind.memberSetAccessorElement;
+ case 148:
+ case 147:
+ return ts.ScriptElementKind.memberFunctionElement;
+ case 146:
+ case 145:
+ return ts.ScriptElementKind.memberVariableElement;
+ case 154: return ts.ScriptElementKind.indexSignatureElement;
+ case 153: return ts.ScriptElementKind.constructSignatureElement;
+ case 152: return ts.ScriptElementKind.callSignatureElement;
+ case 149: return ts.ScriptElementKind.constructorImplementationElement;
+ case 142: return ts.ScriptElementKind.typeParameterElement;
+ case 255: return ts.ScriptElementKind.enumMemberElement;
+ case 143: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement;
+ case 230:
+ case 235:
+ case 232:
+ case 239:
+ case 233:
+ return ts.ScriptElementKind.alias;
+ case 279:
+ return ts.ScriptElementKind.typeElement;
+ default:
+ return ts.ScriptElementKind.unknown;
}
- if (!scriptKind) {
- scriptKind = ts.getScriptKindFromFileName(fileName);
+ function getKindOfVariableDeclaration(v) {
+ return ts.isConst(v)
+ ? ts.ScriptElementKind.constElement
+ : ts.isLet(v)
+ ? ts.ScriptElementKind.letElement
+ : ts.ScriptElementKind.variableElement;
}
- return ts.ensureScriptKind(fileName, scriptKind);
}
- ts.getScriptKind = getScriptKind;
- function sanitizeConfigFile(configFileName, content) {
- var options = {
- fileName: "config.js",
- compilerOptions: {
- target: 2,
- removeComments: true
- },
- reportDiagnostics: true
- };
- var _a = ts.transpileModule("(" + content + ")", options), outputText = _a.outputText, diagnostics = _a.diagnostics;
- var trimmedOutput = outputText.trim();
- for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) {
- var diagnostic = diagnostics_2[_i];
- diagnostic.start = diagnostic.start - 1;
+ ts.getNodeKind = getNodeKind;
+ function getStringLiteralTypeForNode(node, typeChecker) {
+ var searchNode = node.parent.kind === 167 ? node.parent : node;
+ var type = typeChecker.getTypeAtLocation(searchNode);
+ if (type && type.flags & 32) {
+ return type;
}
- var _b = ts.parseConfigFileTextToJson(configFileName, trimmedOutput.substring(1, trimmedOutput.length - 2), false), config = _b.config, error = _b.error;
- return {
- configJsonObject: config || {},
- diagnostics: error ? ts.concatenate(diagnostics, [error]) : diagnostics
- };
+ return undefined;
}
- ts.sanitizeConfigFile = sanitizeConfigFile;
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var BreakpointResolver;
- (function (BreakpointResolver) {
- function spanInSourceFileAtLocation(sourceFile, position) {
- if (sourceFile.isDeclarationFile) {
- return undefined;
- }
- var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position);
- var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
- if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) {
- tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile);
- if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) {
- return undefined;
- }
- }
- if (ts.isInAmbientContext(tokenAtLocation)) {
- return undefined;
- }
- return spanInNode(tokenAtLocation);
- function textSpan(startNode, endNode) {
- var start = startNode.decorators ?
- ts.skipTrivia(sourceFile.text, startNode.decorators.end) :
- startNode.getStart(sourceFile);
- return ts.createTextSpanFromBounds(start, (endNode || startNode).getEnd());
- }
- function textSpanEndingAtNextToken(startNode, previousTokenToFindNextEndToken) {
- return textSpan(startNode, ts.findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent));
- }
- function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) {
- if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) {
- return spanInNode(node);
- }
- return spanInNode(otherwiseOnNode);
- }
- function spanInNodeArray(nodeArray) {
- return ts.createTextSpanFromBounds(ts.skipTrivia(sourceFile.text, nodeArray.pos), nodeArray.end);
- }
- function spanInPreviousNode(node) {
- return spanInNode(ts.findPrecedingToken(node.pos, sourceFile));
- }
- function spanInNextNode(node) {
- return spanInNode(ts.findNextToken(node, node.parent));
- }
- function spanInNode(node) {
- if (node) {
- switch (node.kind) {
- case 200:
- return spanInVariableDeclaration(node.declarationList.declarations[0]);
- case 218:
- case 145:
- case 144:
- return spanInVariableDeclaration(node);
- case 142:
- return spanInParameterDeclaration(node);
- case 220:
- case 147:
- case 146:
- case 149:
- case 150:
- case 148:
- case 179:
- case 180:
- return spanInFunctionDeclaration(node);
- case 199:
- if (ts.isFunctionBlock(node)) {
- return spanInFunctionBlock(node);
- }
- case 226:
- return spanInBlock(node);
- case 252:
- return spanInBlock(node.block);
- case 202:
- return textSpan(node.expression);
- case 211:
- return textSpan(node.getChildAt(0), node.expression);
- case 205:
- return textSpanEndingAtNextToken(node, node.expression);
- case 204:
- return spanInNode(node.statement);
- case 217:
- return textSpan(node.getChildAt(0));
- case 203:
- return textSpanEndingAtNextToken(node, node.expression);
- case 214:
- return spanInNode(node.statement);
- case 210:
- case 209:
- return textSpan(node.getChildAt(0), node.label);
- case 206:
- return spanInForStatement(node);
- case 207:
- return textSpanEndingAtNextToken(node, node.expression);
- case 208:
- return spanInInitializerOfForLike(node);
- case 213:
- return textSpanEndingAtNextToken(node, node.expression);
- case 249:
- case 250:
- return spanInNode(node.statements[0]);
- case 216:
- return spanInBlock(node.tryBlock);
- case 215:
- return textSpan(node, node.expression);
- case 235:
- return textSpan(node, node.expression);
- case 229:
- return textSpan(node, node.moduleReference);
- case 230:
- return textSpan(node, node.moduleSpecifier);
- case 236:
- return textSpan(node, node.moduleSpecifier);
- case 225:
- if (ts.getModuleInstanceState(node) !== 1) {
- return undefined;
- }
- case 221:
- case 224:
- case 255:
- case 169:
- return textSpan(node);
- case 212:
- return spanInNode(node.statement);
- case 143:
- return spanInNodeArray(node.parent.decorators);
- case 167:
- case 168:
- return spanInBindingPattern(node);
- case 222:
- case 223:
- return undefined;
- case 23:
- case 1:
- return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile));
- case 24:
- return spanInPreviousNode(node);
- case 15:
- return spanInOpenBraceToken(node);
- case 16:
- return spanInCloseBraceToken(node);
- case 20:
- return spanInCloseBracketToken(node);
- case 17:
- return spanInOpenParenToken(node);
- case 18:
- return spanInCloseParenToken(node);
- case 54:
- return spanInColonToken(node);
- case 27:
- case 25:
- return spanInGreaterThanOrLessThanToken(node);
- case 104:
- return spanInWhileKeyword(node);
- case 80:
- case 72:
- case 85:
- return spanInNextNode(node);
- case 138:
- return spanInOfKeyword(node);
- default:
- if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) {
- return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node);
- }
- if ((node.kind === 69 ||
- node.kind == 191 ||
- node.kind === 253 ||
- node.kind === 254) &&
- ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
- return textSpan(node);
- }
- if (node.kind === 187) {
- var binaryExpression = node;
- if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) {
- return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left);
- }
- if (binaryExpression.operatorToken.kind === 56 &&
- ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) {
- return textSpan(node);
- }
- if (binaryExpression.operatorToken.kind === 24) {
- return spanInNode(binaryExpression.left);
- }
- }
- if (ts.isPartOfExpression(node)) {
- switch (node.parent.kind) {
- case 204:
- return spanInPreviousNode(node);
- case 143:
- return spanInNode(node.parent);
- case 206:
- case 208:
- return textSpan(node);
- case 187:
- if (node.parent.operatorToken.kind === 24) {
- return textSpan(node);
- }
- break;
- case 180:
- if (node.parent.body === node) {
- return textSpan(node);
- }
- break;
- }
- }
- if (node.parent.kind === 253 &&
- node.parent.name === node &&
- !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) {
- return spanInNode(node.parent.initializer);
- }
- if (node.parent.kind === 177 && node.parent.type === node) {
- return spanInNextNode(node.parent.type);
- }
- if (ts.isFunctionLike(node.parent) && node.parent.type === node) {
- return spanInPreviousNode(node);
- }
- if ((node.parent.kind === 218 ||
- node.parent.kind === 142)) {
- var paramOrVarDecl = node.parent;
- if (paramOrVarDecl.initializer === node ||
- paramOrVarDecl.type === node ||
- ts.isAssignmentOperator(node.kind)) {
- return spanInPreviousNode(node);
- }
- }
- if (node.parent.kind === 187) {
- var binaryExpression = node.parent;
- if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) &&
- (binaryExpression.right === node ||
- binaryExpression.operatorToken === node)) {
- return spanInPreviousNode(node);
- }
- }
- return spanInNode(node.parent);
- }
+ ts.getStringLiteralTypeForNode = getStringLiteralTypeForNode;
+ function isThis(node) {
+ switch (node.kind) {
+ case 98:
+ return true;
+ case 70:
+ return ts.identifierIsThisKeyword(node) && node.parent.kind === 143;
+ default:
+ return false;
+ }
+ }
+ ts.isThis = isThis;
+ var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*;
+ function getLineStartPositionForPosition(position, sourceFile) {
+ var lineStarts = sourceFile.getLineStarts();
+ var line = sourceFile.getLineAndCharacterOfPosition(position).line;
+ return lineStarts[line];
+ }
+ ts.getLineStartPositionForPosition = getLineStartPositionForPosition;
+ function rangeContainsRange(r1, r2) {
+ return startEndContainsRange(r1.pos, r1.end, r2);
+ }
+ ts.rangeContainsRange = rangeContainsRange;
+ function startEndContainsRange(start, end, range) {
+ return start <= range.pos && end >= range.end;
+ }
+ ts.startEndContainsRange = startEndContainsRange;
+ function rangeContainsStartEnd(range, start, end) {
+ return range.pos <= start && range.end >= end;
+ }
+ ts.rangeContainsStartEnd = rangeContainsStartEnd;
+ function rangeOverlapsWithStartEnd(r1, start, end) {
+ return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end);
+ }
+ ts.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd;
+ function startEndOverlapsWithStartEnd(start1, end1, start2, end2) {
+ var start = Math.max(start1, start2);
+ var end = Math.min(end1, end2);
+ return start < end;
+ }
+ ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd;
+ function positionBelongsToNode(candidate, position, sourceFile) {
+ return candidate.end > position || !isCompletedNode(candidate, sourceFile);
+ }
+ ts.positionBelongsToNode = positionBelongsToNode;
+ function isCompletedNode(n, sourceFile) {
+ if (ts.nodeIsMissing(n)) {
+ return false;
+ }
+ switch (n.kind) {
+ case 222:
+ case 223:
+ case 225:
+ case 172:
+ case 168:
+ case 160:
+ case 200:
+ case 227:
+ case 228:
+ case 234:
+ case 238:
+ return nodeEndsWith(n, 17, sourceFile);
+ case 252:
+ return isCompletedNode(n.block, sourceFile);
+ case 176:
+ if (!n.arguments) {
+ return true;
}
- function textSpanFromVariableDeclaration(variableDeclaration) {
- var declarations = variableDeclaration.parent.declarations;
- if (declarations && declarations[0] === variableDeclaration) {
- return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration);
- }
- else {
- return textSpan(variableDeclaration);
- }
+ case 175:
+ case 179:
+ case 165:
+ return nodeEndsWith(n, 19, sourceFile);
+ case 157:
+ case 158:
+ return isCompletedNode(n.type, sourceFile);
+ case 149:
+ case 150:
+ case 151:
+ case 221:
+ case 180:
+ case 148:
+ case 147:
+ case 153:
+ case 152:
+ case 181:
+ if (n.body) {
+ return isCompletedNode(n.body, sourceFile);
}
- function spanInVariableDeclaration(variableDeclaration) {
- if (variableDeclaration.parent.parent.kind === 207) {
- return spanInNode(variableDeclaration.parent.parent);
- }
- if (ts.isBindingPattern(variableDeclaration.name)) {
- return spanInBindingPattern(variableDeclaration.name);
- }
- if (variableDeclaration.initializer ||
- ts.hasModifier(variableDeclaration, 1) ||
- variableDeclaration.parent.parent.kind === 208) {
- return textSpanFromVariableDeclaration(variableDeclaration);
- }
- var declarations = variableDeclaration.parent.declarations;
- if (declarations && declarations[0] !== variableDeclaration) {
- return spanInNode(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent));
- }
+ if (n.type) {
+ return isCompletedNode(n.type, sourceFile);
}
- function canHaveSpanInParameterDeclaration(parameter) {
- return !!parameter.initializer || parameter.dotDotDotToken !== undefined ||
- ts.hasModifier(parameter, 4 | 8);
+ return hasChildOfKind(n, 19, sourceFile);
+ case 226:
+ return n.body && isCompletedNode(n.body, sourceFile);
+ case 204:
+ if (n.elseStatement) {
+ return isCompletedNode(n.elseStatement, sourceFile);
}
- function spanInParameterDeclaration(parameter) {
- if (ts.isBindingPattern(parameter.name)) {
- return spanInBindingPattern(parameter.name);
- }
- else if (canHaveSpanInParameterDeclaration(parameter)) {
- return textSpan(parameter);
- }
- else {
- var functionDeclaration = parameter.parent;
- var indexOfParameter = ts.indexOf(functionDeclaration.parameters, parameter);
- if (indexOfParameter) {
- return spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]);
+ return isCompletedNode(n.thenStatement, sourceFile);
+ case 203:
+ return isCompletedNode(n.expression, sourceFile) ||
+ hasChildOfKind(n, 24);
+ case 171:
+ case 169:
+ case 174:
+ case 141:
+ case 162:
+ return nodeEndsWith(n, 21, sourceFile);
+ case 154:
+ if (n.type) {
+ return isCompletedNode(n.type, sourceFile);
+ }
+ return hasChildOfKind(n, 21, sourceFile);
+ case 249:
+ case 250:
+ return false;
+ case 207:
+ case 208:
+ case 209:
+ case 206:
+ return isCompletedNode(n.statement, sourceFile);
+ case 205:
+ var hasWhileKeyword = findChildOfKind(n, 105, sourceFile);
+ if (hasWhileKeyword) {
+ return nodeEndsWith(n, 19, sourceFile);
+ }
+ return isCompletedNode(n.statement, sourceFile);
+ case 159:
+ return isCompletedNode(n.exprName, sourceFile);
+ case 183:
+ case 182:
+ case 184:
+ case 191:
+ case 192:
+ var unaryWordExpression = n;
+ return isCompletedNode(unaryWordExpression.expression, sourceFile);
+ case 177:
+ return isCompletedNode(n.template, sourceFile);
+ case 190:
+ var lastSpan = ts.lastOrUndefined(n.templateSpans);
+ return isCompletedNode(lastSpan, sourceFile);
+ case 198:
+ return ts.nodeIsPresent(n.literal);
+ case 237:
+ case 231:
+ return ts.nodeIsPresent(n.moduleSpecifier);
+ case 186:
+ return isCompletedNode(n.operand, sourceFile);
+ case 188:
+ return isCompletedNode(n.right, sourceFile);
+ case 189:
+ return isCompletedNode(n.whenFalse, sourceFile);
+ default:
+ return true;
+ }
+ }
+ ts.isCompletedNode = isCompletedNode;
+ function nodeEndsWith(n, expectedLastToken, sourceFile) {
+ var children = n.getChildren(sourceFile);
+ if (children.length) {
+ var last = ts.lastOrUndefined(children);
+ if (last.kind === expectedLastToken) {
+ return true;
+ }
+ else if (last.kind === 24 && children.length !== 1) {
+ return children[children.length - 2].kind === expectedLastToken;
+ }
+ }
+ return false;
+ }
+ function findListItemInfo(node) {
+ var list = findContainingList(node);
+ if (!list) {
+ return undefined;
+ }
+ var children = list.getChildren();
+ var listItemIndex = ts.indexOf(children, node);
+ return {
+ listItemIndex: listItemIndex,
+ list: list
+ };
+ }
+ ts.findListItemInfo = findListItemInfo;
+ function hasChildOfKind(n, kind, sourceFile) {
+ return !!findChildOfKind(n, kind, sourceFile);
+ }
+ ts.hasChildOfKind = hasChildOfKind;
+ function findChildOfKind(n, kind, sourceFile) {
+ return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; });
+ }
+ ts.findChildOfKind = findChildOfKind;
+ function findContainingList(node) {
+ var syntaxList = ts.forEach(node.parent.getChildren(), function (c) {
+ if (c.kind === 286 && c.pos <= node.pos && c.end >= node.end) {
+ return c;
+ }
+ });
+ ts.Debug.assert(!syntaxList || ts.contains(syntaxList.getChildren(), node));
+ return syntaxList;
+ }
+ ts.findContainingList = findContainingList;
+ function getTouchingWord(sourceFile, position, includeJsDocComment) {
+ if (includeJsDocComment === void 0) { includeJsDocComment = false; }
+ return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }, includeJsDocComment);
+ }
+ ts.getTouchingWord = getTouchingWord;
+ function getTouchingPropertyName(sourceFile, position, includeJsDocComment) {
+ if (includeJsDocComment === void 0) { includeJsDocComment = false; }
+ return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }, includeJsDocComment);
+ }
+ ts.getTouchingPropertyName = getTouchingPropertyName;
+ function getTouchingToken(sourceFile, position, includeItemAtEndPosition, includeJsDocComment) {
+ if (includeJsDocComment === void 0) { includeJsDocComment = false; }
+ return getTokenAtPositionWorker(sourceFile, position, false, includeItemAtEndPosition, includeJsDocComment);
+ }
+ ts.getTouchingToken = getTouchingToken;
+ function getTokenAtPosition(sourceFile, position, includeJsDocComment) {
+ if (includeJsDocComment === void 0) { includeJsDocComment = false; }
+ return getTokenAtPositionWorker(sourceFile, position, true, undefined, includeJsDocComment);
+ }
+ ts.getTokenAtPosition = getTokenAtPosition;
+ function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition, includeJsDocComment) {
+ if (includeJsDocComment === void 0) { includeJsDocComment = false; }
+ var current = sourceFile;
+ outer: while (true) {
+ if (isToken(current)) {
+ return current;
+ }
+ if (includeJsDocComment) {
+ var jsDocChildren = ts.filter(current.getChildren(), ts.isJSDocNode);
+ for (var _i = 0, jsDocChildren_1 = jsDocChildren; _i < jsDocChildren_1.length; _i++) {
+ var jsDocChild = jsDocChildren_1[_i];
+ var start = allowPositionInLeadingTrivia ? jsDocChild.getFullStart() : jsDocChild.getStart(sourceFile, includeJsDocComment);
+ if (start <= position) {
+ var end = jsDocChild.getEnd();
+ if (position < end || (position === end && jsDocChild.kind === 1)) {
+ current = jsDocChild;
+ continue outer;
}
- else {
- return spanInNode(functionDeclaration.body);
+ else if (includeItemAtEndPosition && end === position) {
+ var previousToken = findPrecedingToken(position, sourceFile, jsDocChild);
+ if (previousToken && includeItemAtEndPosition(previousToken)) {
+ return previousToken;
+ }
}
}
}
- function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) {
- return ts.hasModifier(functionDeclaration, 1) ||
- (functionDeclaration.parent.kind === 221 && functionDeclaration.kind !== 148);
+ }
+ for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) {
+ var child = current.getChildAt(i);
+ if (ts.isJSDocNode(child)) {
+ continue;
}
- function spanInFunctionDeclaration(functionDeclaration) {
- if (!functionDeclaration.body) {
- return undefined;
- }
- if (canFunctionHaveSpanInWholeDeclaration(functionDeclaration)) {
- return textSpan(functionDeclaration);
+ var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, includeJsDocComment);
+ if (start <= position) {
+ var end = child.getEnd();
+ if (position < end || (position === end && child.kind === 1)) {
+ current = child;
+ continue outer;
}
- return spanInNode(functionDeclaration.body);
- }
- function spanInFunctionBlock(block) {
- var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken();
- if (canFunctionHaveSpanInWholeDeclaration(block.parent)) {
- return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock);
+ else if (includeItemAtEndPosition && end === position) {
+ var previousToken = findPrecedingToken(position, sourceFile, child);
+ if (previousToken && includeItemAtEndPosition(previousToken)) {
+ return previousToken;
+ }
}
- return spanInNode(nodeForSpanInBlock);
}
- function spanInBlock(block) {
- switch (block.parent.kind) {
- case 225:
- if (ts.getModuleInstanceState(block.parent) !== 1) {
- return undefined;
- }
- case 205:
- case 203:
- case 207:
- return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
- case 206:
- case 208:
- return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
- }
- return spanInNode(block.statements[0]);
+ }
+ return current;
+ }
+ }
+ function findTokenOnLeftOfPosition(file, position) {
+ var tokenAtPosition = getTokenAtPosition(file, position);
+ if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) {
+ return tokenAtPosition;
+ }
+ return findPrecedingToken(position, file);
+ }
+ ts.findTokenOnLeftOfPosition = findTokenOnLeftOfPosition;
+ function findNextToken(previousToken, parent) {
+ return find(parent);
+ function find(n) {
+ if (isToken(n) && n.pos === previousToken.end) {
+ return n;
+ }
+ var children = n.getChildren();
+ for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
+ var child = children_2[_i];
+ var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) ||
+ (child.pos === previousToken.end);
+ if (shouldDiveInChildNode && nodeHasTokens(child)) {
+ return find(child);
}
- function spanInInitializerOfForLike(forLikeStatement) {
- if (forLikeStatement.initializer.kind === 219) {
- var variableDeclarationList = forLikeStatement.initializer;
- if (variableDeclarationList.declarations.length > 0) {
- return spanInNode(variableDeclarationList.declarations[0]);
- }
+ }
+ return undefined;
+ }
+ }
+ ts.findNextToken = findNextToken;
+ function findPrecedingToken(position, sourceFile, startNode) {
+ return find(startNode || sourceFile);
+ function findRightmostToken(n) {
+ if (isToken(n)) {
+ return n;
+ }
+ var children = n.getChildren();
+ var candidate = findRightmostChildNodeWithTokens(children, children.length);
+ return candidate && findRightmostToken(candidate);
+ }
+ function find(n) {
+ if (isToken(n)) {
+ return n;
+ }
+ var children = n.getChildren();
+ for (var i = 0, len = children.length; i < len; i++) {
+ var child = children[i];
+ if (position < child.end && (nodeHasTokens(child) || child.kind === 10)) {
+ var start = child.getStart(sourceFile);
+ var lookInPreviousChild = (start >= position) ||
+ (child.kind === 10 && start === child.end);
+ if (lookInPreviousChild) {
+ var candidate = findRightmostChildNodeWithTokens(children, i);
+ return candidate && findRightmostToken(candidate);
}
else {
- return spanInNode(forLikeStatement.initializer);
+ return find(child);
}
}
- function spanInForStatement(forStatement) {
- if (forStatement.initializer) {
- return spanInInitializerOfForLike(forStatement);
- }
- if (forStatement.condition) {
- return textSpan(forStatement.condition);
- }
- if (forStatement.incrementor) {
- return textSpan(forStatement.incrementor);
- }
- }
- function spanInBindingPattern(bindingPattern) {
- var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 193 ? element : undefined; });
- if (firstBindingElement) {
- return spanInNode(firstBindingElement);
- }
- if (bindingPattern.parent.kind === 169) {
- return textSpan(bindingPattern.parent);
- }
- return textSpanFromVariableDeclaration(bindingPattern.parent);
- }
- function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- ts.Debug.assert(node.kind !== 168 && node.kind !== 167);
- var elements = node.kind === 170 ?
- node.elements :
- node.properties;
- var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 193 ? element : undefined; });
- if (firstBindingElement) {
- return spanInNode(firstBindingElement);
- }
- return textSpan(node.parent.kind === 187 ? node.parent : node);
- }
- function spanInOpenBraceToken(node) {
- switch (node.parent.kind) {
- case 224:
- var enumDeclaration = node.parent;
- return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile));
- case 221:
- var classDeclaration = node.parent;
- return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile));
- case 227:
- return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]);
- }
- return spanInNode(node.parent);
- }
- function spanInCloseBraceToken(node) {
- switch (node.parent.kind) {
- case 226:
- if (ts.getModuleInstanceState(node.parent.parent) !== 1) {
- return undefined;
- }
- case 224:
- case 221:
- return textSpan(node);
- case 199:
- if (ts.isFunctionBlock(node.parent)) {
- return textSpan(node);
- }
- case 252:
- return spanInNode(ts.lastOrUndefined(node.parent.statements));
- case 227:
- var caseBlock = node.parent;
- var lastClause = ts.lastOrUndefined(caseBlock.clauses);
- if (lastClause) {
- return spanInNode(ts.lastOrUndefined(lastClause.statements));
- }
- return undefined;
- case 167:
- var bindingPattern = node.parent;
- return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
- default:
- if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
- var objectLiteral = node.parent;
- return textSpan(ts.lastOrUndefined(objectLiteral.properties) || objectLiteral);
- }
- return spanInNode(node.parent);
- }
- }
- function spanInCloseBracketToken(node) {
- switch (node.parent.kind) {
- case 168:
- var bindingPattern = node.parent;
- return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
- default:
- if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
- var arrayLiteral = node.parent;
- return textSpan(ts.lastOrUndefined(arrayLiteral.elements) || arrayLiteral);
- }
- return spanInNode(node.parent);
- }
- }
- function spanInOpenParenToken(node) {
- if (node.parent.kind === 204 ||
- node.parent.kind === 174 ||
- node.parent.kind === 175) {
- return spanInPreviousNode(node);
- }
- if (node.parent.kind === 178) {
- return spanInNextNode(node);
- }
- return spanInNode(node.parent);
- }
- function spanInCloseParenToken(node) {
- switch (node.parent.kind) {
- case 179:
- case 220:
- case 180:
- case 147:
- case 146:
- case 149:
- case 150:
- case 148:
- case 205:
- case 204:
- case 206:
- case 208:
- case 174:
- case 175:
- case 178:
- return spanInPreviousNode(node);
- default:
- return spanInNode(node.parent);
- }
- }
- function spanInColonToken(node) {
- if (ts.isFunctionLike(node.parent) ||
- node.parent.kind === 253 ||
- node.parent.kind === 142) {
- return spanInPreviousNode(node);
- }
- return spanInNode(node.parent);
- }
- function spanInGreaterThanOrLessThanToken(node) {
- if (node.parent.kind === 177) {
- return spanInNextNode(node);
- }
- return spanInNode(node.parent);
- }
- function spanInWhileKeyword(node) {
- if (node.parent.kind === 204) {
- return textSpanEndingAtNextToken(node, node.parent.expression);
- }
- return spanInNode(node.parent);
- }
- function spanInOfKeyword(node) {
- if (node.parent.kind === 208) {
- return spanInNextNode(node);
- }
- return spanInNode(node.parent);
- }
+ }
+ ts.Debug.assert(startNode !== undefined || n.kind === 256);
+ if (children.length) {
+ var candidate = findRightmostChildNodeWithTokens(children, children.length);
+ return candidate && findRightmostToken(candidate);
}
}
- BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation;
- })(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function createClassifier() {
- var scanner = ts.createScanner(2, false);
- var noRegexTable = [];
- noRegexTable[69] = true;
- noRegexTable[9] = true;
- noRegexTable[8] = true;
- noRegexTable[10] = true;
- noRegexTable[97] = true;
- noRegexTable[41] = true;
- noRegexTable[42] = true;
- noRegexTable[18] = true;
- noRegexTable[20] = true;
- noRegexTable[16] = true;
- noRegexTable[99] = true;
- noRegexTable[84] = true;
- var templateStack = [];
- function canFollow(keyword1, keyword2) {
- if (ts.isAccessibilityModifier(keyword1)) {
- if (keyword2 === 123 ||
- keyword2 === 131 ||
- keyword2 === 121 ||
- keyword2 === 113) {
- return true;
+ function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) {
+ for (var i = exclusiveStartPosition - 1; i >= 0; i--) {
+ if (nodeHasTokens(children[i])) {
+ return children[i];
}
- return false;
}
- return true;
}
- function convertClassifications(classifications, text) {
- var entries = [];
- var dense = classifications.spans;
- var lastEnd = 0;
- for (var i = 0, n = dense.length; i < n; i += 3) {
- var start = dense[i];
- var length_4 = dense[i + 1];
- var type = dense[i + 2];
- if (lastEnd >= 0) {
- var whitespaceLength_1 = start - lastEnd;
- if (whitespaceLength_1 > 0) {
- entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace });
- }
- }
- entries.push({ length: length_4, classification: convertClassification(type) });
- lastEnd = start + length_4;
+ }
+ ts.findPrecedingToken = findPrecedingToken;
+ function isInString(sourceFile, position) {
+ var previousToken = findPrecedingToken(position, sourceFile);
+ if (previousToken && previousToken.kind === 9) {
+ var start = previousToken.getStart();
+ var end = previousToken.getEnd();
+ if (start < position && position < end) {
+ return true;
}
- var whitespaceLength = text.length - lastEnd;
- if (whitespaceLength > 0) {
- entries.push({ length: whitespaceLength, classification: ts.TokenClass.Whitespace });
+ if (position === end) {
+ return !!previousToken.isUnterminated;
}
- return { entries: entries, finalLexState: classifications.endOfLineState };
}
- function convertClassification(type) {
- switch (type) {
- case 1: return ts.TokenClass.Comment;
- case 3: return ts.TokenClass.Keyword;
- case 4: return ts.TokenClass.NumberLiteral;
- case 5: return ts.TokenClass.Operator;
- case 6: return ts.TokenClass.StringLiteral;
- case 8: return ts.TokenClass.Whitespace;
- case 10: return ts.TokenClass.Punctuation;
- case 2:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 9:
- case 17:
- default:
- return ts.TokenClass.Identifier;
- }
+ return false;
+ }
+ ts.isInString = isInString;
+ function isInComment(sourceFile, position) {
+ return isInCommentHelper(sourceFile, position, undefined);
+ }
+ ts.isInComment = isInComment;
+ function isInsideJsxElementOrAttribute(sourceFile, position) {
+ var token = getTokenAtPosition(sourceFile, position);
+ if (!token) {
+ return false;
}
- function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {
- return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
+ if (token.kind === 10) {
+ return true;
}
- function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) {
- var offset = 0;
- var token = 0;
- var lastNonTriviaToken = 0;
- while (templateStack.length > 0) {
- templateStack.pop();
- }
- switch (lexState) {
- case 3:
- text = "\"\\\n" + text;
- offset = 3;
- break;
- case 2:
- text = "'\\\n" + text;
- offset = 3;
- break;
- case 1:
- text = "/*\n" + text;
- offset = 3;
- break;
- case 4:
- text = "`\n" + text;
- offset = 2;
+ if (token.kind === 26 && token.parent.kind === 10) {
+ return true;
+ }
+ if (token.kind === 26 && token.parent.kind === 248) {
+ return true;
+ }
+ if (token && token.kind === 17 && token.parent.kind === 248) {
+ return true;
+ }
+ if (token.kind === 26 && token.parent.kind === 245) {
+ return true;
+ }
+ return false;
+ }
+ ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute;
+ function isInTemplateString(sourceFile, position) {
+ var token = getTokenAtPosition(sourceFile, position);
+ return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile);
+ }
+ ts.isInTemplateString = isInTemplateString;
+ function isInCommentHelper(sourceFile, position, predicate) {
+ var token = getTokenAtPosition(sourceFile, position);
+ if (token && position <= token.getStart(sourceFile)) {
+ var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
+ return predicate ?
+ ts.forEach(commentRanges, function (c) { return c.pos < position &&
+ (c.kind == 2 ? position <= c.end : position < c.end) &&
+ predicate(c); }) :
+ ts.forEach(commentRanges, function (c) { return c.pos < position &&
+ (c.kind == 2 ? position <= c.end : position < c.end); });
+ }
+ return false;
+ }
+ ts.isInCommentHelper = isInCommentHelper;
+ function hasDocComment(sourceFile, position) {
+ var token = getTokenAtPosition(sourceFile, position);
+ var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
+ return ts.forEach(commentRanges, jsDocPrefix);
+ function jsDocPrefix(c) {
+ var text = sourceFile.text;
+ return text.length >= c.pos + 3 && text[c.pos] === "/" && text[c.pos + 1] === "*" && text[c.pos + 2] === "*";
+ }
+ }
+ ts.hasDocComment = hasDocComment;
+ function getJsDocTagAtPosition(sourceFile, position) {
+ var node = ts.getTokenAtPosition(sourceFile, position);
+ if (isToken(node)) {
+ switch (node.kind) {
+ case 103:
+ case 109:
+ case 75:
+ node = node.parent === undefined ? undefined : node.parent.parent;
break;
- case 5:
- text = "}\n" + text;
- offset = 2;
- case 6:
- templateStack.push(12);
+ default:
+ node = node.parent;
break;
}
- scanner.setText(text);
- var result = {
- endOfLineState: 0,
- spans: []
- };
- var angleBracketStack = 0;
- do {
- token = scanner.scan();
- if (!ts.isTrivia(token)) {
- if ((token === 39 || token === 61) && !noRegexTable[lastNonTriviaToken]) {
- if (scanner.reScanSlashToken() === 10) {
- token = 10;
- }
- }
- else if (lastNonTriviaToken === 21 && isKeyword(token)) {
- token = 69;
- }
- else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {
- token = 69;
- }
- else if (lastNonTriviaToken === 69 &&
- token === 25) {
- angleBracketStack++;
- }
- else if (token === 27 && angleBracketStack > 0) {
- angleBracketStack--;
- }
- else if (token === 117 ||
- token === 132 ||
- token === 130 ||
- token === 120 ||
- token === 133) {
- if (angleBracketStack > 0 && !syntacticClassifierAbsent) {
- token = 69;
- }
- }
- else if (token === 12) {
- templateStack.push(token);
- }
- else if (token === 15) {
- if (templateStack.length > 0) {
- templateStack.push(token);
- }
- }
- else if (token === 16) {
- if (templateStack.length > 0) {
- var lastTemplateStackToken = ts.lastOrUndefined(templateStack);
- if (lastTemplateStackToken === 12) {
- token = scanner.reScanTemplateToken();
- if (token === 14) {
- templateStack.pop();
- }
- else {
- ts.Debug.assert(token === 13, "Should have been a template middle. Was " + token);
- }
- }
- else {
- ts.Debug.assert(lastTemplateStackToken === 15, "Should have been an open brace. Was: " + token);
- templateStack.pop();
- }
- }
- }
- lastNonTriviaToken = token;
- }
- processToken();
- } while (token !== 1);
- return result;
- function processToken() {
- var start = scanner.getTokenPos();
- var end = scanner.getTextPos();
- addResult(start, end, classFromKind(token));
- if (end >= text.length) {
- if (token === 9) {
- var tokenText = scanner.getTokenText();
- if (scanner.isUnterminated()) {
- var lastCharIndex = tokenText.length - 1;
- var numBackslashes = 0;
- while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92) {
- numBackslashes++;
- }
- if (numBackslashes & 1) {
- var quoteChar = tokenText.charCodeAt(0);
- result.endOfLineState = quoteChar === 34
- ? 3
- : 2;
- }
- }
- }
- else if (token === 3) {
- if (scanner.isUnterminated()) {
- result.endOfLineState = 1;
- }
- }
- else if (ts.isTemplateLiteralKind(token)) {
- if (scanner.isUnterminated()) {
- if (token === 14) {
- result.endOfLineState = 5;
- }
- else if (token === 11) {
- result.endOfLineState = 4;
- }
- else {
- ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token);
+ }
+ if (node) {
+ if (node.jsDocComments) {
+ for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
+ var jsDocComment = _a[_i];
+ if (jsDocComment.tags) {
+ for (var _b = 0, _c = jsDocComment.tags; _b < _c.length; _b++) {
+ var tag = _c[_b];
+ if (tag.pos <= position && position <= tag.end) {
+ return tag;
}
}
}
- else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 12) {
- result.endOfLineState = 6;
- }
- }
- }
- function addResult(start, end, classification) {
- if (classification === 8) {
- return;
- }
- if (start === 0 && offset > 0) {
- start += offset;
- }
- start -= offset;
- end -= offset;
- var length = end - start;
- if (length > 0) {
- result.spans.push(start);
- result.spans.push(length);
- result.spans.push(classification);
}
}
}
- function isBinaryExpressionOperatorToken(token) {
- switch (token) {
- case 37:
- case 39:
- case 40:
- case 35:
- case 36:
- case 43:
- case 44:
- case 45:
- case 25:
- case 27:
- case 28:
- case 29:
- case 91:
- case 90:
- case 116:
- case 30:
- case 31:
- case 32:
- case 33:
- case 46:
- case 48:
- case 47:
- case 51:
- case 52:
- case 67:
- case 66:
- case 68:
- case 63:
- case 64:
- case 65:
- case 57:
- case 58:
- case 59:
- case 61:
- case 62:
- case 56:
- case 24:
- return true;
- default:
- return false;
- }
+ return undefined;
+ }
+ ts.getJsDocTagAtPosition = getJsDocTagAtPosition;
+ function nodeHasTokens(n) {
+ return n.getWidth() !== 0;
+ }
+ function getNodeModifiers(node) {
+ var flags = ts.getCombinedModifierFlags(node);
+ var result = [];
+ if (flags & 8)
+ result.push(ts.ScriptElementKindModifier.privateMemberModifier);
+ if (flags & 16)
+ result.push(ts.ScriptElementKindModifier.protectedMemberModifier);
+ if (flags & 4)
+ result.push(ts.ScriptElementKindModifier.publicMemberModifier);
+ if (flags & 32)
+ result.push(ts.ScriptElementKindModifier.staticModifier);
+ if (flags & 128)
+ result.push(ts.ScriptElementKindModifier.abstractModifier);
+ if (flags & 1)
+ result.push(ts.ScriptElementKindModifier.exportedModifier);
+ if (ts.isInAmbientContext(node))
+ result.push(ts.ScriptElementKindModifier.ambientModifier);
+ return result.length > 0 ? result.join(",") : ts.ScriptElementKindModifier.none;
+ }
+ ts.getNodeModifiers = getNodeModifiers;
+ function getTypeArgumentOrTypeParameterList(node) {
+ if (node.kind === 156 || node.kind === 175) {
+ return node.typeArguments;
}
- function isPrefixUnaryExpressionOperatorToken(token) {
- switch (token) {
- case 35:
- case 36:
- case 50:
- case 49:
- case 41:
- case 42:
- return true;
- default:
- return false;
- }
+ if (ts.isFunctionLike(node) || node.kind === 222 || node.kind === 223) {
+ return node.typeParameters;
}
- function isKeyword(token) {
- return token >= 70 && token <= 138;
+ return undefined;
+ }
+ ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList;
+ function isToken(n) {
+ return n.kind >= 0 && n.kind <= 139;
+ }
+ ts.isToken = isToken;
+ function isWord(kind) {
+ return kind === 70 || ts.isKeyword(kind);
+ }
+ ts.isWord = isWord;
+ function isPropertyName(kind) {
+ return kind === 9 || kind === 8 || isWord(kind);
+ }
+ function isComment(kind) {
+ return kind === 2 || kind === 3;
+ }
+ ts.isComment = isComment;
+ function isStringOrRegularExpressionOrTemplateLiteral(kind) {
+ if (kind === 9
+ || kind === 11
+ || ts.isTemplateLiteralKind(kind)) {
+ return true;
}
- function classFromKind(token) {
- if (isKeyword(token)) {
- return 3;
- }
- else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) {
- return 5;
- }
- else if (token >= 15 && token <= 68) {
- return 10;
- }
- switch (token) {
- case 8:
- return 4;
- case 9:
- return 6;
- case 10:
- return 7;
- case 7:
- case 3:
- case 2:
- return 1;
- case 5:
- case 4:
- return 8;
- case 69:
- default:
- if (ts.isTemplateLiteralKind(token)) {
- return 6;
- }
- return 2;
- }
- }
- return {
- getClassificationsForLine: getClassificationsForLine,
- getEncodedLexicalClassifications: getEncodedLexicalClassifications
- };
+ return false;
}
- ts.createClassifier = createClassifier;
- function getSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) {
- return convertClassifications(getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span));
+ ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral;
+ function isPunctuation(kind) {
+ return 16 <= kind && kind <= 69;
}
- ts.getSemanticClassifications = getSemanticClassifications;
- function checkForClassificationCancellation(cancellationToken, kind) {
+ ts.isPunctuation = isPunctuation;
+ function isInsideTemplateLiteral(node, position) {
+ return ts.isTemplateLiteralKind(node.kind)
+ && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd());
+ }
+ ts.isInsideTemplateLiteral = isInsideTemplateLiteral;
+ function isAccessibilityModifier(kind) {
switch (kind) {
- case 225:
- case 221:
- case 222:
- case 220:
- cancellationToken.throwIfCancellationRequested();
+ case 113:
+ case 111:
+ case 112:
+ return true;
}
+ return false;
}
- function getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) {
- var result = [];
- processNode(sourceFile);
- return { spans: result, endOfLineState: 0 };
- function pushClassification(start, length, type) {
- result.push(start);
- result.push(length);
- result.push(type);
- }
- function classifySymbol(symbol, meaningAtPosition) {
- var flags = symbol.getFlags();
- if ((flags & 788448) === 0) {
- return;
- }
- if (flags & 32) {
- return 11;
- }
- else if (flags & 384) {
- return 12;
- }
- else if (flags & 524288) {
- return 16;
- }
- else if (meaningAtPosition & 2) {
- if (flags & 64) {
- return 13;
- }
- else if (flags & 262144) {
- return 15;
+ ts.isAccessibilityModifier = isAccessibilityModifier;
+ function compareDataObjects(dst, src) {
+ for (var e in dst) {
+ if (typeof dst[e] === "object") {
+ if (!compareDataObjects(dst[e], src[e])) {
+ return false;
}
}
- else if (flags & 1536) {
- if (meaningAtPosition & 4 ||
- (meaningAtPosition & 1 && hasValueSideModule(symbol))) {
- return 14;
+ else if (typeof dst[e] !== "function") {
+ if (dst[e] !== src[e]) {
+ return false;
}
}
- return undefined;
- function hasValueSideModule(symbol) {
- return ts.forEach(symbol.declarations, function (declaration) {
- return declaration.kind === 225 &&
- ts.getModuleInstanceState(declaration) === 1;
- });
- }
}
- function processNode(node) {
- if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) {
- var kind = node.kind;
- checkForClassificationCancellation(cancellationToken, kind);
- if (kind === 69 && !ts.nodeIsMissing(node)) {
- var identifier = node;
- if (classifiableNames[identifier.text]) {
- var symbol = typeChecker.getSymbolAtLocation(node);
- if (symbol) {
- var type = classifySymbol(symbol, ts.getMeaningFromLocation(node));
- if (type) {
- pushClassification(node.getStart(), node.getWidth(), type);
- }
- }
- }
- }
- ts.forEachChild(node, processNode);
+ return true;
+ }
+ ts.compareDataObjects = compareDataObjects;
+ function isArrayLiteralOrObjectLiteralDestructuringPattern(node) {
+ if (node.kind === 171 ||
+ node.kind === 172) {
+ if (node.parent.kind === 188 &&
+ node.parent.left === node &&
+ node.parent.operatorToken.kind === 57) {
+ return true;
+ }
+ if (node.parent.kind === 209 &&
+ node.parent.initializer === node) {
+ return true;
+ }
+ if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 253 ? node.parent.parent : node.parent)) {
+ return true;
}
}
+ return false;
}
- ts.getEncodedSemanticClassifications = getEncodedSemanticClassifications;
- function getClassificationTypeName(type) {
- switch (type) {
- case 1: return ts.ClassificationTypeNames.comment;
- case 2: return ts.ClassificationTypeNames.identifier;
- case 3: return ts.ClassificationTypeNames.keyword;
- case 4: return ts.ClassificationTypeNames.numericLiteral;
- case 5: return ts.ClassificationTypeNames.operator;
- case 6: return ts.ClassificationTypeNames.stringLiteral;
- case 8: return ts.ClassificationTypeNames.whiteSpace;
- case 9: return ts.ClassificationTypeNames.text;
- case 10: return ts.ClassificationTypeNames.punctuation;
- case 11: return ts.ClassificationTypeNames.className;
- case 12: return ts.ClassificationTypeNames.enumName;
- case 13: return ts.ClassificationTypeNames.interfaceName;
- case 14: return ts.ClassificationTypeNames.moduleName;
- case 15: return ts.ClassificationTypeNames.typeParameterName;
- case 16: return ts.ClassificationTypeNames.typeAliasName;
- case 17: return ts.ClassificationTypeNames.parameterName;
- case 18: return ts.ClassificationTypeNames.docCommentTagName;
- case 19: return ts.ClassificationTypeNames.jsxOpenTagName;
- case 20: return ts.ClassificationTypeNames.jsxCloseTagName;
- case 21: return ts.ClassificationTypeNames.jsxSelfClosingTagName;
- case 22: return ts.ClassificationTypeNames.jsxAttribute;
- case 23: return ts.ClassificationTypeNames.jsxText;
- case 24: return ts.ClassificationTypeNames.jsxAttributeStringLiteralValue;
+ ts.isArrayLiteralOrObjectLiteralDestructuringPattern = isArrayLiteralOrObjectLiteralDestructuringPattern;
+ function hasTrailingDirectorySeparator(path) {
+ var lastCharacter = path.charAt(path.length - 1);
+ return lastCharacter === "/" || lastCharacter === "\\";
+ }
+ ts.hasTrailingDirectorySeparator = hasTrailingDirectorySeparator;
+ function isInReferenceComment(sourceFile, position) {
+ return isInCommentHelper(sourceFile, position, isReferenceComment);
+ function isReferenceComment(c) {
+ var commentText = sourceFile.text.substring(c.pos, c.end);
+ return tripleSlashDirectivePrefixRegex.test(commentText);
}
}
- function convertClassifications(classifications) {
- ts.Debug.assert(classifications.spans.length % 3 === 0);
- var dense = classifications.spans;
- var result = [];
- for (var i = 0, n = dense.length; i < n; i += 3) {
- result.push({
- textSpan: ts.createTextSpan(dense[i], dense[i + 1]),
- classificationType: getClassificationTypeName(dense[i + 2])
- });
+ ts.isInReferenceComment = isInReferenceComment;
+ function isInNonReferenceComment(sourceFile, position) {
+ return isInCommentHelper(sourceFile, position, isNonReferenceComment);
+ function isNonReferenceComment(c) {
+ var commentText = sourceFile.text.substring(c.pos, c.end);
+ return !tripleSlashDirectivePrefixRegex.test(commentText);
}
- return result;
}
- function getSyntacticClassifications(cancellationToken, sourceFile, span) {
- return convertClassifications(getEncodedSyntacticClassifications(cancellationToken, sourceFile, span));
+ ts.isInNonReferenceComment = isInNonReferenceComment;
+})(ts || (ts = {}));
+(function (ts) {
+ function isFirstDeclarationOfSymbolParameter(symbol) {
+ return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 143;
}
- ts.getSyntacticClassifications = getSyntacticClassifications;
- function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span) {
- var spanStart = span.start;
- var spanLength = span.length;
- var triviaScanner = ts.createScanner(2, false, sourceFile.languageVariant, sourceFile.text);
- var mergeConflictScanner = ts.createScanner(2, false, sourceFile.languageVariant, sourceFile.text);
- var result = [];
- processElement(sourceFile);
- return { spans: result, endOfLineState: 0 };
- function pushClassification(start, length, type) {
- result.push(start);
- result.push(length);
- result.push(type);
- }
- function classifyLeadingTriviaAndGetTokenStart(token) {
- triviaScanner.setTextPos(token.pos);
- while (true) {
- var start = triviaScanner.getTextPos();
- if (!ts.couldStartTrivia(sourceFile.text, start)) {
- return start;
- }
- var kind = triviaScanner.scan();
- var end = triviaScanner.getTextPos();
- var width = end - start;
- if (!ts.isTrivia(kind)) {
- return start;
- }
- if (kind === 4 || kind === 5) {
- continue;
- }
- if (ts.isComment(kind)) {
- classifyComment(token, kind, start, width);
- triviaScanner.setTextPos(end);
- continue;
- }
- if (kind === 7) {
- var text = sourceFile.text;
- var ch = text.charCodeAt(start);
- if (ch === 60 || ch === 62) {
- pushClassification(start, width, 1);
- continue;
- }
- ts.Debug.assert(ch === 61);
- classifyDisabledMergeCode(text, start, end);
- }
- }
- }
- function classifyComment(token, kind, start, width) {
- if (kind === 3) {
- var docCommentAndDiagnostics = ts.parseIsolatedJSDocComment(sourceFile.text, start, width);
- if (docCommentAndDiagnostics && docCommentAndDiagnostics.jsDoc) {
- docCommentAndDiagnostics.jsDoc.parent = token;
- classifyJSDocComment(docCommentAndDiagnostics.jsDoc);
- return;
+ ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter;
+ var displayPartWriter = getDisplayPartWriter();
+ function getDisplayPartWriter() {
+ var displayParts;
+ var lineStart;
+ var indent;
+ resetWriter();
+ return {
+ displayParts: function () { return displayParts; },
+ writeKeyword: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.keyword); },
+ writeOperator: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.operator); },
+ writePunctuation: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.punctuation); },
+ writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); },
+ writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); },
+ writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); },
+ writeSymbol: writeSymbol,
+ writeLine: writeLine,
+ increaseIndent: function () { indent++; },
+ decreaseIndent: function () { indent--; },
+ clear: resetWriter,
+ trackSymbol: function () { },
+ reportInaccessibleThisError: function () { }
+ };
+ function writeIndent() {
+ if (lineStart) {
+ var indentString = ts.getIndentString(indent);
+ if (indentString) {
+ displayParts.push(displayPart(indentString, ts.SymbolDisplayPartKind.space));
}
+ lineStart = false;
}
- pushCommentRange(start, width);
}
- function pushCommentRange(start, width) {
- pushClassification(start, width, 1);
- }
- function classifyJSDocComment(docComment) {
- var pos = docComment.pos;
- if (docComment.tags) {
- for (var _i = 0, _a = docComment.tags; _i < _a.length; _i++) {
- var tag = _a[_i];
- if (tag.pos !== pos) {
- pushCommentRange(pos, tag.pos - pos);
- }
- pushClassification(tag.atToken.pos, tag.atToken.end - tag.atToken.pos, 10);
- pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18);
- pos = tag.tagName.end;
- switch (tag.kind) {
- case 275:
- processJSDocParameterTag(tag);
- break;
- case 278:
- processJSDocTemplateTag(tag);
- break;
- case 277:
- processElement(tag.typeExpression);
- break;
- case 276:
- processElement(tag.typeExpression);
- break;
- }
- pos = tag.end;
- }
- }
- if (pos !== docComment.end) {
- pushCommentRange(pos, docComment.end - pos);
- }
- return;
- function processJSDocParameterTag(tag) {
- if (tag.preParameterName) {
- pushCommentRange(pos, tag.preParameterName.pos - pos);
- pushClassification(tag.preParameterName.pos, tag.preParameterName.end - tag.preParameterName.pos, 17);
- pos = tag.preParameterName.end;
- }
- if (tag.typeExpression) {
- pushCommentRange(pos, tag.typeExpression.pos - pos);
- processElement(tag.typeExpression);
- pos = tag.typeExpression.end;
- }
- if (tag.postParameterName) {
- pushCommentRange(pos, tag.postParameterName.pos - pos);
- pushClassification(tag.postParameterName.pos, tag.postParameterName.end - tag.postParameterName.pos, 17);
- pos = tag.postParameterName.end;
- }
- }
+ function writeKind(text, kind) {
+ writeIndent();
+ displayParts.push(displayPart(text, kind));
}
- function processJSDocTemplateTag(tag) {
- for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) {
- var child = _a[_i];
- processElement(child);
- }
+ function writeSymbol(text, symbol) {
+ writeIndent();
+ displayParts.push(symbolPart(text, symbol));
}
- function classifyDisabledMergeCode(text, start, end) {
- var i;
- for (i = start; i < end; i++) {
- if (ts.isLineBreak(text.charCodeAt(i))) {
- break;
- }
- }
- pushClassification(start, i - start, 1);
- mergeConflictScanner.setTextPos(i);
- while (mergeConflictScanner.getTextPos() < end) {
- classifyDisabledCodeToken();
- }
+ function writeLine() {
+ displayParts.push(lineBreakPart());
+ lineStart = true;
}
- function classifyDisabledCodeToken() {
- var start = mergeConflictScanner.getTextPos();
- var tokenKind = mergeConflictScanner.scan();
- var end = mergeConflictScanner.getTextPos();
- var type = classifyTokenType(tokenKind);
- if (type) {
- pushClassification(start, end - start, type);
- }
+ function resetWriter() {
+ displayParts = [];
+ lineStart = true;
+ indent = 0;
}
- function tryClassifyNode(node) {
- if (ts.isJSDocTag(node)) {
- return true;
- }
- if (ts.nodeIsMissing(node)) {
- return true;
- }
- var classifiedElementName = tryClassifyJsxElementName(node);
- if (!ts.isToken(node) && node.kind !== 244 && classifiedElementName === undefined) {
- return false;
+ }
+ function symbolPart(text, symbol) {
+ return displayPart(text, displayPartKind(symbol));
+ function displayPartKind(symbol) {
+ var flags = symbol.flags;
+ if (flags & 3) {
+ return isFirstDeclarationOfSymbolParameter(symbol) ? ts.SymbolDisplayPartKind.parameterName : ts.SymbolDisplayPartKind.localName;
}
- var tokenStart = node.kind === 244 ? node.pos : classifyLeadingTriviaAndGetTokenStart(node);
- var tokenWidth = node.end - tokenStart;
- ts.Debug.assert(tokenWidth >= 0);
- if (tokenWidth > 0) {
- var type = classifiedElementName || classifyTokenType(node.kind, node);
- if (type) {
- pushClassification(tokenStart, tokenWidth, type);
- }
+ else if (flags & 4) {
+ return ts.SymbolDisplayPartKind.propertyName;
}
- return true;
- }
- function tryClassifyJsxElementName(token) {
- switch (token.parent && token.parent.kind) {
- case 243:
- if (token.parent.tagName === token) {
- return 19;
- }
- break;
- case 245:
- if (token.parent.tagName === token) {
- return 20;
- }
- break;
- case 242:
- if (token.parent.tagName === token) {
- return 21;
- }
- break;
- case 246:
- if (token.parent.name === token) {
- return 22;
- }
- break;
+ else if (flags & 32768) {
+ return ts.SymbolDisplayPartKind.propertyName;
}
- return undefined;
- }
- function classifyTokenType(tokenKind, token) {
- if (ts.isKeyword(tokenKind)) {
- return 3;
+ else if (flags & 65536) {
+ return ts.SymbolDisplayPartKind.propertyName;
}
- if (tokenKind === 25 || tokenKind === 27) {
- if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) {
- return 10;
- }
+ else if (flags & 8) {
+ return ts.SymbolDisplayPartKind.enumMemberName;
}
- if (ts.isPunctuation(tokenKind)) {
- if (token) {
- if (tokenKind === 56) {
- if (token.parent.kind === 218 ||
- token.parent.kind === 145 ||
- token.parent.kind === 142 ||
- token.parent.kind === 246) {
- return 5;
- }
- }
- if (token.parent.kind === 187 ||
- token.parent.kind === 185 ||
- token.parent.kind === 186 ||
- token.parent.kind === 188) {
- return 5;
- }
- }
- return 10;
+ else if (flags & 16) {
+ return ts.SymbolDisplayPartKind.functionName;
}
- else if (tokenKind === 8) {
- return 4;
+ else if (flags & 32) {
+ return ts.SymbolDisplayPartKind.className;
}
- else if (tokenKind === 9) {
- return token.parent.kind === 246 ? 24 : 6;
+ else if (flags & 64) {
+ return ts.SymbolDisplayPartKind.interfaceName;
}
- else if (tokenKind === 10) {
- return 6;
+ else if (flags & 384) {
+ return ts.SymbolDisplayPartKind.enumName;
}
- else if (ts.isTemplateLiteralKind(tokenKind)) {
- return 6;
+ else if (flags & 1536) {
+ return ts.SymbolDisplayPartKind.moduleName;
}
- else if (tokenKind === 244) {
- return 23;
+ else if (flags & 8192) {
+ return ts.SymbolDisplayPartKind.methodName;
}
- else if (tokenKind === 69) {
- if (token) {
- switch (token.parent.kind) {
- case 221:
- if (token.parent.name === token) {
- return 11;
- }
- return;
- case 141:
- if (token.parent.name === token) {
- return 15;
- }
- return;
- case 222:
- if (token.parent.name === token) {
- return 13;
- }
- return;
- case 224:
- if (token.parent.name === token) {
- return 12;
- }
- return;
- case 225:
- if (token.parent.name === token) {
- return 14;
- }
- return;
- case 142:
- if (token.parent.name === token) {
- return ts.isThisIdentifier(token) ? 3 : 17;
- }
- return;
- }
- }
- return 2;
+ else if (flags & 262144) {
+ return ts.SymbolDisplayPartKind.typeParameterName;
}
- }
- function processElement(element) {
- if (!element) {
- return;
+ else if (flags & 524288) {
+ return ts.SymbolDisplayPartKind.aliasName;
}
- if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) {
- checkForClassificationCancellation(cancellationToken, element.kind);
- var children = element.getChildren(sourceFile);
- for (var i = 0, n = children.length; i < n; i++) {
- var child = children[i];
- if (!tryClassifyNode(child)) {
- processElement(child);
- }
- }
+ else if (flags & 8388608) {
+ return ts.SymbolDisplayPartKind.aliasName;
}
+ return ts.SymbolDisplayPartKind.text;
}
}
- ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications;
-})(ts || (ts = {}));
+ ts.symbolPart = symbolPart;
+ function displayPart(text, kind) {
+ return {
+ text: text,
+ kind: ts.SymbolDisplayPartKind[kind]
+ };
+ }
+ ts.displayPart = displayPart;
+ function spacePart() {
+ return displayPart(" ", ts.SymbolDisplayPartKind.space);
+ }
+ ts.spacePart = spacePart;
+ function keywordPart(kind) {
+ return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.keyword);
+ }
+ ts.keywordPart = keywordPart;
+ function punctuationPart(kind) {
+ return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.punctuation);
+ }
+ ts.punctuationPart = punctuationPart;
+ function operatorPart(kind) {
+ return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.operator);
+ }
+ ts.operatorPart = operatorPart;
+ function textOrKeywordPart(text) {
+ var kind = ts.stringToToken(text);
+ return kind === undefined
+ ? textPart(text)
+ : keywordPart(kind);
+ }
+ ts.textOrKeywordPart = textOrKeywordPart;
+ function textPart(text) {
+ return displayPart(text, ts.SymbolDisplayPartKind.text);
+ }
+ ts.textPart = textPart;
+ var carriageReturnLineFeed = "\r\n";
+ function getNewLineOrDefaultFromHost(host) {
+ return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed;
+ }
+ ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost;
+ function lineBreakPart() {
+ return displayPart("\n", ts.SymbolDisplayPartKind.lineBreak);
+ }
+ ts.lineBreakPart = lineBreakPart;
+ function mapToDisplayParts(writeDisplayParts) {
+ writeDisplayParts(displayPartWriter);
+ var result = displayPartWriter.displayParts();
+ displayPartWriter.clear();
+ return result;
+ }
+ ts.mapToDisplayParts = mapToDisplayParts;
+ function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) {
+ return mapToDisplayParts(function (writer) {
+ typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
+ });
+ }
+ ts.typeToDisplayParts = typeToDisplayParts;
+ function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) {
+ return mapToDisplayParts(function (writer) {
+ typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags);
+ });
+ }
+ ts.symbolToDisplayParts = symbolToDisplayParts;
+ function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) {
+ return mapToDisplayParts(function (writer) {
+ typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);
+ });
+ }
+ ts.signatureToDisplayParts = signatureToDisplayParts;
+ function getDeclaredName(typeChecker, symbol, location) {
+ if (isImportOrExportSpecifierName(location)) {
+ return location.getText();
+ }
+ else if (ts.isStringOrNumericLiteral(location.kind) &&
+ location.parent.kind === 141) {
+ return location.text;
+ }
+ var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol);
+ var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol);
+ return name;
+ }
+ ts.getDeclaredName = getDeclaredName;
+ function isImportOrExportSpecifierName(location) {
+ return location.parent &&
+ (location.parent.kind === 235 || location.parent.kind === 239) &&
+ location.parent.propertyName === location;
+ }
+ ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName;
+ function stripQuotes(name) {
+ var length = name.length;
+ if (length >= 2 &&
+ name.charCodeAt(0) === name.charCodeAt(length - 1) &&
+ (name.charCodeAt(0) === 34 || name.charCodeAt(0) === 39)) {
+ return name.substring(1, length - 1);
+ }
+ ;
+ return name;
+ }
+ ts.stripQuotes = stripQuotes;
+ function scriptKindIs(fileName, host) {
+ var scriptKinds = [];
+ for (var _i = 2; _i < arguments.length; _i++) {
+ scriptKinds[_i - 2] = arguments[_i];
+ }
+ var scriptKind = getScriptKind(fileName, host);
+ return ts.forEach(scriptKinds, function (k) { return k === scriptKind; });
+ }
+ ts.scriptKindIs = scriptKindIs;
+ function getScriptKind(fileName, host) {
+ var scriptKind;
+ if (host && host.getScriptKind) {
+ scriptKind = host.getScriptKind(fileName);
+ }
+ if (!scriptKind) {
+ scriptKind = ts.getScriptKindFromFileName(fileName);
+ }
+ return ts.ensureScriptKind(fileName, scriptKind);
+ }
+ ts.getScriptKind = getScriptKind;
+ function sanitizeConfigFile(configFileName, content) {
+ var options = {
+ fileName: "config.js",
+ compilerOptions: {
+ target: 2,
+ removeComments: true
+ },
+ reportDiagnostics: true
+ };
+ var _a = ts.transpileModule("(" + content + ")", options), outputText = _a.outputText, diagnostics = _a.diagnostics;
+ var trimmedOutput = outputText.trim();
+ for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) {
+ var diagnostic = diagnostics_2[_i];
+ diagnostic.start = diagnostic.start - 1;
+ }
+ var _b = ts.parseConfigFileTextToJson(configFileName, trimmedOutput.substring(1, trimmedOutput.length - 2), false), config = _b.config, error = _b.error;
+ return {
+ configJsonObject: config || {},
+ diagnostics: error ? ts.concatenate(diagnostics, [error]) : diagnostics
+ };
+ }
+ ts.sanitizeConfigFile = sanitizeConfigFile;
+})(ts || (ts = {}));
var ts;
(function (ts) {
- var Completions;
- (function (Completions) {
- function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) {
- if (ts.isInReferenceComment(sourceFile, position)) {
- return getTripleSlashReferenceCompletion(sourceFile, position);
+ var BreakpointResolver;
+ (function (BreakpointResolver) {
+ function spanInSourceFileAtLocation(sourceFile, position) {
+ if (sourceFile.isDeclarationFile) {
+ return undefined;
}
- if (ts.isInString(sourceFile, position)) {
- return getStringLiteralCompletionEntries(sourceFile, position);
+ var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position);
+ var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
+ if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) {
+ tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile);
+ if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) {
+ return undefined;
+ }
}
- var completionData = getCompletionData(typeChecker, log, sourceFile, position);
- if (!completionData) {
+ if (ts.isInAmbientContext(tokenAtLocation)) {
return undefined;
}
- var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName;
- if (isJsDocTagName) {
- return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getAllJsDocCompletionEntries() };
+ return spanInNode(tokenAtLocation);
+ function textSpan(startNode, endNode) {
+ var start = startNode.decorators ?
+ ts.skipTrivia(sourceFile.text, startNode.decorators.end) :
+ startNode.getStart(sourceFile);
+ return ts.createTextSpanFromBounds(start, (endNode || startNode).getEnd());
}
- var entries = [];
- if (ts.isSourceFileJavaScript(sourceFile)) {
- var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true);
- ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames));
+ function textSpanEndingAtNextToken(startNode, previousTokenToFindNextEndToken) {
+ return textSpan(startNode, ts.findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent));
}
- else {
- if (!symbols || symbols.length === 0) {
- if (sourceFile.languageVariant === 1 &&
- location.parent && location.parent.kind === 245) {
- var tagName = location.parent.parent.openingElement.tagName;
- entries.push({
- name: tagName.text,
- kind: undefined,
- kindModifiers: undefined,
- sortText: "0"
- });
- }
- else {
- return undefined;
- }
+ function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) {
+ if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) {
+ return spanInNode(node);
}
- getCompletionEntriesFromSymbols(symbols, entries, location, true);
+ return spanInNode(otherwiseOnNode);
}
- if (!isMemberCompletion && !isJsDocTagName) {
- ts.addRange(entries, keywordCompletions);
+ function spanInNodeArray(nodeArray) {
+ return ts.createTextSpanFromBounds(ts.skipTrivia(sourceFile.text, nodeArray.pos), nodeArray.end);
}
- return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries };
- function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) {
- var entries = [];
- var nameTable = ts.getNameTable(sourceFile);
- for (var name_47 in nameTable) {
- if (nameTable[name_47] === position) {
- continue;
- }
- if (!uniqueNames[name_47]) {
- uniqueNames[name_47] = name_47;
- var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_47), compilerOptions.target, true);
- if (displayName) {
- var entry = {
- name: displayName,
- kind: ts.ScriptElementKind.warning,
- kindModifiers: "",
- sortText: "1"
- };
- entries.push(entry);
- }
- }
- }
- return entries;
+ function spanInPreviousNode(node) {
+ return spanInNode(ts.findPrecedingToken(node.pos, sourceFile));
}
- function createCompletionEntry(symbol, location, performCharacterChecks) {
- var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location);
- if (!displayName) {
- return undefined;
- }
- return {
- name: displayName,
- kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location),
- kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- sortText: "0"
- };
+ function spanInNextNode(node) {
+ return spanInNode(ts.findNextToken(node, node.parent));
}
- function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) {
- var start = ts.timestamp();
- var uniqueNames = ts.createMap();
- if (symbols) {
- for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) {
- var symbol = symbols_4[_i];
- var entry = createCompletionEntry(symbol, location, performCharacterChecks);
- if (entry) {
- var id = ts.escapeIdentifier(entry.name);
- if (!uniqueNames[id]) {
- entries.push(entry);
- uniqueNames[id] = id;
+ function spanInNode(node) {
+ if (node) {
+ switch (node.kind) {
+ case 201:
+ return spanInVariableDeclaration(node.declarationList.declarations[0]);
+ case 219:
+ case 146:
+ case 145:
+ return spanInVariableDeclaration(node);
+ case 143:
+ return spanInParameterDeclaration(node);
+ case 221:
+ case 148:
+ case 147:
+ case 150:
+ case 151:
+ case 149:
+ case 180:
+ case 181:
+ return spanInFunctionDeclaration(node);
+ case 200:
+ if (ts.isFunctionBlock(node)) {
+ return spanInFunctionBlock(node);
}
- }
+ case 227:
+ return spanInBlock(node);
+ case 252:
+ return spanInBlock(node.block);
+ case 203:
+ return textSpan(node.expression);
+ case 212:
+ return textSpan(node.getChildAt(0), node.expression);
+ case 206:
+ return textSpanEndingAtNextToken(node, node.expression);
+ case 205:
+ return spanInNode(node.statement);
+ case 218:
+ return textSpan(node.getChildAt(0));
+ case 204:
+ return textSpanEndingAtNextToken(node, node.expression);
+ case 215:
+ return spanInNode(node.statement);
+ case 211:
+ case 210:
+ return textSpan(node.getChildAt(0), node.label);
+ case 207:
+ return spanInForStatement(node);
+ case 208:
+ return textSpanEndingAtNextToken(node, node.expression);
+ case 209:
+ return spanInInitializerOfForLike(node);
+ case 214:
+ return textSpanEndingAtNextToken(node, node.expression);
+ case 249:
+ case 250:
+ return spanInNode(node.statements[0]);
+ case 217:
+ return spanInBlock(node.tryBlock);
+ case 216:
+ return textSpan(node, node.expression);
+ case 236:
+ return textSpan(node, node.expression);
+ case 230:
+ return textSpan(node, node.moduleReference);
+ case 231:
+ return textSpan(node, node.moduleSpecifier);
+ case 237:
+ return textSpan(node, node.moduleSpecifier);
+ case 226:
+ if (ts.getModuleInstanceState(node) !== 1) {
+ return undefined;
+ }
+ case 222:
+ case 225:
+ case 255:
+ case 170:
+ return textSpan(node);
+ case 213:
+ return spanInNode(node.statement);
+ case 144:
+ return spanInNodeArray(node.parent.decorators);
+ case 168:
+ case 169:
+ return spanInBindingPattern(node);
+ case 223:
+ case 224:
+ return undefined;
+ case 24:
+ case 1:
+ return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile));
+ case 25:
+ return spanInPreviousNode(node);
+ case 16:
+ return spanInOpenBraceToken(node);
+ case 17:
+ return spanInCloseBraceToken(node);
+ case 21:
+ return spanInCloseBracketToken(node);
+ case 18:
+ return spanInOpenParenToken(node);
+ case 19:
+ return spanInCloseParenToken(node);
+ case 55:
+ return spanInColonToken(node);
+ case 28:
+ case 26:
+ return spanInGreaterThanOrLessThanToken(node);
+ case 105:
+ return spanInWhileKeyword(node);
+ case 81:
+ case 73:
+ case 86:
+ return spanInNextNode(node);
+ case 139:
+ return spanInOfKeyword(node);
+ default:
+ if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) {
+ return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node);
+ }
+ if ((node.kind === 70 ||
+ node.kind == 192 ||
+ node.kind === 253 ||
+ node.kind === 254) &&
+ ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
+ return textSpan(node);
+ }
+ if (node.kind === 188) {
+ var binaryExpression = node;
+ if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) {
+ return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left);
+ }
+ if (binaryExpression.operatorToken.kind === 57 &&
+ ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) {
+ return textSpan(node);
+ }
+ if (binaryExpression.operatorToken.kind === 25) {
+ return spanInNode(binaryExpression.left);
+ }
+ }
+ if (ts.isPartOfExpression(node)) {
+ switch (node.parent.kind) {
+ case 205:
+ return spanInPreviousNode(node);
+ case 144:
+ return spanInNode(node.parent);
+ case 207:
+ case 209:
+ return textSpan(node);
+ case 188:
+ if (node.parent.operatorToken.kind === 25) {
+ return textSpan(node);
+ }
+ break;
+ case 181:
+ if (node.parent.body === node) {
+ return textSpan(node);
+ }
+ break;
+ }
+ }
+ if (node.parent.kind === 253 &&
+ node.parent.name === node &&
+ !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) {
+ return spanInNode(node.parent.initializer);
+ }
+ if (node.parent.kind === 178 && node.parent.type === node) {
+ return spanInNextNode(node.parent.type);
+ }
+ if (ts.isFunctionLike(node.parent) && node.parent.type === node) {
+ return spanInPreviousNode(node);
+ }
+ if ((node.parent.kind === 219 ||
+ node.parent.kind === 143)) {
+ var paramOrVarDecl = node.parent;
+ if (paramOrVarDecl.initializer === node ||
+ paramOrVarDecl.type === node ||
+ ts.isAssignmentOperator(node.kind)) {
+ return spanInPreviousNode(node);
+ }
+ }
+ if (node.parent.kind === 188) {
+ var binaryExpression = node.parent;
+ if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) &&
+ (binaryExpression.right === node ||
+ binaryExpression.operatorToken === node)) {
+ return spanInPreviousNode(node);
+ }
+ }
+ return spanInNode(node.parent);
}
}
- log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start));
- return uniqueNames;
- }
- function getStringLiteralCompletionEntries(sourceFile, position) {
- var node = ts.findPrecedingToken(position, sourceFile);
- if (!node || node.kind !== 9) {
- return undefined;
- }
- if (node.parent.kind === 253 &&
- node.parent.parent.kind === 171 &&
- node.parent.name === node) {
- return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent);
+ function textSpanFromVariableDeclaration(variableDeclaration) {
+ var declarations = variableDeclaration.parent.declarations;
+ if (declarations && declarations[0] === variableDeclaration) {
+ return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration);
+ }
+ else {
+ return textSpan(variableDeclaration);
+ }
}
- else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) {
- return getStringLiteralCompletionEntriesFromElementAccess(node.parent);
+ function spanInVariableDeclaration(variableDeclaration) {
+ if (variableDeclaration.parent.parent.kind === 208) {
+ return spanInNode(variableDeclaration.parent.parent);
+ }
+ if (ts.isBindingPattern(variableDeclaration.name)) {
+ return spanInBindingPattern(variableDeclaration.name);
+ }
+ if (variableDeclaration.initializer ||
+ ts.hasModifier(variableDeclaration, 1) ||
+ variableDeclaration.parent.parent.kind === 209) {
+ return textSpanFromVariableDeclaration(variableDeclaration);
+ }
+ var declarations = variableDeclaration.parent.declarations;
+ if (declarations && declarations[0] !== variableDeclaration) {
+ return spanInNode(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent));
+ }
}
- else if (node.parent.kind === 230 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) {
- return getStringLiteralCompletionEntriesFromModuleNames(node);
+ function canHaveSpanInParameterDeclaration(parameter) {
+ return !!parameter.initializer || parameter.dotDotDotToken !== undefined ||
+ ts.hasModifier(parameter, 4 | 8);
}
- else {
- var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile);
- if (argumentInfo) {
- return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, node);
+ function spanInParameterDeclaration(parameter) {
+ if (ts.isBindingPattern(parameter.name)) {
+ return spanInBindingPattern(parameter.name);
}
- return getStringLiteralCompletionEntriesFromContextualType(node);
- }
- }
- function getStringLiteralCompletionEntriesFromPropertyAssignment(element) {
- var type = typeChecker.getContextualType(element.parent);
- var entries = [];
- if (type) {
- getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, false);
- if (entries.length) {
- return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries };
+ else if (canHaveSpanInParameterDeclaration(parameter)) {
+ return textSpan(parameter);
}
- }
- }
- function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, location) {
- var candidates = [];
- var entries = [];
- typeChecker.getResolvedSignature(argumentInfo.invocation, candidates);
- for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) {
- var candidate = candidates_3[_i];
- if (candidate.parameters.length > argumentInfo.argumentIndex) {
- var parameter = candidate.parameters[argumentInfo.argumentIndex];
- addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries);
+ else {
+ var functionDeclaration = parameter.parent;
+ var indexOfParameter = ts.indexOf(functionDeclaration.parameters, parameter);
+ if (indexOfParameter) {
+ return spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]);
+ }
+ else {
+ return spanInNode(functionDeclaration.body);
+ }
}
}
- if (entries.length) {
- return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries };
+ function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) {
+ return ts.hasModifier(functionDeclaration, 1) ||
+ (functionDeclaration.parent.kind === 222 && functionDeclaration.kind !== 149);
}
- return undefined;
- }
- function getStringLiteralCompletionEntriesFromElementAccess(node) {
- var type = typeChecker.getTypeAtLocation(node.expression);
- var entries = [];
- if (type) {
- getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, false);
- if (entries.length) {
- return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries };
+ function spanInFunctionDeclaration(functionDeclaration) {
+ if (!functionDeclaration.body) {
+ return undefined;
}
- }
- return undefined;
- }
- function getStringLiteralCompletionEntriesFromContextualType(node) {
- var type = typeChecker.getContextualType(node);
- if (type) {
- var entries_2 = [];
- addStringLiteralCompletionsFromType(type, entries_2);
- if (entries_2.length) {
- return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 };
+ if (canFunctionHaveSpanInWholeDeclaration(functionDeclaration)) {
+ return textSpan(functionDeclaration);
}
+ return spanInNode(functionDeclaration.body);
}
- return undefined;
- }
- function addStringLiteralCompletionsFromType(type, result) {
- if (!type) {
- return;
- }
- if (type.flags & 524288) {
- ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); });
+ function spanInFunctionBlock(block) {
+ var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken();
+ if (canFunctionHaveSpanInWholeDeclaration(block.parent)) {
+ return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock);
+ }
+ return spanInNode(nodeForSpanInBlock);
}
- else {
- if (type.flags & 32) {
- result.push({
- name: type.text,
- kindModifiers: ts.ScriptElementKindModifier.none,
- kind: ts.ScriptElementKind.variableElement,
- sortText: "0"
- });
+ function spanInBlock(block) {
+ switch (block.parent.kind) {
+ case 226:
+ if (ts.getModuleInstanceState(block.parent) !== 1) {
+ return undefined;
+ }
+ case 206:
+ case 204:
+ case 208:
+ return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
+ case 207:
+ case 209:
+ return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
}
+ return spanInNode(block.statements[0]);
}
- }
- function getStringLiteralCompletionEntriesFromModuleNames(node) {
- var literalValue = ts.normalizeSlashes(node.text);
- var scriptPath = node.getSourceFile().path;
- var scriptDirectory = ts.getDirectoryPath(scriptPath);
- var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1);
- var entries;
- if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) {
- if (compilerOptions.rootDirs) {
- entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath);
+ function spanInInitializerOfForLike(forLikeStatement) {
+ if (forLikeStatement.initializer.kind === 220) {
+ var variableDeclarationList = forLikeStatement.initializer;
+ if (variableDeclarationList.declarations.length > 0) {
+ return spanInNode(variableDeclarationList.declarations[0]);
+ }
}
else {
- entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath);
+ return spanInNode(forLikeStatement.initializer);
}
}
- else {
- entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span);
- }
- return {
- isGlobalCompletion: false,
- isMemberCompletion: false,
- isNewIdentifierLocation: true,
- entries: entries
- };
- }
- function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) {
- rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); });
- var relativeDirectory;
- for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) {
- var rootDirectory = rootDirs_1[_i];
- if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) {
- relativeDirectory = scriptPath.substr(rootDirectory.length);
- break;
+ function spanInForStatement(forStatement) {
+ if (forStatement.initializer) {
+ return spanInInitializerOfForLike(forStatement);
}
- }
- return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); }));
- }
- function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) {
- var basePath = compilerOptions.project || host.getCurrentDirectory();
- var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
- var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase);
- var result = [];
- for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) {
- var baseDirectory = baseDirectories_1[_i];
- getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result);
- }
- return result;
- }
- function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) {
- if (result === void 0) { result = []; }
- if (fragment === undefined) {
- fragment = "";
- }
- fragment = ts.normalizeSlashes(fragment);
- fragment = ts.getDirectoryPath(fragment);
- if (fragment === "") {
- fragment = "." + ts.directorySeparator;
- }
- fragment = ts.ensureTrailingDirectorySeparator(fragment);
- var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment));
- var baseDirectory = ts.getDirectoryPath(absolutePath);
- var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
- if (tryDirectoryExists(host, baseDirectory)) {
- var files = tryReadDirectory(host, baseDirectory, extensions, undefined, ["./*"]);
- if (files) {
- var foundFiles = ts.createMap();
- for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
- var filePath = files_3[_i];
- filePath = ts.normalizePath(filePath);
- if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0) {
- continue;
- }
- var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath));
- if (!foundFiles[foundFileName]) {
- foundFiles[foundFileName] = true;
- }
- }
- for (var foundFile in foundFiles) {
- result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span));
- }
+ if (forStatement.condition) {
+ return textSpan(forStatement.condition);
}
- var directories = tryGetDirectories(host, baseDirectory);
- if (directories) {
- for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) {
- var directory = directories_2[_a];
- var directoryName = ts.getBaseFileName(ts.normalizePath(directory));
- result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span));
- }
+ if (forStatement.incrementor) {
+ return textSpan(forStatement.incrementor);
}
}
- return result;
- }
- function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) {
- var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths;
- var result;
- if (baseUrl) {
- var fileExtensions = ts.getSupportedExtensions(compilerOptions);
- var projectDir = compilerOptions.project || host.getCurrentDirectory();
- var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl);
- result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, false, span);
- if (paths) {
- for (var path in paths) {
- if (paths.hasOwnProperty(path)) {
- if (path === "*") {
- if (paths[path]) {
- for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) {
- var pattern = _a[_i];
- for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) {
- var match = _c[_b];
- result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span));
- }
- }
- }
- }
- else if (ts.startsWith(path, fragment)) {
- var entry = paths[path] && paths[path].length === 1 && paths[path][0];
- if (entry) {
- result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span));
- }
- }
- }
- }
+ function spanInBindingPattern(bindingPattern) {
+ var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 194 ? element : undefined; });
+ if (firstBindingElement) {
+ return spanInNode(firstBindingElement);
}
+ if (bindingPattern.parent.kind === 170) {
+ return textSpan(bindingPattern.parent);
+ }
+ return textSpanFromVariableDeclaration(bindingPattern.parent);
}
- else {
- result = [];
+ function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) {
+ ts.Debug.assert(node.kind !== 169 && node.kind !== 168);
+ var elements = node.kind === 171 ?
+ node.elements :
+ node.properties;
+ var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 194 ? element : undefined; });
+ if (firstBindingElement) {
+ return spanInNode(firstBindingElement);
+ }
+ return textSpan(node.parent.kind === 188 ? node.parent : node);
}
- getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result);
- for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) {
- var moduleName = _e[_d];
- result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span));
+ function spanInOpenBraceToken(node) {
+ switch (node.parent.kind) {
+ case 225:
+ var enumDeclaration = node.parent;
+ return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile));
+ case 222:
+ var classDeclaration = node.parent;
+ return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile));
+ case 228:
+ return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]);
+ }
+ return spanInNode(node.parent);
}
- return result;
- }
- function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) {
- if (host.readDirectory) {
- var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined;
- if (parsed) {
- var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix);
- var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix);
- var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix);
- var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1;
- var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory;
- var normalizedSuffix = ts.normalizePath(parsed.suffix);
- var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory);
- var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase;
- var includeGlob = normalizedSuffix ? "**/*" : "./*";
- var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]);
- if (matches) {
- var result = [];
- for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) {
- var match = matches_1[_i];
- var normalizedMatch = ts.normalizePath(match);
- if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) {
- continue;
- }
- var start = completePrefix.length;
- var length_5 = normalizedMatch.length - start - normalizedSuffix.length;
- result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5)));
+ function spanInCloseBraceToken(node) {
+ switch (node.parent.kind) {
+ case 227:
+ if (ts.getModuleInstanceState(node.parent.parent) !== 1) {
+ return undefined;
}
- return result;
- }
+ case 225:
+ case 222:
+ return textSpan(node);
+ case 200:
+ if (ts.isFunctionBlock(node.parent)) {
+ return textSpan(node);
+ }
+ case 252:
+ return spanInNode(ts.lastOrUndefined(node.parent.statements));
+ case 228:
+ var caseBlock = node.parent;
+ var lastClause = ts.lastOrUndefined(caseBlock.clauses);
+ if (lastClause) {
+ return spanInNode(ts.lastOrUndefined(lastClause.statements));
+ }
+ return undefined;
+ case 168:
+ var bindingPattern = node.parent;
+ return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
+ default:
+ if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
+ var objectLiteral = node.parent;
+ return textSpan(ts.lastOrUndefined(objectLiteral.properties) || objectLiteral);
+ }
+ return spanInNode(node.parent);
}
}
- return undefined;
- }
- function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) {
- var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1;
- var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined;
- var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); });
- var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); });
- if (isNestedModule) {
- var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment);
- nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) {
- if (ts.startsWith(fragment, moduleNameWithSeperator_1)) {
- return moduleName.substr(moduleNameWithSeperator_1.length);
- }
- return moduleName;
- });
- }
- if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) {
- for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) {
- var visibleModule = _a[_i];
- if (!isNestedModule) {
- nonRelativeModules.push(visibleModule.moduleName);
- }
- else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) {
- var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, undefined, ["./*"]);
- if (nestedFiles) {
- for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) {
- var f = nestedFiles_1[_b];
- f = ts.normalizePath(f);
- var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f));
- nonRelativeModules.push(nestedModule);
- }
+ function spanInCloseBracketToken(node) {
+ switch (node.parent.kind) {
+ case 169:
+ var bindingPattern = node.parent;
+ return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
+ default:
+ if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
+ var arrayLiteral = node.parent;
+ return textSpan(ts.lastOrUndefined(arrayLiteral.elements) || arrayLiteral);
}
- }
+ return spanInNode(node.parent);
}
}
- return ts.deduplicate(nonRelativeModules);
- }
- function getTripleSlashReferenceCompletion(sourceFile, position) {
- var token = ts.getTokenAtPosition(sourceFile, position);
- if (!token) {
- return undefined;
- }
- var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
- if (!commentRanges || !commentRanges.length) {
- return undefined;
- }
- var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; });
- if (!range) {
- return undefined;
- }
- var completionInfo = {
- isGlobalCompletion: false,
- isMemberCompletion: false,
- isNewIdentifierLocation: true,
- entries: []
- };
- var text = sourceFile.text.substr(range.pos, position - range.pos);
- var match = tripleSlashDirectiveFragmentRegex.exec(text);
- if (match) {
- var prefix = match[1];
- var kind = match[2];
- var toComplete = match[3];
- var scriptPath = ts.getDirectoryPath(sourceFile.path);
- if (kind === "path") {
- var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length);
- completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), true, span_10, sourceFile.path);
+ function spanInOpenParenToken(node) {
+ if (node.parent.kind === 205 ||
+ node.parent.kind === 175 ||
+ node.parent.kind === 176) {
+ return spanInPreviousNode(node);
}
- else {
- var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length };
- completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11);
+ if (node.parent.kind === 179) {
+ return spanInNextNode(node);
}
+ return spanInNode(node.parent);
}
- return completionInfo;
- }
- function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) {
- if (result === void 0) { result = []; }
- if (options.types) {
- for (var _i = 0, _a = options.types; _i < _a.length; _i++) {
- var moduleName = _a[_i];
- result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span));
+ function spanInCloseParenToken(node) {
+ switch (node.parent.kind) {
+ case 180:
+ case 221:
+ case 181:
+ case 148:
+ case 147:
+ case 150:
+ case 151:
+ case 149:
+ case 206:
+ case 205:
+ case 207:
+ case 209:
+ case 175:
+ case 176:
+ case 179:
+ return spanInPreviousNode(node);
+ default:
+ return spanInNode(node.parent);
}
}
- else if (host.getDirectories) {
- var typeRoots = void 0;
- try {
- typeRoots = ts.getEffectiveTypeRoots(options, host);
- }
- catch (e) { }
- if (typeRoots) {
- for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) {
- var root = typeRoots_2[_b];
- getCompletionEntriesFromDirectories(host, options, root, span, result);
- }
+ function spanInColonToken(node) {
+ if (ts.isFunctionLike(node.parent) ||
+ node.parent.kind === 253 ||
+ node.parent.kind === 143) {
+ return spanInPreviousNode(node);
}
+ return spanInNode(node.parent);
}
- if (host.getDirectories) {
- for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) {
- var packageJson = _d[_c];
- var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types");
- getCompletionEntriesFromDirectories(host, options, typesDir, span, result);
+ function spanInGreaterThanOrLessThanToken(node) {
+ if (node.parent.kind === 178) {
+ return spanInNextNode(node);
}
+ return spanInNode(node.parent);
}
- return result;
- }
- function getCompletionEntriesFromDirectories(host, options, directory, span, result) {
- if (host.getDirectories && tryDirectoryExists(host, directory)) {
- var directories = tryGetDirectories(host, directory);
- if (directories) {
- for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) {
- var typeDirectory = directories_3[_i];
- typeDirectory = ts.normalizePath(typeDirectory);
- result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span));
- }
+ function spanInWhileKeyword(node) {
+ if (node.parent.kind === 205) {
+ return textSpanEndingAtNextToken(node, node.parent.expression);
}
+ return spanInNode(node.parent);
}
- }
- function findPackageJsons(currentDir) {
- var paths = [];
- var currentConfigPath;
- while (true) {
- currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, "package.json");
- if (currentConfigPath) {
- paths.push(currentConfigPath);
- currentDir = ts.getDirectoryPath(currentConfigPath);
- var parent_16 = ts.getDirectoryPath(currentDir);
- if (currentDir === parent_16) {
- break;
- }
- currentDir = parent_16;
- }
- else {
- break;
+ function spanInOfKeyword(node) {
+ if (node.parent.kind === 209) {
+ return spanInNextNode(node);
}
+ return spanInNode(node.parent);
}
- return paths;
}
- function enumerateNodeModulesVisibleToScript(host, scriptPath) {
- var result = [];
- if (host.readFile && host.fileExists) {
- for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) {
- var packageJson = _a[_i];
- var contents = tryReadingPackageJson(packageJson);
- if (!contents) {
- return;
- }
- var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules");
- var foundModuleNames = [];
- for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) {
- var key = nodeModulesDependencyKeys_1[_b];
- addPotentialPackageNames(contents[key], foundModuleNames);
- }
- for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) {
- var moduleName = foundModuleNames_1[_c];
- var moduleDir = ts.combinePaths(nodeModulesDir, moduleName);
- result.push({
- moduleName: moduleName,
- moduleDir: moduleDir
- });
- }
- }
- }
- return result;
- function tryReadingPackageJson(filePath) {
- try {
- var fileText = tryReadFile(host, filePath);
- return fileText ? JSON.parse(fileText) : undefined;
- }
- catch (e) {
- return undefined;
- }
- }
- function addPotentialPackageNames(dependencies, result) {
- if (dependencies) {
- for (var dep in dependencies) {
- if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) {
- result.push(dep);
- }
- }
- }
+ }
+ BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation;
+ })(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function createClassifier() {
+ var scanner = ts.createScanner(4, false);
+ var noRegexTable = [];
+ noRegexTable[70] = true;
+ noRegexTable[9] = true;
+ noRegexTable[8] = true;
+ noRegexTable[11] = true;
+ noRegexTable[98] = true;
+ noRegexTable[42] = true;
+ noRegexTable[43] = true;
+ noRegexTable[19] = true;
+ noRegexTable[21] = true;
+ noRegexTable[17] = true;
+ noRegexTable[100] = true;
+ noRegexTable[85] = true;
+ var templateStack = [];
+ function canFollow(keyword1, keyword2) {
+ if (ts.isAccessibilityModifier(keyword1)) {
+ if (keyword2 === 124 ||
+ keyword2 === 132 ||
+ keyword2 === 122 ||
+ keyword2 === 114) {
+ return true;
}
+ return false;
}
- function createCompletionEntryForModule(name, kind, replacementSpan) {
- return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan };
- }
- function getDirectoryFragmentTextSpan(text, textStart) {
- var index = text.lastIndexOf(ts.directorySeparator);
- var offset = index !== -1 ? index + 1 : 0;
- return { start: textStart + offset, length: text.length - offset };
- }
- function isPathRelativeToScript(path) {
- if (path && path.length >= 2 && path.charCodeAt(0) === 46) {
- var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 ? 2 : 1;
- var slashCharCode = path.charCodeAt(slashIndex);
- return slashCharCode === 47 || slashCharCode === 92;
+ return true;
+ }
+ function convertClassifications(classifications, text) {
+ var entries = [];
+ var dense = classifications.spans;
+ var lastEnd = 0;
+ for (var i = 0, n = dense.length; i < n; i += 3) {
+ var start = dense[i];
+ var length_4 = dense[i + 1];
+ var type = dense[i + 2];
+ if (lastEnd >= 0) {
+ var whitespaceLength_1 = start - lastEnd;
+ if (whitespaceLength_1 > 0) {
+ entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace });
+ }
}
- return false;
+ entries.push({ length: length_4, classification: convertClassification(type) });
+ lastEnd = start + length_4;
}
- function normalizeAndPreserveTrailingSlash(path) {
- return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path);
+ var whitespaceLength = text.length - lastEnd;
+ if (whitespaceLength > 0) {
+ entries.push({ length: whitespaceLength, classification: ts.TokenClass.Whitespace });
}
+ return { entries: entries, finalLexState: classifications.endOfLineState };
}
- Completions.getCompletionsAtPosition = getCompletionsAtPosition;
- function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) {
- var completionData = getCompletionData(typeChecker, log, sourceFile, position);
- if (completionData) {
- var symbols = completionData.symbols, location_2 = completionData.location;
- var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_2) === entryName ? s : undefined; });
- if (symbol) {
- var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_2, location_2, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
- return {
- name: entryName,
- kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- kind: symbolKind,
- displayParts: displayParts,
- documentation: documentation
- };
- }
- }
- var keywordCompletion = ts.forEach(keywordCompletions, function (c) { return c.name === entryName; });
- if (keywordCompletion) {
- return {
- name: entryName,
- kind: ts.ScriptElementKind.keyword,
- kindModifiers: ts.ScriptElementKindModifier.none,
- displayParts: [ts.displayPart(entryName, ts.SymbolDisplayPartKind.keyword)],
- documentation: undefined
- };
+ function convertClassification(type) {
+ switch (type) {
+ case 1: return ts.TokenClass.Comment;
+ case 3: return ts.TokenClass.Keyword;
+ case 4: return ts.TokenClass.NumberLiteral;
+ case 5: return ts.TokenClass.Operator;
+ case 6: return ts.TokenClass.StringLiteral;
+ case 8: return ts.TokenClass.Whitespace;
+ case 10: return ts.TokenClass.Punctuation;
+ case 2:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ case 9:
+ case 17:
+ default:
+ return ts.TokenClass.Identifier;
}
- return undefined;
}
- Completions.getCompletionEntryDetails = getCompletionEntryDetails;
- function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) {
- var completionData = getCompletionData(typeChecker, log, sourceFile, position);
- if (completionData) {
- var symbols = completionData.symbols, location_3 = completionData.location;
- return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; });
- }
- return undefined;
+ function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {
+ return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
}
- Completions.getCompletionEntrySymbol = getCompletionEntrySymbol;
- function getCompletionData(typeChecker, log, sourceFile, position) {
- var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile);
- var isJsDocTagName = false;
- var start = ts.timestamp();
- var currentToken = ts.getTokenAtPosition(sourceFile, position);
- log("getCompletionData: Get current token: " + (ts.timestamp() - start));
- start = ts.timestamp();
- var insideComment = ts.isInsideComment(sourceFile, currentToken, position);
- log("getCompletionData: Is inside comment: " + (ts.timestamp() - start));
- if (insideComment) {
- if (ts.hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === 64) {
- isJsDocTagName = true;
- }
- var insideJsDocTagExpression = false;
- var tag = ts.getJsDocTagAtPosition(sourceFile, position);
- if (tag) {
- if (tag.tagName.pos <= position && position <= tag.tagName.end) {
- isJsDocTagName = true;
- }
- switch (tag.kind) {
- case 277:
- case 275:
- case 276:
- var tagWithExpression = tag;
- if (tagWithExpression.typeExpression) {
- insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;
- }
- break;
- }
- }
- if (isJsDocTagName) {
- return { symbols: undefined, isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName: isJsDocTagName };
- }
- if (!insideJsDocTagExpression) {
- log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.");
- return undefined;
- }
+ function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) {
+ var offset = 0;
+ var token = 0;
+ var lastNonTriviaToken = 0;
+ while (templateStack.length > 0) {
+ templateStack.pop();
}
- start = ts.timestamp();
- var previousToken = ts.findPrecedingToken(position, sourceFile);
- log("getCompletionData: Get previous token 1: " + (ts.timestamp() - start));
- var contextToken = previousToken;
- if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) {
- var start_2 = ts.timestamp();
- contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile);
- log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_2));
+ switch (lexState) {
+ case 3:
+ text = "\"\\\n" + text;
+ offset = 3;
+ break;
+ case 2:
+ text = "'\\\n" + text;
+ offset = 3;
+ break;
+ case 1:
+ text = "/*\n" + text;
+ offset = 3;
+ break;
+ case 4:
+ text = "`\n" + text;
+ offset = 2;
+ break;
+ case 5:
+ text = "}\n" + text;
+ offset = 2;
+ case 6:
+ templateStack.push(13);
+ break;
}
- var node = currentToken;
- var isRightOfDot = false;
- var isRightOfOpenTag = false;
- var isStartingCloseTag = false;
- var location = ts.getTouchingPropertyName(sourceFile, position);
- if (contextToken) {
- if (isCompletionListBlocker(contextToken)) {
- log("Returning an empty list because completion was requested in an invalid position.");
- return undefined;
- }
- var parent_17 = contextToken.parent, kind = contextToken.kind;
- if (kind === 21) {
- if (parent_17.kind === 172) {
- node = contextToken.parent.expression;
- isRightOfDot = true;
+ scanner.setText(text);
+ var result = {
+ endOfLineState: 0,
+ spans: []
+ };
+ var angleBracketStack = 0;
+ do {
+ token = scanner.scan();
+ if (!ts.isTrivia(token)) {
+ if ((token === 40 || token === 62) && !noRegexTable[lastNonTriviaToken]) {
+ if (scanner.reScanSlashToken() === 11) {
+ token = 11;
+ }
}
- else if (parent_17.kind === 139) {
- node = contextToken.parent.left;
- isRightOfDot = true;
+ else if (lastNonTriviaToken === 22 && isKeyword(token)) {
+ token = 70;
}
- else {
- return undefined;
+ else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {
+ token = 70;
}
- }
- else if (sourceFile.languageVariant === 1) {
- if (kind === 25) {
- isRightOfOpenTag = true;
- location = contextToken;
+ else if (lastNonTriviaToken === 70 &&
+ token === 26) {
+ angleBracketStack++;
}
- else if (kind === 39 && contextToken.parent.kind === 245) {
- isStartingCloseTag = true;
- location = contextToken;
+ else if (token === 28 && angleBracketStack > 0) {
+ angleBracketStack--;
}
- }
- }
- var semanticStart = ts.timestamp();
- var isGlobalCompletion = false;
- var isMemberCompletion;
- var isNewIdentifierLocation;
- var symbols = [];
- if (isRightOfDot) {
- getTypeScriptMemberSymbols();
- }
- else if (isRightOfOpenTag) {
- var tagSymbols = typeChecker.getJsxIntrinsicTagNames();
- if (tryGetGlobalSymbols()) {
- symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 | 8388608)); }));
- }
- else {
- symbols = tagSymbols;
- }
- isMemberCompletion = true;
- isNewIdentifierLocation = false;
- }
- else if (isStartingCloseTag) {
- var tagName = contextToken.parent.parent.openingElement.tagName;
- var tagSymbol = typeChecker.getSymbolAtLocation(tagName);
- if (!typeChecker.isUnknownSymbol(tagSymbol)) {
- symbols = [tagSymbol];
- }
- isMemberCompletion = true;
- isNewIdentifierLocation = false;
- }
- else {
- if (!tryGetGlobalSymbols()) {
- return undefined;
- }
- isGlobalCompletion = true;
- }
- log("getCompletionData: Semantic work: " + (ts.timestamp() - semanticStart));
- return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName: isJsDocTagName };
- function getTypeScriptMemberSymbols() {
- isGlobalCompletion = false;
- isMemberCompletion = true;
- isNewIdentifierLocation = false;
- if (node.kind === 69 || node.kind === 139 || node.kind === 172) {
- var symbol = typeChecker.getSymbolAtLocation(node);
- if (symbol && symbol.flags & 8388608) {
- symbol = typeChecker.getAliasedSymbol(symbol);
+ else if (token === 118 ||
+ token === 133 ||
+ token === 131 ||
+ token === 121 ||
+ token === 134) {
+ if (angleBracketStack > 0 && !syntacticClassifierAbsent) {
+ token = 70;
+ }
}
- if (symbol && symbol.flags & 1952) {
- var exportedSymbols = typeChecker.getExportsOfModule(symbol);
- ts.forEach(exportedSymbols, function (symbol) {
- if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) {
- symbols.push(symbol);
- }
- });
+ else if (token === 13) {
+ templateStack.push(token);
}
- }
- var type = typeChecker.getTypeAtLocation(node);
- addTypeProperties(type);
- }
- function addTypeProperties(type) {
- if (type) {
- for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
- var symbol = _a[_i];
- if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) {
- symbols.push(symbol);
+ else if (token === 16) {
+ if (templateStack.length > 0) {
+ templateStack.push(token);
}
}
- if (isJavaScriptFile && type.flags & 524288) {
- var unionType = type;
- for (var _b = 0, _c = unionType.types; _b < _c.length; _b++) {
- var elementType = _c[_b];
- addTypeProperties(elementType);
+ else if (token === 17) {
+ if (templateStack.length > 0) {
+ var lastTemplateStackToken = ts.lastOrUndefined(templateStack);
+ if (lastTemplateStackToken === 13) {
+ token = scanner.reScanTemplateToken();
+ if (token === 15) {
+ templateStack.pop();
+ }
+ else {
+ ts.Debug.assert(token === 14, "Should have been a template middle. Was " + token);
+ }
+ }
+ else {
+ ts.Debug.assert(lastTemplateStackToken === 16, "Should have been an open brace. Was: " + token);
+ templateStack.pop();
+ }
}
}
+ lastNonTriviaToken = token;
}
- }
- function tryGetGlobalSymbols() {
- var objectLikeContainer;
- var namedImportsOrExports;
- var jsxContainer;
- if (objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken)) {
- return tryGetObjectLikeCompletionSymbols(objectLikeContainer);
- }
- if (namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken)) {
- return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports);
- }
- if (jsxContainer = tryGetContainingJsxElement(contextToken)) {
- var attrsType = void 0;
- if ((jsxContainer.kind === 242) || (jsxContainer.kind === 243)) {
- attrsType = typeChecker.getJsxElementAttributesType(jsxContainer);
- isGlobalCompletion = false;
- if (attrsType) {
- symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes);
- isMemberCompletion = true;
- isNewIdentifierLocation = false;
- return true;
+ processToken();
+ } while (token !== 1);
+ return result;
+ function processToken() {
+ var start = scanner.getTokenPos();
+ var end = scanner.getTextPos();
+ addResult(start, end, classFromKind(token));
+ if (end >= text.length) {
+ if (token === 9) {
+ var tokenText = scanner.getTokenText();
+ if (scanner.isUnterminated()) {
+ var lastCharIndex = tokenText.length - 1;
+ var numBackslashes = 0;
+ while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92) {
+ numBackslashes++;
+ }
+ if (numBackslashes & 1) {
+ var quoteChar = tokenText.charCodeAt(0);
+ result.endOfLineState = quoteChar === 34
+ ? 3
+ : 2;
+ }
}
}
- }
- isMemberCompletion = false;
- isNewIdentifierLocation = isNewIdentifierDefinitionLocation(contextToken);
- if (previousToken !== contextToken) {
- ts.Debug.assert(!!previousToken, "Expected 'contextToken' to be defined when different from 'previousToken'.");
- }
- var adjustedPosition = previousToken !== contextToken ?
- previousToken.getStart() :
- position;
- var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
- var symbolMeanings = 793064 | 107455 | 1920 | 8388608;
- symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings);
- return true;
- }
- function getScopeNode(initialToken, position, sourceFile) {
- var scope = initialToken;
- while (scope && !ts.positionBelongsToNode(scope, position, sourceFile)) {
- scope = scope.parent;
- }
- return scope;
- }
- function isCompletionListBlocker(contextToken) {
- var start = ts.timestamp();
- var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
- isSolelyIdentifierDefinitionLocation(contextToken) ||
- isDotOfNumericLiteral(contextToken) ||
- isInJsxText(contextToken);
- log("getCompletionsAtPosition: isCompletionListBlocker: " + (ts.timestamp() - start));
- return result;
- }
- function isInJsxText(contextToken) {
- if (contextToken.kind === 244) {
- return true;
- }
- if (contextToken.kind === 27 && contextToken.parent) {
- if (contextToken.parent.kind === 243) {
- return true;
- }
- if (contextToken.parent.kind === 245 || contextToken.parent.kind === 242) {
- return contextToken.parent.parent && contextToken.parent.parent.kind === 241;
- }
- }
- return false;
- }
- function isNewIdentifierDefinitionLocation(previousToken) {
- if (previousToken) {
- var containingNodeKind = previousToken.parent.kind;
- switch (previousToken.kind) {
- case 24:
- return containingNodeKind === 174
- || containingNodeKind === 148
- || containingNodeKind === 175
- || containingNodeKind === 170
- || containingNodeKind === 187
- || containingNodeKind === 156;
- case 17:
- return containingNodeKind === 174
- || containingNodeKind === 148
- || containingNodeKind === 175
- || containingNodeKind === 178
- || containingNodeKind === 164;
- case 19:
- return containingNodeKind === 170
- || containingNodeKind === 153
- || containingNodeKind === 140;
- case 125:
- case 126:
- return true;
- case 21:
- return containingNodeKind === 225;
- case 15:
- return containingNodeKind === 221;
- case 56:
- return containingNodeKind === 218
- || containingNodeKind === 187;
- case 12:
- return containingNodeKind === 189;
- case 13:
- return containingNodeKind === 197;
- case 112:
- case 110:
- case 111:
- return containingNodeKind === 145;
- }
- switch (previousToken.getText()) {
- case "public":
- case "protected":
- case "private":
- return true;
- }
- }
- return false;
- }
- function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) {
- if (contextToken.kind === 9
- || contextToken.kind === 10
- || ts.isTemplateLiteralKind(contextToken.kind)) {
- var start_3 = contextToken.getStart();
- var end = contextToken.getEnd();
- if (start_3 < position && position < end) {
- return true;
- }
- if (position === end) {
- return !!contextToken.isUnterminated
- || contextToken.kind === 10;
+ else if (token === 3) {
+ if (scanner.isUnterminated()) {
+ result.endOfLineState = 1;
+ }
}
- }
- return false;
- }
- function tryGetObjectLikeCompletionSymbols(objectLikeContainer) {
- isMemberCompletion = true;
- var typeForObject;
- var existingMembers;
- if (objectLikeContainer.kind === 171) {
- isNewIdentifierLocation = true;
- typeForObject = typeChecker.getContextualType(objectLikeContainer);
- typeForObject = typeForObject && typeForObject.getNonNullableType();
- existingMembers = objectLikeContainer.properties;
- }
- else if (objectLikeContainer.kind === 167) {
- isNewIdentifierLocation = false;
- var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);
- if (ts.isVariableLike(rootDeclaration)) {
- var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);
- if (!canGetType && rootDeclaration.kind === 142) {
- if (ts.isExpression(rootDeclaration.parent)) {
- canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
+ else if (ts.isTemplateLiteralKind(token)) {
+ if (scanner.isUnterminated()) {
+ if (token === 15) {
+ result.endOfLineState = 5;
}
- else if (rootDeclaration.parent.kind === 147 || rootDeclaration.parent.kind === 150) {
- canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);
+ else if (token === 12) {
+ result.endOfLineState = 4;
+ }
+ else {
+ ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token);
}
- }
- if (canGetType) {
- typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
- existingMembers = objectLikeContainer.elements;
}
}
- else {
- ts.Debug.fail("Root declaration is not variable-like.");
+ else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 13) {
+ result.endOfLineState = 6;
}
}
- else {
- ts.Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind);
+ }
+ function addResult(start, end, classification) {
+ if (classification === 8) {
+ return;
}
- if (!typeForObject) {
- return false;
+ if (start === 0 && offset > 0) {
+ start += offset;
}
- var typeMembers = typeChecker.getPropertiesOfType(typeForObject);
- if (typeMembers && typeMembers.length > 0) {
- symbols = filterObjectMembersList(typeMembers, existingMembers);
+ start -= offset;
+ end -= offset;
+ var length = end - start;
+ if (length > 0) {
+ result.spans.push(start);
+ result.spans.push(length);
+ result.spans.push(classification);
}
- return true;
}
- function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) {
- var declarationKind = namedImportsOrExports.kind === 233 ?
- 230 :
- 236;
- var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind);
- var moduleSpecifier = importOrExportDeclaration.moduleSpecifier;
- if (!moduleSpecifier) {
+ }
+ function isBinaryExpressionOperatorToken(token) {
+ switch (token) {
+ case 38:
+ case 40:
+ case 41:
+ case 36:
+ case 37:
+ case 44:
+ case 45:
+ case 46:
+ case 26:
+ case 28:
+ case 29:
+ case 30:
+ case 92:
+ case 91:
+ case 117:
+ case 31:
+ case 32:
+ case 33:
+ case 34:
+ case 47:
+ case 49:
+ case 48:
+ case 52:
+ case 53:
+ case 68:
+ case 67:
+ case 69:
+ case 64:
+ case 65:
+ case 66:
+ case 58:
+ case 59:
+ case 60:
+ case 62:
+ case 63:
+ case 57:
+ case 25:
+ return true;
+ default:
return false;
- }
- isMemberCompletion = true;
- isNewIdentifierLocation = false;
- var exports;
- var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier);
- if (moduleSpecifierSymbol) {
- exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol);
- }
- symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : ts.emptyArray;
- return true;
}
- function tryGetObjectLikeCompletionContainer(contextToken) {
- if (contextToken) {
- switch (contextToken.kind) {
- case 15:
- case 24:
- var parent_18 = contextToken.parent;
- if (parent_18 && (parent_18.kind === 171 || parent_18.kind === 167)) {
- return parent_18;
- }
- break;
- }
- }
- return undefined;
+ }
+ function isPrefixUnaryExpressionOperatorToken(token) {
+ switch (token) {
+ case 36:
+ case 37:
+ case 51:
+ case 50:
+ case 42:
+ case 43:
+ return true;
+ default:
+ return false;
}
- function tryGetNamedImportsOrExportsForCompletion(contextToken) {
- if (contextToken) {
- switch (contextToken.kind) {
- case 15:
- case 24:
- switch (contextToken.parent.kind) {
- case 233:
- case 237:
- return contextToken.parent;
- }
- }
- }
- return undefined;
+ }
+ function isKeyword(token) {
+ return token >= 71 && token <= 139;
+ }
+ function classFromKind(token) {
+ if (isKeyword(token)) {
+ return 3;
}
- function tryGetContainingJsxElement(contextToken) {
- if (contextToken) {
- var parent_19 = contextToken.parent;
- switch (contextToken.kind) {
- case 26:
- case 39:
- case 69:
- case 246:
- case 247:
- if (parent_19 && (parent_19.kind === 242 || parent_19.kind === 243)) {
- return parent_19;
- }
- else if (parent_19.kind === 246) {
- return parent_19.parent;
- }
- break;
- case 9:
- if (parent_19 && ((parent_19.kind === 246) || (parent_19.kind === 247))) {
- return parent_19.parent;
- }
- break;
- case 16:
- if (parent_19 &&
- parent_19.kind === 248 &&
- parent_19.parent &&
- (parent_19.parent.kind === 246)) {
- return parent_19.parent.parent;
- }
- if (parent_19 && parent_19.kind === 247) {
- return parent_19.parent;
- }
- break;
+ else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) {
+ return 5;
+ }
+ else if (token >= 16 && token <= 69) {
+ return 10;
+ }
+ switch (token) {
+ case 8:
+ return 4;
+ case 9:
+ return 6;
+ case 11:
+ return 7;
+ case 7:
+ case 3:
+ case 2:
+ return 1;
+ case 5:
+ case 4:
+ return 8;
+ case 70:
+ default:
+ if (ts.isTemplateLiteralKind(token)) {
+ return 6;
}
- }
- return undefined;
+ return 2;
}
- function isFunction(kind) {
- switch (kind) {
- case 179:
- case 180:
- case 220:
- case 147:
- case 146:
- case 149:
- case 150:
- case 151:
- case 152:
- case 153:
- return true;
- }
- return false;
+ }
+ return {
+ getClassificationsForLine: getClassificationsForLine,
+ getEncodedLexicalClassifications: getEncodedLexicalClassifications
+ };
+ }
+ ts.createClassifier = createClassifier;
+ function getSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) {
+ return convertClassifications(getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span));
+ }
+ ts.getSemanticClassifications = getSemanticClassifications;
+ function checkForClassificationCancellation(cancellationToken, kind) {
+ switch (kind) {
+ case 226:
+ case 222:
+ case 223:
+ case 221:
+ cancellationToken.throwIfCancellationRequested();
+ }
+ }
+ function getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) {
+ var result = [];
+ processNode(sourceFile);
+ return { spans: result, endOfLineState: 0 };
+ function pushClassification(start, length, type) {
+ result.push(start);
+ result.push(length);
+ result.push(type);
+ }
+ function classifySymbol(symbol, meaningAtPosition) {
+ var flags = symbol.getFlags();
+ if ((flags & 788448) === 0) {
+ return;
}
- function isSolelyIdentifierDefinitionLocation(contextToken) {
- var containingNodeKind = contextToken.parent.kind;
- switch (contextToken.kind) {
- case 24:
- return containingNodeKind === 218 ||
- containingNodeKind === 219 ||
- containingNodeKind === 200 ||
- containingNodeKind === 224 ||
- isFunction(containingNodeKind) ||
- containingNodeKind === 221 ||
- containingNodeKind === 192 ||
- containingNodeKind === 222 ||
- containingNodeKind === 168 ||
- containingNodeKind === 223;
- case 21:
- return containingNodeKind === 168;
- case 54:
- return containingNodeKind === 169;
- case 19:
- return containingNodeKind === 168;
- case 17:
- return containingNodeKind === 252 ||
- isFunction(containingNodeKind);
- case 15:
- return containingNodeKind === 224 ||
- containingNodeKind === 222 ||
- containingNodeKind === 159;
- case 23:
- return containingNodeKind === 144 &&
- contextToken.parent && contextToken.parent.parent &&
- (contextToken.parent.parent.kind === 222 ||
- contextToken.parent.parent.kind === 159);
- case 25:
- return containingNodeKind === 221 ||
- containingNodeKind === 192 ||
- containingNodeKind === 222 ||
- containingNodeKind === 223 ||
- isFunction(containingNodeKind);
- case 113:
- return containingNodeKind === 145;
- case 22:
- return containingNodeKind === 142 ||
- (contextToken.parent && contextToken.parent.parent &&
- contextToken.parent.parent.kind === 168);
- case 112:
- case 110:
- case 111:
- return containingNodeKind === 142;
- case 116:
- return containingNodeKind === 234 ||
- containingNodeKind === 238 ||
- containingNodeKind === 232;
- case 73:
- case 81:
- case 107:
- case 87:
- case 102:
- case 123:
- case 131:
- case 89:
- case 108:
- case 74:
- case 114:
- case 134:
- return true;
- }
- switch (contextToken.getText()) {
- case "abstract":
- case "async":
- case "class":
- case "const":
- case "declare":
- case "enum":
- case "function":
- case "interface":
- case "let":
- case "private":
- case "protected":
- case "public":
- case "static":
- case "var":
- case "yield":
- return true;
- }
- return false;
+ if (flags & 32) {
+ return 11;
}
- function isDotOfNumericLiteral(contextToken) {
- if (contextToken.kind === 8) {
- var text = contextToken.getFullText();
- return text.charAt(text.length - 1) === ".";
- }
- return false;
+ else if (flags & 384) {
+ return 12;
}
- function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) {
- var existingImportsOrExports = ts.createMap();
- for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) {
- var element = namedImportsOrExports_1[_i];
- if (element.getStart() <= position && position <= element.getEnd()) {
- continue;
- }
- var name_48 = element.propertyName || element.name;
- existingImportsOrExports[name_48.text] = true;
+ else if (flags & 524288) {
+ return 16;
+ }
+ else if (meaningAtPosition & 2) {
+ if (flags & 64) {
+ return 13;
}
- if (!ts.someProperties(existingImportsOrExports)) {
- return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; });
+ else if (flags & 262144) {
+ return 15;
}
- return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports[e.name]; });
}
- function filterObjectMembersList(contextualMemberSymbols, existingMembers) {
- if (!existingMembers || existingMembers.length === 0) {
- return contextualMemberSymbols;
+ else if (flags & 1536) {
+ if (meaningAtPosition & 4 ||
+ (meaningAtPosition & 1 && hasValueSideModule(symbol))) {
+ return 14;
}
- var existingMemberNames = ts.createMap();
- for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) {
- var m = existingMembers_1[_i];
- if (m.kind !== 253 &&
- m.kind !== 254 &&
- m.kind !== 169 &&
- m.kind !== 147) {
- continue;
- }
- if (m.getStart() <= position && position <= m.getEnd()) {
- continue;
- }
- var existingName = void 0;
- if (m.kind === 169 && m.propertyName) {
- if (m.propertyName.kind === 69) {
- existingName = m.propertyName.text;
+ }
+ return undefined;
+ function hasValueSideModule(symbol) {
+ return ts.forEach(symbol.declarations, function (declaration) {
+ return declaration.kind === 226 &&
+ ts.getModuleInstanceState(declaration) === 1;
+ });
+ }
+ }
+ function processNode(node) {
+ if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) {
+ var kind = node.kind;
+ checkForClassificationCancellation(cancellationToken, kind);
+ if (kind === 70 && !ts.nodeIsMissing(node)) {
+ var identifier = node;
+ if (classifiableNames[identifier.text]) {
+ var symbol = typeChecker.getSymbolAtLocation(node);
+ if (symbol) {
+ var type = classifySymbol(symbol, ts.getMeaningFromLocation(node));
+ if (type) {
+ pushClassification(node.getStart(), node.getWidth(), type);
+ }
}
}
- else {
- existingName = m.name.text;
- }
- existingMemberNames[existingName] = true;
}
- return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; });
+ ts.forEachChild(node, processNode);
}
- function filterJsxAttributes(symbols, attributes) {
- var seenNames = ts.createMap();
- for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) {
- var attr = attributes_1[_i];
- if (attr.getStart() <= position && position <= attr.getEnd()) {
+ }
+ }
+ ts.getEncodedSemanticClassifications = getEncodedSemanticClassifications;
+ function getClassificationTypeName(type) {
+ switch (type) {
+ case 1: return ts.ClassificationTypeNames.comment;
+ case 2: return ts.ClassificationTypeNames.identifier;
+ case 3: return ts.ClassificationTypeNames.keyword;
+ case 4: return ts.ClassificationTypeNames.numericLiteral;
+ case 5: return ts.ClassificationTypeNames.operator;
+ case 6: return ts.ClassificationTypeNames.stringLiteral;
+ case 8: return ts.ClassificationTypeNames.whiteSpace;
+ case 9: return ts.ClassificationTypeNames.text;
+ case 10: return ts.ClassificationTypeNames.punctuation;
+ case 11: return ts.ClassificationTypeNames.className;
+ case 12: return ts.ClassificationTypeNames.enumName;
+ case 13: return ts.ClassificationTypeNames.interfaceName;
+ case 14: return ts.ClassificationTypeNames.moduleName;
+ case 15: return ts.ClassificationTypeNames.typeParameterName;
+ case 16: return ts.ClassificationTypeNames.typeAliasName;
+ case 17: return ts.ClassificationTypeNames.parameterName;
+ case 18: return ts.ClassificationTypeNames.docCommentTagName;
+ case 19: return ts.ClassificationTypeNames.jsxOpenTagName;
+ case 20: return ts.ClassificationTypeNames.jsxCloseTagName;
+ case 21: return ts.ClassificationTypeNames.jsxSelfClosingTagName;
+ case 22: return ts.ClassificationTypeNames.jsxAttribute;
+ case 23: return ts.ClassificationTypeNames.jsxText;
+ case 24: return ts.ClassificationTypeNames.jsxAttributeStringLiteralValue;
+ }
+ }
+ function convertClassifications(classifications) {
+ ts.Debug.assert(classifications.spans.length % 3 === 0);
+ var dense = classifications.spans;
+ var result = [];
+ for (var i = 0, n = dense.length; i < n; i += 3) {
+ result.push({
+ textSpan: ts.createTextSpan(dense[i], dense[i + 1]),
+ classificationType: getClassificationTypeName(dense[i + 2])
+ });
+ }
+ return result;
+ }
+ function getSyntacticClassifications(cancellationToken, sourceFile, span) {
+ return convertClassifications(getEncodedSyntacticClassifications(cancellationToken, sourceFile, span));
+ }
+ ts.getSyntacticClassifications = getSyntacticClassifications;
+ function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span) {
+ var spanStart = span.start;
+ var spanLength = span.length;
+ var triviaScanner = ts.createScanner(4, false, sourceFile.languageVariant, sourceFile.text);
+ var mergeConflictScanner = ts.createScanner(4, false, sourceFile.languageVariant, sourceFile.text);
+ var result = [];
+ processElement(sourceFile);
+ return { spans: result, endOfLineState: 0 };
+ function pushClassification(start, length, type) {
+ result.push(start);
+ result.push(length);
+ result.push(type);
+ }
+ function classifyLeadingTriviaAndGetTokenStart(token) {
+ triviaScanner.setTextPos(token.pos);
+ while (true) {
+ var start = triviaScanner.getTextPos();
+ if (!ts.couldStartTrivia(sourceFile.text, start)) {
+ return start;
+ }
+ var kind = triviaScanner.scan();
+ var end = triviaScanner.getTextPos();
+ var width = end - start;
+ if (!ts.isTrivia(kind)) {
+ return start;
+ }
+ if (kind === 4 || kind === 5) {
+ continue;
+ }
+ if (ts.isComment(kind)) {
+ classifyComment(token, kind, start, width);
+ triviaScanner.setTextPos(end);
+ continue;
+ }
+ if (kind === 7) {
+ var text = sourceFile.text;
+ var ch = text.charCodeAt(start);
+ if (ch === 60 || ch === 62) {
+ pushClassification(start, width, 1);
continue;
}
- if (attr.kind === 246) {
- seenNames[attr.name.text] = true;
- }
+ ts.Debug.assert(ch === 61);
+ classifyDisabledMergeCode(text, start, end);
}
- return ts.filter(symbols, function (a) { return !seenNames[a.name]; });
}
}
- function getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location) {
- var displayName = ts.getDeclaredName(typeChecker, symbol, location);
- if (displayName) {
- var firstCharCode = displayName.charCodeAt(0);
- if ((symbol.flags & 1920) && (firstCharCode === 39 || firstCharCode === 34)) {
- return undefined;
+ function classifyComment(token, kind, start, width) {
+ if (kind === 3) {
+ var docCommentAndDiagnostics = ts.parseIsolatedJSDocComment(sourceFile.text, start, width);
+ if (docCommentAndDiagnostics && docCommentAndDiagnostics.jsDoc) {
+ docCommentAndDiagnostics.jsDoc.parent = token;
+ classifyJSDocComment(docCommentAndDiagnostics.jsDoc);
+ return;
}
}
- return getCompletionEntryDisplayName(displayName, target, performCharacterChecks);
+ pushCommentRange(start, width);
}
- function getCompletionEntryDisplayName(name, target, performCharacterChecks) {
- if (!name) {
- return undefined;
+ function pushCommentRange(start, width) {
+ pushClassification(start, width, 1);
+ }
+ function classifyJSDocComment(docComment) {
+ var pos = docComment.pos;
+ if (docComment.tags) {
+ for (var _i = 0, _a = docComment.tags; _i < _a.length; _i++) {
+ var tag = _a[_i];
+ if (tag.pos !== pos) {
+ pushCommentRange(pos, tag.pos - pos);
+ }
+ pushClassification(tag.atToken.pos, tag.atToken.end - tag.atToken.pos, 10);
+ pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18);
+ pos = tag.tagName.end;
+ switch (tag.kind) {
+ case 275:
+ processJSDocParameterTag(tag);
+ break;
+ case 278:
+ processJSDocTemplateTag(tag);
+ break;
+ case 277:
+ processElement(tag.typeExpression);
+ break;
+ case 276:
+ processElement(tag.typeExpression);
+ break;
+ }
+ pos = tag.end;
+ }
}
- name = ts.stripQuotes(name);
- if (!name) {
- return undefined;
+ if (pos !== docComment.end) {
+ pushCommentRange(pos, docComment.end - pos);
}
- if (performCharacterChecks) {
- if (!ts.isIdentifierText(name, target)) {
- return undefined;
+ return;
+ function processJSDocParameterTag(tag) {
+ if (tag.preParameterName) {
+ pushCommentRange(pos, tag.preParameterName.pos - pos);
+ pushClassification(tag.preParameterName.pos, tag.preParameterName.end - tag.preParameterName.pos, 17);
+ pos = tag.preParameterName.end;
+ }
+ if (tag.typeExpression) {
+ pushCommentRange(pos, tag.typeExpression.pos - pos);
+ processElement(tag.typeExpression);
+ pos = tag.typeExpression.end;
+ }
+ if (tag.postParameterName) {
+ pushCommentRange(pos, tag.postParameterName.pos - pos);
+ pushClassification(tag.postParameterName.pos, tag.postParameterName.end - tag.postParameterName.pos, 17);
+ pos = tag.postParameterName.end;
}
}
- return name;
- }
- var keywordCompletions = [];
- for (var i = 70; i <= 138; i++) {
- keywordCompletions.push({
- name: ts.tokenToString(i),
- kind: ts.ScriptElementKind.keyword,
- kindModifiers: ts.ScriptElementKindModifier.none,
- sortText: "0"
- });
- }
- var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*= 0);
+ if (tokenWidth > 0) {
+ var type = classifiedElementName || classifyTokenType(node.kind, node);
+ if (type) {
+ pushClassification(tokenStart, tokenWidth, type);
}
- return undefined;
- function convertReferencedSymbols(referencedSymbols) {
- if (!referencedSymbols) {
- return undefined;
+ }
+ return true;
+ }
+ function tryClassifyJsxElementName(token) {
+ switch (token.parent && token.parent.kind) {
+ case 244:
+ if (token.parent.tagName === token) {
+ return 19;
}
- var fileNameToDocumentHighlights = ts.createMap();
- var result = [];
- for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) {
- var referencedSymbol = referencedSymbols_1[_i];
- for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
- var referenceEntry = _b[_a];
- var fileName = referenceEntry.fileName;
- var documentHighlights = fileNameToDocumentHighlights[fileName];
- if (!documentHighlights) {
- documentHighlights = { fileName: fileName, highlightSpans: [] };
- fileNameToDocumentHighlights[fileName] = documentHighlights;
- result.push(documentHighlights);
- }
- documentHighlights.highlightSpans.push({
- textSpan: referenceEntry.textSpan,
- kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference
- });
- }
+ break;
+ case 245:
+ if (token.parent.tagName === token) {
+ return 20;
}
- return result;
- }
+ break;
+ case 243:
+ if (token.parent.tagName === token) {
+ return 21;
+ }
+ break;
+ case 246:
+ if (token.parent.name === token) {
+ return 22;
+ }
+ break;
}
- function getSyntacticDocumentHighlights(node) {
- var fileName = sourceFile.fileName;
- var highlightSpans = getHighlightSpans(node);
- if (!highlightSpans || highlightSpans.length === 0) {
- return undefined;
- }
- return [{ fileName: fileName, highlightSpans: highlightSpans }];
- function hasKind(node, kind) {
- return node !== undefined && node.kind === kind;
- }
- function parent(node) {
- return node && node.parent;
+ return undefined;
+ }
+ function classifyTokenType(tokenKind, token) {
+ if (ts.isKeyword(tokenKind)) {
+ return 3;
+ }
+ if (tokenKind === 26 || tokenKind === 28) {
+ if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) {
+ return 10;
}
- function getHighlightSpans(node) {
- if (node) {
- switch (node.kind) {
- case 88:
- case 80:
- if (hasKind(node.parent, 203)) {
- return getIfElseOccurrences(node.parent);
- }
- break;
- case 94:
- if (hasKind(node.parent, 211)) {
- return getReturnOccurrences(node.parent);
- }
- break;
- case 98:
- if (hasKind(node.parent, 215)) {
- return getThrowOccurrences(node.parent);
- }
- break;
- case 72:
- if (hasKind(parent(parent(node)), 216)) {
- return getTryCatchFinallyOccurrences(node.parent.parent);
- }
- break;
- case 100:
- case 85:
- if (hasKind(parent(node), 216)) {
- return getTryCatchFinallyOccurrences(node.parent);
- }
- break;
- case 96:
- if (hasKind(node.parent, 213)) {
- return getSwitchCaseDefaultOccurrences(node.parent);
- }
- break;
- case 71:
- case 77:
- if (hasKind(parent(parent(parent(node))), 213)) {
- return getSwitchCaseDefaultOccurrences(node.parent.parent.parent);
- }
- break;
- case 70:
- case 75:
- if (hasKind(node.parent, 210) || hasKind(node.parent, 209)) {
- return getBreakOrContinueStatementOccurrences(node.parent);
- }
- break;
- case 86:
- if (hasKind(node.parent, 206) ||
- hasKind(node.parent, 207) ||
- hasKind(node.parent, 208)) {
- return getLoopBreakContinueOccurrences(node.parent);
- }
- break;
- case 104:
- case 79:
- if (hasKind(node.parent, 205) || hasKind(node.parent, 204)) {
- return getLoopBreakContinueOccurrences(node.parent);
- }
- break;
- case 121:
- if (hasKind(node.parent, 148)) {
- return getConstructorOccurrences(node.parent);
- }
- break;
- case 123:
- case 131:
- if (hasKind(node.parent, 149) || hasKind(node.parent, 150)) {
- return getGetAndSetOccurrences(node.parent);
- }
- break;
- default:
- if (ts.isModifierKind(node.kind) && node.parent &&
- (ts.isDeclaration(node.parent) || node.parent.kind === 200)) {
- return getModifierOccurrences(node.kind, node.parent);
- }
+ }
+ if (ts.isPunctuation(tokenKind)) {
+ if (token) {
+ if (tokenKind === 57) {
+ if (token.parent.kind === 219 ||
+ token.parent.kind === 146 ||
+ token.parent.kind === 143 ||
+ token.parent.kind === 246) {
+ return 5;
}
}
- return undefined;
+ if (token.parent.kind === 188 ||
+ token.parent.kind === 186 ||
+ token.parent.kind === 187 ||
+ token.parent.kind === 189) {
+ return 5;
+ }
}
- function aggregateOwnedThrowStatements(node) {
- var statementAccumulator = [];
- aggregate(node);
- return statementAccumulator;
- function aggregate(node) {
- if (node.kind === 215) {
- statementAccumulator.push(node);
- }
- else if (node.kind === 216) {
- var tryStatement = node;
- if (tryStatement.catchClause) {
- aggregate(tryStatement.catchClause);
+ return 10;
+ }
+ else if (tokenKind === 8) {
+ return 4;
+ }
+ else if (tokenKind === 9) {
+ return token.parent.kind === 246 ? 24 : 6;
+ }
+ else if (tokenKind === 11) {
+ return 6;
+ }
+ else if (ts.isTemplateLiteralKind(tokenKind)) {
+ return 6;
+ }
+ else if (tokenKind === 10) {
+ return 23;
+ }
+ else if (tokenKind === 70) {
+ if (token) {
+ switch (token.parent.kind) {
+ case 222:
+ if (token.parent.name === token) {
+ return 11;
}
- else {
- aggregate(tryStatement.tryBlock);
+ return;
+ case 142:
+ if (token.parent.name === token) {
+ return 15;
}
- if (tryStatement.finallyBlock) {
- aggregate(tryStatement.finallyBlock);
+ return;
+ case 223:
+ if (token.parent.name === token) {
+ return 13;
}
- }
- else if (!ts.isFunctionLike(node)) {
- ts.forEachChild(node, aggregate);
- }
- }
- }
- function getThrowStatementOwner(throwStatement) {
- var child = throwStatement;
- while (child.parent) {
- var parent_20 = child.parent;
- if (ts.isFunctionBlock(parent_20) || parent_20.kind === 256) {
- return parent_20;
- }
- if (parent_20.kind === 216) {
- var tryStatement = parent_20;
- if (tryStatement.tryBlock === child && tryStatement.catchClause) {
- return child;
+ return;
+ case 225:
+ if (token.parent.name === token) {
+ return 12;
}
- }
- child = parent_20;
- }
- return undefined;
- }
- function aggregateAllBreakAndContinueStatements(node) {
- var statementAccumulator = [];
- aggregate(node);
- return statementAccumulator;
- function aggregate(node) {
- if (node.kind === 210 || node.kind === 209) {
- statementAccumulator.push(node);
- }
- else if (!ts.isFunctionLike(node)) {
- ts.forEachChild(node, aggregate);
- }
+ return;
+ case 226:
+ if (token.parent.name === token) {
+ return 14;
+ }
+ return;
+ case 143:
+ if (token.parent.name === token) {
+ return ts.isThisIdentifier(token) ? 3 : 17;
+ }
+ return;
}
}
- function ownsBreakOrContinueStatement(owner, statement) {
- var actualOwner = getBreakOrContinueOwner(statement);
- return actualOwner && actualOwner === owner;
- }
- function getBreakOrContinueOwner(statement) {
- for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) {
- switch (node_1.kind) {
- case 213:
- if (statement.kind === 209) {
- continue;
- }
- case 206:
- case 207:
- case 208:
- case 205:
- case 204:
- if (!statement.label || isLabeledBy(node_1, statement.label.text)) {
- return node_1;
- }
- break;
- default:
- if (ts.isFunctionLike(node_1)) {
- return undefined;
- }
- break;
- }
+ return 2;
+ }
+ }
+ function processElement(element) {
+ if (!element) {
+ return;
+ }
+ if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) {
+ checkForClassificationCancellation(cancellationToken, element.kind);
+ var children = element.getChildren(sourceFile);
+ for (var i = 0, n = children.length; i < n; i++) {
+ var child = children[i];
+ if (!tryClassifyNode(child)) {
+ processElement(child);
}
- return undefined;
}
- function getModifierOccurrences(modifier, declaration) {
- var container = declaration.parent;
- if (ts.isAccessibilityModifier(modifier)) {
- if (!(container.kind === 221 ||
- container.kind === 192 ||
- (declaration.kind === 142 && hasKind(container, 148)))) {
- return undefined;
- }
- }
- else if (modifier === 113) {
- if (!(container.kind === 221 || container.kind === 192)) {
- return undefined;
- }
- }
- else if (modifier === 82 || modifier === 122) {
- if (!(container.kind === 226 || container.kind === 256)) {
- return undefined;
- }
- }
- else if (modifier === 115) {
- if (!(container.kind === 221 || declaration.kind === 221)) {
- return undefined;
- }
+ }
+ }
+ }
+ ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications;
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var Completions;
+ (function (Completions) {
+ function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) {
+ if (ts.isInReferenceComment(sourceFile, position)) {
+ return getTripleSlashReferenceCompletion(sourceFile, position);
+ }
+ if (ts.isInString(sourceFile, position)) {
+ return getStringLiteralCompletionEntries(sourceFile, position);
+ }
+ var completionData = getCompletionData(typeChecker, log, sourceFile, position);
+ if (!completionData) {
+ return undefined;
+ }
+ var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName;
+ if (isJsDocTagName) {
+ return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getAllJsDocCompletionEntries() };
+ }
+ var entries = [];
+ if (ts.isSourceFileJavaScript(sourceFile)) {
+ var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true);
+ ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames));
+ }
+ else {
+ if (!symbols || symbols.length === 0) {
+ if (sourceFile.languageVariant === 1 &&
+ location.parent && location.parent.kind === 245) {
+ var tagName = location.parent.parent.openingElement.tagName;
+ entries.push({
+ name: tagName.text,
+ kind: undefined,
+ kindModifiers: undefined,
+ sortText: "0",
+ });
}
else {
return undefined;
}
- var keywords = [];
- var modifierFlag = getFlagFromModifier(modifier);
- var nodes;
- switch (container.kind) {
- case 226:
- case 256:
- if (modifierFlag & 128) {
- nodes = declaration.members.concat(declaration);
- }
- else {
- nodes = container.statements;
- }
- break;
- case 148:
- nodes = container.parameters.concat(container.parent.members);
- break;
- case 221:
- case 192:
- nodes = container.members;
- if (modifierFlag & 28) {
- var constructor = ts.forEach(container.members, function (member) {
- return member.kind === 148 && member;
- });
- if (constructor) {
- nodes = nodes.concat(constructor.parameters);
- }
- }
- else if (modifierFlag & 128) {
- nodes = nodes.concat(container);
- }
- break;
- default:
- ts.Debug.fail("Invalid container kind.");
- }
- ts.forEach(nodes, function (node) {
- if (ts.getModifierFlags(node) & modifierFlag) {
- ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); });
- }
- });
- return ts.map(keywords, getHighlightSpanForNode);
- function getFlagFromModifier(modifier) {
- switch (modifier) {
- case 112:
- return 4;
- case 110:
- return 8;
- case 111:
- return 16;
- case 113:
- return 32;
- case 82:
- return 1;
- case 122:
- return 2;
- case 115:
- return 128;
- default:
- ts.Debug.fail();
- }
- }
}
- function pushKeywordIf(keywordList, token) {
- var expected = [];
- for (var _i = 2; _i < arguments.length; _i++) {
- expected[_i - 2] = arguments[_i];
- }
- if (token && ts.contains(expected, token.kind)) {
- keywordList.push(token);
- return true;
+ getCompletionEntriesFromSymbols(symbols, entries, location, true);
+ }
+ if (!isMemberCompletion && !isJsDocTagName) {
+ ts.addRange(entries, keywordCompletions);
+ }
+ return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries };
+ function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) {
+ var entries = [];
+ var nameTable = ts.getNameTable(sourceFile);
+ for (var name_46 in nameTable) {
+ if (nameTable[name_46] === position) {
+ continue;
}
- return false;
- }
- function getGetAndSetOccurrences(accessorDeclaration) {
- var keywords = [];
- tryPushAccessorKeyword(accessorDeclaration.symbol, 149);
- tryPushAccessorKeyword(accessorDeclaration.symbol, 150);
- return ts.map(keywords, getHighlightSpanForNode);
- function tryPushAccessorKeyword(accessorSymbol, accessorKind) {
- var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind);
- if (accessor) {
- ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123, 131); });
+ if (!uniqueNames[name_46]) {
+ uniqueNames[name_46] = name_46;
+ var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_46), compilerOptions.target, true);
+ if (displayName) {
+ var entry = {
+ name: displayName,
+ kind: ts.ScriptElementKind.warning,
+ kindModifiers: "",
+ sortText: "1"
+ };
+ entries.push(entry);
}
}
}
- function getConstructorOccurrences(constructorDeclaration) {
- var declarations = constructorDeclaration.symbol.getDeclarations();
- var keywords = [];
- ts.forEach(declarations, function (declaration) {
- ts.forEach(declaration.getChildren(), function (token) {
- return pushKeywordIf(keywords, token, 121);
- });
- });
- return ts.map(keywords, getHighlightSpanForNode);
+ return entries;
+ }
+ function createCompletionEntry(symbol, location, performCharacterChecks) {
+ var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location);
+ if (!displayName) {
+ return undefined;
}
- function getLoopBreakContinueOccurrences(loopNode) {
- var keywords = [];
- if (pushKeywordIf(keywords, loopNode.getFirstToken(), 86, 104, 79)) {
- if (loopNode.kind === 204) {
- var loopTokens = loopNode.getChildren();
- for (var i = loopTokens.length - 1; i >= 0; i--) {
- if (pushKeywordIf(keywords, loopTokens[i], 104)) {
- break;
- }
+ return {
+ name: displayName,
+ kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location),
+ kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
+ sortText: "0",
+ };
+ }
+ function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) {
+ var start = ts.timestamp();
+ var uniqueNames = ts.createMap();
+ if (symbols) {
+ for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) {
+ var symbol = symbols_4[_i];
+ var entry = createCompletionEntry(symbol, location, performCharacterChecks);
+ if (entry) {
+ var id = ts.escapeIdentifier(entry.name);
+ if (!uniqueNames[id]) {
+ entries.push(entry);
+ uniqueNames[id] = id;
}
}
}
- var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement);
- ts.forEach(breaksAndContinues, function (statement) {
- if (ownsBreakOrContinueStatement(loopNode, statement)) {
- pushKeywordIf(keywords, statement.getFirstToken(), 70, 75);
- }
- });
- return ts.map(keywords, getHighlightSpanForNode);
}
- function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) {
- var owner = getBreakOrContinueOwner(breakOrContinueStatement);
- if (owner) {
- switch (owner.kind) {
- case 206:
- case 207:
- case 208:
- case 204:
- case 205:
- return getLoopBreakContinueOccurrences(owner);
- case 213:
- return getSwitchCaseDefaultOccurrences(owner);
- }
- }
+ log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start));
+ return uniqueNames;
+ }
+ function getStringLiteralCompletionEntries(sourceFile, position) {
+ var node = ts.findPrecedingToken(position, sourceFile);
+ if (!node || node.kind !== 9) {
return undefined;
}
- function getSwitchCaseDefaultOccurrences(switchStatement) {
- var keywords = [];
- pushKeywordIf(keywords, switchStatement.getFirstToken(), 96);
- ts.forEach(switchStatement.caseBlock.clauses, function (clause) {
- pushKeywordIf(keywords, clause.getFirstToken(), 71, 77);
- var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause);
- ts.forEach(breaksAndContinues, function (statement) {
- if (ownsBreakOrContinueStatement(switchStatement, statement)) {
- pushKeywordIf(keywords, statement.getFirstToken(), 70);
- }
- });
- });
- return ts.map(keywords, getHighlightSpanForNode);
+ if (node.parent.kind === 253 &&
+ node.parent.parent.kind === 172 &&
+ node.parent.name === node) {
+ return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent);
}
- function getTryCatchFinallyOccurrences(tryStatement) {
- var keywords = [];
- pushKeywordIf(keywords, tryStatement.getFirstToken(), 100);
- if (tryStatement.catchClause) {
- pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 72);
- }
- if (tryStatement.finallyBlock) {
- var finallyKeyword = ts.findChildOfKind(tryStatement, 85, sourceFile);
- pushKeywordIf(keywords, finallyKeyword, 85);
- }
- return ts.map(keywords, getHighlightSpanForNode);
+ else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) {
+ return getStringLiteralCompletionEntriesFromElementAccess(node.parent);
}
- function getThrowOccurrences(throwStatement) {
- var owner = getThrowStatementOwner(throwStatement);
- if (!owner) {
- return undefined;
- }
- var keywords = [];
- ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) {
- pushKeywordIf(keywords, throwStatement.getFirstToken(), 98);
- });
- if (ts.isFunctionBlock(owner)) {
- ts.forEachReturnStatement(owner, function (returnStatement) {
- pushKeywordIf(keywords, returnStatement.getFirstToken(), 94);
- });
+ else if (node.parent.kind === 231 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) {
+ return getStringLiteralCompletionEntriesFromModuleNames(node);
+ }
+ else {
+ var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile);
+ if (argumentInfo) {
+ return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo);
}
- return ts.map(keywords, getHighlightSpanForNode);
+ return getStringLiteralCompletionEntriesFromContextualType(node);
}
- function getReturnOccurrences(returnStatement) {
- var func = ts.getContainingFunction(returnStatement);
- if (!(func && hasKind(func.body, 199))) {
- return undefined;
+ }
+ function getStringLiteralCompletionEntriesFromPropertyAssignment(element) {
+ var type = typeChecker.getContextualType(element.parent);
+ var entries = [];
+ if (type) {
+ getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, false);
+ if (entries.length) {
+ return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries };
}
- var keywords = [];
- ts.forEachReturnStatement(func.body, function (returnStatement) {
- pushKeywordIf(keywords, returnStatement.getFirstToken(), 94);
- });
- ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) {
- pushKeywordIf(keywords, throwStatement.getFirstToken(), 98);
- });
- return ts.map(keywords, getHighlightSpanForNode);
}
- function getIfElseOccurrences(ifStatement) {
- var keywords = [];
- while (hasKind(ifStatement.parent, 203) && ifStatement.parent.elseStatement === ifStatement) {
- ifStatement = ifStatement.parent;
+ }
+ function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) {
+ var candidates = [];
+ var entries = [];
+ typeChecker.getResolvedSignature(argumentInfo.invocation, candidates);
+ for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) {
+ var candidate = candidates_3[_i];
+ if (candidate.parameters.length > argumentInfo.argumentIndex) {
+ var parameter = candidate.parameters[argumentInfo.argumentIndex];
+ addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries);
}
- while (ifStatement) {
- var children = ifStatement.getChildren();
- pushKeywordIf(keywords, children[0], 88);
- for (var i = children.length - 1; i >= 0; i--) {
- if (pushKeywordIf(keywords, children[i], 80)) {
- break;
- }
- }
- if (!hasKind(ifStatement.elseStatement, 203)) {
- break;
- }
- ifStatement = ifStatement.elseStatement;
- }
- var result = [];
- for (var i = 0; i < keywords.length; i++) {
- if (keywords[i].kind === 80 && i < keywords.length - 1) {
- var elseKeyword = keywords[i];
- var ifKeyword = keywords[i + 1];
- var shouldCombindElseAndIf = true;
- for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) {
- if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) {
- shouldCombindElseAndIf = false;
- break;
- }
- }
- if (shouldCombindElseAndIf) {
- result.push({
- fileName: fileName,
- textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end),
- kind: ts.HighlightSpanKind.reference
- });
- i++;
- continue;
- }
- }
- result.push(getHighlightSpanForNode(keywords[i]));
- }
- return result;
}
- }
- }
- DocumentHighlights.getDocumentHighlights = getDocumentHighlights;
- function isLabeledBy(node, labelName) {
- for (var owner = node.parent; owner.kind === 214; owner = owner.parent) {
- if (owner.label.text === labelName) {
- return true;
+ if (entries.length) {
+ return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries };
}
+ return undefined;
}
- return false;
- }
- })(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) {
- if (currentDirectory === void 0) { currentDirectory = ""; }
- var buckets = ts.createMap();
- var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames);
- function getKeyForCompilationSettings(settings) {
- return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths);
- }
- function getBucketForCompilationSettings(key, createIfMissing) {
- var bucket = buckets[key];
- if (!bucket && createIfMissing) {
- buckets[key] = bucket = ts.createFileMap();
- }
- return bucket;
- }
- function reportStats() {
- var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) {
- var entries = buckets[name];
- var sourceFiles = [];
- entries.forEachValue(function (key, entry) {
- sourceFiles.push({
- name: key,
- refCount: entry.languageServiceRefCount,
- references: entry.owners.slice(0)
- });
- });
- sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; });
- return {
- bucket: name,
- sourceFiles: sourceFiles
- };
- });
- return JSON.stringify(bucketInfoArray, undefined, 2);
- }
- function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) {
- var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
- var key = getKeyForCompilationSettings(compilationSettings);
- return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind);
- }
- function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) {
- return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, true, scriptKind);
- }
- function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) {
- var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
- var key = getKeyForCompilationSettings(compilationSettings);
- return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind);
- }
- function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) {
- return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, false, scriptKind);
- }
- function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) {
- var bucket = getBucketForCompilationSettings(key, true);
- var entry = bucket.get(path);
- if (!entry) {
- ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?");
- var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false, scriptKind);
- entry = {
- sourceFile: sourceFile,
- languageServiceRefCount: 0,
- owners: []
- };
- bucket.set(path, entry);
- }
- else {
- if (entry.sourceFile.version !== version) {
- entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot));
+ function getStringLiteralCompletionEntriesFromElementAccess(node) {
+ var type = typeChecker.getTypeAtLocation(node.expression);
+ var entries = [];
+ if (type) {
+ getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, false);
+ if (entries.length) {
+ return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries };
+ }
}
+ return undefined;
}
- if (acquiring) {
- entry.languageServiceRefCount++;
- }
- return entry.sourceFile;
- }
- function releaseDocument(fileName, compilationSettings) {
- var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
- var key = getKeyForCompilationSettings(compilationSettings);
- return releaseDocumentWithKey(path, key);
- }
- function releaseDocumentWithKey(path, key) {
- var bucket = getBucketForCompilationSettings(key, false);
- ts.Debug.assert(bucket !== undefined);
- var entry = bucket.get(path);
- entry.languageServiceRefCount--;
- ts.Debug.assert(entry.languageServiceRefCount >= 0);
- if (entry.languageServiceRefCount === 0) {
- bucket.remove(path);
- }
- }
- return {
- acquireDocument: acquireDocument,
- acquireDocumentWithKey: acquireDocumentWithKey,
- updateDocument: updateDocument,
- updateDocumentWithKey: updateDocumentWithKey,
- releaseDocument: releaseDocument,
- releaseDocumentWithKey: releaseDocumentWithKey,
- reportStats: reportStats,
- getKeyForCompilationSettings: getKeyForCompilationSettings
- };
- }
- ts.createDocumentRegistry = createDocumentRegistry;
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var FindAllReferences;
- (function (FindAllReferences) {
- function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) {
- var node = ts.getTouchingPropertyName(sourceFile, position, true);
- if (node === sourceFile) {
+ function getStringLiteralCompletionEntriesFromContextualType(node) {
+ var type = typeChecker.getContextualType(node);
+ if (type) {
+ var entries_2 = [];
+ addStringLiteralCompletionsFromType(type, entries_2);
+ if (entries_2.length) {
+ return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 };
+ }
+ }
return undefined;
}
- switch (node.kind) {
- case 8:
- if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {
- break;
+ function addStringLiteralCompletionsFromType(type, result) {
+ if (!type) {
+ return;
+ }
+ if (type.flags & 524288) {
+ ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); });
+ }
+ else {
+ if (type.flags & 32) {
+ result.push({
+ name: type.text,
+ kindModifiers: ts.ScriptElementKindModifier.none,
+ kind: ts.ScriptElementKind.variableElement,
+ sortText: "0"
+ });
}
- case 69:
- case 97:
- case 121:
- case 9:
- return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, false);
+ }
}
- return undefined;
- }
- FindAllReferences.findReferencedSymbols = findReferencedSymbols;
- function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) {
- if (!implementations) {
- if (ts.isLabelName(node)) {
- if (ts.isJumpStatementTarget(node)) {
- var labelDefinition = ts.getTargetLabel(node.parent, node.text);
- return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined;
+ function getStringLiteralCompletionEntriesFromModuleNames(node) {
+ var literalValue = ts.normalizeSlashes(node.text);
+ var scriptPath = node.getSourceFile().path;
+ var scriptDirectory = ts.getDirectoryPath(scriptPath);
+ var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1);
+ var entries;
+ if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) {
+ if (compilerOptions.rootDirs) {
+ entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath);
}
else {
- return getLabelReferencesInNode(node.parent, node);
+ entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath);
}
}
- if (ts.isThis(node)) {
- return getReferencesForThisKeyword(node, sourceFiles);
- }
- if (node.kind === 95) {
- return getReferencesForSuperKeyword(node);
+ else {
+ entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span);
}
+ return {
+ isGlobalCompletion: false,
+ isMemberCompletion: false,
+ isNewIdentifierLocation: true,
+ entries: entries
+ };
}
- var symbol = typeChecker.getSymbolAtLocation(node);
- if (!implementations && !symbol && node.kind === 9) {
- return getReferencesForStringLiteral(node, sourceFiles);
- }
- if (!symbol) {
- return undefined;
- }
- var declarations = symbol.declarations;
- if (!declarations || !declarations.length) {
- return undefined;
- }
- var result;
- var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations);
- var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node));
- var scope = getSymbolScope(symbol);
- var symbolToIndex = [];
- if (scope) {
- result = [];
- getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex);
- }
- else {
- var internedName = getInternedName(symbol, node, declarations);
- for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) {
- var sourceFile = sourceFiles_8[_i];
- cancellationToken.throwIfCancellationRequested();
- var nameTable = ts.getNameTable(sourceFile);
- if (nameTable[internedName] !== undefined) {
- result = result || [];
- getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex);
+ function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) {
+ rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); });
+ var relativeDirectory;
+ for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) {
+ var rootDirectory = rootDirs_1[_i];
+ if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) {
+ relativeDirectory = scriptPath.substr(rootDirectory.length);
+ break;
}
}
+ return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); }));
}
- return result;
- function getDefinition(symbol) {
- var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node);
- var name = ts.map(info.displayParts, function (p) { return p.text; }).join("");
- var declarations = symbol.declarations;
- if (!declarations || declarations.length === 0) {
- return undefined;
+ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) {
+ var basePath = compilerOptions.project || host.getCurrentDirectory();
+ var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
+ var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase);
+ var result = [];
+ for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) {
+ var baseDirectory = baseDirectories_1[_i];
+ getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result);
}
- return {
- containerKind: "",
- containerName: "",
- name: name,
- kind: info.symbolKind,
- fileName: declarations[0].getSourceFile().fileName,
- textSpan: ts.createTextSpan(declarations[0].getStart(), 0),
- displayParts: info.displayParts
- };
+ return result;
}
- function getAliasSymbolForPropertyNameSymbol(symbol, location) {
- if (symbol.flags & 8388608) {
- var defaultImport = ts.getDeclarationOfKind(symbol, 231);
- if (defaultImport) {
- return typeChecker.getAliasedSymbol(symbol);
+ function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) {
+ if (result === void 0) { result = []; }
+ if (fragment === undefined) {
+ fragment = "";
+ }
+ fragment = ts.normalizeSlashes(fragment);
+ fragment = ts.getDirectoryPath(fragment);
+ if (fragment === "") {
+ fragment = "." + ts.directorySeparator;
+ }
+ fragment = ts.ensureTrailingDirectorySeparator(fragment);
+ var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment));
+ var baseDirectory = ts.getDirectoryPath(absolutePath);
+ var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
+ if (tryDirectoryExists(host, baseDirectory)) {
+ var files = tryReadDirectory(host, baseDirectory, extensions, undefined, ["./*"]);
+ if (files) {
+ var foundFiles = ts.createMap();
+ for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
+ var filePath = files_3[_i];
+ filePath = ts.normalizePath(filePath);
+ if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0) {
+ continue;
+ }
+ var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath));
+ if (!foundFiles[foundFileName]) {
+ foundFiles[foundFileName] = true;
+ }
+ }
+ for (var foundFile in foundFiles) {
+ result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span));
+ }
}
- var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 234 ||
- declaration.kind === 238) ? declaration : undefined; });
- if (importOrExportSpecifier &&
- (!importOrExportSpecifier.propertyName ||
- importOrExportSpecifier.propertyName === location)) {
- return importOrExportSpecifier.kind === 234 ?
- typeChecker.getAliasedSymbol(symbol) :
- typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier);
+ var directories = tryGetDirectories(host, baseDirectory);
+ if (directories) {
+ for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) {
+ var directory = directories_2[_a];
+ var directoryName = ts.getBaseFileName(ts.normalizePath(directory));
+ result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span));
+ }
}
}
- return undefined;
- }
- function followAliasIfNecessary(symbol, location) {
- return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol;
- }
- function getPropertySymbolOfDestructuringAssignment(location) {
- return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) &&
- typeChecker.getPropertySymbolOfDestructuringAssignment(location);
- }
- function isObjectBindingPatternElementWithoutPropertyName(symbol) {
- var bindingElement = ts.getDeclarationOfKind(symbol, 169);
- return bindingElement &&
- bindingElement.parent.kind === 167 &&
- !bindingElement.propertyName;
+ return result;
}
- function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) {
- if (isObjectBindingPatternElementWithoutPropertyName(symbol)) {
- var bindingElement = ts.getDeclarationOfKind(symbol, 169);
- var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent);
- return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text);
+ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) {
+ var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths;
+ var result;
+ if (baseUrl) {
+ var fileExtensions = ts.getSupportedExtensions(compilerOptions);
+ var projectDir = compilerOptions.project || host.getCurrentDirectory();
+ var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl);
+ result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, false, span);
+ if (paths) {
+ for (var path in paths) {
+ if (paths.hasOwnProperty(path)) {
+ if (path === "*") {
+ if (paths[path]) {
+ for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) {
+ var pattern = _a[_i];
+ for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) {
+ var match = _c[_b];
+ result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span));
+ }
+ }
+ }
+ }
+ else if (ts.startsWith(path, fragment)) {
+ var entry = paths[path] && paths[path].length === 1 && paths[path][0];
+ if (entry) {
+ result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span));
+ }
+ }
+ }
+ }
+ }
}
- return undefined;
+ else {
+ result = [];
+ }
+ getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result);
+ for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) {
+ var moduleName = _e[_d];
+ result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span));
+ }
+ return result;
}
- function getInternedName(symbol, location, declarations) {
- if (ts.isImportOrExportSpecifierName(location)) {
- return location.getText();
+ function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) {
+ if (host.readDirectory) {
+ var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined;
+ if (parsed) {
+ var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix);
+ var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix);
+ var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix);
+ var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1;
+ var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory;
+ var normalizedSuffix = ts.normalizePath(parsed.suffix);
+ var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory);
+ var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase;
+ var includeGlob = normalizedSuffix ? "**/*" : "./*";
+ var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]);
+ if (matches) {
+ var result = [];
+ for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) {
+ var match = matches_1[_i];
+ var normalizedMatch = ts.normalizePath(match);
+ if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) {
+ continue;
+ }
+ var start = completePrefix.length;
+ var length_5 = normalizedMatch.length - start - normalizedSuffix.length;
+ result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5)));
+ }
+ return result;
+ }
+ }
}
- var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol);
- symbol = localExportDefaultSymbol || symbol;
- return ts.stripQuotes(symbol.name);
+ return undefined;
}
- function getSymbolScope(symbol) {
- var valueDeclaration = symbol.valueDeclaration;
- if (valueDeclaration && (valueDeclaration.kind === 179 || valueDeclaration.kind === 192)) {
- return valueDeclaration;
+ function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) {
+ var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1;
+ var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined;
+ var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); });
+ var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); });
+ if (isNestedModule) {
+ var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment);
+ nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) {
+ if (ts.startsWith(fragment, moduleNameWithSeperator_1)) {
+ return moduleName.substr(moduleNameWithSeperator_1.length);
+ }
+ return moduleName;
+ });
}
- if (symbol.flags & (4 | 8192)) {
- var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8) ? d : undefined; });
- if (privateDeclaration) {
- return ts.getAncestor(privateDeclaration, 221);
+ if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) {
+ for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) {
+ var visibleModule = _a[_i];
+ if (!isNestedModule) {
+ nonRelativeModules.push(visibleModule.moduleName);
+ }
+ else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) {
+ var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, undefined, ["./*"]);
+ if (nestedFiles) {
+ for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) {
+ var f = nestedFiles_1[_b];
+ f = ts.normalizePath(f);
+ var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f));
+ nonRelativeModules.push(nestedModule);
+ }
+ }
+ }
}
}
- if (symbol.flags & 8388608) {
+ return ts.deduplicate(nonRelativeModules);
+ }
+ function getTripleSlashReferenceCompletion(sourceFile, position) {
+ var token = ts.getTokenAtPosition(sourceFile, position);
+ if (!token) {
return undefined;
}
- if (isObjectBindingPatternElementWithoutPropertyName(symbol)) {
+ var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
+ if (!commentRanges || !commentRanges.length) {
return undefined;
}
- if (symbol.parent || (symbol.flags & 268435456)) {
+ var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; });
+ if (!range) {
return undefined;
}
- var scope;
- var declarations = symbol.getDeclarations();
- if (declarations) {
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
- var declaration = declarations_7[_i];
- var container = ts.getContainerNode(declaration);
- if (!container) {
- return undefined;
- }
- if (scope && scope !== container) {
- return undefined;
- }
- if (container.kind === 256 && !ts.isExternalModule(container)) {
- return undefined;
- }
- scope = container;
+ var completionInfo = {
+ isGlobalCompletion: false,
+ isMemberCompletion: false,
+ isNewIdentifierLocation: true,
+ entries: []
+ };
+ var text = sourceFile.text.substr(range.pos, position - range.pos);
+ var match = tripleSlashDirectiveFragmentRegex.exec(text);
+ if (match) {
+ var prefix = match[1];
+ var kind = match[2];
+ var toComplete = match[3];
+ var scriptPath = ts.getDirectoryPath(sourceFile.path);
+ if (kind === "path") {
+ var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length);
+ completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), true, span_10, sourceFile.path);
+ }
+ else {
+ var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length };
+ completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11);
}
}
- return scope;
+ return completionInfo;
}
- function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) {
- var positions = [];
- if (!symbolName || !symbolName.length) {
- return positions;
+ function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) {
+ if (result === void 0) { result = []; }
+ if (options.types) {
+ for (var _i = 0, _a = options.types; _i < _a.length; _i++) {
+ var moduleName = _a[_i];
+ result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span));
+ }
}
- var text = sourceFile.text;
- var sourceLength = text.length;
- var symbolNameLength = symbolName.length;
- var position = text.indexOf(symbolName, start);
- while (position >= 0) {
- cancellationToken.throwIfCancellationRequested();
- if (position > end)
- break;
- var endPosition = position + symbolNameLength;
- if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) &&
- (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) {
- positions.push(position);
+ else if (host.getDirectories) {
+ var typeRoots = void 0;
+ try {
+ typeRoots = ts.getEffectiveTypeRoots(options, host);
+ }
+ catch (e) { }
+ if (typeRoots) {
+ for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) {
+ var root = typeRoots_2[_b];
+ getCompletionEntriesFromDirectories(host, root, span, result);
+ }
}
- position = text.indexOf(symbolName, position + symbolNameLength + 1);
}
- return positions;
- }
- function getLabelReferencesInNode(container, targetLabel) {
- var references = [];
- var sourceFile = container.getSourceFile();
- var labelName = targetLabel.text;
- var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd());
- ts.forEach(possiblePositions, function (position) {
- cancellationToken.throwIfCancellationRequested();
- var node = ts.getTouchingWord(sourceFile, position);
- if (!node || node.getWidth() !== labelName.length) {
- return;
+ if (host.getDirectories) {
+ for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) {
+ var packageJson = _d[_c];
+ var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types");
+ getCompletionEntriesFromDirectories(host, typesDir, span, result);
}
- if (node === targetLabel ||
- (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) {
- references.push(getReferenceEntryFromNode(node));
+ }
+ return result;
+ }
+ function getCompletionEntriesFromDirectories(host, directory, span, result) {
+ if (host.getDirectories && tryDirectoryExists(host, directory)) {
+ var directories = tryGetDirectories(host, directory);
+ if (directories) {
+ for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) {
+ var typeDirectory = directories_3[_i];
+ typeDirectory = ts.normalizePath(typeDirectory);
+ result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span));
+ }
}
- });
- var definition = {
- containerKind: "",
- containerName: "",
- fileName: targetLabel.getSourceFile().fileName,
- kind: ts.ScriptElementKind.label,
- name: labelName,
- textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()),
- displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)]
- };
- return [{ definition: definition, references: references }];
+ }
}
- function isValidReferencePosition(node, searchSymbolName) {
- if (node) {
- switch (node.kind) {
- case 69:
- return node.getWidth() === searchSymbolName.length;
- case 9:
- if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||
- isNameOfExternalModuleImportOrDeclaration(node)) {
- return node.getWidth() === searchSymbolName.length + 2;
- }
- break;
- case 8:
- if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {
- return node.getWidth() === searchSymbolName.length;
- }
+ function findPackageJsons(currentDir) {
+ var paths = [];
+ var currentConfigPath;
+ while (true) {
+ currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, "package.json");
+ if (currentConfigPath) {
+ paths.push(currentConfigPath);
+ currentDir = ts.getDirectoryPath(currentConfigPath);
+ var parent_16 = ts.getDirectoryPath(currentDir);
+ if (currentDir === parent_16) {
break;
+ }
+ currentDir = parent_16;
+ }
+ else {
+ break;
}
}
- return false;
+ return paths;
}
- function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) {
- var sourceFile = container.getSourceFile();
- var start = findInComments ? container.getFullStart() : container.getStart();
- var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd());
- var parents = getParentSymbolsOfPropertyAccess();
- var inheritsFromCache = ts.createMap();
- if (possiblePositions.length) {
- var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation);
- ts.forEach(possiblePositions, function (position) {
- cancellationToken.throwIfCancellationRequested();
- var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);
- if (!isValidReferencePosition(referenceLocation, searchText)) {
- if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) ||
- (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) {
- result.push({
- definition: undefined,
- references: [{
- fileName: sourceFile.fileName,
- textSpan: ts.createTextSpan(position, searchText.length),
- isWriteAccess: false,
- isDefinition: false
- }]
- });
- }
+ function enumerateNodeModulesVisibleToScript(host, scriptPath) {
+ var result = [];
+ if (host.readFile && host.fileExists) {
+ for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) {
+ var packageJson = _a[_i];
+ var contents = tryReadingPackageJson(packageJson);
+ if (!contents) {
return;
}
- if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) {
- return;
+ var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules");
+ var foundModuleNames = [];
+ for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) {
+ var key = nodeModulesDependencyKeys_1[_b];
+ addPotentialPackageNames(contents[key], foundModuleNames);
}
- var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation);
- if (referenceSymbol) {
- var referenceSymbolDeclaration = referenceSymbol.valueDeclaration;
- var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration);
- var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, searchLocation.kind === 121, parents, inheritsFromCache);
- if (relatedSymbol) {
- addReferenceToRelatedSymbol(referenceLocation, relatedSymbol);
- }
- else if (!(referenceSymbol.flags & 67108864) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) {
- addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol);
- }
- else if (searchLocation.kind === 121) {
- findAdditionalConstructorReferences(referenceSymbol, referenceLocation);
- }
+ for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) {
+ var moduleName = foundModuleNames_1[_c];
+ var moduleDir = ts.combinePaths(nodeModulesDir, moduleName);
+ result.push({
+ moduleName: moduleName,
+ moduleDir: moduleDir
+ });
}
- });
+ }
}
- return;
- function getParentSymbolsOfPropertyAccess() {
- if (implementations) {
- var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation);
- if (propertyAccessExpression) {
- var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression);
- if (localParentType) {
- if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== searchSymbol.parent) {
- return [localParentType.symbol];
- }
- else if (localParentType.flags & 1572864) {
- return getSymbolsForClassAndInterfaceComponents(localParentType);
- }
+ return result;
+ function tryReadingPackageJson(filePath) {
+ try {
+ var fileText = tryReadFile(host, filePath);
+ return fileText ? JSON.parse(fileText) : undefined;
+ }
+ catch (e) {
+ return undefined;
+ }
+ }
+ function addPotentialPackageNames(dependencies, result) {
+ if (dependencies) {
+ for (var dep in dependencies) {
+ if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) {
+ result.push(dep);
}
}
}
}
- function getPropertyAccessExpressionFromRightHandSide(node) {
- return ts.isRightSideOfPropertyAccess(node) && node.parent;
+ }
+ function createCompletionEntryForModule(name, kind, replacementSpan) {
+ return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan };
+ }
+ function getDirectoryFragmentTextSpan(text, textStart) {
+ var index = text.lastIndexOf(ts.directorySeparator);
+ var offset = index !== -1 ? index + 1 : 0;
+ return { start: textStart + offset, length: text.length - offset };
+ }
+ function isPathRelativeToScript(path) {
+ if (path && path.length >= 2 && path.charCodeAt(0) === 46) {
+ var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 ? 2 : 1;
+ var slashCharCode = path.charCodeAt(slashIndex);
+ return slashCharCode === 47 || slashCharCode === 92;
}
- function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) {
- ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration));
- var referenceClass = referenceLocation.parent;
- if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) {
- ts.Debug.assert(referenceClass.name === referenceLocation);
- addReferences(findOwnConstructorCalls(searchSymbol));
- }
- else {
- var classExtending = tryGetClassByExtendingIdentifier(referenceLocation);
- if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) {
- addReferences(superConstructorAccesses(classExtending));
- }
- }
+ return false;
+ }
+ function normalizeAndPreserveTrailingSlash(path) {
+ return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path);
+ }
+ }
+ Completions.getCompletionsAtPosition = getCompletionsAtPosition;
+ function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) {
+ var completionData = getCompletionData(typeChecker, log, sourceFile, position);
+ if (completionData) {
+ var symbols = completionData.symbols, location_2 = completionData.location;
+ var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_2) === entryName ? s : undefined; });
+ if (symbol) {
+ var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_2, location_2, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
+ return {
+ name: entryName,
+ kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
+ kind: symbolKind,
+ displayParts: displayParts,
+ documentation: documentation
+ };
}
- function addReferences(references) {
- if (references.length) {
- var referencedSymbol = getReferencedSymbol(searchSymbol);
- ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode));
- }
+ }
+ var keywordCompletion = ts.forEach(keywordCompletions, function (c) { return c.name === entryName; });
+ if (keywordCompletion) {
+ return {
+ name: entryName,
+ kind: ts.ScriptElementKind.keyword,
+ kindModifiers: ts.ScriptElementKindModifier.none,
+ displayParts: [ts.displayPart(entryName, ts.SymbolDisplayPartKind.keyword)],
+ documentation: undefined
+ };
+ }
+ return undefined;
+ }
+ Completions.getCompletionEntryDetails = getCompletionEntryDetails;
+ function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) {
+ var completionData = getCompletionData(typeChecker, log, sourceFile, position);
+ if (completionData) {
+ var symbols = completionData.symbols, location_3 = completionData.location;
+ return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; });
+ }
+ return undefined;
+ }
+ Completions.getCompletionEntrySymbol = getCompletionEntrySymbol;
+ function getCompletionData(typeChecker, log, sourceFile, position) {
+ var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile);
+ var isJsDocTagName = false;
+ var start = ts.timestamp();
+ var currentToken = ts.getTokenAtPosition(sourceFile, position);
+ log("getCompletionData: Get current token: " + (ts.timestamp() - start));
+ start = ts.timestamp();
+ var insideComment = ts.isInsideComment(sourceFile, currentToken, position);
+ log("getCompletionData: Is inside comment: " + (ts.timestamp() - start));
+ if (insideComment) {
+ if (ts.hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === 64) {
+ isJsDocTagName = true;
}
- function findOwnConstructorCalls(classSymbol) {
- var result = [];
- for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) {
- var decl = _a[_i];
- ts.Debug.assert(decl.kind === 148);
- var ctrKeyword = decl.getChildAt(0);
- ts.Debug.assert(ctrKeyword.kind === 121);
- result.push(ctrKeyword);
+ var insideJsDocTagExpression = false;
+ var tag = ts.getJsDocTagAtPosition(sourceFile, position);
+ if (tag) {
+ if (tag.tagName.pos <= position && position <= tag.tagName.end) {
+ isJsDocTagName = true;
}
- ts.forEachProperty(classSymbol.exports, function (member) {
- var decl = member.valueDeclaration;
- if (decl && decl.kind === 147) {
- var body = decl.body;
- if (body) {
- forEachDescendantOfKind(body, 97, function (thisKeyword) {
- if (ts.isNewExpressionTarget(thisKeyword)) {
- result.push(thisKeyword);
- }
- });
+ switch (tag.kind) {
+ case 277:
+ case 275:
+ case 276:
+ var tagWithExpression = tag;
+ if (tagWithExpression.typeExpression) {
+ insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;
}
- }
- });
- return result;
- }
- function superConstructorAccesses(cls) {
- var symbol = cls.symbol;
- var ctr = symbol.members["__constructor"];
- if (!ctr) {
- return [];
- }
- var result = [];
- for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) {
- var decl = _a[_i];
- ts.Debug.assert(decl.kind === 148);
- var body = decl.body;
- if (body) {
- forEachDescendantOfKind(body, 95, function (node) {
- if (ts.isCallExpressionTarget(node)) {
- result.push(node);
- }
- });
- }
+ break;
}
- ;
- return result;
}
- function getReferencedSymbol(symbol) {
- var symbolId = ts.getSymbolId(symbol);
- var index = symbolToIndex[symbolId];
- if (index === undefined) {
- index = result.length;
- symbolToIndex[symbolId] = index;
- result.push({
- definition: getDefinition(symbol),
- references: []
- });
- }
- return result[index];
+ if (isJsDocTagName) {
+ return { symbols: undefined, isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName: isJsDocTagName };
}
- function addReferenceToRelatedSymbol(node, relatedSymbol) {
- var references = getReferencedSymbol(relatedSymbol).references;
- if (implementations) {
- getImplementationReferenceEntryForNode(node, references);
- }
- else {
- references.push(getReferenceEntryFromNode(node));
- }
+ if (!insideJsDocTagExpression) {
+ log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.");
+ return undefined;
}
}
- function getImplementationReferenceEntryForNode(refNode, result) {
- if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) {
- result.push(getReferenceEntryFromNode(refNode.parent));
+ start = ts.timestamp();
+ var previousToken = ts.findPrecedingToken(position, sourceFile);
+ log("getCompletionData: Get previous token 1: " + (ts.timestamp() - start));
+ var contextToken = previousToken;
+ if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) {
+ var start_2 = ts.timestamp();
+ contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile);
+ log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_2));
+ }
+ var node = currentToken;
+ var isRightOfDot = false;
+ var isRightOfOpenTag = false;
+ var isStartingCloseTag = false;
+ var location = ts.getTouchingPropertyName(sourceFile, position);
+ if (contextToken) {
+ if (isCompletionListBlocker(contextToken)) {
+ log("Returning an empty list because completion was requested in an invalid position.");
+ return undefined;
}
- else if (refNode.kind === 69) {
- if (refNode.parent.kind === 254) {
- getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result);
+ var parent_17 = contextToken.parent, kind = contextToken.kind;
+ if (kind === 22) {
+ if (parent_17.kind === 173) {
+ node = contextToken.parent.expression;
+ isRightOfDot = true;
}
- var containingClass = getContainingClassIfInHeritageClause(refNode);
- if (containingClass) {
- result.push(getReferenceEntryFromNode(containingClass));
- return;
+ else if (parent_17.kind === 140) {
+ node = contextToken.parent.left;
+ isRightOfDot = true;
}
- var containingTypeReference = getContainingTypeReference(refNode);
- if (containingTypeReference) {
- var parent_21 = containingTypeReference.parent;
- if (ts.isVariableLike(parent_21) && parent_21.type === containingTypeReference && parent_21.initializer && isImplementationExpression(parent_21.initializer)) {
- maybeAdd(getReferenceEntryFromNode(parent_21.initializer));
- }
- else if (ts.isFunctionLike(parent_21) && parent_21.type === containingTypeReference && parent_21.body) {
- if (parent_21.body.kind === 199) {
- ts.forEachReturnStatement(parent_21.body, function (returnStatement) {
- if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
- maybeAdd(getReferenceEntryFromNode(returnStatement.expression));
- }
- });
- }
- else if (isImplementationExpression(parent_21.body)) {
- maybeAdd(getReferenceEntryFromNode(parent_21.body));
- }
- }
- else if (ts.isAssertionExpression(parent_21) && isImplementationExpression(parent_21.expression)) {
- maybeAdd(getReferenceEntryFromNode(parent_21.expression));
- }
+ else {
+ return undefined;
}
}
- function maybeAdd(a) {
- if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) {
- result.push(a);
+ else if (sourceFile.languageVariant === 1) {
+ if (kind === 26) {
+ isRightOfOpenTag = true;
+ location = contextToken;
+ }
+ else if (kind === 40 && contextToken.parent.kind === 245) {
+ isStartingCloseTag = true;
+ location = contextToken;
}
}
}
- function getSymbolsForClassAndInterfaceComponents(type, result) {
- if (result === void 0) { result = []; }
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var componentType = _a[_i];
- if (componentType.symbol && componentType.symbol.getFlags() & (32 | 64)) {
- result.push(componentType.symbol);
- }
- if (componentType.getFlags() & 1572864) {
- getSymbolsForClassAndInterfaceComponents(componentType, result);
- }
+ var semanticStart = ts.timestamp();
+ var isGlobalCompletion = false;
+ var isMemberCompletion;
+ var isNewIdentifierLocation;
+ var symbols = [];
+ if (isRightOfDot) {
+ getTypeScriptMemberSymbols();
+ }
+ else if (isRightOfOpenTag) {
+ var tagSymbols = typeChecker.getJsxIntrinsicTagNames();
+ if (tryGetGlobalSymbols()) {
+ symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 | 8388608)); }));
}
- return result;
+ else {
+ symbols = tagSymbols;
+ }
+ isMemberCompletion = true;
+ isNewIdentifierLocation = false;
}
- function getContainingTypeReference(node) {
- var topLevelTypeReference = undefined;
- while (node) {
- if (ts.isTypeNode(node)) {
- topLevelTypeReference = node;
- }
- node = node.parent;
+ else if (isStartingCloseTag) {
+ var tagName = contextToken.parent.parent.openingElement.tagName;
+ var tagSymbol = typeChecker.getSymbolAtLocation(tagName);
+ if (!typeChecker.isUnknownSymbol(tagSymbol)) {
+ symbols = [tagSymbol];
}
- return topLevelTypeReference;
+ isMemberCompletion = true;
+ isNewIdentifierLocation = false;
}
- function getContainingClassIfInHeritageClause(node) {
- if (node && node.parent) {
- if (node.kind === 194
- && node.parent.kind === 251
- && ts.isClassLike(node.parent.parent)) {
- return node.parent.parent;
+ else {
+ if (!tryGetGlobalSymbols()) {
+ return undefined;
+ }
+ }
+ log("getCompletionData: Semantic work: " + (ts.timestamp() - semanticStart));
+ return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName: isJsDocTagName };
+ function getTypeScriptMemberSymbols() {
+ isGlobalCompletion = false;
+ isMemberCompletion = true;
+ isNewIdentifierLocation = false;
+ if (node.kind === 70 || node.kind === 140 || node.kind === 173) {
+ var symbol = typeChecker.getSymbolAtLocation(node);
+ if (symbol && symbol.flags & 8388608) {
+ symbol = typeChecker.getAliasedSymbol(symbol);
}
- else if (node.kind === 69 || node.kind === 172) {
- return getContainingClassIfInHeritageClause(node.parent);
+ if (symbol && symbol.flags & 1952) {
+ var exportedSymbols = typeChecker.getExportsOfModule(symbol);
+ ts.forEach(exportedSymbols, function (symbol) {
+ if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) {
+ symbols.push(symbol);
+ }
+ });
}
}
- return undefined;
+ var type = typeChecker.getTypeAtLocation(node);
+ addTypeProperties(type);
}
- function isImplementationExpression(node) {
- if (node.kind === 178) {
- return isImplementationExpression(node.expression);
+ function addTypeProperties(type) {
+ if (type) {
+ for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
+ var symbol = _a[_i];
+ if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) {
+ symbols.push(symbol);
+ }
+ }
+ if (isJavaScriptFile && type.flags & 524288) {
+ var unionType = type;
+ for (var _b = 0, _c = unionType.types; _b < _c.length; _b++) {
+ var elementType = _c[_b];
+ addTypeProperties(elementType);
+ }
+ }
}
- return node.kind === 180 ||
- node.kind === 179 ||
- node.kind === 171 ||
- node.kind === 192 ||
- node.kind === 170;
}
- function explicitlyInheritsFrom(child, parent, cachedResults) {
- var parentIsInterface = parent.getFlags() & 64;
- return searchHierarchy(child);
- function searchHierarchy(symbol) {
- if (symbol === parent) {
- return true;
- }
- var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent);
- if (key in cachedResults) {
- return cachedResults[key];
- }
- cachedResults[key] = false;
- var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) {
- if (ts.isClassLike(declaration)) {
- if (parentIsInterface) {
- var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration);
- if (interfaceReferences) {
- for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) {
- var typeReference = interfaceReferences_1[_i];
- if (searchTypeReference(typeReference)) {
- return true;
- }
- }
- }
- }
- return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));
- }
- else if (declaration.kind === 222) {
- if (parentIsInterface) {
- return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference);
- }
- }
- return false;
- });
- cachedResults[key] = inherits;
- return inherits;
+ function tryGetGlobalSymbols() {
+ var objectLikeContainer;
+ var namedImportsOrExports;
+ var jsxContainer;
+ if (objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken)) {
+ return tryGetObjectLikeCompletionSymbols(objectLikeContainer);
}
- function searchTypeReference(typeReference) {
- if (typeReference) {
- var type = typeChecker.getTypeAtLocation(typeReference);
- if (type && type.symbol) {
- return searchHierarchy(type.symbol);
+ if (namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken)) {
+ return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports);
+ }
+ if (jsxContainer = tryGetContainingJsxElement(contextToken)) {
+ var attrsType = void 0;
+ if ((jsxContainer.kind === 243) || (jsxContainer.kind === 244)) {
+ attrsType = typeChecker.getJsxElementAttributesType(jsxContainer);
+ if (attrsType) {
+ symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes);
+ isMemberCompletion = true;
+ isNewIdentifierLocation = false;
+ return true;
}
}
- return false;
}
- }
- function getReferencesForSuperKeyword(superKeyword) {
- var searchSpaceNode = ts.getSuperContainer(superKeyword, false);
- if (!searchSpaceNode) {
- return undefined;
+ isMemberCompletion = false;
+ isNewIdentifierLocation = isNewIdentifierDefinitionLocation(contextToken);
+ if (previousToken !== contextToken) {
+ ts.Debug.assert(!!previousToken, "Expected 'contextToken' to be defined when different from 'previousToken'.");
}
- var staticFlag = 32;
- switch (searchSpaceNode.kind) {
- case 145:
- case 144:
- case 147:
- case 146:
- case 148:
- case 149:
- case 150:
- staticFlag &= ts.getModifierFlags(searchSpaceNode);
- searchSpaceNode = searchSpaceNode.parent;
- break;
- default:
- return undefined;
+ var adjustedPosition = previousToken !== contextToken ?
+ previousToken.getStart() :
+ position;
+ var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
+ if (scopeNode) {
+ isGlobalCompletion =
+ scopeNode.kind === 256 ||
+ scopeNode.kind === 190 ||
+ scopeNode.kind === 248 ||
+ ts.isStatement(scopeNode);
}
- var references = [];
- var sourceFile = searchSpaceNode.getSourceFile();
- var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd());
- ts.forEach(possiblePositions, function (position) {
- cancellationToken.throwIfCancellationRequested();
- var node = ts.getTouchingWord(sourceFile, position);
- if (!node || node.kind !== 95) {
- return;
- }
- var container = ts.getSuperContainer(node, false);
- if (container && (32 & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) {
- references.push(getReferenceEntryFromNode(node));
- }
- });
- var definition = getDefinition(searchSpaceNode.symbol);
- return [{ definition: definition, references: references }];
+ var symbolMeanings = 793064 | 107455 | 1920 | 8388608;
+ symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings);
+ return true;
}
- function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) {
- var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false);
- var staticFlag = 32;
- switch (searchSpaceNode.kind) {
- case 147:
- case 146:
- if (ts.isObjectLiteralMethod(searchSpaceNode)) {
- break;
- }
- case 145:
- case 144:
- case 148:
- case 149:
- case 150:
- staticFlag &= ts.getModifierFlags(searchSpaceNode);
- searchSpaceNode = searchSpaceNode.parent;
- break;
- case 256:
- if (ts.isExternalModule(searchSpaceNode)) {
- return undefined;
- }
- case 220:
- case 179:
- break;
- default:
- return undefined;
- }
- var references = [];
- var possiblePositions;
- if (searchSpaceNode.kind === 256) {
- ts.forEach(sourceFiles, function (sourceFile) {
- possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd());
- getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references);
- });
- }
- else {
- var sourceFile = searchSpaceNode.getSourceFile();
- possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd());
- getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references);
- }
- var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword);
- var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts;
- return [{
- definition: {
- containerKind: "",
- containerName: "",
- fileName: node.getSourceFile().fileName,
- kind: ts.ScriptElementKind.variableElement,
- name: "this",
- textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()),
- displayParts: displayParts
- },
- references: references
- }];
- function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) {
- ts.forEach(possiblePositions, function (position) {
- cancellationToken.throwIfCancellationRequested();
- var node = ts.getTouchingWord(sourceFile, position);
- if (!node || !ts.isThis(node)) {
- return;
- }
- var container = ts.getThisContainer(node, false);
- switch (searchSpaceNode.kind) {
- case 179:
- case 220:
- if (searchSpaceNode.symbol === container.symbol) {
- result.push(getReferenceEntryFromNode(node));
- }
- break;
- case 147:
- case 146:
- if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) {
- result.push(getReferenceEntryFromNode(node));
- }
- break;
- case 192:
- case 221:
- if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) {
- result.push(getReferenceEntryFromNode(node));
- }
- break;
- case 256:
- if (container.kind === 256 && !ts.isExternalModule(container)) {
- result.push(getReferenceEntryFromNode(node));
- }
- break;
- }
- });
+ function getScopeNode(initialToken, position, sourceFile) {
+ var scope = initialToken;
+ while (scope && !ts.positionBelongsToNode(scope, position, sourceFile)) {
+ scope = scope.parent;
}
+ return scope;
}
- function getReferencesForStringLiteral(node, sourceFiles) {
- var type = ts.getStringLiteralTypeForNode(node, typeChecker);
- if (!type) {
- return undefined;
- }
- var references = [];
- for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) {
- var sourceFile = sourceFiles_9[_i];
- var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd());
- getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references);
+ function isCompletionListBlocker(contextToken) {
+ var start = ts.timestamp();
+ var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
+ isSolelyIdentifierDefinitionLocation(contextToken) ||
+ isDotOfNumericLiteral(contextToken) ||
+ isInJsxText(contextToken);
+ log("getCompletionsAtPosition: isCompletionListBlocker: " + (ts.timestamp() - start));
+ return result;
+ }
+ function isInJsxText(contextToken) {
+ if (contextToken.kind === 10) {
+ return true;
}
- return [{
- definition: {
- containerKind: "",
- containerName: "",
- fileName: node.getSourceFile().fileName,
- kind: ts.ScriptElementKind.variableElement,
- name: type.text,
- textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()),
- displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)]
- },
- references: references
- }];
- function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) {
- for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) {
- var position = possiblePositions_1[_i];
- cancellationToken.throwIfCancellationRequested();
- var node_2 = ts.getTouchingWord(sourceFile, position);
- if (!node_2 || node_2.kind !== 9) {
- return;
- }
- var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker);
- if (type_1 === searchType) {
- references.push(getReferenceEntryFromNode(node_2));
- }
+ if (contextToken.kind === 28 && contextToken.parent) {
+ if (contextToken.parent.kind === 244) {
+ return true;
+ }
+ if (contextToken.parent.kind === 245 || contextToken.parent.kind === 243) {
+ return contextToken.parent.parent && contextToken.parent.parent.kind === 242;
}
}
+ return false;
}
- function populateSearchSymbolSet(symbol, location) {
- var result = [symbol];
- var containingObjectLiteralElement = getContainingObjectLiteralElement(location);
- if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 254) {
- var propertySymbol = getPropertySymbolOfDestructuringAssignment(location);
- if (propertySymbol) {
- result.push(propertySymbol);
+ function isNewIdentifierDefinitionLocation(previousToken) {
+ if (previousToken) {
+ var containingNodeKind = previousToken.parent.kind;
+ switch (previousToken.kind) {
+ case 25:
+ return containingNodeKind === 175
+ || containingNodeKind === 149
+ || containingNodeKind === 176
+ || containingNodeKind === 171
+ || containingNodeKind === 188
+ || containingNodeKind === 157;
+ case 18:
+ return containingNodeKind === 175
+ || containingNodeKind === 149
+ || containingNodeKind === 176
+ || containingNodeKind === 179
+ || containingNodeKind === 165;
+ case 20:
+ return containingNodeKind === 171
+ || containingNodeKind === 154
+ || containingNodeKind === 141;
+ case 126:
+ case 127:
+ return true;
+ case 22:
+ return containingNodeKind === 226;
+ case 16:
+ return containingNodeKind === 222;
+ case 57:
+ return containingNodeKind === 219
+ || containingNodeKind === 188;
+ case 13:
+ return containingNodeKind === 190;
+ case 14:
+ return containingNodeKind === 198;
+ case 113:
+ case 111:
+ case 112:
+ return containingNodeKind === 146;
}
- }
- var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location);
- if (aliasSymbol) {
- result = result.concat(populateSearchSymbolSet(aliasSymbol, location));
- }
- if (containingObjectLiteralElement) {
- ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) {
- ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol));
- });
- var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent);
- if (shorthandValueSymbol) {
- result.push(shorthandValueSymbol);
+ switch (previousToken.getText()) {
+ case "public":
+ case "protected":
+ case "private":
+ return true;
}
}
- if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 142 &&
- ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) {
- result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name));
- }
- var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol);
- if (bindingElementPropertySymbol) {
- result.push(bindingElementPropertySymbol);
- }
- ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) {
- if (rootSymbol !== symbol) {
- result.push(rootSymbol);
+ return false;
+ }
+ function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) {
+ if (contextToken.kind === 9
+ || contextToken.kind === 11
+ || ts.isTemplateLiteralKind(contextToken.kind)) {
+ var start_3 = contextToken.getStart();
+ var end = contextToken.getEnd();
+ if (start_3 < position && position < end) {
+ return true;
}
- if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) {
- getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap());
+ if (position === end) {
+ return !!contextToken.isUnterminated
+ || contextToken.kind === 11;
}
- });
- return result;
- }
- function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) {
- if (!symbol) {
- return;
- }
- if (symbol.name in previousIterationSymbolsCache) {
- return;
}
- if (symbol.flags & (32 | 64)) {
- ts.forEach(symbol.getDeclarations(), function (declaration) {
- if (ts.isClassLike(declaration)) {
- getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));
- ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference);
- }
- else if (declaration.kind === 222) {
- ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference);
- }
- });
+ return false;
+ }
+ function tryGetObjectLikeCompletionSymbols(objectLikeContainer) {
+ isMemberCompletion = true;
+ var typeForObject;
+ var existingMembers;
+ if (objectLikeContainer.kind === 172) {
+ isNewIdentifierLocation = true;
+ typeForObject = typeChecker.getContextualType(objectLikeContainer);
+ typeForObject = typeForObject && typeForObject.getNonNullableType();
+ existingMembers = objectLikeContainer.properties;
}
- return;
- function getPropertySymbolFromTypeReference(typeReference) {
- if (typeReference) {
- var type = typeChecker.getTypeAtLocation(typeReference);
- if (type) {
- var propertySymbol = typeChecker.getPropertyOfType(type, propertyName);
- if (propertySymbol) {
- result.push.apply(result, typeChecker.getRootSymbols(propertySymbol));
+ else if (objectLikeContainer.kind === 168) {
+ isNewIdentifierLocation = false;
+ var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);
+ if (ts.isVariableLike(rootDeclaration)) {
+ var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);
+ if (!canGetType && rootDeclaration.kind === 143) {
+ if (ts.isExpression(rootDeclaration.parent)) {
+ canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
}
- previousIterationSymbolsCache[symbol.name] = symbol;
- getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache);
+ else if (rootDeclaration.parent.kind === 148 || rootDeclaration.parent.kind === 151) {
+ canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);
+ }
+ }
+ if (canGetType) {
+ typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
+ existingMembers = objectLikeContainer.elements;
}
}
+ else {
+ ts.Debug.fail("Root declaration is not variable-like.");
+ }
}
- }
- function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) {
- if (ts.contains(searchSymbols, referenceSymbol)) {
- return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol;
+ else {
+ ts.Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind);
}
- var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation);
- if (aliasSymbol) {
- return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache);
+ if (!typeForObject) {
+ return false;
}
- var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation);
- if (containingObjectLiteralElement) {
- var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) {
- return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
- });
- if (contextualSymbol) {
- return contextualSymbol;
- }
- var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation);
- if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) {
- return propertySymbol;
- }
+ var typeMembers = typeChecker.getPropertiesOfType(typeForObject);
+ if (typeMembers && typeMembers.length > 0) {
+ symbols = filterObjectMembersList(typeMembers, existingMembers);
}
- var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol);
- if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) {
- return bindingElementPropertySymbol;
+ return true;
+ }
+ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) {
+ var declarationKind = namedImportsOrExports.kind === 234 ?
+ 231 :
+ 237;
+ var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind);
+ var moduleSpecifier = importOrExportDeclaration.moduleSpecifier;
+ if (!moduleSpecifier) {
+ return false;
}
- return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) {
- if (searchSymbols.indexOf(rootSymbol) >= 0) {
- return rootSymbol;
- }
- if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) {
- if (parents) {
- if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) {
- return undefined;
- }
- }
- var result_3 = [];
- getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3, ts.createMap());
- return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
- }
- return undefined;
- });
+ isMemberCompletion = true;
+ isNewIdentifierLocation = false;
+ var exports;
+ var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier);
+ if (moduleSpecifierSymbol) {
+ exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol);
+ }
+ symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : ts.emptyArray;
+ return true;
}
- function getNameFromObjectLiteralElement(node) {
- if (node.name.kind === 140) {
- var nameExpression = node.name.expression;
- if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
- return nameExpression.text;
+ function tryGetObjectLikeCompletionContainer(contextToken) {
+ if (contextToken) {
+ switch (contextToken.kind) {
+ case 16:
+ case 25:
+ var parent_18 = contextToken.parent;
+ if (parent_18 && (parent_18.kind === 172 || parent_18.kind === 168)) {
+ return parent_18;
+ }
+ break;
}
- return undefined;
}
- return node.name.text;
+ return undefined;
}
- function getPropertySymbolsFromContextualType(node) {
- var objectLiteral = node.parent;
- var contextualType = typeChecker.getContextualType(objectLiteral);
- var name = getNameFromObjectLiteralElement(node);
- if (name && contextualType) {
- var result_4 = [];
- var symbol_2 = contextualType.getProperty(name);
- if (symbol_2) {
- result_4.push(symbol_2);
- }
- if (contextualType.flags & 524288) {
- ts.forEach(contextualType.types, function (t) {
- var symbol = t.getProperty(name);
- if (symbol) {
- result_4.push(symbol);
+ function tryGetNamedImportsOrExportsForCompletion(contextToken) {
+ if (contextToken) {
+ switch (contextToken.kind) {
+ case 16:
+ case 25:
+ switch (contextToken.parent.kind) {
+ case 234:
+ case 238:
+ return contextToken.parent;
}
- });
}
- return result_4;
}
return undefined;
}
- function getIntersectingMeaningFromDeclarations(meaning, declarations) {
- if (declarations) {
- var lastIterationMeaning = void 0;
- do {
- lastIterationMeaning = meaning;
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
- var declaration = declarations_8[_i];
- var declarationMeaning = ts.getMeaningFromDeclaration(declaration);
- if (declarationMeaning & meaning) {
- meaning |= declarationMeaning;
+ function tryGetContainingJsxElement(contextToken) {
+ if (contextToken) {
+ var parent_19 = contextToken.parent;
+ switch (contextToken.kind) {
+ case 27:
+ case 40:
+ case 70:
+ case 246:
+ case 247:
+ if (parent_19 && (parent_19.kind === 243 || parent_19.kind === 244)) {
+ return parent_19;
}
- }
- } while (meaning !== lastIterationMeaning);
+ else if (parent_19.kind === 246) {
+ return parent_19.parent;
+ }
+ break;
+ case 9:
+ if (parent_19 && ((parent_19.kind === 246) || (parent_19.kind === 247))) {
+ return parent_19.parent;
+ }
+ break;
+ case 17:
+ if (parent_19 &&
+ parent_19.kind === 248 &&
+ parent_19.parent &&
+ (parent_19.parent.kind === 246)) {
+ return parent_19.parent.parent;
+ }
+ if (parent_19 && parent_19.kind === 247) {
+ return parent_19.parent;
+ }
+ break;
+ }
}
- return meaning;
- }
- }
- FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode;
- function convertReferences(referenceSymbols) {
- if (!referenceSymbols) {
return undefined;
}
- var referenceEntries = [];
- for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) {
- var referenceSymbol = referenceSymbols_1[_i];
- ts.addRange(referenceEntries, referenceSymbol.references);
- }
- return referenceEntries;
- }
- FindAllReferences.convertReferences = convertReferences;
- function isImplementation(node) {
- if (!node) {
- return false;
- }
- else if (ts.isVariableLike(node)) {
- if (node.initializer) {
- return true;
+ function isFunction(kind) {
+ switch (kind) {
+ case 180:
+ case 181:
+ case 221:
+ case 148:
+ case 147:
+ case 150:
+ case 151:
+ case 152:
+ case 153:
+ case 154:
+ return true;
}
- else if (node.kind === 218) {
- var parentStatement = getParentStatementOfVariableDeclaration(node);
- return parentStatement && ts.hasModifier(parentStatement, 2);
+ return false;
+ }
+ function isSolelyIdentifierDefinitionLocation(contextToken) {
+ var containingNodeKind = contextToken.parent.kind;
+ switch (contextToken.kind) {
+ case 25:
+ return containingNodeKind === 219 ||
+ containingNodeKind === 220 ||
+ containingNodeKind === 201 ||
+ containingNodeKind === 225 ||
+ isFunction(containingNodeKind) ||
+ containingNodeKind === 222 ||
+ containingNodeKind === 193 ||
+ containingNodeKind === 223 ||
+ containingNodeKind === 169 ||
+ containingNodeKind === 224;
+ case 22:
+ return containingNodeKind === 169;
+ case 55:
+ return containingNodeKind === 170;
+ case 20:
+ return containingNodeKind === 169;
+ case 18:
+ return containingNodeKind === 252 ||
+ isFunction(containingNodeKind);
+ case 16:
+ return containingNodeKind === 225 ||
+ containingNodeKind === 223 ||
+ containingNodeKind === 160;
+ case 24:
+ return containingNodeKind === 145 &&
+ contextToken.parent && contextToken.parent.parent &&
+ (contextToken.parent.parent.kind === 223 ||
+ contextToken.parent.parent.kind === 160);
+ case 26:
+ return containingNodeKind === 222 ||
+ containingNodeKind === 193 ||
+ containingNodeKind === 223 ||
+ containingNodeKind === 224 ||
+ isFunction(containingNodeKind);
+ case 114:
+ return containingNodeKind === 146;
+ case 23:
+ return containingNodeKind === 143 ||
+ (contextToken.parent && contextToken.parent.parent &&
+ contextToken.parent.parent.kind === 169);
+ case 113:
+ case 111:
+ case 112:
+ return containingNodeKind === 143;
+ case 117:
+ return containingNodeKind === 235 ||
+ containingNodeKind === 239 ||
+ containingNodeKind === 233;
+ case 74:
+ case 82:
+ case 108:
+ case 88:
+ case 103:
+ case 124:
+ case 132:
+ case 90:
+ case 109:
+ case 75:
+ case 115:
+ case 135:
+ return true;
+ }
+ switch (contextToken.getText()) {
+ case "abstract":
+ case "async":
+ case "class":
+ case "const":
+ case "declare":
+ case "enum":
+ case "function":
+ case "interface":
+ case "let":
+ case "private":
+ case "protected":
+ case "public":
+ case "static":
+ case "var":
+ case "yield":
+ return true;
}
+ return false;
}
- else if (ts.isFunctionLike(node)) {
- return !!node.body || ts.hasModifier(node, 2);
+ function isDotOfNumericLiteral(contextToken) {
+ if (contextToken.kind === 8) {
+ var text = contextToken.getFullText();
+ return text.charAt(text.length - 1) === ".";
+ }
+ return false;
}
- else {
- switch (node.kind) {
- case 221:
- case 192:
- case 224:
- case 225:
- return true;
+ function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) {
+ var existingImportsOrExports = ts.createMap();
+ for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) {
+ var element = namedImportsOrExports_1[_i];
+ if (element.getStart() <= position && position <= element.getEnd()) {
+ continue;
+ }
+ var name_47 = element.propertyName || element.name;
+ existingImportsOrExports[name_47.text] = true;
}
+ if (!ts.someProperties(existingImportsOrExports)) {
+ return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; });
+ }
+ return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports[e.name]; });
}
- return false;
- }
- function getParentStatementOfVariableDeclaration(node) {
- if (node.parent && node.parent.parent && node.parent.parent.kind === 200) {
- ts.Debug.assert(node.parent.kind === 219);
- return node.parent.parent;
+ function filterObjectMembersList(contextualMemberSymbols, existingMembers) {
+ if (!existingMembers || existingMembers.length === 0) {
+ return contextualMemberSymbols;
+ }
+ var existingMemberNames = ts.createMap();
+ for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) {
+ var m = existingMembers_1[_i];
+ if (m.kind !== 253 &&
+ m.kind !== 254 &&
+ m.kind !== 170 &&
+ m.kind !== 148) {
+ continue;
+ }
+ if (m.getStart() <= position && position <= m.getEnd()) {
+ continue;
+ }
+ var existingName = void 0;
+ if (m.kind === 170 && m.propertyName) {
+ if (m.propertyName.kind === 70) {
+ existingName = m.propertyName.text;
+ }
+ }
+ else {
+ existingName = m.name.text;
+ }
+ existingMemberNames[existingName] = true;
+ }
+ return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; });
}
- }
- function getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result) {
- var refSymbol = typeChecker.getSymbolAtLocation(node);
- var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration);
- if (shorthandSymbol) {
- for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) {
- var declaration = _a[_i];
- if (ts.getMeaningFromDeclaration(declaration) & 1) {
- result.push(getReferenceEntryFromNode(declaration));
+ function filterJsxAttributes(symbols, attributes) {
+ var seenNames = ts.createMap();
+ for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) {
+ var attr = attributes_1[_i];
+ if (attr.getStart() <= position && position <= attr.getEnd()) {
+ continue;
+ }
+ if (attr.kind === 246) {
+ seenNames[attr.name.text] = true;
}
}
+ return ts.filter(symbols, function (a) { return !seenNames[a.name]; });
}
}
- FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment;
- function getReferenceEntryFromNode(node) {
- var start = node.getStart();
- var end = node.getEnd();
- if (node.kind === 9) {
- start += 1;
- end -= 1;
+ function getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location) {
+ var displayName = ts.getDeclaredName(typeChecker, symbol, location);
+ if (displayName) {
+ var firstCharCode = displayName.charCodeAt(0);
+ if ((symbol.flags & 1920) && (firstCharCode === 39 || firstCharCode === 34)) {
+ return undefined;
+ }
}
- return {
- fileName: node.getSourceFile().fileName,
- textSpan: ts.createTextSpanFromBounds(start, end),
- isWriteAccess: isWriteAccess(node),
- isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node)
- };
+ return getCompletionEntryDisplayName(displayName, target, performCharacterChecks);
}
- FindAllReferences.getReferenceEntryFromNode = getReferenceEntryFromNode;
- function isWriteAccess(node) {
- if (node.kind === 69 && ts.isDeclarationName(node)) {
- return true;
+ function getCompletionEntryDisplayName(name, target, performCharacterChecks) {
+ if (!name) {
+ return undefined;
}
- var parent = node.parent;
- if (parent) {
- if (parent.kind === 186 || parent.kind === 185) {
- return true;
- }
- else if (parent.kind === 187 && parent.left === node) {
- var operator = parent.operatorToken.kind;
- return 56 <= operator && operator <= 68;
+ name = ts.stripQuotes(name);
+ if (!name) {
+ return undefined;
+ }
+ if (performCharacterChecks) {
+ if (!ts.isIdentifierText(name, target)) {
+ return undefined;
}
}
- return false;
+ return name;
}
- function forEachDescendantOfKind(node, kind, action) {
- ts.forEachChild(node, function (child) {
- if (child.kind === kind) {
- action(child);
- }
- forEachDescendantOfKind(child, kind, action);
+ var keywordCompletions = [];
+ for (var i = 71; i <= 139; i++) {
+ keywordCompletions.push({
+ name: ts.tokenToString(i),
+ kind: ts.ScriptElementKind.keyword,
+ kindModifiers: ts.ScriptElementKindModifier.none,
+ sortText: "0"
});
}
- function getContainingObjectLiteralElement(node) {
- switch (node.kind) {
- case 9:
- case 8:
- if (node.parent.kind === 140) {
- return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined;
- }
- case 69:
- return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined;
+ var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s* 0 ? result : undefined;
- }
- else if (node.kind === 95 || ts.isSuperProperty(node.parent)) {
- var symbol = typeChecker.getSymbolAtLocation(node);
- return symbol.valueDeclaration && [ts.FindAllReferences.getReferenceEntryFromNode(symbol.valueDeclaration)];
- }
- else {
- var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, false, false, true);
- var result = ts.flatMap(referencedSymbols, function (symbol) {
- return ts.map(symbol.references, function (_a) {
- var textSpan = _a.textSpan, fileName = _a.fileName;
- return ({ textSpan: textSpan, fileName: fileName });
- });
- });
- return result && result.length > 0 ? result : undefined;
- }
- }
- GoToImplementation.getImplementationAtPosition = getImplementationAtPosition;
- })(GoToImplementation = ts.GoToImplementation || (ts.GoToImplementation = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var JsDoc;
- (function (JsDoc) {
- var jsDocTagNames = [
- "augments",
- "author",
- "argument",
- "borrows",
- "class",
- "constant",
- "constructor",
- "constructs",
- "default",
- "deprecated",
- "description",
- "event",
- "example",
- "extends",
- "field",
- "fileOverview",
- "function",
- "ignore",
- "inner",
- "lends",
- "link",
- "memberOf",
- "name",
- "namespace",
- "param",
- "private",
- "property",
- "public",
- "requires",
- "returns",
- "see",
- "since",
- "static",
- "throws",
- "type",
- "typedef",
- "property",
- "prop",
- "version"
- ];
- var jsDocCompletionEntries;
- function getJsDocCommentsFromDeclarations(declarations, name, canUseParsedParamTagComments) {
- var documentationComment = [];
- forEachUnique(declarations, function (declaration) {
- var comments = ts.getJSDocComments(declaration, true);
- if (!comments) {
- return;
- }
- for (var _i = 0, comments_3 = comments; _i < comments_3.length; _i++) {
- var comment = comments_3[_i];
- if (comment) {
- if (documentationComment.length) {
- documentationComment.push(ts.lineBreakPart());
+ function aggregateOwnedThrowStatements(node) {
+ var statementAccumulator = [];
+ aggregate(node);
+ return statementAccumulator;
+ function aggregate(node) {
+ if (node.kind === 216) {
+ statementAccumulator.push(node);
+ }
+ else if (node.kind === 217) {
+ var tryStatement = node;
+ if (tryStatement.catchClause) {
+ aggregate(tryStatement.catchClause);
+ }
+ else {
+ aggregate(tryStatement.tryBlock);
+ }
+ if (tryStatement.finallyBlock) {
+ aggregate(tryStatement.finallyBlock);
+ }
+ }
+ else if (!ts.isFunctionLike(node)) {
+ ts.forEachChild(node, aggregate);
}
- documentationComment.push(ts.textPart(comment));
}
}
- });
- return documentationComment;
- }
- JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
- function forEachUnique(array, callback) {
- if (array) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (ts.indexOf(array, array[i]) === i) {
- var result = callback(array[i], i);
- if (result) {
- return result;
+ function getThrowStatementOwner(throwStatement) {
+ var child = throwStatement;
+ while (child.parent) {
+ var parent_20 = child.parent;
+ if (ts.isFunctionBlock(parent_20) || parent_20.kind === 256) {
+ return parent_20;
+ }
+ if (parent_20.kind === 217) {
+ var tryStatement = parent_20;
+ if (tryStatement.tryBlock === child && tryStatement.catchClause) {
+ return child;
+ }
}
+ child = parent_20;
}
+ return undefined;
}
- }
- return undefined;
- }
- function getAllJsDocCompletionEntries() {
- return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, function (tagName) {
- return {
- name: tagName,
- kind: ts.ScriptElementKind.keyword,
- kindModifiers: "",
- sortText: "0"
- };
- }));
- }
- JsDoc.getAllJsDocCompletionEntries = getAllJsDocCompletionEntries;
- function getDocCommentTemplateAtPosition(newLine, sourceFile, position) {
- if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) {
- return undefined;
- }
- var tokenAtPos = ts.getTokenAtPosition(sourceFile, position);
- var tokenStart = tokenAtPos.getStart();
- if (!tokenAtPos || tokenStart < position) {
- return undefined;
- }
- var commentOwner;
- findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) {
- switch (commentOwner.kind) {
- case 220:
- case 147:
- case 148:
- case 221:
- case 200:
- break findOwner;
- case 256:
- return undefined;
- case 225:
- if (commentOwner.parent.kind === 225) {
- return undefined;
+ function aggregateAllBreakAndContinueStatements(node) {
+ var statementAccumulator = [];
+ aggregate(node);
+ return statementAccumulator;
+ function aggregate(node) {
+ if (node.kind === 211 || node.kind === 210) {
+ statementAccumulator.push(node);
}
- break findOwner;
+ else if (!ts.isFunctionLike(node)) {
+ ts.forEachChild(node, aggregate);
+ }
+ }
}
- }
- if (!commentOwner || commentOwner.getStart() < position) {
- return undefined;
- }
- var parameters = getParametersForJsDocOwningNode(commentOwner);
- var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position);
- var lineStart = sourceFile.getLineStarts()[posLineAndChar.line];
- var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);
- var docParams = "";
- for (var i = 0, numParams = parameters.length; i < numParams; i++) {
- var currentName = parameters[i].name;
- var paramName = currentName.kind === 69 ?
- currentName.text :
- "param" + i;
- docParams += indentationStr + " * @param " + paramName + newLine;
- }
- var preamble = "/**" + newLine +
- indentationStr + " * ";
- var result = preamble + newLine +
- docParams +
- indentationStr + " */" +
- (tokenStart === position ? newLine + indentationStr : "");
- return { newText: result, caretOffset: preamble.length };
- }
- JsDoc.getDocCommentTemplateAtPosition = getDocCommentTemplateAtPosition;
- function getParametersForJsDocOwningNode(commentOwner) {
- if (ts.isFunctionLike(commentOwner)) {
- return commentOwner.parameters;
- }
- if (commentOwner.kind === 200) {
- var varStatement = commentOwner;
- var varDeclarations = varStatement.declarationList.declarations;
- if (varDeclarations.length === 1 && varDeclarations[0].initializer) {
- return getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer);
+ function ownsBreakOrContinueStatement(owner, statement) {
+ var actualOwner = getBreakOrContinueOwner(statement);
+ return actualOwner && actualOwner === owner;
}
- }
- return ts.emptyArray;
- }
- function getParametersFromRightHandSideOfAssignment(rightHandSide) {
- while (rightHandSide.kind === 178) {
- rightHandSide = rightHandSide.expression;
- }
- switch (rightHandSide.kind) {
- case 179:
- case 180:
- return rightHandSide.parameters;
- case 192:
- for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) {
- var member = _a[_i];
- if (member.kind === 148) {
- return member.parameters;
+ function getBreakOrContinueOwner(statement) {
+ for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) {
+ switch (node_1.kind) {
+ case 214:
+ if (statement.kind === 210) {
+ continue;
+ }
+ case 207:
+ case 208:
+ case 209:
+ case 206:
+ case 205:
+ if (!statement.label || isLabeledBy(node_1, statement.label.text)) {
+ return node_1;
+ }
+ break;
+ default:
+ if (ts.isFunctionLike(node_1)) {
+ return undefined;
+ }
+ break;
}
}
- break;
- }
- return ts.emptyArray;
- }
- })(JsDoc = ts.JsDoc || (ts.JsDoc = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var NavigateTo;
- (function (NavigateTo) {
- function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) {
- var patternMatcher = ts.createPatternMatcher(searchValue);
- var rawItems = [];
- var baseSensitivity = { sensitivity: "base" };
- ts.forEach(sourceFiles, function (sourceFile) {
- cancellationToken.throwIfCancellationRequested();
- if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) {
- return;
+ return undefined;
}
- var nameToDeclarations = sourceFile.getNamedDeclarations();
- for (var name_49 in nameToDeclarations) {
- var declarations = nameToDeclarations[name_49];
- if (declarations) {
- var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_49);
- if (!matches) {
- continue;
+ function getModifierOccurrences(modifier, declaration) {
+ var container = declaration.parent;
+ if (ts.isAccessibilityModifier(modifier)) {
+ if (!(container.kind === 222 ||
+ container.kind === 193 ||
+ (declaration.kind === 143 && hasKind(container, 149)))) {
+ return undefined;
}
- for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
- var declaration = declarations_9[_i];
- if (patternMatcher.patternContainsDots) {
- var containers = getContainers(declaration);
- if (!containers) {
- return undefined;
- }
- matches = patternMatcher.getMatches(containers, name_49);
- if (!matches) {
- continue;
+ }
+ else if (modifier === 114) {
+ if (!(container.kind === 222 || container.kind === 193)) {
+ return undefined;
+ }
+ }
+ else if (modifier === 83 || modifier === 123) {
+ if (!(container.kind === 227 || container.kind === 256)) {
+ return undefined;
+ }
+ }
+ else if (modifier === 116) {
+ if (!(container.kind === 222 || declaration.kind === 222)) {
+ return undefined;
+ }
+ }
+ else {
+ return undefined;
+ }
+ var keywords = [];
+ var modifierFlag = getFlagFromModifier(modifier);
+ var nodes;
+ switch (container.kind) {
+ case 227:
+ case 256:
+ if (modifierFlag & 128) {
+ nodes = declaration.members.concat(declaration);
+ }
+ else {
+ nodes = container.statements;
+ }
+ break;
+ case 149:
+ nodes = container.parameters.concat(container.parent.members);
+ break;
+ case 222:
+ case 193:
+ nodes = container.members;
+ if (modifierFlag & 28) {
+ var constructor = ts.forEach(container.members, function (member) {
+ return member.kind === 149 && member;
+ });
+ if (constructor) {
+ nodes = nodes.concat(constructor.parameters);
}
}
- var fileName = sourceFile.fileName;
- var matchKind = bestMatchKind(matches);
- rawItems.push({ name: name_49, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
+ else if (modifierFlag & 128) {
+ nodes = nodes.concat(container);
+ }
+ break;
+ default:
+ ts.Debug.fail("Invalid container kind.");
+ }
+ ts.forEach(nodes, function (node) {
+ if (ts.getModifierFlags(node) & modifierFlag) {
+ ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); });
+ }
+ });
+ return ts.map(keywords, getHighlightSpanForNode);
+ function getFlagFromModifier(modifier) {
+ switch (modifier) {
+ case 113:
+ return 4;
+ case 111:
+ return 8;
+ case 112:
+ return 16;
+ case 114:
+ return 32;
+ case 83:
+ return 1;
+ case 123:
+ return 2;
+ case 116:
+ return 128;
+ default:
+ ts.Debug.fail();
}
}
}
- });
- rawItems = ts.filter(rawItems, function (item) {
- var decl = item.declaration;
- if (decl.kind === 231 || decl.kind === 234 || decl.kind === 229) {
- var importer = checker.getSymbolAtLocation(decl.name);
- var imported = checker.getAliasedSymbol(importer);
- return importer.name !== imported.name;
- }
- else {
- return true;
- }
- });
- rawItems.sort(compareNavigateToItems);
- if (maxResultCount !== undefined) {
- rawItems = rawItems.slice(0, maxResultCount);
- }
- var items = ts.map(rawItems, createNavigateToItem);
- return items;
- function allMatchesAreCaseSensitive(matches) {
- ts.Debug.assert(matches.length > 0);
- for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) {
- var match = matches_2[_i];
- if (!match.isCaseSensitive) {
- return false;
+ function pushKeywordIf(keywordList, token) {
+ var expected = [];
+ for (var _i = 2; _i < arguments.length; _i++) {
+ expected[_i - 2] = arguments[_i];
}
- }
- return true;
- }
- function getTextOfIdentifierOrLiteral(node) {
- if (node) {
- if (node.kind === 69 ||
- node.kind === 9 ||
- node.kind === 8) {
- return node.text;
+ if (token && ts.contains(expected, token.kind)) {
+ keywordList.push(token);
+ return true;
}
+ return false;
}
- return undefined;
- }
- function tryAddSingleDeclarationName(declaration, containers) {
- if (declaration && declaration.name) {
- var text = getTextOfIdentifierOrLiteral(declaration.name);
- if (text !== undefined) {
- containers.unshift(text);
- }
- else if (declaration.name.kind === 140) {
- return tryAddComputedPropertyName(declaration.name.expression, containers, true);
+ function getGetAndSetOccurrences(accessorDeclaration) {
+ var keywords = [];
+ tryPushAccessorKeyword(accessorDeclaration.symbol, 150);
+ tryPushAccessorKeyword(accessorDeclaration.symbol, 151);
+ return ts.map(keywords, getHighlightSpanForNode);
+ function tryPushAccessorKeyword(accessorSymbol, accessorKind) {
+ var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind);
+ if (accessor) {
+ ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124, 132); });
+ }
}
- else {
- return false;
+ }
+ function getConstructorOccurrences(constructorDeclaration) {
+ var declarations = constructorDeclaration.symbol.getDeclarations();
+ var keywords = [];
+ ts.forEach(declarations, function (declaration) {
+ ts.forEach(declaration.getChildren(), function (token) {
+ return pushKeywordIf(keywords, token, 122);
+ });
+ });
+ return ts.map(keywords, getHighlightSpanForNode);
+ }
+ function getLoopBreakContinueOccurrences(loopNode) {
+ var keywords = [];
+ if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87, 105, 80)) {
+ if (loopNode.kind === 205) {
+ var loopTokens = loopNode.getChildren();
+ for (var i = loopTokens.length - 1; i >= 0; i--) {
+ if (pushKeywordIf(keywords, loopTokens[i], 105)) {
+ break;
+ }
+ }
+ }
}
+ var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement);
+ ts.forEach(breaksAndContinues, function (statement) {
+ if (ownsBreakOrContinueStatement(loopNode, statement)) {
+ pushKeywordIf(keywords, statement.getFirstToken(), 71, 76);
+ }
+ });
+ return ts.map(keywords, getHighlightSpanForNode);
}
- return true;
- }
- function tryAddComputedPropertyName(expression, containers, includeLastPortion) {
- var text = getTextOfIdentifierOrLiteral(expression);
- if (text !== undefined) {
- if (includeLastPortion) {
- containers.unshift(text);
+ function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) {
+ var owner = getBreakOrContinueOwner(breakOrContinueStatement);
+ if (owner) {
+ switch (owner.kind) {
+ case 207:
+ case 208:
+ case 209:
+ case 205:
+ case 206:
+ return getLoopBreakContinueOccurrences(owner);
+ case 214:
+ return getSwitchCaseDefaultOccurrences(owner);
+ }
}
- return true;
+ return undefined;
}
- if (expression.kind === 172) {
- var propertyAccess = expression;
- if (includeLastPortion) {
- containers.unshift(propertyAccess.name.text);
+ function getSwitchCaseDefaultOccurrences(switchStatement) {
+ var keywords = [];
+ pushKeywordIf(keywords, switchStatement.getFirstToken(), 97);
+ ts.forEach(switchStatement.caseBlock.clauses, function (clause) {
+ pushKeywordIf(keywords, clause.getFirstToken(), 72, 78);
+ var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause);
+ ts.forEach(breaksAndContinues, function (statement) {
+ if (ownsBreakOrContinueStatement(switchStatement, statement)) {
+ pushKeywordIf(keywords, statement.getFirstToken(), 71);
+ }
+ });
+ });
+ return ts.map(keywords, getHighlightSpanForNode);
+ }
+ function getTryCatchFinallyOccurrences(tryStatement) {
+ var keywords = [];
+ pushKeywordIf(keywords, tryStatement.getFirstToken(), 101);
+ if (tryStatement.catchClause) {
+ pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73);
}
- return tryAddComputedPropertyName(propertyAccess.expression, containers, true);
+ if (tryStatement.finallyBlock) {
+ var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile);
+ pushKeywordIf(keywords, finallyKeyword, 86);
+ }
+ return ts.map(keywords, getHighlightSpanForNode);
}
- return false;
- }
- function getContainers(declaration) {
- var containers = [];
- if (declaration.name.kind === 140) {
- if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) {
+ function getThrowOccurrences(throwStatement) {
+ var owner = getThrowStatementOwner(throwStatement);
+ if (!owner) {
return undefined;
}
+ var keywords = [];
+ ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) {
+ pushKeywordIf(keywords, throwStatement.getFirstToken(), 99);
+ });
+ if (ts.isFunctionBlock(owner)) {
+ ts.forEachReturnStatement(owner, function (returnStatement) {
+ pushKeywordIf(keywords, returnStatement.getFirstToken(), 95);
+ });
+ }
+ return ts.map(keywords, getHighlightSpanForNode);
}
- declaration = ts.getContainerNode(declaration);
- while (declaration) {
- if (!tryAddSingleDeclarationName(declaration, containers)) {
+ function getReturnOccurrences(returnStatement) {
+ var func = ts.getContainingFunction(returnStatement);
+ if (!(func && hasKind(func.body, 200))) {
return undefined;
}
- declaration = ts.getContainerNode(declaration);
+ var keywords = [];
+ ts.forEachReturnStatement(func.body, function (returnStatement) {
+ pushKeywordIf(keywords, returnStatement.getFirstToken(), 95);
+ });
+ ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) {
+ pushKeywordIf(keywords, throwStatement.getFirstToken(), 99);
+ });
+ return ts.map(keywords, getHighlightSpanForNode);
}
- return containers;
- }
- function bestMatchKind(matches) {
- ts.Debug.assert(matches.length > 0);
- var bestMatchKind = ts.PatternMatchKind.camelCase;
- for (var _i = 0, matches_3 = matches; _i < matches_3.length; _i++) {
- var match = matches_3[_i];
- var kind = match.kind;
- if (kind < bestMatchKind) {
- bestMatchKind = kind;
+ function getIfElseOccurrences(ifStatement) {
+ var keywords = [];
+ while (hasKind(ifStatement.parent, 204) && ifStatement.parent.elseStatement === ifStatement) {
+ ifStatement = ifStatement.parent;
+ }
+ while (ifStatement) {
+ var children = ifStatement.getChildren();
+ pushKeywordIf(keywords, children[0], 89);
+ for (var i = children.length - 1; i >= 0; i--) {
+ if (pushKeywordIf(keywords, children[i], 81)) {
+ break;
+ }
+ }
+ if (!hasKind(ifStatement.elseStatement, 204)) {
+ break;
+ }
+ ifStatement = ifStatement.elseStatement;
+ }
+ var result = [];
+ for (var i = 0; i < keywords.length; i++) {
+ if (keywords[i].kind === 81 && i < keywords.length - 1) {
+ var elseKeyword = keywords[i];
+ var ifKeyword = keywords[i + 1];
+ var shouldCombindElseAndIf = true;
+ for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) {
+ if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) {
+ shouldCombindElseAndIf = false;
+ break;
+ }
+ }
+ if (shouldCombindElseAndIf) {
+ result.push({
+ fileName: fileName,
+ textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end),
+ kind: ts.HighlightSpanKind.reference
+ });
+ i++;
+ continue;
+ }
+ }
+ result.push(getHighlightSpanForNode(keywords[i]));
}
+ return result;
}
- return bestMatchKind;
- }
- function compareNavigateToItems(i1, i2) {
- return i1.matchKind - i2.matchKind ||
- i1.name.localeCompare(i2.name, undefined, baseSensitivity) ||
- i1.name.localeCompare(i2.name);
}
- function createNavigateToItem(rawItem) {
- var declaration = rawItem.declaration;
- var container = ts.getContainerNode(declaration);
- return {
- name: rawItem.name,
- kind: ts.getNodeKind(declaration),
- kindModifiers: ts.getNodeModifiers(declaration),
- matchKind: ts.PatternMatchKind[rawItem.matchKind],
- isCaseSensitive: rawItem.isCaseSensitive,
- fileName: rawItem.fileName,
- textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()),
- containerName: container && container.name ? container.name.text : "",
- containerKind: container && container.name ? ts.getNodeKind(container) : ""
- };
+ }
+ DocumentHighlights.getDocumentHighlights = getDocumentHighlights;
+ function isLabeledBy(node, labelName) {
+ for (var owner = node.parent; owner.kind === 215; owner = owner.parent) {
+ if (owner.label.text === labelName) {
+ return true;
+ }
}
+ return false;
}
- NavigateTo.getNavigateToItems = getNavigateToItems;
- })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
+ })(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
- var NavigationBar;
- (function (NavigationBar) {
- function getNavigationBarItems(sourceFile) {
- curSourceFile = sourceFile;
- var result = ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem);
- curSourceFile = undefined;
- return result;
+ function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) {
+ if (currentDirectory === void 0) { currentDirectory = ""; }
+ var buckets = ts.createMap();
+ var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames);
+ function getKeyForCompilationSettings(settings) {
+ return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths);
}
- NavigationBar.getNavigationBarItems = getNavigationBarItems;
- function getNavigationTree(sourceFile) {
- curSourceFile = sourceFile;
- var result = convertToTree(rootNavigationBarNode(sourceFile));
- curSourceFile = undefined;
- return result;
+ function getBucketForCompilationSettings(key, createIfMissing) {
+ var bucket = buckets[key];
+ if (!bucket && createIfMissing) {
+ buckets[key] = bucket = ts.createFileMap();
+ }
+ return bucket;
}
- NavigationBar.getNavigationTree = getNavigationTree;
- var curSourceFile;
- function nodeText(node) {
- return node.getText(curSourceFile);
+ function reportStats() {
+ var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) {
+ var entries = buckets[name];
+ var sourceFiles = [];
+ entries.forEachValue(function (key, entry) {
+ sourceFiles.push({
+ name: key,
+ refCount: entry.languageServiceRefCount,
+ references: entry.owners.slice(0)
+ });
+ });
+ sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; });
+ return {
+ bucket: name,
+ sourceFiles: sourceFiles
+ };
+ });
+ return JSON.stringify(bucketInfoArray, undefined, 2);
}
- function navigationBarNodeKind(n) {
- return n.node.kind;
+ function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) {
+ var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
+ var key = getKeyForCompilationSettings(compilationSettings);
+ return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind);
}
- function pushChild(parent, child) {
- if (parent.children) {
- parent.children.push(child);
+ function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) {
+ return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, true, scriptKind);
+ }
+ function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) {
+ var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
+ var key = getKeyForCompilationSettings(compilationSettings);
+ return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind);
+ }
+ function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) {
+ return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, false, scriptKind);
+ }
+ function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) {
+ var bucket = getBucketForCompilationSettings(key, true);
+ var entry = bucket.get(path);
+ if (!entry) {
+ ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?");
+ var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false, scriptKind);
+ entry = {
+ sourceFile: sourceFile,
+ languageServiceRefCount: 0,
+ owners: []
+ };
+ bucket.set(path, entry);
}
else {
- parent.children = [child];
+ if (entry.sourceFile.version !== version) {
+ entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot));
+ }
}
- }
- var parentsStack = [];
- var parent;
- function rootNavigationBarNode(sourceFile) {
- ts.Debug.assert(!parentsStack.length);
- var root = { node: sourceFile, additionalNodes: undefined, parent: undefined, children: undefined, indent: 0 };
- parent = root;
- for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
- var statement = _a[_i];
- addChildrenRecursively(statement);
+ if (acquiring) {
+ entry.languageServiceRefCount++;
}
- endNode();
- ts.Debug.assert(!parent && !parentsStack.length);
- return root;
- }
- function addLeafNode(node) {
- pushChild(parent, emptyNavigationBarNode(node));
- }
- function emptyNavigationBarNode(node) {
- return {
- node: node,
- additionalNodes: undefined,
- parent: parent,
- children: undefined,
- indent: parent.indent + 1
- };
+ return entry.sourceFile;
}
- function startNode(node) {
- var navNode = emptyNavigationBarNode(node);
- pushChild(parent, navNode);
- parentsStack.push(parent);
- parent = navNode;
+ function releaseDocument(fileName, compilationSettings) {
+ var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
+ var key = getKeyForCompilationSettings(compilationSettings);
+ return releaseDocumentWithKey(path, key);
}
- function endNode() {
- if (parent.children) {
- mergeChildren(parent.children);
- sortChildren(parent.children);
+ function releaseDocumentWithKey(path, key) {
+ var bucket = getBucketForCompilationSettings(key, false);
+ ts.Debug.assert(bucket !== undefined);
+ var entry = bucket.get(path);
+ entry.languageServiceRefCount--;
+ ts.Debug.assert(entry.languageServiceRefCount >= 0);
+ if (entry.languageServiceRefCount === 0) {
+ bucket.remove(path);
}
- parent = parentsStack.pop();
- }
- function addNodeWithRecursiveChild(node, child) {
- startNode(node);
- addChildrenRecursively(child);
- endNode();
}
- function addChildrenRecursively(node) {
- if (!node || ts.isToken(node)) {
- return;
+ return {
+ acquireDocument: acquireDocument,
+ acquireDocumentWithKey: acquireDocumentWithKey,
+ updateDocument: updateDocument,
+ updateDocumentWithKey: updateDocumentWithKey,
+ releaseDocument: releaseDocument,
+ releaseDocumentWithKey: releaseDocumentWithKey,
+ reportStats: reportStats,
+ getKeyForCompilationSettings: getKeyForCompilationSettings
+ };
+ }
+ ts.createDocumentRegistry = createDocumentRegistry;
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var FindAllReferences;
+ (function (FindAllReferences) {
+ function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) {
+ var node = ts.getTouchingPropertyName(sourceFile, position, true);
+ if (node === sourceFile) {
+ return undefined;
}
switch (node.kind) {
- case 148:
- var ctr = node;
- addNodeWithRecursiveChild(ctr, ctr.body);
- for (var _i = 0, _a = ctr.parameters; _i < _a.length; _i++) {
- var param = _a[_i];
- if (ts.isParameterPropertyDeclaration(param)) {
- addLeafNode(param);
- }
- }
- break;
- case 147:
- case 149:
- case 150:
- case 146:
- if (!ts.hasDynamicName(node)) {
- addNodeWithRecursiveChild(node, node.body);
- }
- break;
- case 145:
- case 144:
- if (!ts.hasDynamicName(node)) {
- addLeafNode(node);
- }
- break;
- case 231:
- var importClause = node;
- if (importClause.name) {
- addLeafNode(importClause);
- }
- var namedBindings = importClause.namedBindings;
- if (namedBindings) {
- if (namedBindings.kind === 232) {
- addLeafNode(namedBindings);
- }
- else {
- for (var _b = 0, _c = namedBindings.elements; _b < _c.length; _b++) {
- var element = _c[_b];
- addLeafNode(element);
- }
- }
- }
- break;
- case 169:
- case 218:
- var decl = node;
- var name_50 = decl.name;
- if (ts.isBindingPattern(name_50)) {
- addChildrenRecursively(name_50);
+ case 8:
+ if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {
+ break;
}
- else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) {
- addChildrenRecursively(decl.initializer);
+ case 70:
+ case 98:
+ case 122:
+ case 9:
+ return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, false);
+ }
+ return undefined;
+ }
+ FindAllReferences.findReferencedSymbols = findReferencedSymbols;
+ function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) {
+ if (!implementations) {
+ if (ts.isLabelName(node)) {
+ if (ts.isJumpStatementTarget(node)) {
+ var labelDefinition = ts.getTargetLabel(node.parent, node.text);
+ return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined;
}
else {
- addNodeWithRecursiveChild(decl, decl.initializer);
- }
- break;
- case 180:
- case 220:
- case 179:
- addNodeWithRecursiveChild(node, node.body);
- break;
- case 224:
- startNode(node);
- for (var _d = 0, _e = node.members; _d < _e.length; _d++) {
- var member = _e[_d];
- if (!isComputedProperty(member)) {
- addLeafNode(member);
- }
- }
- endNode();
- break;
- case 221:
- case 192:
- case 222:
- startNode(node);
- for (var _f = 0, _g = node.members; _f < _g.length; _f++) {
- var member = _g[_f];
- addChildrenRecursively(member);
+ return getLabelReferencesInNode(node.parent, node);
}
- endNode();
- break;
- case 225:
- addNodeWithRecursiveChild(node, getInteriorModule(node).body);
- break;
- case 238:
- case 229:
- case 153:
- case 151:
- case 152:
- case 223:
- addLeafNode(node);
- break;
- default:
- ts.forEach(node.jsDocComments, function (jsDocComment) {
- ts.forEach(jsDocComment.tags, function (tag) {
- if (tag.kind === 279) {
- addLeafNode(tag);
- }
- });
- });
- ts.forEachChild(node, addChildrenRecursively);
- }
- }
- function mergeChildren(children) {
- var nameToItems = ts.createMap();
- ts.filterMutate(children, function (child) {
- var decl = child.node;
- var name = decl.name && nodeText(decl.name);
- if (!name) {
- return true;
}
- var itemsWithSameName = nameToItems[name];
- if (!itemsWithSameName) {
- nameToItems[name] = child;
- return true;
+ if (ts.isThis(node)) {
+ return getReferencesForThisKeyword(node, sourceFiles);
}
- if (itemsWithSameName instanceof Array) {
- for (var _i = 0, itemsWithSameName_1 = itemsWithSameName; _i < itemsWithSameName_1.length; _i++) {
- var itemWithSameName = itemsWithSameName_1[_i];
- if (tryMerge(itemWithSameName, child)) {
- return false;
- }
- }
- itemsWithSameName.push(child);
- return true;
+ if (node.kind === 96) {
+ return getReferencesForSuperKeyword(node);
}
- else {
- var itemWithSameName = itemsWithSameName;
- if (tryMerge(itemWithSameName, child)) {
- return false;
+ }
+ var symbol = typeChecker.getSymbolAtLocation(node);
+ if (!implementations && !symbol && node.kind === 9) {
+ return getReferencesForStringLiteral(node, sourceFiles);
+ }
+ if (!symbol) {
+ return undefined;
+ }
+ var declarations = symbol.declarations;
+ if (!declarations || !declarations.length) {
+ return undefined;
+ }
+ var result;
+ var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations);
+ var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node));
+ var scope = getSymbolScope(symbol);
+ var symbolToIndex = [];
+ if (scope) {
+ result = [];
+ getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex);
+ }
+ else {
+ var internedName = getInternedName(symbol, node);
+ for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) {
+ var sourceFile = sourceFiles_8[_i];
+ cancellationToken.throwIfCancellationRequested();
+ var nameTable = ts.getNameTable(sourceFile);
+ if (nameTable[internedName] !== undefined) {
+ result = result || [];
+ getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex);
}
- nameToItems[name] = [itemWithSameName, child];
- return true;
}
- function tryMerge(a, b) {
- if (shouldReallyMerge(a.node, b.node)) {
- merge(a, b);
- return true;
- }
- return false;
+ }
+ return result;
+ function getDefinition(symbol) {
+ var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node);
+ var name = ts.map(info.displayParts, function (p) { return p.text; }).join("");
+ var declarations = symbol.declarations;
+ if (!declarations || declarations.length === 0) {
+ return undefined;
}
- });
- function shouldReallyMerge(a, b) {
- return a.kind === b.kind && (a.kind !== 225 || areSameModule(a, b));
- function areSameModule(a, b) {
- if (a.body.kind !== b.body.kind) {
- return false;
+ return {
+ containerKind: "",
+ containerName: "",
+ name: name,
+ kind: info.symbolKind,
+ fileName: declarations[0].getSourceFile().fileName,
+ textSpan: ts.createTextSpan(declarations[0].getStart(), 0),
+ displayParts: info.displayParts
+ };
+ }
+ function getAliasSymbolForPropertyNameSymbol(symbol, location) {
+ if (symbol.flags & 8388608) {
+ var defaultImport = ts.getDeclarationOfKind(symbol, 232);
+ if (defaultImport) {
+ return typeChecker.getAliasedSymbol(symbol);
}
- if (a.body.kind !== 225) {
- return true;
+ var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 235 ||
+ declaration.kind === 239) ? declaration : undefined; });
+ if (importOrExportSpecifier &&
+ (!importOrExportSpecifier.propertyName ||
+ importOrExportSpecifier.propertyName === location)) {
+ return importOrExportSpecifier.kind === 235 ?
+ typeChecker.getAliasedSymbol(symbol) :
+ typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier);
}
- return areSameModule(a.body, b.body);
}
+ return undefined;
}
- function merge(target, source) {
- target.additionalNodes = target.additionalNodes || [];
- target.additionalNodes.push(source.node);
- if (source.additionalNodes) {
- (_a = target.additionalNodes).push.apply(_a, source.additionalNodes);
- }
- target.children = ts.concatenate(target.children, source.children);
- if (target.children) {
- mergeChildren(target.children);
- sortChildren(target.children);
- }
- var _a;
+ function followAliasIfNecessary(symbol, location) {
+ return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol;
}
- }
- function sortChildren(children) {
- children.sort(compareChildren);
- }
- function compareChildren(child1, child2) {
- var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node);
- if (name1 && name2) {
- var cmp = localeCompareFix(name1, name2);
- return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);
+ function getPropertySymbolOfDestructuringAssignment(location) {
+ return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) &&
+ typeChecker.getPropertySymbolOfDestructuringAssignment(location);
}
- else {
- return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);
+ function isObjectBindingPatternElementWithoutPropertyName(symbol) {
+ var bindingElement = ts.getDeclarationOfKind(symbol, 170);
+ return bindingElement &&
+ bindingElement.parent.kind === 168 &&
+ !bindingElement.propertyName;
}
- }
- var collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
- var localeCompareIsCorrect = collator && collator.compare("a", "B") < 0;
- var localeCompareFix = localeCompareIsCorrect ? collator.compare : function (a, b) {
- for (var i = 0; i < Math.min(a.length, b.length); i++) {
- var chA = a.charAt(i), chB = b.charAt(i);
- if (chA === "\"" && chB === "'") {
- return 1;
- }
- if (chA === "'" && chB === "\"") {
- return -1;
- }
- var cmp = chA.toLocaleLowerCase().localeCompare(chB.toLocaleLowerCase());
- if (cmp !== 0) {
- return cmp;
+ function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) {
+ if (isObjectBindingPatternElementWithoutPropertyName(symbol)) {
+ var bindingElement = ts.getDeclarationOfKind(symbol, 170);
+ var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent);
+ return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text);
}
+ return undefined;
}
- return a.length - b.length;
- };
- function tryGetName(node) {
- if (node.kind === 225) {
- return getModuleName(node);
+ function getInternedName(symbol, location) {
+ if (ts.isImportOrExportSpecifierName(location)) {
+ return location.getText();
+ }
+ var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol);
+ symbol = localExportDefaultSymbol || symbol;
+ return ts.stripQuotes(symbol.name);
}
- var decl = node;
- if (decl.name) {
- return ts.getPropertyNameForPropertyNameNode(decl.name);
- }
- switch (node.kind) {
- case 179:
- case 180:
- case 192:
- return getFunctionOrClassName(node);
- case 279:
- return getJSDocTypedefTagName(node);
- default:
- return undefined;
- }
- }
- function getItemName(node) {
- if (node.kind === 225) {
- return getModuleName(node);
- }
- var name = node.name;
- if (name) {
- var text = nodeText(name);
- if (text.length > 0) {
- return text;
+ function getSymbolScope(symbol) {
+ var valueDeclaration = symbol.valueDeclaration;
+ if (valueDeclaration && (valueDeclaration.kind === 180 || valueDeclaration.kind === 193)) {
+ return valueDeclaration;
}
- }
- switch (node.kind) {
- case 256:
- var sourceFile = node;
- return ts.isExternalModule(sourceFile)
- ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\""
- : "";
- case 180:
- case 220:
- case 179:
- case 221:
- case 192:
- if (ts.getModifierFlags(node) & 512) {
- return "default";
- }
- return getFunctionOrClassName(node);
- case 148:
- return "constructor";
- case 152:
- return "new()";
- case 151:
- return "()";
- case 153:
- return "[]";
- case 279:
- return getJSDocTypedefTagName(node);
- default:
- return "";
- }
- }
- function getJSDocTypedefTagName(node) {
- if (node.name) {
- return node.name.text;
- }
- else {
- var parentNode = node.parent && node.parent.parent;
- if (parentNode && parentNode.kind === 200) {
- if (parentNode.declarationList.declarations.length > 0) {
- var nameIdentifier = parentNode.declarationList.declarations[0].name;
- if (nameIdentifier.kind === 69) {
- return nameIdentifier.text;
- }
+ if (symbol.flags & (4 | 8192)) {
+ var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8) ? d : undefined; });
+ if (privateDeclaration) {
+ return ts.getAncestor(privateDeclaration, 222);
}
}
- return "";
- }
- }
- function topLevelItems(root) {
- var topLevel = [];
- function recur(item) {
- if (isTopLevel(item)) {
- topLevel.push(item);
- if (item.children) {
- for (var _i = 0, _a = item.children; _i < _a.length; _i++) {
- var child = _a[_i];
- recur(child);
+ if (symbol.flags & 8388608) {
+ return undefined;
+ }
+ if (isObjectBindingPatternElementWithoutPropertyName(symbol)) {
+ return undefined;
+ }
+ if (symbol.parent || (symbol.flags & 268435456)) {
+ return undefined;
+ }
+ var scope;
+ var declarations = symbol.getDeclarations();
+ if (declarations) {
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
+ var declaration = declarations_7[_i];
+ var container = ts.getContainerNode(declaration);
+ if (!container) {
+ return undefined;
+ }
+ if (scope && scope !== container) {
+ return undefined;
}
+ if (container.kind === 256 && !ts.isExternalModule(container)) {
+ return undefined;
+ }
+ scope = container;
}
}
+ return scope;
}
- recur(root);
- return topLevel;
- function isTopLevel(item) {
- switch (navigationBarNodeKind(item)) {
- case 221:
- case 192:
- case 224:
- case 222:
- case 225:
- case 256:
- case 223:
- case 279:
- return true;
- case 148:
- case 147:
- case 149:
- case 150:
- case 218:
- return hasSomeImportantChild(item);
- case 180:
- case 220:
- case 179:
- return isTopLevelFunctionDeclaration(item);
- default:
- return false;
+ function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) {
+ var positions = [];
+ if (!symbolName || !symbolName.length) {
+ return positions;
}
- function isTopLevelFunctionDeclaration(item) {
- if (!item.node.body) {
- return false;
- }
- switch (navigationBarNodeKind(item.parent)) {
- case 226:
- case 256:
- case 147:
- case 148:
- return true;
- default:
- return hasSomeImportantChild(item);
+ var text = sourceFile.text;
+ var sourceLength = text.length;
+ var symbolNameLength = symbolName.length;
+ var position = text.indexOf(symbolName, start);
+ while (position >= 0) {
+ cancellationToken.throwIfCancellationRequested();
+ if (position > end)
+ break;
+ var endPosition = position + symbolNameLength;
+ if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 4)) &&
+ (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 4))) {
+ positions.push(position);
}
+ position = text.indexOf(symbolName, position + symbolNameLength + 1);
}
- function hasSomeImportantChild(item) {
- return ts.forEach(item.children, function (child) {
- var childKind = navigationBarNodeKind(child);
- return childKind !== 218 && childKind !== 169;
- });
- }
+ return positions;
}
- }
- var emptyChildItemArray = [];
- function convertToTree(n) {
- return {
- text: getItemName(n.node),
- kind: ts.getNodeKind(n.node),
- kindModifiers: ts.getNodeModifiers(n.node),
- spans: getSpans(n),
- childItems: ts.map(n.children, convertToTree)
- };
- }
- function convertToTopLevelItem(n) {
- return {
- text: getItemName(n.node),
- kind: ts.getNodeKind(n.node),
- kindModifiers: ts.getNodeModifiers(n.node),
- spans: getSpans(n),
- childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray,
- indent: n.indent,
- bolded: false,
- grayed: false
- };
- function convertToChildItem(n) {
- return {
- text: getItemName(n.node),
- kind: ts.getNodeKind(n.node),
- kindModifiers: ts.getNodeModifiers(n.node),
- spans: getSpans(n),
- childItems: emptyChildItemArray,
- indent: 0,
- bolded: false,
- grayed: false
+ function getLabelReferencesInNode(container, targetLabel) {
+ var references = [];
+ var sourceFile = container.getSourceFile();
+ var labelName = targetLabel.text;
+ var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd());
+ ts.forEach(possiblePositions, function (position) {
+ cancellationToken.throwIfCancellationRequested();
+ var node = ts.getTouchingWord(sourceFile, position);
+ if (!node || node.getWidth() !== labelName.length) {
+ return;
+ }
+ if (node === targetLabel ||
+ (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) {
+ references.push(getReferenceEntryFromNode(node));
+ }
+ });
+ var definition = {
+ containerKind: "",
+ containerName: "",
+ fileName: targetLabel.getSourceFile().fileName,
+ kind: ts.ScriptElementKind.label,
+ name: labelName,
+ textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()),
+ displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)]
};
+ return [{ definition: definition, references: references }];
}
- }
- function getSpans(n) {
- var spans = [getNodeSpan(n.node)];
- if (n.additionalNodes) {
- for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {
- var node = _a[_i];
- spans.push(getNodeSpan(node));
- }
- }
- return spans;
- }
- function getModuleName(moduleDeclaration) {
- if (ts.isAmbientModule(moduleDeclaration)) {
- return ts.getTextOfNode(moduleDeclaration.name);
- }
- var result = [];
- result.push(moduleDeclaration.name.text);
- while (moduleDeclaration.body && moduleDeclaration.body.kind === 225) {
- moduleDeclaration = moduleDeclaration.body;
- result.push(moduleDeclaration.name.text);
- }
- return result.join(".");
- }
- function getInteriorModule(decl) {
- return decl.body.kind === 225 ? getInteriorModule(decl.body) : decl;
- }
- function isComputedProperty(member) {
- return !member.name || member.name.kind === 140;
- }
- function getNodeSpan(node) {
- return node.kind === 256
- ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd())
- : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd());
- }
- function getFunctionOrClassName(node) {
- if (node.name && ts.getFullWidth(node.name) > 0) {
- return ts.declarationNameToString(node.name);
- }
- else if (node.parent.kind === 218) {
- return ts.declarationNameToString(node.parent.name);
- }
- else if (node.parent.kind === 187 &&
- node.parent.operatorToken.kind === 56) {
- return nodeText(node.parent.left);
- }
- else if (node.parent.kind === 253 && node.parent.name) {
- return nodeText(node.parent.name);
- }
- else if (ts.getModifierFlags(node) & 512) {
- return "default";
- }
- else {
- return ts.isClassLike(node) ? "" : "";
- }
- }
- function isFunctionOrClassExpression(node) {
- return node.kind === 179 || node.kind === 180 || node.kind === 192;
- }
- })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var OutliningElementsCollector;
- (function (OutliningElementsCollector) {
- function collectElements(sourceFile) {
- var elements = [];
- var collapseText = "...";
- function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) {
- if (hintSpanNode && startElement && endElement) {
- var span_12 = {
- textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end),
- hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end),
- bannerText: collapseText,
- autoCollapse: autoCollapse
- };
- elements.push(span_12);
- }
- }
- function addOutliningSpanComments(commentSpan, autoCollapse) {
- if (commentSpan) {
- var span_13 = {
- textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end),
- hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end),
- bannerText: collapseText,
- autoCollapse: autoCollapse
- };
- elements.push(span_13);
+ function isValidReferencePosition(node, searchSymbolName) {
+ if (node) {
+ switch (node.kind) {
+ case 70:
+ return node.getWidth() === searchSymbolName.length;
+ case 9:
+ if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||
+ isNameOfExternalModuleImportOrDeclaration(node)) {
+ return node.getWidth() === searchSymbolName.length + 2;
+ }
+ break;
+ case 8:
+ if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {
+ return node.getWidth() === searchSymbolName.length;
+ }
+ break;
+ }
}
+ return false;
}
- function addOutliningForLeadingCommentsForNode(n) {
- var comments = ts.getLeadingCommentRangesOfNode(n, sourceFile);
- if (comments) {
- var firstSingleLineCommentStart = -1;
- var lastSingleLineCommentEnd = -1;
- var isFirstSingleLineComment = true;
- var singleLineCommentCount = 0;
- for (var _i = 0, comments_4 = comments; _i < comments_4.length; _i++) {
- var currentComment = comments_4[_i];
- if (currentComment.kind === 2) {
- if (isFirstSingleLineComment) {
- firstSingleLineCommentStart = currentComment.pos;
+ function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) {
+ var sourceFile = container.getSourceFile();
+ var start = findInComments ? container.getFullStart() : container.getStart();
+ var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd());
+ var parents = getParentSymbolsOfPropertyAccess();
+ var inheritsFromCache = ts.createMap();
+ if (possiblePositions.length) {
+ var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation);
+ ts.forEach(possiblePositions, function (position) {
+ cancellationToken.throwIfCancellationRequested();
+ var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);
+ if (!isValidReferencePosition(referenceLocation, searchText)) {
+ if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) ||
+ (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) {
+ result.push({
+ definition: undefined,
+ references: [{
+ fileName: sourceFile.fileName,
+ textSpan: ts.createTextSpan(position, searchText.length),
+ isWriteAccess: false,
+ isDefinition: false
+ }]
+ });
}
- isFirstSingleLineComment = false;
- lastSingleLineCommentEnd = currentComment.end;
- singleLineCommentCount++;
+ return;
}
- else if (currentComment.kind === 3) {
- combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);
- addOutliningSpanComments(currentComment, false);
- singleLineCommentCount = 0;
- lastSingleLineCommentEnd = -1;
- isFirstSingleLineComment = true;
+ if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) {
+ return;
+ }
+ var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation);
+ if (referenceSymbol) {
+ var referenceSymbolDeclaration = referenceSymbol.valueDeclaration;
+ var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration);
+ var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, searchLocation.kind === 122, parents, inheritsFromCache);
+ if (relatedSymbol) {
+ addReferenceToRelatedSymbol(referenceLocation, relatedSymbol);
+ }
+ else if (!(referenceSymbol.flags & 67108864) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) {
+ addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol);
+ }
+ else if (searchLocation.kind === 122) {
+ findAdditionalConstructorReferences(referenceSymbol, referenceLocation);
+ }
+ }
+ });
+ }
+ return;
+ function getParentSymbolsOfPropertyAccess() {
+ if (implementations) {
+ var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation);
+ if (propertyAccessExpression) {
+ var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression);
+ if (localParentType) {
+ if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== searchSymbol.parent) {
+ return [localParentType.symbol];
+ }
+ else if (localParentType.flags & 1572864) {
+ return getSymbolsForClassAndInterfaceComponents(localParentType);
+ }
+ }
}
}
- combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);
}
- }
- function combineAndAddMultipleSingleLineComments(count, start, end) {
- if (count > 1) {
- var multipleSingleLineComments = {
- pos: start,
- end: end,
- kind: 2
- };
- addOutliningSpanComments(multipleSingleLineComments, false);
+ function getPropertyAccessExpressionFromRightHandSide(node) {
+ return ts.isRightSideOfPropertyAccess(node) && node.parent;
}
- }
- function autoCollapse(node) {
- return ts.isFunctionBlock(node) && node.parent.kind !== 180;
- }
- var depth = 0;
- var maxDepth = 20;
- function walk(n) {
- if (depth > maxDepth) {
- return;
+ function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) {
+ ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration));
+ var referenceClass = referenceLocation.parent;
+ if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) {
+ ts.Debug.assert(referenceClass.name === referenceLocation);
+ addReferences(findOwnConstructorCalls(searchSymbol));
+ }
+ else {
+ var classExtending = tryGetClassByExtendingIdentifier(referenceLocation);
+ if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) {
+ addReferences(superConstructorAccesses(classExtending));
+ }
+ }
}
- if (ts.isDeclaration(n)) {
- addOutliningForLeadingCommentsForNode(n);
+ function addReferences(references) {
+ if (references.length) {
+ var referencedSymbol = getReferencedSymbol(searchSymbol);
+ ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode));
+ }
}
- switch (n.kind) {
- case 199:
- if (!ts.isFunctionBlock(n)) {
- var parent_22 = n.parent;
- var openBrace = ts.findChildOfKind(n, 15, sourceFile);
- var closeBrace = ts.findChildOfKind(n, 16, sourceFile);
- if (parent_22.kind === 204 ||
- parent_22.kind === 207 ||
- parent_22.kind === 208 ||
- parent_22.kind === 206 ||
- parent_22.kind === 203 ||
- parent_22.kind === 205 ||
- parent_22.kind === 212 ||
- parent_22.kind === 252) {
- addOutliningSpan(parent_22, openBrace, closeBrace, autoCollapse(n));
- break;
- }
- if (parent_22.kind === 216) {
- var tryStatement = parent_22;
- if (tryStatement.tryBlock === n) {
- addOutliningSpan(parent_22, openBrace, closeBrace, autoCollapse(n));
- break;
- }
- else if (tryStatement.finallyBlock === n) {
- var finallyKeyword = ts.findChildOfKind(tryStatement, 85, sourceFile);
- if (finallyKeyword) {
- addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n));
- break;
+ function findOwnConstructorCalls(classSymbol) {
+ var result = [];
+ for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) {
+ var decl = _a[_i];
+ ts.Debug.assert(decl.kind === 149);
+ var ctrKeyword = decl.getChildAt(0);
+ ts.Debug.assert(ctrKeyword.kind === 122);
+ result.push(ctrKeyword);
+ }
+ ts.forEachProperty(classSymbol.exports, function (member) {
+ var decl = member.valueDeclaration;
+ if (decl && decl.kind === 148) {
+ var body = decl.body;
+ if (body) {
+ forEachDescendantOfKind(body, 98, function (thisKeyword) {
+ if (ts.isNewExpressionTarget(thisKeyword)) {
+ result.push(thisKeyword);
}
- }
+ });
}
- var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end);
- elements.push({
- textSpan: span_14,
- hintSpan: span_14,
- bannerText: collapseText,
- autoCollapse: autoCollapse(n)
- });
- break;
}
- case 226: {
- var openBrace = ts.findChildOfKind(n, 15, sourceFile);
- var closeBrace = ts.findChildOfKind(n, 16, sourceFile);
- addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n));
- break;
+ });
+ return result;
+ }
+ function superConstructorAccesses(cls) {
+ var symbol = cls.symbol;
+ var ctr = symbol.members["__constructor"];
+ if (!ctr) {
+ return [];
}
- case 221:
- case 222:
- case 224:
- case 171:
- case 227: {
- var openBrace = ts.findChildOfKind(n, 15, sourceFile);
- var closeBrace = ts.findChildOfKind(n, 16, sourceFile);
- addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n));
- break;
+ var result = [];
+ for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) {
+ var decl = _a[_i];
+ ts.Debug.assert(decl.kind === 149);
+ var body = decl.body;
+ if (body) {
+ forEachDescendantOfKind(body, 96, function (node) {
+ if (ts.isCallExpressionTarget(node)) {
+ result.push(node);
+ }
+ });
+ }
}
- case 170:
- var openBracket = ts.findChildOfKind(n, 19, sourceFile);
- var closeBracket = ts.findChildOfKind(n, 20, sourceFile);
- addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n));
- break;
+ ;
+ return result;
}
- depth++;
- ts.forEachChild(n, walk);
- depth--;
- }
- walk(sourceFile);
- return elements;
- }
- OutliningElementsCollector.collectElements = collectElements;
- })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- (function (PatternMatchKind) {
- PatternMatchKind[PatternMatchKind["exact"] = 0] = "exact";
- PatternMatchKind[PatternMatchKind["prefix"] = 1] = "prefix";
- PatternMatchKind[PatternMatchKind["substring"] = 2] = "substring";
- PatternMatchKind[PatternMatchKind["camelCase"] = 3] = "camelCase";
- })(ts.PatternMatchKind || (ts.PatternMatchKind = {}));
- var PatternMatchKind = ts.PatternMatchKind;
- function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) {
- return {
- kind: kind,
- punctuationStripped: punctuationStripped,
- isCaseSensitive: isCaseSensitive,
- camelCaseWeight: camelCaseWeight
- };
- }
- function createPatternMatcher(pattern) {
- var stringToWordSpans = ts.createMap();
- pattern = pattern.trim();
- var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); });
- var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid);
- return {
- getMatches: getMatches,
- getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern,
- patternContainsDots: dotSeparatedSegments.length > 1
- };
- function skipMatch(candidate) {
- return invalidPattern || !candidate;
- }
- function getMatchesForLastSegmentOfPattern(candidate) {
- if (skipMatch(candidate)) {
- return undefined;
- }
- return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments));
- }
- function getMatches(candidateContainers, candidate) {
- if (skipMatch(candidate)) {
- return undefined;
- }
- var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments));
- if (!candidateMatch) {
- return undefined;
- }
- candidateContainers = candidateContainers || [];
- if (dotSeparatedSegments.length - 1 > candidateContainers.length) {
- return undefined;
- }
- var totalMatch = candidateMatch;
- for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) {
- var segment = dotSeparatedSegments[i];
- var containerName = candidateContainers[j];
- var containerMatch = matchSegment(containerName, segment);
- if (!containerMatch) {
- return undefined;
- }
- ts.addRange(totalMatch, containerMatch);
- }
- return totalMatch;
- }
- function getWordSpans(word) {
- if (!(word in stringToWordSpans)) {
- stringToWordSpans[word] = breakIntoWordSpans(word);
- }
- return stringToWordSpans[word];
- }
- function matchTextChunk(candidate, chunk, punctuationStripped) {
- var index = indexOfIgnoringCase(candidate, chunk.textLowerCase);
- if (index === 0) {
- if (chunk.text.length === candidate.length) {
- return createPatternMatch(PatternMatchKind.exact, punctuationStripped, candidate === chunk.text);
+ function getReferencedSymbol(symbol) {
+ var symbolId = ts.getSymbolId(symbol);
+ var index = symbolToIndex[symbolId];
+ if (index === undefined) {
+ index = result.length;
+ symbolToIndex[symbolId] = index;
+ result.push({
+ definition: getDefinition(symbol),
+ references: []
+ });
+ }
+ return result[index];
}
- else {
- return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, ts.startsWith(candidate, chunk.text));
+ function addReferenceToRelatedSymbol(node, relatedSymbol) {
+ var references = getReferencedSymbol(relatedSymbol).references;
+ if (implementations) {
+ getImplementationReferenceEntryForNode(node, references);
+ }
+ else {
+ references.push(getReferenceEntryFromNode(node));
+ }
}
}
- var isLowercase = chunk.isLowerCase;
- if (isLowercase) {
- if (index > 0) {
- var wordSpans = getWordSpans(candidate);
- for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) {
- var span_15 = wordSpans_1[_i];
- if (partStartsWith(candidate, span_15, chunk.text, true)) {
- return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span_15, chunk.text, false));
+ function getImplementationReferenceEntryForNode(refNode, result) {
+ if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) {
+ result.push(getReferenceEntryFromNode(refNode.parent));
+ }
+ else if (refNode.kind === 70) {
+ if (refNode.parent.kind === 254) {
+ getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result);
+ }
+ var containingClass = getContainingClassIfInHeritageClause(refNode);
+ if (containingClass) {
+ result.push(getReferenceEntryFromNode(containingClass));
+ return;
+ }
+ var containingTypeReference = getContainingTypeReference(refNode);
+ if (containingTypeReference) {
+ var parent_21 = containingTypeReference.parent;
+ if (ts.isVariableLike(parent_21) && parent_21.type === containingTypeReference && parent_21.initializer && isImplementationExpression(parent_21.initializer)) {
+ maybeAdd(getReferenceEntryFromNode(parent_21.initializer));
+ }
+ else if (ts.isFunctionLike(parent_21) && parent_21.type === containingTypeReference && parent_21.body) {
+ if (parent_21.body.kind === 200) {
+ ts.forEachReturnStatement(parent_21.body, function (returnStatement) {
+ if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
+ maybeAdd(getReferenceEntryFromNode(returnStatement.expression));
+ }
+ });
+ }
+ else if (isImplementationExpression(parent_21.body)) {
+ maybeAdd(getReferenceEntryFromNode(parent_21.body));
+ }
+ }
+ else if (ts.isAssertionExpression(parent_21) && isImplementationExpression(parent_21.expression)) {
+ maybeAdd(getReferenceEntryFromNode(parent_21.expression));
}
}
}
- }
- else {
- if (candidate.indexOf(chunk.text) > 0) {
- return createPatternMatch(PatternMatchKind.substring, punctuationStripped, true);
+ function maybeAdd(a) {
+ if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) {
+ result.push(a);
+ }
}
}
- if (!isLowercase) {
- if (chunk.characterSpans.length > 0) {
- var candidateParts = getWordSpans(candidate);
- var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, false);
- if (camelCaseWeight !== undefined) {
- return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, true, camelCaseWeight);
+ function getSymbolsForClassAndInterfaceComponents(type, result) {
+ if (result === void 0) { result = []; }
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var componentType = _a[_i];
+ if (componentType.symbol && componentType.symbol.getFlags() & (32 | 64)) {
+ result.push(componentType.symbol);
}
- camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, true);
- if (camelCaseWeight !== undefined) {
- return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, false, camelCaseWeight);
+ if (componentType.getFlags() & 1572864) {
+ getSymbolsForClassAndInterfaceComponents(componentType, result);
}
}
+ return result;
}
- if (isLowercase) {
- if (chunk.text.length < candidate.length) {
- if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) {
- return createPatternMatch(PatternMatchKind.substring, punctuationStripped, false);
+ function getContainingTypeReference(node) {
+ var topLevelTypeReference = undefined;
+ while (node) {
+ if (ts.isTypeNode(node)) {
+ topLevelTypeReference = node;
}
+ node = node.parent;
}
+ return topLevelTypeReference;
}
- return undefined;
- }
- function containsSpaceOrAsterisk(text) {
- for (var i = 0; i < text.length; i++) {
- var ch = text.charCodeAt(i);
- if (ch === 32 || ch === 42) {
- return true;
- }
- }
- return false;
- }
- function matchSegment(candidate, segment) {
- if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) {
- var match = matchTextChunk(candidate, segment.totalTextChunk, false);
- if (match) {
- return [match];
+ function getContainingClassIfInHeritageClause(node) {
+ if (node && node.parent) {
+ if (node.kind === 195
+ && node.parent.kind === 251
+ && ts.isClassLike(node.parent.parent)) {
+ return node.parent.parent;
+ }
+ else if (node.kind === 70 || node.kind === 173) {
+ return getContainingClassIfInHeritageClause(node.parent);
+ }
}
+ return undefined;
}
- var subWordTextChunks = segment.subWordTextChunks;
- var matches = undefined;
- for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) {
- var subWordTextChunk = subWordTextChunks_1[_i];
- var result = matchTextChunk(candidate, subWordTextChunk, true);
- if (!result) {
- return undefined;
+ function isImplementationExpression(node) {
+ if (node.kind === 179) {
+ return isImplementationExpression(node.expression);
}
- matches = matches || [];
- matches.push(result);
- }
- return matches;
- }
- function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) {
- var patternPartStart = patternSpan ? patternSpan.start : 0;
- var patternPartLength = patternSpan ? patternSpan.length : pattern.length;
- if (patternPartLength > candidateSpan.length) {
- return false;
+ return node.kind === 181 ||
+ node.kind === 180 ||
+ node.kind === 172 ||
+ node.kind === 193 ||
+ node.kind === 171;
}
- if (ignoreCase) {
- for (var i = 0; i < patternPartLength; i++) {
- var ch1 = pattern.charCodeAt(patternPartStart + i);
- var ch2 = candidate.charCodeAt(candidateSpan.start + i);
- if (toLowerCase(ch1) !== toLowerCase(ch2)) {
- return false;
+ function explicitlyInheritsFrom(child, parent, cachedResults) {
+ var parentIsInterface = parent.getFlags() & 64;
+ return searchHierarchy(child);
+ function searchHierarchy(symbol) {
+ if (symbol === parent) {
+ return true;
}
- }
- }
- else {
- for (var i = 0; i < patternPartLength; i++) {
- var ch1 = pattern.charCodeAt(patternPartStart + i);
- var ch2 = candidate.charCodeAt(candidateSpan.start + i);
- if (ch1 !== ch2) {
+ var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent);
+ if (key in cachedResults) {
+ return cachedResults[key];
+ }
+ cachedResults[key] = false;
+ var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) {
+ if (ts.isClassLike(declaration)) {
+ if (parentIsInterface) {
+ var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration);
+ if (interfaceReferences) {
+ for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) {
+ var typeReference = interfaceReferences_1[_i];
+ if (searchTypeReference(typeReference)) {
+ return true;
+ }
+ }
+ }
+ }
+ return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));
+ }
+ else if (declaration.kind === 223) {
+ if (parentIsInterface) {
+ return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference);
+ }
+ }
return false;
+ });
+ cachedResults[key] = inherits;
+ return inherits;
+ }
+ function searchTypeReference(typeReference) {
+ if (typeReference) {
+ var type = typeChecker.getTypeAtLocation(typeReference);
+ if (type && type.symbol) {
+ return searchHierarchy(type.symbol);
+ }
}
+ return false;
}
}
- return true;
- }
- function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) {
- var chunkCharacterSpans = chunk.characterSpans;
- var currentCandidate = 0;
- var currentChunkSpan = 0;
- var firstMatch = undefined;
- var contiguous = undefined;
- while (true) {
- if (currentChunkSpan === chunkCharacterSpans.length) {
- var weight = 0;
- if (contiguous) {
- weight += 1;
+ function getReferencesForSuperKeyword(superKeyword) {
+ var searchSpaceNode = ts.getSuperContainer(superKeyword, false);
+ if (!searchSpaceNode) {
+ return undefined;
+ }
+ var staticFlag = 32;
+ switch (searchSpaceNode.kind) {
+ case 146:
+ case 145:
+ case 148:
+ case 147:
+ case 149:
+ case 150:
+ case 151:
+ staticFlag &= ts.getModifierFlags(searchSpaceNode);
+ searchSpaceNode = searchSpaceNode.parent;
+ break;
+ default:
+ return undefined;
+ }
+ var references = [];
+ var sourceFile = searchSpaceNode.getSourceFile();
+ var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd());
+ ts.forEach(possiblePositions, function (position) {
+ cancellationToken.throwIfCancellationRequested();
+ var node = ts.getTouchingWord(sourceFile, position);
+ if (!node || node.kind !== 96) {
+ return;
}
- if (firstMatch === 0) {
- weight += 2;
+ var container = ts.getSuperContainer(node, false);
+ if (container && (32 & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) {
+ references.push(getReferenceEntryFromNode(node));
}
- return weight;
+ });
+ var definition = getDefinition(searchSpaceNode.symbol);
+ return [{ definition: definition, references: references }];
+ }
+ function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) {
+ var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false);
+ var staticFlag = 32;
+ switch (searchSpaceNode.kind) {
+ case 148:
+ case 147:
+ if (ts.isObjectLiteralMethod(searchSpaceNode)) {
+ break;
+ }
+ case 146:
+ case 145:
+ case 149:
+ case 150:
+ case 151:
+ staticFlag &= ts.getModifierFlags(searchSpaceNode);
+ searchSpaceNode = searchSpaceNode.parent;
+ break;
+ case 256:
+ if (ts.isExternalModule(searchSpaceNode)) {
+ return undefined;
+ }
+ case 221:
+ case 180:
+ break;
+ default:
+ return undefined;
}
- else if (currentCandidate === candidateParts.length) {
+ var references = [];
+ var possiblePositions;
+ if (searchSpaceNode.kind === 256) {
+ ts.forEach(sourceFiles, function (sourceFile) {
+ possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd());
+ getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references);
+ });
+ }
+ else {
+ var sourceFile = searchSpaceNode.getSourceFile();
+ possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd());
+ getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references);
+ }
+ var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword);
+ var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts;
+ return [{
+ definition: {
+ containerKind: "",
+ containerName: "",
+ fileName: node.getSourceFile().fileName,
+ kind: ts.ScriptElementKind.variableElement,
+ name: "this",
+ textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()),
+ displayParts: displayParts
+ },
+ references: references
+ }];
+ function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) {
+ ts.forEach(possiblePositions, function (position) {
+ cancellationToken.throwIfCancellationRequested();
+ var node = ts.getTouchingWord(sourceFile, position);
+ if (!node || !ts.isThis(node)) {
+ return;
+ }
+ var container = ts.getThisContainer(node, false);
+ switch (searchSpaceNode.kind) {
+ case 180:
+ case 221:
+ if (searchSpaceNode.symbol === container.symbol) {
+ result.push(getReferenceEntryFromNode(node));
+ }
+ break;
+ case 148:
+ case 147:
+ if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) {
+ result.push(getReferenceEntryFromNode(node));
+ }
+ break;
+ case 193:
+ case 222:
+ if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) {
+ result.push(getReferenceEntryFromNode(node));
+ }
+ break;
+ case 256:
+ if (container.kind === 256 && !ts.isExternalModule(container)) {
+ result.push(getReferenceEntryFromNode(node));
+ }
+ break;
+ }
+ });
+ }
+ }
+ function getReferencesForStringLiteral(node, sourceFiles) {
+ var type = ts.getStringLiteralTypeForNode(node, typeChecker);
+ if (!type) {
return undefined;
}
- var candidatePart = candidateParts[currentCandidate];
- var gotOneMatchThisCandidate = false;
- for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) {
- var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan];
- if (gotOneMatchThisCandidate) {
- if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) ||
- !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) {
- break;
+ var references = [];
+ for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) {
+ var sourceFile = sourceFiles_9[_i];
+ var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd());
+ getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references);
+ }
+ return [{
+ definition: {
+ containerKind: "",
+ containerName: "",
+ fileName: node.getSourceFile().fileName,
+ kind: ts.ScriptElementKind.variableElement,
+ name: type.text,
+ textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()),
+ displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)]
+ },
+ references: references
+ }];
+ function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) {
+ for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) {
+ var position = possiblePositions_1[_i];
+ cancellationToken.throwIfCancellationRequested();
+ var node_2 = ts.getTouchingWord(sourceFile, position);
+ if (!node_2 || node_2.kind !== 9) {
+ return;
+ }
+ var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker);
+ if (type_1 === searchType) {
+ references.push(getReferenceEntryFromNode(node_2));
}
}
- if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) {
- break;
+ }
+ }
+ function populateSearchSymbolSet(symbol, location) {
+ var result = [symbol];
+ var containingObjectLiteralElement = getContainingObjectLiteralElement(location);
+ if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 254) {
+ var propertySymbol = getPropertySymbolOfDestructuringAssignment(location);
+ if (propertySymbol) {
+ result.push(propertySymbol);
}
- gotOneMatchThisCandidate = true;
- firstMatch = firstMatch === undefined ? currentCandidate : firstMatch;
- contiguous = contiguous === undefined ? true : contiguous;
- candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length);
}
- if (!gotOneMatchThisCandidate && contiguous !== undefined) {
- contiguous = false;
+ var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location);
+ if (aliasSymbol) {
+ result = result.concat(populateSearchSymbolSet(aliasSymbol, location));
}
- currentCandidate++;
+ if (containingObjectLiteralElement) {
+ ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) {
+ ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol));
+ });
+ var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent);
+ if (shorthandValueSymbol) {
+ result.push(shorthandValueSymbol);
+ }
+ }
+ if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 143 &&
+ ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) {
+ result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name));
+ }
+ var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol);
+ if (bindingElementPropertySymbol) {
+ result.push(bindingElementPropertySymbol);
+ }
+ ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) {
+ if (rootSymbol !== symbol) {
+ result.push(rootSymbol);
+ }
+ if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) {
+ getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap());
+ }
+ });
+ return result;
}
- }
- }
- ts.createPatternMatcher = createPatternMatcher;
- function createSegment(text) {
- return {
- totalTextChunk: createTextChunk(text),
- subWordTextChunks: breakPatternIntoTextChunks(text)
- };
- }
- function segmentIsInvalid(segment) {
- return segment.subWordTextChunks.length === 0;
- }
- function isUpperCaseLetter(ch) {
- if (ch >= 65 && ch <= 90) {
- return true;
- }
- if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) {
- return false;
- }
- var str = String.fromCharCode(ch);
- return str === str.toUpperCase();
- }
- function isLowerCaseLetter(ch) {
- if (ch >= 97 && ch <= 122) {
- return true;
- }
- if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) {
- return false;
- }
- var str = String.fromCharCode(ch);
- return str === str.toLowerCase();
- }
- function indexOfIgnoringCase(string, value) {
- for (var i = 0, n = string.length - value.length; i <= n; i++) {
- if (startsWithIgnoringCase(string, value, i)) {
- return i;
- }
- }
- return -1;
- }
- function startsWithIgnoringCase(string, value, start) {
- for (var i = 0, n = value.length; i < n; i++) {
- var ch1 = toLowerCase(string.charCodeAt(i + start));
- var ch2 = value.charCodeAt(i);
- if (ch1 !== ch2) {
- return false;
- }
- }
- return true;
- }
- function toLowerCase(ch) {
- if (ch >= 65 && ch <= 90) {
- return 97 + (ch - 65);
- }
- if (ch < 127) {
- return ch;
- }
- return String.fromCharCode(ch).toLowerCase().charCodeAt(0);
- }
- function isDigit(ch) {
- return ch >= 48 && ch <= 57;
- }
- function isWordChar(ch) {
- return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === 95 || ch === 36;
- }
- function breakPatternIntoTextChunks(pattern) {
- var result = [];
- var wordStart = 0;
- var wordLength = 0;
- for (var i = 0; i < pattern.length; i++) {
- var ch = pattern.charCodeAt(i);
- if (isWordChar(ch)) {
- if (wordLength === 0) {
- wordStart = i;
+ function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) {
+ if (!symbol) {
+ return;
}
- wordLength++;
- }
- else {
- if (wordLength > 0) {
- result.push(createTextChunk(pattern.substr(wordStart, wordLength)));
- wordLength = 0;
+ if (symbol.name in previousIterationSymbolsCache) {
+ return;
}
- }
- }
- if (wordLength > 0) {
- result.push(createTextChunk(pattern.substr(wordStart, wordLength)));
- }
- return result;
- }
- function createTextChunk(text) {
- var textLowerCase = text.toLowerCase();
- return {
- text: text,
- textLowerCase: textLowerCase,
- isLowerCase: text === textLowerCase,
- characterSpans: breakIntoCharacterSpans(text)
- };
- }
- function breakIntoCharacterSpans(identifier) {
- return breakIntoSpans(identifier, false);
- }
- ts.breakIntoCharacterSpans = breakIntoCharacterSpans;
- function breakIntoWordSpans(identifier) {
- return breakIntoSpans(identifier, true);
- }
- ts.breakIntoWordSpans = breakIntoWordSpans;
- function breakIntoSpans(identifier, word) {
- var result = [];
- var wordStart = 0;
- for (var i = 1, n = identifier.length; i < n; i++) {
- var lastIsDigit = isDigit(identifier.charCodeAt(i - 1));
- var currentIsDigit = isDigit(identifier.charCodeAt(i));
- var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i);
- var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart);
- if (charIsPunctuation(identifier.charCodeAt(i - 1)) ||
- charIsPunctuation(identifier.charCodeAt(i)) ||
- lastIsDigit !== currentIsDigit ||
- hasTransitionFromLowerToUpper ||
- hasTransitionFromUpperToLower) {
- if (!isAllPunctuation(identifier, wordStart, i)) {
- result.push(ts.createTextSpan(wordStart, i - wordStart));
+ if (symbol.flags & (32 | 64)) {
+ ts.forEach(symbol.getDeclarations(), function (declaration) {
+ if (ts.isClassLike(declaration)) {
+ getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));
+ ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference);
+ }
+ else if (declaration.kind === 223) {
+ ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference);
+ }
+ });
}
- wordStart = i;
- }
- }
- if (!isAllPunctuation(identifier, wordStart, identifier.length)) {
- result.push(ts.createTextSpan(wordStart, identifier.length - wordStart));
- }
- return result;
- }
- function charIsPunctuation(ch) {
- switch (ch) {
- case 33:
- case 34:
- case 35:
- case 37:
- case 38:
- case 39:
- case 40:
- case 41:
- case 42:
- case 44:
- case 45:
- case 46:
- case 47:
- case 58:
- case 59:
- case 63:
- case 64:
- case 91:
- case 92:
- case 93:
- case 95:
- case 123:
- case 125:
- return true;
- }
- return false;
- }
- function isAllPunctuation(identifier, start, end) {
- for (var i = start; i < end; i++) {
- var ch = identifier.charCodeAt(i);
- if (!charIsPunctuation(ch) || ch === 95 || ch === 36) {
- return false;
- }
- }
- return true;
- }
- function transitionFromUpperToLower(identifier, word, index, wordStart) {
- if (word) {
- if (index !== wordStart &&
- index + 1 < identifier.length) {
- var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));
- var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1));
- if (currentIsUpper && nextIsLower) {
- for (var i = wordStart; i < index; i++) {
- if (!isUpperCaseLetter(identifier.charCodeAt(i))) {
- return false;
+ return;
+ function getPropertySymbolFromTypeReference(typeReference) {
+ if (typeReference) {
+ var type = typeChecker.getTypeAtLocation(typeReference);
+ if (type) {
+ var propertySymbol = typeChecker.getPropertyOfType(type, propertyName);
+ if (propertySymbol) {
+ result.push.apply(result, typeChecker.getRootSymbols(propertySymbol));
+ }
+ previousIterationSymbolsCache[symbol.name] = symbol;
+ getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache);
}
}
- return true;
}
}
- }
- return false;
- }
- function transitionFromLowerToUpper(identifier, word, index) {
- var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1));
- var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));
- var transition = word
- ? (currentIsUpper && !lastIsUpper)
- : currentIsUpper;
- return transition;
- }
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) {
- if (readImportFiles === void 0) { readImportFiles = true; }
- if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; }
- var referencedFiles = [];
- var typeReferenceDirectives = [];
- var importedFiles = [];
- var ambientExternalModules;
- var isNoDefaultLib = false;
- var braceNesting = 0;
- var externalModule = false;
- function nextToken() {
- var token = ts.scanner.scan();
- if (token === 15) {
- braceNesting++;
- }
- else if (token === 16) {
- braceNesting--;
- }
- return token;
- }
- function processTripleSlashDirectives() {
- var commentRanges = ts.getLeadingCommentRanges(sourceText, 0);
- ts.forEach(commentRanges, function (commentRange) {
- var comment = sourceText.substring(commentRange.pos, commentRange.end);
- var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, commentRange);
- if (referencePathMatchResult) {
- isNoDefaultLib = referencePathMatchResult.isNoDefaultLib;
- var fileReference = referencePathMatchResult.fileReference;
- if (fileReference) {
- var collection = referencePathMatchResult.isTypeReferenceDirective
- ? typeReferenceDirectives
- : referencedFiles;
- collection.push(fileReference);
- }
+ function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) {
+ if (ts.contains(searchSymbols, referenceSymbol)) {
+ return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol;
}
- });
- }
- function getFileReference() {
- var file = ts.scanner.getTokenValue();
- var pos = ts.scanner.getTokenPos();
- return {
- fileName: file,
- pos: pos,
- end: pos + file.length
- };
- }
- function recordAmbientExternalModule() {
- if (!ambientExternalModules) {
- ambientExternalModules = [];
- }
- ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting });
- }
- function recordModuleName() {
- importedFiles.push(getFileReference());
- markAsExternalModuleIfTopLevel();
- }
- function markAsExternalModuleIfTopLevel() {
- if (braceNesting === 0) {
- externalModule = true;
- }
- }
- function tryConsumeDeclare() {
- var token = ts.scanner.getToken();
- if (token === 122) {
- token = nextToken();
- if (token === 125) {
- token = nextToken();
- if (token === 9) {
- recordAmbientExternalModule();
+ var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation);
+ if (aliasSymbol) {
+ return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache);
+ }
+ var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation);
+ if (containingObjectLiteralElement) {
+ var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) {
+ return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
+ });
+ if (contextualSymbol) {
+ return contextualSymbol;
+ }
+ var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation);
+ if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) {
+ return propertySymbol;
}
}
- return true;
- }
- return false;
- }
- function tryConsumeImport() {
- var token = ts.scanner.getToken();
- if (token === 89) {
- token = nextToken();
- if (token === 9) {
- recordModuleName();
- return true;
+ var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol);
+ if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) {
+ return bindingElementPropertySymbol;
}
- else {
- if (token === 69 || ts.isKeyword(token)) {
- token = nextToken();
- if (token === 136) {
- token = nextToken();
- if (token === 9) {
- recordModuleName();
- return true;
- }
- }
- else if (token === 56) {
- if (tryConsumeRequireCall(true)) {
- return true;
- }
- }
- else if (token === 24) {
- token = nextToken();
- }
- else {
- return true;
- }
+ return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) {
+ if (searchSymbols.indexOf(rootSymbol) >= 0) {
+ return rootSymbol;
}
- if (token === 15) {
- token = nextToken();
- while (token !== 16 && token !== 1) {
- token = nextToken();
- }
- if (token === 16) {
- token = nextToken();
- if (token === 136) {
- token = nextToken();
- if (token === 9) {
- recordModuleName();
- }
+ if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) {
+ if (parents) {
+ if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) {
+ return undefined;
}
}
+ var result_3 = [];
+ getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3, ts.createMap());
+ return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
}
- else if (token === 37) {
- token = nextToken();
- if (token === 116) {
- token = nextToken();
- if (token === 69 || ts.isKeyword(token)) {
- token = nextToken();
- if (token === 136) {
- token = nextToken();
- if (token === 9) {
- recordModuleName();
- }
- }
- }
- }
+ return undefined;
+ });
+ }
+ function getNameFromObjectLiteralElement(node) {
+ if (node.name.kind === 141) {
+ var nameExpression = node.name.expression;
+ if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
+ return nameExpression.text;
}
+ return undefined;
}
- return true;
+ return node.name.text;
}
- return false;
- }
- function tryConsumeExport() {
- var token = ts.scanner.getToken();
- if (token === 82) {
- markAsExternalModuleIfTopLevel();
- token = nextToken();
- if (token === 15) {
- token = nextToken();
- while (token !== 16 && token !== 1) {
- token = nextToken();
+ function getPropertySymbolsFromContextualType(node) {
+ var objectLiteral = node.parent;
+ var contextualType = typeChecker.getContextualType(objectLiteral);
+ var name = getNameFromObjectLiteralElement(node);
+ if (name && contextualType) {
+ var result_4 = [];
+ var symbol_2 = contextualType.getProperty(name);
+ if (symbol_2) {
+ result_4.push(symbol_2);
}
- if (token === 16) {
- token = nextToken();
- if (token === 136) {
- token = nextToken();
- if (token === 9) {
- recordModuleName();
+ if (contextualType.flags & 524288) {
+ ts.forEach(contextualType.types, function (t) {
+ var symbol = t.getProperty(name);
+ if (symbol) {
+ result_4.push(symbol);
}
- }
- }
- }
- else if (token === 37) {
- token = nextToken();
- if (token === 136) {
- token = nextToken();
- if (token === 9) {
- recordModuleName();
- }
+ });
}
+ return result_4;
}
- else if (token === 89) {
- token = nextToken();
- if (token === 69 || ts.isKeyword(token)) {
- token = nextToken();
- if (token === 56) {
- if (tryConsumeRequireCall(true)) {
- return true;
+ return undefined;
+ }
+ function getIntersectingMeaningFromDeclarations(meaning, declarations) {
+ if (declarations) {
+ var lastIterationMeaning = void 0;
+ do {
+ lastIterationMeaning = meaning;
+ for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
+ var declaration = declarations_8[_i];
+ var declarationMeaning = ts.getMeaningFromDeclaration(declaration);
+ if (declarationMeaning & meaning) {
+ meaning |= declarationMeaning;
}
}
- }
+ } while (meaning !== lastIterationMeaning);
}
- return true;
+ return meaning;
}
- return false;
}
- function tryConsumeRequireCall(skipCurrentToken) {
- var token = skipCurrentToken ? nextToken() : ts.scanner.getToken();
- if (token === 129) {
- token = nextToken();
- if (token === 17) {
- token = nextToken();
- if (token === 9) {
- recordModuleName();
- }
- }
- return true;
+ FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode;
+ function convertReferences(referenceSymbols) {
+ if (!referenceSymbols) {
+ return undefined;
}
- return false;
+ var referenceEntries = [];
+ for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) {
+ var referenceSymbol = referenceSymbols_1[_i];
+ ts.addRange(referenceEntries, referenceSymbol.references);
+ }
+ return referenceEntries;
}
- function tryConsumeDefine() {
- var token = ts.scanner.getToken();
- if (token === 69 && ts.scanner.getTokenValue() === "define") {
- token = nextToken();
- if (token !== 17) {
+ FindAllReferences.convertReferences = convertReferences;
+ function isImplementation(node) {
+ if (!node) {
+ return false;
+ }
+ else if (ts.isVariableLike(node)) {
+ if (node.initializer) {
return true;
}
- token = nextToken();
- if (token === 9) {
- token = nextToken();
- if (token === 24) {
- token = nextToken();
- }
- else {
- return true;
- }
- }
- if (token !== 19) {
- return true;
+ else if (node.kind === 219) {
+ var parentStatement = getParentStatementOfVariableDeclaration(node);
+ return parentStatement && ts.hasModifier(parentStatement, 2);
}
- token = nextToken();
- var i = 0;
- while (token !== 20 && token !== 1) {
- if (token === 9) {
- recordModuleName();
- i++;
- }
- token = nextToken();
+ }
+ else if (ts.isFunctionLike(node)) {
+ return !!node.body || ts.hasModifier(node, 2);
+ }
+ else {
+ switch (node.kind) {
+ case 222:
+ case 193:
+ case 225:
+ case 226:
+ return true;
}
- return true;
}
return false;
}
- function processImports() {
- ts.scanner.setText(sourceText);
- nextToken();
- while (true) {
- if (ts.scanner.getToken() === 1) {
- break;
- }
- if (tryConsumeDeclare() ||
- tryConsumeImport() ||
- tryConsumeExport() ||
- (detectJavaScriptImports && (tryConsumeRequireCall(false) || tryConsumeDefine()))) {
- continue;
- }
- else {
- nextToken();
- }
+ function getParentStatementOfVariableDeclaration(node) {
+ if (node.parent && node.parent.parent && node.parent.parent.kind === 201) {
+ ts.Debug.assert(node.parent.kind === 220);
+ return node.parent.parent;
}
- ts.scanner.setText(undefined);
- }
- if (readImportFiles) {
- processImports();
}
- processTripleSlashDirectives();
- if (externalModule) {
- if (ambientExternalModules) {
- for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) {
- var decl = ambientExternalModules_1[_i];
- importedFiles.push(decl.ref);
+ function getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result) {
+ var refSymbol = typeChecker.getSymbolAtLocation(node);
+ var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration);
+ if (shorthandSymbol) {
+ for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) {
+ var declaration = _a[_i];
+ if (ts.getMeaningFromDeclaration(declaration) & 1) {
+ result.push(getReferenceEntryFromNode(declaration));
+ }
}
}
- return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined };
}
- else {
- var ambientModuleNames = void 0;
- if (ambientExternalModules) {
- for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) {
- var decl = ambientExternalModules_2[_a];
- if (decl.depth === 0) {
- if (!ambientModuleNames) {
- ambientModuleNames = [];
- }
- ambientModuleNames.push(decl.ref.fileName);
- }
- else {
- importedFiles.push(decl.ref);
- }
- }
+ FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment;
+ function getReferenceEntryFromNode(node) {
+ var start = node.getStart();
+ var end = node.getEnd();
+ if (node.kind === 9) {
+ start += 1;
+ end -= 1;
}
- return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames };
+ return {
+ fileName: node.getSourceFile().fileName,
+ textSpan: ts.createTextSpanFromBounds(start, end),
+ isWriteAccess: isWriteAccess(node),
+ isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node)
+ };
}
- }
- ts.preProcessFile = preProcessFile;
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var Rename;
- (function (Rename) {
- function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) {
- var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName));
- var node = ts.getTouchingWord(sourceFile, position, true);
- if (node) {
- if (node.kind === 69 ||
- node.kind === 9 ||
- ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||
- ts.isThis(node)) {
- var symbol = typeChecker.getSymbolAtLocation(node);
- if (symbol) {
- var declarations = symbol.getDeclarations();
- if (declarations && declarations.length > 0) {
- if (ts.forEach(declarations, isDefinedInLibraryFile)) {
- return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));
- }
- var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node));
- var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node);
- if (kind) {
- return {
- canRename: true,
- kind: kind,
- displayName: displayName,
- localizedErrorMessage: undefined,
- fullDisplayName: typeChecker.getFullyQualifiedName(symbol),
- kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- triggerSpan: createTriggerSpanForNode(node, sourceFile)
- };
- }
- }
- }
- else if (node.kind === 9) {
- var type = ts.getStringLiteralTypeForNode(node, typeChecker);
- if (type) {
- if (isDefinedInLibraryFile(node)) {
- return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));
- }
- else {
- var displayName = ts.stripQuotes(type.text);
- return {
- canRename: true,
- kind: ts.ScriptElementKind.variableElement,
- displayName: displayName,
- localizedErrorMessage: undefined,
- fullDisplayName: displayName,
- kindModifiers: ts.ScriptElementKindModifier.none,
- triggerSpan: createTriggerSpanForNode(node, sourceFile)
- };
- }
- }
- }
- }
- }
- return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element));
- function getRenameInfoError(localizedErrorMessage) {
- return {
- canRename: false,
- localizedErrorMessage: localizedErrorMessage,
- displayName: undefined,
- fullDisplayName: undefined,
- kind: undefined,
- kindModifiers: undefined,
- triggerSpan: undefined
- };
+ FindAllReferences.getReferenceEntryFromNode = getReferenceEntryFromNode;
+ function isWriteAccess(node) {
+ if (node.kind === 70 && ts.isDeclarationName(node)) {
+ return true;
}
- function isDefinedInLibraryFile(declaration) {
- if (defaultLibFileName) {
- var sourceFile_1 = declaration.getSourceFile();
- var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName));
- if (canonicalName === canonicalDefaultLibName) {
- return true;
- }
+ var parent = node.parent;
+ if (parent) {
+ if (parent.kind === 187 || parent.kind === 186) {
+ return true;
+ }
+ else if (parent.kind === 188 && parent.left === node) {
+ var operator = parent.operatorToken.kind;
+ return 57 <= operator && operator <= 69;
}
- return false;
}
- function createTriggerSpanForNode(node, sourceFile) {
- var start = node.getStart(sourceFile);
- var width = node.getWidth(sourceFile);
- if (node.kind === 9) {
- start += 1;
- width -= 2;
+ return false;
+ }
+ function forEachDescendantOfKind(node, kind, action) {
+ ts.forEachChild(node, function (child) {
+ if (child.kind === kind) {
+ action(child);
}
- return ts.createTextSpan(start, width);
+ forEachDescendantOfKind(child, kind, action);
+ });
+ }
+ function getContainingObjectLiteralElement(node) {
+ switch (node.kind) {
+ case 9:
+ case 8:
+ if (node.parent.kind === 141) {
+ return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined;
+ }
+ case 70:
+ return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined;
}
+ return undefined;
}
- Rename.getRenameInfo = getRenameInfo;
- })(Rename = ts.Rename || (ts.Rename = {}));
+ function isObjectLiteralPropertyDeclaration(node) {
+ switch (node.kind) {
+ case 253:
+ case 254:
+ case 148:
+ case 150:
+ case 151:
+ return true;
+ }
+ return false;
+ }
+ function tryGetClassByExtendingIdentifier(node) {
+ return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent);
+ }
+ function isNameOfExternalModuleImportOrDeclaration(node) {
+ if (node.kind === 9) {
+ return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node);
+ }
+ return false;
+ }
+ })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
- var SignatureHelp;
- (function (SignatureHelp) {
- var emptyArray = [];
- function getSignatureHelpItems(program, sourceFile, position, cancellationToken) {
- var typeChecker = program.getTypeChecker();
- var startingToken = ts.findTokenOnLeftOfPosition(sourceFile, position);
- if (!startingToken) {
- return undefined;
- }
- var argumentInfo = getContainingArgumentInfo(startingToken, position, sourceFile);
- cancellationToken.throwIfCancellationRequested();
- if (!argumentInfo) {
+ var GoToDefinition;
+ (function (GoToDefinition) {
+ function getDefinitionAtPosition(program, sourceFile, position) {
+ var comment = findReferenceInPosition(sourceFile.referencedFiles, position);
+ if (comment) {
+ var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment);
+ if (referenceFile) {
+ return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)];
+ }
return undefined;
}
- var call = argumentInfo.invocation;
- var candidates = [];
- var resolvedSignature = typeChecker.getResolvedSignature(call, candidates);
- cancellationToken.throwIfCancellationRequested();
- if (!candidates.length) {
- if (ts.isSourceFileJavaScript(sourceFile)) {
- return createJavaScriptSignatureHelpItems(argumentInfo, program);
+ var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position);
+ if (typeReferenceDirective) {
+ var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName];
+ if (referenceFile && referenceFile.resolvedFileName) {
+ return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)];
}
return undefined;
}
- return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo, typeChecker);
- }
- SignatureHelp.getSignatureHelpItems = getSignatureHelpItems;
- function createJavaScriptSignatureHelpItems(argumentInfo, program) {
- if (argumentInfo.invocation.kind !== 174) {
+ var node = ts.getTouchingPropertyName(sourceFile, position);
+ if (node === sourceFile) {
return undefined;
}
- var callExpression = argumentInfo.invocation;
- var expression = callExpression.expression;
- var name = expression.kind === 69
- ? expression
- : expression.kind === 172
- ? expression.name
- : undefined;
- if (!name || !name.text) {
- return undefined;
+ if (ts.isJumpStatementTarget(node)) {
+ var labelName = node.text;
+ var label = ts.getTargetLabel(node.parent, node.text);
+ return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, undefined)] : undefined;
}
var typeChecker = program.getTypeChecker();
- for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
- var sourceFile = _a[_i];
- var nameToDeclarations = sourceFile.getNamedDeclarations();
- var declarations = nameToDeclarations[name.text];
- if (declarations) {
- for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) {
- var declaration = declarations_10[_b];
- var symbol = declaration.symbol;
- if (symbol) {
- var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);
- if (type) {
- var callSignatures = type.getCallSignatures();
- if (callSignatures && callSignatures.length) {
- return createSignatureHelpItems(callSignatures, callSignatures[0], argumentInfo, typeChecker);
- }
- }
- }
- }
- }
+ var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
+ if (calledDeclaration) {
+ return [createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration)];
}
- }
- function getImmediatelyContainingArgumentInfo(node, position, sourceFile) {
- if (node.parent.kind === 174 || node.parent.kind === 175) {
- var callExpression = node.parent;
- if (node.kind === 25 ||
- node.kind === 17) {
- var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile);
- var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos;
- ts.Debug.assert(list !== undefined);
- return {
- kind: isTypeArgList ? 0 : 1,
- invocation: callExpression,
- argumentsSpan: getApplicableSpanForArguments(list, sourceFile),
- argumentIndex: 0,
- argumentCount: getArgumentCount(list)
- };
+ var symbol = typeChecker.getSymbolAtLocation(node);
+ if (!symbol) {
+ return undefined;
+ }
+ if (symbol.flags & 8388608) {
+ var declaration = symbol.declarations[0];
+ if (node.kind === 70 &&
+ (node.parent === declaration ||
+ (declaration.kind === 235 && declaration.parent && declaration.parent.kind === 234))) {
+ symbol = typeChecker.getAliasedSymbol(symbol);
}
- var listItemInfo = ts.findListItemInfo(node);
- if (listItemInfo) {
- var list = listItemInfo.list;
- var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos;
- var argumentIndex = getArgumentIndex(list, node);
- var argumentCount = getArgumentCount(list);
- ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex);
- return {
- kind: isTypeArgList ? 0 : 1,
- invocation: callExpression,
- argumentsSpan: getApplicableSpanForArguments(list, sourceFile),
- argumentIndex: argumentIndex,
- argumentCount: argumentCount
- };
+ }
+ if (node.parent.kind === 254) {
+ var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
+ if (!shorthandSymbol) {
+ return [];
}
+ var shorthandDeclarations = shorthandSymbol.getDeclarations();
+ var shorthandSymbolKind_1 = ts.SymbolDisplay.getSymbolKind(typeChecker, shorthandSymbol, node);
+ var shorthandSymbolName_1 = typeChecker.symbolToString(shorthandSymbol);
+ var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node);
+ return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); });
+ }
+ return getDefinitionFromSymbol(typeChecker, symbol, node);
+ }
+ GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
+ function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
+ var node = ts.getTouchingPropertyName(sourceFile, position);
+ if (node === sourceFile) {
return undefined;
}
- else if (node.kind === 11 && node.parent.kind === 176) {
- if (ts.isInsideTemplateLiteral(node, position)) {
- return getArgumentListInfoForTemplate(node.parent, 0, sourceFile);
- }
+ var symbol = typeChecker.getSymbolAtLocation(node);
+ if (!symbol) {
+ return undefined;
}
- else if (node.kind === 12 && node.parent.parent.kind === 176) {
- var templateExpression = node.parent;
- var tagExpression = templateExpression.parent;
- ts.Debug.assert(templateExpression.kind === 189);
- var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1;
- return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);
+ var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
+ if (!type) {
+ return undefined;
}
- else if (node.parent.kind === 197 && node.parent.parent.parent.kind === 176) {
- var templateSpan = node.parent;
- var templateExpression = templateSpan.parent;
- var tagExpression = templateExpression.parent;
- ts.Debug.assert(templateExpression.kind === 189);
- if (node.kind === 14 && !ts.isInsideTemplateLiteral(node, position)) {
- return undefined;
- }
- var spanIndex = templateExpression.templateSpans.indexOf(templateSpan);
- var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node, position);
- return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);
+ if (type.flags & 524288 && !(type.flags & 16)) {
+ var result_5 = [];
+ ts.forEach(type.types, function (t) {
+ if (t.symbol) {
+ ts.addRange(result_5, getDefinitionFromSymbol(typeChecker, t.symbol, node));
+ }
+ });
+ return result_5;
}
- return undefined;
+ if (!type.symbol) {
+ return undefined;
+ }
+ return getDefinitionFromSymbol(typeChecker, type.symbol, node);
}
- function getArgumentIndex(argumentsList, node) {
- var argumentIndex = 0;
- var listChildren = argumentsList.getChildren();
- for (var _i = 0, listChildren_1 = listChildren; _i < listChildren_1.length; _i++) {
- var child = listChildren_1[_i];
- if (child === node) {
- break;
- }
- if (child.kind !== 24) {
- argumentIndex++;
+ GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
+ function getDefinitionFromSymbol(typeChecker, symbol, node) {
+ var result = [];
+ var declarations = symbol.getDeclarations();
+ var _a = getSymbolInfo(typeChecker, symbol, node), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName;
+ if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&
+ !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
+ ts.forEach(declarations, function (declaration) {
+ result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
+ });
+ }
+ return result;
+ function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) {
+ if (ts.isNewExpressionTarget(location) || location.kind === 122) {
+ if (symbol.flags & 32) {
+ for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) {
+ var declaration = _a[_i];
+ if (ts.isClassLike(declaration)) {
+ return tryAddSignature(declaration.members, true, symbolKind, symbolName, containerName, result);
+ }
+ }
+ ts.Debug.fail("Expected declaration to have at least one class-like declaration");
+ }
}
+ return false;
}
- return argumentIndex;
- }
- function getArgumentCount(argumentsList) {
- var listChildren = argumentsList.getChildren();
- var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 24; });
- if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 24) {
- argumentCount++;
+ function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) {
+ if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location) || ts.isNameOfFunctionDeclaration(location)) {
+ return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result);
+ }
+ return false;
}
- return argumentCount;
- }
- function getArgumentIndexForTemplatePiece(spanIndex, node, position) {
- ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node.");
- if (ts.isTemplateLiteralKind(node.kind)) {
- if (ts.isInsideTemplateLiteral(node, position)) {
- return 0;
+ function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) {
+ var declarations = [];
+ var definition;
+ ts.forEach(signatureDeclarations, function (d) {
+ if ((selectConstructors && d.kind === 149) ||
+ (!selectConstructors && (d.kind === 221 || d.kind === 148 || d.kind === 147))) {
+ declarations.push(d);
+ if (d.body)
+ definition = d;
+ }
+ });
+ if (definition) {
+ result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName));
+ return true;
}
- return spanIndex + 2;
+ else if (declarations.length) {
+ result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName));
+ return true;
+ }
+ return false;
}
- return spanIndex + 1;
}
- function getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile) {
- var argumentCount = tagExpression.template.kind === 11
- ? 1
- : tagExpression.template.templateSpans.length + 1;
- ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex);
+ function createDefinitionInfo(node, symbolKind, symbolName, containerName) {
return {
- kind: 2,
- invocation: tagExpression,
- argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression, sourceFile),
- argumentIndex: argumentIndex,
- argumentCount: argumentCount
+ fileName: node.getSourceFile().fileName,
+ textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()),
+ kind: symbolKind,
+ name: symbolName,
+ containerKind: undefined,
+ containerName: containerName
};
}
- function getApplicableSpanForArguments(argumentsList, sourceFile) {
- var applicableSpanStart = argumentsList.getFullStart();
- var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), false);
- return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
+ function getSymbolInfo(typeChecker, symbol, node) {
+ return {
+ symbolName: typeChecker.symbolToString(symbol),
+ symbolKind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node),
+ containerName: symbol.parent ? typeChecker.symbolToString(symbol.parent, node) : ""
+ };
}
- function getApplicableSpanForTaggedTemplate(taggedTemplate, sourceFile) {
- var template = taggedTemplate.template;
- var applicableSpanStart = template.getStart();
- var applicableSpanEnd = template.getEnd();
- if (template.kind === 189) {
- var lastSpan = ts.lastOrUndefined(template.templateSpans);
- if (lastSpan.literal.getFullWidth() === 0) {
- applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false);
- }
- }
- return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
+ function createDefinitionFromSignatureDeclaration(typeChecker, decl) {
+ var _a = getSymbolInfo(typeChecker, decl.symbol, decl), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName;
+ return createDefinitionInfo(decl, symbolKind, symbolName, containerName);
}
- function getContainingArgumentInfo(node, position, sourceFile) {
- for (var n = node; n.kind !== 256; n = n.parent) {
- if (ts.isFunctionBlock(n)) {
- return undefined;
- }
- if (n.pos < n.parent.pos || n.end > n.parent.end) {
- ts.Debug.fail("Node of kind " + n.kind + " is not a subspan of its parent of kind " + n.parent.kind);
- }
- var argumentInfo = getImmediatelyContainingArgumentInfo(n, position, sourceFile);
- if (argumentInfo) {
- return argumentInfo;
+ function findReferenceInPosition(refs, pos) {
+ for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) {
+ var ref = refs_1[_i];
+ if (ref.pos <= pos && pos < ref.end) {
+ return ref;
}
}
return undefined;
}
- SignatureHelp.getContainingArgumentInfo = getContainingArgumentInfo;
- function getChildListThatStartsWithOpenerToken(parent, openerToken, sourceFile) {
- var children = parent.getChildren(sourceFile);
- var indexOfOpenerToken = children.indexOf(openerToken);
- ts.Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1);
- return children[indexOfOpenerToken + 1];
+ function getDefinitionInfoForFileReference(name, targetFileName) {
+ return {
+ fileName: targetFileName,
+ textSpan: ts.createTextSpanFromBounds(0, 0),
+ kind: ts.ScriptElementKind.scriptElement,
+ name: name,
+ containerName: undefined,
+ containerKind: undefined
+ };
}
- function selectBestInvalidOverloadIndex(candidates, argumentCount) {
- var maxParamsSignatureIndex = -1;
- var maxParams = -1;
- for (var i = 0; i < candidates.length; i++) {
- var candidate = candidates[i];
- if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) {
- return i;
- }
- if (candidate.parameters.length > maxParams) {
- maxParams = candidate.parameters.length;
- maxParamsSignatureIndex = i;
- }
+ function getAncestorCallLikeExpression(node) {
+ var target = climbPastManyPropertyAccesses(node);
+ var callLike = target.parent;
+ return callLike && ts.isCallLikeExpression(callLike) && ts.getInvokedExpression(callLike) === target && callLike;
+ }
+ function climbPastManyPropertyAccesses(node) {
+ return ts.isRightSideOfPropertyAccess(node) ? climbPastManyPropertyAccesses(node.parent) : node;
+ }
+ function tryGetSignatureDeclaration(typeChecker, node) {
+ var callLike = getAncestorCallLikeExpression(node);
+ return callLike && typeChecker.getResolvedSignature(callLike).declaration;
+ }
+ })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var GoToImplementation;
+ (function (GoToImplementation) {
+ function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) {
+ if (node.parent.kind === 254) {
+ var result = [];
+ ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result);
+ return result.length > 0 ? result : undefined;
+ }
+ else if (node.kind === 96 || ts.isSuperProperty(node.parent)) {
+ var symbol = typeChecker.getSymbolAtLocation(node);
+ return symbol.valueDeclaration && [ts.FindAllReferences.getReferenceEntryFromNode(symbol.valueDeclaration)];
+ }
+ else {
+ var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, false, false, true);
+ var result = ts.flatMap(referencedSymbols, function (symbol) {
+ return ts.map(symbol.references, function (_a) {
+ var textSpan = _a.textSpan, fileName = _a.fileName;
+ return ({ textSpan: textSpan, fileName: fileName });
+ });
+ });
+ return result && result.length > 0 ? result : undefined;
}
- return maxParamsSignatureIndex;
}
- function createSignatureHelpItems(candidates, bestSignature, argumentListInfo, typeChecker) {
- var applicableSpan = argumentListInfo.argumentsSpan;
- var isTypeParameterList = argumentListInfo.kind === 0;
- var invocation = argumentListInfo.invocation;
- var callTarget = ts.getInvokedExpression(invocation);
- var callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget);
- var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeChecker, callTargetSymbol, undefined, undefined);
- var items = ts.map(candidates, function (candidateSignature) {
- var signatureHelpParameters;
- var prefixDisplayParts = [];
- var suffixDisplayParts = [];
- if (callTargetDisplayParts) {
- ts.addRange(prefixDisplayParts, callTargetDisplayParts);
- }
- if (isTypeParameterList) {
- prefixDisplayParts.push(ts.punctuationPart(25));
- var typeParameters = candidateSignature.typeParameters;
- signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray;
- suffixDisplayParts.push(ts.punctuationPart(27));
- var parameterParts = ts.mapToDisplayParts(function (writer) {
- return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisParameter, candidateSignature.parameters, writer, invocation);
- });
- ts.addRange(suffixDisplayParts, parameterParts);
+ GoToImplementation.getImplementationAtPosition = getImplementationAtPosition;
+ })(GoToImplementation = ts.GoToImplementation || (ts.GoToImplementation = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var JsDoc;
+ (function (JsDoc) {
+ var jsDocTagNames = [
+ "augments",
+ "author",
+ "argument",
+ "borrows",
+ "class",
+ "constant",
+ "constructor",
+ "constructs",
+ "default",
+ "deprecated",
+ "description",
+ "event",
+ "example",
+ "extends",
+ "field",
+ "fileOverview",
+ "function",
+ "ignore",
+ "inner",
+ "lends",
+ "link",
+ "memberOf",
+ "name",
+ "namespace",
+ "param",
+ "private",
+ "property",
+ "public",
+ "requires",
+ "returns",
+ "see",
+ "since",
+ "static",
+ "throws",
+ "type",
+ "typedef",
+ "property",
+ "prop",
+ "version"
+ ];
+ var jsDocCompletionEntries;
+ function getJsDocCommentsFromDeclarations(declarations) {
+ var documentationComment = [];
+ forEachUnique(declarations, function (declaration) {
+ var comments = ts.getJSDocComments(declaration, true);
+ if (!comments) {
+ return;
}
- else {
- var typeParameterParts = ts.mapToDisplayParts(function (writer) {
- return typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation);
- });
- ts.addRange(prefixDisplayParts, typeParameterParts);
- prefixDisplayParts.push(ts.punctuationPart(17));
- var parameters = candidateSignature.parameters;
- signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray;
- suffixDisplayParts.push(ts.punctuationPart(18));
+ for (var _i = 0, comments_3 = comments; _i < comments_3.length; _i++) {
+ var comment = comments_3[_i];
+ if (comment) {
+ if (documentationComment.length) {
+ documentationComment.push(ts.lineBreakPart());
+ }
+ documentationComment.push(ts.textPart(comment));
+ }
}
- var returnTypeParts = ts.mapToDisplayParts(function (writer) {
- return typeChecker.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation);
- });
- ts.addRange(suffixDisplayParts, returnTypeParts);
- return {
- isVariadic: candidateSignature.hasRestParameter,
- prefixDisplayParts: prefixDisplayParts,
- suffixDisplayParts: suffixDisplayParts,
- separatorDisplayParts: [ts.punctuationPart(24), ts.spacePart()],
- parameters: signatureHelpParameters,
- documentation: candidateSignature.getDocumentationComment()
- };
});
- var argumentIndex = argumentListInfo.argumentIndex;
- var argumentCount = argumentListInfo.argumentCount;
- var selectedItemIndex = candidates.indexOf(bestSignature);
- if (selectedItemIndex < 0) {
- selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount);
+ return documentationComment;
+ }
+ JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
+ function forEachUnique(array, callback) {
+ if (array) {
+ for (var i = 0, len = array.length; i < len; i++) {
+ if (ts.indexOf(array, array[i]) === i) {
+ var result = callback(array[i], i);
+ if (result) {
+ return result;
+ }
+ }
+ }
}
- ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex);
- return {
- items: items,
- applicableSpan: applicableSpan,
- selectedItemIndex: selectedItemIndex,
- argumentIndex: argumentIndex,
- argumentCount: argumentCount
- };
- function createSignatureHelpParameterForParameter(parameter) {
- var displayParts = ts.mapToDisplayParts(function (writer) {
- return typeChecker.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation);
- });
+ return undefined;
+ }
+ function getAllJsDocCompletionEntries() {
+ return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, function (tagName) {
return {
- name: parameter.name,
- documentation: parameter.getDocumentationComment(),
- displayParts: displayParts,
- isOptional: typeChecker.isOptionalParameter(parameter.valueDeclaration)
+ name: tagName,
+ kind: ts.ScriptElementKind.keyword,
+ kindModifiers: "",
+ sortText: "0",
};
+ }));
+ }
+ JsDoc.getAllJsDocCompletionEntries = getAllJsDocCompletionEntries;
+ function getDocCommentTemplateAtPosition(newLine, sourceFile, position) {
+ if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) {
+ return undefined;
}
- function createSignatureHelpParameterForTypeParameter(typeParameter) {
- var displayParts = ts.mapToDisplayParts(function (writer) {
- return typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation);
- });
- return {
- name: typeParameter.symbol.name,
- documentation: emptyArray,
- displayParts: displayParts,
- isOptional: false
- };
+ var tokenAtPos = ts.getTokenAtPosition(sourceFile, position);
+ var tokenStart = tokenAtPos.getStart();
+ if (!tokenAtPos || tokenStart < position) {
+ return undefined;
+ }
+ var commentOwner;
+ findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) {
+ switch (commentOwner.kind) {
+ case 221:
+ case 148:
+ case 149:
+ case 222:
+ case 201:
+ break findOwner;
+ case 256:
+ return undefined;
+ case 226:
+ if (commentOwner.parent.kind === 226) {
+ return undefined;
+ }
+ break findOwner;
+ }
+ }
+ if (!commentOwner || commentOwner.getStart() < position) {
+ return undefined;
+ }
+ var parameters = getParametersForJsDocOwningNode(commentOwner);
+ var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position);
+ var lineStart = sourceFile.getLineStarts()[posLineAndChar.line];
+ var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);
+ var docParams = "";
+ for (var i = 0, numParams = parameters.length; i < numParams; i++) {
+ var currentName = parameters[i].name;
+ var paramName = currentName.kind === 70 ?
+ currentName.text :
+ "param" + i;
+ docParams += indentationStr + " * @param " + paramName + newLine;
}
+ var preamble = "/**" + newLine +
+ indentationStr + " * ";
+ var result = preamble + newLine +
+ docParams +
+ indentationStr + " */" +
+ (tokenStart === position ? newLine + indentationStr : "");
+ return { newText: result, caretOffset: preamble.length };
}
- })(SignatureHelp = ts.SignatureHelp || (ts.SignatureHelp = {}));
+ JsDoc.getDocCommentTemplateAtPosition = getDocCommentTemplateAtPosition;
+ function getParametersForJsDocOwningNode(commentOwner) {
+ if (ts.isFunctionLike(commentOwner)) {
+ return commentOwner.parameters;
+ }
+ if (commentOwner.kind === 201) {
+ var varStatement = commentOwner;
+ var varDeclarations = varStatement.declarationList.declarations;
+ if (varDeclarations.length === 1 && varDeclarations[0].initializer) {
+ return getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer);
+ }
+ }
+ return ts.emptyArray;
+ }
+ function getParametersFromRightHandSideOfAssignment(rightHandSide) {
+ while (rightHandSide.kind === 179) {
+ rightHandSide = rightHandSide.expression;
+ }
+ switch (rightHandSide.kind) {
+ case 180:
+ case 181:
+ return rightHandSide.parameters;
+ case 193:
+ for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) {
+ var member = _a[_i];
+ if (member.kind === 149) {
+ return member.parameters;
+ }
+ }
+ break;
+ }
+ return ts.emptyArray;
+ }
+ })(JsDoc = ts.JsDoc || (ts.JsDoc = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
- var SymbolDisplay;
- (function (SymbolDisplay) {
- function getSymbolKind(typeChecker, symbol, location) {
- var flags = symbol.getFlags();
- if (flags & 32)
- return ts.getDeclarationOfKind(symbol, 192) ?
- ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement;
- if (flags & 384)
- return ts.ScriptElementKind.enumElement;
- if (flags & 524288)
- return ts.ScriptElementKind.typeElement;
- if (flags & 64)
- return ts.ScriptElementKind.interfaceElement;
- if (flags & 262144)
- return ts.ScriptElementKind.typeParameterElement;
- var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location);
- if (result === ts.ScriptElementKind.unknown) {
- if (flags & 262144)
- return ts.ScriptElementKind.typeParameterElement;
- if (flags & 8)
- return ts.ScriptElementKind.variableElement;
- if (flags & 8388608)
- return ts.ScriptElementKind.alias;
- if (flags & 1536)
- return ts.ScriptElementKind.moduleElement;
+ var JsTyping;
+ (function (JsTyping) {
+ ;
+ ;
+ var safeList;
+ var EmptySafeList = ts.createMap();
+ function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions) {
+ var inferredTypings = ts.createMap();
+ if (!typingOptions || !typingOptions.enableAutoDiscovery) {
+ return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
}
- return result;
- }
- SymbolDisplay.getSymbolKind = getSymbolKind;
- function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location) {
- if (typeChecker.isUndefinedSymbol(symbol)) {
- return ts.ScriptElementKind.variableElement;
+ fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) {
+ var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f));
+ return kind === 1 || kind === 2;
+ });
+ if (!safeList) {
+ var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); });
+ safeList = result.config ? ts.createMap(result.config) : EmptySafeList;
}
- if (typeChecker.isArgumentsSymbol(symbol)) {
- return ts.ScriptElementKind.localVariableElement;
+ var filesToWatch = [];
+ var searchDirs = [];
+ var exclude = [];
+ mergeTypings(typingOptions.include);
+ exclude = typingOptions.exclude || [];
+ var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
+ if (projectRootPath !== undefined) {
+ possibleSearchDirs.push(projectRootPath);
}
- if (location.kind === 97 && ts.isExpression(location)) {
- return ts.ScriptElementKind.parameterElement;
+ searchDirs = ts.deduplicate(possibleSearchDirs);
+ for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) {
+ var searchDir = searchDirs_1[_i];
+ var packageJsonPath = ts.combinePaths(searchDir, "package.json");
+ getTypingNamesFromJson(packageJsonPath, filesToWatch);
+ var bowerJsonPath = ts.combinePaths(searchDir, "bower.json");
+ getTypingNamesFromJson(bowerJsonPath, filesToWatch);
+ var nodeModulesPath = ts.combinePaths(searchDir, "node_modules");
+ getTypingNamesFromNodeModuleFolder(nodeModulesPath);
}
- if (flags & 3) {
- if (ts.isFirstDeclarationOfSymbolParameter(symbol)) {
- return ts.ScriptElementKind.parameterElement;
+ getTypingNamesFromSourceFileNames(fileNames);
+ for (var name_48 in packageNameToTypingLocation) {
+ if (name_48 in inferredTypings && !inferredTypings[name_48]) {
+ inferredTypings[name_48] = packageNameToTypingLocation[name_48];
}
- else if (symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration)) {
- return ts.ScriptElementKind.constElement;
+ }
+ for (var _a = 0, exclude_1 = exclude; _a < exclude_1.length; _a++) {
+ var excludeTypingName = exclude_1[_a];
+ delete inferredTypings[excludeTypingName];
+ }
+ var newTypingNames = [];
+ var cachedTypingPaths = [];
+ for (var typing in inferredTypings) {
+ if (inferredTypings[typing] !== undefined) {
+ cachedTypingPaths.push(inferredTypings[typing]);
}
- else if (ts.forEach(symbol.declarations, ts.isLet)) {
- return ts.ScriptElementKind.letElement;
+ else {
+ newTypingNames.push(typing);
}
- return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localVariableElement : ts.ScriptElementKind.variableElement;
}
- if (flags & 16)
- return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localFunctionElement : ts.ScriptElementKind.functionElement;
- if (flags & 32768)
- return ts.ScriptElementKind.memberGetAccessorElement;
- if (flags & 65536)
- return ts.ScriptElementKind.memberSetAccessorElement;
- if (flags & 8192)
- return ts.ScriptElementKind.memberFunctionElement;
- if (flags & 16384)
- return ts.ScriptElementKind.constructorImplementationElement;
- if (flags & 4) {
- if (flags & 268435456) {
- var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) {
- var rootSymbolFlags = rootSymbol.getFlags();
- if (rootSymbolFlags & (98308 | 3)) {
- return ts.ScriptElementKind.memberVariableElement;
- }
- ts.Debug.assert(!!(rootSymbolFlags & 8192));
- });
- if (!unionPropertyKind) {
- var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
- if (typeOfUnionProperty.getCallSignatures().length) {
- return ts.ScriptElementKind.memberFunctionElement;
- }
- return ts.ScriptElementKind.memberVariableElement;
+ return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch };
+ function mergeTypings(typingNames) {
+ if (!typingNames) {
+ return;
+ }
+ for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) {
+ var typing = typingNames_1[_i];
+ if (!(typing in inferredTypings)) {
+ inferredTypings[typing] = undefined;
}
- return unionPropertyKind;
}
- return ts.ScriptElementKind.memberVariableElement;
}
- return ts.ScriptElementKind.unknown;
- }
- function getSymbolModifiers(symbol) {
- return symbol && symbol.declarations && symbol.declarations.length > 0
- ? ts.getNodeModifiers(symbol.declarations[0])
- : ts.ScriptElementKindModifier.none;
- }
- SymbolDisplay.getSymbolModifiers = getSymbolModifiers;
- function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning) {
- if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); }
- var displayParts = [];
- var documentation;
- var symbolFlags = symbol.flags;
- var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, symbolFlags, location);
- var hasAddedSymbolInfo;
- var isThisExpression = location.kind === 97 && ts.isExpression(location);
- var type;
- if (symbolKind !== ts.ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) {
- if (symbolKind === ts.ScriptElementKind.memberGetAccessorElement || symbolKind === ts.ScriptElementKind.memberSetAccessorElement) {
- symbolKind = ts.ScriptElementKind.memberVariableElement;
- }
- var signature = void 0;
- type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
- if (type) {
- if (location.parent && location.parent.kind === 172) {
- var right = location.parent.name;
- if (right === location || (right && right.getFullWidth() === 0)) {
- location = location.parent;
- }
- }
- var callExpression = void 0;
- if (location.kind === 174 || location.kind === 175) {
- callExpression = location;
+ function getTypingNamesFromJson(jsonPath, filesToWatch) {
+ var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); });
+ if (result.config) {
+ var jsonConfig = result.config;
+ filesToWatch.push(jsonPath);
+ if (jsonConfig.dependencies) {
+ mergeTypings(ts.getOwnKeys(jsonConfig.dependencies));
}
- else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) {
- callExpression = location.parent;
+ if (jsonConfig.devDependencies) {
+ mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies));
}
- if (callExpression) {
- var candidateSignatures = [];
- signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures);
- if (!signature && candidateSignatures.length) {
- signature = candidateSignatures[0];
- }
- var useConstructSignatures = callExpression.kind === 175 || callExpression.expression.kind === 95;
- var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
- if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) {
- signature = allSignatures.length ? allSignatures[0] : undefined;
- }
- if (signature) {
- if (useConstructSignatures && (symbolFlags & 32)) {
- symbolKind = ts.ScriptElementKind.constructorImplementationElement;
- addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
- }
- else if (symbolFlags & 8388608) {
- symbolKind = ts.ScriptElementKind.alias;
- pushTypePart(symbolKind);
- displayParts.push(ts.spacePart());
- if (useConstructSignatures) {
- displayParts.push(ts.keywordPart(92));
- displayParts.push(ts.spacePart());
- }
- addFullSymbolName(symbol);
- }
- else {
- addPrefixForAnyFunctionOrVar(symbol, symbolKind);
- }
- switch (symbolKind) {
- case ts.ScriptElementKind.memberVariableElement:
- case ts.ScriptElementKind.variableElement:
- case ts.ScriptElementKind.constElement:
- case ts.ScriptElementKind.letElement:
- case ts.ScriptElementKind.parameterElement:
- case ts.ScriptElementKind.localVariableElement:
- displayParts.push(ts.punctuationPart(54));
- displayParts.push(ts.spacePart());
- if (useConstructSignatures) {
- displayParts.push(ts.keywordPart(92));
- displayParts.push(ts.spacePart());
- }
- if (!(type.flags & 2097152) && type.symbol) {
- ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, undefined, 1));
- }
- addSignatureDisplayParts(signature, allSignatures, 8);
- break;
- default:
- addSignatureDisplayParts(signature, allSignatures);
- }
- hasAddedSymbolInfo = true;
- }
+ if (jsonConfig.optionalDependencies) {
+ mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies));
}
- else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) ||
- (location.kind === 121 && location.parent.kind === 148)) {
- var functionDeclaration = location.parent;
- var allSignatures = functionDeclaration.kind === 148 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
- if (!typeChecker.isImplementationOfOverload(functionDeclaration)) {
- signature = typeChecker.getSignatureFromDeclaration(functionDeclaration);
- }
- else {
- signature = allSignatures[0];
- }
- if (functionDeclaration.kind === 148) {
- symbolKind = ts.ScriptElementKind.constructorImplementationElement;
- addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
- }
- else {
- addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 151 &&
- !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind);
- }
- addSignatureDisplayParts(signature, allSignatures);
- hasAddedSymbolInfo = true;
+ if (jsonConfig.peerDependencies) {
+ mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies));
}
}
}
- if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) {
- if (ts.getDeclarationOfKind(symbol, 192)) {
- pushTypePart(ts.ScriptElementKind.localClassElement);
- }
- else {
- displayParts.push(ts.keywordPart(73));
+ function getTypingNamesFromSourceFileNames(fileNames) {
+ var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension);
+ var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); });
+ var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); });
+ if (safeList !== EmptySafeList) {
+ mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; }));
}
- displayParts.push(ts.spacePart());
- addFullSymbolName(symbol);
- writeTypeParametersOfSymbol(symbol, sourceFile);
- }
- if ((symbolFlags & 64) && (semanticMeaning & 2)) {
- addNewLineIfDisplayPartsExist();
- displayParts.push(ts.keywordPart(107));
- displayParts.push(ts.spacePart());
- addFullSymbolName(symbol);
- writeTypeParametersOfSymbol(symbol, sourceFile);
- }
- if (symbolFlags & 524288) {
- addNewLineIfDisplayPartsExist();
- displayParts.push(ts.keywordPart(134));
- displayParts.push(ts.spacePart());
- addFullSymbolName(symbol);
- writeTypeParametersOfSymbol(symbol, sourceFile);
- displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(56));
- displayParts.push(ts.spacePart());
- ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 512));
- }
- if (symbolFlags & 384) {
- addNewLineIfDisplayPartsExist();
- if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) {
- displayParts.push(ts.keywordPart(74));
- displayParts.push(ts.spacePart());
+ var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; });
+ if (hasJsxFile) {
+ mergeTypings(["react"]);
}
- displayParts.push(ts.keywordPart(81));
- displayParts.push(ts.spacePart());
- addFullSymbolName(symbol);
}
- if (symbolFlags & 1536) {
- addNewLineIfDisplayPartsExist();
- var declaration = ts.getDeclarationOfKind(symbol, 225);
- var isNamespace = declaration && declaration.name && declaration.name.kind === 69;
- displayParts.push(ts.keywordPart(isNamespace ? 126 : 125));
- displayParts.push(ts.spacePart());
- addFullSymbolName(symbol);
- }
- if ((symbolFlags & 262144) && (semanticMeaning & 2)) {
- addNewLineIfDisplayPartsExist();
- displayParts.push(ts.punctuationPart(17));
- displayParts.push(ts.textPart("type parameter"));
- displayParts.push(ts.punctuationPart(18));
- displayParts.push(ts.spacePart());
- addFullSymbolName(symbol);
- displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(90));
- displayParts.push(ts.spacePart());
- if (symbol.parent) {
- addFullSymbolName(symbol.parent, enclosingDeclaration);
- writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration);
+ function getTypingNamesFromNodeModuleFolder(nodeModulesPath) {
+ if (!host.directoryExists(nodeModulesPath)) {
+ return;
}
- else {
- var declaration = ts.getDeclarationOfKind(symbol, 141);
- ts.Debug.assert(declaration !== undefined);
- declaration = declaration.parent;
- if (declaration) {
- if (ts.isFunctionLikeKind(declaration.kind)) {
- var signature = typeChecker.getSignatureFromDeclaration(declaration);
- if (declaration.kind === 152) {
- displayParts.push(ts.keywordPart(92));
- displayParts.push(ts.spacePart());
- }
- else if (declaration.kind !== 151 && declaration.name) {
- addFullSymbolName(declaration.symbol);
- }
- ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32));
- }
- else {
- displayParts.push(ts.keywordPart(134));
- displayParts.push(ts.spacePart());
- addFullSymbolName(declaration.symbol);
- writeTypeParametersOfSymbol(declaration.symbol, sourceFile);
- }
+ var typingNames = [];
+ var fileNames = host.readDirectory(nodeModulesPath, [".json"], undefined, undefined, 2);
+ for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) {
+ var fileName = fileNames_2[_i];
+ var normalizedFileName = ts.normalizePath(fileName);
+ if (ts.getBaseFileName(normalizedFileName) !== "package.json") {
+ continue;
}
- }
- }
- if (symbolFlags & 8) {
- addPrefixForAnyFunctionOrVar(symbol, "enum member");
- var declaration = symbol.declarations[0];
- if (declaration.kind === 255) {
- var constantValue = typeChecker.getConstantValue(declaration);
- if (constantValue !== undefined) {
- displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(56));
- displayParts.push(ts.spacePart());
- displayParts.push(ts.displayPart(constantValue.toString(), ts.SymbolDisplayPartKind.numericLiteral));
+ var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); });
+ if (!result.config) {
+ continue;
+ }
+ var packageJson = result.config;
+ if (packageJson._requiredBy &&
+ ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) {
+ continue;
+ }
+ if (!packageJson.name) {
+ continue;
+ }
+ if (packageJson.typings) {
+ var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName));
+ inferredTypings[packageJson.name] = absolutePath;
+ }
+ else {
+ typingNames.push(packageJson.name);
}
}
+ mergeTypings(typingNames);
}
- if (symbolFlags & 8388608) {
- addNewLineIfDisplayPartsExist();
- if (symbol.declarations[0].kind === 228) {
- displayParts.push(ts.keywordPart(82));
- displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(126));
- }
- else {
- displayParts.push(ts.keywordPart(89));
+ }
+ JsTyping.discoverTypings = discoverTypings;
+ })(JsTyping = ts.JsTyping || (ts.JsTyping = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var NavigateTo;
+ (function (NavigateTo) {
+ function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) {
+ var patternMatcher = ts.createPatternMatcher(searchValue);
+ var rawItems = [];
+ ts.forEach(sourceFiles, function (sourceFile) {
+ cancellationToken.throwIfCancellationRequested();
+ if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) {
+ return;
}
- displayParts.push(ts.spacePart());
- addFullSymbolName(symbol);
- ts.forEach(symbol.declarations, function (declaration) {
- if (declaration.kind === 229) {
- var importEqualsDeclaration = declaration;
- if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) {
- displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(56));
- displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(129));
- displayParts.push(ts.punctuationPart(17));
- displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral));
- displayParts.push(ts.punctuationPart(18));
- }
- else {
- var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference);
- if (internalAliasSymbol) {
- displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(56));
- displayParts.push(ts.spacePart());
- addFullSymbolName(internalAliasSymbol, enclosingDeclaration);
- }
- }
- return true;
- }
- });
- }
- if (!hasAddedSymbolInfo) {
- if (symbolKind !== ts.ScriptElementKind.unknown) {
- if (type) {
- if (isThisExpression) {
- addNewLineIfDisplayPartsExist();
- displayParts.push(ts.keywordPart(97));
- }
- else {
- addPrefixForAnyFunctionOrVar(symbol, symbolKind);
+ var nameToDeclarations = sourceFile.getNamedDeclarations();
+ for (var name_49 in nameToDeclarations) {
+ var declarations = nameToDeclarations[name_49];
+ if (declarations) {
+ var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_49);
+ if (!matches) {
+ continue;
}
- if (symbolKind === ts.ScriptElementKind.memberVariableElement ||
- symbolFlags & 3 ||
- symbolKind === ts.ScriptElementKind.localVariableElement ||
- isThisExpression) {
- displayParts.push(ts.punctuationPart(54));
- displayParts.push(ts.spacePart());
- if (type.symbol && type.symbol.flags & 262144) {
- var typeParameterParts = ts.mapToDisplayParts(function (writer) {
- typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration);
- });
- ts.addRange(displayParts, typeParameterParts);
- }
- else {
- ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, type, enclosingDeclaration));
+ for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
+ var declaration = declarations_9[_i];
+ if (patternMatcher.patternContainsDots) {
+ var containers = getContainers(declaration);
+ if (!containers) {
+ return undefined;
+ }
+ matches = patternMatcher.getMatches(containers, name_49);
+ if (!matches) {
+ continue;
+ }
}
- }
- else if (symbolFlags & 16 ||
- symbolFlags & 8192 ||
- symbolFlags & 16384 ||
- symbolFlags & 131072 ||
- symbolFlags & 98304 ||
- symbolKind === ts.ScriptElementKind.memberFunctionElement) {
- var allSignatures = type.getNonNullableType().getCallSignatures();
- addSignatureDisplayParts(allSignatures[0], allSignatures);
+ var fileName = sourceFile.fileName;
+ var matchKind = bestMatchKind(matches);
+ rawItems.push({ name: name_49, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
}
}
}
+ });
+ rawItems = ts.filter(rawItems, function (item) {
+ var decl = item.declaration;
+ if (decl.kind === 232 || decl.kind === 235 || decl.kind === 230) {
+ var importer = checker.getSymbolAtLocation(decl.name);
+ var imported = checker.getAliasedSymbol(importer);
+ return importer.name !== imported.name;
+ }
else {
- symbolKind = getSymbolKind(typeChecker, symbol, location);
+ return true;
}
+ });
+ rawItems.sort(compareNavigateToItems);
+ if (maxResultCount !== undefined) {
+ rawItems = rawItems.slice(0, maxResultCount);
}
- if (!documentation) {
- documentation = symbol.getDocumentationComment();
- if (documentation.length === 0 && symbol.flags & 4) {
- if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 256; })) {
- for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
- var declaration = _a[_i];
- if (!declaration.parent || declaration.parent.kind !== 187) {
- continue;
- }
- var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right);
- if (!rhsSymbol) {
- continue;
- }
- documentation = rhsSymbol.getDocumentationComment();
- if (documentation.length > 0) {
- break;
- }
- }
+ var items = ts.map(rawItems, createNavigateToItem);
+ return items;
+ function allMatchesAreCaseSensitive(matches) {
+ ts.Debug.assert(matches.length > 0);
+ for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) {
+ var match = matches_2[_i];
+ if (!match.isCaseSensitive) {
+ return false;
}
}
+ return true;
}
- return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind };
- function addNewLineIfDisplayPartsExist() {
- if (displayParts.length) {
- displayParts.push(ts.lineBreakPart());
+ function getTextOfIdentifierOrLiteral(node) {
+ if (node) {
+ if (node.kind === 70 ||
+ node.kind === 9 ||
+ node.kind === 8) {
+ return node.text;
+ }
}
+ return undefined;
}
- function addFullSymbolName(symbol, enclosingDeclaration) {
- var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, undefined, 1 | 2);
- ts.addRange(displayParts, fullSymbolDisplayParts);
- }
- function addPrefixForAnyFunctionOrVar(symbol, symbolKind) {
- addNewLineIfDisplayPartsExist();
- if (symbolKind) {
- pushTypePart(symbolKind);
- displayParts.push(ts.spacePart());
- addFullSymbolName(symbol);
+ function tryAddSingleDeclarationName(declaration, containers) {
+ if (declaration && declaration.name) {
+ var text = getTextOfIdentifierOrLiteral(declaration.name);
+ if (text !== undefined) {
+ containers.unshift(text);
+ }
+ else if (declaration.name.kind === 141) {
+ return tryAddComputedPropertyName(declaration.name.expression, containers, true);
+ }
+ else {
+ return false;
+ }
}
+ return true;
}
- function pushTypePart(symbolKind) {
- switch (symbolKind) {
- case ts.ScriptElementKind.variableElement:
- case ts.ScriptElementKind.functionElement:
- case ts.ScriptElementKind.letElement:
- case ts.ScriptElementKind.constElement:
- case ts.ScriptElementKind.constructorImplementationElement:
- displayParts.push(ts.textOrKeywordPart(symbolKind));
- return;
- default:
- displayParts.push(ts.punctuationPart(17));
- displayParts.push(ts.textOrKeywordPart(symbolKind));
- displayParts.push(ts.punctuationPart(18));
- return;
+ function tryAddComputedPropertyName(expression, containers, includeLastPortion) {
+ var text = getTextOfIdentifierOrLiteral(expression);
+ if (text !== undefined) {
+ if (includeLastPortion) {
+ containers.unshift(text);
+ }
+ return true;
}
- }
- function addSignatureDisplayParts(signature, allSignatures, flags) {
- ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32));
- if (allSignatures.length > 1) {
- displayParts.push(ts.spacePart());
- displayParts.push(ts.punctuationPart(17));
- displayParts.push(ts.operatorPart(35));
- displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), ts.SymbolDisplayPartKind.numericLiteral));
- displayParts.push(ts.spacePart());
- displayParts.push(ts.textPart(allSignatures.length === 2 ? "overload" : "overloads"));
- displayParts.push(ts.punctuationPart(18));
+ if (expression.kind === 173) {
+ var propertyAccess = expression;
+ if (includeLastPortion) {
+ containers.unshift(propertyAccess.name.text);
+ }
+ return tryAddComputedPropertyName(propertyAccess.expression, containers, true);
}
- documentation = signature.getDocumentationComment();
- }
- function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) {
- var typeParameterParts = ts.mapToDisplayParts(function (writer) {
- typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration);
- });
- ts.addRange(displayParts, typeParameterParts);
- }
- }
- SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind;
- function isLocalVariableOrFunction(symbol) {
- if (symbol.parent) {
return false;
}
- return ts.forEach(symbol.declarations, function (declaration) {
- if (declaration.kind === 179) {
- return true;
+ function getContainers(declaration) {
+ var containers = [];
+ if (declaration.name.kind === 141) {
+ if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) {
+ return undefined;
+ }
}
- if (declaration.kind !== 218 && declaration.kind !== 220) {
- return false;
+ declaration = ts.getContainerNode(declaration);
+ while (declaration) {
+ if (!tryAddSingleDeclarationName(declaration, containers)) {
+ return undefined;
+ }
+ declaration = ts.getContainerNode(declaration);
}
- for (var parent_23 = declaration.parent; !ts.isFunctionBlock(parent_23); parent_23 = parent_23.parent) {
- if (parent_23.kind === 256 || parent_23.kind === 226) {
- return false;
+ return containers;
+ }
+ function bestMatchKind(matches) {
+ ts.Debug.assert(matches.length > 0);
+ var bestMatchKind = ts.PatternMatchKind.camelCase;
+ for (var _i = 0, matches_3 = matches; _i < matches_3.length; _i++) {
+ var match = matches_3[_i];
+ var kind = match.kind;
+ if (kind < bestMatchKind) {
+ bestMatchKind = kind;
}
}
- return true;
- });
+ return bestMatchKind;
+ }
+ function compareNavigateToItems(i1, i2) {
+ return i1.matchKind - i2.matchKind ||
+ ts.compareStringsCaseInsensitive(i1.name, i2.name) ||
+ ts.compareStrings(i1.name, i2.name);
+ }
+ function createNavigateToItem(rawItem) {
+ var declaration = rawItem.declaration;
+ var container = ts.getContainerNode(declaration);
+ return {
+ name: rawItem.name,
+ kind: ts.getNodeKind(declaration),
+ kindModifiers: ts.getNodeModifiers(declaration),
+ matchKind: ts.PatternMatchKind[rawItem.matchKind],
+ isCaseSensitive: rawItem.isCaseSensitive,
+ fileName: rawItem.fileName,
+ textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()),
+ containerName: container && container.name ? container.name.text : "",
+ containerKind: container && container.name ? ts.getNodeKind(container) : ""
+ };
+ }
}
- })(SymbolDisplay = ts.SymbolDisplay || (ts.SymbolDisplay = {}));
+ NavigateTo.getNavigateToItems = getNavigateToItems;
+ })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
- function transpileModule(input, transpileOptions) {
- var diagnostics = [];
- var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : ts.getDefaultCompilerOptions();
- options.isolatedModules = true;
- options.suppressOutputPathCheck = true;
- options.allowNonTsExtensions = true;
- options.noLib = true;
- options.lib = undefined;
- options.types = undefined;
- options.noEmit = undefined;
- options.noEmitOnError = undefined;
- options.paths = undefined;
- options.rootDirs = undefined;
- options.declaration = undefined;
- options.declarationDir = undefined;
- options.out = undefined;
- options.outFile = undefined;
- options.noResolve = true;
- var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts");
- var sourceFile = ts.createSourceFile(inputFileName, input, options.target);
- if (transpileOptions.moduleName) {
- sourceFile.moduleName = transpileOptions.moduleName;
+ var NavigationBar;
+ (function (NavigationBar) {
+ function getNavigationBarItems(sourceFile) {
+ curSourceFile = sourceFile;
+ var result = ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem);
+ curSourceFile = undefined;
+ return result;
}
- if (transpileOptions.renamedDependencies) {
- sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies);
+ NavigationBar.getNavigationBarItems = getNavigationBarItems;
+ function getNavigationTree(sourceFile) {
+ curSourceFile = sourceFile;
+ var result = convertToTree(rootNavigationBarNode(sourceFile));
+ curSourceFile = undefined;
+ return result;
}
- var newLine = ts.getNewLineCharacter(options);
- var outputText;
- var sourceMapText;
- var compilerHost = {
- getSourceFile: function (fileName, target) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : undefined; },
- writeFile: function (name, text, writeByteOrderMark) {
- if (ts.fileExtensionIs(name, ".map")) {
- ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'");
- sourceMapText = text;
- }
- else {
- ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: '" + name + "'");
- outputText = text;
- }
- },
- getDefaultLibFileName: function () { return "lib.d.ts"; },
- useCaseSensitiveFileNames: function () { return false; },
- getCanonicalFileName: function (fileName) { return fileName; },
- getCurrentDirectory: function () { return ""; },
- getNewLine: function () { return newLine; },
- fileExists: function (fileName) { return fileName === inputFileName; },
- readFile: function (fileName) { return ""; },
- directoryExists: function (directoryExists) { return true; },
- getDirectories: function (path) { return []; }
- };
- var program = ts.createProgram([inputFileName], options, compilerHost);
- if (transpileOptions.reportDiagnostics) {
- ts.addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile));
- ts.addRange(diagnostics, program.getOptionsDiagnostics());
+ NavigationBar.getNavigationTree = getNavigationTree;
+ var curSourceFile;
+ function nodeText(node) {
+ return node.getText(curSourceFile);
}
- program.emit();
- ts.Debug.assert(outputText !== undefined, "Output generation failed");
- return { outputText: outputText, diagnostics: diagnostics, sourceMapText: sourceMapText };
- }
- ts.transpileModule = transpileModule;
- function transpile(input, compilerOptions, fileName, diagnostics, moduleName) {
- var output = transpileModule(input, { compilerOptions: compilerOptions, fileName: fileName, reportDiagnostics: !!diagnostics, moduleName: moduleName });
- ts.addRange(diagnostics, output.diagnostics);
- return output.outputText;
- }
- ts.transpile = transpile;
- var commandLineOptionsStringToEnum;
- function fixupCompilerOptions(options, diagnostics) {
- commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) {
- return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; });
- });
- options = ts.clone(options);
- var _loop_2 = function (opt) {
- if (!ts.hasProperty(options, opt.name)) {
- return "continue";
- }
- var value = options[opt.name];
- if (typeof value === "string") {
- options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics);
+ function navigationBarNodeKind(n) {
+ return n.node.kind;
+ }
+ function pushChild(parent, child) {
+ if (parent.children) {
+ parent.children.push(child);
}
else {
- if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) {
- diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt));
- }
+ parent.children = [child];
}
- };
- for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
- var opt = commandLineOptionsStringToEnum_1[_i];
- _loop_2(opt);
}
- return options;
- }
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var formatting;
- (function (formatting) {
- var standardScanner = ts.createScanner(2, false, 0);
- var jsxScanner = ts.createScanner(2, false, 1);
- var scanner;
- function getFormattingScanner(sourceFile, startPos, endPos) {
- ts.Debug.assert(scanner === undefined);
- scanner = sourceFile.languageVariant === 1 ? jsxScanner : standardScanner;
- scanner.setText(sourceFile.text);
- scanner.setTextPos(startPos);
- var wasNewLine = true;
- var leadingTrivia;
- var trailingTrivia;
- var savedPos;
- var lastScanAction;
- var lastTokenInfo;
+ var parentsStack = [];
+ var parent;
+ function rootNavigationBarNode(sourceFile) {
+ ts.Debug.assert(!parentsStack.length);
+ var root = { node: sourceFile, additionalNodes: undefined, parent: undefined, children: undefined, indent: 0 };
+ parent = root;
+ for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
+ var statement = _a[_i];
+ addChildrenRecursively(statement);
+ }
+ endNode();
+ ts.Debug.assert(!parent && !parentsStack.length);
+ return root;
+ }
+ function addLeafNode(node) {
+ pushChild(parent, emptyNavigationBarNode(node));
+ }
+ function emptyNavigationBarNode(node) {
return {
- advance: advance,
- readTokenInfo: readTokenInfo,
- isOnToken: isOnToken,
- getCurrentLeadingTrivia: function () { return leadingTrivia; },
- lastTrailingTriviaWasNewLine: function () { return wasNewLine; },
- skipToEndOf: skipToEndOf,
- close: function () {
- ts.Debug.assert(scanner !== undefined);
- lastTokenInfo = undefined;
- scanner.setText(undefined);
- scanner = undefined;
- }
+ node: node,
+ additionalNodes: undefined,
+ parent: parent,
+ children: undefined,
+ indent: parent.indent + 1
};
- function advance() {
- ts.Debug.assert(scanner !== undefined);
- lastTokenInfo = undefined;
- var isStarted = scanner.getStartPos() !== startPos;
- if (isStarted) {
- if (trailingTrivia) {
- ts.Debug.assert(trailingTrivia.length !== 0);
- wasNewLine = ts.lastOrUndefined(trailingTrivia).kind === 4;
- }
- else {
- wasNewLine = false;
+ }
+ function startNode(node) {
+ var navNode = emptyNavigationBarNode(node);
+ pushChild(parent, navNode);
+ parentsStack.push(parent);
+ parent = navNode;
+ }
+ function endNode() {
+ if (parent.children) {
+ mergeChildren(parent.children);
+ sortChildren(parent.children);
+ }
+ parent = parentsStack.pop();
+ }
+ function addNodeWithRecursiveChild(node, child) {
+ startNode(node);
+ addChildrenRecursively(child);
+ endNode();
+ }
+ function addChildrenRecursively(node) {
+ if (!node || ts.isToken(node)) {
+ return;
+ }
+ switch (node.kind) {
+ case 149:
+ var ctr = node;
+ addNodeWithRecursiveChild(ctr, ctr.body);
+ for (var _i = 0, _a = ctr.parameters; _i < _a.length; _i++) {
+ var param = _a[_i];
+ if (ts.isParameterPropertyDeclaration(param)) {
+ addLeafNode(param);
+ }
}
+ break;
+ case 148:
+ case 150:
+ case 151:
+ case 147:
+ if (!ts.hasDynamicName(node)) {
+ addNodeWithRecursiveChild(node, node.body);
+ }
+ break;
+ case 146:
+ case 145:
+ if (!ts.hasDynamicName(node)) {
+ addLeafNode(node);
+ }
+ break;
+ case 232:
+ var importClause = node;
+ if (importClause.name) {
+ addLeafNode(importClause);
+ }
+ var namedBindings = importClause.namedBindings;
+ if (namedBindings) {
+ if (namedBindings.kind === 233) {
+ addLeafNode(namedBindings);
+ }
+ else {
+ for (var _b = 0, _c = namedBindings.elements; _b < _c.length; _b++) {
+ var element = _c[_b];
+ addLeafNode(element);
+ }
+ }
+ }
+ break;
+ case 170:
+ case 219:
+ var decl = node;
+ var name_50 = decl.name;
+ if (ts.isBindingPattern(name_50)) {
+ addChildrenRecursively(name_50);
+ }
+ else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) {
+ addChildrenRecursively(decl.initializer);
+ }
+ else {
+ addNodeWithRecursiveChild(decl, decl.initializer);
+ }
+ break;
+ case 181:
+ case 221:
+ case 180:
+ addNodeWithRecursiveChild(node, node.body);
+ break;
+ case 225:
+ startNode(node);
+ for (var _d = 0, _e = node.members; _d < _e.length; _d++) {
+ var member = _e[_d];
+ if (!isComputedProperty(member)) {
+ addLeafNode(member);
+ }
+ }
+ endNode();
+ break;
+ case 222:
+ case 193:
+ case 223:
+ startNode(node);
+ for (var _f = 0, _g = node.members; _f < _g.length; _f++) {
+ var member = _g[_f];
+ addChildrenRecursively(member);
+ }
+ endNode();
+ break;
+ case 226:
+ addNodeWithRecursiveChild(node, getInteriorModule(node).body);
+ break;
+ case 239:
+ case 230:
+ case 154:
+ case 152:
+ case 153:
+ case 224:
+ addLeafNode(node);
+ break;
+ default:
+ ts.forEach(node.jsDocComments, function (jsDocComment) {
+ ts.forEach(jsDocComment.tags, function (tag) {
+ if (tag.kind === 279) {
+ addLeafNode(tag);
+ }
+ });
+ });
+ ts.forEachChild(node, addChildrenRecursively);
+ }
+ }
+ function mergeChildren(children) {
+ var nameToItems = ts.createMap();
+ ts.filterMutate(children, function (child) {
+ var decl = child.node;
+ var name = decl.name && nodeText(decl.name);
+ if (!name) {
+ return true;
}
- leadingTrivia = undefined;
- trailingTrivia = undefined;
- if (!isStarted) {
- scanner.scan();
- }
- var pos = scanner.getStartPos();
- while (pos < endPos) {
- var t = scanner.getToken();
- if (!ts.isTrivia(t)) {
- break;
+ var itemsWithSameName = nameToItems[name];
+ if (!itemsWithSameName) {
+ nameToItems[name] = child;
+ return true;
+ }
+ if (itemsWithSameName instanceof Array) {
+ for (var _i = 0, itemsWithSameName_1 = itemsWithSameName; _i < itemsWithSameName_1.length; _i++) {
+ var itemWithSameName = itemsWithSameName_1[_i];
+ if (tryMerge(itemWithSameName, child)) {
+ return false;
+ }
}
- scanner.scan();
- var item = {
- pos: pos,
- end: scanner.getStartPos(),
- kind: t
- };
- pos = scanner.getStartPos();
- if (!leadingTrivia) {
- leadingTrivia = [];
+ itemsWithSameName.push(child);
+ return true;
+ }
+ else {
+ var itemWithSameName = itemsWithSameName;
+ if (tryMerge(itemWithSameName, child)) {
+ return false;
}
- leadingTrivia.push(item);
+ nameToItems[name] = [itemWithSameName, child];
+ return true;
}
- savedPos = scanner.getStartPos();
- }
- function shouldRescanGreaterThanToken(node) {
- if (node) {
- switch (node.kind) {
- case 29:
- case 64:
- case 65:
- case 45:
- case 44:
- return true;
+ function tryMerge(a, b) {
+ if (shouldReallyMerge(a.node, b.node)) {
+ merge(a, b);
+ return true;
}
+ return false;
}
- return false;
- }
- function shouldRescanJsxIdentifier(node) {
- if (node.parent) {
- switch (node.parent.kind) {
- case 246:
- case 243:
- case 245:
- case 242:
- return node.kind === 69;
+ });
+ function shouldReallyMerge(a, b) {
+ return a.kind === b.kind && (a.kind !== 226 || areSameModule(a, b));
+ function areSameModule(a, b) {
+ if (a.body.kind !== b.body.kind) {
+ return false;
}
+ if (a.body.kind !== 226) {
+ return true;
+ }
+ return areSameModule(a.body, b.body);
}
- return false;
}
- function shouldRescanJsxText(node) {
- return node && node.kind === 244;
- }
- function shouldRescanSlashToken(container) {
- return container.kind === 10;
+ function merge(target, source) {
+ target.additionalNodes = target.additionalNodes || [];
+ target.additionalNodes.push(source.node);
+ if (source.additionalNodes) {
+ (_a = target.additionalNodes).push.apply(_a, source.additionalNodes);
+ }
+ target.children = ts.concatenate(target.children, source.children);
+ if (target.children) {
+ mergeChildren(target.children);
+ sortChildren(target.children);
+ }
+ var _a;
}
- function shouldRescanTemplateToken(container) {
- return container.kind === 13 ||
- container.kind === 14;
+ }
+ function sortChildren(children) {
+ children.sort(compareChildren);
+ }
+ function compareChildren(child1, child2) {
+ var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node);
+ if (name1 && name2) {
+ var cmp = localeCompareFix(name1, name2);
+ return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);
}
- function startsWithSlashToken(t) {
- return t === 39 || t === 61;
+ else {
+ return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);
}
- function readTokenInfo(n) {
- ts.Debug.assert(scanner !== undefined);
- if (!isOnToken()) {
- return {
- leadingTrivia: leadingTrivia,
- trailingTrivia: undefined,
- token: undefined
- };
- }
- var expectedScanAction = shouldRescanGreaterThanToken(n)
- ? 1
- : shouldRescanSlashToken(n)
- ? 2
- : shouldRescanTemplateToken(n)
- ? 3
- : shouldRescanJsxIdentifier(n)
- ? 4
- : shouldRescanJsxText(n)
- ? 5
- : 0;
- if (lastTokenInfo && expectedScanAction === lastScanAction) {
- return fixTokenKind(lastTokenInfo, n);
- }
- if (scanner.getStartPos() !== savedPos) {
- ts.Debug.assert(lastTokenInfo !== undefined);
- scanner.setTextPos(savedPos);
- scanner.scan();
- }
- var currentToken = scanner.getToken();
- if (expectedScanAction === 1 && currentToken === 27) {
- currentToken = scanner.reScanGreaterToken();
- ts.Debug.assert(n.kind === currentToken);
- lastScanAction = 1;
+ }
+ var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0;
+ var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) {
+ for (var i = 0; i < Math.min(a.length, b.length); i++) {
+ var chA = a.charAt(i), chB = b.charAt(i);
+ if (chA === "\"" && chB === "'") {
+ return 1;
}
- else if (expectedScanAction === 2 && startsWithSlashToken(currentToken)) {
- currentToken = scanner.reScanSlashToken();
- ts.Debug.assert(n.kind === currentToken);
- lastScanAction = 2;
+ if (chA === "'" && chB === "\"") {
+ return -1;
}
- else if (expectedScanAction === 3 && currentToken === 16) {
- currentToken = scanner.reScanTemplateToken();
- lastScanAction = 3;
+ var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase());
+ if (cmp !== 0) {
+ return cmp;
}
- else if (expectedScanAction === 4 && currentToken === 69) {
- currentToken = scanner.scanJsxIdentifier();
- lastScanAction = 4;
+ }
+ return a.length - b.length;
+ };
+ function tryGetName(node) {
+ if (node.kind === 226) {
+ return getModuleName(node);
+ }
+ var decl = node;
+ if (decl.name) {
+ return ts.getPropertyNameForPropertyNameNode(decl.name);
+ }
+ switch (node.kind) {
+ case 180:
+ case 181:
+ case 193:
+ return getFunctionOrClassName(node);
+ case 279:
+ return getJSDocTypedefTagName(node);
+ default:
+ return undefined;
+ }
+ }
+ function getItemName(node) {
+ if (node.kind === 226) {
+ return getModuleName(node);
+ }
+ var name = node.name;
+ if (name) {
+ var text = nodeText(name);
+ if (text.length > 0) {
+ return text;
}
- else if (expectedScanAction === 5) {
- currentToken = scanner.reScanJsxToken();
- lastScanAction = 5;
+ }
+ switch (node.kind) {
+ case 256:
+ var sourceFile = node;
+ return ts.isExternalModule(sourceFile)
+ ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\""
+ : "";
+ case 181:
+ case 221:
+ case 180:
+ case 222:
+ case 193:
+ if (ts.getModifierFlags(node) & 512) {
+ return "default";
+ }
+ return getFunctionOrClassName(node);
+ case 149:
+ return "constructor";
+ case 153:
+ return "new()";
+ case 152:
+ return "()";
+ case 154:
+ return "[]";
+ case 279:
+ return getJSDocTypedefTagName(node);
+ default:
+ return "";
+ }
+ }
+ function getJSDocTypedefTagName(node) {
+ if (node.name) {
+ return node.name.text;
+ }
+ else {
+ var parentNode = node.parent && node.parent.parent;
+ if (parentNode && parentNode.kind === 201) {
+ if (parentNode.declarationList.declarations.length > 0) {
+ var nameIdentifier = parentNode.declarationList.declarations[0].name;
+ if (nameIdentifier.kind === 70) {
+ return nameIdentifier.text;
+ }
+ }
}
- else {
- lastScanAction = 0;
+ return "";
+ }
+ }
+ function topLevelItems(root) {
+ var topLevel = [];
+ function recur(item) {
+ if (isTopLevel(item)) {
+ topLevel.push(item);
+ if (item.children) {
+ for (var _i = 0, _a = item.children; _i < _a.length; _i++) {
+ var child = _a[_i];
+ recur(child);
+ }
+ }
}
- var token = {
- pos: scanner.getStartPos(),
- end: scanner.getTextPos(),
- kind: currentToken
- };
- if (trailingTrivia) {
- trailingTrivia = undefined;
+ }
+ recur(root);
+ return topLevel;
+ function isTopLevel(item) {
+ switch (navigationBarNodeKind(item)) {
+ case 222:
+ case 193:
+ case 225:
+ case 223:
+ case 226:
+ case 256:
+ case 224:
+ case 279:
+ return true;
+ case 149:
+ case 148:
+ case 150:
+ case 151:
+ case 219:
+ return hasSomeImportantChild(item);
+ case 181:
+ case 221:
+ case 180:
+ return isTopLevelFunctionDeclaration(item);
+ default:
+ return false;
}
- while (scanner.getStartPos() < endPos) {
- currentToken = scanner.scan();
- if (!ts.isTrivia(currentToken)) {
- break;
- }
- var trivia = {
- pos: scanner.getStartPos(),
- end: scanner.getTextPos(),
- kind: currentToken
- };
- if (!trailingTrivia) {
- trailingTrivia = [];
+ function isTopLevelFunctionDeclaration(item) {
+ if (!item.node.body) {
+ return false;
}
- trailingTrivia.push(trivia);
- if (currentToken === 4) {
- scanner.scan();
- break;
+ switch (navigationBarNodeKind(item.parent)) {
+ case 227:
+ case 256:
+ case 148:
+ case 149:
+ return true;
+ default:
+ return hasSomeImportantChild(item);
}
}
- lastTokenInfo = {
- leadingTrivia: leadingTrivia,
- trailingTrivia: trailingTrivia,
- token: token
- };
- return fixTokenKind(lastTokenInfo, n);
+ function hasSomeImportantChild(item) {
+ return ts.forEach(item.children, function (child) {
+ var childKind = navigationBarNodeKind(child);
+ return childKind !== 219 && childKind !== 170;
+ });
+ }
}
- function isOnToken() {
- ts.Debug.assert(scanner !== undefined);
- var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken();
- var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos();
- return startPos < endPos && current !== 1 && !ts.isTrivia(current);
+ }
+ var emptyChildItemArray = [];
+ function convertToTree(n) {
+ return {
+ text: getItemName(n.node),
+ kind: ts.getNodeKind(n.node),
+ kindModifiers: ts.getNodeModifiers(n.node),
+ spans: getSpans(n),
+ childItems: ts.map(n.children, convertToTree)
+ };
+ }
+ function convertToTopLevelItem(n) {
+ return {
+ text: getItemName(n.node),
+ kind: ts.getNodeKind(n.node),
+ kindModifiers: ts.getNodeModifiers(n.node),
+ spans: getSpans(n),
+ childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray,
+ indent: n.indent,
+ bolded: false,
+ grayed: false
+ };
+ function convertToChildItem(n) {
+ return {
+ text: getItemName(n.node),
+ kind: ts.getNodeKind(n.node),
+ kindModifiers: ts.getNodeModifiers(n.node),
+ spans: getSpans(n),
+ childItems: emptyChildItemArray,
+ indent: 0,
+ bolded: false,
+ grayed: false
+ };
}
- function fixTokenKind(tokenInfo, container) {
- if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) {
- tokenInfo.token.kind = container.kind;
+ }
+ function getSpans(n) {
+ var spans = [getNodeSpan(n.node)];
+ if (n.additionalNodes) {
+ for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {
+ var node = _a[_i];
+ spans.push(getNodeSpan(node));
}
- return tokenInfo;
}
- function skipToEndOf(node) {
- scanner.setTextPos(node.end);
- savedPos = scanner.getStartPos();
- lastScanAction = undefined;
- lastTokenInfo = undefined;
- wasNewLine = false;
- leadingTrivia = undefined;
- trailingTrivia = undefined;
+ return spans;
+ }
+ function getModuleName(moduleDeclaration) {
+ if (ts.isAmbientModule(moduleDeclaration)) {
+ return ts.getTextOfNode(moduleDeclaration.name);
+ }
+ var result = [];
+ result.push(moduleDeclaration.name.text);
+ while (moduleDeclaration.body && moduleDeclaration.body.kind === 226) {
+ moduleDeclaration = moduleDeclaration.body;
+ result.push(moduleDeclaration.name.text);
}
+ return result.join(".");
}
- formatting.getFormattingScanner = getFormattingScanner;
- })(formatting = ts.formatting || (ts.formatting = {}));
+ function getInteriorModule(decl) {
+ return decl.body.kind === 226 ? getInteriorModule(decl.body) : decl;
+ }
+ function isComputedProperty(member) {
+ return !member.name || member.name.kind === 141;
+ }
+ function getNodeSpan(node) {
+ return node.kind === 256
+ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd())
+ : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd());
+ }
+ function getFunctionOrClassName(node) {
+ if (node.name && ts.getFullWidth(node.name) > 0) {
+ return ts.declarationNameToString(node.name);
+ }
+ else if (node.parent.kind === 219) {
+ return ts.declarationNameToString(node.parent.name);
+ }
+ else if (node.parent.kind === 188 &&
+ node.parent.operatorToken.kind === 57) {
+ return nodeText(node.parent.left);
+ }
+ else if (node.parent.kind === 253 && node.parent.name) {
+ return nodeText(node.parent.name);
+ }
+ else if (ts.getModifierFlags(node) & 512) {
+ return "default";
+ }
+ else {
+ return ts.isClassLike(node) ? "" : "";
+ }
+ }
+ function isFunctionOrClassExpression(node) {
+ return node.kind === 180 || node.kind === 181 || node.kind === 193;
+ }
+ })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
- var formatting;
- (function (formatting) {
- var FormattingContext = (function () {
- function FormattingContext(sourceFile, formattingRequestKind) {
- this.sourceFile = sourceFile;
- this.formattingRequestKind = formattingRequestKind;
- }
- FormattingContext.prototype.updateContext = function (currentRange, currentTokenParent, nextRange, nextTokenParent, commonParent) {
- ts.Debug.assert(currentRange !== undefined, "currentTokenSpan is null");
- ts.Debug.assert(currentTokenParent !== undefined, "currentTokenParent is null");
- ts.Debug.assert(nextRange !== undefined, "nextTokenSpan is null");
- ts.Debug.assert(nextTokenParent !== undefined, "nextTokenParent is null");
- ts.Debug.assert(commonParent !== undefined, "commonParent is null");
- this.currentTokenSpan = currentRange;
- this.currentTokenParent = currentTokenParent;
- this.nextTokenSpan = nextRange;
- this.nextTokenParent = nextTokenParent;
- this.contextNode = commonParent;
- this.contextNodeAllOnSameLine = undefined;
- this.nextNodeAllOnSameLine = undefined;
- this.tokensAreOnSameLine = undefined;
- this.contextNodeBlockIsOnOneLine = undefined;
- this.nextNodeBlockIsOnOneLine = undefined;
- };
- FormattingContext.prototype.ContextNodeAllOnSameLine = function () {
- if (this.contextNodeAllOnSameLine === undefined) {
- this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode);
+ var OutliningElementsCollector;
+ (function (OutliningElementsCollector) {
+ function collectElements(sourceFile) {
+ var elements = [];
+ var collapseText = "...";
+ function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) {
+ if (hintSpanNode && startElement && endElement) {
+ var span_12 = {
+ textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end),
+ hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end),
+ bannerText: collapseText,
+ autoCollapse: autoCollapse
+ };
+ elements.push(span_12);
}
- return this.contextNodeAllOnSameLine;
- };
- FormattingContext.prototype.NextNodeAllOnSameLine = function () {
- if (this.nextNodeAllOnSameLine === undefined) {
- this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent);
+ }
+ function addOutliningSpanComments(commentSpan, autoCollapse) {
+ if (commentSpan) {
+ var span_13 = {
+ textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end),
+ hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end),
+ bannerText: collapseText,
+ autoCollapse: autoCollapse
+ };
+ elements.push(span_13);
}
- return this.nextNodeAllOnSameLine;
- };
- FormattingContext.prototype.TokensAreOnSameLine = function () {
- if (this.tokensAreOnSameLine === undefined) {
- var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line;
- var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line;
- this.tokensAreOnSameLine = (startLine === endLine);
+ }
+ function addOutliningForLeadingCommentsForNode(n) {
+ var comments = ts.getLeadingCommentRangesOfNode(n, sourceFile);
+ if (comments) {
+ var firstSingleLineCommentStart = -1;
+ var lastSingleLineCommentEnd = -1;
+ var isFirstSingleLineComment = true;
+ var singleLineCommentCount = 0;
+ for (var _i = 0, comments_4 = comments; _i < comments_4.length; _i++) {
+ var currentComment = comments_4[_i];
+ if (currentComment.kind === 2) {
+ if (isFirstSingleLineComment) {
+ firstSingleLineCommentStart = currentComment.pos;
+ }
+ isFirstSingleLineComment = false;
+ lastSingleLineCommentEnd = currentComment.end;
+ singleLineCommentCount++;
+ }
+ else if (currentComment.kind === 3) {
+ combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);
+ addOutliningSpanComments(currentComment, false);
+ singleLineCommentCount = 0;
+ lastSingleLineCommentEnd = -1;
+ isFirstSingleLineComment = true;
+ }
+ }
+ combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);
}
- return this.tokensAreOnSameLine;
- };
- FormattingContext.prototype.ContextNodeBlockIsOnOneLine = function () {
- if (this.contextNodeBlockIsOnOneLine === undefined) {
- this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode);
+ }
+ function combineAndAddMultipleSingleLineComments(count, start, end) {
+ if (count > 1) {
+ var multipleSingleLineComments = {
+ pos: start,
+ end: end,
+ kind: 2
+ };
+ addOutliningSpanComments(multipleSingleLineComments, false);
}
- return this.contextNodeBlockIsOnOneLine;
- };
- FormattingContext.prototype.NextNodeBlockIsOnOneLine = function () {
- if (this.nextNodeBlockIsOnOneLine === undefined) {
- this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent);
+ }
+ function autoCollapse(node) {
+ return ts.isFunctionBlock(node) && node.parent.kind !== 181;
+ }
+ var depth = 0;
+ var maxDepth = 20;
+ function walk(n) {
+ if (depth > maxDepth) {
+ return;
}
- return this.nextNodeBlockIsOnOneLine;
- };
- FormattingContext.prototype.NodeIsOnOneLine = function (node) {
- var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line;
- var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line;
- return startLine === endLine;
- };
- FormattingContext.prototype.BlockIsOnOneLine = function (node) {
- var openBrace = ts.findChildOfKind(node, 15, this.sourceFile);
- var closeBrace = ts.findChildOfKind(node, 16, this.sourceFile);
- if (openBrace && closeBrace) {
- var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line;
- var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line;
- return startLine === endLine;
+ if (ts.isDeclaration(n)) {
+ addOutliningForLeadingCommentsForNode(n);
}
- return false;
- };
- return FormattingContext;
- }());
- formatting.FormattingContext = FormattingContext;
- })(formatting = ts.formatting || (ts.formatting = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var formatting;
- (function (formatting) {
- var Rule = (function () {
- function Rule(Descriptor, Operation, Flag) {
- if (Flag === void 0) { Flag = 0; }
- this.Descriptor = Descriptor;
- this.Operation = Operation;
- this.Flag = Flag;
+ switch (n.kind) {
+ case 200:
+ if (!ts.isFunctionBlock(n)) {
+ var parent_22 = n.parent;
+ var openBrace = ts.findChildOfKind(n, 16, sourceFile);
+ var closeBrace = ts.findChildOfKind(n, 17, sourceFile);
+ if (parent_22.kind === 205 ||
+ parent_22.kind === 208 ||
+ parent_22.kind === 209 ||
+ parent_22.kind === 207 ||
+ parent_22.kind === 204 ||
+ parent_22.kind === 206 ||
+ parent_22.kind === 213 ||
+ parent_22.kind === 252) {
+ addOutliningSpan(parent_22, openBrace, closeBrace, autoCollapse(n));
+ break;
+ }
+ if (parent_22.kind === 217) {
+ var tryStatement = parent_22;
+ if (tryStatement.tryBlock === n) {
+ addOutliningSpan(parent_22, openBrace, closeBrace, autoCollapse(n));
+ break;
+ }
+ else if (tryStatement.finallyBlock === n) {
+ var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile);
+ if (finallyKeyword) {
+ addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n));
+ break;
+ }
+ }
+ }
+ var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end);
+ elements.push({
+ textSpan: span_14,
+ hintSpan: span_14,
+ bannerText: collapseText,
+ autoCollapse: autoCollapse(n)
+ });
+ break;
+ }
+ case 227: {
+ var openBrace = ts.findChildOfKind(n, 16, sourceFile);
+ var closeBrace = ts.findChildOfKind(n, 17, sourceFile);
+ addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n));
+ break;
+ }
+ case 222:
+ case 223:
+ case 225:
+ case 172:
+ case 228: {
+ var openBrace = ts.findChildOfKind(n, 16, sourceFile);
+ var closeBrace = ts.findChildOfKind(n, 17, sourceFile);
+ addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n));
+ break;
+ }
+ case 171:
+ var openBracket = ts.findChildOfKind(n, 20, sourceFile);
+ var closeBracket = ts.findChildOfKind(n, 21, sourceFile);
+ addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n));
+ break;
+ }
+ depth++;
+ ts.forEachChild(n, walk);
+ depth--;
}
- Rule.prototype.toString = function () {
- return "[desc=" + this.Descriptor + "," +
- "operation=" + this.Operation + "," +
- "flag=" + this.Flag + "]";
- };
- return Rule;
- }());
- formatting.Rule = Rule;
- })(formatting = ts.formatting || (ts.formatting = {}));
+ walk(sourceFile);
+ return elements;
+ }
+ OutliningElementsCollector.collectElements = collectElements;
+ })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
- var formatting;
- (function (formatting) {
- var RuleDescriptor = (function () {
- function RuleDescriptor(LeftTokenRange, RightTokenRange) {
- this.LeftTokenRange = LeftTokenRange;
- this.RightTokenRange = RightTokenRange;
+ (function (PatternMatchKind) {
+ PatternMatchKind[PatternMatchKind["exact"] = 0] = "exact";
+ PatternMatchKind[PatternMatchKind["prefix"] = 1] = "prefix";
+ PatternMatchKind[PatternMatchKind["substring"] = 2] = "substring";
+ PatternMatchKind[PatternMatchKind["camelCase"] = 3] = "camelCase";
+ })(ts.PatternMatchKind || (ts.PatternMatchKind = {}));
+ var PatternMatchKind = ts.PatternMatchKind;
+ function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) {
+ return {
+ kind: kind,
+ punctuationStripped: punctuationStripped,
+ isCaseSensitive: isCaseSensitive,
+ camelCaseWeight: camelCaseWeight
+ };
+ }
+ function createPatternMatcher(pattern) {
+ var stringToWordSpans = ts.createMap();
+ pattern = pattern.trim();
+ var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); });
+ var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid);
+ return {
+ getMatches: getMatches,
+ getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern,
+ patternContainsDots: dotSeparatedSegments.length > 1
+ };
+ function skipMatch(candidate) {
+ return invalidPattern || !candidate;
+ }
+ function getMatchesForLastSegmentOfPattern(candidate) {
+ if (skipMatch(candidate)) {
+ return undefined;
}
- RuleDescriptor.prototype.toString = function () {
- return "[leftRange=" + this.LeftTokenRange + "," +
- "rightRange=" + this.RightTokenRange + "]";
- };
- RuleDescriptor.create1 = function (left, right) {
- return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right));
- };
- RuleDescriptor.create2 = function (left, right) {
- return RuleDescriptor.create4(left, formatting.Shared.TokenRange.FromToken(right));
- };
- RuleDescriptor.create3 = function (left, right) {
- return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), right);
- };
- RuleDescriptor.create4 = function (left, right) {
- return new RuleDescriptor(left, right);
- };
- return RuleDescriptor;
- }());
- formatting.RuleDescriptor = RuleDescriptor;
- })(formatting = ts.formatting || (ts.formatting = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var formatting;
- (function (formatting) {
- var RuleOperation = (function () {
- function RuleOperation(Context, Action) {
- this.Context = Context;
- this.Action = Action;
+ return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments));
+ }
+ function getMatches(candidateContainers, candidate) {
+ if (skipMatch(candidate)) {
+ return undefined;
}
- RuleOperation.prototype.toString = function () {
- return "[context=" + this.Context + "," +
- "action=" + this.Action + "]";
- };
- RuleOperation.create1 = function (action) {
- return RuleOperation.create2(formatting.RuleOperationContext.Any, action);
- };
- RuleOperation.create2 = function (context, action) {
- return new RuleOperation(context, action);
- };
- return RuleOperation;
- }());
- formatting.RuleOperation = RuleOperation;
- })(formatting = ts.formatting || (ts.formatting = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var formatting;
- (function (formatting) {
- var RuleOperationContext = (function () {
- function RuleOperationContext() {
- var funcs = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- funcs[_i - 0] = arguments[_i];
+ var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments));
+ if (!candidateMatch) {
+ return undefined;
+ }
+ candidateContainers = candidateContainers || [];
+ if (dotSeparatedSegments.length - 1 > candidateContainers.length) {
+ return undefined;
+ }
+ var totalMatch = candidateMatch;
+ for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) {
+ var segment = dotSeparatedSegments[i];
+ var containerName = candidateContainers[j];
+ var containerMatch = matchSegment(containerName, segment);
+ if (!containerMatch) {
+ return undefined;
}
- this.customContextChecks = funcs;
+ ts.addRange(totalMatch, containerMatch);
}
- RuleOperationContext.prototype.IsAny = function () {
- return this === RuleOperationContext.Any;
- };
- RuleOperationContext.prototype.InContext = function (context) {
- if (this.IsAny()) {
+ return totalMatch;
+ }
+ function getWordSpans(word) {
+ if (!(word in stringToWordSpans)) {
+ stringToWordSpans[word] = breakIntoWordSpans(word);
+ }
+ return stringToWordSpans[word];
+ }
+ function matchTextChunk(candidate, chunk, punctuationStripped) {
+ var index = indexOfIgnoringCase(candidate, chunk.textLowerCase);
+ if (index === 0) {
+ if (chunk.text.length === candidate.length) {
+ return createPatternMatch(PatternMatchKind.exact, punctuationStripped, candidate === chunk.text);
+ }
+ else {
+ return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, ts.startsWith(candidate, chunk.text));
+ }
+ }
+ var isLowercase = chunk.isLowerCase;
+ if (isLowercase) {
+ if (index > 0) {
+ var wordSpans = getWordSpans(candidate);
+ for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) {
+ var span_15 = wordSpans_1[_i];
+ if (partStartsWith(candidate, span_15, chunk.text, true)) {
+ return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span_15, chunk.text, false));
+ }
+ }
+ }
+ }
+ else {
+ if (candidate.indexOf(chunk.text) > 0) {
+ return createPatternMatch(PatternMatchKind.substring, punctuationStripped, true);
+ }
+ }
+ if (!isLowercase) {
+ if (chunk.characterSpans.length > 0) {
+ var candidateParts = getWordSpans(candidate);
+ var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, false);
+ if (camelCaseWeight !== undefined) {
+ return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, true, camelCaseWeight);
+ }
+ camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, true);
+ if (camelCaseWeight !== undefined) {
+ return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, false, camelCaseWeight);
+ }
+ }
+ }
+ if (isLowercase) {
+ if (chunk.text.length < candidate.length) {
+ if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) {
+ return createPatternMatch(PatternMatchKind.substring, punctuationStripped, false);
+ }
+ }
+ }
+ return undefined;
+ }
+ function containsSpaceOrAsterisk(text) {
+ for (var i = 0; i < text.length; i++) {
+ var ch = text.charCodeAt(i);
+ if (ch === 32 || ch === 42) {
return true;
}
- for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) {
- var check = _a[_i];
- if (!check(context)) {
+ }
+ return false;
+ }
+ function matchSegment(candidate, segment) {
+ if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) {
+ var match = matchTextChunk(candidate, segment.totalTextChunk, false);
+ if (match) {
+ return [match];
+ }
+ }
+ var subWordTextChunks = segment.subWordTextChunks;
+ var matches = undefined;
+ for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) {
+ var subWordTextChunk = subWordTextChunks_1[_i];
+ var result = matchTextChunk(candidate, subWordTextChunk, true);
+ if (!result) {
+ return undefined;
+ }
+ matches = matches || [];
+ matches.push(result);
+ }
+ return matches;
+ }
+ function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) {
+ var patternPartStart = patternSpan ? patternSpan.start : 0;
+ var patternPartLength = patternSpan ? patternSpan.length : pattern.length;
+ if (patternPartLength > candidateSpan.length) {
+ return false;
+ }
+ if (ignoreCase) {
+ for (var i = 0; i < patternPartLength; i++) {
+ var ch1 = pattern.charCodeAt(patternPartStart + i);
+ var ch2 = candidate.charCodeAt(candidateSpan.start + i);
+ if (toLowerCase(ch1) !== toLowerCase(ch2)) {
return false;
}
}
- return true;
- };
- return RuleOperationContext;
- }());
- RuleOperationContext.Any = new RuleOperationContext();
- formatting.RuleOperationContext = RuleOperationContext;
- })(formatting = ts.formatting || (ts.formatting = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var formatting;
- (function (formatting) {
- var Rules = (function () {
- function Rules() {
- this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1));
- this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1));
- this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));
- this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));
- this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 2));
- this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2));
- this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2));
- this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16, 80), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16, 104), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.FromTokens([18, 20, 24, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8));
- this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments;
- this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1);
- this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([69, 3, 73, 82, 89]);
- this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1);
- this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18, 3, 79, 100, 85, 80]);
- this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1);
- this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2));
- this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2));
- this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8));
- this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8));
- this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8));
- this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4));
- this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4));
- this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));
- this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
- this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
- this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
- this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
- this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
- this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
- this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102, 98, 92, 78, 94, 101, 119]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108, 74]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2));
- this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8));
- this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(87, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2));
- this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8));
- this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2));
- this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18, 79, 80, 71]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNotForContext), 2));
- this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100, 85]), 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123, 131]), 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2));
- this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
- this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
- this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125, 129]), 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115, 73, 122, 77, 81, 82, 83, 123, 106, 89, 107, 125, 126, 110, 112, 111, 131, 113, 134, 136]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83, 106, 136])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2));
- this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22, 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.FromTokens([18, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));
- this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));
- this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));
- this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));
- this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));
- this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.FromTokens([17, 19, 27, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));
- this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8));
- this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115, 69, 82, 77, 73, 113, 112, 110, 111, 123, 131, 19, 37])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2));
- this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(87, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8));
- this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37, formatting.Shared.TokenRange.FromTokens([69, 17])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2));
- this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8));
- this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114, 37]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2));
- this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), 2));
- this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118, 87), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69, formatting.Shared.TokenRange.FromTokens([11, 12])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.SpaceBeforeJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNextTokenParentJsxAttribute, Rules.IsNonJsxSameLineTokenContext), 2));
- this.SpaceBeforeSlashInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 2));
- this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(39, 27), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(56, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8));
- this.HighPriorityCommonRules = [
- this.IgnoreBeforeComment, this.IgnoreAfterLineComment,
- this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator,
- this.NoSpaceAfterQuestionMark,
- this.NoSpaceBeforeDot, this.NoSpaceAfterDot,
- this.NoSpaceAfterUnaryPrefixOperator,
- this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator,
- this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator,
- this.SpaceAfterPostincrementWhenFollowedByAdd,
- this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement,
- this.SpaceAfterPostdecrementWhenFollowedBySubtract,
- this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement,
- this.NoSpaceAfterCloseBrace,
- this.NewLineBeforeCloseBraceInBlockContext,
- this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets,
- this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration,
- this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember,
- this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand,
- this.NoSpaceBetweenReturnAndSemicolon,
- this.SpaceAfterCertainKeywords,
- this.SpaceAfterLetConstInVariableDeclaration,
- this.NoSpaceBeforeOpenParenInFuncCall,
- this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator,
- this.SpaceAfterVoidOperator,
- this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword,
- this.NoSpaceBetweenTagAndTemplateString,
- this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement,
- this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute,
- this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport,
- this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords,
- this.SpaceAfterModuleName,
- this.SpaceBeforeArrow, this.SpaceAfterArrow,
- this.NoSpaceAfterEllipsis,
- this.NoSpaceAfterOptionalParameters,
- this.NoSpaceBetweenEmptyInterfaceBraceBrackets,
- this.NoSpaceBeforeOpenAngularBracket,
- this.NoSpaceBetweenCloseParenAndAngularBracket,
- this.NoSpaceAfterOpenAngularBracket,
- this.NoSpaceBeforeCloseAngularBracket,
- this.NoSpaceAfterCloseAngularBracket,
- this.SpaceBeforeAt,
- this.NoSpaceAfterAt,
- this.SpaceAfterDecorator,
- ];
- this.LowPriorityCommonRules = [
- this.NoSpaceBeforeSemicolon,
- this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock,
- this.NoSpaceBeforeComma,
- this.NoSpaceBeforeOpenBracket,
- this.NoSpaceAfterCloseBracket,
- this.SpaceAfterSemicolon,
- this.NoSpaceBeforeOpenParenInFuncDecl,
- this.SpaceBetweenStatements, this.SpaceAfterTryFinally
- ];
- this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), 2));
- this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext), 8));
- this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
- this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
- this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8));
- this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8));
- this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2));
- this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8));
- this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1);
- this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4), 1);
- this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1);
- this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 2));
- this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 8));
- this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12, 13]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.SpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12, 13]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13, 14])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
- this.SpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13, 14])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
- this.NoSpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8));
- this.SpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2));
- this.NoSpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8));
- this.SpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2));
- this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2));
- this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8));
- this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 8));
- this.SpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 2));
}
- Rules.prototype.getRuleName = function (rule) {
- var o = this;
- for (var name_51 in o) {
- if (o[name_51] === rule) {
- return name_51;
+ else {
+ for (var i = 0; i < patternPartLength; i++) {
+ var ch1 = pattern.charCodeAt(patternPartStart + i);
+ var ch2 = candidate.charCodeAt(candidateSpan.start + i);
+ if (ch1 !== ch2) {
+ return false;
}
}
- throw new Error("Unknown rule");
- };
- Rules.IsForContext = function (context) {
- return context.contextNode.kind === 206;
- };
- Rules.IsNotForContext = function (context) {
- return !Rules.IsForContext(context);
- };
- Rules.IsBinaryOpContext = function (context) {
- switch (context.contextNode.kind) {
- case 187:
- case 188:
- case 195:
- case 238:
- case 234:
- case 154:
- case 162:
- case 163:
- return true;
- case 169:
- case 223:
- case 229:
- case 218:
- case 142:
- case 255:
- case 145:
- case 144:
- return context.currentTokenSpan.kind === 56 || context.nextTokenSpan.kind === 56;
- case 207:
- return context.currentTokenSpan.kind === 90 || context.nextTokenSpan.kind === 90;
- case 208:
- return context.currentTokenSpan.kind === 138 || context.nextTokenSpan.kind === 138;
- }
- return false;
- };
- Rules.IsNotBinaryOpContext = function (context) {
- return !Rules.IsBinaryOpContext(context);
- };
- Rules.IsConditionalOperatorContext = function (context) {
- return context.contextNode.kind === 188;
- };
- Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) {
- return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context);
- };
- Rules.IsBeforeMultilineBlockContext = function (context) {
- return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine());
- };
- Rules.IsMultilineBlockContext = function (context) {
- return Rules.IsBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine());
- };
- Rules.IsSingleLineBlockContext = function (context) {
- return Rules.IsBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine());
- };
- Rules.IsBlockContext = function (context) {
- return Rules.NodeIsBlockContext(context.contextNode);
- };
- Rules.IsBeforeBlockContext = function (context) {
- return Rules.NodeIsBlockContext(context.nextTokenParent);
- };
- Rules.NodeIsBlockContext = function (node) {
- if (Rules.NodeIsTypeScriptDeclWithBlockContext(node)) {
- return true;
- }
- switch (node.kind) {
- case 199:
- case 227:
- case 171:
- case 226:
- return true;
+ }
+ return true;
+ }
+ function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) {
+ var chunkCharacterSpans = chunk.characterSpans;
+ var currentCandidate = 0;
+ var currentChunkSpan = 0;
+ var firstMatch = undefined;
+ var contiguous = undefined;
+ while (true) {
+ if (currentChunkSpan === chunkCharacterSpans.length) {
+ var weight = 0;
+ if (contiguous) {
+ weight += 1;
+ }
+ if (firstMatch === 0) {
+ weight += 2;
+ }
+ return weight;
}
- return false;
- };
- Rules.IsFunctionDeclContext = function (context) {
- switch (context.contextNode.kind) {
- case 220:
- case 147:
- case 146:
- case 149:
- case 150:
- case 151:
- case 179:
- case 148:
- case 180:
- case 222:
- return true;
+ else if (currentCandidate === candidateParts.length) {
+ return undefined;
}
- return false;
- };
- Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) {
- return context.contextNode.kind === 220 || context.contextNode.kind === 179;
- };
- Rules.IsTypeScriptDeclWithBlockContext = function (context) {
- return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode);
- };
- Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) {
- switch (node.kind) {
- case 221:
- case 192:
- case 222:
- case 224:
- case 159:
- case 225:
- case 236:
- case 237:
- case 230:
- case 233:
- return true;
+ var candidatePart = candidateParts[currentCandidate];
+ var gotOneMatchThisCandidate = false;
+ for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) {
+ var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan];
+ if (gotOneMatchThisCandidate) {
+ if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) ||
+ !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) {
+ break;
+ }
+ }
+ if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) {
+ break;
+ }
+ gotOneMatchThisCandidate = true;
+ firstMatch = firstMatch === undefined ? currentCandidate : firstMatch;
+ contiguous = contiguous === undefined ? true : contiguous;
+ candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length);
}
- return false;
- };
- Rules.IsAfterCodeBlockContext = function (context) {
- switch (context.currentTokenParent.kind) {
- case 221:
- case 225:
- case 224:
- case 199:
- case 252:
- case 226:
- case 213:
- return true;
+ if (!gotOneMatchThisCandidate && contiguous !== undefined) {
+ contiguous = false;
}
+ currentCandidate++;
+ }
+ }
+ }
+ ts.createPatternMatcher = createPatternMatcher;
+ function createSegment(text) {
+ return {
+ totalTextChunk: createTextChunk(text),
+ subWordTextChunks: breakPatternIntoTextChunks(text)
+ };
+ }
+ function segmentIsInvalid(segment) {
+ return segment.subWordTextChunks.length === 0;
+ }
+ function isUpperCaseLetter(ch) {
+ if (ch >= 65 && ch <= 90) {
+ return true;
+ }
+ if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 4)) {
+ return false;
+ }
+ var str = String.fromCharCode(ch);
+ return str === str.toUpperCase();
+ }
+ function isLowerCaseLetter(ch) {
+ if (ch >= 97 && ch <= 122) {
+ return true;
+ }
+ if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 4)) {
+ return false;
+ }
+ var str = String.fromCharCode(ch);
+ return str === str.toLowerCase();
+ }
+ function indexOfIgnoringCase(string, value) {
+ for (var i = 0, n = string.length - value.length; i <= n; i++) {
+ if (startsWithIgnoringCase(string, value, i)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+ function startsWithIgnoringCase(string, value, start) {
+ for (var i = 0, n = value.length; i < n; i++) {
+ var ch1 = toLowerCase(string.charCodeAt(i + start));
+ var ch2 = value.charCodeAt(i);
+ if (ch1 !== ch2) {
return false;
- };
- Rules.IsControlDeclContext = function (context) {
- switch (context.contextNode.kind) {
- case 203:
- case 213:
- case 206:
- case 207:
- case 208:
- case 205:
- case 216:
- case 204:
- case 212:
- case 252:
- return true;
- default:
- return false;
+ }
+ }
+ return true;
+ }
+ function toLowerCase(ch) {
+ if (ch >= 65 && ch <= 90) {
+ return 97 + (ch - 65);
+ }
+ if (ch < 127) {
+ return ch;
+ }
+ return String.fromCharCode(ch).toLowerCase().charCodeAt(0);
+ }
+ function isDigit(ch) {
+ return ch >= 48 && ch <= 57;
+ }
+ function isWordChar(ch) {
+ return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === 95 || ch === 36;
+ }
+ function breakPatternIntoTextChunks(pattern) {
+ var result = [];
+ var wordStart = 0;
+ var wordLength = 0;
+ for (var i = 0; i < pattern.length; i++) {
+ var ch = pattern.charCodeAt(i);
+ if (isWordChar(ch)) {
+ if (wordLength === 0) {
+ wordStart = i;
}
- };
- Rules.IsObjectContext = function (context) {
- return context.contextNode.kind === 171;
- };
- Rules.IsFunctionCallContext = function (context) {
- return context.contextNode.kind === 174;
- };
- Rules.IsNewContext = function (context) {
- return context.contextNode.kind === 175;
- };
- Rules.IsFunctionCallOrNewContext = function (context) {
- return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context);
- };
- Rules.IsPreviousTokenNotComma = function (context) {
- return context.currentTokenSpan.kind !== 24;
- };
- Rules.IsNextTokenNotCloseBracket = function (context) {
- return context.nextTokenSpan.kind !== 20;
- };
- Rules.IsArrowFunctionContext = function (context) {
- return context.contextNode.kind === 180;
- };
- Rules.IsNonJsxSameLineTokenContext = function (context) {
- return context.TokensAreOnSameLine() && context.contextNode.kind !== 244;
- };
- Rules.IsNonJsxElementContext = function (context) {
- return context.contextNode.kind !== 241;
- };
- Rules.IsJsxExpressionContext = function (context) {
- return context.contextNode.kind === 248;
- };
- Rules.IsNextTokenParentJsxAttribute = function (context) {
- return context.nextTokenParent.kind === 246;
- };
- Rules.IsJsxAttributeContext = function (context) {
- return context.contextNode.kind === 246;
- };
- Rules.IsJsxSelfClosingElementContext = function (context) {
- return context.contextNode.kind === 242;
- };
- Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) {
- return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context);
- };
- Rules.IsEndOfDecoratorContextOnSameLine = function (context) {
- return context.TokensAreOnSameLine() &&
- context.contextNode.decorators &&
- Rules.NodeIsInDecoratorContext(context.currentTokenParent) &&
- !Rules.NodeIsInDecoratorContext(context.nextTokenParent);
- };
- Rules.NodeIsInDecoratorContext = function (node) {
- while (ts.isPartOfExpression(node)) {
- node = node.parent;
+ wordLength++;
+ }
+ else {
+ if (wordLength > 0) {
+ result.push(createTextChunk(pattern.substr(wordStart, wordLength)));
+ wordLength = 0;
}
- return node.kind === 143;
- };
- Rules.IsStartOfVariableDeclarationList = function (context) {
- return context.currentTokenParent.kind === 219 &&
- context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos;
- };
- Rules.IsNotFormatOnEnter = function (context) {
- return context.formattingRequestKind !== 2;
- };
- Rules.IsModuleDeclContext = function (context) {
- return context.contextNode.kind === 225;
- };
- Rules.IsObjectTypeContext = function (context) {
- return context.contextNode.kind === 159;
- };
- Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) {
- if (token.kind !== 25 && token.kind !== 27) {
- return false;
+ }
+ }
+ if (wordLength > 0) {
+ result.push(createTextChunk(pattern.substr(wordStart, wordLength)));
+ }
+ return result;
+ }
+ function createTextChunk(text) {
+ var textLowerCase = text.toLowerCase();
+ return {
+ text: text,
+ textLowerCase: textLowerCase,
+ isLowerCase: text === textLowerCase,
+ characterSpans: breakIntoCharacterSpans(text)
+ };
+ }
+ function breakIntoCharacterSpans(identifier) {
+ return breakIntoSpans(identifier, false);
+ }
+ ts.breakIntoCharacterSpans = breakIntoCharacterSpans;
+ function breakIntoWordSpans(identifier) {
+ return breakIntoSpans(identifier, true);
+ }
+ ts.breakIntoWordSpans = breakIntoWordSpans;
+ function breakIntoSpans(identifier, word) {
+ var result = [];
+ var wordStart = 0;
+ for (var i = 1, n = identifier.length; i < n; i++) {
+ var lastIsDigit = isDigit(identifier.charCodeAt(i - 1));
+ var currentIsDigit = isDigit(identifier.charCodeAt(i));
+ var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i);
+ var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart);
+ if (charIsPunctuation(identifier.charCodeAt(i - 1)) ||
+ charIsPunctuation(identifier.charCodeAt(i)) ||
+ lastIsDigit !== currentIsDigit ||
+ hasTransitionFromLowerToUpper ||
+ hasTransitionFromUpperToLower) {
+ if (!isAllPunctuation(identifier, wordStart, i)) {
+ result.push(ts.createTextSpan(wordStart, i - wordStart));
}
- switch (parent.kind) {
- case 155:
- case 177:
- case 221:
- case 192:
- case 222:
- case 220:
- case 179:
- case 180:
- case 147:
- case 146:
- case 151:
- case 152:
- case 174:
- case 175:
- case 194:
- return true;
- default:
- return false;
+ wordStart = i;
+ }
+ }
+ if (!isAllPunctuation(identifier, wordStart, identifier.length)) {
+ result.push(ts.createTextSpan(wordStart, identifier.length - wordStart));
+ }
+ return result;
+ }
+ function charIsPunctuation(ch) {
+ switch (ch) {
+ case 33:
+ case 34:
+ case 35:
+ case 37:
+ case 38:
+ case 39:
+ case 40:
+ case 41:
+ case 42:
+ case 44:
+ case 45:
+ case 46:
+ case 47:
+ case 58:
+ case 59:
+ case 63:
+ case 64:
+ case 91:
+ case 92:
+ case 93:
+ case 95:
+ case 123:
+ case 125:
+ return true;
+ }
+ return false;
+ }
+ function isAllPunctuation(identifier, start, end) {
+ for (var i = start; i < end; i++) {
+ var ch = identifier.charCodeAt(i);
+ if (!charIsPunctuation(ch) || ch === 95 || ch === 36) {
+ return false;
+ }
+ }
+ return true;
+ }
+ function transitionFromUpperToLower(identifier, word, index, wordStart) {
+ if (word) {
+ if (index !== wordStart &&
+ index + 1 < identifier.length) {
+ var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));
+ var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1));
+ if (currentIsUpper && nextIsLower) {
+ for (var i = wordStart; i < index; i++) {
+ if (!isUpperCaseLetter(identifier.charCodeAt(i))) {
+ return false;
+ }
+ }
+ return true;
}
- };
- Rules.IsTypeArgumentOrParameterOrAssertionContext = function (context) {
- return Rules.IsTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) ||
- Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent);
- };
- Rules.IsTypeAssertionContext = function (context) {
- return context.contextNode.kind === 177;
- };
- Rules.IsVoidOpContext = function (context) {
- return context.currentTokenSpan.kind === 103 && context.currentTokenParent.kind === 183;
- };
- Rules.IsYieldOrYieldStarWithOperand = function (context) {
- return context.contextNode.kind === 190 && context.contextNode.expression !== undefined;
- };
- return Rules;
- }());
- formatting.Rules = Rules;
- })(formatting = ts.formatting || (ts.formatting = {}));
+ }
+ }
+ return false;
+ }
+ function transitionFromLowerToUpper(identifier, word, index) {
+ var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1));
+ var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));
+ var transition = word
+ ? (currentIsUpper && !lastIsUpper)
+ : currentIsUpper;
+ return transition;
+ }
})(ts || (ts = {}));
var ts;
(function (ts) {
- var formatting;
- (function (formatting) {
- var RulesMap = (function () {
- function RulesMap() {
- this.map = [];
- this.mapRowLength = 0;
+ function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) {
+ if (readImportFiles === void 0) { readImportFiles = true; }
+ if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; }
+ var referencedFiles = [];
+ var typeReferenceDirectives = [];
+ var importedFiles = [];
+ var ambientExternalModules;
+ var isNoDefaultLib = false;
+ var braceNesting = 0;
+ var externalModule = false;
+ function nextToken() {
+ var token = ts.scanner.scan();
+ if (token === 16) {
+ braceNesting++;
}
- RulesMap.create = function (rules) {
- var result = new RulesMap();
- result.Initialize(rules);
- return result;
- };
- RulesMap.prototype.Initialize = function (rules) {
- this.mapRowLength = 138 + 1;
- this.map = new Array(this.mapRowLength * this.mapRowLength);
- var rulesBucketConstructionStateList = new Array(this.map.length);
- this.FillRules(rules, rulesBucketConstructionStateList);
- return this.map;
- };
- RulesMap.prototype.FillRules = function (rules, rulesBucketConstructionStateList) {
- var _this = this;
- rules.forEach(function (rule) {
- _this.FillRule(rule, rulesBucketConstructionStateList);
- });
- };
- RulesMap.prototype.GetRuleBucketIndex = function (row, column) {
- var rulesBucketIndex = (row * this.mapRowLength) + column;
- return rulesBucketIndex;
+ else if (token === 17) {
+ braceNesting--;
+ }
+ return token;
+ }
+ function processTripleSlashDirectives() {
+ var commentRanges = ts.getLeadingCommentRanges(sourceText, 0);
+ ts.forEach(commentRanges, function (commentRange) {
+ var comment = sourceText.substring(commentRange.pos, commentRange.end);
+ var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, commentRange);
+ if (referencePathMatchResult) {
+ isNoDefaultLib = referencePathMatchResult.isNoDefaultLib;
+ var fileReference = referencePathMatchResult.fileReference;
+ if (fileReference) {
+ var collection = referencePathMatchResult.isTypeReferenceDirective
+ ? typeReferenceDirectives
+ : referencedFiles;
+ collection.push(fileReference);
+ }
+ }
+ });
+ }
+ function getFileReference() {
+ var file = ts.scanner.getTokenValue();
+ var pos = ts.scanner.getTokenPos();
+ return {
+ fileName: file,
+ pos: pos,
+ end: pos + file.length
};
- RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) {
- var _this = this;
- var specificRule = rule.Descriptor.LeftTokenRange !== formatting.Shared.TokenRange.Any &&
- rule.Descriptor.RightTokenRange !== formatting.Shared.TokenRange.Any;
- rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) {
- rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) {
- var rulesBucketIndex = _this.GetRuleBucketIndex(left, right);
- var rulesBucket = _this.map[rulesBucketIndex];
- if (rulesBucket === undefined) {
- rulesBucket = _this.map[rulesBucketIndex] = new RulesBucket();
- }
- rulesBucket.AddRule(rule, specificRule, rulesBucketConstructionStateList, rulesBucketIndex);
- });
- });
- };
- RulesMap.prototype.GetRule = function (context) {
- var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind);
- var bucket = this.map[bucketIndex];
- if (bucket) {
- for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) {
- var rule = _a[_i];
- if (rule.Operation.Context.InContext(context)) {
- return rule;
- }
- }
- }
- return undefined;
- };
- return RulesMap;
- }());
- formatting.RulesMap = RulesMap;
- var MaskBitSize = 5;
- var Mask = 0x1f;
- (function (RulesPosition) {
- RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific";
- RulesPosition[RulesPosition["IgnoreRulesAny"] = MaskBitSize * 1] = "IgnoreRulesAny";
- RulesPosition[RulesPosition["ContextRulesSpecific"] = MaskBitSize * 2] = "ContextRulesSpecific";
- RulesPosition[RulesPosition["ContextRulesAny"] = MaskBitSize * 3] = "ContextRulesAny";
- RulesPosition[RulesPosition["NoContextRulesSpecific"] = MaskBitSize * 4] = "NoContextRulesSpecific";
- RulesPosition[RulesPosition["NoContextRulesAny"] = MaskBitSize * 5] = "NoContextRulesAny";
- })(formatting.RulesPosition || (formatting.RulesPosition = {}));
- var RulesPosition = formatting.RulesPosition;
- var RulesBucketConstructionState = (function () {
- function RulesBucketConstructionState() {
- this.rulesInsertionIndexBitmap = 0;
+ }
+ function recordAmbientExternalModule() {
+ if (!ambientExternalModules) {
+ ambientExternalModules = [];
}
- RulesBucketConstructionState.prototype.GetInsertionIndex = function (maskPosition) {
- var index = 0;
- var pos = 0;
- var indexBitmap = this.rulesInsertionIndexBitmap;
- while (pos <= maskPosition) {
- index += (indexBitmap & Mask);
- indexBitmap >>= MaskBitSize;
- pos += MaskBitSize;
- }
- return index;
- };
- RulesBucketConstructionState.prototype.IncreaseInsertionIndex = function (maskPosition) {
- var value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask;
- value++;
- ts.Debug.assert((value & Mask) === value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules.");
- var temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition);
- temp |= value << maskPosition;
- this.rulesInsertionIndexBitmap = temp;
- };
- return RulesBucketConstructionState;
- }());
- formatting.RulesBucketConstructionState = RulesBucketConstructionState;
- var RulesBucket = (function () {
- function RulesBucket() {
- this.rules = [];
+ ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting });
+ }
+ function recordModuleName() {
+ importedFiles.push(getFileReference());
+ markAsExternalModuleIfTopLevel();
+ }
+ function markAsExternalModuleIfTopLevel() {
+ if (braceNesting === 0) {
+ externalModule = true;
}
- RulesBucket.prototype.Rules = function () {
- return this.rules;
- };
- RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) {
- var position;
- if (rule.Operation.Action === 1) {
- position = specificTokens ?
- RulesPosition.IgnoreRulesSpecific :
- RulesPosition.IgnoreRulesAny;
+ }
+ function tryConsumeDeclare() {
+ var token = ts.scanner.getToken();
+ if (token === 123) {
+ token = nextToken();
+ if (token === 126) {
+ token = nextToken();
+ if (token === 9) {
+ recordAmbientExternalModule();
+ }
}
- else if (!rule.Operation.Context.IsAny()) {
- position = specificTokens ?
- RulesPosition.ContextRulesSpecific :
- RulesPosition.ContextRulesAny;
+ return true;
+ }
+ return false;
+ }
+ function tryConsumeImport() {
+ var token = ts.scanner.getToken();
+ if (token === 90) {
+ token = nextToken();
+ if (token === 9) {
+ recordModuleName();
+ return true;
}
else {
- position = specificTokens ?
- RulesPosition.NoContextRulesSpecific :
- RulesPosition.NoContextRulesAny;
- }
- var state = constructionState[rulesBucketIndex];
- if (state === undefined) {
- state = constructionState[rulesBucketIndex] = new RulesBucketConstructionState();
- }
- var index = state.GetInsertionIndex(position);
- this.rules.splice(index, 0, rule);
- state.IncreaseInsertionIndex(position);
- };
- return RulesBucket;
- }());
- formatting.RulesBucket = RulesBucket;
- })(formatting = ts.formatting || (ts.formatting = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var formatting;
- (function (formatting) {
- var Shared;
- (function (Shared) {
- var TokenRangeAccess = (function () {
- function TokenRangeAccess(from, to, except) {
- this.tokens = [];
- for (var token = from; token <= to; token++) {
- if (ts.indexOf(except, token) < 0) {
- this.tokens.push(token);
+ if (token === 70 || ts.isKeyword(token)) {
+ token = nextToken();
+ if (token === 137) {
+ token = nextToken();
+ if (token === 9) {
+ recordModuleName();
+ return true;
+ }
+ }
+ else if (token === 57) {
+ if (tryConsumeRequireCall(true)) {
+ return true;
+ }
+ }
+ else if (token === 25) {
+ token = nextToken();
+ }
+ else {
+ return true;
}
}
- }
- TokenRangeAccess.prototype.GetTokens = function () {
- return this.tokens;
- };
- TokenRangeAccess.prototype.Contains = function (token) {
- return this.tokens.indexOf(token) >= 0;
- };
- return TokenRangeAccess;
- }());
- Shared.TokenRangeAccess = TokenRangeAccess;
- var TokenValuesAccess = (function () {
- function TokenValuesAccess(tks) {
- this.tokens = tks && tks.length ? tks : [];
- }
- TokenValuesAccess.prototype.GetTokens = function () {
- return this.tokens;
- };
- TokenValuesAccess.prototype.Contains = function (token) {
- return this.tokens.indexOf(token) >= 0;
- };
- return TokenValuesAccess;
- }());
- Shared.TokenValuesAccess = TokenValuesAccess;
- var TokenSingleValueAccess = (function () {
- function TokenSingleValueAccess(token) {
- this.token = token;
- }
- TokenSingleValueAccess.prototype.GetTokens = function () {
- return [this.token];
- };
- TokenSingleValueAccess.prototype.Contains = function (tokenValue) {
- return tokenValue === this.token;
- };
- return TokenSingleValueAccess;
- }());
- Shared.TokenSingleValueAccess = TokenSingleValueAccess;
- var TokenAllAccess = (function () {
- function TokenAllAccess() {
- }
- TokenAllAccess.prototype.GetTokens = function () {
- var result = [];
- for (var token = 0; token <= 138; token++) {
- result.push(token);
+ if (token === 16) {
+ token = nextToken();
+ while (token !== 17 && token !== 1) {
+ token = nextToken();
+ }
+ if (token === 17) {
+ token = nextToken();
+ if (token === 137) {
+ token = nextToken();
+ if (token === 9) {
+ recordModuleName();
+ }
+ }
+ }
+ }
+ else if (token === 38) {
+ token = nextToken();
+ if (token === 117) {
+ token = nextToken();
+ if (token === 70 || ts.isKeyword(token)) {
+ token = nextToken();
+ if (token === 137) {
+ token = nextToken();
+ if (token === 9) {
+ recordModuleName();
+ }
+ }
+ }
+ }
}
- return result;
- };
- TokenAllAccess.prototype.Contains = function (tokenValue) {
- return true;
- };
- TokenAllAccess.prototype.toString = function () {
- return "[allTokens]";
- };
- return TokenAllAccess;
- }());
- Shared.TokenAllAccess = TokenAllAccess;
- var TokenRange = (function () {
- function TokenRange(tokenAccess) {
- this.tokenAccess = tokenAccess;
}
- TokenRange.FromToken = function (token) {
- return new TokenRange(new TokenSingleValueAccess(token));
- };
- TokenRange.FromTokens = function (tokens) {
- return new TokenRange(new TokenValuesAccess(tokens));
- };
- TokenRange.FromRange = function (f, to, except) {
- if (except === void 0) { except = []; }
- return new TokenRange(new TokenRangeAccess(f, to, except));
- };
- TokenRange.AllTokens = function () {
- return new TokenRange(new TokenAllAccess());
- };
- TokenRange.prototype.GetTokens = function () {
- return this.tokenAccess.GetTokens();
- };
- TokenRange.prototype.Contains = function (token) {
- return this.tokenAccess.Contains(token);
- };
- TokenRange.prototype.toString = function () {
- return this.tokenAccess.toString();
- };
- return TokenRange;
- }());
- TokenRange.Any = TokenRange.AllTokens();
- TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3]));
- TokenRange.Keywords = TokenRange.FromRange(70, 138);
- TokenRange.BinaryOperators = TokenRange.FromRange(25, 68);
- TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90, 91, 138, 116, 124]);
- TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([41, 42, 50, 49]);
- TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 69, 17, 19, 15, 97, 92]);
- TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([69, 17, 97, 92]);
- TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([69, 18, 20, 92]);
- TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([69, 17, 97, 92]);
- TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([69, 18, 20, 92]);
- TokenRange.Comments = TokenRange.FromTokens([2, 3]);
- TokenRange.TypeNames = TokenRange.FromTokens([69, 130, 132, 120, 133, 103, 117]);
- Shared.TokenRange = TokenRange;
- })(Shared = formatting.Shared || (formatting.Shared = {}));
- })(formatting = ts.formatting || (ts.formatting = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var formatting;
- (function (formatting) {
- var RulesProvider = (function () {
- function RulesProvider() {
- this.globalRules = new formatting.Rules();
+ return true;
}
- RulesProvider.prototype.getRuleName = function (rule) {
- return this.globalRules.getRuleName(rule);
- };
- RulesProvider.prototype.getRuleByName = function (name) {
- return this.globalRules[name];
- };
- RulesProvider.prototype.getRulesMap = function () {
- return this.rulesMap;
- };
- RulesProvider.prototype.ensureUpToDate = function (options) {
- if (!this.options || !ts.compareDataObjects(this.options, options)) {
- var activeRules = this.createActiveRules(options);
- var rulesMap = formatting.RulesMap.create(activeRules);
- this.activeRules = activeRules;
- this.rulesMap = rulesMap;
- this.options = ts.clone(options);
- }
- };
- RulesProvider.prototype.createActiveRules = function (options) {
- var rules = this.globalRules.HighPriorityCommonRules.slice(0);
- if (options.insertSpaceAfterCommaDelimiter) {
- rules.push(this.globalRules.SpaceAfterComma);
- }
- else {
- rules.push(this.globalRules.NoSpaceAfterComma);
- }
- if (options.insertSpaceAfterFunctionKeywordForAnonymousFunctions) {
- rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword);
- }
- else {
- rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword);
- }
- if (options.insertSpaceAfterKeywordsInControlFlowStatements) {
- rules.push(this.globalRules.SpaceAfterKeywordInControl);
- }
- else {
- rules.push(this.globalRules.NoSpaceAfterKeywordInControl);
- }
- if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) {
- rules.push(this.globalRules.SpaceAfterOpenParen);
- rules.push(this.globalRules.SpaceBeforeCloseParen);
- rules.push(this.globalRules.NoSpaceBetweenParens);
- }
- else {
- rules.push(this.globalRules.NoSpaceAfterOpenParen);
- rules.push(this.globalRules.NoSpaceBeforeCloseParen);
- rules.push(this.globalRules.NoSpaceBetweenParens);
- }
- if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) {
- rules.push(this.globalRules.SpaceAfterOpenBracket);
- rules.push(this.globalRules.SpaceBeforeCloseBracket);
- rules.push(this.globalRules.NoSpaceBetweenBrackets);
- }
- else {
- rules.push(this.globalRules.NoSpaceAfterOpenBracket);
- rules.push(this.globalRules.NoSpaceBeforeCloseBracket);
- rules.push(this.globalRules.NoSpaceBetweenBrackets);
+ return false;
+ }
+ function tryConsumeExport() {
+ var token = ts.scanner.getToken();
+ if (token === 83) {
+ markAsExternalModuleIfTopLevel();
+ token = nextToken();
+ if (token === 16) {
+ token = nextToken();
+ while (token !== 17 && token !== 1) {
+ token = nextToken();
+ }
+ if (token === 17) {
+ token = nextToken();
+ if (token === 137) {
+ token = nextToken();
+ if (token === 9) {
+ recordModuleName();
+ }
+ }
+ }
}
- if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces !== false) {
- rules.push(this.globalRules.SpaceAfterOpenBrace);
- rules.push(this.globalRules.SpaceBeforeCloseBrace);
- rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets);
+ else if (token === 38) {
+ token = nextToken();
+ if (token === 137) {
+ token = nextToken();
+ if (token === 9) {
+ recordModuleName();
+ }
+ }
}
- else {
- rules.push(this.globalRules.NoSpaceAfterOpenBrace);
- rules.push(this.globalRules.NoSpaceBeforeCloseBrace);
- rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets);
+ else if (token === 90) {
+ token = nextToken();
+ if (token === 70 || ts.isKeyword(token)) {
+ token = nextToken();
+ if (token === 57) {
+ if (tryConsumeRequireCall(true)) {
+ return true;
+ }
+ }
+ }
}
- if (options.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) {
- rules.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle);
- rules.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail);
+ return true;
+ }
+ return false;
+ }
+ function tryConsumeRequireCall(skipCurrentToken) {
+ var token = skipCurrentToken ? nextToken() : ts.scanner.getToken();
+ if (token === 130) {
+ token = nextToken();
+ if (token === 18) {
+ token = nextToken();
+ if (token === 9) {
+ recordModuleName();
+ }
}
- else {
- rules.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle);
- rules.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail);
+ return true;
+ }
+ return false;
+ }
+ function tryConsumeDefine() {
+ var token = ts.scanner.getToken();
+ if (token === 70 && ts.scanner.getTokenValue() === "define") {
+ token = nextToken();
+ if (token !== 18) {
+ return true;
}
- if (options.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces) {
- rules.push(this.globalRules.SpaceAfterOpenBraceInJsxExpression);
- rules.push(this.globalRules.SpaceBeforeCloseBraceInJsxExpression);
+ token = nextToken();
+ if (token === 9) {
+ token = nextToken();
+ if (token === 25) {
+ token = nextToken();
+ }
+ else {
+ return true;
+ }
}
- else {
- rules.push(this.globalRules.NoSpaceAfterOpenBraceInJsxExpression);
- rules.push(this.globalRules.NoSpaceBeforeCloseBraceInJsxExpression);
+ if (token !== 20) {
+ return true;
}
- if (options.insertSpaceAfterSemicolonInForStatements) {
- rules.push(this.globalRules.SpaceAfterSemicolonInFor);
+ token = nextToken();
+ var i = 0;
+ while (token !== 21 && token !== 1) {
+ if (token === 9) {
+ recordModuleName();
+ i++;
+ }
+ token = nextToken();
}
- else {
- rules.push(this.globalRules.NoSpaceAfterSemicolonInFor);
+ return true;
+ }
+ return false;
+ }
+ function processImports() {
+ ts.scanner.setText(sourceText);
+ nextToken();
+ while (true) {
+ if (ts.scanner.getToken() === 1) {
+ break;
}
- if (options.insertSpaceBeforeAndAfterBinaryOperators) {
- rules.push(this.globalRules.SpaceBeforeBinaryOperator);
- rules.push(this.globalRules.SpaceAfterBinaryOperator);
+ if (tryConsumeDeclare() ||
+ tryConsumeImport() ||
+ tryConsumeExport() ||
+ (detectJavaScriptImports && (tryConsumeRequireCall(false) || tryConsumeDefine()))) {
+ continue;
}
else {
- rules.push(this.globalRules.NoSpaceBeforeBinaryOperator);
- rules.push(this.globalRules.NoSpaceAfterBinaryOperator);
- }
- if (options.placeOpenBraceOnNewLineForControlBlocks) {
- rules.push(this.globalRules.NewLineBeforeOpenBraceInControl);
- }
- if (options.placeOpenBraceOnNewLineForFunctions) {
- rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction);
- rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock);
+ nextToken();
}
- if (options.insertSpaceAfterTypeAssertion) {
- rules.push(this.globalRules.SpaceAfterTypeAssertion);
+ }
+ ts.scanner.setText(undefined);
+ }
+ if (readImportFiles) {
+ processImports();
+ }
+ processTripleSlashDirectives();
+ if (externalModule) {
+ if (ambientExternalModules) {
+ for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) {
+ var decl = ambientExternalModules_1[_i];
+ importedFiles.push(decl.ref);
}
- else {
- rules.push(this.globalRules.NoSpaceAfterTypeAssertion);
+ }
+ return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined };
+ }
+ else {
+ var ambientModuleNames = void 0;
+ if (ambientExternalModules) {
+ for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) {
+ var decl = ambientExternalModules_2[_a];
+ if (decl.depth === 0) {
+ if (!ambientModuleNames) {
+ ambientModuleNames = [];
+ }
+ ambientModuleNames.push(decl.ref.fileName);
+ }
+ else {
+ importedFiles.push(decl.ref);
+ }
}
- rules = rules.concat(this.globalRules.LowPriorityCommonRules);
- return rules;
- };
- return RulesProvider;
- }());
- formatting.RulesProvider = RulesProvider;
- })(formatting = ts.formatting || (ts.formatting = {}));
+ }
+ return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames };
+ }
+ }
+ ts.preProcessFile = preProcessFile;
})(ts || (ts = {}));
var ts;
(function (ts) {
- var formatting;
- (function (formatting) {
- function formatOnEnter(position, sourceFile, rulesProvider, options) {
- var line = sourceFile.getLineAndCharacterOfPosition(position).line;
- if (line === 0) {
- return [];
- }
- var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile);
- while (ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(endOfFormatSpan))) {
- endOfFormatSpan--;
- }
- if (ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) {
- endOfFormatSpan--;
- }
- var span = {
- pos: ts.getStartPositionOfLine(line - 1, sourceFile),
- end: endOfFormatSpan + 1
- };
- return formatSpan(span, sourceFile, options, rulesProvider, 2);
- }
- formatting.formatOnEnter = formatOnEnter;
- function formatOnSemicolon(position, sourceFile, rulesProvider, options) {
- return formatOutermostParent(position, 23, sourceFile, options, rulesProvider, 3);
- }
- formatting.formatOnSemicolon = formatOnSemicolon;
- function formatOnClosingCurly(position, sourceFile, rulesProvider, options) {
- return formatOutermostParent(position, 16, sourceFile, options, rulesProvider, 4);
- }
- formatting.formatOnClosingCurly = formatOnClosingCurly;
- function formatDocument(sourceFile, rulesProvider, options) {
- var span = {
- pos: 0,
- end: sourceFile.text.length
- };
- return formatSpan(span, sourceFile, options, rulesProvider, 0);
- }
- formatting.formatDocument = formatDocument;
- function formatSelection(start, end, sourceFile, rulesProvider, options) {
- var span = {
- pos: ts.getLineStartPositionForPosition(start, sourceFile),
- end: end
- };
- return formatSpan(span, sourceFile, options, rulesProvider, 1);
- }
- formatting.formatSelection = formatSelection;
- function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) {
- var parent = findOutermostParent(position, expectedLastToken, sourceFile);
- if (!parent) {
- return [];
+ var Rename;
+ (function (Rename) {
+ function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) {
+ var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName));
+ var node = ts.getTouchingWord(sourceFile, position, true);
+ if (node) {
+ if (node.kind === 70 ||
+ node.kind === 9 ||
+ ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||
+ ts.isThis(node)) {
+ var symbol = typeChecker.getSymbolAtLocation(node);
+ if (symbol) {
+ var declarations = symbol.getDeclarations();
+ if (declarations && declarations.length > 0) {
+ if (ts.forEach(declarations, isDefinedInLibraryFile)) {
+ return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));
+ }
+ var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node));
+ var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node);
+ if (kind) {
+ return {
+ canRename: true,
+ kind: kind,
+ displayName: displayName,
+ localizedErrorMessage: undefined,
+ fullDisplayName: typeChecker.getFullyQualifiedName(symbol),
+ kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
+ triggerSpan: createTriggerSpanForNode(node, sourceFile)
+ };
+ }
+ }
+ }
+ else if (node.kind === 9) {
+ var type = ts.getStringLiteralTypeForNode(node, typeChecker);
+ if (type) {
+ if (isDefinedInLibraryFile(node)) {
+ return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));
+ }
+ else {
+ var displayName = ts.stripQuotes(type.text);
+ return {
+ canRename: true,
+ kind: ts.ScriptElementKind.variableElement,
+ displayName: displayName,
+ localizedErrorMessage: undefined,
+ fullDisplayName: displayName,
+ kindModifiers: ts.ScriptElementKindModifier.none,
+ triggerSpan: createTriggerSpanForNode(node, sourceFile)
+ };
+ }
+ }
+ }
+ }
}
- var span = {
- pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile),
- end: parent.end
- };
- return formatSpan(span, sourceFile, options, rulesProvider, requestKind);
- }
- function findOutermostParent(position, expectedTokenKind, sourceFile) {
- var precedingToken = ts.findPrecedingToken(position, sourceFile);
- if (!precedingToken ||
- precedingToken.kind !== expectedTokenKind ||
- position !== precedingToken.getEnd()) {
- return undefined;
+ return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element));
+ function getRenameInfoError(localizedErrorMessage) {
+ return {
+ canRename: false,
+ localizedErrorMessage: localizedErrorMessage,
+ displayName: undefined,
+ fullDisplayName: undefined,
+ kind: undefined,
+ kindModifiers: undefined,
+ triggerSpan: undefined
+ };
}
- var current = precedingToken;
- while (current &&
- current.parent &&
- current.parent.end === precedingToken.end &&
- !isListElement(current.parent, current)) {
- current = current.parent;
+ function isDefinedInLibraryFile(declaration) {
+ if (defaultLibFileName) {
+ var sourceFile_1 = declaration.getSourceFile();
+ var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName));
+ if (canonicalName === canonicalDefaultLibName) {
+ return true;
+ }
+ }
+ return false;
}
- return current;
- }
- function isListElement(parent, node) {
- switch (parent.kind) {
- case 221:
- case 222:
- return ts.rangeContainsRange(parent.members, node);
- case 225:
- var body = parent.body;
- return body && body.kind === 226 && ts.rangeContainsRange(body.statements, node);
- case 256:
- case 199:
- case 226:
- return ts.rangeContainsRange(parent.statements, node);
- case 252:
- return ts.rangeContainsRange(parent.block.statements, node);
+ function createTriggerSpanForNode(node, sourceFile) {
+ var start = node.getStart(sourceFile);
+ var width = node.getWidth(sourceFile);
+ if (node.kind === 9) {
+ start += 1;
+ width -= 2;
+ }
+ return ts.createTextSpan(start, width);
}
- return false;
}
- function findEnclosingNode(range, sourceFile) {
- return find(sourceFile);
- function find(n) {
- var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; });
- if (candidate) {
- var result = find(candidate);
- if (result) {
- return result;
- }
+ Rename.getRenameInfo = getRenameInfo;
+ })(Rename = ts.Rename || (ts.Rename = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var SignatureHelp;
+ (function (SignatureHelp) {
+ var emptyArray = [];
+ (function (ArgumentListKind) {
+ ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments";
+ ArgumentListKind[ArgumentListKind["CallArguments"] = 1] = "CallArguments";
+ ArgumentListKind[ArgumentListKind["TaggedTemplateArguments"] = 2] = "TaggedTemplateArguments";
+ })(SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {}));
+ var ArgumentListKind = SignatureHelp.ArgumentListKind;
+ function getSignatureHelpItems(program, sourceFile, position, cancellationToken) {
+ var typeChecker = program.getTypeChecker();
+ var startingToken = ts.findTokenOnLeftOfPosition(sourceFile, position);
+ if (!startingToken) {
+ return undefined;
+ }
+ var argumentInfo = getContainingArgumentInfo(startingToken, position, sourceFile);
+ cancellationToken.throwIfCancellationRequested();
+ if (!argumentInfo) {
+ return undefined;
+ }
+ var call = argumentInfo.invocation;
+ var candidates = [];
+ var resolvedSignature = typeChecker.getResolvedSignature(call, candidates);
+ cancellationToken.throwIfCancellationRequested();
+ if (!candidates.length) {
+ if (ts.isSourceFileJavaScript(sourceFile)) {
+ return createJavaScriptSignatureHelpItems(argumentInfo, program);
}
- return n;
+ return undefined;
}
+ return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo, typeChecker);
}
- function prepareRangeContainsErrorFunction(errors, originalRange) {
- if (!errors.length) {
- return rangeHasNoErrors;
+ SignatureHelp.getSignatureHelpItems = getSignatureHelpItems;
+ function createJavaScriptSignatureHelpItems(argumentInfo, program) {
+ if (argumentInfo.invocation.kind !== 175) {
+ return undefined;
}
- var sorted = errors
- .filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); })
- .sort(function (e1, e2) { return e1.start - e2.start; });
- if (!sorted.length) {
- return rangeHasNoErrors;
+ var callExpression = argumentInfo.invocation;
+ var expression = callExpression.expression;
+ var name = expression.kind === 70
+ ? expression
+ : expression.kind === 173
+ ? expression.name
+ : undefined;
+ if (!name || !name.text) {
+ return undefined;
}
- var index = 0;
- return function (r) {
- while (true) {
- if (index >= sorted.length) {
- return false;
- }
- var error = sorted[index];
- if (r.end <= error.start) {
- return false;
- }
- if (ts.startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) {
- return true;
+ var typeChecker = program.getTypeChecker();
+ for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
+ var sourceFile = _a[_i];
+ var nameToDeclarations = sourceFile.getNamedDeclarations();
+ var declarations = nameToDeclarations[name.text];
+ if (declarations) {
+ for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) {
+ var declaration = declarations_10[_b];
+ var symbol = declaration.symbol;
+ if (symbol) {
+ var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);
+ if (type) {
+ var callSignatures = type.getCallSignatures();
+ if (callSignatures && callSignatures.length) {
+ return createSignatureHelpItems(callSignatures, callSignatures[0], argumentInfo, typeChecker);
+ }
+ }
+ }
}
- index++;
}
- };
- function rangeHasNoErrors(r) {
- return false;
}
}
- function getScanStartPosition(enclosingNode, originalRange, sourceFile) {
- var start = enclosingNode.getStart(sourceFile);
- if (start === originalRange.pos && enclosingNode.end === originalRange.end) {
- return start;
+ function getImmediatelyContainingArgumentInfo(node, position, sourceFile) {
+ if (node.parent.kind === 175 || node.parent.kind === 176) {
+ var callExpression = node.parent;
+ if (node.kind === 26 ||
+ node.kind === 18) {
+ var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile);
+ var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos;
+ ts.Debug.assert(list !== undefined);
+ return {
+ kind: isTypeArgList ? 0 : 1,
+ invocation: callExpression,
+ argumentsSpan: getApplicableSpanForArguments(list, sourceFile),
+ argumentIndex: 0,
+ argumentCount: getArgumentCount(list)
+ };
+ }
+ var listItemInfo = ts.findListItemInfo(node);
+ if (listItemInfo) {
+ var list = listItemInfo.list;
+ var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos;
+ var argumentIndex = getArgumentIndex(list, node);
+ var argumentCount = getArgumentCount(list);
+ ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex);
+ return {
+ kind: isTypeArgList ? 0 : 1,
+ invocation: callExpression,
+ argumentsSpan: getApplicableSpanForArguments(list, sourceFile),
+ argumentIndex: argumentIndex,
+ argumentCount: argumentCount
+ };
+ }
+ return undefined;
}
- var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile);
- if (!precedingToken) {
- return enclosingNode.pos;
+ else if (node.kind === 12 && node.parent.kind === 177) {
+ if (ts.isInsideTemplateLiteral(node, position)) {
+ return getArgumentListInfoForTemplate(node.parent, 0, sourceFile);
+ }
}
- if (precedingToken.end >= originalRange.pos) {
- return enclosingNode.pos;
+ else if (node.kind === 13 && node.parent.parent.kind === 177) {
+ var templateExpression = node.parent;
+ var tagExpression = templateExpression.parent;
+ ts.Debug.assert(templateExpression.kind === 190);
+ var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1;
+ return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);
}
- return precedingToken.end;
+ else if (node.parent.kind === 198 && node.parent.parent.parent.kind === 177) {
+ var templateSpan = node.parent;
+ var templateExpression = templateSpan.parent;
+ var tagExpression = templateExpression.parent;
+ ts.Debug.assert(templateExpression.kind === 190);
+ if (node.kind === 15 && !ts.isInsideTemplateLiteral(node, position)) {
+ return undefined;
+ }
+ var spanIndex = templateExpression.templateSpans.indexOf(templateSpan);
+ var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node, position);
+ return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);
+ }
+ return undefined;
}
- function getOwnOrInheritedDelta(n, options, sourceFile) {
- var previousLine = -1;
- var child;
- while (n) {
- var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line;
- if (previousLine !== -1 && line !== previousLine) {
+ function getArgumentIndex(argumentsList, node) {
+ var argumentIndex = 0;
+ var listChildren = argumentsList.getChildren();
+ for (var _i = 0, listChildren_1 = listChildren; _i < listChildren_1.length; _i++) {
+ var child = listChildren_1[_i];
+ if (child === node) {
break;
}
- if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) {
- return options.indentSize;
+ if (child.kind !== 25) {
+ argumentIndex++;
}
- previousLine = line;
- child = n;
- n = n.parent;
}
- return 0;
+ return argumentIndex;
}
- function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) {
- var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange);
- var formattingContext = new formatting.FormattingContext(sourceFile, requestKind);
- var enclosingNode = findEnclosingNode(originalRange, sourceFile);
- var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end);
- var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options);
- var previousRangeHasError;
- var previousRange;
- var previousParent;
- var previousRangeStartLine;
- var lastIndentedLine;
- var indentationOnLastIndentedLine;
- var edits = [];
- formattingScanner.advance();
- if (formattingScanner.isOnToken()) {
- var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line;
- var undecoratedStartLine = startLine;
- if (enclosingNode.decorators) {
- undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line;
+ function getArgumentCount(argumentsList) {
+ var listChildren = argumentsList.getChildren();
+ var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 25; });
+ if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 25) {
+ argumentCount++;
+ }
+ return argumentCount;
+ }
+ function getArgumentIndexForTemplatePiece(spanIndex, node, position) {
+ ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node.");
+ if (ts.isTemplateLiteralKind(node.kind)) {
+ if (ts.isInsideTemplateLiteral(node, position)) {
+ return 0;
}
- var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile);
- processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta);
+ return spanIndex + 2;
}
- if (!formattingScanner.isOnToken()) {
- var leadingTrivia = formattingScanner.getCurrentLeadingTrivia();
- if (leadingTrivia) {
- processTrivia(leadingTrivia, enclosingNode, enclosingNode, undefined);
- trimTrailingWhitespacesForRemainingRange();
+ return spanIndex + 1;
+ }
+ function getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile) {
+ var argumentCount = tagExpression.template.kind === 12
+ ? 1
+ : tagExpression.template.templateSpans.length + 1;
+ ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex);
+ return {
+ kind: 2,
+ invocation: tagExpression,
+ argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression, sourceFile),
+ argumentIndex: argumentIndex,
+ argumentCount: argumentCount
+ };
+ }
+ function getApplicableSpanForArguments(argumentsList, sourceFile) {
+ var applicableSpanStart = argumentsList.getFullStart();
+ var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), false);
+ return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
+ }
+ function getApplicableSpanForTaggedTemplate(taggedTemplate, sourceFile) {
+ var template = taggedTemplate.template;
+ var applicableSpanStart = template.getStart();
+ var applicableSpanEnd = template.getEnd();
+ if (template.kind === 190) {
+ var lastSpan = ts.lastOrUndefined(template.templateSpans);
+ if (lastSpan.literal.getFullWidth() === 0) {
+ applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false);
}
}
- formattingScanner.close();
- return edits;
- function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) {
- if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) ||
- ts.rangeContainsStartEnd(range, startPos, endPos)) {
- if (inheritedIndentation !== -1) {
- return inheritedIndentation;
- }
+ return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
+ }
+ function getContainingArgumentInfo(node, position, sourceFile) {
+ for (var n = node; n.kind !== 256; n = n.parent) {
+ if (ts.isFunctionBlock(n)) {
+ return undefined;
}
- else {
- var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line;
- var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile);
- var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options);
- if (startLine !== parentStartLine || startPos === column) {
- var baseIndentSize = formatting.SmartIndenter.getBaseIndentation(options);
- return baseIndentSize > column ? baseIndentSize : column;
- }
+ if (n.pos < n.parent.pos || n.end > n.parent.end) {
+ ts.Debug.fail("Node of kind " + n.kind + " is not a subspan of its parent of kind " + n.parent.kind);
+ }
+ var argumentInfo = getImmediatelyContainingArgumentInfo(n, position, sourceFile);
+ if (argumentInfo) {
+ return argumentInfo;
}
- return -1;
}
- function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) {
- var indentation = inheritedIndentation;
- var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0;
- if (effectiveParentStartLine === startLine) {
- indentation = startLine === lastIndentedLine
- ? indentationOnLastIndentedLine
- : parentDynamicIndentation.getIndentation();
- delta = Math.min(options.indentSize, parentDynamicIndentation.getDelta(node) + delta);
+ return undefined;
+ }
+ SignatureHelp.getContainingArgumentInfo = getContainingArgumentInfo;
+ function getChildListThatStartsWithOpenerToken(parent, openerToken, sourceFile) {
+ var children = parent.getChildren(sourceFile);
+ var indexOfOpenerToken = children.indexOf(openerToken);
+ ts.Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1);
+ return children[indexOfOpenerToken + 1];
+ }
+ function selectBestInvalidOverloadIndex(candidates, argumentCount) {
+ var maxParamsSignatureIndex = -1;
+ var maxParams = -1;
+ for (var i = 0; i < candidates.length; i++) {
+ var candidate = candidates[i];
+ if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) {
+ return i;
}
- else if (indentation === -1) {
- if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) {
- indentation = parentDynamicIndentation.getIndentation();
- }
- else {
- indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node);
- }
+ if (candidate.parameters.length > maxParams) {
+ maxParams = candidate.parameters.length;
+ maxParamsSignatureIndex = i;
}
- return {
- indentation: indentation,
- delta: delta
- };
}
- function getFirstNonDecoratorTokenOfNode(node) {
- if (node.modifiers && node.modifiers.length) {
- return node.modifiers[0].kind;
+ return maxParamsSignatureIndex;
+ }
+ function createSignatureHelpItems(candidates, bestSignature, argumentListInfo, typeChecker) {
+ var applicableSpan = argumentListInfo.argumentsSpan;
+ var isTypeParameterList = argumentListInfo.kind === 0;
+ var invocation = argumentListInfo.invocation;
+ var callTarget = ts.getInvokedExpression(invocation);
+ var callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget);
+ var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeChecker, callTargetSymbol, undefined, undefined);
+ var items = ts.map(candidates, function (candidateSignature) {
+ var signatureHelpParameters;
+ var prefixDisplayParts = [];
+ var suffixDisplayParts = [];
+ if (callTargetDisplayParts) {
+ ts.addRange(prefixDisplayParts, callTargetDisplayParts);
}
- switch (node.kind) {
- case 221: return 73;
- case 222: return 107;
- case 220: return 87;
- case 224: return 224;
- case 149: return 123;
- case 150: return 131;
- case 147:
- if (node.asteriskToken) {
- return 37;
- }
- case 145:
- case 142:
- return node.name.kind;
+ if (isTypeParameterList) {
+ prefixDisplayParts.push(ts.punctuationPart(26));
+ var typeParameters = candidateSignature.typeParameters;
+ signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray;
+ suffixDisplayParts.push(ts.punctuationPart(28));
+ var parameterParts = ts.mapToDisplayParts(function (writer) {
+ return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisParameter, candidateSignature.parameters, writer, invocation);
+ });
+ ts.addRange(suffixDisplayParts, parameterParts);
+ }
+ else {
+ var typeParameterParts = ts.mapToDisplayParts(function (writer) {
+ return typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation);
+ });
+ ts.addRange(prefixDisplayParts, typeParameterParts);
+ prefixDisplayParts.push(ts.punctuationPart(18));
+ var parameters = candidateSignature.parameters;
+ signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray;
+ suffixDisplayParts.push(ts.punctuationPart(19));
}
+ var returnTypeParts = ts.mapToDisplayParts(function (writer) {
+ return typeChecker.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation);
+ });
+ ts.addRange(suffixDisplayParts, returnTypeParts);
+ return {
+ isVariadic: candidateSignature.hasRestParameter,
+ prefixDisplayParts: prefixDisplayParts,
+ suffixDisplayParts: suffixDisplayParts,
+ separatorDisplayParts: [ts.punctuationPart(25), ts.spacePart()],
+ parameters: signatureHelpParameters,
+ documentation: candidateSignature.getDocumentationComment()
+ };
+ });
+ var argumentIndex = argumentListInfo.argumentIndex;
+ var argumentCount = argumentListInfo.argumentCount;
+ var selectedItemIndex = candidates.indexOf(bestSignature);
+ if (selectedItemIndex < 0) {
+ selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount);
}
- function getDynamicIndentation(node, nodeStartLine, indentation, delta) {
+ ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex);
+ return {
+ items: items,
+ applicableSpan: applicableSpan,
+ selectedItemIndex: selectedItemIndex,
+ argumentIndex: argumentIndex,
+ argumentCount: argumentCount
+ };
+ function createSignatureHelpParameterForParameter(parameter) {
+ var displayParts = ts.mapToDisplayParts(function (writer) {
+ return typeChecker.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation);
+ });
return {
- getIndentationForComment: function (kind, tokenIndentation, container) {
- switch (kind) {
- case 16:
- case 20:
- case 18:
- return indentation + getEffectiveDelta(delta, container);
- }
- return tokenIndentation !== -1 ? tokenIndentation : indentation;
- },
- getIndentationForToken: function (line, kind, container) {
- if (nodeStartLine !== line && node.decorators) {
- if (kind === getFirstNonDecoratorTokenOfNode(node)) {
- return indentation;
- }
- }
- switch (kind) {
- case 15:
- case 16:
- case 19:
- case 20:
- case 17:
- case 18:
- case 80:
- case 104:
- case 55:
- return indentation;
- default:
- return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation;
- }
- },
- getIndentation: function () { return indentation; },
- getDelta: function (child) { return getEffectiveDelta(delta, child); },
- recomputeIndentation: function (lineAdded) {
- if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) {
- if (lineAdded) {
- indentation += options.indentSize;
- }
- else {
- indentation -= options.indentSize;
- }
- if (formatting.SmartIndenter.shouldIndentChildNode(node)) {
- delta = options.indentSize;
- }
- else {
- delta = 0;
- }
- }
- }
+ name: parameter.name,
+ documentation: parameter.getDocumentationComment(),
+ displayParts: displayParts,
+ isOptional: typeChecker.isOptionalParameter(parameter.valueDeclaration)
};
- function getEffectiveDelta(delta, child) {
- return formatting.SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0;
- }
}
- function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) {
- if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) {
- return;
- }
- var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta);
- var childContextNode = contextNode;
- ts.forEachChild(node, function (child) {
- processChildNode(child, -1, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, false);
- }, function (nodes) {
- processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);
+ function createSignatureHelpParameterForTypeParameter(typeParameter) {
+ var displayParts = ts.mapToDisplayParts(function (writer) {
+ return typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation);
});
- while (formattingScanner.isOnToken()) {
- var tokenInfo = formattingScanner.readTokenInfo(node);
- if (tokenInfo.token.end > node.end) {
- break;
- }
- consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation);
+ return {
+ name: typeParameter.symbol.name,
+ documentation: emptyArray,
+ displayParts: displayParts,
+ isOptional: false
+ };
+ }
+ }
+ })(SignatureHelp = ts.SignatureHelp || (ts.SignatureHelp = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var SymbolDisplay;
+ (function (SymbolDisplay) {
+ function getSymbolKind(typeChecker, symbol, location) {
+ var flags = symbol.getFlags();
+ if (flags & 32)
+ return ts.getDeclarationOfKind(symbol, 193) ?
+ ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement;
+ if (flags & 384)
+ return ts.ScriptElementKind.enumElement;
+ if (flags & 524288)
+ return ts.ScriptElementKind.typeElement;
+ if (flags & 64)
+ return ts.ScriptElementKind.interfaceElement;
+ if (flags & 262144)
+ return ts.ScriptElementKind.typeParameterElement;
+ var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location);
+ if (result === ts.ScriptElementKind.unknown) {
+ if (flags & 262144)
+ return ts.ScriptElementKind.typeParameterElement;
+ if (flags & 8)
+ return ts.ScriptElementKind.variableElement;
+ if (flags & 8388608)
+ return ts.ScriptElementKind.alias;
+ if (flags & 1536)
+ return ts.ScriptElementKind.moduleElement;
+ }
+ return result;
+ }
+ SymbolDisplay.getSymbolKind = getSymbolKind;
+ function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location) {
+ if (typeChecker.isUndefinedSymbol(symbol)) {
+ return ts.ScriptElementKind.variableElement;
+ }
+ if (typeChecker.isArgumentsSymbol(symbol)) {
+ return ts.ScriptElementKind.localVariableElement;
+ }
+ if (location.kind === 98 && ts.isExpression(location)) {
+ return ts.ScriptElementKind.parameterElement;
+ }
+ if (flags & 3) {
+ if (ts.isFirstDeclarationOfSymbolParameter(symbol)) {
+ return ts.ScriptElementKind.parameterElement;
}
- function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
- var childStartPos = child.getStart(sourceFile);
- var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
- var undecoratedChildStartLine = childStartLine;
- if (child.decorators) {
- undecoratedChildStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(child, sourceFile)).line;
- }
- var childIndentationAmount = -1;
- if (isListItem) {
- childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation);
- if (childIndentationAmount !== -1) {
- inheritedIndentation = childIndentationAmount;
+ else if (symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration)) {
+ return ts.ScriptElementKind.constElement;
+ }
+ else if (ts.forEach(symbol.declarations, ts.isLet)) {
+ return ts.ScriptElementKind.letElement;
+ }
+ return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localVariableElement : ts.ScriptElementKind.variableElement;
+ }
+ if (flags & 16)
+ return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localFunctionElement : ts.ScriptElementKind.functionElement;
+ if (flags & 32768)
+ return ts.ScriptElementKind.memberGetAccessorElement;
+ if (flags & 65536)
+ return ts.ScriptElementKind.memberSetAccessorElement;
+ if (flags & 8192)
+ return ts.ScriptElementKind.memberFunctionElement;
+ if (flags & 16384)
+ return ts.ScriptElementKind.constructorImplementationElement;
+ if (flags & 4) {
+ if (flags & 268435456) {
+ var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) {
+ var rootSymbolFlags = rootSymbol.getFlags();
+ if (rootSymbolFlags & (98308 | 3)) {
+ return ts.ScriptElementKind.memberVariableElement;
}
- }
- if (!ts.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) {
- if (child.end < originalRange.pos) {
- formattingScanner.skipToEndOf(child);
+ ts.Debug.assert(!!(rootSymbolFlags & 8192));
+ });
+ if (!unionPropertyKind) {
+ var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
+ if (typeOfUnionProperty.getCallSignatures().length) {
+ return ts.ScriptElementKind.memberFunctionElement;
}
- return inheritedIndentation;
- }
- if (child.getFullWidth() === 0) {
- return inheritedIndentation;
+ return ts.ScriptElementKind.memberVariableElement;
}
- while (formattingScanner.isOnToken()) {
- var tokenInfo = formattingScanner.readTokenInfo(node);
- if (tokenInfo.token.end > childStartPos) {
- break;
+ return unionPropertyKind;
+ }
+ return ts.ScriptElementKind.memberVariableElement;
+ }
+ return ts.ScriptElementKind.unknown;
+ }
+ function getSymbolModifiers(symbol) {
+ return symbol && symbol.declarations && symbol.declarations.length > 0
+ ? ts.getNodeModifiers(symbol.declarations[0])
+ : ts.ScriptElementKindModifier.none;
+ }
+ SymbolDisplay.getSymbolModifiers = getSymbolModifiers;
+ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning) {
+ if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); }
+ var displayParts = [];
+ var documentation;
+ var symbolFlags = symbol.flags;
+ var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, symbolFlags, location);
+ var hasAddedSymbolInfo;
+ var isThisExpression = location.kind === 98 && ts.isExpression(location);
+ var type;
+ if (symbolKind !== ts.ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) {
+ if (symbolKind === ts.ScriptElementKind.memberGetAccessorElement || symbolKind === ts.ScriptElementKind.memberSetAccessorElement) {
+ symbolKind = ts.ScriptElementKind.memberVariableElement;
+ }
+ var signature = void 0;
+ type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
+ if (type) {
+ if (location.parent && location.parent.kind === 173) {
+ var right = location.parent.name;
+ if (right === location || (right && right.getFullWidth() === 0)) {
+ location = location.parent;
}
- consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation);
- }
- if (!formattingScanner.isOnToken()) {
- return inheritedIndentation;
}
- if (ts.isToken(child)) {
- var tokenInfo = formattingScanner.readTokenInfo(child);
- ts.Debug.assert(tokenInfo.token.end === child.end);
- consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child);
- return inheritedIndentation;
+ var callExpression = void 0;
+ if (location.kind === 175 || location.kind === 176) {
+ callExpression = location;
}
- var effectiveParentStartLine = child.kind === 143 ? childStartLine : undecoratedParentStartLine;
- var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine);
- processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta);
- childContextNode = node;
- if (isFirstListItem && parent.kind === 170 && inheritedIndentation === -1) {
- inheritedIndentation = childIndentation.indentation;
+ else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) {
+ callExpression = location.parent;
}
- return inheritedIndentation;
- }
- function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) {
- var listStartToken = getOpenTokenForList(parent, nodes);
- var listEndToken = getCloseTokenForOpenToken(listStartToken);
- var listDynamicIndentation = parentDynamicIndentation;
- var startLine = parentStartLine;
- if (listStartToken !== 0) {
- while (formattingScanner.isOnToken()) {
- var tokenInfo = formattingScanner.readTokenInfo(parent);
- if (tokenInfo.token.end > nodes.pos) {
- break;
+ if (callExpression) {
+ var candidateSignatures = [];
+ signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures);
+ if (!signature && candidateSignatures.length) {
+ signature = candidateSignatures[0];
+ }
+ var useConstructSignatures = callExpression.kind === 176 || callExpression.expression.kind === 96;
+ var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
+ if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) {
+ signature = allSignatures.length ? allSignatures[0] : undefined;
+ }
+ if (signature) {
+ if (useConstructSignatures && (symbolFlags & 32)) {
+ symbolKind = ts.ScriptElementKind.constructorImplementationElement;
+ addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
}
- else if (tokenInfo.token.kind === listStartToken) {
- startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
- var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, parentStartLine);
- listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta);
- consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);
+ else if (symbolFlags & 8388608) {
+ symbolKind = ts.ScriptElementKind.alias;
+ pushTypePart(symbolKind);
+ displayParts.push(ts.spacePart());
+ if (useConstructSignatures) {
+ displayParts.push(ts.keywordPart(93));
+ displayParts.push(ts.spacePart());
+ }
+ addFullSymbolName(symbol);
}
else {
- consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation);
+ addPrefixForAnyFunctionOrVar(symbol, symbolKind);
}
- }
- }
- var inheritedIndentation = -1;
- for (var i = 0; i < nodes.length; i++) {
- var child = nodes[i];
- inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, true, i === 0);
- }
- if (listEndToken !== 0) {
- if (formattingScanner.isOnToken()) {
- var tokenInfo = formattingScanner.readTokenInfo(parent);
- if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) {
- consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);
+ switch (symbolKind) {
+ case ts.ScriptElementKind.memberVariableElement:
+ case ts.ScriptElementKind.variableElement:
+ case ts.ScriptElementKind.constElement:
+ case ts.ScriptElementKind.letElement:
+ case ts.ScriptElementKind.parameterElement:
+ case ts.ScriptElementKind.localVariableElement:
+ displayParts.push(ts.punctuationPart(55));
+ displayParts.push(ts.spacePart());
+ if (useConstructSignatures) {
+ displayParts.push(ts.keywordPart(93));
+ displayParts.push(ts.spacePart());
+ }
+ if (!(type.flags & 2097152) && type.symbol) {
+ ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, undefined, 1));
+ }
+ addSignatureDisplayParts(signature, allSignatures, 8);
+ break;
+ default:
+ addSignatureDisplayParts(signature, allSignatures);
}
+ hasAddedSymbolInfo = true;
}
}
- }
- function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation, container) {
- ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token));
- var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine();
- var indentToken = false;
- if (currentTokenInfo.leadingTrivia) {
- processTrivia(currentTokenInfo.leadingTrivia, parent, childContextNode, dynamicIndentation);
- }
- var lineAdded;
- var isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token);
- var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos);
- if (isTokenInRange) {
- var rangeHasError = rangeContainsError(currentTokenInfo.token);
- var savePreviousRange = previousRange;
- lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation);
- if (rangeHasError) {
- indentToken = false;
+ else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) ||
+ (location.kind === 122 && location.parent.kind === 149)) {
+ var functionDeclaration = location.parent;
+ var allSignatures = functionDeclaration.kind === 149 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
+ if (!typeChecker.isImplementationOfOverload(functionDeclaration)) {
+ signature = typeChecker.getSignatureFromDeclaration(functionDeclaration);
}
else {
- if (lineAdded !== undefined) {
- indentToken = lineAdded;
- }
- else {
- var prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line;
- indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine;
- }
+ signature = allSignatures[0];
}
- }
- if (currentTokenInfo.trailingTrivia) {
- processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation);
- }
- if (indentToken) {
- var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ?
- dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) :
- -1;
- var indentNextTokenOrTrivia = true;
- if (currentTokenInfo.leadingTrivia) {
- var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container);
- for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) {
- var triviaItem = _a[_i];
- var triviaInRange = ts.rangeContainsRange(originalRange, triviaItem);
- switch (triviaItem.kind) {
- case 3:
- if (triviaInRange) {
- indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia);
- }
- indentNextTokenOrTrivia = false;
- break;
- case 2:
- if (indentNextTokenOrTrivia && triviaInRange) {
- insertIndentation(triviaItem.pos, commentIndentation, false);
- }
- indentNextTokenOrTrivia = false;
- break;
- case 4:
- indentNextTokenOrTrivia = true;
- break;
- }
- }
+ if (functionDeclaration.kind === 149) {
+ symbolKind = ts.ScriptElementKind.constructorImplementationElement;
+ addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
}
- if (tokenIndentation !== -1 && indentNextTokenOrTrivia) {
- insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded);
- lastIndentedLine = tokenStart.line;
- indentationOnLastIndentedLine = tokenIndentation;
+ else {
+ addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 152 &&
+ !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind);
}
+ addSignatureDisplayParts(signature, allSignatures);
+ hasAddedSymbolInfo = true;
}
- formattingScanner.advance();
- childContextNode = parent;
}
}
- function processTrivia(trivia, parent, contextNode, dynamicIndentation) {
- for (var _i = 0, trivia_1 = trivia; _i < trivia_1.length; _i++) {
- var triviaItem = trivia_1[_i];
- if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) {
- var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos);
- processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation);
- }
+ if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) {
+ if (ts.getDeclarationOfKind(symbol, 193)) {
+ pushTypePart(ts.ScriptElementKind.localClassElement);
+ }
+ else {
+ displayParts.push(ts.keywordPart(74));
}
+ displayParts.push(ts.spacePart());
+ addFullSymbolName(symbol);
+ writeTypeParametersOfSymbol(symbol, sourceFile);
}
- function processRange(range, rangeStart, parent, contextNode, dynamicIndentation) {
- var rangeHasError = rangeContainsError(range);
- var lineAdded;
- if (!rangeHasError && !previousRangeHasError) {
- if (!previousRange) {
- var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos);
- trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line);
- }
- else {
- lineAdded =
- processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation);
- }
+ if ((symbolFlags & 64) && (semanticMeaning & 2)) {
+ addNewLineIfDisplayPartsExist();
+ displayParts.push(ts.keywordPart(108));
+ displayParts.push(ts.spacePart());
+ addFullSymbolName(symbol);
+ writeTypeParametersOfSymbol(symbol, sourceFile);
+ }
+ if (symbolFlags & 524288) {
+ addNewLineIfDisplayPartsExist();
+ displayParts.push(ts.keywordPart(135));
+ displayParts.push(ts.spacePart());
+ addFullSymbolName(symbol);
+ writeTypeParametersOfSymbol(symbol, sourceFile);
+ displayParts.push(ts.spacePart());
+ displayParts.push(ts.operatorPart(57));
+ displayParts.push(ts.spacePart());
+ ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 512));
+ }
+ if (symbolFlags & 384) {
+ addNewLineIfDisplayPartsExist();
+ if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) {
+ displayParts.push(ts.keywordPart(75));
+ displayParts.push(ts.spacePart());
}
- previousRange = range;
- previousParent = parent;
- previousRangeStartLine = rangeStart.line;
- previousRangeHasError = rangeHasError;
- return lineAdded;
+ displayParts.push(ts.keywordPart(82));
+ displayParts.push(ts.spacePart());
+ addFullSymbolName(symbol);
}
- function processPair(currentItem, currentStartLine, currentParent, previousItem, previousStartLine, previousParent, contextNode, dynamicIndentation) {
- formattingContext.updateContext(previousItem, previousParent, currentItem, currentParent, contextNode);
- var rule = rulesProvider.getRulesMap().GetRule(formattingContext);
- var trimTrailingWhitespaces;
- var lineAdded;
- if (rule) {
- applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine);
- if (rule.Operation.Action & (2 | 8) && currentStartLine !== previousStartLine) {
- lineAdded = false;
- if (currentParent.getStart(sourceFile) === currentItem.pos) {
- dynamicIndentation.recomputeIndentation(false);
+ if (symbolFlags & 1536) {
+ addNewLineIfDisplayPartsExist();
+ var declaration = ts.getDeclarationOfKind(symbol, 226);
+ var isNamespace = declaration && declaration.name && declaration.name.kind === 70;
+ displayParts.push(ts.keywordPart(isNamespace ? 127 : 126));
+ displayParts.push(ts.spacePart());
+ addFullSymbolName(symbol);
+ }
+ if ((symbolFlags & 262144) && (semanticMeaning & 2)) {
+ addNewLineIfDisplayPartsExist();
+ displayParts.push(ts.punctuationPart(18));
+ displayParts.push(ts.textPart("type parameter"));
+ displayParts.push(ts.punctuationPart(19));
+ displayParts.push(ts.spacePart());
+ addFullSymbolName(symbol);
+ displayParts.push(ts.spacePart());
+ displayParts.push(ts.keywordPart(91));
+ displayParts.push(ts.spacePart());
+ if (symbol.parent) {
+ addFullSymbolName(symbol.parent, enclosingDeclaration);
+ writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration);
+ }
+ else {
+ var declaration = ts.getDeclarationOfKind(symbol, 142);
+ ts.Debug.assert(declaration !== undefined);
+ declaration = declaration.parent;
+ if (declaration) {
+ if (ts.isFunctionLikeKind(declaration.kind)) {
+ var signature = typeChecker.getSignatureFromDeclaration(declaration);
+ if (declaration.kind === 153) {
+ displayParts.push(ts.keywordPart(93));
+ displayParts.push(ts.spacePart());
+ }
+ else if (declaration.kind !== 152 && declaration.name) {
+ addFullSymbolName(declaration.symbol);
+ }
+ ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32));
}
- }
- else if (rule.Operation.Action & 4 && currentStartLine === previousStartLine) {
- lineAdded = true;
- if (currentParent.getStart(sourceFile) === currentItem.pos) {
- dynamicIndentation.recomputeIndentation(true);
+ else {
+ displayParts.push(ts.keywordPart(135));
+ displayParts.push(ts.spacePart());
+ addFullSymbolName(declaration.symbol);
+ writeTypeParametersOfSymbol(declaration.symbol, sourceFile);
}
}
- trimTrailingWhitespaces = !(rule.Operation.Action & 8) && rule.Flag !== 1;
- }
- else {
- trimTrailingWhitespaces = true;
- }
- if (currentStartLine !== previousStartLine && trimTrailingWhitespaces) {
- trimTrailingWhitespacesForLines(previousStartLine, currentStartLine, previousItem);
}
- return lineAdded;
}
- function insertIndentation(pos, indentation, lineAdded) {
- var indentationString = getIndentationString(indentation, options);
- if (lineAdded) {
- recordReplace(pos, 0, indentationString);
- }
- else {
- var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos);
- var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile);
- if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) {
- recordReplace(startLinePosition, tokenStart.character, indentationString);
+ if (symbolFlags & 8) {
+ addPrefixForAnyFunctionOrVar(symbol, "enum member");
+ var declaration = symbol.declarations[0];
+ if (declaration.kind === 255) {
+ var constantValue = typeChecker.getConstantValue(declaration);
+ if (constantValue !== undefined) {
+ displayParts.push(ts.spacePart());
+ displayParts.push(ts.operatorPart(57));
+ displayParts.push(ts.spacePart());
+ displayParts.push(ts.displayPart(constantValue.toString(), ts.SymbolDisplayPartKind.numericLiteral));
}
}
}
- function indentationIsDifferent(indentationString, startLinePosition) {
- return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length);
- }
- function indentMultilineComment(commentRange, indentation, firstLineIsIndented) {
- var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line;
- var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line;
- var parts;
- if (startLine === endLine) {
- if (!firstLineIsIndented) {
- insertIndentation(commentRange.pos, indentation, false);
- }
- return;
+ if (symbolFlags & 8388608) {
+ addNewLineIfDisplayPartsExist();
+ if (symbol.declarations[0].kind === 229) {
+ displayParts.push(ts.keywordPart(83));
+ displayParts.push(ts.spacePart());
+ displayParts.push(ts.keywordPart(127));
}
else {
- parts = [];
- var startPos = commentRange.pos;
- for (var line = startLine; line < endLine; line++) {
- var endOfLine = ts.getEndLinePosition(line, sourceFile);
- parts.push({ pos: startPos, end: endOfLine });
- startPos = ts.getStartPositionOfLine(line + 1, sourceFile);
- }
- parts.push({ pos: startPos, end: commentRange.end });
- }
- var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile);
- var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options);
- if (indentation === nonWhitespaceColumnInFirstPart.column) {
- return;
+ displayParts.push(ts.keywordPart(90));
}
- var startIndex = 0;
- if (firstLineIsIndented) {
- startIndex = 1;
- startLine++;
- }
- var delta = indentation - nonWhitespaceColumnInFirstPart.column;
- for (var i = startIndex, len = parts.length; i < len; i++, startLine++) {
- var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile);
- var nonWhitespaceCharacterAndColumn = i === 0
- ? nonWhitespaceColumnInFirstPart
- : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options);
- var newIndentation = nonWhitespaceCharacterAndColumn.column + delta;
- if (newIndentation > 0) {
- var indentationString = getIndentationString(newIndentation, options);
- recordReplace(startLinePos_1, nonWhitespaceCharacterAndColumn.character, indentationString);
+ displayParts.push(ts.spacePart());
+ addFullSymbolName(symbol);
+ ts.forEach(symbol.declarations, function (declaration) {
+ if (declaration.kind === 230) {
+ var importEqualsDeclaration = declaration;
+ if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) {
+ displayParts.push(ts.spacePart());
+ displayParts.push(ts.operatorPart(57));
+ displayParts.push(ts.spacePart());
+ displayParts.push(ts.keywordPart(130));
+ displayParts.push(ts.punctuationPart(18));
+ displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral));
+ displayParts.push(ts.punctuationPart(19));
+ }
+ else {
+ var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference);
+ if (internalAliasSymbol) {
+ displayParts.push(ts.spacePart());
+ displayParts.push(ts.operatorPart(57));
+ displayParts.push(ts.spacePart());
+ addFullSymbolName(internalAliasSymbol, enclosingDeclaration);
+ }
+ }
+ return true;
}
- else {
- recordDelete(startLinePos_1, nonWhitespaceCharacterAndColumn.character);
+ });
+ }
+ if (!hasAddedSymbolInfo) {
+ if (symbolKind !== ts.ScriptElementKind.unknown) {
+ if (type) {
+ if (isThisExpression) {
+ addNewLineIfDisplayPartsExist();
+ displayParts.push(ts.keywordPart(98));
+ }
+ else {
+ addPrefixForAnyFunctionOrVar(symbol, symbolKind);
+ }
+ if (symbolKind === ts.ScriptElementKind.memberVariableElement ||
+ symbolFlags & 3 ||
+ symbolKind === ts.ScriptElementKind.localVariableElement ||
+ isThisExpression) {
+ displayParts.push(ts.punctuationPart(55));
+ displayParts.push(ts.spacePart());
+ if (type.symbol && type.symbol.flags & 262144) {
+ var typeParameterParts = ts.mapToDisplayParts(function (writer) {
+ typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration);
+ });
+ ts.addRange(displayParts, typeParameterParts);
+ }
+ else {
+ ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, type, enclosingDeclaration));
+ }
+ }
+ else if (symbolFlags & 16 ||
+ symbolFlags & 8192 ||
+ symbolFlags & 16384 ||
+ symbolFlags & 131072 ||
+ symbolFlags & 98304 ||
+ symbolKind === ts.ScriptElementKind.memberFunctionElement) {
+ var allSignatures = type.getNonNullableType().getCallSignatures();
+ addSignatureDisplayParts(allSignatures[0], allSignatures);
+ }
}
}
+ else {
+ symbolKind = getSymbolKind(typeChecker, symbol, location);
+ }
}
- function trimTrailingWhitespacesForLines(line1, line2, range) {
- for (var line = line1; line < line2; line++) {
- var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile);
- var lineEndPosition = ts.getEndLinePosition(line, sourceFile);
- if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) {
- continue;
- }
- var whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition);
- if (whitespaceStart !== -1) {
- ts.Debug.assert(whitespaceStart === lineStartPosition || !ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(whitespaceStart - 1)));
- recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart);
+ if (!documentation) {
+ documentation = symbol.getDocumentationComment();
+ if (documentation.length === 0 && symbol.flags & 4) {
+ if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 256; })) {
+ for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
+ var declaration = _a[_i];
+ if (!declaration.parent || declaration.parent.kind !== 188) {
+ continue;
+ }
+ var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right);
+ if (!rhsSymbol) {
+ continue;
+ }
+ documentation = rhsSymbol.getDocumentationComment();
+ if (documentation.length > 0) {
+ break;
+ }
+ }
}
}
}
- function getTrailingWhitespaceStartPosition(start, end) {
- var pos = end;
- while (pos >= start && ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(pos))) {
- pos--;
- }
- if (pos !== end) {
- return pos + 1;
+ return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind };
+ function addNewLineIfDisplayPartsExist() {
+ if (displayParts.length) {
+ displayParts.push(ts.lineBreakPart());
}
- return -1;
- }
- function trimTrailingWhitespacesForRemainingRange() {
- var startPosition = previousRange ? previousRange.end : originalRange.pos;
- var startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line;
- var endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line;
- trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange);
}
- function newTextChange(start, len, newText) {
- return { span: ts.createTextSpan(start, len), newText: newText };
- }
- function recordDelete(start, len) {
- if (len) {
- edits.push(newTextChange(start, len, ""));
- }
+ function addFullSymbolName(symbol, enclosingDeclaration) {
+ var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, undefined, 1 | 2);
+ ts.addRange(displayParts, fullSymbolDisplayParts);
}
- function recordReplace(start, len, newText) {
- if (len || newText) {
- edits.push(newTextChange(start, len, newText));
+ function addPrefixForAnyFunctionOrVar(symbol, symbolKind) {
+ addNewLineIfDisplayPartsExist();
+ if (symbolKind) {
+ pushTypePart(symbolKind);
+ displayParts.push(ts.spacePart());
+ addFullSymbolName(symbol);
}
}
- function applyRuleEdits(rule, previousRange, previousStartLine, currentRange, currentStartLine) {
- switch (rule.Operation.Action) {
- case 1:
+ function pushTypePart(symbolKind) {
+ switch (symbolKind) {
+ case ts.ScriptElementKind.variableElement:
+ case ts.ScriptElementKind.functionElement:
+ case ts.ScriptElementKind.letElement:
+ case ts.ScriptElementKind.constElement:
+ case ts.ScriptElementKind.constructorImplementationElement:
+ displayParts.push(ts.textOrKeywordPart(symbolKind));
+ return;
+ default:
+ displayParts.push(ts.punctuationPart(18));
+ displayParts.push(ts.textOrKeywordPart(symbolKind));
+ displayParts.push(ts.punctuationPart(19));
return;
- case 8:
- if (previousRange.end !== currentRange.pos) {
- recordDelete(previousRange.end, currentRange.pos - previousRange.end);
- }
- break;
- case 4:
- if (rule.Flag !== 1 && previousStartLine !== currentStartLine) {
- return;
- }
- var lineDelta = currentStartLine - previousStartLine;
- if (lineDelta !== 1) {
- recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter);
- }
- break;
- case 2:
- if (rule.Flag !== 1 && previousStartLine !== currentStartLine) {
- return;
- }
- var posDelta = currentRange.pos - previousRange.end;
- if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange.end) !== 32) {
- recordReplace(previousRange.end, currentRange.pos - previousRange.end, " ");
- }
- break;
}
}
- }
- function getOpenTokenForList(node, list) {
- switch (node.kind) {
- case 148:
- case 220:
- case 179:
- case 147:
- case 146:
- case 180:
- if (node.typeParameters === list) {
- return 25;
- }
- else if (node.parameters === list) {
- return 17;
- }
- break;
- case 174:
- case 175:
- if (node.typeArguments === list) {
- return 25;
- }
- else if (node.arguments === list) {
- return 17;
- }
- break;
- case 155:
- if (node.typeArguments === list) {
- return 25;
- }
+ function addSignatureDisplayParts(signature, allSignatures, flags) {
+ ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32));
+ if (allSignatures.length > 1) {
+ displayParts.push(ts.spacePart());
+ displayParts.push(ts.punctuationPart(18));
+ displayParts.push(ts.operatorPart(36));
+ displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), ts.SymbolDisplayPartKind.numericLiteral));
+ displayParts.push(ts.spacePart());
+ displayParts.push(ts.textPart(allSignatures.length === 2 ? "overload" : "overloads"));
+ displayParts.push(ts.punctuationPart(19));
+ }
+ documentation = signature.getDocumentationComment();
}
- return 0;
- }
- function getCloseTokenForOpenToken(kind) {
- switch (kind) {
- case 17:
- return 18;
- case 25:
- return 27;
+ function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) {
+ var typeParameterParts = ts.mapToDisplayParts(function (writer) {
+ typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration);
+ });
+ ts.addRange(displayParts, typeParameterParts);
}
- return 0;
}
- var internedSizes;
- var internedTabsIndentation;
- var internedSpacesIndentation;
- function getIndentationString(indentation, options) {
- var resetInternedStrings = !internedSizes || (internedSizes.tabSize !== options.tabSize || internedSizes.indentSize !== options.indentSize);
- if (resetInternedStrings) {
- internedSizes = { tabSize: options.tabSize, indentSize: options.indentSize };
- internedTabsIndentation = internedSpacesIndentation = undefined;
+ SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind;
+ function isLocalVariableOrFunction(symbol) {
+ if (symbol.parent) {
+ return false;
}
- if (!options.convertTabsToSpaces) {
- var tabs = Math.floor(indentation / options.tabSize);
- var spaces = indentation - tabs * options.tabSize;
- var tabString = void 0;
- if (!internedTabsIndentation) {
- internedTabsIndentation = [];
- }
- if (internedTabsIndentation[tabs] === undefined) {
- internedTabsIndentation[tabs] = tabString = repeat("\t", tabs);
+ return ts.forEach(symbol.declarations, function (declaration) {
+ if (declaration.kind === 180) {
+ return true;
}
- else {
- tabString = internedTabsIndentation[tabs];
+ if (declaration.kind !== 219 && declaration.kind !== 221) {
+ return false;
}
- return spaces ? tabString + repeat(" ", spaces) : tabString;
- }
- else {
- var spacesString = void 0;
- var quotient = Math.floor(indentation / options.indentSize);
- var remainder = indentation % options.indentSize;
- if (!internedSpacesIndentation) {
- internedSpacesIndentation = [];
+ for (var parent_23 = declaration.parent; !ts.isFunctionBlock(parent_23); parent_23 = parent_23.parent) {
+ if (parent_23.kind === 256 || parent_23.kind === 227) {
+ return false;
+ }
}
- if (internedSpacesIndentation[quotient] === undefined) {
- spacesString = repeat(" ", options.indentSize * quotient);
- internedSpacesIndentation[quotient] = spacesString;
+ return true;
+ });
+ }
+ })(SymbolDisplay = ts.SymbolDisplay || (ts.SymbolDisplay = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function transpileModule(input, transpileOptions) {
+ var diagnostics = [];
+ var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : ts.getDefaultCompilerOptions();
+ options.isolatedModules = true;
+ options.suppressOutputPathCheck = true;
+ options.allowNonTsExtensions = true;
+ options.noLib = true;
+ options.lib = undefined;
+ options.types = undefined;
+ options.noEmit = undefined;
+ options.noEmitOnError = undefined;
+ options.paths = undefined;
+ options.rootDirs = undefined;
+ options.declaration = undefined;
+ options.declarationDir = undefined;
+ options.out = undefined;
+ options.outFile = undefined;
+ options.noResolve = true;
+ var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts");
+ var sourceFile = ts.createSourceFile(inputFileName, input, options.target);
+ if (transpileOptions.moduleName) {
+ sourceFile.moduleName = transpileOptions.moduleName;
+ }
+ if (transpileOptions.renamedDependencies) {
+ sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies);
+ }
+ var newLine = ts.getNewLineCharacter(options);
+ var outputText;
+ var sourceMapText;
+ var compilerHost = {
+ getSourceFile: function (fileName) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : undefined; },
+ writeFile: function (name, text) {
+ if (ts.fileExtensionIs(name, ".map")) {
+ ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'");
+ sourceMapText = text;
}
else {
- spacesString = internedSpacesIndentation[quotient];
+ ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: '" + name + "'");
+ outputText = text;
}
- return remainder ? spacesString + repeat(" ", remainder) : spacesString;
+ },
+ getDefaultLibFileName: function () { return "lib.d.ts"; },
+ useCaseSensitiveFileNames: function () { return false; },
+ getCanonicalFileName: function (fileName) { return fileName; },
+ getCurrentDirectory: function () { return ""; },
+ getNewLine: function () { return newLine; },
+ fileExists: function (fileName) { return fileName === inputFileName; },
+ readFile: function () { return ""; },
+ directoryExists: function () { return true; },
+ getDirectories: function () { return []; }
+ };
+ var program = ts.createProgram([inputFileName], options, compilerHost);
+ if (transpileOptions.reportDiagnostics) {
+ ts.addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile));
+ ts.addRange(diagnostics, program.getOptionsDiagnostics());
+ }
+ program.emit();
+ ts.Debug.assert(outputText !== undefined, "Output generation failed");
+ return { outputText: outputText, diagnostics: diagnostics, sourceMapText: sourceMapText };
+ }
+ ts.transpileModule = transpileModule;
+ function transpile(input, compilerOptions, fileName, diagnostics, moduleName) {
+ var output = transpileModule(input, { compilerOptions: compilerOptions, fileName: fileName, reportDiagnostics: !!diagnostics, moduleName: moduleName });
+ ts.addRange(diagnostics, output.diagnostics);
+ return output.outputText;
+ }
+ ts.transpile = transpile;
+ var commandLineOptionsStringToEnum;
+ function fixupCompilerOptions(options, diagnostics) {
+ commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) {
+ return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; });
+ });
+ options = ts.clone(options);
+ var _loop_2 = function (opt) {
+ if (!ts.hasProperty(options, opt.name)) {
+ return "continue";
}
- function repeat(value, count) {
- var s = "";
- for (var i = 0; i < count; i++) {
- s += value;
+ var value = options[opt.name];
+ if (typeof value === "string") {
+ options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics);
+ }
+ else {
+ if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) {
+ diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt));
}
- return s;
}
+ };
+ for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
+ var opt = commandLineOptionsStringToEnum_1[_i];
+ _loop_2(opt);
}
- formatting.getIndentationString = getIndentationString;
- })(formatting = ts.formatting || (ts.formatting = {}));
+ return options;
+ }
})(ts || (ts = {}));
var ts;
(function (ts) {
var formatting;
(function (formatting) {
- var SmartIndenter;
- (function (SmartIndenter) {
- function getIndentation(position, sourceFile, options) {
- if (position > sourceFile.text.length) {
- return getBaseIndentation(options);
- }
- if (options.indentStyle === ts.IndentStyle.None) {
- return 0;
- }
- var precedingToken = ts.findPrecedingToken(position, sourceFile);
- if (!precedingToken) {
- return getBaseIndentation(options);
- }
- var precedingTokenIsLiteral = ts.isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind);
- if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
- return 0;
+ var standardScanner = ts.createScanner(4, false, 0);
+ var jsxScanner = ts.createScanner(4, false, 1);
+ var scanner;
+ var ScanAction;
+ (function (ScanAction) {
+ ScanAction[ScanAction["Scan"] = 0] = "Scan";
+ ScanAction[ScanAction["RescanGreaterThanToken"] = 1] = "RescanGreaterThanToken";
+ ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken";
+ ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken";
+ ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier";
+ ScanAction[ScanAction["RescanJsxText"] = 5] = "RescanJsxText";
+ })(ScanAction || (ScanAction = {}));
+ function getFormattingScanner(sourceFile, startPos, endPos) {
+ ts.Debug.assert(scanner === undefined, "Scanner should be undefined");
+ scanner = sourceFile.languageVariant === 1 ? jsxScanner : standardScanner;
+ scanner.setText(sourceFile.text);
+ scanner.setTextPos(startPos);
+ var wasNewLine = true;
+ var leadingTrivia;
+ var trailingTrivia;
+ var savedPos;
+ var lastScanAction;
+ var lastTokenInfo;
+ return {
+ advance: advance,
+ readTokenInfo: readTokenInfo,
+ isOnToken: isOnToken,
+ getCurrentLeadingTrivia: function () { return leadingTrivia; },
+ lastTrailingTriviaWasNewLine: function () { return wasNewLine; },
+ skipToEndOf: skipToEndOf,
+ close: function () {
+ ts.Debug.assert(scanner !== undefined);
+ lastTokenInfo = undefined;
+ scanner.setText(undefined);
+ scanner = undefined;
}
- var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
- if (options.indentStyle === ts.IndentStyle.Block) {
- var current_1 = position;
- while (current_1 > 0) {
- var char = sourceFile.text.charCodeAt(current_1);
- if (!ts.isWhiteSpace(char)) {
- break;
- }
- current_1--;
+ };
+ function advance() {
+ ts.Debug.assert(scanner !== undefined, "Scanner should be present");
+ lastTokenInfo = undefined;
+ var isStarted = scanner.getStartPos() !== startPos;
+ if (isStarted) {
+ if (trailingTrivia) {
+ ts.Debug.assert(trailingTrivia.length !== 0);
+ wasNewLine = ts.lastOrUndefined(trailingTrivia).kind === 4;
}
- var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile);
- return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options);
- }
- if (precedingToken.kind === 24 && precedingToken.parent.kind !== 187) {
- var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);
- if (actualIndentation !== -1) {
- return actualIndentation;
+ else {
+ wasNewLine = false;
}
}
- var previous;
- var current = precedingToken;
- var currentStart;
- var indentationDelta;
- while (current) {
- if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) {
- currentStart = getStartLineAndCharacterForNode(current, sourceFile);
- if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) {
- indentationDelta = 0;
- }
- else {
- indentationDelta = lineAtPosition !== currentStart.line ? options.indentSize : 0;
- }
+ leadingTrivia = undefined;
+ trailingTrivia = undefined;
+ if (!isStarted) {
+ scanner.scan();
+ }
+ var pos = scanner.getStartPos();
+ while (pos < endPos) {
+ var t = scanner.getToken();
+ if (!ts.isTrivia(t)) {
break;
}
- var actualIndentation = getActualIndentationForListItem(current, sourceFile, options);
- if (actualIndentation !== -1) {
- return actualIndentation;
+ scanner.scan();
+ var item = {
+ pos: pos,
+ end: scanner.getStartPos(),
+ kind: t
+ };
+ pos = scanner.getStartPos();
+ if (!leadingTrivia) {
+ leadingTrivia = [];
}
- actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
- if (actualIndentation !== -1) {
- return actualIndentation + options.indentSize;
+ leadingTrivia.push(item);
+ }
+ savedPos = scanner.getStartPos();
+ }
+ function shouldRescanGreaterThanToken(node) {
+ if (node) {
+ switch (node.kind) {
+ case 30:
+ case 65:
+ case 66:
+ case 46:
+ case 45:
+ return true;
}
- previous = current;
- current = current.parent;
}
- if (!current) {
- return getBaseIndentation(options);
+ return false;
+ }
+ function shouldRescanJsxIdentifier(node) {
+ if (node.parent) {
+ switch (node.parent.kind) {
+ case 246:
+ case 244:
+ case 245:
+ case 243:
+ return node.kind === 70;
+ }
}
- return getIndentationForNodeWorker(current, currentStart, undefined, indentationDelta, sourceFile, options);
+ return false;
}
- SmartIndenter.getIndentation = getIndentation;
- function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) {
- var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));
- return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, 0, sourceFile, options);
+ function shouldRescanJsxText(node) {
+ return node && node.kind === 10;
}
- SmartIndenter.getIndentationForNode = getIndentationForNode;
- function getBaseIndentation(options) {
- return options.baseIndentSize || 0;
+ function shouldRescanSlashToken(container) {
+ return container.kind === 11;
}
- SmartIndenter.getBaseIndentation = getBaseIndentation;
- function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) {
- var parent = current.parent;
- var parentStart;
- while (parent) {
- var useActualIndentation = true;
- if (ignoreActualIndentationRange) {
- var start = current.getStart(sourceFile);
- useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end;
- }
- if (useActualIndentation) {
- var actualIndentation = getActualIndentationForListItem(current, sourceFile, options);
- if (actualIndentation !== -1) {
- return actualIndentation + indentationDelta;
- }
- }
- parentStart = getParentStart(parent, current, sourceFile);
- var parentAndChildShareLine = parentStart.line === currentStart.line ||
- childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile);
- if (useActualIndentation) {
- var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options);
- if (actualIndentation !== -1) {
- return actualIndentation + indentationDelta;
- }
- actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
- if (actualIndentation !== -1) {
- return actualIndentation + indentationDelta;
- }
- }
- if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) {
- indentationDelta += options.indentSize;
- }
- current = parent;
- currentStart = parentStart;
- parent = current.parent;
- }
- return indentationDelta + getBaseIndentation(options);
- }
- function getParentStart(parent, child, sourceFile) {
- var containingList = getContainingList(child, sourceFile);
- if (containingList) {
- return sourceFile.getLineAndCharacterOfPosition(containingList.pos);
- }
- return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile));
- }
- function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) {
- var commaItemInfo = ts.findListItemInfo(commaToken);
- if (commaItemInfo && commaItemInfo.listItemIndex > 0) {
- return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options);
- }
- else {
- return -1;
- }
+ function shouldRescanTemplateToken(container) {
+ return container.kind === 14 ||
+ container.kind === 15;
}
- function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) {
- var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) &&
- (parent.kind === 256 || !parentAndChildShareLine);
- if (!useActualIndentation) {
- return -1;
- }
- return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options);
+ function startsWithSlashToken(t) {
+ return t === 40 || t === 62;
}
- function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) {
- var nextToken = ts.findNextToken(precedingToken, current);
- if (!nextToken) {
- return false;
+ function readTokenInfo(n) {
+ ts.Debug.assert(scanner !== undefined);
+ if (!isOnToken()) {
+ return {
+ leadingTrivia: leadingTrivia,
+ trailingTrivia: undefined,
+ token: undefined
+ };
}
- if (nextToken.kind === 15) {
- return true;
+ var expectedScanAction = shouldRescanGreaterThanToken(n)
+ ? 1
+ : shouldRescanSlashToken(n)
+ ? 2
+ : shouldRescanTemplateToken(n)
+ ? 3
+ : shouldRescanJsxIdentifier(n)
+ ? 4
+ : shouldRescanJsxText(n)
+ ? 5
+ : 0;
+ if (lastTokenInfo && expectedScanAction === lastScanAction) {
+ return fixTokenKind(lastTokenInfo, n);
}
- else if (nextToken.kind === 16) {
- var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line;
- return lineAtPosition === nextTokenStartLine;
+ if (scanner.getStartPos() !== savedPos) {
+ ts.Debug.assert(lastTokenInfo !== undefined);
+ scanner.setTextPos(savedPos);
+ scanner.scan();
}
- return false;
- }
- function getStartLineAndCharacterForNode(n, sourceFile) {
- return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));
- }
- function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) {
- if (parent.kind === 203 && parent.elseStatement === child) {
- var elseKeyword = ts.findChildOfKind(parent, 80, sourceFile);
- ts.Debug.assert(elseKeyword !== undefined);
- var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line;
- return elseKeywordStartLine === childStartLine;
+ var currentToken = scanner.getToken();
+ if (expectedScanAction === 1 && currentToken === 28) {
+ currentToken = scanner.reScanGreaterToken();
+ ts.Debug.assert(n.kind === currentToken);
+ lastScanAction = 1;
}
- return false;
- }
- SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement;
- function getContainingList(node, sourceFile) {
- if (node.parent) {
- switch (node.parent.kind) {
- case 155:
- if (node.parent.typeArguments &&
- ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) {
- return node.parent.typeArguments;
- }
- break;
- case 171:
- return node.parent.properties;
- case 170:
- return node.parent.elements;
- case 220:
- case 179:
- case 180:
- case 147:
- case 146:
- case 151:
- case 152: {
- var start = node.getStart(sourceFile);
- if (node.parent.typeParameters &&
- ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) {
- return node.parent.typeParameters;
- }
- if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) {
- return node.parent.parameters;
- }
- break;
- }
- case 175:
- case 174: {
- var start = node.getStart(sourceFile);
- if (node.parent.typeArguments &&
- ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) {
- return node.parent.typeArguments;
- }
- if (node.parent.arguments &&
- ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) {
- return node.parent.arguments;
- }
- break;
- }
- }
+ else if (expectedScanAction === 2 && startsWithSlashToken(currentToken)) {
+ currentToken = scanner.reScanSlashToken();
+ ts.Debug.assert(n.kind === currentToken);
+ lastScanAction = 2;
}
- return undefined;
- }
- function getActualIndentationForListItem(node, sourceFile, options) {
- var containingList = getContainingList(node, sourceFile);
- return containingList ? getActualIndentationFromList(containingList) : -1;
- function getActualIndentationFromList(list) {
- var index = ts.indexOf(list, node);
- return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1;
+ else if (expectedScanAction === 3 && currentToken === 17) {
+ currentToken = scanner.reScanTemplateToken();
+ lastScanAction = 3;
}
- }
- function getLineIndentationWhenExpressionIsInMultiLine(node, sourceFile, options) {
- if (node.kind === 18) {
- return -1;
+ else if (expectedScanAction === 4 && currentToken === 70) {
+ currentToken = scanner.scanJsxIdentifier();
+ lastScanAction = 4;
}
- if (node.parent && (node.parent.kind === 174 ||
- node.parent.kind === 175) &&
- node.parent.expression !== node) {
- var fullCallOrNewExpression = node.parent.expression;
- var startingExpression = getStartingExpression(fullCallOrNewExpression);
- if (fullCallOrNewExpression === startingExpression) {
- return -1;
- }
- var fullCallOrNewExpressionEnd = sourceFile.getLineAndCharacterOfPosition(fullCallOrNewExpression.end);
- var startingExpressionEnd = sourceFile.getLineAndCharacterOfPosition(startingExpression.end);
- if (fullCallOrNewExpressionEnd.line === startingExpressionEnd.line) {
- return -1;
- }
- return findColumnForFirstNonWhitespaceCharacterInLine(fullCallOrNewExpressionEnd, sourceFile, options);
+ else if (expectedScanAction === 5) {
+ currentToken = scanner.reScanJsxToken();
+ lastScanAction = 5;
}
- return -1;
- function getStartingExpression(node) {
- while (true) {
- switch (node.kind) {
- case 174:
- case 175:
- case 172:
- case 173:
- node = node.expression;
- break;
- default:
- return node;
- }
- }
+ else {
+ lastScanAction = 0;
}
- }
- function deriveActualIndentationFromList(list, index, sourceFile, options) {
- ts.Debug.assert(index >= 0 && index < list.length);
- var node = list[index];
- var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile);
- for (var i = index - 1; i >= 0; i--) {
- if (list[i].kind === 24) {
- continue;
- }
- var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line;
- if (prevEndLine !== lineAndCharacter.line) {
- return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options);
- }
- lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile);
+ var token = {
+ pos: scanner.getStartPos(),
+ end: scanner.getTextPos(),
+ kind: currentToken
+ };
+ if (trailingTrivia) {
+ trailingTrivia = undefined;
}
- return -1;
- }
- function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) {
- var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0);
- return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options);
- }
- function findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options) {
- var character = 0;
- var column = 0;
- for (var pos = startPos; pos < endPos; pos++) {
- var ch = sourceFile.text.charCodeAt(pos);
- if (!ts.isWhiteSpaceSingleLine(ch)) {
+ while (scanner.getStartPos() < endPos) {
+ currentToken = scanner.scan();
+ if (!ts.isTrivia(currentToken)) {
break;
}
- if (ch === 9) {
- column += options.tabSize + (column % options.tabSize);
+ var trivia = {
+ pos: scanner.getStartPos(),
+ end: scanner.getTextPos(),
+ kind: currentToken
+ };
+ if (!trailingTrivia) {
+ trailingTrivia = [];
}
- else {
- column++;
+ trailingTrivia.push(trivia);
+ if (currentToken === 4) {
+ scanner.scan();
+ break;
}
- character++;
}
- return { column: column, character: character };
- }
- SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn;
- function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) {
- return findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options).column;
+ lastTokenInfo = {
+ leadingTrivia: leadingTrivia,
+ trailingTrivia: trailingTrivia,
+ token: token
+ };
+ return fixTokenKind(lastTokenInfo, n);
}
- SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn;
- function nodeContentIsAlwaysIndented(kind) {
- switch (kind) {
- case 202:
- case 221:
- case 192:
- case 222:
- case 224:
- case 223:
- case 170:
- case 199:
- case 226:
- case 171:
- case 159:
- case 161:
- case 227:
- case 250:
- case 249:
- case 178:
- case 172:
- case 174:
- case 175:
- case 200:
- case 218:
- case 235:
- case 211:
- case 188:
- case 168:
- case 167:
- case 243:
- case 242:
- case 248:
- case 146:
- case 151:
- case 152:
- case 142:
- case 156:
- case 157:
- case 164:
- case 176:
- case 184:
- case 237:
- case 233:
- case 238:
- case 234:
- return true;
- }
- return false;
+ function isOnToken() {
+ ts.Debug.assert(scanner !== undefined);
+ var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken();
+ var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos();
+ return startPos < endPos && current !== 1 && !ts.isTrivia(current);
}
- function nodeWillIndentChild(parent, child, indentByDefault) {
- var childKind = child ? child.kind : 0;
- switch (parent.kind) {
- case 204:
- case 205:
- case 207:
- case 208:
- case 206:
- case 203:
- case 220:
- case 179:
- case 147:
- case 180:
- case 148:
- case 149:
- case 150:
- return childKind !== 199;
- case 236:
- return childKind !== 237;
- case 230:
- return childKind !== 231 ||
- (child.namedBindings && child.namedBindings.kind !== 233);
- case 241:
- return childKind !== 245;
+ function fixTokenKind(tokenInfo, container) {
+ if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) {
+ tokenInfo.token.kind = container.kind;
}
- return indentByDefault;
+ return tokenInfo;
}
- SmartIndenter.nodeWillIndentChild = nodeWillIndentChild;
- function shouldIndentChildNode(parent, child) {
- return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false);
+ function skipToEndOf(node) {
+ scanner.setTextPos(node.end);
+ savedPos = scanner.getStartPos();
+ lastScanAction = undefined;
+ lastTokenInfo = undefined;
+ wasNewLine = false;
+ leadingTrivia = undefined;
+ trailingTrivia = undefined;
}
- SmartIndenter.shouldIndentChildNode = shouldIndentChildNode;
- })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {}));
+ }
+ formatting.getFormattingScanner = getFormattingScanner;
})(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
- var codefix;
- (function (codefix) {
- var codeFixes = ts.createMap();
- function registerCodeFix(action) {
- ts.forEach(action.errorCodes, function (error) {
- var fixes = codeFixes[error];
- if (!fixes) {
- fixes = [];
- codeFixes[error] = fixes;
- }
- fixes.push(action);
- });
- }
- codefix.registerCodeFix = registerCodeFix;
- function getSupportedErrorCodes() {
- return Object.keys(codeFixes);
- }
- codefix.getSupportedErrorCodes = getSupportedErrorCodes;
- function getFixes(context) {
- var fixes = codeFixes[context.errorCode];
- var allActions = [];
- ts.forEach(fixes, function (f) {
- var actions = f.getCodeActions(context);
- if (actions && actions.length > 0) {
- allActions = allActions.concat(actions);
+ var formatting;
+ (function (formatting) {
+ var FormattingContext = (function () {
+ function FormattingContext(sourceFile, formattingRequestKind) {
+ this.sourceFile = sourceFile;
+ this.formattingRequestKind = formattingRequestKind;
+ }
+ FormattingContext.prototype.updateContext = function (currentRange, currentTokenParent, nextRange, nextTokenParent, commonParent) {
+ ts.Debug.assert(currentRange !== undefined, "currentTokenSpan is null");
+ ts.Debug.assert(currentTokenParent !== undefined, "currentTokenParent is null");
+ ts.Debug.assert(nextRange !== undefined, "nextTokenSpan is null");
+ ts.Debug.assert(nextTokenParent !== undefined, "nextTokenParent is null");
+ ts.Debug.assert(commonParent !== undefined, "commonParent is null");
+ this.currentTokenSpan = currentRange;
+ this.currentTokenParent = currentTokenParent;
+ this.nextTokenSpan = nextRange;
+ this.nextTokenParent = nextTokenParent;
+ this.contextNode = commonParent;
+ this.contextNodeAllOnSameLine = undefined;
+ this.nextNodeAllOnSameLine = undefined;
+ this.tokensAreOnSameLine = undefined;
+ this.contextNodeBlockIsOnOneLine = undefined;
+ this.nextNodeBlockIsOnOneLine = undefined;
+ };
+ FormattingContext.prototype.ContextNodeAllOnSameLine = function () {
+ if (this.contextNodeAllOnSameLine === undefined) {
+ this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode);
}
- });
- return allActions;
- }
- codefix.getFixes = getFixes;
- })(codefix = ts.codefix || (ts.codefix = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var codefix;
- (function (codefix) {
- function getOpenBraceEnd(constructor, sourceFile) {
- return constructor.body.getFirstToken(sourceFile).getEnd();
- }
- codefix.registerCodeFix({
- errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code],
- getCodeActions: function (context) {
- var sourceFile = context.sourceFile;
- var token = ts.getTokenAtPosition(sourceFile, context.span.start);
- if (token.kind !== 121) {
- return undefined;
+ return this.contextNodeAllOnSameLine;
+ };
+ FormattingContext.prototype.NextNodeAllOnSameLine = function () {
+ if (this.nextNodeAllOnSameLine === undefined) {
+ this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent);
}
- var newPosition = getOpenBraceEnd(token.parent, sourceFile);
- return [{
- description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call),
- changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }]
- }];
- }
- });
- codefix.registerCodeFix({
- errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code],
- getCodeActions: function (context) {
- var sourceFile = context.sourceFile;
- var token = ts.getTokenAtPosition(sourceFile, context.span.start);
- if (token.kind !== 97) {
- return undefined;
+ return this.nextNodeAllOnSameLine;
+ };
+ FormattingContext.prototype.TokensAreOnSameLine = function () {
+ if (this.tokensAreOnSameLine === undefined) {
+ var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line;
+ var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line;
+ this.tokensAreOnSameLine = (startLine === endLine);
}
- var constructor = ts.getContainingFunction(token);
- var superCall = findSuperCall(constructor.body);
- if (!superCall) {
- return undefined;
+ return this.tokensAreOnSameLine;
+ };
+ FormattingContext.prototype.ContextNodeBlockIsOnOneLine = function () {
+ if (this.contextNodeBlockIsOnOneLine === undefined) {
+ this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode);
}
- if (superCall.expression && superCall.expression.kind == 174) {
- var arguments_1 = superCall.expression.arguments;
- for (var i = 0; i < arguments_1.length; i++) {
- if (arguments_1[i].expression === token) {
- return undefined;
- }
- }
+ return this.contextNodeBlockIsOnOneLine;
+ };
+ FormattingContext.prototype.NextNodeBlockIsOnOneLine = function () {
+ if (this.nextNodeBlockIsOnOneLine === undefined) {
+ this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent);
}
- var newPosition = getOpenBraceEnd(constructor, sourceFile);
- var changes = [{
- fileName: sourceFile.fileName, textChanges: [{
- newText: superCall.getText(sourceFile),
- span: { start: newPosition, length: 0 }
- },
- {
- newText: "",
- span: { start: superCall.getStart(sourceFile), length: superCall.getWidth(sourceFile) }
- }]
- }];
- return [{
- description: ts.getLocaleSpecificMessage(ts.Diagnostics.Make_super_call_the_first_statement_in_the_constructor),
- changes: changes
- }];
- function findSuperCall(n) {
- if (n.kind === 202 && ts.isSuperCall(n.expression)) {
- return n;
- }
- if (ts.isFunctionLike(n)) {
- return undefined;
- }
- return ts.forEachChild(n, findSuperCall);
+ return this.nextNodeBlockIsOnOneLine;
+ };
+ FormattingContext.prototype.NodeIsOnOneLine = function (node) {
+ var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line;
+ var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line;
+ return startLine === endLine;
+ };
+ FormattingContext.prototype.BlockIsOnOneLine = function (node) {
+ var openBrace = ts.findChildOfKind(node, 16, this.sourceFile);
+ var closeBrace = ts.findChildOfKind(node, 17, this.sourceFile);
+ if (openBrace && closeBrace) {
+ var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line;
+ var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line;
+ return startLine === endLine;
}
- }
- });
- })(codefix = ts.codefix || (ts.codefix = {}));
+ return false;
+ };
+ return FormattingContext;
+ }());
+ formatting.FormattingContext = FormattingContext;
+ })(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
- ts.servicesVersion = "0.5";
- function createNode(kind, pos, end, parent) {
- var node = kind >= 139 ? new NodeObject(kind, pos, end) :
- kind === 69 ? new IdentifierObject(69, pos, end) :
- new TokenObject(kind, pos, end);
- node.parent = parent;
- return node;
- }
- var NodeObject = (function () {
- function NodeObject(kind, pos, end) {
- this.pos = pos;
- this.end = end;
- this.flags = 0;
- this.transformFlags = undefined;
- this.excludeTransformFlags = undefined;
- this.parent = undefined;
- this.kind = kind;
- }
- NodeObject.prototype.getSourceFile = function () {
- return ts.getSourceFileOfNode(this);
- };
- NodeObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
- return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
- };
- NodeObject.prototype.getFullStart = function () {
- return this.pos;
- };
- NodeObject.prototype.getEnd = function () {
- return this.end;
- };
- NodeObject.prototype.getWidth = function (sourceFile) {
- return this.getEnd() - this.getStart(sourceFile);
- };
- NodeObject.prototype.getFullWidth = function () {
- return this.end - this.pos;
- };
- NodeObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
- return this.getStart(sourceFile) - this.pos;
- };
- NodeObject.prototype.getFullText = function (sourceFile) {
- return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
- };
- NodeObject.prototype.getText = function (sourceFile) {
- if (!sourceFile) {
- sourceFile = this.getSourceFile();
- }
- return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd());
- };
- NodeObject.prototype.addSyntheticNodes = function (nodes, pos, end, useJSDocScanner) {
- ts.scanner.setTextPos(pos);
- while (pos < end) {
- var token = useJSDocScanner ? ts.scanner.scanJSDocToken() : ts.scanner.scan();
- var textPos = ts.scanner.getTextPos();
- if (textPos <= end) {
- nodes.push(createNode(token, pos, textPos, this));
- }
- pos = textPos;
+ var formatting;
+ (function (formatting) {
+ (function (FormattingRequestKind) {
+ FormattingRequestKind[FormattingRequestKind["FormatDocument"] = 0] = "FormatDocument";
+ FormattingRequestKind[FormattingRequestKind["FormatSelection"] = 1] = "FormatSelection";
+ FormattingRequestKind[FormattingRequestKind["FormatOnEnter"] = 2] = "FormatOnEnter";
+ FormattingRequestKind[FormattingRequestKind["FormatOnSemicolon"] = 3] = "FormatOnSemicolon";
+ FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 4] = "FormatOnClosingCurlyBrace";
+ })(formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {}));
+ var FormattingRequestKind = formatting.FormattingRequestKind;
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ var Rule = (function () {
+ function Rule(Descriptor, Operation, Flag) {
+ if (Flag === void 0) { Flag = 0; }
+ this.Descriptor = Descriptor;
+ this.Operation = Operation;
+ this.Flag = Flag;
}
- return pos;
- };
- NodeObject.prototype.createSyntaxList = function (nodes) {
- var list = createNode(286, nodes.pos, nodes.end, this);
- list._children = [];
- var pos = nodes.pos;
- for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
- var node = nodes_4[_i];
- if (pos < node.pos) {
- pos = this.addSyntheticNodes(list._children, pos, node.pos);
- }
- list._children.push(node);
- pos = node.end;
+ Rule.prototype.toString = function () {
+ return "[desc=" + this.Descriptor + "," +
+ "operation=" + this.Operation + "," +
+ "flag=" + this.Flag + "]";
+ };
+ return Rule;
+ }());
+ formatting.Rule = Rule;
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ (function (RuleAction) {
+ RuleAction[RuleAction["Ignore"] = 1] = "Ignore";
+ RuleAction[RuleAction["Space"] = 2] = "Space";
+ RuleAction[RuleAction["NewLine"] = 4] = "NewLine";
+ RuleAction[RuleAction["Delete"] = 8] = "Delete";
+ })(formatting.RuleAction || (formatting.RuleAction = {}));
+ var RuleAction = formatting.RuleAction;
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ var RuleDescriptor = (function () {
+ function RuleDescriptor(LeftTokenRange, RightTokenRange) {
+ this.LeftTokenRange = LeftTokenRange;
+ this.RightTokenRange = RightTokenRange;
}
- if (pos < nodes.end) {
- this.addSyntheticNodes(list._children, pos, nodes.end);
+ RuleDescriptor.prototype.toString = function () {
+ return "[leftRange=" + this.LeftTokenRange + "," +
+ "rightRange=" + this.RightTokenRange + "]";
+ };
+ RuleDescriptor.create1 = function (left, right) {
+ return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right));
+ };
+ RuleDescriptor.create2 = function (left, right) {
+ return RuleDescriptor.create4(left, formatting.Shared.TokenRange.FromToken(right));
+ };
+ RuleDescriptor.create3 = function (left, right) {
+ return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), right);
+ };
+ RuleDescriptor.create4 = function (left, right) {
+ return new RuleDescriptor(left, right);
+ };
+ return RuleDescriptor;
+ }());
+ formatting.RuleDescriptor = RuleDescriptor;
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ (function (RuleFlags) {
+ RuleFlags[RuleFlags["None"] = 0] = "None";
+ RuleFlags[RuleFlags["CanDeleteNewLines"] = 1] = "CanDeleteNewLines";
+ })(formatting.RuleFlags || (formatting.RuleFlags = {}));
+ var RuleFlags = formatting.RuleFlags;
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ var RuleOperation = (function () {
+ function RuleOperation(Context, Action) {
+ this.Context = Context;
+ this.Action = Action;
}
- return list;
- };
- NodeObject.prototype.createChildren = function (sourceFile) {
- var _this = this;
- var children;
- if (this.kind >= 139) {
- ts.scanner.setText((sourceFile || this.getSourceFile()).text);
- children = [];
- var pos_3 = this.pos;
- var useJSDocScanner_1 = this.kind >= 273 && this.kind <= 285;
- var processNode = function (node) {
- var isJSDocTagNode = ts.isJSDocTag(node);
- if (!isJSDocTagNode && pos_3 < node.pos) {
- pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos, useJSDocScanner_1);
- }
- children.push(node);
- if (!isJSDocTagNode) {
- pos_3 = node.end;
- }
- };
- var processNodes = function (nodes) {
- if (pos_3 < nodes.pos) {
- pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos, useJSDocScanner_1);
- }
- children.push(_this.createSyntaxList(nodes));
- pos_3 = nodes.end;
- };
- if (this.jsDocComments) {
- for (var _i = 0, _a = this.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- processNode(jsDocComment);
- }
- }
- pos_3 = this.pos;
- ts.forEachChild(this, processNode, processNodes);
- if (pos_3 < this.end) {
- this.addSyntheticNodes(children, pos_3, this.end);
+ RuleOperation.prototype.toString = function () {
+ return "[context=" + this.Context + "," +
+ "action=" + this.Action + "]";
+ };
+ RuleOperation.create1 = function (action) {
+ return RuleOperation.create2(formatting.RuleOperationContext.Any, action);
+ };
+ RuleOperation.create2 = function (context, action) {
+ return new RuleOperation(context, action);
+ };
+ return RuleOperation;
+ }());
+ formatting.RuleOperation = RuleOperation;
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ var RuleOperationContext = (function () {
+ function RuleOperationContext() {
+ var funcs = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ funcs[_i - 0] = arguments[_i];
}
- ts.scanner.setText(undefined);
- }
- this._children = children || ts.emptyArray;
- };
- NodeObject.prototype.getChildCount = function (sourceFile) {
- if (!this._children)
- this.createChildren(sourceFile);
- return this._children.length;
- };
- NodeObject.prototype.getChildAt = function (index, sourceFile) {
- if (!this._children)
- this.createChildren(sourceFile);
- return this._children[index];
- };
- NodeObject.prototype.getChildren = function (sourceFile) {
- if (!this._children)
- this.createChildren(sourceFile);
- return this._children;
- };
- NodeObject.prototype.getFirstToken = function (sourceFile) {
- var children = this.getChildren(sourceFile);
- if (!children.length) {
- return undefined;
- }
- var child = children[0];
- return child.kind < 139 ? child : child.getFirstToken(sourceFile);
- };
- NodeObject.prototype.getLastToken = function (sourceFile) {
- var children = this.getChildren(sourceFile);
- var child = ts.lastOrUndefined(children);
- if (!child) {
- return undefined;
- }
- return child.kind < 139 ? child : child.getLastToken(sourceFile);
- };
- return NodeObject;
- }());
- var TokenOrIdentifierObject = (function () {
- function TokenOrIdentifierObject(pos, end) {
- this.pos = pos;
- this.end = end;
- this.flags = 0;
- this.parent = undefined;
- }
- TokenOrIdentifierObject.prototype.getSourceFile = function () {
- return ts.getSourceFileOfNode(this);
- };
- TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
- return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
- };
- TokenOrIdentifierObject.prototype.getFullStart = function () {
- return this.pos;
- };
- TokenOrIdentifierObject.prototype.getEnd = function () {
- return this.end;
- };
- TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {
- return this.getEnd() - this.getStart(sourceFile);
- };
- TokenOrIdentifierObject.prototype.getFullWidth = function () {
- return this.end - this.pos;
- };
- TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
- return this.getStart(sourceFile) - this.pos;
- };
- TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {
- return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
- };
- TokenOrIdentifierObject.prototype.getText = function (sourceFile) {
- return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
- };
- TokenOrIdentifierObject.prototype.getChildCount = function (sourceFile) {
- return 0;
- };
- TokenOrIdentifierObject.prototype.getChildAt = function (index, sourceFile) {
- return undefined;
- };
- TokenOrIdentifierObject.prototype.getChildren = function (sourceFile) {
- return ts.emptyArray;
- };
- TokenOrIdentifierObject.prototype.getFirstToken = function (sourceFile) {
- return undefined;
- };
- TokenOrIdentifierObject.prototype.getLastToken = function (sourceFile) {
- return undefined;
- };
- return TokenOrIdentifierObject;
- }());
- var SymbolObject = (function () {
- function SymbolObject(flags, name) {
- this.flags = flags;
- this.name = name;
- }
- SymbolObject.prototype.getFlags = function () {
- return this.flags;
- };
- SymbolObject.prototype.getName = function () {
- return this.name;
- };
- SymbolObject.prototype.getDeclarations = function () {
- return this.declarations;
- };
- SymbolObject.prototype.getDocumentationComment = function () {
- if (this.documentationComment === undefined) {
- this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations(this.declarations, this.name, !(this.flags & 4));
- }
- return this.documentationComment;
- };
- return SymbolObject;
- }());
- var TokenObject = (function (_super) {
- __extends(TokenObject, _super);
- function TokenObject(kind, pos, end) {
- var _this = _super.call(this, pos, end) || this;
- _this.kind = kind;
- return _this;
- }
- return TokenObject;
- }(TokenOrIdentifierObject));
- var IdentifierObject = (function (_super) {
- __extends(IdentifierObject, _super);
- function IdentifierObject(kind, pos, end) {
- return _super.call(this, pos, end) || this;
- }
- return IdentifierObject;
- }(TokenOrIdentifierObject));
- IdentifierObject.prototype.kind = 69;
- var TypeObject = (function () {
- function TypeObject(checker, flags) {
- this.checker = checker;
- this.flags = flags;
- }
- TypeObject.prototype.getFlags = function () {
- return this.flags;
- };
- TypeObject.prototype.getSymbol = function () {
- return this.symbol;
- };
- TypeObject.prototype.getProperties = function () {
- return this.checker.getPropertiesOfType(this);
- };
- TypeObject.prototype.getProperty = function (propertyName) {
- return this.checker.getPropertyOfType(this, propertyName);
- };
- TypeObject.prototype.getApparentProperties = function () {
- return this.checker.getAugmentedPropertiesOfType(this);
- };
- TypeObject.prototype.getCallSignatures = function () {
- return this.checker.getSignaturesOfType(this, 0);
- };
- TypeObject.prototype.getConstructSignatures = function () {
- return this.checker.getSignaturesOfType(this, 1);
- };
- TypeObject.prototype.getStringIndexType = function () {
- return this.checker.getIndexTypeOfType(this, 0);
- };
- TypeObject.prototype.getNumberIndexType = function () {
- return this.checker.getIndexTypeOfType(this, 1);
- };
- TypeObject.prototype.getBaseTypes = function () {
- return this.flags & (32768 | 65536)
- ? this.checker.getBaseTypes(this)
- : undefined;
- };
- TypeObject.prototype.getNonNullableType = function () {
- return this.checker.getNonNullableType(this);
- };
- return TypeObject;
- }());
- var SignatureObject = (function () {
- function SignatureObject(checker) {
- this.checker = checker;
- }
- SignatureObject.prototype.getDeclaration = function () {
- return this.declaration;
- };
- SignatureObject.prototype.getTypeParameters = function () {
- return this.typeParameters;
- };
- SignatureObject.prototype.getParameters = function () {
- return this.parameters;
- };
- SignatureObject.prototype.getReturnType = function () {
- return this.checker.getReturnTypeOfSignature(this);
- };
- SignatureObject.prototype.getDocumentationComment = function () {
- if (this.documentationComment === undefined) {
- this.documentationComment = this.declaration ? ts.JsDoc.getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : [];
- }
- return this.documentationComment;
- };
- return SignatureObject;
- }());
- var SourceFileObject = (function (_super) {
- __extends(SourceFileObject, _super);
- function SourceFileObject(kind, pos, end) {
- return _super.call(this, kind, pos, end) || this;
- }
- SourceFileObject.prototype.update = function (newText, textChangeRange) {
- return ts.updateSourceFile(this, newText, textChangeRange);
- };
- SourceFileObject.prototype.getLineAndCharacterOfPosition = function (position) {
- return ts.getLineAndCharacterOfPosition(this, position);
- };
- SourceFileObject.prototype.getLineStarts = function () {
- return ts.getLineStarts(this);
- };
- SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) {
- return ts.getPositionOfLineAndCharacter(this, line, character);
- };
- SourceFileObject.prototype.getNamedDeclarations = function () {
- if (!this.namedDeclarations) {
- this.namedDeclarations = this.computeNamedDeclarations();
+ this.customContextChecks = funcs;
}
- return this.namedDeclarations;
- };
- SourceFileObject.prototype.computeNamedDeclarations = function () {
- var result = ts.createMap();
- ts.forEachChild(this, visit);
- return result;
- function addDeclaration(declaration) {
- var name = getDeclarationName(declaration);
- if (name) {
- ts.multiMapAdd(result, name, declaration);
+ RuleOperationContext.prototype.IsAny = function () {
+ return this === RuleOperationContext.Any;
+ };
+ RuleOperationContext.prototype.InContext = function (context) {
+ if (this.IsAny()) {
+ return true;
}
- }
- function getDeclarations(name) {
- return result[name] || (result[name] = []);
- }
- function getDeclarationName(declaration) {
- if (declaration.name) {
- var result_6 = getTextOfIdentifierOrLiteral(declaration.name);
- if (result_6 !== undefined) {
- return result_6;
- }
- if (declaration.name.kind === 140) {
- var expr = declaration.name.expression;
- if (expr.kind === 172) {
- return expr.name.text;
- }
- return getTextOfIdentifierOrLiteral(expr);
+ for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) {
+ var check = _a[_i];
+ if (!check(context)) {
+ return false;
}
}
- return undefined;
+ return true;
+ };
+ return RuleOperationContext;
+ }());
+ RuleOperationContext.Any = new RuleOperationContext();
+ formatting.RuleOperationContext = RuleOperationContext;
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ var Rules = (function () {
+ function Rules() {
+ this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1));
+ this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1));
+ this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));
+ this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));
+ this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(55, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 2));
+ this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2));
+ this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2));
+ this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17, 81), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17, 105), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([19, 21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(21, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8));
+ this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments;
+ this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1);
+ this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([70, 3, 74, 83, 90]);
+ this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1);
+ this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19, 3, 80, 101, 86, 81]);
+ this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1);
+ this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2));
+ this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2));
+ this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8));
+ this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8));
+ this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8));
+ this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4));
+ this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4));
+ this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));
+ this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(43, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 43), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(42, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
+ this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(36, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
+ this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
+ this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(43, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
+ this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(37, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
+ this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(37, 43), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
+ this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([103, 99, 93, 79, 95, 102, 120]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109, 75]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2));
+ this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8));
+ this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2));
+ this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8));
+ this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2));
+ this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([19, 80, 81, 72]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNotForContext), 2));
+ this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101, 86]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 132]), 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2));
+ this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
+ this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
+ this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([126, 130]), 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 126, 127, 111, 113, 112, 132, 114, 135, 137]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 137])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2));
+ this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(35, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(23, 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.FromTokens([19, 25])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));
+ this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 26), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));
+ this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(19, 26), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));
+ this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(26, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));
+ this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 28), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));
+ this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(28, formatting.Shared.TokenRange.FromTokens([18, 20, 28, 25])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));
+ this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8));
+ this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116, 70, 83, 78, 74, 114, 113, 111, 112, 124, 132, 20, 38])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2));
+ this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8));
+ this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38, formatting.Shared.TokenRange.FromTokens([70, 18])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2));
+ this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8));
+ this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115, 38]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2));
+ this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(119, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), 2));
+ this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(119, 88), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(70, formatting.Shared.TokenRange.FromTokens([12, 13])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.SpaceBeforeJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNextTokenParentJsxAttribute, Rules.IsNonJsxSameLineTokenContext), 2));
+ this.SpaceBeforeSlashInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 40), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 2));
+ this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40, 28), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8));
+ this.HighPriorityCommonRules = [
+ this.IgnoreBeforeComment, this.IgnoreAfterLineComment,
+ this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator,
+ this.NoSpaceAfterQuestionMark,
+ this.NoSpaceBeforeDot, this.NoSpaceAfterDot,
+ this.NoSpaceAfterUnaryPrefixOperator,
+ this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator,
+ this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator,
+ this.SpaceAfterPostincrementWhenFollowedByAdd,
+ this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement,
+ this.SpaceAfterPostdecrementWhenFollowedBySubtract,
+ this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement,
+ this.NoSpaceAfterCloseBrace,
+ this.NewLineBeforeCloseBraceInBlockContext,
+ this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets,
+ this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration,
+ this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember,
+ this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand,
+ this.NoSpaceBetweenReturnAndSemicolon,
+ this.SpaceAfterCertainKeywords,
+ this.SpaceAfterLetConstInVariableDeclaration,
+ this.NoSpaceBeforeOpenParenInFuncCall,
+ this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator,
+ this.SpaceAfterVoidOperator,
+ this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword,
+ this.NoSpaceBetweenTagAndTemplateString,
+ this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement,
+ this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute,
+ this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport,
+ this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords,
+ this.SpaceAfterModuleName,
+ this.SpaceBeforeArrow, this.SpaceAfterArrow,
+ this.NoSpaceAfterEllipsis,
+ this.NoSpaceAfterOptionalParameters,
+ this.NoSpaceBetweenEmptyInterfaceBraceBrackets,
+ this.NoSpaceBeforeOpenAngularBracket,
+ this.NoSpaceBetweenCloseParenAndAngularBracket,
+ this.NoSpaceAfterOpenAngularBracket,
+ this.NoSpaceBeforeCloseAngularBracket,
+ this.NoSpaceAfterCloseAngularBracket,
+ this.SpaceBeforeAt,
+ this.NoSpaceAfterAt,
+ this.SpaceAfterDecorator,
+ ];
+ this.LowPriorityCommonRules = [
+ this.NoSpaceBeforeSemicolon,
+ this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock,
+ this.NoSpaceBeforeComma,
+ this.NoSpaceBeforeOpenBracket,
+ this.NoSpaceAfterCloseBracket,
+ this.SpaceAfterSemicolon,
+ this.NoSpaceBeforeOpenParenInFuncDecl,
+ this.SpaceBetweenStatements, this.SpaceAfterTryFinally
+ ];
+ this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), 2));
+ this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext), 8));
+ this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
+ this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));
+ this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8));
+ this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8));
+ this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2));
+ this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8));
+ this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1);
+ this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4), 1);
+ this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1);
+ this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 2));
+ this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 8));
+ this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(18, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(18, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(18, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(20, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([13, 14]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.SpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([13, 14]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([14, 15])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));
+ this.SpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([14, 15])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));
+ this.NoSpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8));
+ this.SpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2));
+ this.NoSpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8));
+ this.SpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2));
+ this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(88, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2));
+ this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(88, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8));
+ this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(28, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 8));
+ this.SpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(28, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 2));
}
- function getTextOfIdentifierOrLiteral(node) {
- if (node) {
- if (node.kind === 69 ||
- node.kind === 9 ||
- node.kind === 8) {
- return node.text;
+ Rules.prototype.getRuleName = function (rule) {
+ var o = this;
+ for (var name_51 in o) {
+ if (o[name_51] === rule) {
+ return name_51;
}
}
- return undefined;
- }
- function visit(node) {
- switch (node.kind) {
- case 220:
- case 179:
- case 147:
+ throw new Error("Unknown rule");
+ };
+ Rules.IsForContext = function (context) {
+ return context.contextNode.kind === 207;
+ };
+ Rules.IsNotForContext = function (context) {
+ return !Rules.IsForContext(context);
+ };
+ Rules.IsBinaryOpContext = function (context) {
+ switch (context.contextNode.kind) {
+ case 188:
+ case 189:
+ case 196:
+ case 239:
+ case 235:
+ case 155:
+ case 163:
+ case 164:
+ return true;
+ case 170:
+ case 224:
+ case 230:
+ case 219:
+ case 143:
+ case 255:
case 146:
- var functionDeclaration = node;
- var declarationName = getDeclarationName(functionDeclaration);
- if (declarationName) {
- var declarations = getDeclarations(declarationName);
- var lastDeclaration = ts.lastOrUndefined(declarations);
- if (lastDeclaration && functionDeclaration.parent === lastDeclaration.parent && functionDeclaration.symbol === lastDeclaration.symbol) {
- if (functionDeclaration.body && !lastDeclaration.body) {
- declarations[declarations.length - 1] = functionDeclaration;
- }
- }
- else {
- declarations.push(functionDeclaration);
- }
- ts.forEachChild(node, visit);
- }
- break;
+ case 145:
+ return context.currentTokenSpan.kind === 57 || context.nextTokenSpan.kind === 57;
+ case 208:
+ return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91;
+ case 209:
+ return context.currentTokenSpan.kind === 139 || context.nextTokenSpan.kind === 139;
+ }
+ return false;
+ };
+ Rules.IsNotBinaryOpContext = function (context) {
+ return !Rules.IsBinaryOpContext(context);
+ };
+ Rules.IsConditionalOperatorContext = function (context) {
+ return context.contextNode.kind === 189;
+ };
+ Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) {
+ return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context);
+ };
+ Rules.IsBeforeMultilineBlockContext = function (context) {
+ return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine());
+ };
+ Rules.IsMultilineBlockContext = function (context) {
+ return Rules.IsBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine());
+ };
+ Rules.IsSingleLineBlockContext = function (context) {
+ return Rules.IsBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine());
+ };
+ Rules.IsBlockContext = function (context) {
+ return Rules.NodeIsBlockContext(context.contextNode);
+ };
+ Rules.IsBeforeBlockContext = function (context) {
+ return Rules.NodeIsBlockContext(context.nextTokenParent);
+ };
+ Rules.NodeIsBlockContext = function (node) {
+ if (Rules.NodeIsTypeScriptDeclWithBlockContext(node)) {
+ return true;
+ }
+ switch (node.kind) {
+ case 200:
+ case 228:
+ case 172:
+ case 227:
+ return true;
+ }
+ return false;
+ };
+ Rules.IsFunctionDeclContext = function (context) {
+ switch (context.contextNode.kind) {
case 221:
- case 192:
+ case 148:
+ case 147:
+ case 150:
+ case 151:
+ case 152:
+ case 180:
+ case 149:
+ case 181:
+ case 223:
+ return true;
+ }
+ return false;
+ };
+ Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) {
+ return context.contextNode.kind === 221 || context.contextNode.kind === 180;
+ };
+ Rules.IsTypeScriptDeclWithBlockContext = function (context) {
+ return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode);
+ };
+ Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) {
+ switch (node.kind) {
case 222:
+ case 193:
case 223:
- case 224:
case 225:
- case 229:
+ case 160:
+ case 226:
+ case 237:
case 238:
- case 234:
- case 229:
case 231:
- case 232:
- case 149:
- case 150:
- case 159:
- addDeclaration(node);
- ts.forEachChild(node, visit);
- break;
- case 142:
- if (!ts.hasModifier(node, 92)) {
- break;
+ case 234:
+ return true;
+ }
+ return false;
+ };
+ Rules.IsAfterCodeBlockContext = function (context) {
+ switch (context.currentTokenParent.kind) {
+ case 222:
+ case 226:
+ case 225:
+ case 200:
+ case 252:
+ case 227:
+ case 214:
+ return true;
+ }
+ return false;
+ };
+ Rules.IsControlDeclContext = function (context) {
+ switch (context.contextNode.kind) {
+ case 204:
+ case 214:
+ case 207:
+ case 208:
+ case 209:
+ case 206:
+ case 217:
+ case 205:
+ case 213:
+ case 252:
+ return true;
+ default:
+ return false;
+ }
+ };
+ Rules.IsObjectContext = function (context) {
+ return context.contextNode.kind === 172;
+ };
+ Rules.IsFunctionCallContext = function (context) {
+ return context.contextNode.kind === 175;
+ };
+ Rules.IsNewContext = function (context) {
+ return context.contextNode.kind === 176;
+ };
+ Rules.IsFunctionCallOrNewContext = function (context) {
+ return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context);
+ };
+ Rules.IsPreviousTokenNotComma = function (context) {
+ return context.currentTokenSpan.kind !== 25;
+ };
+ Rules.IsNextTokenNotCloseBracket = function (context) {
+ return context.nextTokenSpan.kind !== 21;
+ };
+ Rules.IsArrowFunctionContext = function (context) {
+ return context.contextNode.kind === 181;
+ };
+ Rules.IsNonJsxSameLineTokenContext = function (context) {
+ return context.TokensAreOnSameLine() && context.contextNode.kind !== 10;
+ };
+ Rules.IsNonJsxElementContext = function (context) {
+ return context.contextNode.kind !== 242;
+ };
+ Rules.IsJsxExpressionContext = function (context) {
+ return context.contextNode.kind === 248;
+ };
+ Rules.IsNextTokenParentJsxAttribute = function (context) {
+ return context.nextTokenParent.kind === 246;
+ };
+ Rules.IsJsxAttributeContext = function (context) {
+ return context.contextNode.kind === 246;
+ };
+ Rules.IsJsxSelfClosingElementContext = function (context) {
+ return context.contextNode.kind === 243;
+ };
+ Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) {
+ return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context);
+ };
+ Rules.IsEndOfDecoratorContextOnSameLine = function (context) {
+ return context.TokensAreOnSameLine() &&
+ context.contextNode.decorators &&
+ Rules.NodeIsInDecoratorContext(context.currentTokenParent) &&
+ !Rules.NodeIsInDecoratorContext(context.nextTokenParent);
+ };
+ Rules.NodeIsInDecoratorContext = function (node) {
+ while (ts.isPartOfExpression(node)) {
+ node = node.parent;
+ }
+ return node.kind === 144;
+ };
+ Rules.IsStartOfVariableDeclarationList = function (context) {
+ return context.currentTokenParent.kind === 220 &&
+ context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos;
+ };
+ Rules.IsNotFormatOnEnter = function (context) {
+ return context.formattingRequestKind !== 2;
+ };
+ Rules.IsModuleDeclContext = function (context) {
+ return context.contextNode.kind === 226;
+ };
+ Rules.IsObjectTypeContext = function (context) {
+ return context.contextNode.kind === 160;
+ };
+ Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) {
+ if (token.kind !== 26 && token.kind !== 28) {
+ return false;
+ }
+ switch (parent.kind) {
+ case 156:
+ case 178:
+ case 222:
+ case 193:
+ case 223:
+ case 221:
+ case 180:
+ case 181:
+ case 148:
+ case 147:
+ case 152:
+ case 153:
+ case 175:
+ case 176:
+ case 195:
+ return true;
+ default:
+ return false;
+ }
+ };
+ Rules.IsTypeArgumentOrParameterOrAssertionContext = function (context) {
+ return Rules.IsTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) ||
+ Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent);
+ };
+ Rules.IsTypeAssertionContext = function (context) {
+ return context.contextNode.kind === 178;
+ };
+ Rules.IsVoidOpContext = function (context) {
+ return context.currentTokenSpan.kind === 104 && context.currentTokenParent.kind === 184;
+ };
+ Rules.IsYieldOrYieldStarWithOperand = function (context) {
+ return context.contextNode.kind === 191 && context.contextNode.expression !== undefined;
+ };
+ return Rules;
+ }());
+ formatting.Rules = Rules;
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ var RulesMap = (function () {
+ function RulesMap() {
+ this.map = [];
+ this.mapRowLength = 0;
+ }
+ RulesMap.create = function (rules) {
+ var result = new RulesMap();
+ result.Initialize(rules);
+ return result;
+ };
+ RulesMap.prototype.Initialize = function (rules) {
+ this.mapRowLength = 139 + 1;
+ this.map = new Array(this.mapRowLength * this.mapRowLength);
+ var rulesBucketConstructionStateList = new Array(this.map.length);
+ this.FillRules(rules, rulesBucketConstructionStateList);
+ return this.map;
+ };
+ RulesMap.prototype.FillRules = function (rules, rulesBucketConstructionStateList) {
+ var _this = this;
+ rules.forEach(function (rule) {
+ _this.FillRule(rule, rulesBucketConstructionStateList);
+ });
+ };
+ RulesMap.prototype.GetRuleBucketIndex = function (row, column) {
+ ts.Debug.assert(row <= 139 && column <= 139, "Must compute formatting context from tokens");
+ var rulesBucketIndex = (row * this.mapRowLength) + column;
+ return rulesBucketIndex;
+ };
+ RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) {
+ var _this = this;
+ var specificRule = rule.Descriptor.LeftTokenRange !== formatting.Shared.TokenRange.Any &&
+ rule.Descriptor.RightTokenRange !== formatting.Shared.TokenRange.Any;
+ rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) {
+ rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) {
+ var rulesBucketIndex = _this.GetRuleBucketIndex(left, right);
+ var rulesBucket = _this.map[rulesBucketIndex];
+ if (rulesBucket === undefined) {
+ rulesBucket = _this.map[rulesBucketIndex] = new RulesBucket();
}
- case 218:
- case 169: {
- var decl = node;
- if (ts.isBindingPattern(decl.name)) {
- ts.forEachChild(decl.name, visit);
- break;
+ rulesBucket.AddRule(rule, specificRule, rulesBucketConstructionStateList, rulesBucketIndex);
+ });
+ });
+ };
+ RulesMap.prototype.GetRule = function (context) {
+ var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind);
+ var bucket = this.map[bucketIndex];
+ if (bucket) {
+ for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) {
+ var rule = _a[_i];
+ if (rule.Operation.Context.InContext(context)) {
+ return rule;
}
- if (decl.initializer)
- visit(decl.initializer);
}
- case 255:
- case 145:
- case 144:
- addDeclaration(node);
- break;
- case 236:
- if (node.exportClause) {
- ts.forEach(node.exportClause.elements, visit);
- }
- break;
- case 230:
- var importClause = node.importClause;
- if (importClause) {
- if (importClause.name) {
- addDeclaration(importClause);
- }
- if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 232) {
- addDeclaration(importClause.namedBindings);
- }
- else {
- ts.forEach(importClause.namedBindings.elements, visit);
- }
- }
- }
- break;
- default:
- ts.forEachChild(node, visit);
}
+ return undefined;
+ };
+ return RulesMap;
+ }());
+ formatting.RulesMap = RulesMap;
+ var MaskBitSize = 5;
+ var Mask = 0x1f;
+ (function (RulesPosition) {
+ RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific";
+ RulesPosition[RulesPosition["IgnoreRulesAny"] = MaskBitSize * 1] = "IgnoreRulesAny";
+ RulesPosition[RulesPosition["ContextRulesSpecific"] = MaskBitSize * 2] = "ContextRulesSpecific";
+ RulesPosition[RulesPosition["ContextRulesAny"] = MaskBitSize * 3] = "ContextRulesAny";
+ RulesPosition[RulesPosition["NoContextRulesSpecific"] = MaskBitSize * 4] = "NoContextRulesSpecific";
+ RulesPosition[RulesPosition["NoContextRulesAny"] = MaskBitSize * 5] = "NoContextRulesAny";
+ })(formatting.RulesPosition || (formatting.RulesPosition = {}));
+ var RulesPosition = formatting.RulesPosition;
+ var RulesBucketConstructionState = (function () {
+ function RulesBucketConstructionState() {
+ this.rulesInsertionIndexBitmap = 0;
}
- };
- return SourceFileObject;
- }(NodeObject));
- function getServicesObjectAllocator() {
- return {
- getNodeConstructor: function () { return NodeObject; },
- getTokenConstructor: function () { return TokenObject; },
- getIdentifierConstructor: function () { return IdentifierObject; },
- getSourceFileConstructor: function () { return SourceFileObject; },
- getSymbolConstructor: function () { return SymbolObject; },
- getTypeConstructor: function () { return TypeObject; },
- getSignatureConstructor: function () { return SignatureObject; }
- };
- }
- function toEditorSettings(optionsAsMap) {
- var allPropertiesAreCamelCased = true;
- for (var key in optionsAsMap) {
- if (ts.hasProperty(optionsAsMap, key) && !isCamelCase(key)) {
- allPropertiesAreCamelCased = false;
- break;
- }
- }
- if (allPropertiesAreCamelCased) {
- return optionsAsMap;
- }
- var settings = {};
- for (var key in optionsAsMap) {
- if (ts.hasProperty(optionsAsMap, key)) {
- var newKey = isCamelCase(key) ? key : key.charAt(0).toLowerCase() + key.substr(1);
- settings[newKey] = optionsAsMap[key];
- }
- }
- return settings;
- }
- ts.toEditorSettings = toEditorSettings;
- function isCamelCase(s) {
- return !s.length || s.charAt(0) === s.charAt(0).toLowerCase();
- }
- function displayPartsToString(displayParts) {
- if (displayParts) {
- return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join("");
- }
- return "";
- }
- ts.displayPartsToString = displayPartsToString;
- function getDefaultCompilerOptions() {
- return {
- target: 1,
- jsx: 1
- };
- }
- ts.getDefaultCompilerOptions = getDefaultCompilerOptions;
- function getSupportedCodeFixes() {
- return ts.codefix.getSupportedErrorCodes();
- }
- ts.getSupportedCodeFixes = getSupportedCodeFixes;
- var HostCache = (function () {
- function HostCache(host, getCanonicalFileName) {
- this.host = host;
- this.getCanonicalFileName = getCanonicalFileName;
- this.currentDirectory = host.getCurrentDirectory();
- this.fileNameToEntry = ts.createFileMap();
- var rootFileNames = host.getScriptFileNames();
- for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) {
- var fileName = rootFileNames_1[_i];
- this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName));
- }
- this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
- }
- HostCache.prototype.compilationSettings = function () {
- return this._compilationSettings;
- };
- HostCache.prototype.createEntry = function (fileName, path) {
- var entry;
- var scriptSnapshot = this.host.getScriptSnapshot(fileName);
- if (scriptSnapshot) {
- entry = {
- hostFileName: fileName,
- version: this.host.getScriptVersion(fileName),
- scriptSnapshot: scriptSnapshot,
- scriptKind: ts.getScriptKind(fileName, this.host)
- };
- }
- this.fileNameToEntry.set(path, entry);
- return entry;
- };
- HostCache.prototype.getEntry = function (path) {
- return this.fileNameToEntry.get(path);
- };
- HostCache.prototype.contains = function (path) {
- return this.fileNameToEntry.contains(path);
- };
- HostCache.prototype.getOrCreateEntry = function (fileName) {
- var path = ts.toPath(fileName, this.currentDirectory, this.getCanonicalFileName);
- return this.getOrCreateEntryByPath(fileName, path);
- };
- HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) {
- return this.contains(path)
- ? this.getEntry(path)
- : this.createEntry(fileName, path);
- };
- HostCache.prototype.getRootFileNames = function () {
- var fileNames = [];
- this.fileNameToEntry.forEachValue(function (path, value) {
- if (value) {
- fileNames.push(value.hostFileName);
+ RulesBucketConstructionState.prototype.GetInsertionIndex = function (maskPosition) {
+ var index = 0;
+ var pos = 0;
+ var indexBitmap = this.rulesInsertionIndexBitmap;
+ while (pos <= maskPosition) {
+ index += (indexBitmap & Mask);
+ indexBitmap >>= MaskBitSize;
+ pos += MaskBitSize;
}
- });
- return fileNames;
- };
- HostCache.prototype.getVersion = function (path) {
- var file = this.getEntry(path);
- return file && file.version;
- };
- HostCache.prototype.getScriptSnapshot = function (path) {
- var file = this.getEntry(path);
- return file && file.scriptSnapshot;
- };
- return HostCache;
- }());
- var SyntaxTreeCache = (function () {
- function SyntaxTreeCache(host) {
- this.host = host;
- }
- SyntaxTreeCache.prototype.getCurrentSourceFile = function (fileName) {
- var scriptSnapshot = this.host.getScriptSnapshot(fileName);
- if (!scriptSnapshot) {
- throw new Error("Could not find file: '" + fileName + "'.");
- }
- var scriptKind = ts.getScriptKind(fileName, this.host);
- var version = this.host.getScriptVersion(fileName);
- var sourceFile;
- if (this.currentFileName !== fileName) {
- sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, version, true, scriptKind);
- }
- else if (this.currentFileVersion !== version) {
- var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot);
- sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange);
+ return index;
+ };
+ RulesBucketConstructionState.prototype.IncreaseInsertionIndex = function (maskPosition) {
+ var value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask;
+ value++;
+ ts.Debug.assert((value & Mask) === value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules.");
+ var temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition);
+ temp |= value << maskPosition;
+ this.rulesInsertionIndexBitmap = temp;
+ };
+ return RulesBucketConstructionState;
+ }());
+ formatting.RulesBucketConstructionState = RulesBucketConstructionState;
+ var RulesBucket = (function () {
+ function RulesBucket() {
+ this.rules = [];
}
- if (sourceFile) {
- this.currentFileVersion = version;
- this.currentFileName = fileName;
- this.currentFileScriptSnapshot = scriptSnapshot;
- this.currentSourceFile = sourceFile;
- }
- return this.currentSourceFile;
- };
- return SyntaxTreeCache;
- }());
- function setSourceFileFields(sourceFile, scriptSnapshot, version) {
- sourceFile.version = version;
- sourceFile.scriptSnapshot = scriptSnapshot;
- }
- function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents, scriptKind) {
- var text = scriptSnapshot.getText(0, scriptSnapshot.getLength());
- var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents, scriptKind);
- setSourceFileFields(sourceFile, scriptSnapshot, version);
- return sourceFile;
- }
- ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile;
- ts.disableIncrementalParsing = false;
- function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) {
- if (textChangeRange) {
- if (version !== sourceFile.version) {
- if (!ts.disableIncrementalParsing) {
- var newText = void 0;
- var prefix = textChangeRange.span.start !== 0
- ? sourceFile.text.substr(0, textChangeRange.span.start)
- : "";
- var suffix = ts.textSpanEnd(textChangeRange.span) !== sourceFile.text.length
- ? sourceFile.text.substr(ts.textSpanEnd(textChangeRange.span))
- : "";
- if (textChangeRange.newLength === 0) {
- newText = prefix && suffix ? prefix + suffix : prefix || suffix;
- }
- else {
- var changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength);
- newText = prefix && suffix
- ? prefix + changedText + suffix
- : prefix
- ? (prefix + changedText)
- : (changedText + suffix);
- }
- var newSourceFile = ts.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
- setSourceFileFields(newSourceFile, scriptSnapshot, version);
- newSourceFile.nameTable = undefined;
- if (sourceFile !== newSourceFile && sourceFile.scriptSnapshot) {
- if (sourceFile.scriptSnapshot.dispose) {
- sourceFile.scriptSnapshot.dispose();
+ RulesBucket.prototype.Rules = function () {
+ return this.rules;
+ };
+ RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) {
+ var position;
+ if (rule.Operation.Action === 1) {
+ position = specificTokens ?
+ RulesPosition.IgnoreRulesSpecific :
+ RulesPosition.IgnoreRulesAny;
+ }
+ else if (!rule.Operation.Context.IsAny()) {
+ position = specificTokens ?
+ RulesPosition.ContextRulesSpecific :
+ RulesPosition.ContextRulesAny;
+ }
+ else {
+ position = specificTokens ?
+ RulesPosition.NoContextRulesSpecific :
+ RulesPosition.NoContextRulesAny;
+ }
+ var state = constructionState[rulesBucketIndex];
+ if (state === undefined) {
+ state = constructionState[rulesBucketIndex] = new RulesBucketConstructionState();
+ }
+ var index = state.GetInsertionIndex(position);
+ this.rules.splice(index, 0, rule);
+ state.IncreaseInsertionIndex(position);
+ };
+ return RulesBucket;
+ }());
+ formatting.RulesBucket = RulesBucket;
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ var Shared;
+ (function (Shared) {
+ var TokenRangeAccess = (function () {
+ function TokenRangeAccess(from, to, except) {
+ this.tokens = [];
+ for (var token = from; token <= to; token++) {
+ if (ts.indexOf(except, token) < 0) {
+ this.tokens.push(token);
}
- sourceFile.scriptSnapshot = undefined;
}
- return newSourceFile;
}
- }
- }
- return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, true, sourceFile.scriptKind);
- }
- ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile;
- var CancellationTokenObject = (function () {
- function CancellationTokenObject(cancellationToken) {
- this.cancellationToken = cancellationToken;
- }
- CancellationTokenObject.prototype.isCancellationRequested = function () {
- return this.cancellationToken && this.cancellationToken.isCancellationRequested();
- };
- CancellationTokenObject.prototype.throwIfCancellationRequested = function () {
- if (this.isCancellationRequested()) {
- throw new ts.OperationCanceledException();
- }
- };
- return CancellationTokenObject;
- }());
- function createLanguageService(host, documentRegistry) {
- if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); }
- var syntaxTreeCache = new SyntaxTreeCache(host);
- var ruleProvider;
- var program;
- var lastProjectVersion;
- var lastTypesRootVersion = 0;
- var useCaseSensitivefileNames = host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames();
- var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken());
- var currentDirectory = host.getCurrentDirectory();
- if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) {
- ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();
- }
- function log(message) {
- if (host.log) {
- host.log(message);
- }
- }
- var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitivefileNames);
- function getValidSourceFile(fileName) {
- var sourceFile = program.getSourceFile(fileName);
- if (!sourceFile) {
- throw new Error("Could not find file: '" + fileName + "'.");
- }
- return sourceFile;
- }
- function getRuleProvider(options) {
- if (!ruleProvider) {
- ruleProvider = new ts.formatting.RulesProvider();
- }
- ruleProvider.ensureUpToDate(options);
- return ruleProvider;
- }
- function synchronizeHostData() {
- if (host.getProjectVersion) {
- var hostProjectVersion = host.getProjectVersion();
- if (hostProjectVersion) {
- if (lastProjectVersion === hostProjectVersion) {
- return;
- }
- lastProjectVersion = hostProjectVersion;
+ TokenRangeAccess.prototype.GetTokens = function () {
+ return this.tokens;
+ };
+ TokenRangeAccess.prototype.Contains = function (token) {
+ return this.tokens.indexOf(token) >= 0;
+ };
+ return TokenRangeAccess;
+ }());
+ Shared.TokenRangeAccess = TokenRangeAccess;
+ var TokenValuesAccess = (function () {
+ function TokenValuesAccess(tks) {
+ this.tokens = tks && tks.length ? tks : [];
}
- }
- var typeRootsVersion = host.getTypeRootsVersion ? host.getTypeRootsVersion() : 0;
- if (lastTypesRootVersion !== typeRootsVersion) {
- log("TypeRoots version has changed; provide new program");
- program = undefined;
- lastTypesRootVersion = typeRootsVersion;
- }
- var hostCache = new HostCache(host, getCanonicalFileName);
- if (programUpToDate()) {
- return;
- }
- var oldSettings = program && program.getCompilerOptions();
- var newSettings = hostCache.compilationSettings();
- var shouldCreateNewSourceFiles = oldSettings &&
- (oldSettings.target !== newSettings.target ||
- oldSettings.module !== newSettings.module ||
- oldSettings.moduleResolution !== newSettings.moduleResolution ||
- oldSettings.noResolve !== newSettings.noResolve ||
- oldSettings.jsx !== newSettings.jsx ||
- oldSettings.allowJs !== newSettings.allowJs ||
- oldSettings.disableSizeLimit !== oldSettings.disableSizeLimit ||
- oldSettings.baseUrl !== newSettings.baseUrl ||
- !ts.equalOwnProperties(oldSettings.paths, newSettings.paths));
- var compilerHost = {
- getSourceFile: getOrCreateSourceFile,
- getSourceFileByPath: getOrCreateSourceFileByPath,
- getCancellationToken: function () { return cancellationToken; },
- getCanonicalFileName: getCanonicalFileName,
- useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; },
- getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); },
- getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
- writeFile: function (fileName, data, writeByteOrderMark) { },
- getCurrentDirectory: function () { return currentDirectory; },
- fileExists: function (fileName) {
- return hostCache.getOrCreateEntry(fileName) !== undefined;
- },
- readFile: function (fileName) {
- var entry = hostCache.getOrCreateEntry(fileName);
- return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength());
- },
- directoryExists: function (directoryName) {
- return ts.directoryProbablyExists(directoryName, host);
- },
- getDirectories: function (path) {
- return host.getDirectories ? host.getDirectories(path) : [];
+ TokenValuesAccess.prototype.GetTokens = function () {
+ return this.tokens;
+ };
+ TokenValuesAccess.prototype.Contains = function (token) {
+ return this.tokens.indexOf(token) >= 0;
+ };
+ return TokenValuesAccess;
+ }());
+ Shared.TokenValuesAccess = TokenValuesAccess;
+ var TokenSingleValueAccess = (function () {
+ function TokenSingleValueAccess(token) {
+ this.token = token;
}
- };
- if (host.trace) {
- compilerHost.trace = function (message) { return host.trace(message); };
- }
- if (host.resolveModuleNames) {
- compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); };
- }
- if (host.resolveTypeReferenceDirectives) {
- compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) {
- return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile);
+ TokenSingleValueAccess.prototype.GetTokens = function () {
+ return [this.token];
};
- }
- var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
- var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program);
- if (program) {
- var oldSourceFiles = program.getSourceFiles();
- var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldSettings);
- for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) {
- var oldSourceFile = oldSourceFiles_1[_i];
- if (!newProgram.getSourceFile(oldSourceFile.fileName) || shouldCreateNewSourceFiles) {
- documentRegistry.releaseDocumentWithKey(oldSourceFile.path, oldSettingsKey);
+ TokenSingleValueAccess.prototype.Contains = function (tokenValue) {
+ return tokenValue === this.token;
+ };
+ return TokenSingleValueAccess;
+ }());
+ Shared.TokenSingleValueAccess = TokenSingleValueAccess;
+ var TokenAllAccess = (function () {
+ function TokenAllAccess() {
+ }
+ TokenAllAccess.prototype.GetTokens = function () {
+ var result = [];
+ for (var token = 0; token <= 139; token++) {
+ result.push(token);
}
+ return result;
+ };
+ TokenAllAccess.prototype.Contains = function () {
+ return true;
+ };
+ TokenAllAccess.prototype.toString = function () {
+ return "[allTokens]";
+ };
+ return TokenAllAccess;
+ }());
+ Shared.TokenAllAccess = TokenAllAccess;
+ var TokenRange = (function () {
+ function TokenRange(tokenAccess) {
+ this.tokenAccess = tokenAccess;
}
+ TokenRange.FromToken = function (token) {
+ return new TokenRange(new TokenSingleValueAccess(token));
+ };
+ TokenRange.FromTokens = function (tokens) {
+ return new TokenRange(new TokenValuesAccess(tokens));
+ };
+ TokenRange.FromRange = function (f, to, except) {
+ if (except === void 0) { except = []; }
+ return new TokenRange(new TokenRangeAccess(f, to, except));
+ };
+ TokenRange.AllTokens = function () {
+ return new TokenRange(new TokenAllAccess());
+ };
+ TokenRange.prototype.GetTokens = function () {
+ return this.tokenAccess.GetTokens();
+ };
+ TokenRange.prototype.Contains = function (token) {
+ return this.tokenAccess.Contains(token);
+ };
+ TokenRange.prototype.toString = function () {
+ return this.tokenAccess.toString();
+ };
+ return TokenRange;
+ }());
+ TokenRange.Any = TokenRange.AllTokens();
+ TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3]));
+ TokenRange.Keywords = TokenRange.FromRange(71, 139);
+ TokenRange.BinaryOperators = TokenRange.FromRange(26, 69);
+ TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91, 92, 139, 117, 125]);
+ TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42, 43, 51, 50]);
+ TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 70, 18, 20, 16, 98, 93]);
+ TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]);
+ TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([70, 19, 21, 93]);
+ TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]);
+ TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70, 19, 21, 93]);
+ TokenRange.Comments = TokenRange.FromTokens([2, 3]);
+ TokenRange.TypeNames = TokenRange.FromTokens([70, 131, 133, 121, 134, 104, 118]);
+ Shared.TokenRange = TokenRange;
+ })(Shared = formatting.Shared || (formatting.Shared = {}));
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ var RulesProvider = (function () {
+ function RulesProvider() {
+ this.globalRules = new formatting.Rules();
}
- hostCache = undefined;
- program = newProgram;
- program.getTypeChecker();
- return;
- function getOrCreateSourceFile(fileName) {
- return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName));
- }
- function getOrCreateSourceFileByPath(fileName, path) {
- ts.Debug.assert(hostCache !== undefined);
- var hostFileInformation = hostCache.getOrCreateEntryByPath(fileName, path);
- if (!hostFileInformation) {
- return undefined;
+ RulesProvider.prototype.getRuleName = function (rule) {
+ return this.globalRules.getRuleName(rule);
+ };
+ RulesProvider.prototype.getRuleByName = function (name) {
+ return this.globalRules[name];
+ };
+ RulesProvider.prototype.getRulesMap = function () {
+ return this.rulesMap;
+ };
+ RulesProvider.prototype.ensureUpToDate = function (options) {
+ if (!this.options || !ts.compareDataObjects(this.options, options)) {
+ var activeRules = this.createActiveRules(options);
+ var rulesMap = formatting.RulesMap.create(activeRules);
+ this.activeRules = activeRules;
+ this.rulesMap = rulesMap;
+ this.options = ts.clone(options);
}
- if (!shouldCreateNewSourceFiles) {
- var oldSourceFile = program && program.getSourceFileByPath(path);
- if (oldSourceFile) {
- ts.Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind + ") for file: " + path);
- return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind);
- }
+ };
+ RulesProvider.prototype.createActiveRules = function (options) {
+ var rules = this.globalRules.HighPriorityCommonRules.slice(0);
+ if (options.insertSpaceAfterCommaDelimiter) {
+ rules.push(this.globalRules.SpaceAfterComma);
}
- return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind);
- }
- function sourceFileUpToDate(sourceFile) {
- if (!sourceFile) {
- return false;
+ else {
+ rules.push(this.globalRules.NoSpaceAfterComma);
}
- var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName);
- return sourceFile.version === hostCache.getVersion(path);
- }
- function programUpToDate() {
- if (!program) {
- return false;
+ if (options.insertSpaceAfterFunctionKeywordForAnonymousFunctions) {
+ rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword);
}
- var rootFileNames = hostCache.getRootFileNames();
- if (program.getSourceFiles().length !== rootFileNames.length) {
- return false;
+ else {
+ rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword);
}
- for (var _i = 0, rootFileNames_2 = rootFileNames; _i < rootFileNames_2.length; _i++) {
- var fileName = rootFileNames_2[_i];
- if (!sourceFileUpToDate(program.getSourceFile(fileName))) {
- return false;
- }
+ if (options.insertSpaceAfterKeywordsInControlFlowStatements) {
+ rules.push(this.globalRules.SpaceAfterKeywordInControl);
}
- return ts.compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings());
+ else {
+ rules.push(this.globalRules.NoSpaceAfterKeywordInControl);
+ }
+ if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) {
+ rules.push(this.globalRules.SpaceAfterOpenParen);
+ rules.push(this.globalRules.SpaceBeforeCloseParen);
+ rules.push(this.globalRules.NoSpaceBetweenParens);
+ }
+ else {
+ rules.push(this.globalRules.NoSpaceAfterOpenParen);
+ rules.push(this.globalRules.NoSpaceBeforeCloseParen);
+ rules.push(this.globalRules.NoSpaceBetweenParens);
+ }
+ if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) {
+ rules.push(this.globalRules.SpaceAfterOpenBracket);
+ rules.push(this.globalRules.SpaceBeforeCloseBracket);
+ rules.push(this.globalRules.NoSpaceBetweenBrackets);
+ }
+ else {
+ rules.push(this.globalRules.NoSpaceAfterOpenBracket);
+ rules.push(this.globalRules.NoSpaceBeforeCloseBracket);
+ rules.push(this.globalRules.NoSpaceBetweenBrackets);
+ }
+ if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces !== false) {
+ rules.push(this.globalRules.SpaceAfterOpenBrace);
+ rules.push(this.globalRules.SpaceBeforeCloseBrace);
+ rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets);
+ }
+ else {
+ rules.push(this.globalRules.NoSpaceAfterOpenBrace);
+ rules.push(this.globalRules.NoSpaceBeforeCloseBrace);
+ rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets);
+ }
+ if (options.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) {
+ rules.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle);
+ rules.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail);
+ }
+ else {
+ rules.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle);
+ rules.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail);
+ }
+ if (options.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces) {
+ rules.push(this.globalRules.SpaceAfterOpenBraceInJsxExpression);
+ rules.push(this.globalRules.SpaceBeforeCloseBraceInJsxExpression);
+ }
+ else {
+ rules.push(this.globalRules.NoSpaceAfterOpenBraceInJsxExpression);
+ rules.push(this.globalRules.NoSpaceBeforeCloseBraceInJsxExpression);
+ }
+ if (options.insertSpaceAfterSemicolonInForStatements) {
+ rules.push(this.globalRules.SpaceAfterSemicolonInFor);
+ }
+ else {
+ rules.push(this.globalRules.NoSpaceAfterSemicolonInFor);
+ }
+ if (options.insertSpaceBeforeAndAfterBinaryOperators) {
+ rules.push(this.globalRules.SpaceBeforeBinaryOperator);
+ rules.push(this.globalRules.SpaceAfterBinaryOperator);
+ }
+ else {
+ rules.push(this.globalRules.NoSpaceBeforeBinaryOperator);
+ rules.push(this.globalRules.NoSpaceAfterBinaryOperator);
+ }
+ if (options.placeOpenBraceOnNewLineForControlBlocks) {
+ rules.push(this.globalRules.NewLineBeforeOpenBraceInControl);
+ }
+ if (options.placeOpenBraceOnNewLineForFunctions) {
+ rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction);
+ rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock);
+ }
+ if (options.insertSpaceAfterTypeAssertion) {
+ rules.push(this.globalRules.SpaceAfterTypeAssertion);
+ }
+ else {
+ rules.push(this.globalRules.NoSpaceAfterTypeAssertion);
+ }
+ rules = rules.concat(this.globalRules.LowPriorityCommonRules);
+ return rules;
+ };
+ return RulesProvider;
+ }());
+ formatting.RulesProvider = RulesProvider;
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ var Constants;
+ (function (Constants) {
+ Constants[Constants["Unknown"] = -1] = "Unknown";
+ })(Constants || (Constants = {}));
+ function formatOnEnter(position, sourceFile, rulesProvider, options) {
+ var line = sourceFile.getLineAndCharacterOfPosition(position).line;
+ if (line === 0) {
+ return [];
+ }
+ var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile);
+ while (ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(endOfFormatSpan))) {
+ endOfFormatSpan--;
}
+ if (ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) {
+ endOfFormatSpan--;
+ }
+ var span = {
+ pos: ts.getStartPositionOfLine(line - 1, sourceFile),
+ end: endOfFormatSpan + 1
+ };
+ return formatSpan(span, sourceFile, options, rulesProvider, 2);
}
- function getProgram() {
- synchronizeHostData();
- return program;
+ formatting.formatOnEnter = formatOnEnter;
+ function formatOnSemicolon(position, sourceFile, rulesProvider, options) {
+ return formatOutermostParent(position, 24, sourceFile, options, rulesProvider, 3);
}
- function cleanupSemanticCache() {
+ formatting.formatOnSemicolon = formatOnSemicolon;
+ function formatOnClosingCurly(position, sourceFile, rulesProvider, options) {
+ return formatOutermostParent(position, 17, sourceFile, options, rulesProvider, 4);
}
- function dispose() {
- if (program) {
- ts.forEach(program.getSourceFiles(), function (f) {
- return documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions());
- });
- }
+ formatting.formatOnClosingCurly = formatOnClosingCurly;
+ function formatDocument(sourceFile, rulesProvider, options) {
+ var span = {
+ pos: 0,
+ end: sourceFile.text.length
+ };
+ return formatSpan(span, sourceFile, options, rulesProvider, 0);
}
- function getSyntacticDiagnostics(fileName) {
- synchronizeHostData();
- return program.getSyntacticDiagnostics(getValidSourceFile(fileName), cancellationToken);
+ formatting.formatDocument = formatDocument;
+ function formatSelection(start, end, sourceFile, rulesProvider, options) {
+ var span = {
+ pos: ts.getLineStartPositionForPosition(start, sourceFile),
+ end: end
+ };
+ return formatSpan(span, sourceFile, options, rulesProvider, 1);
}
- function getSemanticDiagnostics(fileName) {
- synchronizeHostData();
- var targetSourceFile = getValidSourceFile(fileName);
- var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken);
- if (!program.getCompilerOptions().declaration) {
- return semanticDiagnostics;
+ formatting.formatSelection = formatSelection;
+ function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) {
+ var parent = findOutermostParent(position, expectedLastToken, sourceFile);
+ if (!parent) {
+ return [];
}
- var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken);
- return ts.concatenate(semanticDiagnostics, declarationDiagnostics);
- }
- function getCompilerOptionsDiagnostics() {
- synchronizeHostData();
- return program.getOptionsDiagnostics(cancellationToken).concat(program.getGlobalDiagnostics(cancellationToken));
- }
- function getCompletionsAtPosition(fileName, position) {
- synchronizeHostData();
- return ts.Completions.getCompletionsAtPosition(host, program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position);
- }
- function getCompletionEntryDetails(fileName, position, entryName) {
- synchronizeHostData();
- return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, entryName);
- }
- function getCompletionEntrySymbol(fileName, position, entryName) {
- synchronizeHostData();
- return ts.Completions.getCompletionEntrySymbol(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, entryName);
+ var span = {
+ pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile),
+ end: parent.end
+ };
+ return formatSpan(span, sourceFile, options, rulesProvider, requestKind);
}
- function getQuickInfoAtPosition(fileName, position) {
- synchronizeHostData();
- var sourceFile = getValidSourceFile(fileName);
- var node = ts.getTouchingPropertyName(sourceFile, position);
- if (node === sourceFile) {
- return undefined;
- }
- if (ts.isLabelName(node)) {
+ function findOutermostParent(position, expectedTokenKind, sourceFile) {
+ var precedingToken = ts.findPrecedingToken(position, sourceFile);
+ if (!precedingToken ||
+ precedingToken.kind !== expectedTokenKind ||
+ position !== precedingToken.getEnd()) {
return undefined;
}
- var typeChecker = program.getTypeChecker();
- var symbol = typeChecker.getSymbolAtLocation(node);
- if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
- switch (node.kind) {
- case 69:
- case 172:
- case 139:
- case 97:
- case 165:
- case 95:
- var type = typeChecker.getTypeAtLocation(node);
- if (type) {
- return {
- kind: ts.ScriptElementKind.unknown,
- kindModifiers: ts.ScriptElementKindModifier.none,
- textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),
- displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)),
- documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined
- };
- }
- }
- return undefined;
+ var current = precedingToken;
+ while (current &&
+ current.parent &&
+ current.parent.end === precedingToken.end &&
+ !isListElement(current.parent, current)) {
+ current = current.parent;
}
- var displayPartsDocumentationsAndKind = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node);
- return {
- kind: displayPartsDocumentationsAndKind.symbolKind,
- kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),
- displayParts: displayPartsDocumentationsAndKind.displayParts,
- documentation: displayPartsDocumentationsAndKind.documentation
- };
- }
- function getDefinitionAtPosition(fileName, position) {
- synchronizeHostData();
- return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
- }
- function getImplementationAtPosition(fileName, position) {
- synchronizeHostData();
- return ts.GoToImplementation.getImplementationAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), ts.getTouchingPropertyName(getValidSourceFile(fileName), position));
- }
- function getTypeDefinitionAtPosition(fileName, position) {
- synchronizeHostData();
- return ts.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position);
+ return current;
}
- function getOccurrencesAtPosition(fileName, position) {
- var results = getOccurrencesAtPositionCore(fileName, position);
- if (results) {
- var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName));
- results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; });
+ function isListElement(parent, node) {
+ switch (parent.kind) {
+ case 222:
+ case 223:
+ return ts.rangeContainsRange(parent.members, node);
+ case 226:
+ var body = parent.body;
+ return body && body.kind === 227 && ts.rangeContainsRange(body.statements, node);
+ case 256:
+ case 200:
+ case 227:
+ return ts.rangeContainsRange(parent.statements, node);
+ case 252:
+ return ts.rangeContainsRange(parent.block.statements, node);
}
- return results;
- }
- function getDocumentHighlights(fileName, position, filesToSearch) {
- synchronizeHostData();
- var sourceFilesToSearch = ts.map(filesToSearch, function (f) { return program.getSourceFile(f); });
- var sourceFile = getValidSourceFile(fileName);
- return ts.DocumentHighlights.getDocumentHighlights(program.getTypeChecker(), cancellationToken, sourceFile, position, sourceFilesToSearch);
+ return false;
}
- function getOccurrencesAtPositionCore(fileName, position) {
- synchronizeHostData();
- return convertDocumentHighlights(getDocumentHighlights(fileName, position, [fileName]));
- function convertDocumentHighlights(documentHighlights) {
- if (!documentHighlights) {
- return undefined;
- }
- var result = [];
- for (var _i = 0, documentHighlights_1 = documentHighlights; _i < documentHighlights_1.length; _i++) {
- var entry = documentHighlights_1[_i];
- for (var _a = 0, _b = entry.highlightSpans; _a < _b.length; _a++) {
- var highlightSpan = _b[_a];
- result.push({
- fileName: entry.fileName,
- textSpan: highlightSpan.textSpan,
- isWriteAccess: highlightSpan.kind === ts.HighlightSpanKind.writtenReference,
- isDefinition: false
- });
+ function findEnclosingNode(range, sourceFile) {
+ return find(sourceFile);
+ function find(n) {
+ var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; });
+ if (candidate) {
+ var result = find(candidate);
+ if (result) {
+ return result;
}
}
- return result;
- }
- }
- function findRenameLocations(fileName, position, findInStrings, findInComments) {
- var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments);
- return ts.FindAllReferences.convertReferences(referencedSymbols);
- }
- function getReferencesAtPosition(fileName, position) {
- var referencedSymbols = findReferencedSymbols(fileName, position, false, false);
- return ts.FindAllReferences.convertReferences(referencedSymbols);
- }
- function findReferences(fileName, position) {
- var referencedSymbols = findReferencedSymbols(fileName, position, false, false);
- return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; });
- }
- function findReferencedSymbols(fileName, position, findInStrings, findInComments) {
- synchronizeHostData();
- return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments);
- }
- function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) {
- synchronizeHostData();
- var sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles();
- return ts.NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles);
- }
- function getEmitOutput(fileName, emitOnlyDtsFiles) {
- synchronizeHostData();
- var sourceFile = getValidSourceFile(fileName);
- var outputFiles = [];
- function writeFile(fileName, data, writeByteOrderMark) {
- outputFiles.push({
- name: fileName,
- writeByteOrderMark: writeByteOrderMark,
- text: data
- });
+ return n;
}
- var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles);
- return {
- outputFiles: outputFiles,
- emitSkipped: emitOutput.emitSkipped
- };
- }
- function getSignatureHelpItems(fileName, position) {
- synchronizeHostData();
- var sourceFile = getValidSourceFile(fileName);
- return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken);
- }
- function getNonBoundSourceFile(fileName) {
- return syntaxTreeCache.getCurrentSourceFile(fileName);
}
- function getSourceFile(fileName) {
- return getNonBoundSourceFile(fileName);
- }
- function getNameOrDottedNameSpan(fileName, startPos, endPos) {
- var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
- var node = ts.getTouchingPropertyName(sourceFile, startPos);
- if (node === sourceFile) {
- return;
+ function prepareRangeContainsErrorFunction(errors, originalRange) {
+ if (!errors.length) {
+ return rangeHasNoErrors;
}
- switch (node.kind) {
- case 172:
- case 139:
- case 9:
- case 84:
- case 99:
- case 93:
- case 95:
- case 97:
- case 165:
- case 69:
- break;
- default:
- return;
+ var sorted = errors
+ .filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); })
+ .sort(function (e1, e2) { return e1.start - e2.start; });
+ if (!sorted.length) {
+ return rangeHasNoErrors;
}
- var nodeForStartPos = node;
- while (true) {
- if (ts.isRightSideOfPropertyAccess(nodeForStartPos) || ts.isRightSideOfQualifiedName(nodeForStartPos)) {
- nodeForStartPos = nodeForStartPos.parent;
- }
- else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) {
- if (nodeForStartPos.parent.parent.kind === 225 &&
- nodeForStartPos.parent.parent.body === nodeForStartPos.parent) {
- nodeForStartPos = nodeForStartPos.parent.parent.name;
+ var index = 0;
+ return function (r) {
+ while (true) {
+ if (index >= sorted.length) {
+ return false;
}
- else {
- break;
+ var error = sorted[index];
+ if (r.end <= error.start) {
+ return false;
}
+ if (ts.startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) {
+ return true;
+ }
+ index++;
}
- else {
- break;
- }
+ };
+ function rangeHasNoErrors() {
+ return false;
}
- return ts.createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd());
- }
- function getBreakpointStatementAtPosition(fileName, position) {
- var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
- return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position);
- }
- function getNavigationBarItems(fileName) {
- return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName));
- }
- function getNavigationTree(fileName) {
- return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName));
- }
- function isTsOrTsxFile(fileName) {
- var kind = ts.getScriptKind(fileName, host);
- return kind === 3 || kind === 4;
}
- function getSemanticClassifications(fileName, span) {
- if (!isTsOrTsxFile(fileName)) {
- return [];
+ function getScanStartPosition(enclosingNode, originalRange, sourceFile) {
+ var start = enclosingNode.getStart(sourceFile);
+ if (start === originalRange.pos && enclosingNode.end === originalRange.end) {
+ return start;
}
- synchronizeHostData();
- return ts.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
- }
- function getEncodedSemanticClassifications(fileName, span) {
- if (!isTsOrTsxFile(fileName)) {
- return { spans: [], endOfLineState: 0 };
+ var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile);
+ if (!precedingToken) {
+ return enclosingNode.pos;
}
- synchronizeHostData();
- return ts.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
- }
- function getSyntacticClassifications(fileName, span) {
- return ts.getSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);
- }
- function getEncodedSyntacticClassifications(fileName, span) {
- return ts.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);
- }
- function getOutliningSpans(fileName) {
- var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
- return ts.OutliningElementsCollector.collectElements(sourceFile);
+ if (precedingToken.end >= originalRange.pos) {
+ return enclosingNode.pos;
+ }
+ return precedingToken.end;
}
- function getBraceMatchingAtPosition(fileName, position) {
- var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
- var result = [];
- var token = ts.getTouchingToken(sourceFile, position);
- if (token.getStart(sourceFile) === position) {
- var matchKind = getMatchingTokenKind(token);
- if (matchKind) {
- var parentElement = token.parent;
- var childNodes = parentElement.getChildren(sourceFile);
- for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) {
- var current = childNodes_1[_i];
- if (current.kind === matchKind) {
- var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile));
- var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile));
- if (range1.start < range2.start) {
- result.push(range1, range2);
- }
- else {
- result.push(range2, range1);
- }
- break;
- }
- }
+ function getOwnOrInheritedDelta(n, options, sourceFile) {
+ var previousLine = -1;
+ var child;
+ while (n) {
+ var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line;
+ if (previousLine !== -1 && line !== previousLine) {
+ break;
}
- }
- return result;
- function getMatchingTokenKind(token) {
- switch (token.kind) {
- case 15: return 16;
- case 17: return 18;
- case 19: return 20;
- case 25: return 27;
- case 16: return 15;
- case 18: return 17;
- case 20: return 19;
- case 27: return 25;
+ if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) {
+ return options.indentSize;
}
- return undefined;
- }
- }
- function getIndentationAtPosition(fileName, position, editorOptions) {
- var start = ts.timestamp();
- var settings = toEditorSettings(editorOptions);
- var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
- log("getIndentationAtPosition: getCurrentSourceFile: " + (ts.timestamp() - start));
- start = ts.timestamp();
- var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, settings);
- log("getIndentationAtPosition: computeIndentation : " + (ts.timestamp() - start));
- return result;
- }
- function getFormattingEditsForRange(fileName, start, end, options) {
- var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
- var settings = toEditorSettings(options);
- return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(settings), settings);
- }
- function getFormattingEditsForDocument(fileName, options) {
- var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
- var settings = toEditorSettings(options);
- return ts.formatting.formatDocument(sourceFile, getRuleProvider(settings), settings);
- }
- function getFormattingEditsAfterKeystroke(fileName, position, key, options) {
- var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
- var settings = toEditorSettings(options);
- if (key === "}") {
- return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(settings), settings);
- }
- else if (key === ";") {
- return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(settings), settings);
- }
- else if (key === "\n") {
- return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(settings), settings);
+ previousLine = line;
+ child = n;
+ n = n.parent;
}
- return [];
+ return 0;
}
- function getCodeFixesAtPosition(fileName, start, end, errorCodes) {
- synchronizeHostData();
- var sourceFile = getValidSourceFile(fileName);
- var span = { start: start, length: end - start };
- var newLineChar = ts.getNewLineOrDefaultFromHost(host);
- var allFixes = [];
- ts.forEach(errorCodes, function (error) {
- cancellationToken.throwIfCancellationRequested();
- var context = {
- errorCode: error,
- sourceFile: sourceFile,
- span: span,
- program: program,
- newLineCharacter: newLineChar
- };
- var fixes = ts.codefix.getFixes(context);
- if (fixes) {
- allFixes = allFixes.concat(fixes);
+ function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) {
+ var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange);
+ var formattingContext = new formatting.FormattingContext(sourceFile, requestKind);
+ var enclosingNode = findEnclosingNode(originalRange, sourceFile);
+ var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end);
+ var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options);
+ var previousRangeHasError;
+ var previousRange;
+ var previousParent;
+ var previousRangeStartLine;
+ var lastIndentedLine;
+ var indentationOnLastIndentedLine;
+ var edits = [];
+ formattingScanner.advance();
+ if (formattingScanner.isOnToken()) {
+ var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line;
+ var undecoratedStartLine = startLine;
+ if (enclosingNode.decorators) {
+ undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line;
}
- });
- return allFixes;
- }
- function getDocCommentTemplateAtPosition(fileName, position) {
- return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position);
- }
- function isValidBraceCompletionAtPosition(fileName, position, openingBrace) {
- if (openingBrace === 60) {
- return false;
- }
- var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
- if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) {
- return false;
- }
- if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) {
- return openingBrace === 123;
+ var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile);
+ processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta);
}
- if (ts.isInTemplateString(sourceFile, position)) {
- return false;
+ if (!formattingScanner.isOnToken()) {
+ var leadingTrivia = formattingScanner.getCurrentLeadingTrivia();
+ if (leadingTrivia) {
+ processTrivia(leadingTrivia, enclosingNode, enclosingNode, undefined);
+ trimTrailingWhitespacesForRemainingRange();
+ }
}
- return true;
- }
- function getTodoComments(fileName, descriptors) {
- synchronizeHostData();
- var sourceFile = getValidSourceFile(fileName);
- cancellationToken.throwIfCancellationRequested();
- var fileContents = sourceFile.text;
- var result = [];
- if (descriptors.length > 0) {
- var regExp = getTodoCommentsRegExp();
- var matchArray = void 0;
- while (matchArray = regExp.exec(fileContents)) {
- cancellationToken.throwIfCancellationRequested();
- var firstDescriptorCaptureIndex = 3;
- ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex);
- var preamble = matchArray[1];
- var matchPosition = matchArray.index + preamble.length;
- var token = ts.getTokenAtPosition(sourceFile, matchPosition);
- if (!ts.isInsideComment(sourceFile, token, matchPosition)) {
- continue;
- }
- var descriptor = undefined;
- for (var i = 0, n = descriptors.length; i < n; i++) {
- if (matchArray[i + firstDescriptorCaptureIndex]) {
- descriptor = descriptors[i];
- }
+ formattingScanner.close();
+ return edits;
+ function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) {
+ if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) ||
+ ts.rangeContainsStartEnd(range, startPos, endPos)) {
+ if (inheritedIndentation !== -1) {
+ return inheritedIndentation;
}
- ts.Debug.assert(descriptor !== undefined);
- if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) {
- continue;
+ }
+ else {
+ var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line;
+ var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile);
+ var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options);
+ if (startLine !== parentStartLine || startPos === column) {
+ var baseIndentSize = formatting.SmartIndenter.getBaseIndentation(options);
+ return baseIndentSize > column ? baseIndentSize : column;
}
- var message = matchArray[2];
- result.push({
- descriptor: descriptor,
- message: message,
- position: matchPosition
- });
}
+ return -1;
}
- return result;
- function escapeRegExp(str) {
- return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
+ function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) {
+ var indentation = inheritedIndentation;
+ var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0;
+ if (effectiveParentStartLine === startLine) {
+ indentation = startLine === lastIndentedLine
+ ? indentationOnLastIndentedLine
+ : parentDynamicIndentation.getIndentation();
+ delta = Math.min(options.indentSize, parentDynamicIndentation.getDelta(node) + delta);
+ }
+ else if (indentation === -1) {
+ if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) {
+ indentation = parentDynamicIndentation.getIndentation();
+ }
+ else {
+ indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node);
+ }
+ }
+ return {
+ indentation: indentation,
+ delta: delta
+ };
}
- function getTodoCommentsRegExp() {
- var singleLineCommentStart = /(?:\/\/+\s*)/.source;
- var multiLineCommentStart = /(?:\/\*+\s*)/.source;
- var anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source;
- var preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")";
- var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")";
- var endOfLineOrEndOfComment = /(?:$|\*\/)/.source;
- var messageRemainder = /(?:.*?)/.source;
- var messagePortion = "(" + literals + messageRemainder + ")";
- var regExpString = preamble + messagePortion + endOfLineOrEndOfComment;
- return new RegExp(regExpString, "gim");
- }
- function isLetterOrDigit(char) {
- return (char >= 97 && char <= 122) ||
- (char >= 65 && char <= 90) ||
- (char >= 48 && char <= 57);
- }
- }
- function getRenameInfo(fileName, position) {
- synchronizeHostData();
- var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings());
- return ts.Rename.getRenameInfo(program.getTypeChecker(), defaultLibFileName, getCanonicalFileName, getValidSourceFile(fileName), position);
- }
- return {
- dispose: dispose,
- cleanupSemanticCache: cleanupSemanticCache,
- getSyntacticDiagnostics: getSyntacticDiagnostics,
- getSemanticDiagnostics: getSemanticDiagnostics,
- getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,
- getSyntacticClassifications: getSyntacticClassifications,
- getSemanticClassifications: getSemanticClassifications,
- getEncodedSyntacticClassifications: getEncodedSyntacticClassifications,
- getEncodedSemanticClassifications: getEncodedSemanticClassifications,
- getCompletionsAtPosition: getCompletionsAtPosition,
- getCompletionEntryDetails: getCompletionEntryDetails,
- getCompletionEntrySymbol: getCompletionEntrySymbol,
- getSignatureHelpItems: getSignatureHelpItems,
- getQuickInfoAtPosition: getQuickInfoAtPosition,
- getDefinitionAtPosition: getDefinitionAtPosition,
- getImplementationAtPosition: getImplementationAtPosition,
- getTypeDefinitionAtPosition: getTypeDefinitionAtPosition,
- getReferencesAtPosition: getReferencesAtPosition,
- findReferences: findReferences,
- getOccurrencesAtPosition: getOccurrencesAtPosition,
- getDocumentHighlights: getDocumentHighlights,
- getNameOrDottedNameSpan: getNameOrDottedNameSpan,
- getBreakpointStatementAtPosition: getBreakpointStatementAtPosition,
- getNavigateToItems: getNavigateToItems,
- getRenameInfo: getRenameInfo,
- findRenameLocations: findRenameLocations,
- getNavigationBarItems: getNavigationBarItems,
- getNavigationTree: getNavigationTree,
- getOutliningSpans: getOutliningSpans,
- getTodoComments: getTodoComments,
- getBraceMatchingAtPosition: getBraceMatchingAtPosition,
- getIndentationAtPosition: getIndentationAtPosition,
- getFormattingEditsForRange: getFormattingEditsForRange,
- getFormattingEditsForDocument: getFormattingEditsForDocument,
- getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke,
- getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition,
- isValidBraceCompletionAtPosition: isValidBraceCompletionAtPosition,
- getCodeFixesAtPosition: getCodeFixesAtPosition,
- getEmitOutput: getEmitOutput,
- getNonBoundSourceFile: getNonBoundSourceFile,
- getSourceFile: getSourceFile,
- getProgram: getProgram
- };
- }
- ts.createLanguageService = createLanguageService;
- function getNameTable(sourceFile) {
- if (!sourceFile.nameTable) {
- initializeNameTable(sourceFile);
- }
- return sourceFile.nameTable;
- }
- ts.getNameTable = getNameTable;
- function initializeNameTable(sourceFile) {
- var nameTable = ts.createMap();
- walk(sourceFile);
- sourceFile.nameTable = nameTable;
- function walk(node) {
- switch (node.kind) {
- case 69:
- nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1;
- break;
- case 9:
- case 8:
- if (ts.isDeclarationName(node) ||
- node.parent.kind === 240 ||
- isArgumentOfElementAccessExpression(node) ||
- ts.isLiteralComputedPropertyDeclarationName(node)) {
- nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1;
- }
- break;
- default:
- ts.forEachChild(node, walk);
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- ts.forEachChild(jsDocComment, walk);
- }
- }
- }
- }
- }
- function isArgumentOfElementAccessExpression(node) {
- return node &&
- node.parent &&
- node.parent.kind === 173 &&
- node.parent.argumentExpression === node;
- }
- function getDefaultLibFilePath(options) {
- if (typeof __dirname !== "undefined") {
- return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options);
- }
- throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. ");
- }
- ts.getDefaultLibFilePath = getDefaultLibFilePath;
- function initializeServices() {
- ts.objectAllocator = getServicesObjectAllocator();
- }
- initializeServices();
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var server;
- (function (server) {
- var ScriptInfo = (function () {
- function ScriptInfo(host, fileName, content, scriptKind, isOpen, hasMixedContent) {
- if (isOpen === void 0) { isOpen = false; }
- if (hasMixedContent === void 0) { hasMixedContent = false; }
- this.host = host;
- this.fileName = fileName;
- this.scriptKind = scriptKind;
- this.isOpen = isOpen;
- this.hasMixedContent = hasMixedContent;
- this.containingProjects = [];
- this.path = ts.toPath(fileName, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
- this.svc = server.ScriptVersionCache.fromString(host, content);
- this.scriptKind = scriptKind
- ? scriptKind
- : ts.getScriptKindFromFileName(fileName);
- }
- ScriptInfo.prototype.getFormatCodeSettings = function () {
- return this.formatCodeSettings;
- };
- ScriptInfo.prototype.attachToProject = function (project) {
- var isNew = !this.isAttached(project);
- if (isNew) {
- this.containingProjects.push(project);
+ function getFirstNonDecoratorTokenOfNode(node) {
+ if (node.modifiers && node.modifiers.length) {
+ return node.modifiers[0].kind;
}
- return isNew;
- };
- ScriptInfo.prototype.isAttached = function (project) {
- switch (this.containingProjects.length) {
- case 0: return false;
- case 1: return this.containingProjects[0] === project;
- case 2: return this.containingProjects[0] === project || this.containingProjects[1] === project;
- default: return ts.contains(this.containingProjects, project);
+ switch (node.kind) {
+ case 222: return 74;
+ case 223: return 108;
+ case 221: return 88;
+ case 225: return 225;
+ case 150: return 124;
+ case 151: return 132;
+ case 148:
+ if (node.asteriskToken) {
+ return 38;
+ }
+ case 146:
+ case 143:
+ return node.name.kind;
}
- };
- ScriptInfo.prototype.detachFromProject = function (project) {
- switch (this.containingProjects.length) {
- case 0:
- return;
- case 1:
- if (this.containingProjects[0] === project) {
- this.containingProjects.pop();
+ }
+ function getDynamicIndentation(node, nodeStartLine, indentation, delta) {
+ return {
+ getIndentationForComment: function (kind, tokenIndentation, container) {
+ switch (kind) {
+ case 17:
+ case 21:
+ case 19:
+ return indentation + getEffectiveDelta(delta, container);
}
- break;
- case 2:
- if (this.containingProjects[0] === project) {
- this.containingProjects[0] = this.containingProjects.pop();
+ return tokenIndentation !== -1 ? tokenIndentation : indentation;
+ },
+ getIndentationForToken: function (line, kind, container) {
+ if (nodeStartLine !== line && node.decorators) {
+ if (kind === getFirstNonDecoratorTokenOfNode(node)) {
+ return indentation;
+ }
}
- else if (this.containingProjects[1] === project) {
- this.containingProjects.pop();
+ switch (kind) {
+ case 16:
+ case 17:
+ case 20:
+ case 21:
+ case 18:
+ case 19:
+ case 81:
+ case 105:
+ case 56:
+ return indentation;
+ default:
+ return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation;
+ }
+ },
+ getIndentation: function () { return indentation; },
+ getDelta: function (child) { return getEffectiveDelta(delta, child); },
+ recomputeIndentation: function (lineAdded) {
+ if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) {
+ if (lineAdded) {
+ indentation += options.indentSize;
+ }
+ else {
+ indentation -= options.indentSize;
+ }
+ if (formatting.SmartIndenter.shouldIndentChildNode(node)) {
+ delta = options.indentSize;
+ }
+ else {
+ delta = 0;
+ }
}
- break;
- default:
- server.removeItemFromSet(this.containingProjects, project);
- break;
- }
- };
- ScriptInfo.prototype.detachAllProjects = function () {
- for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) {
- var p = _a[_i];
- p.removeFile(this, false);
- }
- this.containingProjects.length = 0;
- };
- ScriptInfo.prototype.getDefaultProject = function () {
- if (this.containingProjects.length === 0) {
- return server.Errors.ThrowNoProject();
- }
- ts.Debug.assert(this.containingProjects.length !== 0);
- return this.containingProjects[0];
- };
- ScriptInfo.prototype.setFormatOptions = function (formatSettings) {
- if (formatSettings) {
- if (!this.formatCodeSettings) {
- this.formatCodeSettings = server.getDefaultFormatCodeSettings(this.host);
}
- server.mergeMaps(this.formatCodeSettings, formatSettings);
- }
- };
- ScriptInfo.prototype.setWatcher = function (watcher) {
- this.stopWatcher();
- this.fileWatcher = watcher;
- };
- ScriptInfo.prototype.stopWatcher = function () {
- if (this.fileWatcher) {
- this.fileWatcher.close();
- this.fileWatcher = undefined;
- }
- };
- ScriptInfo.prototype.getLatestVersion = function () {
- return this.svc.latestVersion().toString();
- };
- ScriptInfo.prototype.reload = function (script) {
- this.svc.reload(script);
- this.markContainingProjectsAsDirty();
- };
- ScriptInfo.prototype.saveTo = function (fileName) {
- var snap = this.snap();
- this.host.writeFile(fileName, snap.getText(0, snap.getLength()));
- };
- ScriptInfo.prototype.reloadFromFile = function () {
- if (this.hasMixedContent) {
- this.reload("");
- }
- else {
- this.svc.reloadFromFile(this.fileName);
- this.markContainingProjectsAsDirty();
- }
- };
- ScriptInfo.prototype.snap = function () {
- return this.svc.getSnapshot();
- };
- ScriptInfo.prototype.getLineInfo = function (line) {
- var snap = this.snap();
- return snap.index.lineNumberToInfo(line);
- };
- ScriptInfo.prototype.editContent = function (start, end, newText) {
- this.svc.edit(start, end - start, newText);
- this.markContainingProjectsAsDirty();
- };
- ScriptInfo.prototype.markContainingProjectsAsDirty = function () {
- for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) {
- var p = _a[_i];
- p.markAsDirty();
- }
- };
- ScriptInfo.prototype.lineToTextSpan = function (line) {
- var index = this.snap().index;
- var lineInfo = index.lineNumberToInfo(line + 1);
- var len;
- if (lineInfo.leaf) {
- len = lineInfo.leaf.text.length;
+ };
+ function getEffectiveDelta(delta, child) {
+ return formatting.SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0;
}
- else {
- var nextLineInfo = index.lineNumberToInfo(line + 2);
- len = nextLineInfo.offset - lineInfo.offset;
+ }
+ function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) {
+ if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) {
+ return;
}
- return ts.createTextSpan(lineInfo.offset, len);
- };
- ScriptInfo.prototype.lineOffsetToPosition = function (line, offset) {
- var index = this.snap().index;
- var lineInfo = index.lineNumberToInfo(line);
- return (lineInfo.offset + offset - 1);
- };
- ScriptInfo.prototype.positionToLineOffset = function (position) {
- var index = this.snap().index;
- var lineOffset = index.charOffsetToLineNumberAndPos(position);
- return { line: lineOffset.line, offset: lineOffset.offset + 1 };
- };
- return ScriptInfo;
- }());
- server.ScriptInfo = ScriptInfo;
- })(server = ts.server || (ts.server = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var server;
- (function (server) {
- var LSHost = (function () {
- function LSHost(host, project, cancellationToken) {
- var _this = this;
- this.host = host;
- this.project = project;
- this.cancellationToken = cancellationToken;
- this.getCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);
- this.resolvedModuleNames = ts.createFileMap();
- this.resolvedTypeReferenceDirectives = ts.createFileMap();
- if (host.trace) {
- this.trace = function (s) { return host.trace(s); };
+ var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta);
+ var childContextNode = contextNode;
+ ts.forEachChild(node, function (child) {
+ processChildNode(child, -1, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, false);
+ }, function (nodes) {
+ processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);
+ });
+ while (formattingScanner.isOnToken()) {
+ var tokenInfo = formattingScanner.readTokenInfo(node);
+ if (tokenInfo.token.end > node.end) {
+ break;
+ }
+ consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation);
}
- this.resolveModuleName = function (moduleName, containingFile, compilerOptions, host) {
- var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host);
- if (primaryResult.resolvedModule) {
- if (ts.fileExtensionIsAny(primaryResult.resolvedModule.resolvedFileName, ts.supportedTypeScriptExtensions)) {
- return primaryResult;
+ function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
+ var childStartPos = child.getStart(sourceFile);
+ var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
+ var undecoratedChildStartLine = childStartLine;
+ if (child.decorators) {
+ undecoratedChildStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(child, sourceFile)).line;
+ }
+ var childIndentationAmount = -1;
+ if (isListItem) {
+ childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation);
+ if (childIndentationAmount !== -1) {
+ inheritedIndentation = childIndentationAmount;
}
}
- var secondaryLookupFailedLookupLocations = [];
- var globalCache = _this.project.projectService.typingsInstaller.globalTypingsCacheLocation;
- if (_this.project.getTypingOptions().enableAutoDiscovery && globalCache) {
- var traceEnabled = ts.isTraceEnabled(compilerOptions, host);
- if (traceEnabled) {
- ts.trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, _this.project.getProjectName(), moduleName, globalCache);
+ if (!ts.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) {
+ if (child.end < originalRange.pos) {
+ formattingScanner.skipToEndOf(child);
}
- var state = { compilerOptions: compilerOptions, host: host, skipTsx: false, traceEnabled: traceEnabled };
- var resolvedName = ts.loadModuleFromNodeModules(moduleName, globalCache, secondaryLookupFailedLookupLocations, state, true);
- if (resolvedName) {
- return ts.createResolvedModule(resolvedName, true, primaryResult.failedLookupLocations.concat(secondaryLookupFailedLookupLocations));
+ return inheritedIndentation;
+ }
+ if (child.getFullWidth() === 0) {
+ return inheritedIndentation;
+ }
+ while (formattingScanner.isOnToken()) {
+ var tokenInfo = formattingScanner.readTokenInfo(node);
+ if (tokenInfo.token.end > childStartPos) {
+ break;
}
+ consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation);
}
- if (!primaryResult.resolvedModule && secondaryLookupFailedLookupLocations.length) {
- primaryResult.failedLookupLocations = primaryResult.failedLookupLocations.concat(secondaryLookupFailedLookupLocations);
+ if (!formattingScanner.isOnToken()) {
+ return inheritedIndentation;
}
- return primaryResult;
- };
- }
- LSHost.prototype.resolveNamesWithLocalCache = function (names, containingFile, cache, loader, getResult) {
- var path = ts.toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName);
- var currentResolutionsInFile = cache.get(path);
- var newResolutions = ts.createMap();
- var resolvedModules = [];
- var compilerOptions = this.getCompilationSettings();
- var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName;
- for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
- var name_52 = names_3[_i];
- var resolution = newResolutions[name_52];
- if (!resolution) {
- var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_52];
- if (moduleResolutionIsValid(existingResolution)) {
- resolution = existingResolution;
+ if (ts.isToken(child) && child.kind !== 10) {
+ var tokenInfo = formattingScanner.readTokenInfo(child);
+ ts.Debug.assert(tokenInfo.token.end === child.end, "Token end is child end");
+ consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child);
+ return inheritedIndentation;
+ }
+ var effectiveParentStartLine = child.kind === 144 ? childStartLine : undecoratedParentStartLine;
+ var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine);
+ processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta);
+ childContextNode = node;
+ if (isFirstListItem && parent.kind === 171 && inheritedIndentation === -1) {
+ inheritedIndentation = childIndentation.indentation;
+ }
+ return inheritedIndentation;
+ }
+ function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) {
+ var listStartToken = getOpenTokenForList(parent, nodes);
+ var listEndToken = getCloseTokenForOpenToken(listStartToken);
+ var listDynamicIndentation = parentDynamicIndentation;
+ var startLine = parentStartLine;
+ if (listStartToken !== 0) {
+ while (formattingScanner.isOnToken()) {
+ var tokenInfo = formattingScanner.readTokenInfo(parent);
+ if (tokenInfo.token.end > nodes.pos) {
+ break;
+ }
+ else if (tokenInfo.token.kind === listStartToken) {
+ startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
+ var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, parentStartLine);
+ listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta);
+ consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);
+ }
+ else {
+ consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation);
+ }
}
- else {
- newResolutions[name_52] = resolution = loader(name_52, containingFile, compilerOptions, this);
+ }
+ var inheritedIndentation = -1;
+ for (var i = 0; i < nodes.length; i++) {
+ var child = nodes[i];
+ inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, true, i === 0);
+ }
+ if (listEndToken !== 0) {
+ if (formattingScanner.isOnToken()) {
+ var tokenInfo = formattingScanner.readTokenInfo(parent);
+ if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) {
+ consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);
+ }
}
}
- ts.Debug.assert(resolution !== undefined);
- resolvedModules.push(getResult(resolution));
}
- cache.set(path, newResolutions);
- return resolvedModules;
- function moduleResolutionIsValid(resolution) {
- if (!resolution) {
- return false;
+ function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation, container) {
+ ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token));
+ var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine();
+ var indentToken = false;
+ if (currentTokenInfo.leadingTrivia) {
+ processTrivia(currentTokenInfo.leadingTrivia, parent, childContextNode, dynamicIndentation);
}
- var result = getResult(resolution);
- if (result) {
- if (result.resolvedFileName && result.resolvedFileName === lastDeletedFileName) {
- return false;
+ var lineAdded;
+ var isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token);
+ var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos);
+ if (isTokenInRange) {
+ var rangeHasError = rangeContainsError(currentTokenInfo.token);
+ var savePreviousRange = previousRange;
+ lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation);
+ if (rangeHasError) {
+ indentToken = false;
+ }
+ else {
+ if (lineAdded !== undefined) {
+ indentToken = lineAdded;
+ }
+ else {
+ var prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line;
+ indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine;
+ }
}
- return true;
}
- return resolution.failedLookupLocations.length === 0;
- }
- };
- LSHost.prototype.getProjectVersion = function () {
- return this.project.getProjectVersion();
- };
- LSHost.prototype.getCompilationSettings = function () {
- return this.compilationSettings;
- };
- LSHost.prototype.useCaseSensitiveFileNames = function () {
- return this.host.useCaseSensitiveFileNames;
- };
- LSHost.prototype.getCancellationToken = function () {
- return this.cancellationToken;
- };
- LSHost.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) {
- return this.resolveNamesWithLocalCache(typeDirectiveNames, containingFile, this.resolvedTypeReferenceDirectives, ts.resolveTypeReferenceDirective, function (m) { return m.resolvedTypeReferenceDirective; });
- };
- LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) {
- return this.resolveNamesWithLocalCache(moduleNames, containingFile, this.resolvedModuleNames, this.resolveModuleName, function (m) { return m.resolvedModule; });
- };
- LSHost.prototype.getDefaultLibFileName = function () {
- var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath()));
- return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings));
- };
- LSHost.prototype.getScriptSnapshot = function (filename) {
- var scriptInfo = this.project.getScriptInfoLSHost(filename);
- if (scriptInfo) {
- return scriptInfo.snap();
+ if (currentTokenInfo.trailingTrivia) {
+ processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation);
+ }
+ if (indentToken) {
+ var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ?
+ dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) :
+ -1;
+ var indentNextTokenOrTrivia = true;
+ if (currentTokenInfo.leadingTrivia) {
+ var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container);
+ for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) {
+ var triviaItem = _a[_i];
+ var triviaInRange = ts.rangeContainsRange(originalRange, triviaItem);
+ switch (triviaItem.kind) {
+ case 3:
+ if (triviaInRange) {
+ indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia);
+ }
+ indentNextTokenOrTrivia = false;
+ break;
+ case 2:
+ if (indentNextTokenOrTrivia && triviaInRange) {
+ insertIndentation(triviaItem.pos, commentIndentation, false);
+ }
+ indentNextTokenOrTrivia = false;
+ break;
+ case 4:
+ indentNextTokenOrTrivia = true;
+ break;
+ }
+ }
+ }
+ if (tokenIndentation !== -1 && indentNextTokenOrTrivia) {
+ insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded);
+ lastIndentedLine = tokenStart.line;
+ indentationOnLastIndentedLine = tokenIndentation;
+ }
+ }
+ formattingScanner.advance();
+ childContextNode = parent;
}
- };
- LSHost.prototype.getScriptFileNames = function () {
- return this.project.getRootFilesLSHost();
- };
- LSHost.prototype.getTypeRootsVersion = function () {
- return this.project.typesVersion;
- };
- LSHost.prototype.getScriptKind = function (fileName) {
- var info = this.project.getScriptInfoLSHost(fileName);
- return info && info.scriptKind;
- };
- LSHost.prototype.getScriptVersion = function (filename) {
- var info = this.project.getScriptInfoLSHost(filename);
- return info && info.getLatestVersion();
- };
- LSHost.prototype.getCurrentDirectory = function () {
- return this.host.getCurrentDirectory();
- };
- LSHost.prototype.resolvePath = function (path) {
- return this.host.resolvePath(path);
- };
- LSHost.prototype.fileExists = function (path) {
- return this.host.fileExists(path);
- };
- LSHost.prototype.readFile = function (fileName) {
- return this.host.readFile(fileName);
- };
- LSHost.prototype.directoryExists = function (path) {
- return this.host.directoryExists(path);
- };
- LSHost.prototype.readDirectory = function (path, extensions, exclude, include) {
- return this.host.readDirectory(path, extensions, exclude, include);
- };
- LSHost.prototype.getDirectories = function (path) {
- return this.host.getDirectories(path);
- };
- LSHost.prototype.notifyFileRemoved = function (info) {
- this.resolvedModuleNames.remove(info.path);
- this.resolvedTypeReferenceDirectives.remove(info.path);
- };
- LSHost.prototype.setCompilationSettings = function (opt) {
- this.compilationSettings = opt;
- this.resolvedModuleNames.clear();
- this.resolvedTypeReferenceDirectives.clear();
- };
- return LSHost;
- }());
- server.LSHost = LSHost;
- })(server = ts.server || (ts.server = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var server;
- (function (server) {
- server.nullTypingsInstaller = {
- enqueueInstallTypingsRequest: function () { },
- attach: function (projectService) { },
- onProjectClosed: function (p) { },
- globalTypingsCacheLocation: undefined
- };
- var TypingsCacheEntry = (function () {
- function TypingsCacheEntry() {
- }
- return TypingsCacheEntry;
- }());
- function setIsEqualTo(arr1, arr2) {
- if (arr1 === arr2) {
- return true;
- }
- if ((arr1 || server.emptyArray).length === 0 && (arr2 || server.emptyArray).length === 0) {
- return true;
}
- var set = ts.createMap();
- var unique = 0;
- for (var _i = 0, arr1_1 = arr1; _i < arr1_1.length; _i++) {
- var v = arr1_1[_i];
- if (set[v] !== true) {
- set[v] = true;
- unique++;
+ function processTrivia(trivia, parent, contextNode, dynamicIndentation) {
+ for (var _i = 0, trivia_1 = trivia; _i < trivia_1.length; _i++) {
+ var triviaItem = trivia_1[_i];
+ if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) {
+ var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos);
+ processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation);
+ }
}
}
- for (var _a = 0, arr2_1 = arr2; _a < arr2_1.length; _a++) {
- var v = arr2_1[_a];
- if (!ts.hasProperty(set, v)) {
- return false;
- }
- if (set[v] === true) {
- set[v] = false;
- unique--;
+ function processRange(range, rangeStart, parent, contextNode, dynamicIndentation) {
+ var rangeHasError = rangeContainsError(range);
+ var lineAdded;
+ if (!rangeHasError && !previousRangeHasError) {
+ if (!previousRange) {
+ var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos);
+ trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line);
+ }
+ else {
+ lineAdded =
+ processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation);
+ }
}
+ previousRange = range;
+ previousParent = parent;
+ previousRangeStartLine = rangeStart.line;
+ previousRangeHasError = rangeHasError;
+ return lineAdded;
}
- return unique === 0;
- }
- function typingOptionsChanged(opt1, opt2) {
- return opt1.enableAutoDiscovery !== opt2.enableAutoDiscovery ||
- !setIsEqualTo(opt1.include, opt2.include) ||
- !setIsEqualTo(opt1.exclude, opt2.exclude);
- }
- function compilerOptionsChanged(opt1, opt2) {
- return opt1.allowJs != opt2.allowJs;
- }
- function toTypingsArray(arr) {
- arr.sort();
- return arr;
- }
- var TypingsCache = (function () {
- function TypingsCache(installer) {
- this.installer = installer;
- this.perProjectCache = ts.createMap();
- }
- TypingsCache.prototype.getTypingsForProject = function (project, forceRefresh) {
- var typingOptions = project.getTypingOptions();
- if (!typingOptions || !typingOptions.enableAutoDiscovery) {
- return server.emptyArray;
+ function processPair(currentItem, currentStartLine, currentParent, previousItem, previousStartLine, previousParent, contextNode, dynamicIndentation) {
+ formattingContext.updateContext(previousItem, previousParent, currentItem, currentParent, contextNode);
+ var rule = rulesProvider.getRulesMap().GetRule(formattingContext);
+ var trimTrailingWhitespaces;
+ var lineAdded;
+ if (rule) {
+ applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine);
+ if (rule.Operation.Action & (2 | 8) && currentStartLine !== previousStartLine) {
+ lineAdded = false;
+ if (currentParent.getStart(sourceFile) === currentItem.pos) {
+ dynamicIndentation.recomputeIndentation(false);
+ }
+ }
+ else if (rule.Operation.Action & 4 && currentStartLine === previousStartLine) {
+ lineAdded = true;
+ if (currentParent.getStart(sourceFile) === currentItem.pos) {
+ dynamicIndentation.recomputeIndentation(true);
+ }
+ }
+ trimTrailingWhitespaces = !(rule.Operation.Action & 8) && rule.Flag !== 1;
}
- var entry = this.perProjectCache[project.getProjectName()];
- var result = entry ? entry.typings : server.emptyArray;
- if (forceRefresh || !entry || typingOptionsChanged(typingOptions, entry.typingOptions) || compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions)) {
- this.perProjectCache[project.getProjectName()] = {
- compilerOptions: project.getCompilerOptions(),
- typingOptions: typingOptions,
- typings: result,
- poisoned: true
- };
- this.installer.enqueueInstallTypingsRequest(project, typingOptions);
+ else {
+ trimTrailingWhitespaces = true;
}
- return result;
- };
- TypingsCache.prototype.invalidateCachedTypingsForProject = function (project) {
- var typingOptions = project.getTypingOptions();
- if (!typingOptions.enableAutoDiscovery) {
- return;
+ if (currentStartLine !== previousStartLine && trimTrailingWhitespaces) {
+ trimTrailingWhitespacesForLines(previousStartLine, currentStartLine, previousItem);
}
- this.installer.enqueueInstallTypingsRequest(project, typingOptions);
- };
- TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typingOptions, newTypings) {
- this.perProjectCache[projectName] = {
- compilerOptions: compilerOptions,
- typingOptions: typingOptions,
- typings: toTypingsArray(newTypings),
- poisoned: false
- };
- };
- TypingsCache.prototype.onProjectClosed = function (project) {
- delete this.perProjectCache[project.getProjectName()];
- this.installer.onProjectClosed(project);
- };
- return TypingsCache;
- }());
- server.TypingsCache = TypingsCache;
- })(server = ts.server || (ts.server = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var server;
- (function (server) {
- var crypto = require("crypto");
- function shouldEmitFile(scriptInfo) {
- return !scriptInfo.hasMixedContent;
- }
- server.shouldEmitFile = shouldEmitFile;
- var BuilderFileInfo = (function () {
- function BuilderFileInfo(scriptInfo, project) {
- this.scriptInfo = scriptInfo;
- this.project = project;
+ return lineAdded;
}
- BuilderFileInfo.prototype.isExternalModuleOrHasOnlyAmbientExternalModules = function () {
- var sourceFile = this.getSourceFile();
- return ts.isExternalModule(sourceFile) || this.containsOnlyAmbientModules(sourceFile);
- };
- BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) {
- for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
- var statement = _a[_i];
- if (statement.kind !== 225 || statement.name.kind !== 9) {
- return false;
- }
- }
- return true;
- };
- BuilderFileInfo.prototype.computeHash = function (text) {
- return crypto.createHash("md5")
- .update(text)
- .digest("base64");
- };
- BuilderFileInfo.prototype.getSourceFile = function () {
- return this.project.getSourceFile(this.scriptInfo.path);
- };
- BuilderFileInfo.prototype.updateShapeSignature = function () {
- var sourceFile = this.getSourceFile();
- if (!sourceFile) {
- return true;
- }
- var lastSignature = this.lastCheckedShapeSignature;
- if (sourceFile.isDeclarationFile) {
- this.lastCheckedShapeSignature = this.computeHash(sourceFile.text);
+ function insertIndentation(pos, indentation, lineAdded) {
+ var indentationString = getIndentationString(indentation, options);
+ if (lineAdded) {
+ recordReplace(pos, 0, indentationString);
}
else {
- var emitOutput = this.project.getFileEmitOutput(this.scriptInfo, true);
- if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) {
- this.lastCheckedShapeSignature = this.computeHash(emitOutput.outputFiles[0].text);
+ var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos);
+ var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile);
+ if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) {
+ recordReplace(startLinePosition, tokenStart.character, indentationString);
}
}
- return !lastSignature || this.lastCheckedShapeSignature !== lastSignature;
- };
- return BuilderFileInfo;
- }());
- server.BuilderFileInfo = BuilderFileInfo;
- var AbstractBuilder = (function () {
- function AbstractBuilder(project, ctor) {
- this.project = project;
- this.ctor = ctor;
- this.fileInfos = ts.createFileMap();
}
- AbstractBuilder.prototype.getFileInfo = function (path) {
- return this.fileInfos.get(path);
- };
- AbstractBuilder.prototype.getOrCreateFileInfo = function (path) {
- var fileInfo = this.getFileInfo(path);
- if (!fileInfo) {
- var scriptInfo = this.project.getScriptInfo(path);
- fileInfo = new this.ctor(scriptInfo, this.project);
- this.setFileInfo(path, fileInfo);
- }
- return fileInfo;
- };
- AbstractBuilder.prototype.getFileInfoPaths = function () {
- return this.fileInfos.getKeys();
- };
- AbstractBuilder.prototype.setFileInfo = function (path, info) {
- this.fileInfos.set(path, info);
- };
- AbstractBuilder.prototype.removeFileInfo = function (path) {
- this.fileInfos.remove(path);
- };
- AbstractBuilder.prototype.forEachFileInfo = function (action) {
- this.fileInfos.forEachValue(function (path, value) { return action(value); });
- };
- AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) {
- var fileInfo = this.getFileInfo(scriptInfo.path);
- if (!fileInfo) {
- return false;
- }
- var _a = this.project.getFileEmitOutput(fileInfo.scriptInfo, false), emitSkipped = _a.emitSkipped, outputFiles = _a.outputFiles;
- if (!emitSkipped) {
- var projectRootPath = this.project.getProjectRootPath();
- for (var _i = 0, outputFiles_1 = outputFiles; _i < outputFiles_1.length; _i++) {
- var outputFile = outputFiles_1[_i];
- var outputFileAbsoluteFileName = ts.getNormalizedAbsolutePath(outputFile.name, projectRootPath ? projectRootPath : ts.getDirectoryPath(scriptInfo.fileName));
- writeFile(outputFileAbsoluteFileName, outputFile.text, outputFile.writeByteOrderMark);
+ function indentationIsDifferent(indentationString, startLinePosition) {
+ return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length);
+ }
+ function indentMultilineComment(commentRange, indentation, firstLineIsIndented) {
+ var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line;
+ var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line;
+ var parts;
+ if (startLine === endLine) {
+ if (!firstLineIsIndented) {
+ insertIndentation(commentRange.pos, indentation, false);
}
+ return;
}
- return !emitSkipped;
- };
- return AbstractBuilder;
- }());
- var NonModuleBuilder = (function (_super) {
- __extends(NonModuleBuilder, _super);
- function NonModuleBuilder(project) {
- var _this = _super.call(this, project, BuilderFileInfo) || this;
- _this.project = project;
- return _this;
- }
- NonModuleBuilder.prototype.onProjectUpdateGraph = function () {
- };
- NonModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) {
- var info = this.getOrCreateFileInfo(scriptInfo.path);
- var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName];
- if (info.updateShapeSignature()) {
- var options = this.project.getCompilerOptions();
- if (options && (options.out || options.outFile)) {
- return singleFileResult;
+ else {
+ parts = [];
+ var startPos = commentRange.pos;
+ for (var line = startLine; line < endLine; line++) {
+ var endOfLine = ts.getEndLinePosition(line, sourceFile);
+ parts.push({ pos: startPos, end: endOfLine });
+ startPos = ts.getStartPositionOfLine(line + 1, sourceFile);
}
- return this.project.getAllEmittableFiles();
+ parts.push({ pos: startPos, end: commentRange.end });
}
- return singleFileResult;
- };
- return NonModuleBuilder;
- }(AbstractBuilder));
- var ModuleBuilderFileInfo = (function (_super) {
- __extends(ModuleBuilderFileInfo, _super);
- function ModuleBuilderFileInfo() {
- var _this = _super.apply(this, arguments) || this;
- _this.references = [];
- _this.referencedBy = [];
- return _this;
- }
- ModuleBuilderFileInfo.compareFileInfos = function (lf, rf) {
- var l = lf.scriptInfo.fileName;
- var r = rf.scriptInfo.fileName;
- return (l < r ? -1 : (l > r ? 1 : 0));
- };
- ;
- ModuleBuilderFileInfo.addToReferenceList = function (array, fileInfo) {
- if (array.length === 0) {
- array.push(fileInfo);
+ var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile);
+ var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options);
+ if (indentation === nonWhitespaceColumnInFirstPart.column) {
return;
}
- var insertIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos);
- if (insertIndex < 0) {
- array.splice(~insertIndex, 0, fileInfo);
+ var startIndex = 0;
+ if (firstLineIsIndented) {
+ startIndex = 1;
+ startLine++;
}
- };
- ModuleBuilderFileInfo.removeFromReferenceList = function (array, fileInfo) {
- if (!array || array.length === 0) {
- return;
+ var delta = indentation - nonWhitespaceColumnInFirstPart.column;
+ for (var i = startIndex, len = parts.length; i < len; i++, startLine++) {
+ var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile);
+ var nonWhitespaceCharacterAndColumn = i === 0
+ ? nonWhitespaceColumnInFirstPart
+ : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options);
+ var newIndentation = nonWhitespaceCharacterAndColumn.column + delta;
+ if (newIndentation > 0) {
+ var indentationString = getIndentationString(newIndentation, options);
+ recordReplace(startLinePos_1, nonWhitespaceCharacterAndColumn.character, indentationString);
+ }
+ else {
+ recordDelete(startLinePos_1, nonWhitespaceCharacterAndColumn.character);
+ }
}
- if (array[0] === fileInfo) {
- array.splice(0, 1);
- return;
+ }
+ function trimTrailingWhitespacesForLines(line1, line2, range) {
+ for (var line = line1; line < line2; line++) {
+ var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile);
+ var lineEndPosition = ts.getEndLinePosition(line, sourceFile);
+ if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) {
+ continue;
+ }
+ var whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition);
+ if (whitespaceStart !== -1) {
+ ts.Debug.assert(whitespaceStart === lineStartPosition || !ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(whitespaceStart - 1)));
+ recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart);
+ }
}
- var removeIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos);
- if (removeIndex >= 0) {
- array.splice(removeIndex, 1);
+ }
+ function getTrailingWhitespaceStartPosition(start, end) {
+ var pos = end;
+ while (pos >= start && ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(pos))) {
+ pos--;
}
- };
- ModuleBuilderFileInfo.prototype.addReferencedBy = function (fileInfo) {
- ModuleBuilderFileInfo.addToReferenceList(this.referencedBy, fileInfo);
- };
- ModuleBuilderFileInfo.prototype.removeReferencedBy = function (fileInfo) {
- ModuleBuilderFileInfo.removeFromReferenceList(this.referencedBy, fileInfo);
- };
- ModuleBuilderFileInfo.prototype.removeFileReferences = function () {
- for (var _i = 0, _a = this.references; _i < _a.length; _i++) {
- var reference = _a[_i];
- reference.removeReferencedBy(this);
+ if (pos !== end) {
+ return pos + 1;
}
- this.references = [];
- };
- return ModuleBuilderFileInfo;
- }(BuilderFileInfo));
- var ModuleBuilder = (function (_super) {
- __extends(ModuleBuilder, _super);
- function ModuleBuilder(project) {
- var _this = _super.call(this, project, ModuleBuilderFileInfo) || this;
- _this.project = project;
- return _this;
+ return -1;
}
- ModuleBuilder.prototype.getReferencedFileInfos = function (fileInfo) {
- var _this = this;
- if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) {
- return [];
+ function trimTrailingWhitespacesForRemainingRange() {
+ var startPosition = previousRange ? previousRange.end : originalRange.pos;
+ var startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line;
+ var endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line;
+ trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange);
+ }
+ function newTextChange(start, len, newText) {
+ return { span: ts.createTextSpan(start, len), newText: newText };
+ }
+ function recordDelete(start, len) {
+ if (len) {
+ edits.push(newTextChange(start, len, ""));
}
- var referencedFilePaths = this.project.getReferencedFiles(fileInfo.scriptInfo.path);
- if (referencedFilePaths.length > 0) {
- return ts.map(referencedFilePaths, function (f) { return _this.getOrCreateFileInfo(f); }).sort(ModuleBuilderFileInfo.compareFileInfos);
+ }
+ function recordReplace(start, len, newText) {
+ if (len || newText) {
+ edits.push(newTextChange(start, len, newText));
}
- return [];
- };
- ModuleBuilder.prototype.onProjectUpdateGraph = function () {
- this.ensureProjectDependencyGraphUpToDate();
- };
- ModuleBuilder.prototype.ensureProjectDependencyGraphUpToDate = function () {
- var _this = this;
- if (!this.projectVersionForDependencyGraph || this.project.getProjectVersion() !== this.projectVersionForDependencyGraph) {
- var currentScriptInfos = this.project.getScriptInfos();
- for (var _i = 0, currentScriptInfos_1 = currentScriptInfos; _i < currentScriptInfos_1.length; _i++) {
- var scriptInfo = currentScriptInfos_1[_i];
- var fileInfo = this.getOrCreateFileInfo(scriptInfo.path);
- this.updateFileReferences(fileInfo);
- }
- this.forEachFileInfo(function (fileInfo) {
- if (!_this.project.containsScriptInfo(fileInfo.scriptInfo)) {
- fileInfo.removeFileReferences();
- _this.removeFileInfo(fileInfo.scriptInfo.path);
+ }
+ function applyRuleEdits(rule, previousRange, previousStartLine, currentRange, currentStartLine) {
+ switch (rule.Operation.Action) {
+ case 1:
+ return;
+ case 8:
+ if (previousRange.end !== currentRange.pos) {
+ recordDelete(previousRange.end, currentRange.pos - previousRange.end);
}
- });
- this.projectVersionForDependencyGraph = this.project.getProjectVersion();
- }
- };
- ModuleBuilder.prototype.updateFileReferences = function (fileInfo) {
- if (fileInfo.scriptVersionForReferences === fileInfo.scriptInfo.getLatestVersion()) {
- return;
+ break;
+ case 4:
+ if (rule.Flag !== 1 && previousStartLine !== currentStartLine) {
+ return;
+ }
+ var lineDelta = currentStartLine - previousStartLine;
+ if (lineDelta !== 1) {
+ recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter);
+ }
+ break;
+ case 2:
+ if (rule.Flag !== 1 && previousStartLine !== currentStartLine) {
+ return;
+ }
+ var posDelta = currentRange.pos - previousRange.end;
+ if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange.end) !== 32) {
+ recordReplace(previousRange.end, currentRange.pos - previousRange.end, " ");
+ }
+ break;
}
- var newReferences = this.getReferencedFileInfos(fileInfo);
- var oldReferences = fileInfo.references;
- var oldIndex = 0;
- var newIndex = 0;
- while (oldIndex < oldReferences.length && newIndex < newReferences.length) {
- var oldReference = oldReferences[oldIndex];
- var newReference = newReferences[newIndex];
- var compare = ModuleBuilderFileInfo.compareFileInfos(oldReference, newReference);
- if (compare < 0) {
- oldReference.removeReferencedBy(fileInfo);
- oldIndex++;
+ }
+ }
+ function getOpenTokenForList(node, list) {
+ switch (node.kind) {
+ case 149:
+ case 221:
+ case 180:
+ case 148:
+ case 147:
+ case 181:
+ if (node.typeParameters === list) {
+ return 26;
}
- else if (compare > 0) {
- newReference.addReferencedBy(fileInfo);
- newIndex++;
+ else if (node.parameters === list) {
+ return 18;
}
- else {
- oldIndex++;
- newIndex++;
+ break;
+ case 175:
+ case 176:
+ if (node.typeArguments === list) {
+ return 26;
}
- }
- for (var i = oldIndex; i < oldReferences.length; i++) {
- oldReferences[i].removeReferencedBy(fileInfo);
- }
- for (var i = newIndex; i < newReferences.length; i++) {
- newReferences[i].addReferencedBy(fileInfo);
- }
- fileInfo.references = newReferences;
- fileInfo.scriptVersionForReferences = fileInfo.scriptInfo.getLatestVersion();
- };
- ModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) {
- this.ensureProjectDependencyGraphUpToDate();
- var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName];
- var fileInfo = this.getFileInfo(scriptInfo.path);
- if (!fileInfo || !fileInfo.updateShapeSignature()) {
- return singleFileResult;
- }
- if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) {
- return this.project.getAllEmittableFiles();
- }
- var options = this.project.getCompilerOptions();
- if (options && (options.isolatedModules || options.out || options.outFile)) {
- return singleFileResult;
- }
- var queue = fileInfo.referencedBy.slice(0);
- var fileNameSet = ts.createMap();
- fileNameSet[scriptInfo.fileName] = scriptInfo;
- while (queue.length > 0) {
- var processingFileInfo = queue.pop();
- if (processingFileInfo.updateShapeSignature() && processingFileInfo.referencedBy.length > 0) {
- for (var _i = 0, _a = processingFileInfo.referencedBy; _i < _a.length; _i++) {
- var potentialFileInfo = _a[_i];
- if (!fileNameSet[potentialFileInfo.scriptInfo.fileName]) {
- queue.push(potentialFileInfo);
- }
- }
+ else if (node.arguments === list) {
+ return 18;
}
- fileNameSet[processingFileInfo.scriptInfo.fileName] = processingFileInfo.scriptInfo;
- }
- var result = [];
- for (var fileName in fileNameSet) {
- if (shouldEmitFile(fileNameSet[fileName])) {
- result.push(fileName);
+ break;
+ case 156:
+ if (node.typeArguments === list) {
+ return 26;
}
- }
- return result;
- };
- return ModuleBuilder;
- }(AbstractBuilder));
- function createBuilder(project) {
- var moduleKind = project.getCompilerOptions().module;
- switch (moduleKind) {
- case ts.ModuleKind.None:
- return new NonModuleBuilder(project);
- default:
- return new ModuleBuilder(project);
}
+ return 0;
}
- server.createBuilder = createBuilder;
- })(server = ts.server || (ts.server = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var server;
- (function (server) {
- (function (ProjectKind) {
- ProjectKind[ProjectKind["Inferred"] = 0] = "Inferred";
- ProjectKind[ProjectKind["Configured"] = 1] = "Configured";
- ProjectKind[ProjectKind["External"] = 2] = "External";
- })(server.ProjectKind || (server.ProjectKind = {}));
- var ProjectKind = server.ProjectKind;
- function remove(items, item) {
- var index = items.indexOf(item);
- if (index >= 0) {
- items.splice(index, 1);
+ function getCloseTokenForOpenToken(kind) {
+ switch (kind) {
+ case 18:
+ return 19;
+ case 26:
+ return 28;
}
+ return 0;
}
- function countEachFileTypes(infos) {
- var result = { js: 0, jsx: 0, ts: 0, tsx: 0, dts: 0 };
- for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
- var info = infos_1[_i];
- switch (info.scriptKind) {
- case 1:
- result.js += 1;
- break;
- case 2:
- result.jsx += 1;
- break;
- case 3:
- ts.fileExtensionIs(info.fileName, ".d.ts")
- ? result.dts += 1
- : result.ts += 1;
- break;
- case 4:
- result.tsx += 1;
- break;
- }
+ var internedSizes;
+ var internedTabsIndentation;
+ var internedSpacesIndentation;
+ function getIndentationString(indentation, options) {
+ var resetInternedStrings = !internedSizes || (internedSizes.tabSize !== options.tabSize || internedSizes.indentSize !== options.indentSize);
+ if (resetInternedStrings) {
+ internedSizes = { tabSize: options.tabSize, indentSize: options.indentSize };
+ internedTabsIndentation = internedSpacesIndentation = undefined;
}
- return result;
- }
- function hasOneOrMoreJsAndNoTsFiles(project) {
- var counts = countEachFileTypes(project.getScriptInfos());
- return counts.js > 0 && counts.ts === 0 && counts.tsx === 0;
- }
- function allRootFilesAreJsOrDts(project) {
- var counts = countEachFileTypes(project.getRootScriptInfos());
- return counts.ts === 0 && counts.tsx === 0;
- }
- server.allRootFilesAreJsOrDts = allRootFilesAreJsOrDts;
- function allFilesAreJsOrDts(project) {
- var counts = countEachFileTypes(project.getScriptInfos());
- return counts.ts === 0 && counts.tsx === 0;
- }
- server.allFilesAreJsOrDts = allFilesAreJsOrDts;
- var Project = (function () {
- function Project(projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) {
- this.projectKind = projectKind;
- this.projectService = projectService;
- this.documentRegistry = documentRegistry;
- this.languageServiceEnabled = languageServiceEnabled;
- this.compilerOptions = compilerOptions;
- this.compileOnSaveEnabled = compileOnSaveEnabled;
- this.rootFiles = [];
- this.rootFilesMap = ts.createFileMap();
- this.lastReportedVersion = 0;
- this.projectStructureVersion = 0;
- this.projectStateVersion = 0;
- this.typesVersion = 0;
- if (!this.compilerOptions) {
- this.compilerOptions = ts.getDefaultCompilerOptions();
- this.compilerOptions.allowNonTsExtensions = true;
- this.compilerOptions.allowJs = true;
+ if (!options.convertTabsToSpaces) {
+ var tabs = Math.floor(indentation / options.tabSize);
+ var spaces = indentation - tabs * options.tabSize;
+ var tabString = void 0;
+ if (!internedTabsIndentation) {
+ internedTabsIndentation = [];
}
- else if (hasExplicitListOfFiles) {
- this.compilerOptions.allowNonTsExtensions = true;
+ if (internedTabsIndentation[tabs] === undefined) {
+ internedTabsIndentation[tabs] = tabString = repeat("\t", tabs);
}
- if (languageServiceEnabled) {
- this.enableLanguageService();
+ else {
+ tabString = internedTabsIndentation[tabs];
+ }
+ return spaces ? tabString + repeat(" ", spaces) : tabString;
+ }
+ else {
+ var spacesString = void 0;
+ var quotient = Math.floor(indentation / options.indentSize);
+ var remainder = indentation % options.indentSize;
+ if (!internedSpacesIndentation) {
+ internedSpacesIndentation = [];
+ }
+ if (internedSpacesIndentation[quotient] === undefined) {
+ spacesString = repeat(" ", options.indentSize * quotient);
+ internedSpacesIndentation[quotient] = spacesString;
}
else {
- this.disableLanguageService();
+ spacesString = internedSpacesIndentation[quotient];
}
- this.builder = server.createBuilder(this);
- this.markAsDirty();
+ return remainder ? spacesString + repeat(" ", remainder) : spacesString;
}
- Project.prototype.isNonTsProject = function () {
- this.updateGraph();
- return allFilesAreJsOrDts(this);
- };
- Project.prototype.isJsOnlyProject = function () {
- this.updateGraph();
- return hasOneOrMoreJsAndNoTsFiles(this);
- };
- Project.prototype.getProjectErrors = function () {
- return this.projectErrors;
- };
- Project.prototype.getLanguageService = function (ensureSynchronized) {
- if (ensureSynchronized === void 0) { ensureSynchronized = true; }
- if (ensureSynchronized) {
- this.updateGraph();
+ function repeat(value, count) {
+ var s = "";
+ for (var i = 0; i < count; i++) {
+ s += value;
}
- return this.languageService;
- };
- Project.prototype.getCompileOnSaveAffectedFileList = function (scriptInfo) {
- if (!this.languageServiceEnabled) {
- return [];
+ return s;
+ }
+ }
+ formatting.getIndentationString = getIndentationString;
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var formatting;
+ (function (formatting) {
+ var SmartIndenter;
+ (function (SmartIndenter) {
+ var Value;
+ (function (Value) {
+ Value[Value["Unknown"] = -1] = "Unknown";
+ })(Value || (Value = {}));
+ function getIndentation(position, sourceFile, options) {
+ if (position > sourceFile.text.length) {
+ return getBaseIndentation(options);
}
- this.updateGraph();
- return this.builder.getFilesAffectedBy(scriptInfo);
- };
- Project.prototype.getProjectVersion = function () {
- return this.projectStateVersion.toString();
- };
- Project.prototype.enableLanguageService = function () {
- var lsHost = new server.LSHost(this.projectService.host, this, this.projectService.cancellationToken);
- lsHost.setCompilationSettings(this.compilerOptions);
- this.languageService = ts.createLanguageService(lsHost, this.documentRegistry);
- this.lsHost = lsHost;
- this.languageServiceEnabled = true;
- };
- Project.prototype.disableLanguageService = function () {
- this.languageService = server.nullLanguageService;
- this.lsHost = server.nullLanguageServiceHost;
- this.languageServiceEnabled = false;
- };
- Project.prototype.getSourceFile = function (path) {
- if (!this.program) {
- return undefined;
+ if (options.indentStyle === ts.IndentStyle.None) {
+ return 0;
}
- return this.program.getSourceFileByPath(path);
- };
- Project.prototype.updateTypes = function () {
- this.typesVersion++;
- this.markAsDirty();
- this.updateGraph();
- };
- Project.prototype.close = function () {
- if (this.program) {
- for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) {
- var f = _a[_i];
- var info = this.projectService.getScriptInfo(f.fileName);
- info.detachFromProject(this);
- }
+ var precedingToken = ts.findPrecedingToken(position, sourceFile);
+ if (!precedingToken) {
+ return getBaseIndentation(options);
}
- else {
- for (var _b = 0, _c = this.rootFiles; _b < _c.length; _b++) {
- var root = _c[_b];
- root.detachFromProject(this);
- }
+ var precedingTokenIsLiteral = ts.isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind);
+ if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
+ return 0;
}
- this.rootFiles = undefined;
- this.rootFilesMap = undefined;
- this.program = undefined;
- this.languageService.dispose();
- };
- Project.prototype.getCompilerOptions = function () {
- return this.compilerOptions;
- };
- Project.prototype.hasRoots = function () {
- return this.rootFiles && this.rootFiles.length > 0;
- };
- Project.prototype.getRootFiles = function () {
- return this.rootFiles && this.rootFiles.map(function (info) { return info.fileName; });
- };
- Project.prototype.getRootFilesLSHost = function () {
- var result = [];
- if (this.rootFiles) {
- for (var _i = 0, _a = this.rootFiles; _i < _a.length; _i++) {
- var f = _a[_i];
- result.push(f.fileName);
- }
- if (this.typingFiles) {
- for (var _b = 0, _c = this.typingFiles; _b < _c.length; _b++) {
- var f = _c[_b];
- result.push(f);
+ var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
+ if (options.indentStyle === ts.IndentStyle.Block) {
+ var current_1 = position;
+ while (current_1 > 0) {
+ var char = sourceFile.text.charCodeAt(current_1);
+ if (!ts.isWhiteSpace(char)) {
+ break;
}
+ current_1--;
}
+ var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile);
+ return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options);
}
- return result;
- };
- Project.prototype.getRootScriptInfos = function () {
- return this.rootFiles;
- };
- Project.prototype.getScriptInfos = function () {
- var _this = this;
- return ts.map(this.program.getSourceFiles(), function (sourceFile) {
- var scriptInfo = _this.projectService.getScriptInfoForPath(sourceFile.path);
- if (!scriptInfo) {
- ts.Debug.assert(false, "scriptInfo for a file '" + sourceFile.fileName + "' is missing.");
+ if (precedingToken.kind === 25 && precedingToken.parent.kind !== 188) {
+ var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);
+ if (actualIndentation !== -1) {
+ return actualIndentation;
}
- return scriptInfo;
- });
- };
- Project.prototype.getFileEmitOutput = function (info, emitOnlyDtsFiles) {
- if (!this.languageServiceEnabled) {
- return undefined;
- }
- return this.getLanguageService().getEmitOutput(info.fileName, emitOnlyDtsFiles);
- };
- Project.prototype.getFileNames = function () {
- if (!this.program) {
- return [];
}
- if (!this.languageServiceEnabled) {
- var rootFiles = this.getRootFiles();
- if (this.compilerOptions) {
- var defaultLibrary = ts.getDefaultLibFilePath(this.compilerOptions);
- if (defaultLibrary) {
- (rootFiles || (rootFiles = [])).push(server.asNormalizedPath(defaultLibrary));
+ var previous;
+ var current = precedingToken;
+ var currentStart;
+ var indentationDelta;
+ while (current) {
+ if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) {
+ currentStart = getStartLineAndCharacterForNode(current, sourceFile);
+ if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) {
+ indentationDelta = 0;
+ }
+ else {
+ indentationDelta = lineAtPosition !== currentStart.line ? options.indentSize : 0;
}
+ break;
}
- return rootFiles;
+ var actualIndentation = getActualIndentationForListItem(current, sourceFile, options);
+ if (actualIndentation !== -1) {
+ return actualIndentation;
+ }
+ actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
+ if (actualIndentation !== -1) {
+ return actualIndentation + options.indentSize;
+ }
+ previous = current;
+ current = current.parent;
}
- var sourceFiles = this.program.getSourceFiles();
- return sourceFiles.map(function (sourceFile) { return server.asNormalizedPath(sourceFile.fileName); });
- };
- Project.prototype.getAllEmittableFiles = function () {
- if (!this.languageServiceEnabled) {
- return [];
+ if (!current) {
+ return getBaseIndentation(options);
}
- var defaultLibraryFileName = ts.getDefaultLibFileName(this.compilerOptions);
- var infos = this.getScriptInfos();
- var result = [];
- for (var _i = 0, infos_2 = infos; _i < infos_2.length; _i++) {
- var info = infos_2[_i];
- if (ts.getBaseFileName(info.fileName) !== defaultLibraryFileName && server.shouldEmitFile(info)) {
- result.push(info.fileName);
+ return getIndentationForNodeWorker(current, currentStart, undefined, indentationDelta, sourceFile, options);
+ }
+ SmartIndenter.getIndentation = getIndentation;
+ function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) {
+ var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));
+ return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, 0, sourceFile, options);
+ }
+ SmartIndenter.getIndentationForNode = getIndentationForNode;
+ function getBaseIndentation(options) {
+ return options.baseIndentSize || 0;
+ }
+ SmartIndenter.getBaseIndentation = getBaseIndentation;
+ function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) {
+ var parent = current.parent;
+ var parentStart;
+ while (parent) {
+ var useActualIndentation = true;
+ if (ignoreActualIndentationRange) {
+ var start = current.getStart(sourceFile);
+ useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end;
+ }
+ if (useActualIndentation) {
+ var actualIndentation = getActualIndentationForListItem(current, sourceFile, options);
+ if (actualIndentation !== -1) {
+ return actualIndentation + indentationDelta;
+ }
+ }
+ parentStart = getParentStart(parent, current, sourceFile);
+ var parentAndChildShareLine = parentStart.line === currentStart.line ||
+ childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile);
+ if (useActualIndentation) {
+ var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options);
+ if (actualIndentation !== -1) {
+ return actualIndentation + indentationDelta;
+ }
+ actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
+ if (actualIndentation !== -1) {
+ return actualIndentation + indentationDelta;
+ }
+ }
+ if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) {
+ indentationDelta += options.indentSize;
}
+ current = parent;
+ currentStart = parentStart;
+ parent = current.parent;
}
- return result;
- };
- Project.prototype.containsScriptInfo = function (info) {
- return this.isRoot(info) || (this.program && this.program.getSourceFileByPath(info.path) !== undefined);
- };
- Project.prototype.containsFile = function (filename, requireOpen) {
- var info = this.projectService.getScriptInfoForNormalizedPath(filename);
- if (info && (info.isOpen || !requireOpen)) {
- return this.containsScriptInfo(info);
+ return indentationDelta + getBaseIndentation(options);
+ }
+ function getParentStart(parent, child, sourceFile) {
+ var containingList = getContainingList(child, sourceFile);
+ if (containingList) {
+ return sourceFile.getLineAndCharacterOfPosition(containingList.pos);
}
- };
- Project.prototype.isRoot = function (info) {
- return this.rootFilesMap && this.rootFilesMap.contains(info.path);
- };
- Project.prototype.addRoot = function (info) {
- if (!this.isRoot(info)) {
- this.rootFiles.push(info);
- this.rootFilesMap.set(info.path, info);
- info.attachToProject(this);
- this.markAsDirty();
+ return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile));
+ }
+ function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) {
+ var commaItemInfo = ts.findListItemInfo(commaToken);
+ if (commaItemInfo && commaItemInfo.listItemIndex > 0) {
+ return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options);
}
- };
- Project.prototype.removeFile = function (info, detachFromProject) {
- if (detachFromProject === void 0) { detachFromProject = true; }
- this.removeRootFileIfNecessary(info);
- this.lsHost.notifyFileRemoved(info);
- if (detachFromProject) {
- info.detachFromProject(this);
- }
- this.markAsDirty();
- };
- Project.prototype.markAsDirty = function () {
- this.projectStateVersion++;
- };
- Project.prototype.updateGraph = function () {
- if (!this.languageServiceEnabled) {
- return true;
- }
- var hasChanges = this.updateGraphWorker();
- var cachedTypings = this.projectService.typingsCache.getTypingsForProject(this, hasChanges);
- if (this.setTypings(cachedTypings)) {
- hasChanges = this.updateGraphWorker() || hasChanges;
+ else {
+ return -1;
}
- if (hasChanges) {
- this.projectStructureVersion++;
+ }
+ function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) {
+ var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) &&
+ (parent.kind === 256 || !parentAndChildShareLine);
+ if (!useActualIndentation) {
+ return -1;
}
- return !hasChanges;
- };
- Project.prototype.setTypings = function (typings) {
- if (ts.arrayIsEqualTo(this.typingFiles, typings)) {
+ return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options);
+ }
+ function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) {
+ var nextToken = ts.findNextToken(precedingToken, current);
+ if (!nextToken) {
return false;
}
- this.typingFiles = typings;
- this.markAsDirty();
- return true;
- };
- Project.prototype.updateGraphWorker = function () {
- var oldProgram = this.program;
- this.program = this.languageService.getProgram();
- var hasChanges = false;
- if (!oldProgram || (this.program !== oldProgram && !oldProgram.structureIsReused)) {
- hasChanges = true;
- if (oldProgram) {
- for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) {
- var f = _a[_i];
- if (this.program.getSourceFileByPath(f.path)) {
- continue;
- }
- var scriptInfoToDetach = this.projectService.getScriptInfo(f.fileName);
- if (scriptInfoToDetach) {
- scriptInfoToDetach.detachFromProject(this);
- }
- }
- }
- }
- this.builder.onProjectUpdateGraph();
- return hasChanges;
- };
- Project.prototype.getScriptInfoLSHost = function (fileName) {
- var scriptInfo = this.projectService.getOrCreateScriptInfo(fileName, false);
- if (scriptInfo) {
- scriptInfo.attachToProject(this);
- }
- return scriptInfo;
- };
- Project.prototype.getScriptInfoForNormalizedPath = function (fileName) {
- var scriptInfo = this.projectService.getOrCreateScriptInfoForNormalizedPath(fileName, false);
- if (scriptInfo && !scriptInfo.isAttached(this)) {
- return server.Errors.ThrowProjectDoesNotContainDocument(fileName, this);
- }
- return scriptInfo;
- };
- Project.prototype.getScriptInfo = function (uncheckedFileName) {
- return this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName));
- };
- Project.prototype.filesToString = function () {
- if (!this.program) {
- return "";
- }
- var strBuilder = "";
- for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) {
- var file = _a[_i];
- strBuilder += file.fileName + "\n";
+ if (nextToken.kind === 16) {
+ return true;
}
- return strBuilder;
- };
- Project.prototype.setCompilerOptions = function (compilerOptions) {
- if (compilerOptions) {
- if (this.projectKind === ProjectKind.Inferred) {
- compilerOptions.allowJs = true;
- }
- compilerOptions.allowNonTsExtensions = true;
- this.compilerOptions = compilerOptions;
- this.lsHost.setCompilationSettings(compilerOptions);
- this.markAsDirty();
+ else if (nextToken.kind === 17) {
+ var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line;
+ return lineAtPosition === nextTokenStartLine;
}
- };
- Project.prototype.reloadScript = function (filename) {
- var script = this.projectService.getScriptInfoForNormalizedPath(filename);
- if (script) {
- ts.Debug.assert(script.isAttached(this));
- script.reloadFromFile();
- return true;
+ return false;
+ }
+ function getStartLineAndCharacterForNode(n, sourceFile) {
+ return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));
+ }
+ function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) {
+ if (parent.kind === 204 && parent.elseStatement === child) {
+ var elseKeyword = ts.findChildOfKind(parent, 81, sourceFile);
+ ts.Debug.assert(elseKeyword !== undefined);
+ var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line;
+ return elseKeywordStartLine === childStartLine;
}
return false;
- };
- Project.prototype.getChangesSinceVersion = function (lastKnownVersion) {
- this.updateGraph();
- var info = {
- projectName: this.getProjectName(),
- version: this.projectStructureVersion,
- isInferred: this.projectKind === ProjectKind.Inferred,
- options: this.getCompilerOptions()
- };
- if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) {
- if (this.projectStructureVersion == this.lastReportedVersion) {
- return { info: info, projectErrors: this.projectErrors };
- }
- var lastReportedFileNames = this.lastReportedFileNames;
- var currentFiles = ts.arrayToMap(this.getFileNames(), function (x) { return x; });
- var added = [];
- var removed = [];
- for (var id in currentFiles) {
- if (!ts.hasProperty(lastReportedFileNames, id)) {
- added.push(id);
+ }
+ SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement;
+ function getContainingList(node, sourceFile) {
+ if (node.parent) {
+ switch (node.parent.kind) {
+ case 156:
+ if (node.parent.typeArguments &&
+ ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) {
+ return node.parent.typeArguments;
+ }
+ break;
+ case 172:
+ return node.parent.properties;
+ case 171:
+ return node.parent.elements;
+ case 221:
+ case 180:
+ case 181:
+ case 148:
+ case 147:
+ case 152:
+ case 153: {
+ var start = node.getStart(sourceFile);
+ if (node.parent.typeParameters &&
+ ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) {
+ return node.parent.typeParameters;
+ }
+ if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) {
+ return node.parent.parameters;
+ }
+ break;
}
- }
- for (var id in lastReportedFileNames) {
- if (!ts.hasProperty(currentFiles, id)) {
- removed.push(id);
+ case 176:
+ case 175: {
+ var start = node.getStart(sourceFile);
+ if (node.parent.typeArguments &&
+ ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) {
+ return node.parent.typeArguments;
+ }
+ if (node.parent.arguments &&
+ ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) {
+ return node.parent.arguments;
+ }
+ break;
}
}
- this.lastReportedFileNames = currentFiles;
- this.lastReportedVersion = this.projectStructureVersion;
- return { info: info, changes: { added: added, removed: removed }, projectErrors: this.projectErrors };
- }
- else {
- var projectFileNames = this.getFileNames();
- this.lastReportedFileNames = ts.arrayToMap(projectFileNames, function (x) { return x; });
- this.lastReportedVersion = this.projectStructureVersion;
- return { info: info, files: projectFileNames, projectErrors: this.projectErrors };
}
- };
- Project.prototype.getReferencedFiles = function (path) {
- var _this = this;
- if (!this.languageServiceEnabled) {
- return [];
+ return undefined;
+ }
+ function getActualIndentationForListItem(node, sourceFile, options) {
+ var containingList = getContainingList(node, sourceFile);
+ return containingList ? getActualIndentationFromList(containingList) : -1;
+ function getActualIndentationFromList(list) {
+ var index = ts.indexOf(list, node);
+ return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1;
}
- var sourceFile = this.getSourceFile(path);
- if (!sourceFile) {
- return [];
+ }
+ function getLineIndentationWhenExpressionIsInMultiLine(node, sourceFile, options) {
+ if (node.kind === 19) {
+ return -1;
}
- var referencedFiles = ts.createMap();
- if (sourceFile.imports && sourceFile.imports.length > 0) {
- var checker = this.program.getTypeChecker();
- for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {
- var importName = _a[_i];
- var symbol = checker.getSymbolAtLocation(importName);
- if (symbol && symbol.declarations && symbol.declarations[0]) {
- var declarationSourceFile = symbol.declarations[0].getSourceFile();
- if (declarationSourceFile) {
- referencedFiles[declarationSourceFile.path] = true;
- }
- }
+ if (node.parent && (node.parent.kind === 175 ||
+ node.parent.kind === 176) &&
+ node.parent.expression !== node) {
+ var fullCallOrNewExpression = node.parent.expression;
+ var startingExpression = getStartingExpression(fullCallOrNewExpression);
+ if (fullCallOrNewExpression === startingExpression) {
+ return -1;
}
- }
- var currentDirectory = ts.getDirectoryPath(path);
- var getCanonicalFileName = ts.createGetCanonicalFileName(this.projectService.host.useCaseSensitiveFileNames);
- if (sourceFile.referencedFiles && sourceFile.referencedFiles.length > 0) {
- for (var _b = 0, _c = sourceFile.referencedFiles; _b < _c.length; _b++) {
- var referencedFile = _c[_b];
- var referencedPath = ts.toPath(referencedFile.fileName, currentDirectory, getCanonicalFileName);
- referencedFiles[referencedPath] = true;
+ var fullCallOrNewExpressionEnd = sourceFile.getLineAndCharacterOfPosition(fullCallOrNewExpression.end);
+ var startingExpressionEnd = sourceFile.getLineAndCharacterOfPosition(startingExpression.end);
+ if (fullCallOrNewExpressionEnd.line === startingExpressionEnd.line) {
+ return -1;
}
+ return findColumnForFirstNonWhitespaceCharacterInLine(fullCallOrNewExpressionEnd, sourceFile, options);
}
- if (sourceFile.resolvedTypeReferenceDirectiveNames) {
- for (var typeName in sourceFile.resolvedTypeReferenceDirectiveNames) {
- var resolvedTypeReferenceDirective = sourceFile.resolvedTypeReferenceDirectiveNames[typeName];
- if (!resolvedTypeReferenceDirective) {
- continue;
+ return -1;
+ function getStartingExpression(node) {
+ while (true) {
+ switch (node.kind) {
+ case 175:
+ case 176:
+ case 173:
+ case 174:
+ node = node.expression;
+ break;
+ default:
+ return node;
}
- var fileName = resolvedTypeReferenceDirective.resolvedFileName;
- var typeFilePath = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
- referencedFiles[typeFilePath] = true;
}
}
- var allFileNames = ts.map(Object.keys(referencedFiles), function (key) { return key; });
- return ts.filter(allFileNames, function (file) { return _this.projectService.host.fileExists(file); });
- };
- Project.prototype.removeRootFileIfNecessary = function (info) {
- if (this.isRoot(info)) {
- remove(this.rootFiles, info);
- this.rootFilesMap.remove(info.path);
- }
- };
- return Project;
- }());
- server.Project = Project;
- var InferredProject = (function (_super) {
- __extends(InferredProject, _super);
- function InferredProject(projectService, documentRegistry, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) {
- var _this = _super.call(this, ProjectKind.Inferred, projectService, documentRegistry, undefined, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
- _this.compileOnSaveEnabled = compileOnSaveEnabled;
- _this.directoriesWatchedForTsconfig = [];
- _this.inferredProjectName = server.makeInferredProjectName(InferredProject.NextId);
- InferredProject.NextId++;
- return _this;
- }
- InferredProject.prototype.getProjectName = function () {
- return this.inferredProjectName;
- };
- InferredProject.prototype.getProjectRootPath = function () {
- if (this.projectService.useSingleInferredProject) {
- return undefined;
- }
- var rootFiles = this.getRootFiles();
- return ts.getDirectoryPath(rootFiles[0]);
- };
- InferredProject.prototype.close = function () {
- _super.prototype.close.call(this);
- for (var _i = 0, _a = this.directoriesWatchedForTsconfig; _i < _a.length; _i++) {
- var directory = _a[_i];
- this.projectService.stopWatchingDirectory(directory);
- }
- };
- InferredProject.prototype.getTypingOptions = function () {
- return {
- enableAutoDiscovery: allRootFilesAreJsOrDts(this),
- include: [],
- exclude: []
- };
- };
- return InferredProject;
- }(Project));
- InferredProject.NextId = 1;
- server.InferredProject = InferredProject;
- var ConfiguredProject = (function (_super) {
- __extends(ConfiguredProject, _super);
- function ConfiguredProject(configFileName, projectService, documentRegistry, hasExplicitListOfFiles, compilerOptions, wildcardDirectories, languageServiceEnabled, compileOnSaveEnabled) {
- var _this = _super.call(this, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
- _this.configFileName = configFileName;
- _this.wildcardDirectories = wildcardDirectories;
- _this.compileOnSaveEnabled = compileOnSaveEnabled;
- _this.openRefCount = 0;
- return _this;
}
- ConfiguredProject.prototype.getProjectRootPath = function () {
- return ts.getDirectoryPath(this.configFileName);
- };
- ConfiguredProject.prototype.setProjectErrors = function (projectErrors) {
- this.projectErrors = projectErrors;
- };
- ConfiguredProject.prototype.setTypingOptions = function (newTypingOptions) {
- this.typingOptions = newTypingOptions;
- };
- ConfiguredProject.prototype.getTypingOptions = function () {
- return this.typingOptions;
- };
- ConfiguredProject.prototype.getProjectName = function () {
- return this.configFileName;
- };
- ConfiguredProject.prototype.watchConfigFile = function (callback) {
- var _this = this;
- this.projectFileWatcher = this.projectService.host.watchFile(this.configFileName, function (_) { return callback(_this); });
- };
- ConfiguredProject.prototype.watchTypeRoots = function (callback) {
- var _this = this;
- var roots = this.getEffectiveTypeRoots();
- var watchers = [];
- for (var _i = 0, roots_1 = roots; _i < roots_1.length; _i++) {
- var root = roots_1[_i];
- this.projectService.logger.info("Add type root watcher for: " + root);
- watchers.push(this.projectService.host.watchDirectory(root, function (path) { return callback(_this, path); }, false));
- }
- this.typeRootsWatchers = watchers;
- };
- ConfiguredProject.prototype.watchConfigDirectory = function (callback) {
- var _this = this;
- if (this.directoryWatcher) {
- return;
- }
- var directoryToWatch = ts.getDirectoryPath(this.configFileName);
- this.projectService.logger.info("Add recursive watcher for: " + directoryToWatch);
- this.directoryWatcher = this.projectService.host.watchDirectory(directoryToWatch, function (path) { return callback(_this, path); }, true);
- };
- ConfiguredProject.prototype.watchWildcards = function (callback) {
- var _this = this;
- if (!this.wildcardDirectories) {
- return;
- }
- var configDirectoryPath = ts.getDirectoryPath(this.configFileName);
- this.directoriesWatchedForWildcards = ts.reduceProperties(this.wildcardDirectories, function (watchers, flag, directory) {
- if (ts.comparePaths(configDirectoryPath, directory, ".", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) {
- var recursive = (flag & 1) !== 0;
- _this.projectService.logger.info("Add " + (recursive ? "recursive " : "") + "watcher for: " + directory);
- watchers[directory] = _this.projectService.host.watchDirectory(directory, function (path) { return callback(_this, path); }, recursive);
+ function deriveActualIndentationFromList(list, index, sourceFile, options) {
+ ts.Debug.assert(index >= 0 && index < list.length);
+ var node = list[index];
+ var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile);
+ for (var i = index - 1; i >= 0; i--) {
+ if (list[i].kind === 25) {
+ continue;
}
- return watchers;
- }, {});
- };
- ConfiguredProject.prototype.stopWatchingDirectory = function () {
- if (this.directoryWatcher) {
- this.directoryWatcher.close();
- this.directoryWatcher = undefined;
- }
- };
- ConfiguredProject.prototype.close = function () {
- _super.prototype.close.call(this);
- if (this.projectFileWatcher) {
- this.projectFileWatcher.close();
- }
- if (this.typeRootsWatchers) {
- for (var _i = 0, _a = this.typeRootsWatchers; _i < _a.length; _i++) {
- var watcher = _a[_i];
- watcher.close();
+ var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line;
+ if (prevEndLine !== lineAndCharacter.line) {
+ return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options);
}
- this.typeRootsWatchers = undefined;
- }
- for (var id in this.directoriesWatchedForWildcards) {
- this.directoriesWatchedForWildcards[id].close();
+ lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile);
}
- this.directoriesWatchedForWildcards = undefined;
- this.stopWatchingDirectory();
- };
- ConfiguredProject.prototype.addOpenRef = function () {
- this.openRefCount++;
- };
- ConfiguredProject.prototype.deleteOpenRef = function () {
- this.openRefCount--;
- return this.openRefCount;
- };
- ConfiguredProject.prototype.getEffectiveTypeRoots = function () {
- return ts.getEffectiveTypeRoots(this.getCompilerOptions(), this.projectService.host) || [];
- };
- return ConfiguredProject;
- }(Project));
- server.ConfiguredProject = ConfiguredProject;
- var ExternalProject = (function (_super) {
- __extends(ExternalProject, _super);
- function ExternalProject(externalProjectName, projectService, documentRegistry, compilerOptions, languageServiceEnabled, compileOnSaveEnabled, projectFilePath) {
- var _this = _super.call(this, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
- _this.externalProjectName = externalProjectName;
- _this.compileOnSaveEnabled = compileOnSaveEnabled;
- _this.projectFilePath = projectFilePath;
- return _this;
+ return -1;
}
- ExternalProject.prototype.getProjectRootPath = function () {
- if (this.projectFilePath) {
- return ts.getDirectoryPath(this.projectFilePath);
- }
- return ts.getDirectoryPath(ts.normalizeSlashes(this.externalProjectName));
- };
- ExternalProject.prototype.getTypingOptions = function () {
- return this.typingOptions;
- };
- ExternalProject.prototype.setProjectErrors = function (projectErrors) {
- this.projectErrors = projectErrors;
- };
- ExternalProject.prototype.setTypingOptions = function (newTypingOptions) {
- if (!newTypingOptions) {
- newTypingOptions = {
- enableAutoDiscovery: allRootFilesAreJsOrDts(this),
- include: [],
- exclude: []
- };
- }
- else {
- if (newTypingOptions.enableAutoDiscovery === undefined) {
- newTypingOptions.enableAutoDiscovery = allRootFilesAreJsOrDts(this);
+ function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) {
+ var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0);
+ return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options);
+ }
+ function findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options) {
+ var character = 0;
+ var column = 0;
+ for (var pos = startPos; pos < endPos; pos++) {
+ var ch = sourceFile.text.charCodeAt(pos);
+ if (!ts.isWhiteSpaceSingleLine(ch)) {
+ break;
}
- if (!newTypingOptions.include) {
- newTypingOptions.include = [];
+ if (ch === 9) {
+ column += options.tabSize + (column % options.tabSize);
}
- if (!newTypingOptions.exclude) {
- newTypingOptions.exclude = [];
+ else {
+ column++;
}
+ character++;
}
- this.typingOptions = newTypingOptions;
- };
- ExternalProject.prototype.getProjectName = function () {
- return this.externalProjectName;
- };
- return ExternalProject;
- }(Project));
- server.ExternalProject = ExternalProject;
- })(server = ts.server || (ts.server = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var server;
- (function (server) {
- server.maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
- function combineProjectOutput(projects, action, comparer, areEqual) {
- var result = projects.reduce(function (previous, current) { return ts.concatenate(previous, action(current)); }, []).sort(comparer);
- return projects.length > 1 ? ts.deduplicate(result, areEqual) : result;
- }
- server.combineProjectOutput = combineProjectOutput;
- var fileNamePropertyReader = {
- getFileName: function (x) { return x; },
- getScriptKind: function (_) { return undefined; },
- hasMixedContent: function (_) { return false; }
- };
- var externalFilePropertyReader = {
- getFileName: function (x) { return x.fileName; },
- getScriptKind: function (x) { return x.scriptKind; },
- hasMixedContent: function (x) { return x.hasMixedContent; }
- };
- function findProjectByName(projectName, projects) {
- for (var _i = 0, projects_1 = projects; _i < projects_1.length; _i++) {
- var proj = projects_1[_i];
- if (proj.getProjectName() === projectName) {
- return proj;
- }
- }
- }
- function createFileNotFoundDiagnostic(fileName) {
- return ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName);
- }
- function isRootFileInInferredProject(info) {
- if (info.containingProjects.length === 0) {
- return false;
+ return { column: column, character: character };
}
- return info.containingProjects[0].projectKind === server.ProjectKind.Inferred && info.containingProjects[0].isRoot(info);
- }
- var DirectoryWatchers = (function () {
- function DirectoryWatchers(projectService) {
- this.projectService = projectService;
- this.directoryWatchersForTsconfig = ts.createMap();
- this.directoryWatchersRefCount = ts.createMap();
+ SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn;
+ function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) {
+ return findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options).column;
}
- DirectoryWatchers.prototype.stopWatchingDirectory = function (directory) {
- this.directoryWatchersRefCount[directory]--;
- if (this.directoryWatchersRefCount[directory] === 0) {
- this.projectService.logger.info("Close directory watcher for: " + directory);
- this.directoryWatchersForTsconfig[directory].close();
- delete this.directoryWatchersForTsconfig[directory];
- }
- };
- DirectoryWatchers.prototype.startWatchingContainingDirectoriesForFile = function (fileName, project, callback) {
- var currentPath = ts.getDirectoryPath(fileName);
- var parentPath = ts.getDirectoryPath(currentPath);
- while (currentPath != parentPath) {
- if (!this.directoryWatchersForTsconfig[currentPath]) {
- this.projectService.logger.info("Add watcher for: " + currentPath);
- this.directoryWatchersForTsconfig[currentPath] = this.projectService.host.watchDirectory(currentPath, callback);
- this.directoryWatchersRefCount[currentPath] = 1;
- }
- else {
- this.directoryWatchersRefCount[currentPath] += 1;
- }
- project.directoriesWatchedForTsconfig.push(currentPath);
- currentPath = parentPath;
- parentPath = ts.getDirectoryPath(parentPath);
+ SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn;
+ function nodeContentIsAlwaysIndented(kind) {
+ switch (kind) {
+ case 203:
+ case 222:
+ case 193:
+ case 223:
+ case 225:
+ case 224:
+ case 171:
+ case 200:
+ case 227:
+ case 172:
+ case 160:
+ case 162:
+ case 228:
+ case 250:
+ case 249:
+ case 179:
+ case 173:
+ case 175:
+ case 176:
+ case 201:
+ case 219:
+ case 236:
+ case 212:
+ case 189:
+ case 169:
+ case 168:
+ case 244:
+ case 243:
+ case 248:
+ case 147:
+ case 152:
+ case 153:
+ case 143:
+ case 157:
+ case 158:
+ case 165:
+ case 177:
+ case 185:
+ case 238:
+ case 234:
+ case 239:
+ case 235:
+ return true;
}
- };
- return DirectoryWatchers;
- }());
- var ProjectService = (function () {
- function ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, eventHandler) {
- if (typingsInstaller === void 0) { typingsInstaller = server.nullTypingsInstaller; }
- this.host = host;
- this.logger = logger;
- this.cancellationToken = cancellationToken;
- this.useSingleInferredProject = useSingleInferredProject;
- this.typingsInstaller = typingsInstaller;
- this.eventHandler = eventHandler;
- this.filenameToScriptInfo = ts.createFileMap();
- this.externalProjectToConfiguredProjectMap = ts.createMap();
- this.externalProjects = [];
- this.inferredProjects = [];
- this.configuredProjects = [];
- this.openFiles = [];
- this.toCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
- this.directoryWatchers = new DirectoryWatchers(this);
- this.throttledOperations = new server.ThrottledOperations(host);
- this.typingsInstaller.attach(this);
- this.typingsCache = new server.TypingsCache(this.typingsInstaller);
- this.hostConfiguration = {
- formatCodeOptions: server.getDefaultFormatCodeSettings(this.host),
- hostInfo: "Unknown host"
- };
- this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory());
+ return false;
}
- ProjectService.prototype.getChangedFiles_TestOnly = function () {
- return this.changedFiles;
- };
- ProjectService.prototype.ensureInferredProjectsUpToDate_TestOnly = function () {
- this.ensureInferredProjectsUpToDate();
- };
- ProjectService.prototype.updateTypingsForProject = function (response) {
- var project = this.findProject(response.projectName);
- if (!project) {
- return;
+ function nodeWillIndentChild(parent, child, indentByDefault) {
+ var childKind = child ? child.kind : 0;
+ switch (parent.kind) {
+ case 205:
+ case 206:
+ case 208:
+ case 209:
+ case 207:
+ case 204:
+ case 221:
+ case 180:
+ case 148:
+ case 181:
+ case 149:
+ case 150:
+ case 151:
+ return childKind !== 200;
+ case 237:
+ return childKind !== 238;
+ case 231:
+ return childKind !== 232 ||
+ (child.namedBindings && child.namedBindings.kind !== 234);
+ case 242:
+ return childKind !== 245;
}
- switch (response.kind) {
- case "set":
- this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typingOptions, response.typings);
- project.updateGraph();
- break;
- case "invalidate":
- this.typingsCache.invalidateCachedTypingsForProject(project);
- break;
+ return indentByDefault;
+ }
+ SmartIndenter.nodeWillIndentChild = nodeWillIndentChild;
+ function shouldIndentChildNode(parent, child) {
+ return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false);
+ }
+ SmartIndenter.shouldIndentChildNode = shouldIndentChildNode;
+ })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {}));
+ })(formatting = ts.formatting || (ts.formatting = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var codefix;
+ (function (codefix) {
+ var codeFixes = ts.createMap();
+ function registerCodeFix(action) {
+ ts.forEach(action.errorCodes, function (error) {
+ var fixes = codeFixes[error];
+ if (!fixes) {
+ fixes = [];
+ codeFixes[error] = fixes;
}
- };
- ProjectService.prototype.setCompilerOptionsForInferredProjects = function (projectCompilerOptions) {
- this.compilerOptionsForInferredProjects = projectCompilerOptions;
- this.compileOnSaveForInferredProjects = projectCompilerOptions.compileOnSave;
- for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) {
- var proj = _a[_i];
- proj.setCompilerOptions(projectCompilerOptions);
- proj.compileOnSaveEnabled = projectCompilerOptions.compileOnSave;
+ fixes.push(action);
+ });
+ }
+ codefix.registerCodeFix = registerCodeFix;
+ function getSupportedErrorCodes() {
+ return Object.keys(codeFixes);
+ }
+ codefix.getSupportedErrorCodes = getSupportedErrorCodes;
+ function getFixes(context) {
+ var fixes = codeFixes[context.errorCode];
+ var allActions = [];
+ ts.forEach(fixes, function (f) {
+ var actions = f.getCodeActions(context);
+ if (actions && actions.length > 0) {
+ allActions = allActions.concat(actions);
}
- this.updateProjectGraphs(this.inferredProjects);
- };
- ProjectService.prototype.stopWatchingDirectory = function (directory) {
- this.directoryWatchers.stopWatchingDirectory(directory);
- };
- ProjectService.prototype.findProject = function (projectName) {
- if (projectName === undefined) {
+ });
+ return allActions;
+ }
+ codefix.getFixes = getFixes;
+ })(codefix = ts.codefix || (ts.codefix = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var codefix;
+ (function (codefix) {
+ function getOpenBraceEnd(constructor, sourceFile) {
+ return constructor.body.getFirstToken(sourceFile).getEnd();
+ }
+ codefix.registerCodeFix({
+ errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code],
+ getCodeActions: function (context) {
+ var sourceFile = context.sourceFile;
+ var token = ts.getTokenAtPosition(sourceFile, context.span.start);
+ if (token.kind !== 122) {
return undefined;
}
- if (server.isInferredProjectName(projectName)) {
- this.ensureInferredProjectsUpToDate();
- return findProjectByName(projectName, this.inferredProjects);
+ var newPosition = getOpenBraceEnd(token.parent, sourceFile);
+ return [{
+ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call),
+ changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }]
+ }];
+ }
+ });
+ codefix.registerCodeFix({
+ errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code],
+ getCodeActions: function (context) {
+ var sourceFile = context.sourceFile;
+ var token = ts.getTokenAtPosition(sourceFile, context.span.start);
+ if (token.kind !== 98) {
+ return undefined;
}
- return this.findExternalProjectByProjectName(projectName) || this.findConfiguredProjectByProjectName(server.toNormalizedPath(projectName));
- };
- ProjectService.prototype.getDefaultProjectForFile = function (fileName, refreshInferredProjects) {
- if (refreshInferredProjects) {
- this.ensureInferredProjectsUpToDate();
+ var constructor = ts.getContainingFunction(token);
+ var superCall = findSuperCall(constructor.body);
+ if (!superCall) {
+ return undefined;
}
- var scriptInfo = this.getScriptInfoForNormalizedPath(fileName);
- return scriptInfo && scriptInfo.getDefaultProject();
- };
- ProjectService.prototype.ensureInferredProjectsUpToDate = function () {
- if (this.changedFiles) {
- var projectsToUpdate = void 0;
- if (this.changedFiles.length === 1) {
- projectsToUpdate = this.changedFiles[0].containingProjects;
- }
- else {
- projectsToUpdate = [];
- for (var _i = 0, _a = this.changedFiles; _i < _a.length; _i++) {
- var f = _a[_i];
- projectsToUpdate = projectsToUpdate.concat(f.containingProjects);
+ if (superCall.expression && superCall.expression.kind == 175) {
+ var arguments_1 = superCall.expression.arguments;
+ for (var i = 0; i < arguments_1.length; i++) {
+ if (arguments_1[i].expression === token) {
+ return undefined;
}
}
- this.updateProjectGraphs(projectsToUpdate);
- this.changedFiles = undefined;
- }
- };
- ProjectService.prototype.findContainingExternalProject = function (fileName) {
- for (var _i = 0, _a = this.externalProjects; _i < _a.length; _i++) {
- var proj = _a[_i];
- if (proj.containsFile(fileName)) {
- return proj;
- }
}
- return undefined;
- };
- ProjectService.prototype.getFormatCodeOptions = function (file) {
- var formatCodeSettings;
- if (file) {
- var info = this.getScriptInfoForNormalizedPath(file);
- if (info) {
- formatCodeSettings = info.getFormatCodeSettings();
+ var newPosition = getOpenBraceEnd(constructor, sourceFile);
+ var changes = [{
+ fileName: sourceFile.fileName, textChanges: [{
+ newText: superCall.getText(sourceFile),
+ span: { start: newPosition, length: 0 }
+ },
+ {
+ newText: "",
+ span: { start: superCall.getStart(sourceFile), length: superCall.getWidth(sourceFile) }
+ }]
+ }];
+ return [{
+ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Make_super_call_the_first_statement_in_the_constructor),
+ changes: changes
+ }];
+ function findSuperCall(n) {
+ if (n.kind === 203 && ts.isSuperCall(n.expression)) {
+ return n;
}
- }
- return formatCodeSettings || this.hostConfiguration.formatCodeOptions;
- };
- ProjectService.prototype.updateProjectGraphs = function (projects) {
- var shouldRefreshInferredProjects = false;
- for (var _i = 0, projects_2 = projects; _i < projects_2.length; _i++) {
- var p = projects_2[_i];
- if (!p.updateGraph()) {
- shouldRefreshInferredProjects = true;
+ if (ts.isFunctionLike(n)) {
+ return undefined;
}
+ return ts.forEachChild(n, findSuperCall);
}
- if (shouldRefreshInferredProjects) {
- this.refreshInferredProjects();
- }
- };
- ProjectService.prototype.onSourceFileChanged = function (fileName) {
- var info = this.getScriptInfoForNormalizedPath(fileName);
- if (!info) {
- this.logger.info("Error: got watch notification for unknown file: " + fileName);
- return;
- }
- if (!this.host.fileExists(fileName)) {
- this.handleDeletedFile(info);
+ }
+ });
+ })(codefix = ts.codefix || (ts.codefix = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ ts.servicesVersion = "0.5";
+ function createNode(kind, pos, end, parent) {
+ var node = kind >= 140 ? new NodeObject(kind, pos, end) :
+ kind === 70 ? new IdentifierObject(70, pos, end) :
+ new TokenObject(kind, pos, end);
+ node.parent = parent;
+ return node;
+ }
+ var NodeObject = (function () {
+ function NodeObject(kind, pos, end) {
+ this.pos = pos;
+ this.end = end;
+ this.flags = 0;
+ this.transformFlags = undefined;
+ this.excludeTransformFlags = undefined;
+ this.parent = undefined;
+ this.kind = kind;
+ }
+ NodeObject.prototype.getSourceFile = function () {
+ return ts.getSourceFileOfNode(this);
+ };
+ NodeObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
+ return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
+ };
+ NodeObject.prototype.getFullStart = function () {
+ return this.pos;
+ };
+ NodeObject.prototype.getEnd = function () {
+ return this.end;
+ };
+ NodeObject.prototype.getWidth = function (sourceFile) {
+ return this.getEnd() - this.getStart(sourceFile);
+ };
+ NodeObject.prototype.getFullWidth = function () {
+ return this.end - this.pos;
+ };
+ NodeObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
+ return this.getStart(sourceFile) - this.pos;
+ };
+ NodeObject.prototype.getFullText = function (sourceFile) {
+ return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
+ };
+ NodeObject.prototype.getText = function (sourceFile) {
+ if (!sourceFile) {
+ sourceFile = this.getSourceFile();
+ }
+ return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd());
+ };
+ NodeObject.prototype.addSyntheticNodes = function (nodes, pos, end, useJSDocScanner) {
+ ts.scanner.setTextPos(pos);
+ while (pos < end) {
+ var token = useJSDocScanner ? ts.scanner.scanJSDocToken() : ts.scanner.scan();
+ var textPos = ts.scanner.getTextPos();
+ if (textPos <= end) {
+ nodes.push(createNode(token, pos, textPos, this));
}
- else {
- if (info && (!info.isOpen)) {
- info.reloadFromFile();
- this.updateProjectGraphs(info.containingProjects);
- }
+ pos = textPos;
+ }
+ return pos;
+ };
+ NodeObject.prototype.createSyntaxList = function (nodes) {
+ var list = createNode(286, nodes.pos, nodes.end, this);
+ list._children = [];
+ var pos = nodes.pos;
+ for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
+ var node = nodes_4[_i];
+ if (pos < node.pos) {
+ pos = this.addSyntheticNodes(list._children, pos, node.pos);
}
- };
- ProjectService.prototype.handleDeletedFile = function (info) {
- this.logger.info(info.fileName + " deleted");
- info.stopWatcher();
- if (!info.isOpen) {
- this.filenameToScriptInfo.remove(info.path);
- this.lastDeletedFile = info;
- var containingProjects = info.containingProjects.slice();
- info.detachAllProjects();
- this.updateProjectGraphs(containingProjects);
- this.lastDeletedFile = undefined;
- if (!this.eventHandler) {
- return;
+ list._children.push(node);
+ pos = node.end;
+ }
+ if (pos < nodes.end) {
+ this.addSyntheticNodes(list._children, pos, nodes.end);
+ }
+ return list;
+ };
+ NodeObject.prototype.createChildren = function (sourceFile) {
+ var _this = this;
+ var children;
+ if (this.kind >= 140) {
+ ts.scanner.setText((sourceFile || this.getSourceFile()).text);
+ children = [];
+ var pos_3 = this.pos;
+ var useJSDocScanner_1 = this.kind >= 273 && this.kind <= 285;
+ var processNode = function (node) {
+ var isJSDocTagNode = ts.isJSDocTag(node);
+ if (!isJSDocTagNode && pos_3 < node.pos) {
+ pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos, useJSDocScanner_1);
}
- for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {
- var openFile = _a[_i];
- this.eventHandler({ eventName: "context", data: { project: openFile.getDefaultProject(), fileName: openFile.fileName } });
+ children.push(node);
+ if (!isJSDocTagNode) {
+ pos_3 = node.end;
}
- }
- this.printProjects();
- };
- ProjectService.prototype.onTypeRootFileChanged = function (project, fileName) {
- var _this = this;
- this.logger.info("Type root file " + fileName + " changed");
- this.throttledOperations.schedule(project.configFileName + " * type root", 250, function () {
- project.updateTypes();
- _this.updateConfiguredProject(project);
- _this.refreshInferredProjects();
- });
- };
- ProjectService.prototype.onSourceFileInDirectoryChangedForConfiguredProject = function (project, fileName) {
- var _this = this;
- if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions())) {
- return;
- }
- this.logger.info("Detected source file changes: " + fileName);
- this.throttledOperations.schedule(project.configFileName, 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project); });
- };
- ProjectService.prototype.handleChangeInSourceFileForConfiguredProject = function (project) {
- var _this = this;
- var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
- this.reportConfigFileDiagnostics(project.getProjectName(), configFileErrors);
- var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); }));
- var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); }));
- if (!ts.arrayIsEqualTo(currentRootFiles.sort(), newRootFiles.sort())) {
- this.logger.info("Updating configured project");
- this.updateConfiguredProject(project);
- this.refreshInferredProjects();
- }
- };
- ProjectService.prototype.onConfigChangedForConfiguredProject = function (project) {
- this.logger.info("Config file changed: " + project.configFileName);
- this.updateConfiguredProject(project);
- this.refreshInferredProjects();
- };
- ProjectService.prototype.onConfigFileAddedForInferredProject = function (fileName) {
- if (ts.getBaseFileName(fileName) != "tsconfig.json") {
- this.logger.info(fileName + " is not tsconfig.json");
- return;
- }
- var configFileErrors = this.convertConfigFileContentToProjectOptions(fileName).configFileErrors;
- this.reportConfigFileDiagnostics(fileName, configFileErrors);
- this.logger.info("Detected newly added tsconfig file: " + fileName);
- this.reloadProjects();
- };
- ProjectService.prototype.getCanonicalFileName = function (fileName) {
- var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
- return ts.normalizePath(name);
- };
- ProjectService.prototype.removeProject = function (project) {
- this.logger.info("remove project: " + project.getRootFiles().toString());
- project.close();
- switch (project.projectKind) {
- case server.ProjectKind.External:
- server.removeItemFromSet(this.externalProjects, project);
- break;
- case server.ProjectKind.Configured:
- server.removeItemFromSet(this.configuredProjects, project);
- break;
- case server.ProjectKind.Inferred:
- server.removeItemFromSet(this.inferredProjects, project);
- break;
- }
- };
- ProjectService.prototype.assignScriptInfoToInferredProjectIfNecessary = function (info, addToListOfOpenFiles) {
- var externalProject = this.findContainingExternalProject(info.fileName);
- if (externalProject) {
- if (addToListOfOpenFiles) {
- this.openFiles.push(info);
+ };
+ var processNodes = function (nodes) {
+ if (pos_3 < nodes.pos) {
+ pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos, useJSDocScanner_1);
}
- return;
- }
- var foundConfiguredProject = false;
- for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) {
- var p = _a[_i];
- if (p.projectKind === server.ProjectKind.Configured) {
- foundConfiguredProject = true;
- if (addToListOfOpenFiles) {
- (p).addOpenRef();
- }
+ children.push(_this.createSyntaxList(nodes));
+ pos_3 = nodes.end;
+ };
+ if (this.jsDocComments) {
+ for (var _i = 0, _a = this.jsDocComments; _i < _a.length; _i++) {
+ var jsDocComment = _a[_i];
+ processNode(jsDocComment);
}
}
- if (foundConfiguredProject) {
- if (addToListOfOpenFiles) {
- this.openFiles.push(info);
- }
- return;
- }
- if (info.containingProjects.length === 0) {
- var inferredProject = this.createInferredProjectWithRootFileIfNecessary(info);
- if (!this.useSingleInferredProject) {
- for (var _b = 0, _c = this.openFiles; _b < _c.length; _b++) {
- var f = _c[_b];
- if (f.containingProjects.length === 0) {
- continue;
- }
- var defaultProject = f.getDefaultProject();
- if (isRootFileInInferredProject(info) && defaultProject !== inferredProject && inferredProject.containsScriptInfo(f)) {
- this.removeProject(defaultProject);
- f.attachToProject(inferredProject);
- }
- }
- }
- }
- if (addToListOfOpenFiles) {
- this.openFiles.push(info);
+ pos_3 = this.pos;
+ ts.forEachChild(this, processNode, processNodes);
+ if (pos_3 < this.end) {
+ this.addSyntheticNodes(children, pos_3, this.end);
}
- };
- ProjectService.prototype.closeOpenFile = function (info) {
- info.reloadFromFile();
- server.removeItemFromSet(this.openFiles, info);
- info.isOpen = false;
- var projectsToRemove;
- for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) {
- var p = _a[_i];
- if (p.projectKind === server.ProjectKind.Configured) {
- if (p.deleteOpenRef() === 0) {
- (projectsToRemove || (projectsToRemove = [])).push(p);
- }
- }
- else if (p.projectKind === server.ProjectKind.Inferred && p.isRoot(info)) {
- (projectsToRemove || (projectsToRemove = [])).push(p);
- }
+ ts.scanner.setText(undefined);
+ }
+ this._children = children || ts.emptyArray;
+ };
+ NodeObject.prototype.getChildCount = function (sourceFile) {
+ if (!this._children)
+ this.createChildren(sourceFile);
+ return this._children.length;
+ };
+ NodeObject.prototype.getChildAt = function (index, sourceFile) {
+ if (!this._children)
+ this.createChildren(sourceFile);
+ return this._children[index];
+ };
+ NodeObject.prototype.getChildren = function (sourceFile) {
+ if (!this._children)
+ this.createChildren(sourceFile);
+ return this._children;
+ };
+ NodeObject.prototype.getFirstToken = function (sourceFile) {
+ var children = this.getChildren(sourceFile);
+ if (!children.length) {
+ return undefined;
+ }
+ var child = children[0];
+ return child.kind < 140 ? child : child.getFirstToken(sourceFile);
+ };
+ NodeObject.prototype.getLastToken = function (sourceFile) {
+ var children = this.getChildren(sourceFile);
+ var child = ts.lastOrUndefined(children);
+ if (!child) {
+ return undefined;
+ }
+ return child.kind < 140 ? child : child.getLastToken(sourceFile);
+ };
+ return NodeObject;
+ }());
+ var TokenOrIdentifierObject = (function () {
+ function TokenOrIdentifierObject(pos, end) {
+ this.pos = pos;
+ this.end = end;
+ this.flags = 0;
+ this.parent = undefined;
+ }
+ TokenOrIdentifierObject.prototype.getSourceFile = function () {
+ return ts.getSourceFileOfNode(this);
+ };
+ TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
+ return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
+ };
+ TokenOrIdentifierObject.prototype.getFullStart = function () {
+ return this.pos;
+ };
+ TokenOrIdentifierObject.prototype.getEnd = function () {
+ return this.end;
+ };
+ TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {
+ return this.getEnd() - this.getStart(sourceFile);
+ };
+ TokenOrIdentifierObject.prototype.getFullWidth = function () {
+ return this.end - this.pos;
+ };
+ TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
+ return this.getStart(sourceFile) - this.pos;
+ };
+ TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {
+ return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
+ };
+ TokenOrIdentifierObject.prototype.getText = function (sourceFile) {
+ return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
+ };
+ TokenOrIdentifierObject.prototype.getChildCount = function () {
+ return 0;
+ };
+ TokenOrIdentifierObject.prototype.getChildAt = function () {
+ return undefined;
+ };
+ TokenOrIdentifierObject.prototype.getChildren = function () {
+ return ts.emptyArray;
+ };
+ TokenOrIdentifierObject.prototype.getFirstToken = function () {
+ return undefined;
+ };
+ TokenOrIdentifierObject.prototype.getLastToken = function () {
+ return undefined;
+ };
+ return TokenOrIdentifierObject;
+ }());
+ var SymbolObject = (function () {
+ function SymbolObject(flags, name) {
+ this.flags = flags;
+ this.name = name;
+ }
+ SymbolObject.prototype.getFlags = function () {
+ return this.flags;
+ };
+ SymbolObject.prototype.getName = function () {
+ return this.name;
+ };
+ SymbolObject.prototype.getDeclarations = function () {
+ return this.declarations;
+ };
+ SymbolObject.prototype.getDocumentationComment = function () {
+ if (this.documentationComment === undefined) {
+ this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations(this.declarations);
+ }
+ return this.documentationComment;
+ };
+ return SymbolObject;
+ }());
+ var TokenObject = (function (_super) {
+ __extends(TokenObject, _super);
+ function TokenObject(kind, pos, end) {
+ var _this = _super.call(this, pos, end) || this;
+ _this.kind = kind;
+ return _this;
+ }
+ return TokenObject;
+ }(TokenOrIdentifierObject));
+ var IdentifierObject = (function (_super) {
+ __extends(IdentifierObject, _super);
+ function IdentifierObject(_kind, pos, end) {
+ return _super.call(this, pos, end) || this;
+ }
+ return IdentifierObject;
+ }(TokenOrIdentifierObject));
+ IdentifierObject.prototype.kind = 70;
+ var TypeObject = (function () {
+ function TypeObject(checker, flags) {
+ this.checker = checker;
+ this.flags = flags;
+ }
+ TypeObject.prototype.getFlags = function () {
+ return this.flags;
+ };
+ TypeObject.prototype.getSymbol = function () {
+ return this.symbol;
+ };
+ TypeObject.prototype.getProperties = function () {
+ return this.checker.getPropertiesOfType(this);
+ };
+ TypeObject.prototype.getProperty = function (propertyName) {
+ return this.checker.getPropertyOfType(this, propertyName);
+ };
+ TypeObject.prototype.getApparentProperties = function () {
+ return this.checker.getAugmentedPropertiesOfType(this);
+ };
+ TypeObject.prototype.getCallSignatures = function () {
+ return this.checker.getSignaturesOfType(this, 0);
+ };
+ TypeObject.prototype.getConstructSignatures = function () {
+ return this.checker.getSignaturesOfType(this, 1);
+ };
+ TypeObject.prototype.getStringIndexType = function () {
+ return this.checker.getIndexTypeOfType(this, 0);
+ };
+ TypeObject.prototype.getNumberIndexType = function () {
+ return this.checker.getIndexTypeOfType(this, 1);
+ };
+ TypeObject.prototype.getBaseTypes = function () {
+ return this.flags & (32768 | 65536)
+ ? this.checker.getBaseTypes(this)
+ : undefined;
+ };
+ TypeObject.prototype.getNonNullableType = function () {
+ return this.checker.getNonNullableType(this);
+ };
+ return TypeObject;
+ }());
+ var SignatureObject = (function () {
+ function SignatureObject(checker) {
+ this.checker = checker;
+ }
+ SignatureObject.prototype.getDeclaration = function () {
+ return this.declaration;
+ };
+ SignatureObject.prototype.getTypeParameters = function () {
+ return this.typeParameters;
+ };
+ SignatureObject.prototype.getParameters = function () {
+ return this.parameters;
+ };
+ SignatureObject.prototype.getReturnType = function () {
+ return this.checker.getReturnTypeOfSignature(this);
+ };
+ SignatureObject.prototype.getDocumentationComment = function () {
+ if (this.documentationComment === undefined) {
+ this.documentationComment = this.declaration ? ts.JsDoc.getJsDocCommentsFromDeclarations([this.declaration]) : [];
+ }
+ return this.documentationComment;
+ };
+ return SignatureObject;
+ }());
+ var SourceFileObject = (function (_super) {
+ __extends(SourceFileObject, _super);
+ function SourceFileObject(kind, pos, end) {
+ return _super.call(this, kind, pos, end) || this;
+ }
+ SourceFileObject.prototype.update = function (newText, textChangeRange) {
+ return ts.updateSourceFile(this, newText, textChangeRange);
+ };
+ SourceFileObject.prototype.getLineAndCharacterOfPosition = function (position) {
+ return ts.getLineAndCharacterOfPosition(this, position);
+ };
+ SourceFileObject.prototype.getLineStarts = function () {
+ return ts.getLineStarts(this);
+ };
+ SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) {
+ return ts.getPositionOfLineAndCharacter(this, line, character);
+ };
+ SourceFileObject.prototype.getNamedDeclarations = function () {
+ if (!this.namedDeclarations) {
+ this.namedDeclarations = this.computeNamedDeclarations();
+ }
+ return this.namedDeclarations;
+ };
+ SourceFileObject.prototype.computeNamedDeclarations = function () {
+ var result = ts.createMap();
+ ts.forEachChild(this, visit);
+ return result;
+ function addDeclaration(declaration) {
+ var name = getDeclarationName(declaration);
+ if (name) {
+ ts.multiMapAdd(result, name, declaration);
}
- if (projectsToRemove) {
- for (var _b = 0, projectsToRemove_1 = projectsToRemove; _b < projectsToRemove_1.length; _b++) {
- var project = projectsToRemove_1[_b];
- this.removeProject(project);
- }
- var orphanFiles = void 0;
- for (var _c = 0, _d = this.openFiles; _c < _d.length; _c++) {
- var f = _d[_c];
- if (f.containingProjects.length === 0) {
- (orphanFiles || (orphanFiles = [])).push(f);
- }
+ }
+ function getDeclarations(name) {
+ return result[name] || (result[name] = []);
+ }
+ function getDeclarationName(declaration) {
+ if (declaration.name) {
+ var result_6 = getTextOfIdentifierOrLiteral(declaration.name);
+ if (result_6 !== undefined) {
+ return result_6;
}
- if (orphanFiles) {
- for (var _e = 0, orphanFiles_1 = orphanFiles; _e < orphanFiles_1.length; _e++) {
- var f = orphanFiles_1[_e];
- this.assignScriptInfoToInferredProjectIfNecessary(f, false);
+ if (declaration.name.kind === 141) {
+ var expr = declaration.name.expression;
+ if (expr.kind === 173) {
+ return expr.name.text;
}
+ return getTextOfIdentifierOrLiteral(expr);
}
}
- if (info.containingProjects.length === 0) {
- this.filenameToScriptInfo.remove(info.path);
- }
- };
- ProjectService.prototype.openOrUpdateConfiguredProjectForFile = function (fileName) {
- var searchPath = ts.getDirectoryPath(fileName);
- this.logger.info("Search path: " + searchPath);
- var configFileName = this.findConfigFile(server.asNormalizedPath(searchPath));
- if (!configFileName) {
- this.logger.info("No config files found.");
- return {};
- }
- this.logger.info("Config file name: " + configFileName);
- var project = this.findConfiguredProjectByProjectName(configFileName);
- if (!project) {
- var _a = this.openConfigFile(configFileName, fileName), success = _a.success, errors = _a.errors;
- if (!success) {
- return { configFileName: configFileName, configFileErrors: errors };
- }
- this.logger.info("Opened configuration file " + configFileName);
- if (errors && errors.length > 0) {
- return { configFileName: configFileName, configFileErrors: errors };
- }
- }
- else {
- this.updateConfiguredProject(project);
- }
- return { configFileName: configFileName };
- };
- ProjectService.prototype.findConfigFile = function (searchPath) {
- while (true) {
- var tsconfigFileName = server.asNormalizedPath(ts.combinePaths(searchPath, "tsconfig.json"));
- if (this.host.fileExists(tsconfigFileName)) {
- return tsconfigFileName;
- }
- var jsconfigFileName = server.asNormalizedPath(ts.combinePaths(searchPath, "jsconfig.json"));
- if (this.host.fileExists(jsconfigFileName)) {
- return jsconfigFileName;
- }
- var parentPath = server.asNormalizedPath(ts.getDirectoryPath(searchPath));
- if (parentPath === searchPath) {
- break;
- }
- searchPath = parentPath;
- }
return undefined;
- };
- ProjectService.prototype.printProjects = function () {
- if (!this.logger.hasLevel(server.LogLevel.verbose)) {
- return;
- }
- this.logger.startGroup();
- var counter = 0;
- counter = printProjects(this.logger, this.externalProjects, counter);
- counter = printProjects(this.logger, this.configuredProjects, counter);
- counter = printProjects(this.logger, this.inferredProjects, counter);
- this.logger.info("Open files: ");
- for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {
- var rootFile = _a[_i];
- this.logger.info(rootFile.fileName);
- }
- this.logger.endGroup();
- function printProjects(logger, projects, counter) {
- for (var _i = 0, projects_3 = projects; _i < projects_3.length; _i++) {
- var project = projects_3[_i];
- project.updateGraph();
- logger.info("Project '" + project.getProjectName() + "' (" + server.ProjectKind[project.projectKind] + ") " + counter);
- logger.info(project.filesToString());
- logger.info("-----------------------------------------------");
- counter++;
+ }
+ function getTextOfIdentifierOrLiteral(node) {
+ if (node) {
+ if (node.kind === 70 ||
+ node.kind === 9 ||
+ node.kind === 8) {
+ return node.text;
}
- return counter;
- }
- };
- ProjectService.prototype.findConfiguredProjectByProjectName = function (configFileName) {
- return findProjectByName(configFileName, this.configuredProjects);
- };
- ProjectService.prototype.findExternalProjectByProjectName = function (projectFileName) {
- return findProjectByName(projectFileName, this.externalProjects);
- };
- ProjectService.prototype.convertConfigFileContentToProjectOptions = function (configFilename) {
- configFilename = ts.normalizePath(configFilename);
- var configFileContent = this.host.readFile(configFilename);
- var errors;
- var result = ts.parseConfigFileTextToJson(configFilename, configFileContent);
- var config = result.config;
- if (result.error) {
- var _a = ts.sanitizeConfigFile(configFilename, configFileContent), sanitizedConfig = _a.configJsonObject, diagnostics = _a.diagnostics;
- config = sanitizedConfig;
- errors = diagnostics.length ? diagnostics : [result.error];
- }
- var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename);
- if (parsedCommandLine.errors.length) {
- errors = ts.concatenate(errors, parsedCommandLine.errors);
- }
- ts.Debug.assert(!!parsedCommandLine.fileNames);
- if (parsedCommandLine.fileNames.length === 0) {
- (errors || (errors = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename));
- return { success: false, configFileErrors: errors };
- }
- var projectOptions = {
- files: parsedCommandLine.fileNames,
- compilerOptions: parsedCommandLine.options,
- configHasFilesProperty: config["files"] !== undefined,
- wildcardDirectories: ts.createMap(parsedCommandLine.wildcardDirectories),
- typingOptions: parsedCommandLine.typingOptions,
- compileOnSave: parsedCommandLine.compileOnSave
- };
- return { success: true, projectOptions: projectOptions, configFileErrors: errors };
- };
- ProjectService.prototype.exceededTotalSizeLimitForNonTsFiles = function (options, fileNames, propertyReader) {
- if (options && options.disableSizeLimit || !this.host.getFileSize) {
- return false;
}
- var totalNonTsFileSize = 0;
- for (var _i = 0, fileNames_3 = fileNames; _i < fileNames_3.length; _i++) {
- var f = fileNames_3[_i];
- var fileName = propertyReader.getFileName(f);
- if (ts.hasTypeScriptFileExtension(fileName)) {
- continue;
- }
- totalNonTsFileSize += this.host.getFileSize(fileName);
- if (totalNonTsFileSize > server.maxProgramSizeForNonTsFiles) {
- return true;
+ return undefined;
+ }
+ function visit(node) {
+ switch (node.kind) {
+ case 221:
+ case 180:
+ case 148:
+ case 147:
+ var functionDeclaration = node;
+ var declarationName = getDeclarationName(functionDeclaration);
+ if (declarationName) {
+ var declarations = getDeclarations(declarationName);
+ var lastDeclaration = ts.lastOrUndefined(declarations);
+ if (lastDeclaration && functionDeclaration.parent === lastDeclaration.parent && functionDeclaration.symbol === lastDeclaration.symbol) {
+ if (functionDeclaration.body && !lastDeclaration.body) {
+ declarations[declarations.length - 1] = functionDeclaration;
+ }
+ }
+ else {
+ declarations.push(functionDeclaration);
+ }
+ ts.forEachChild(node, visit);
+ }
+ break;
+ case 222:
+ case 193:
+ case 223:
+ case 224:
+ case 225:
+ case 226:
+ case 230:
+ case 239:
+ case 235:
+ case 230:
+ case 232:
+ case 233:
+ case 150:
+ case 151:
+ case 160:
+ addDeclaration(node);
+ ts.forEachChild(node, visit);
+ break;
+ case 143:
+ if (!ts.hasModifier(node, 92)) {
+ break;
+ }
+ case 219:
+ case 170: {
+ var decl = node;
+ if (ts.isBindingPattern(decl.name)) {
+ ts.forEachChild(decl.name, visit);
+ break;
+ }
+ if (decl.initializer)
+ visit(decl.initializer);
}
+ case 255:
+ case 146:
+ case 145:
+ addDeclaration(node);
+ break;
+ case 237:
+ if (node.exportClause) {
+ ts.forEach(node.exportClause.elements, visit);
+ }
+ break;
+ case 231:
+ var importClause = node.importClause;
+ if (importClause) {
+ if (importClause.name) {
+ addDeclaration(importClause);
+ }
+ if (importClause.namedBindings) {
+ if (importClause.namedBindings.kind === 233) {
+ addDeclaration(importClause.namedBindings);
+ }
+ else {
+ ts.forEach(importClause.namedBindings.elements, visit);
+ }
+ }
+ }
+ break;
+ default:
+ ts.forEachChild(node, visit);
}
- return false;
- };
- ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typingOptions) {
- var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, options, !this.exceededTotalSizeLimitForNonTsFiles(options, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave);
- this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typingOptions, undefined);
- this.externalProjects.push(project);
- return project;
- };
- ProjectService.prototype.reportConfigFileDiagnostics = function (configFileName, diagnostics, triggerFile) {
- if (!this.eventHandler) {
- return;
- }
- this.eventHandler({
- eventName: "configFileDiag",
- data: { configFileName: configFileName, diagnostics: diagnostics || [], triggerFile: triggerFile }
- });
- };
- ProjectService.prototype.createAndAddConfiguredProject = function (configFileName, projectOptions, configFileErrors, clientFileName) {
- var _this = this;
- var sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader);
- var project = new server.ConfiguredProject(configFileName, this, this.documentRegistry, projectOptions.configHasFilesProperty, projectOptions.compilerOptions, projectOptions.wildcardDirectories, !sizeLimitExceeded, projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave);
- this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typingOptions, configFileErrors);
- project.watchConfigFile(function (project) { return _this.onConfigChangedForConfiguredProject(project); });
- if (!sizeLimitExceeded) {
- this.watchConfigDirectoryForProject(project, projectOptions);
- }
- project.watchWildcards(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); });
- project.watchTypeRoots(function (project, path) { return _this.onTypeRootFileChanged(project, path); });
- this.configuredProjects.push(project);
- return project;
- };
- ProjectService.prototype.watchConfigDirectoryForProject = function (project, options) {
- var _this = this;
- if (!options.configHasFilesProperty) {
- project.watchConfigDirectory(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); });
+ }
+ };
+ return SourceFileObject;
+ }(NodeObject));
+ function getServicesObjectAllocator() {
+ return {
+ getNodeConstructor: function () { return NodeObject; },
+ getTokenConstructor: function () { return TokenObject; },
+ getIdentifierConstructor: function () { return IdentifierObject; },
+ getSourceFileConstructor: function () { return SourceFileObject; },
+ getSymbolConstructor: function () { return SymbolObject; },
+ getTypeConstructor: function () { return TypeObject; },
+ getSignatureConstructor: function () { return SignatureObject; },
+ };
+ }
+ function toEditorSettings(optionsAsMap) {
+ var allPropertiesAreCamelCased = true;
+ for (var key in optionsAsMap) {
+ if (ts.hasProperty(optionsAsMap, key) && !isCamelCase(key)) {
+ allPropertiesAreCamelCased = false;
+ break;
+ }
+ }
+ if (allPropertiesAreCamelCased) {
+ return optionsAsMap;
+ }
+ var settings = {};
+ for (var key in optionsAsMap) {
+ if (ts.hasProperty(optionsAsMap, key)) {
+ var newKey = isCamelCase(key) ? key : key.charAt(0).toLowerCase() + key.substr(1);
+ settings[newKey] = optionsAsMap[key];
+ }
+ }
+ return settings;
+ }
+ ts.toEditorSettings = toEditorSettings;
+ function isCamelCase(s) {
+ return !s.length || s.charAt(0) === s.charAt(0).toLowerCase();
+ }
+ function displayPartsToString(displayParts) {
+ if (displayParts) {
+ return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join("");
+ }
+ return "";
+ }
+ ts.displayPartsToString = displayPartsToString;
+ function getDefaultCompilerOptions() {
+ return {
+ target: 1,
+ jsx: 1
+ };
+ }
+ ts.getDefaultCompilerOptions = getDefaultCompilerOptions;
+ function getSupportedCodeFixes() {
+ return ts.codefix.getSupportedErrorCodes();
+ }
+ ts.getSupportedCodeFixes = getSupportedCodeFixes;
+ var HostCache = (function () {
+ function HostCache(host, getCanonicalFileName) {
+ this.host = host;
+ this.getCanonicalFileName = getCanonicalFileName;
+ this.currentDirectory = host.getCurrentDirectory();
+ this.fileNameToEntry = ts.createFileMap();
+ var rootFileNames = host.getScriptFileNames();
+ for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) {
+ var fileName = rootFileNames_1[_i];
+ this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName));
+ }
+ this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
+ }
+ HostCache.prototype.compilationSettings = function () {
+ return this._compilationSettings;
+ };
+ HostCache.prototype.createEntry = function (fileName, path) {
+ var entry;
+ var scriptSnapshot = this.host.getScriptSnapshot(fileName);
+ if (scriptSnapshot) {
+ entry = {
+ hostFileName: fileName,
+ version: this.host.getScriptVersion(fileName),
+ scriptSnapshot: scriptSnapshot,
+ scriptKind: ts.getScriptKind(fileName, this.host)
+ };
+ }
+ this.fileNameToEntry.set(path, entry);
+ return entry;
+ };
+ HostCache.prototype.getEntry = function (path) {
+ return this.fileNameToEntry.get(path);
+ };
+ HostCache.prototype.contains = function (path) {
+ return this.fileNameToEntry.contains(path);
+ };
+ HostCache.prototype.getOrCreateEntry = function (fileName) {
+ var path = ts.toPath(fileName, this.currentDirectory, this.getCanonicalFileName);
+ return this.getOrCreateEntryByPath(fileName, path);
+ };
+ HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) {
+ return this.contains(path)
+ ? this.getEntry(path)
+ : this.createEntry(fileName, path);
+ };
+ HostCache.prototype.getRootFileNames = function () {
+ var fileNames = [];
+ this.fileNameToEntry.forEachValue(function (_path, value) {
+ if (value) {
+ fileNames.push(value.hostFileName);
}
- };
- ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typingOptions, configFileErrors) {
- var errors;
- for (var _i = 0, files_4 = files; _i < files_4.length; _i++) {
- var f = files_4[_i];
- var rootFilename = propertyReader.getFileName(f);
- var scriptKind = propertyReader.getScriptKind(f);
- var hasMixedContent = propertyReader.hasMixedContent(f);
- if (this.host.fileExists(rootFilename)) {
- var info = this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(rootFilename), clientFileName == rootFilename, undefined, scriptKind, hasMixedContent);
- project.addRoot(info);
+ });
+ return fileNames;
+ };
+ HostCache.prototype.getVersion = function (path) {
+ var file = this.getEntry(path);
+ return file && file.version;
+ };
+ HostCache.prototype.getScriptSnapshot = function (path) {
+ var file = this.getEntry(path);
+ return file && file.scriptSnapshot;
+ };
+ return HostCache;
+ }());
+ var SyntaxTreeCache = (function () {
+ function SyntaxTreeCache(host) {
+ this.host = host;
+ }
+ SyntaxTreeCache.prototype.getCurrentSourceFile = function (fileName) {
+ var scriptSnapshot = this.host.getScriptSnapshot(fileName);
+ if (!scriptSnapshot) {
+ throw new Error("Could not find file: '" + fileName + "'.");
+ }
+ var scriptKind = ts.getScriptKind(fileName, this.host);
+ var version = this.host.getScriptVersion(fileName);
+ var sourceFile;
+ if (this.currentFileName !== fileName) {
+ sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 4, version, true, scriptKind);
+ }
+ else if (this.currentFileVersion !== version) {
+ var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot);
+ sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange);
+ }
+ if (sourceFile) {
+ this.currentFileVersion = version;
+ this.currentFileName = fileName;
+ this.currentFileScriptSnapshot = scriptSnapshot;
+ this.currentSourceFile = sourceFile;
+ }
+ return this.currentSourceFile;
+ };
+ return SyntaxTreeCache;
+ }());
+ function setSourceFileFields(sourceFile, scriptSnapshot, version) {
+ sourceFile.version = version;
+ sourceFile.scriptSnapshot = scriptSnapshot;
+ }
+ function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents, scriptKind) {
+ var text = scriptSnapshot.getText(0, scriptSnapshot.getLength());
+ var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents, scriptKind);
+ setSourceFileFields(sourceFile, scriptSnapshot, version);
+ return sourceFile;
+ }
+ ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile;
+ ts.disableIncrementalParsing = false;
+ function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) {
+ if (textChangeRange) {
+ if (version !== sourceFile.version) {
+ if (!ts.disableIncrementalParsing) {
+ var newText = void 0;
+ var prefix = textChangeRange.span.start !== 0
+ ? sourceFile.text.substr(0, textChangeRange.span.start)
+ : "";
+ var suffix = ts.textSpanEnd(textChangeRange.span) !== sourceFile.text.length
+ ? sourceFile.text.substr(ts.textSpanEnd(textChangeRange.span))
+ : "";
+ if (textChangeRange.newLength === 0) {
+ newText = prefix && suffix ? prefix + suffix : prefix || suffix;
}
else {
- (errors || (errors = [])).push(createFileNotFoundDiagnostic(rootFilename));
- }
- }
- project.setProjectErrors(ts.concatenate(configFileErrors, errors));
- project.setTypingOptions(typingOptions);
- project.updateGraph();
- };
- ProjectService.prototype.openConfigFile = function (configFileName, clientFileName) {
- var conversionResult = this.convertConfigFileContentToProjectOptions(configFileName);
- var projectOptions = conversionResult.success
- ? conversionResult.projectOptions
- : { files: [], compilerOptions: {} };
- var project = this.createAndAddConfiguredProject(configFileName, projectOptions, conversionResult.configFileErrors, clientFileName);
- return {
- success: conversionResult.success,
- project: project,
- errors: project.getProjectErrors()
- };
- };
- ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypingOptions, compileOnSave, configFileErrors) {
- var oldRootScriptInfos = project.getRootScriptInfos();
- var newRootScriptInfos = [];
- var newRootScriptInfoMap = server.createNormalizedPathMap();
- var projectErrors;
- var rootFilesChanged = false;
- for (var _i = 0, newUncheckedFiles_1 = newUncheckedFiles; _i < newUncheckedFiles_1.length; _i++) {
- var f = newUncheckedFiles_1[_i];
- var newRootFile = propertyReader.getFileName(f);
- if (!this.host.fileExists(newRootFile)) {
- (projectErrors || (projectErrors = [])).push(createFileNotFoundDiagnostic(newRootFile));
- continue;
+ var changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength);
+ newText = prefix && suffix
+ ? prefix + changedText + suffix
+ : prefix
+ ? (prefix + changedText)
+ : (changedText + suffix);
}
- var normalizedPath = server.toNormalizedPath(newRootFile);
- var scriptInfo = this.getScriptInfoForNormalizedPath(normalizedPath);
- if (!scriptInfo || !project.isRoot(scriptInfo)) {
- rootFilesChanged = true;
- if (!scriptInfo) {
- var scriptKind = propertyReader.getScriptKind(f);
- var hasMixedContent = propertyReader.hasMixedContent(f);
- scriptInfo = this.getOrCreateScriptInfoForNormalizedPath(normalizedPath, false, undefined, scriptKind, hasMixedContent);
+ var newSourceFile = ts.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
+ setSourceFileFields(newSourceFile, scriptSnapshot, version);
+ newSourceFile.nameTable = undefined;
+ if (sourceFile !== newSourceFile && sourceFile.scriptSnapshot) {
+ if (sourceFile.scriptSnapshot.dispose) {
+ sourceFile.scriptSnapshot.dispose();
}
+ sourceFile.scriptSnapshot = undefined;
}
- newRootScriptInfos.push(scriptInfo);
- newRootScriptInfoMap.set(scriptInfo.fileName, scriptInfo);
+ return newSourceFile;
}
- if (rootFilesChanged || newRootScriptInfos.length !== oldRootScriptInfos.length) {
- var toAdd = void 0;
- var toRemove = void 0;
- for (var _a = 0, oldRootScriptInfos_1 = oldRootScriptInfos; _a < oldRootScriptInfos_1.length; _a++) {
- var oldFile = oldRootScriptInfos_1[_a];
- if (!newRootScriptInfoMap.contains(oldFile.fileName)) {
- (toRemove || (toRemove = [])).push(oldFile);
- }
- }
- for (var _b = 0, newRootScriptInfos_1 = newRootScriptInfos; _b < newRootScriptInfos_1.length; _b++) {
- var newFile = newRootScriptInfos_1[_b];
- if (!project.isRoot(newFile)) {
- (toAdd || (toAdd = [])).push(newFile);
- }
- }
- if (toRemove) {
- for (var _c = 0, toRemove_1 = toRemove; _c < toRemove_1.length; _c++) {
- var f = toRemove_1[_c];
- project.removeFile(f);
- }
- }
- if (toAdd) {
- for (var _d = 0, toAdd_1 = toAdd; _d < toAdd_1.length; _d++) {
- var f = toAdd_1[_d];
- if (f.isOpen && isRootFileInInferredProject(f)) {
- var inferredProject = f.containingProjects[0];
- inferredProject.removeFile(f);
- if (!inferredProject.hasRoots()) {
- this.removeProject(inferredProject);
- }
- }
- project.addRoot(f);
- }
+ }
+ }
+ return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, true, sourceFile.scriptKind);
+ }
+ ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile;
+ var CancellationTokenObject = (function () {
+ function CancellationTokenObject(cancellationToken) {
+ this.cancellationToken = cancellationToken;
+ }
+ CancellationTokenObject.prototype.isCancellationRequested = function () {
+ return this.cancellationToken && this.cancellationToken.isCancellationRequested();
+ };
+ CancellationTokenObject.prototype.throwIfCancellationRequested = function () {
+ if (this.isCancellationRequested()) {
+ throw new ts.OperationCanceledException();
+ }
+ };
+ return CancellationTokenObject;
+ }());
+ function createLanguageService(host, documentRegistry) {
+ if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); }
+ var syntaxTreeCache = new SyntaxTreeCache(host);
+ var ruleProvider;
+ var program;
+ var lastProjectVersion;
+ var lastTypesRootVersion = 0;
+ var useCaseSensitivefileNames = host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames();
+ var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken());
+ var currentDirectory = host.getCurrentDirectory();
+ if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) {
+ ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();
+ }
+ function log(message) {
+ if (host.log) {
+ host.log(message);
+ }
+ }
+ var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitivefileNames);
+ function getValidSourceFile(fileName) {
+ var sourceFile = program.getSourceFile(fileName);
+ if (!sourceFile) {
+ throw new Error("Could not find file: '" + fileName + "'.");
+ }
+ return sourceFile;
+ }
+ function getRuleProvider(options) {
+ if (!ruleProvider) {
+ ruleProvider = new ts.formatting.RulesProvider();
+ }
+ ruleProvider.ensureUpToDate(options);
+ return ruleProvider;
+ }
+ function synchronizeHostData() {
+ if (host.getProjectVersion) {
+ var hostProjectVersion = host.getProjectVersion();
+ if (hostProjectVersion) {
+ if (lastProjectVersion === hostProjectVersion) {
+ return;
}
+ lastProjectVersion = hostProjectVersion;
}
- project.setCompilerOptions(newOptions);
- project.setTypingOptions(newTypingOptions);
- if (compileOnSave !== undefined) {
- project.compileOnSaveEnabled = compileOnSave;
+ }
+ var typeRootsVersion = host.getTypeRootsVersion ? host.getTypeRootsVersion() : 0;
+ if (lastTypesRootVersion !== typeRootsVersion) {
+ log("TypeRoots version has changed; provide new program");
+ program = undefined;
+ lastTypesRootVersion = typeRootsVersion;
+ }
+ var hostCache = new HostCache(host, getCanonicalFileName);
+ if (programUpToDate()) {
+ return;
+ }
+ var oldSettings = program && program.getCompilerOptions();
+ var newSettings = hostCache.compilationSettings();
+ var shouldCreateNewSourceFiles = oldSettings &&
+ (oldSettings.target !== newSettings.target ||
+ oldSettings.module !== newSettings.module ||
+ oldSettings.moduleResolution !== newSettings.moduleResolution ||
+ oldSettings.noResolve !== newSettings.noResolve ||
+ oldSettings.jsx !== newSettings.jsx ||
+ oldSettings.allowJs !== newSettings.allowJs ||
+ oldSettings.disableSizeLimit !== oldSettings.disableSizeLimit ||
+ oldSettings.baseUrl !== newSettings.baseUrl ||
+ !ts.equalOwnProperties(oldSettings.paths, newSettings.paths));
+ var compilerHost = {
+ getSourceFile: getOrCreateSourceFile,
+ getSourceFileByPath: getOrCreateSourceFileByPath,
+ getCancellationToken: function () { return cancellationToken; },
+ getCanonicalFileName: getCanonicalFileName,
+ useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; },
+ getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); },
+ getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
+ writeFile: function () { },
+ getCurrentDirectory: function () { return currentDirectory; },
+ fileExists: function (fileName) {
+ return hostCache.getOrCreateEntry(fileName) !== undefined;
+ },
+ readFile: function (fileName) {
+ var entry = hostCache.getOrCreateEntry(fileName);
+ return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength());
+ },
+ directoryExists: function (directoryName) {
+ return ts.directoryProbablyExists(directoryName, host);
+ },
+ getDirectories: function (path) {
+ return host.getDirectories ? host.getDirectories(path) : [];
}
- project.setProjectErrors(ts.concatenate(configFileErrors, projectErrors));
- project.updateGraph();
};
- ProjectService.prototype.updateConfiguredProject = function (project) {
- if (!this.host.fileExists(project.configFileName)) {
- this.logger.info("Config file deleted");
- this.removeProject(project);
- return;
+ if (host.trace) {
+ compilerHost.trace = function (message) { return host.trace(message); };
+ }
+ if (host.resolveModuleNames) {
+ compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); };
+ }
+ if (host.resolveTypeReferenceDirectives) {
+ compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) {
+ return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile);
+ };
+ }
+ var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
+ var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program);
+ if (program) {
+ var oldSourceFiles = program.getSourceFiles();
+ var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldSettings);
+ for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) {
+ var oldSourceFile = oldSourceFiles_1[_i];
+ if (!newProgram.getSourceFile(oldSourceFile.fileName) || shouldCreateNewSourceFiles) {
+ documentRegistry.releaseDocumentWithKey(oldSourceFile.path, oldSettingsKey);
+ }
}
- var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
- if (!success) {
- this.updateNonInferredProject(project, [], fileNamePropertyReader, {}, {}, false, configFileErrors);
- return configFileErrors;
+ }
+ hostCache = undefined;
+ program = newProgram;
+ program.getTypeChecker();
+ return;
+ function getOrCreateSourceFile(fileName) {
+ return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName));
+ }
+ function getOrCreateSourceFileByPath(fileName, path) {
+ ts.Debug.assert(hostCache !== undefined);
+ var hostFileInformation = hostCache.getOrCreateEntryByPath(fileName, path);
+ if (!hostFileInformation) {
+ return undefined;
}
- if (this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader)) {
- project.setCompilerOptions(projectOptions.compilerOptions);
- if (!project.languageServiceEnabled) {
- return;
+ if (!shouldCreateNewSourceFiles) {
+ var oldSourceFile = program && program.getSourceFileByPath(path);
+ if (oldSourceFile) {
+ ts.Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind + ") for file: " + path);
+ return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind);
}
- project.disableLanguageService();
- project.stopWatchingDirectory();
}
- else {
- if (!project.languageServiceEnabled) {
- project.enableLanguageService();
- }
- this.watchConfigDirectoryForProject(project, projectOptions);
- this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typingOptions, projectOptions.compileOnSave, configFileErrors);
+ return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind);
+ }
+ function sourceFileUpToDate(sourceFile) {
+ if (!sourceFile) {
+ return false;
}
- };
- ProjectService.prototype.createInferredProjectWithRootFileIfNecessary = function (root) {
- var _this = this;
- var useExistingProject = this.useSingleInferredProject && this.inferredProjects.length;
- var project = useExistingProject
- ? this.inferredProjects[0]
- : new server.InferredProject(this, this.documentRegistry, true, this.compilerOptionsForInferredProjects, this.compileOnSaveForInferredProjects);
- project.addRoot(root);
- this.directoryWatchers.startWatchingContainingDirectoriesForFile(root.fileName, project, function (fileName) { return _this.onConfigFileAddedForInferredProject(fileName); });
- project.updateGraph();
- if (!useExistingProject) {
- this.inferredProjects.push(project);
+ var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName);
+ return sourceFile.version === hostCache.getVersion(path);
+ }
+ function programUpToDate() {
+ if (!program) {
+ return false;
}
- return project;
- };
- ProjectService.prototype.getOrCreateScriptInfo = function (uncheckedFileName, openedByClient, fileContent, scriptKind) {
- return this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName), openedByClient, fileContent, scriptKind);
- };
- ProjectService.prototype.getScriptInfo = function (uncheckedFileName) {
- return this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName));
- };
- ProjectService.prototype.getOrCreateScriptInfoForNormalizedPath = function (fileName, openedByClient, fileContent, scriptKind, hasMixedContent) {
- var _this = this;
- var info = this.getScriptInfoForNormalizedPath(fileName);
- if (!info) {
- var content = void 0;
- if (this.host.fileExists(fileName)) {
- content = fileContent || (hasMixedContent ? "" : this.host.readFile(fileName));
- }
- if (!content) {
- if (openedByClient) {
- content = "";
- }
- }
- if (content !== undefined) {
- info = new server.ScriptInfo(this.host, fileName, content, scriptKind, openedByClient, hasMixedContent);
- this.filenameToScriptInfo.set(info.path, info);
- if (!info.isOpen && !hasMixedContent) {
- info.setWatcher(this.host.watchFile(fileName, function (_) { return _this.onSourceFileChanged(fileName); }));
- }
- }
+ var rootFileNames = hostCache.getRootFileNames();
+ if (program.getSourceFiles().length !== rootFileNames.length) {
+ return false;
}
- if (info) {
- if (fileContent !== undefined) {
- info.reload(fileContent);
- }
- if (openedByClient) {
- info.isOpen = true;
- }
- }
- return info;
- };
- ProjectService.prototype.getScriptInfoForNormalizedPath = function (fileName) {
- return this.getScriptInfoForPath(server.normalizedPathToPath(fileName, this.host.getCurrentDirectory(), this.toCanonicalFileName));
- };
- ProjectService.prototype.getScriptInfoForPath = function (fileName) {
- return this.filenameToScriptInfo.get(fileName);
- };
- ProjectService.prototype.setHostConfiguration = function (args) {
- if (args.file) {
- var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(args.file));
- if (info) {
- info.setFormatOptions(args.formatOptions);
- this.logger.info("Host configuration update for file " + args.file);
- }
- }
- else {
- if (args.hostInfo !== undefined) {
- this.hostConfiguration.hostInfo = args.hostInfo;
- this.logger.info("Host information " + args.hostInfo);
- }
- if (args.formatOptions) {
- server.mergeMaps(this.hostConfiguration.formatCodeOptions, args.formatOptions);
- this.logger.info("Format host information updated");
- }
- }
- };
- ProjectService.prototype.closeLog = function () {
- this.logger.close();
- };
- ProjectService.prototype.reloadProjects = function () {
- this.logger.info("reload projects.");
- for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {
- var info = _a[_i];
- this.openOrUpdateConfiguredProjectForFile(info.fileName);
- }
- this.refreshInferredProjects();
- };
- ProjectService.prototype.refreshInferredProjects = function () {
- this.logger.info("updating project structure from ...");
- this.printProjects();
- var orphantedFiles = [];
- for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {
- var info = _a[_i];
- if (info.containingProjects.length === 0) {
- orphantedFiles.push(info);
- }
- else {
- if (isRootFileInInferredProject(info) && info.containingProjects.length > 1) {
- var inferredProject = info.containingProjects[0];
- ts.Debug.assert(inferredProject.projectKind === server.ProjectKind.Inferred);
- inferredProject.removeFile(info);
- if (!inferredProject.hasRoots()) {
- this.removeProject(inferredProject);
- }
- }
- }
- }
- for (var _b = 0, orphantedFiles_1 = orphantedFiles; _b < orphantedFiles_1.length; _b++) {
- var f = orphantedFiles_1[_b];
- this.assignScriptInfoToInferredProjectIfNecessary(f, false);
- }
- for (var _c = 0, _d = this.inferredProjects; _c < _d.length; _c++) {
- var p = _d[_c];
- p.updateGraph();
- }
- this.printProjects();
- };
- ProjectService.prototype.openClientFile = function (fileName, fileContent, scriptKind) {
- return this.openClientFileWithNormalizedPath(server.toNormalizedPath(fileName), fileContent, scriptKind);
- };
- ProjectService.prototype.openClientFileWithNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent) {
- var _a = this.findContainingExternalProject(fileName)
- ? {}
- : this.openOrUpdateConfiguredProjectForFile(fileName), _b = _a.configFileName, configFileName = _b === void 0 ? undefined : _b, _c = _a.configFileErrors, configFileErrors = _c === void 0 ? undefined : _c;
- var info = this.getOrCreateScriptInfoForNormalizedPath(fileName, true, fileContent, scriptKind, hasMixedContent);
- this.assignScriptInfoToInferredProjectIfNecessary(info, true);
- this.printProjects();
- return { configFileName: configFileName, configFileErrors: configFileErrors };
- };
- ProjectService.prototype.closeClientFile = function (uncheckedFileName) {
- var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName));
- if (info) {
- this.closeOpenFile(info);
- info.isOpen = false;
- }
- this.printProjects();
- };
- ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) {
- var _loop_3 = function (proj) {
- var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; });
- result.push(proj.getChangesSinceVersion(knownProject && knownProject.version));
- };
- for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) {
- var proj = currentProjects_1[_i];
- _loop_3(proj);
- }
- };
- ProjectService.prototype.synchronizeProjectList = function (knownProjects) {
- var files = [];
- this.collectChanges(knownProjects, this.externalProjects, files);
- this.collectChanges(knownProjects, this.configuredProjects, files);
- this.collectChanges(knownProjects, this.inferredProjects, files);
- return files;
- };
- ProjectService.prototype.applyChangesInOpenFiles = function (openFiles, changedFiles, closedFiles) {
- var recordChangedFiles = changedFiles && !openFiles && !closedFiles;
- if (openFiles) {
- for (var _i = 0, openFiles_1 = openFiles; _i < openFiles_1.length; _i++) {
- var file = openFiles_1[_i];
- var scriptInfo = this.getScriptInfo(file.fileName);
- ts.Debug.assert(!scriptInfo || !scriptInfo.isOpen);
- var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName);
- this.openClientFileWithNormalizedPath(normalizedPath, file.content, file.scriptKind, file.hasMixedContent);
+ for (var _i = 0, rootFileNames_2 = rootFileNames; _i < rootFileNames_2.length; _i++) {
+ var fileName = rootFileNames_2[_i];
+ if (!sourceFileUpToDate(program.getSourceFile(fileName))) {
+ return false;
}
}
- if (changedFiles) {
- for (var _a = 0, changedFiles_1 = changedFiles; _a < changedFiles_1.length; _a++) {
- var file = changedFiles_1[_a];
- var scriptInfo = this.getScriptInfo(file.fileName);
- ts.Debug.assert(!!scriptInfo);
- for (var i = file.changes.length - 1; i >= 0; i--) {
- var change = file.changes[i];
- scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
- }
- if (recordChangedFiles) {
- if (!this.changedFiles) {
- this.changedFiles = [scriptInfo];
- }
- else if (this.changedFiles.indexOf(scriptInfo) < 0) {
- this.changedFiles.push(scriptInfo);
- }
+ return ts.compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings());
+ }
+ }
+ function getProgram() {
+ synchronizeHostData();
+ return program;
+ }
+ function cleanupSemanticCache() {
+ }
+ function dispose() {
+ if (program) {
+ ts.forEach(program.getSourceFiles(), function (f) {
+ return documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions());
+ });
+ }
+ }
+ function getSyntacticDiagnostics(fileName) {
+ synchronizeHostData();
+ return program.getSyntacticDiagnostics(getValidSourceFile(fileName), cancellationToken);
+ }
+ function getSemanticDiagnostics(fileName) {
+ synchronizeHostData();
+ var targetSourceFile = getValidSourceFile(fileName);
+ var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken);
+ if (!program.getCompilerOptions().declaration) {
+ return semanticDiagnostics;
+ }
+ var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken);
+ return ts.concatenate(semanticDiagnostics, declarationDiagnostics);
+ }
+ function getCompilerOptionsDiagnostics() {
+ synchronizeHostData();
+ return program.getOptionsDiagnostics(cancellationToken).concat(program.getGlobalDiagnostics(cancellationToken));
+ }
+ function getCompletionsAtPosition(fileName, position) {
+ synchronizeHostData();
+ return ts.Completions.getCompletionsAtPosition(host, program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position);
+ }
+ function getCompletionEntryDetails(fileName, position, entryName) {
+ synchronizeHostData();
+ return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, entryName);
+ }
+ function getCompletionEntrySymbol(fileName, position, entryName) {
+ synchronizeHostData();
+ return ts.Completions.getCompletionEntrySymbol(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, entryName);
+ }
+ function getQuickInfoAtPosition(fileName, position) {
+ synchronizeHostData();
+ var sourceFile = getValidSourceFile(fileName);
+ var node = ts.getTouchingPropertyName(sourceFile, position);
+ if (node === sourceFile) {
+ return undefined;
+ }
+ if (ts.isLabelName(node)) {
+ return undefined;
+ }
+ var typeChecker = program.getTypeChecker();
+ var symbol = typeChecker.getSymbolAtLocation(node);
+ if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
+ switch (node.kind) {
+ case 70:
+ case 173:
+ case 140:
+ case 98:
+ case 166:
+ case 96:
+ var type = typeChecker.getTypeAtLocation(node);
+ if (type) {
+ return {
+ kind: ts.ScriptElementKind.unknown,
+ kindModifiers: ts.ScriptElementKindModifier.none,
+ textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),
+ displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)),
+ documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined
+ };
}
- }
- }
- if (closedFiles) {
- for (var _b = 0, closedFiles_1 = closedFiles; _b < closedFiles_1.length; _b++) {
- var file = closedFiles_1[_b];
- this.closeClientFile(file);
- }
- }
- if (openFiles || closedFiles) {
- this.refreshInferredProjects();
- }
- };
- ProjectService.prototype.closeConfiguredProject = function (configFile) {
- var configuredProject = this.findConfiguredProjectByProjectName(configFile);
- if (configuredProject && configuredProject.deleteOpenRef() === 0) {
- this.removeProject(configuredProject);
}
+ return undefined;
+ }
+ var displayPartsDocumentationsAndKind = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node);
+ return {
+ kind: displayPartsDocumentationsAndKind.symbolKind,
+ kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
+ textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),
+ displayParts: displayPartsDocumentationsAndKind.displayParts,
+ documentation: displayPartsDocumentationsAndKind.documentation
};
- ProjectService.prototype.closeExternalProject = function (uncheckedFileName, suppressRefresh) {
- if (suppressRefresh === void 0) { suppressRefresh = false; }
- var fileName = server.toNormalizedPath(uncheckedFileName);
- var configFiles = this.externalProjectToConfiguredProjectMap[fileName];
- if (configFiles) {
- var shouldRefreshInferredProjects = false;
- for (var _i = 0, configFiles_1 = configFiles; _i < configFiles_1.length; _i++) {
- var configFile = configFiles_1[_i];
- if (this.closeConfiguredProject(configFile)) {
- shouldRefreshInferredProjects = true;
- }
- }
- delete this.externalProjectToConfiguredProjectMap[fileName];
- if (shouldRefreshInferredProjects && !suppressRefresh) {
- this.refreshInferredProjects();
- }
+ }
+ function getDefinitionAtPosition(fileName, position) {
+ synchronizeHostData();
+ return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
+ }
+ function getImplementationAtPosition(fileName, position) {
+ synchronizeHostData();
+ return ts.GoToImplementation.getImplementationAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), ts.getTouchingPropertyName(getValidSourceFile(fileName), position));
+ }
+ function getTypeDefinitionAtPosition(fileName, position) {
+ synchronizeHostData();
+ return ts.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position);
+ }
+ function getOccurrencesAtPosition(fileName, position) {
+ var results = getOccurrencesAtPositionCore(fileName, position);
+ if (results) {
+ var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName));
+ results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; });
+ }
+ return results;
+ }
+ function getDocumentHighlights(fileName, position, filesToSearch) {
+ synchronizeHostData();
+ var sourceFilesToSearch = ts.map(filesToSearch, function (f) { return program.getSourceFile(f); });
+ var sourceFile = getValidSourceFile(fileName);
+ return ts.DocumentHighlights.getDocumentHighlights(program.getTypeChecker(), cancellationToken, sourceFile, position, sourceFilesToSearch);
+ }
+ function getOccurrencesAtPositionCore(fileName, position) {
+ synchronizeHostData();
+ return convertDocumentHighlights(getDocumentHighlights(fileName, position, [fileName]));
+ function convertDocumentHighlights(documentHighlights) {
+ if (!documentHighlights) {
+ return undefined;
}
- else {
- var externalProject = this.findExternalProjectByProjectName(uncheckedFileName);
- if (externalProject) {
- this.removeProject(externalProject);
- if (!suppressRefresh) {
- this.refreshInferredProjects();
- }
+ var result = [];
+ for (var _i = 0, documentHighlights_1 = documentHighlights; _i < documentHighlights_1.length; _i++) {
+ var entry = documentHighlights_1[_i];
+ for (var _a = 0, _b = entry.highlightSpans; _a < _b.length; _a++) {
+ var highlightSpan = _b[_a];
+ result.push({
+ fileName: entry.fileName,
+ textSpan: highlightSpan.textSpan,
+ isWriteAccess: highlightSpan.kind === ts.HighlightSpanKind.writtenReference,
+ isDefinition: false
+ });
}
}
+ return result;
+ }
+ }
+ function findRenameLocations(fileName, position, findInStrings, findInComments) {
+ var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments);
+ return ts.FindAllReferences.convertReferences(referencedSymbols);
+ }
+ function getReferencesAtPosition(fileName, position) {
+ var referencedSymbols = findReferencedSymbols(fileName, position, false, false);
+ return ts.FindAllReferences.convertReferences(referencedSymbols);
+ }
+ function findReferences(fileName, position) {
+ var referencedSymbols = findReferencedSymbols(fileName, position, false, false);
+ return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; });
+ }
+ function findReferencedSymbols(fileName, position, findInStrings, findInComments) {
+ synchronizeHostData();
+ return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments);
+ }
+ function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) {
+ synchronizeHostData();
+ var sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles();
+ return ts.NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles);
+ }
+ function getEmitOutput(fileName, emitOnlyDtsFiles) {
+ synchronizeHostData();
+ var sourceFile = getValidSourceFile(fileName);
+ var outputFiles = [];
+ function writeFile(fileName, data, writeByteOrderMark) {
+ outputFiles.push({
+ name: fileName,
+ writeByteOrderMark: writeByteOrderMark,
+ text: data
+ });
+ }
+ var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles);
+ return {
+ outputFiles: outputFiles,
+ emitSkipped: emitOutput.emitSkipped
};
- ProjectService.prototype.openExternalProject = function (proj) {
- var tsConfigFiles;
- var rootFiles = [];
- for (var _i = 0, _a = proj.rootFiles; _i < _a.length; _i++) {
- var file = _a[_i];
- var normalized = server.toNormalizedPath(file.fileName);
- if (ts.getBaseFileName(normalized) === "tsconfig.json") {
- (tsConfigFiles || (tsConfigFiles = [])).push(normalized);
- }
- else {
- rootFiles.push(file);
- }
- }
- if (tsConfigFiles) {
- tsConfigFiles.sort();
- }
- var externalProject = this.findExternalProjectByProjectName(proj.projectFileName);
- var exisingConfigFiles;
- if (externalProject) {
- if (!tsConfigFiles) {
- this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, proj.options, proj.typingOptions, proj.options.compileOnSave, undefined);
- return;
- }
- this.closeExternalProject(proj.projectFileName, true);
+ }
+ function getSignatureHelpItems(fileName, position) {
+ synchronizeHostData();
+ var sourceFile = getValidSourceFile(fileName);
+ return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken);
+ }
+ function getNonBoundSourceFile(fileName) {
+ return syntaxTreeCache.getCurrentSourceFile(fileName);
+ }
+ function getSourceFile(fileName) {
+ return getNonBoundSourceFile(fileName);
+ }
+ function getNameOrDottedNameSpan(fileName, startPos, _endPos) {
+ var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
+ var node = ts.getTouchingPropertyName(sourceFile, startPos);
+ if (node === sourceFile) {
+ return;
+ }
+ switch (node.kind) {
+ case 173:
+ case 140:
+ case 9:
+ case 85:
+ case 100:
+ case 94:
+ case 96:
+ case 98:
+ case 166:
+ case 70:
+ break;
+ default:
+ return;
+ }
+ var nodeForStartPos = node;
+ while (true) {
+ if (ts.isRightSideOfPropertyAccess(nodeForStartPos) || ts.isRightSideOfQualifiedName(nodeForStartPos)) {
+ nodeForStartPos = nodeForStartPos.parent;
}
- else if (this.externalProjectToConfiguredProjectMap[proj.projectFileName]) {
- if (!tsConfigFiles) {
- this.closeExternalProject(proj.projectFileName, true);
+ else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) {
+ if (nodeForStartPos.parent.parent.kind === 226 &&
+ nodeForStartPos.parent.parent.body === nodeForStartPos.parent) {
+ nodeForStartPos = nodeForStartPos.parent.parent.name;
}
else {
- var oldConfigFiles = this.externalProjectToConfiguredProjectMap[proj.projectFileName];
- var iNew = 0;
- var iOld = 0;
- while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) {
- var newConfig = tsConfigFiles[iNew];
- var oldConfig = oldConfigFiles[iOld];
- if (oldConfig < newConfig) {
- this.closeConfiguredProject(oldConfig);
- iOld++;
- }
- else if (oldConfig > newConfig) {
- iNew++;
- }
- else {
- (exisingConfigFiles || (exisingConfigFiles = [])).push(oldConfig);
- iOld++;
- iNew++;
- }
- }
- for (var i = iOld; i < oldConfigFiles.length; i++) {
- this.closeConfiguredProject(oldConfigFiles[i]);
- }
- }
- }
- if (tsConfigFiles) {
- this.externalProjectToConfiguredProjectMap[proj.projectFileName] = tsConfigFiles;
- for (var _b = 0, tsConfigFiles_1 = tsConfigFiles; _b < tsConfigFiles_1.length; _b++) {
- var tsconfigFile = tsConfigFiles_1[_b];
- var project = this.findConfiguredProjectByProjectName(tsconfigFile);
- if (!project) {
- var result = this.openConfigFile(tsconfigFile);
- project = result.success && result.project;
- }
- if (project && !ts.contains(exisingConfigFiles, tsconfigFile)) {
- project.addOpenRef();
- }
+ break;
}
}
else {
- delete this.externalProjectToConfiguredProjectMap[proj.projectFileName];
- this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typingOptions);
+ break;
}
- this.refreshInferredProjects();
- };
- return ProjectService;
- }());
- server.ProjectService = ProjectService;
- })(server = ts.server || (ts.server = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var server;
- (function (server) {
- function hrTimeToMilliseconds(time) {
- var seconds = time[0];
- var nanoseconds = time[1];
- return ((1e9 * seconds) + nanoseconds) / 1000000.0;
- }
- function shouldSkipSematicCheck(project) {
- if (project.getCompilerOptions().skipLibCheck !== undefined) {
- return false;
- }
- if ((project.projectKind === server.ProjectKind.Inferred || project.projectKind === server.ProjectKind.External) && project.isJsOnlyProject()) {
- return true;
}
- return false;
+ return ts.createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd());
}
- function compareNumber(a, b) {
- return a - b;
+ function getBreakpointStatementAtPosition(fileName, position) {
+ var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
+ return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position);
}
- function compareFileStart(a, b) {
- if (a.file < b.file) {
- return -1;
- }
- else if (a.file == b.file) {
- var n = compareNumber(a.start.line, b.start.line);
- if (n === 0) {
- return compareNumber(a.start.offset, b.start.offset);
- }
- else
- return n;
- }
- else {
- return 1;
- }
+ function getNavigationBarItems(fileName) {
+ return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName));
}
- function formatDiag(fileName, project, diag) {
- var scriptInfo = project.getScriptInfoForNormalizedPath(fileName);
- return {
- start: scriptInfo.positionToLineOffset(diag.start),
- end: scriptInfo.positionToLineOffset(diag.start + diag.length),
- text: ts.flattenDiagnosticMessageText(diag.messageText, "\n"),
- code: diag.code
- };
+ function getNavigationTree(fileName) {
+ return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName));
}
- function formatConfigFileDiag(diag) {
- return {
- start: undefined,
- end: undefined,
- text: ts.flattenDiagnosticMessageText(diag.messageText, "\n")
- };
+ function isTsOrTsxFile(fileName) {
+ var kind = ts.getScriptKind(fileName, host);
+ return kind === 3 || kind === 4;
}
- function allEditsBeforePos(edits, pos) {
- for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) {
- var edit = edits_1[_i];
- if (ts.textSpanEnd(edit.span) >= pos) {
- return false;
- }
- }
- return true;
+ function getSemanticClassifications(fileName, span) {
+ if (!isTsOrTsxFile(fileName)) {
+ return [];
+ }
+ synchronizeHostData();
+ return ts.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
}
- var CommandNames;
- (function (CommandNames) {
- CommandNames.Brace = "brace";
- CommandNames.BraceFull = "brace-full";
- CommandNames.BraceCompletion = "braceCompletion";
- CommandNames.Change = "change";
- CommandNames.Close = "close";
- CommandNames.Completions = "completions";
- CommandNames.CompletionsFull = "completions-full";
- CommandNames.CompletionDetails = "completionEntryDetails";
- CommandNames.CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
- CommandNames.CompileOnSaveEmitFile = "compileOnSaveEmitFile";
- CommandNames.Configure = "configure";
- CommandNames.Definition = "definition";
- CommandNames.DefinitionFull = "definition-full";
- CommandNames.Exit = "exit";
- CommandNames.Format = "format";
- CommandNames.Formatonkey = "formatonkey";
- CommandNames.FormatFull = "format-full";
- CommandNames.FormatonkeyFull = "formatonkey-full";
- CommandNames.FormatRangeFull = "formatRange-full";
- CommandNames.Geterr = "geterr";
- CommandNames.GeterrForProject = "geterrForProject";
- CommandNames.Implementation = "implementation";
- CommandNames.ImplementationFull = "implementation-full";
- CommandNames.SemanticDiagnosticsSync = "semanticDiagnosticsSync";
- CommandNames.SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
- CommandNames.NavBar = "navbar";
- CommandNames.NavBarFull = "navbar-full";
- CommandNames.NavTree = "navtree";
- CommandNames.NavTreeFull = "navtree-full";
- CommandNames.Navto = "navto";
- CommandNames.NavtoFull = "navto-full";
- CommandNames.Occurrences = "occurrences";
- CommandNames.DocumentHighlights = "documentHighlights";
- CommandNames.DocumentHighlightsFull = "documentHighlights-full";
- CommandNames.Open = "open";
- CommandNames.Quickinfo = "quickinfo";
- CommandNames.QuickinfoFull = "quickinfo-full";
- CommandNames.References = "references";
- CommandNames.ReferencesFull = "references-full";
- CommandNames.Reload = "reload";
- CommandNames.Rename = "rename";
- CommandNames.RenameInfoFull = "rename-full";
- CommandNames.RenameLocationsFull = "renameLocations-full";
- CommandNames.Saveto = "saveto";
- CommandNames.SignatureHelp = "signatureHelp";
- CommandNames.SignatureHelpFull = "signatureHelp-full";
- CommandNames.TypeDefinition = "typeDefinition";
- CommandNames.ProjectInfo = "projectInfo";
- CommandNames.ReloadProjects = "reloadProjects";
- CommandNames.Unknown = "unknown";
- CommandNames.OpenExternalProject = "openExternalProject";
- CommandNames.OpenExternalProjects = "openExternalProjects";
- CommandNames.CloseExternalProject = "closeExternalProject";
- CommandNames.SynchronizeProjectList = "synchronizeProjectList";
- CommandNames.ApplyChangedToOpenFiles = "applyChangedToOpenFiles";
- CommandNames.EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full";
- CommandNames.Cleanup = "cleanup";
- CommandNames.OutliningSpans = "outliningSpans";
- CommandNames.TodoComments = "todoComments";
- CommandNames.Indentation = "indentation";
- CommandNames.DocCommentTemplate = "docCommentTemplate";
- CommandNames.CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full";
- CommandNames.NameOrDottedNameSpan = "nameOrDottedNameSpan";
- CommandNames.BreakpointStatement = "breakpointStatement";
- CommandNames.CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
- CommandNames.GetCodeFixes = "getCodeFixes";
- CommandNames.GetCodeFixesFull = "getCodeFixes-full";
- CommandNames.GetSupportedCodeFixes = "getSupportedCodeFixes";
- })(CommandNames = server.CommandNames || (server.CommandNames = {}));
- function formatMessage(msg, logger, byteLength, newLine) {
- var verboseLogging = logger.hasLevel(server.LogLevel.verbose);
- var json = JSON.stringify(msg);
- if (verboseLogging) {
- logger.info(msg.type + ": " + json);
+ function getEncodedSemanticClassifications(fileName, span) {
+ if (!isTsOrTsxFile(fileName)) {
+ return { spans: [], endOfLineState: 0 };
}
- var len = byteLength(json, "utf8");
- return "Content-Length: " + (1 + len) + "\r\n\r\n" + json + newLine;
+ synchronizeHostData();
+ return ts.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
}
- server.formatMessage = formatMessage;
- var Session = (function () {
- function Session(host, cancellationToken, useSingleInferredProject, typingsInstaller, byteLength, hrtime, logger, canUseEvents, eventHandler) {
- var _this = this;
- this.host = host;
- this.typingsInstaller = typingsInstaller;
- this.byteLength = byteLength;
- this.hrtime = hrtime;
- this.logger = logger;
- this.canUseEvents = canUseEvents;
- this.changeSeq = 0;
- this.handlers = ts.createMap((_a = {},
- _a[CommandNames.OpenExternalProject] = function (request) {
- _this.projectService.openExternalProject(request.arguments);
- return _this.requiredResponse(true);
- },
- _a[CommandNames.OpenExternalProjects] = function (request) {
- for (var _i = 0, _a = request.arguments.projects; _i < _a.length; _i++) {
- var proj = _a[_i];
- _this.projectService.openExternalProject(proj);
- }
- return _this.requiredResponse(true);
- },
- _a[CommandNames.CloseExternalProject] = function (request) {
- _this.projectService.closeExternalProject(request.arguments.projectFileName);
- return _this.requiredResponse(true);
- },
- _a[CommandNames.SynchronizeProjectList] = function (request) {
- var result = _this.projectService.synchronizeProjectList(request.arguments.knownProjects);
- if (!result.some(function (p) { return p.projectErrors && p.projectErrors.length !== 0; })) {
- return _this.requiredResponse(result);
- }
- var converted = ts.map(result, function (p) {
- if (!p.projectErrors || p.projectErrors.length === 0) {
- return p;
+ function getSyntacticClassifications(fileName, span) {
+ return ts.getSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);
+ }
+ function getEncodedSyntacticClassifications(fileName, span) {
+ return ts.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);
+ }
+ function getOutliningSpans(fileName) {
+ var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
+ return ts.OutliningElementsCollector.collectElements(sourceFile);
+ }
+ function getBraceMatchingAtPosition(fileName, position) {
+ var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
+ var result = [];
+ var token = ts.getTouchingToken(sourceFile, position);
+ if (token.getStart(sourceFile) === position) {
+ var matchKind = getMatchingTokenKind(token);
+ if (matchKind) {
+ var parentElement = token.parent;
+ var childNodes = parentElement.getChildren(sourceFile);
+ for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) {
+ var current = childNodes_1[_i];
+ if (current.kind === matchKind) {
+ var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile));
+ var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile));
+ if (range1.start < range2.start) {
+ result.push(range1, range2);
}
- return {
- info: p.info,
- changes: p.changes,
- files: p.files,
- projectErrors: _this.convertToDiagnosticsWithLinePosition(p.projectErrors, undefined)
- };
- });
- return _this.requiredResponse(converted);
- },
- _a[CommandNames.ApplyChangedToOpenFiles] = function (request) {
- _this.projectService.applyChangesInOpenFiles(request.arguments.openFiles, request.arguments.changedFiles, request.arguments.closedFiles);
- _this.changeSeq++;
- return _this.requiredResponse(true);
- },
- _a[CommandNames.Exit] = function () {
- _this.exit();
- return _this.notRequired();
- },
- _a[CommandNames.Definition] = function (request) {
- return _this.requiredResponse(_this.getDefinition(request.arguments, true));
- },
- _a[CommandNames.DefinitionFull] = function (request) {
- return _this.requiredResponse(_this.getDefinition(request.arguments, false));
- },
- _a[CommandNames.TypeDefinition] = function (request) {
- return _this.requiredResponse(_this.getTypeDefinition(request.arguments));
- },
- _a[CommandNames.Implementation] = function (request) {
- return _this.requiredResponse(_this.getImplementation(request.arguments, true));
- },
- _a[CommandNames.ImplementationFull] = function (request) {
- return _this.requiredResponse(_this.getImplementation(request.arguments, false));
- },
- _a[CommandNames.References] = function (request) {
- return _this.requiredResponse(_this.getReferences(request.arguments, true));
- },
- _a[CommandNames.ReferencesFull] = function (request) {
- return _this.requiredResponse(_this.getReferences(request.arguments, false));
- },
- _a[CommandNames.Rename] = function (request) {
- return _this.requiredResponse(_this.getRenameLocations(request.arguments, true));
- },
- _a[CommandNames.RenameLocationsFull] = function (request) {
- return _this.requiredResponse(_this.getRenameLocations(request.arguments, false));
- },
- _a[CommandNames.RenameInfoFull] = function (request) {
- return _this.requiredResponse(_this.getRenameInfo(request.arguments));
- },
- _a[CommandNames.Open] = function (request) {
- var openArgs = request.arguments;
- var scriptKind;
- switch (openArgs.scriptKindName) {
- case "TS":
- scriptKind = 3;
- break;
- case "JS":
- scriptKind = 1;
- break;
- case "TSX":
- scriptKind = 4;
- break;
- case "JSX":
- scriptKind = 2;
- break;
+ else {
+ result.push(range2, range1);
+ }
+ break;
}
- _this.openClientFile(server.toNormalizedPath(openArgs.file), openArgs.fileContent, scriptKind);
- return _this.notRequired();
- },
- _a[CommandNames.Quickinfo] = function (request) {
- return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, true));
- },
- _a[CommandNames.QuickinfoFull] = function (request) {
- return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, false));
- },
- _a[CommandNames.OutliningSpans] = function (request) {
- return _this.requiredResponse(_this.getOutliningSpans(request.arguments));
- },
- _a[CommandNames.TodoComments] = function (request) {
- return _this.requiredResponse(_this.getTodoComments(request.arguments));
- },
- _a[CommandNames.Indentation] = function (request) {
- return _this.requiredResponse(_this.getIndentation(request.arguments));
- },
- _a[CommandNames.NameOrDottedNameSpan] = function (request) {
- return _this.requiredResponse(_this.getNameOrDottedNameSpan(request.arguments));
- },
- _a[CommandNames.BreakpointStatement] = function (request) {
- return _this.requiredResponse(_this.getBreakpointStatement(request.arguments));
- },
- _a[CommandNames.BraceCompletion] = function (request) {
- return _this.requiredResponse(_this.isValidBraceCompletion(request.arguments));
- },
- _a[CommandNames.DocCommentTemplate] = function (request) {
- return _this.requiredResponse(_this.getDocCommentTemplate(request.arguments));
- },
- _a[CommandNames.Format] = function (request) {
- return _this.requiredResponse(_this.getFormattingEditsForRange(request.arguments));
- },
- _a[CommandNames.Formatonkey] = function (request) {
- return _this.requiredResponse(_this.getFormattingEditsAfterKeystroke(request.arguments));
- },
- _a[CommandNames.FormatFull] = function (request) {
- return _this.requiredResponse(_this.getFormattingEditsForDocumentFull(request.arguments));
- },
- _a[CommandNames.FormatonkeyFull] = function (request) {
- return _this.requiredResponse(_this.getFormattingEditsAfterKeystrokeFull(request.arguments));
- },
- _a[CommandNames.FormatRangeFull] = function (request) {
- return _this.requiredResponse(_this.getFormattingEditsForRangeFull(request.arguments));
- },
- _a[CommandNames.Completions] = function (request) {
- return _this.requiredResponse(_this.getCompletions(request.arguments, true));
- },
- _a[CommandNames.CompletionsFull] = function (request) {
- return _this.requiredResponse(_this.getCompletions(request.arguments, false));
- },
- _a[CommandNames.CompletionDetails] = function (request) {
- return _this.requiredResponse(_this.getCompletionEntryDetails(request.arguments));
- },
- _a[CommandNames.CompileOnSaveAffectedFileList] = function (request) {
- return _this.requiredResponse(_this.getCompileOnSaveAffectedFileList(request.arguments));
- },
- _a[CommandNames.CompileOnSaveEmitFile] = function (request) {
- return _this.requiredResponse(_this.emitFile(request.arguments));
- },
- _a[CommandNames.SignatureHelp] = function (request) {
- return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, true));
- },
- _a[CommandNames.SignatureHelpFull] = function (request) {
- return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, false));
- },
- _a[CommandNames.CompilerOptionsDiagnosticsFull] = function (request) {
- return _this.requiredResponse(_this.getCompilerOptionsDiagnostics(request.arguments));
- },
- _a[CommandNames.EncodedSemanticClassificationsFull] = function (request) {
- return _this.requiredResponse(_this.getEncodedSemanticClassifications(request.arguments));
- },
- _a[CommandNames.Cleanup] = function (request) {
- _this.cleanup();
- return _this.requiredResponse(true);
- },
- _a[CommandNames.SemanticDiagnosticsSync] = function (request) {
- return _this.requiredResponse(_this.getSemanticDiagnosticsSync(request.arguments));
- },
- _a[CommandNames.SyntacticDiagnosticsSync] = function (request) {
- return _this.requiredResponse(_this.getSyntacticDiagnosticsSync(request.arguments));
- },
- _a[CommandNames.Geterr] = function (request) {
- var geterrArgs = request.arguments;
- return { response: _this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false };
- },
- _a[CommandNames.GeterrForProject] = function (request) {
- var _a = request.arguments, file = _a.file, delay = _a.delay;
- return { response: _this.getDiagnosticsForProject(delay, file), responseRequired: false };
- },
- _a[CommandNames.Change] = function (request) {
- _this.change(request.arguments);
- return _this.notRequired();
- },
- _a[CommandNames.Configure] = function (request) {
- _this.projectService.setHostConfiguration(request.arguments);
- _this.output(undefined, CommandNames.Configure, request.seq);
- return _this.notRequired();
- },
- _a[CommandNames.Reload] = function (request) {
- _this.reload(request.arguments, request.seq);
- return _this.requiredResponse({ reloadFinished: true });
- },
- _a[CommandNames.Saveto] = function (request) {
- var savetoArgs = request.arguments;
- _this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile);
- return _this.notRequired();
- },
- _a[CommandNames.Close] = function (request) {
- var closeArgs = request.arguments;
- _this.closeClientFile(closeArgs.file);
- return _this.notRequired();
- },
- _a[CommandNames.Navto] = function (request) {
- return _this.requiredResponse(_this.getNavigateToItems(request.arguments, true));
- },
- _a[CommandNames.NavtoFull] = function (request) {
- return _this.requiredResponse(_this.getNavigateToItems(request.arguments, false));
- },
- _a[CommandNames.Brace] = function (request) {
- return _this.requiredResponse(_this.getBraceMatching(request.arguments, true));
- },
- _a[CommandNames.BraceFull] = function (request) {
- return _this.requiredResponse(_this.getBraceMatching(request.arguments, false));
- },
- _a[CommandNames.NavBar] = function (request) {
- return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, true));
- },
- _a[CommandNames.NavBarFull] = function (request) {
- return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, false));
- },
- _a[CommandNames.NavTree] = function (request) {
- return _this.requiredResponse(_this.getNavigationTree(request.arguments, true));
- },
- _a[CommandNames.NavTreeFull] = function (request) {
- return _this.requiredResponse(_this.getNavigationTree(request.arguments, false));
- },
- _a[CommandNames.Occurrences] = function (request) {
- return _this.requiredResponse(_this.getOccurrences(request.arguments));
- },
- _a[CommandNames.DocumentHighlights] = function (request) {
- return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, true));
- },
- _a[CommandNames.DocumentHighlightsFull] = function (request) {
- return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, false));
- },
- _a[CommandNames.CompilerOptionsForInferredProjects] = function (request) {
- return _this.requiredResponse(_this.setCompilerOptionsForInferredProjects(request.arguments));
- },
- _a[CommandNames.ProjectInfo] = function (request) {
- return _this.requiredResponse(_this.getProjectInfo(request.arguments));
- },
- _a[CommandNames.ReloadProjects] = function (request) {
- _this.projectService.reloadProjects();
- return _this.notRequired();
- },
- _a[CommandNames.GetCodeFixes] = function (request) {
- return _this.requiredResponse(_this.getCodeFixes(request.arguments, true));
- },
- _a[CommandNames.GetCodeFixesFull] = function (request) {
- return _this.requiredResponse(_this.getCodeFixes(request.arguments, false));
- },
- _a[CommandNames.GetSupportedCodeFixes] = function (request) {
- return _this.requiredResponse(_this.getSupportedCodeFixes());
- },
- _a));
- this.eventHander = canUseEvents
- ? eventHandler || (function (event) { return _this.defaultEventHandler(event); })
- : undefined;
- this.projectService = new server.ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, this.eventHander);
- this.gcTimer = new server.GcTimer(host, 7000, logger);
- var _a;
- }
- Session.prototype.defaultEventHandler = function (event) {
- var _this = this;
- switch (event.eventName) {
- case "context":
- var _a = event.data, project = _a.project, fileName = _a.fileName;
- this.projectService.logger.info("got context event, updating diagnostics for " + fileName);
- this.updateErrorCheck([{ fileName: fileName, project: project }], this.changeSeq, function (n) { return n === _this.changeSeq; }, 100);
- break;
- case "configFileDiag":
- var _b = event.data, triggerFile = _b.triggerFile, configFileName = _b.configFileName, diagnostics = _b.diagnostics;
- this.configFileDiagnosticEvent(triggerFile, configFileName, diagnostics);
- }
- };
- Session.prototype.logError = function (err, cmd) {
- var msg = "Exception on executing command " + cmd;
- if (err.message) {
- msg += ":\n" + err.message;
- if (err.stack) {
- msg += "\n" + err.stack;
}
}
- this.logger.msg(msg, server.Msg.Err);
- };
- Session.prototype.send = function (msg) {
- if (msg.type === "event" && !this.canUseEvents) {
- if (this.logger.hasLevel(server.LogLevel.verbose)) {
- this.logger.info("Session does not support events: ignored event: " + JSON.stringify(msg));
- }
- return;
+ }
+ return result;
+ function getMatchingTokenKind(token) {
+ switch (token.kind) {
+ case 16: return 17;
+ case 18: return 19;
+ case 20: return 21;
+ case 26: return 28;
+ case 17: return 16;
+ case 19: return 18;
+ case 21: return 20;
+ case 28: return 26;
}
- this.host.write(formatMessage(msg, this.logger, this.byteLength, this.host.newLine));
- };
- Session.prototype.configFileDiagnosticEvent = function (triggerFile, configFile, diagnostics) {
- var bakedDiags = ts.map(diagnostics, formatConfigFileDiag);
- var ev = {
- seq: 0,
- type: "event",
- event: "configFileDiag",
- body: {
- triggerFile: triggerFile,
- configFile: configFile,
- diagnostics: bakedDiags
- }
- };
- this.send(ev);
- };
- Session.prototype.event = function (info, eventName) {
- var ev = {
- seq: 0,
- type: "event",
- event: eventName,
- body: info
- };
- this.send(ev);
- };
- Session.prototype.output = function (info, cmdName, reqSeq, errorMsg) {
- if (reqSeq === void 0) { reqSeq = 0; }
- var res = {
- seq: 0,
- type: "response",
- command: cmdName,
- request_seq: reqSeq,
- success: !errorMsg
+ return undefined;
+ }
+ }
+ function getIndentationAtPosition(fileName, position, editorOptions) {
+ var start = ts.timestamp();
+ var settings = toEditorSettings(editorOptions);
+ var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
+ log("getIndentationAtPosition: getCurrentSourceFile: " + (ts.timestamp() - start));
+ start = ts.timestamp();
+ var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, settings);
+ log("getIndentationAtPosition: computeIndentation : " + (ts.timestamp() - start));
+ return result;
+ }
+ function getFormattingEditsForRange(fileName, start, end, options) {
+ var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
+ var settings = toEditorSettings(options);
+ return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(settings), settings);
+ }
+ function getFormattingEditsForDocument(fileName, options) {
+ var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
+ var settings = toEditorSettings(options);
+ return ts.formatting.formatDocument(sourceFile, getRuleProvider(settings), settings);
+ }
+ function getFormattingEditsAfterKeystroke(fileName, position, key, options) {
+ var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
+ var settings = toEditorSettings(options);
+ if (key === "}") {
+ return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(settings), settings);
+ }
+ else if (key === ";") {
+ return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(settings), settings);
+ }
+ else if (key === "\n") {
+ return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(settings), settings);
+ }
+ return [];
+ }
+ function getCodeFixesAtPosition(fileName, start, end, errorCodes) {
+ synchronizeHostData();
+ var sourceFile = getValidSourceFile(fileName);
+ var span = { start: start, length: end - start };
+ var newLineChar = ts.getNewLineOrDefaultFromHost(host);
+ var allFixes = [];
+ ts.forEach(errorCodes, function (error) {
+ cancellationToken.throwIfCancellationRequested();
+ var context = {
+ errorCode: error,
+ sourceFile: sourceFile,
+ span: span,
+ program: program,
+ newLineCharacter: newLineChar
};
- if (!errorMsg) {
- res.body = info;
- }
- else {
- res.message = errorMsg;
- }
- this.send(res);
- };
- Session.prototype.semanticCheck = function (file, project) {
- try {
- var diags = [];
- if (!shouldSkipSematicCheck(project)) {
- diags = project.getLanguageService().getSemanticDiagnostics(file);
- }
- var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); });
- this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag");
- }
- catch (err) {
- this.logError(err, "semantic check");
+ var fixes = ts.codefix.getFixes(context);
+ if (fixes) {
+ allFixes = allFixes.concat(fixes);
}
- };
- Session.prototype.syntacticCheck = function (file, project) {
- try {
- var diags = project.getLanguageService().getSyntacticDiagnostics(file);
- if (diags) {
- var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); });
- this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag");
- }
- }
- catch (err) {
- this.logError(err, "syntactic check");
- }
- };
- Session.prototype.updateProjectStructure = function (seq, matchSeq, ms) {
- var _this = this;
- if (ms === void 0) { ms = 1500; }
- this.host.setTimeout(function () {
- if (matchSeq(seq)) {
- _this.projectService.refreshInferredProjects();
- }
- }, ms);
- };
- Session.prototype.updateErrorCheck = function (checkList, seq, matchSeq, ms, followMs, requireOpen) {
- var _this = this;
- if (ms === void 0) { ms = 1500; }
- if (followMs === void 0) { followMs = 200; }
- if (requireOpen === void 0) { requireOpen = true; }
- if (followMs > ms) {
- followMs = ms;
- }
- if (this.errorTimer) {
- this.host.clearTimeout(this.errorTimer);
- }
- if (this.immediateId) {
- this.host.clearImmediate(this.immediateId);
- this.immediateId = undefined;
- }
- var index = 0;
- var checkOne = function () {
- if (matchSeq(seq)) {
- var checkSpec_1 = checkList[index];
- index++;
- if (checkSpec_1.project.containsFile(checkSpec_1.fileName, requireOpen)) {
- _this.syntacticCheck(checkSpec_1.fileName, checkSpec_1.project);
- _this.immediateId = _this.host.setImmediate(function () {
- _this.semanticCheck(checkSpec_1.fileName, checkSpec_1.project);
- _this.immediateId = undefined;
- if (checkList.length > index) {
- _this.errorTimer = _this.host.setTimeout(checkOne, followMs);
- }
- else {
- _this.errorTimer = undefined;
- }
- });
- }
- }
- };
- if ((checkList.length > index) && (matchSeq(seq))) {
- this.errorTimer = this.host.setTimeout(checkOne, ms);
- }
- };
- Session.prototype.cleanProjects = function (caption, projects) {
- if (!projects) {
- return;
- }
- this.logger.info("cleaning " + caption);
- for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) {
- var p = projects_4[_i];
- p.getLanguageService(false).cleanupSemanticCache();
- }
- };
- Session.prototype.cleanup = function () {
- this.cleanProjects("inferred projects", this.projectService.inferredProjects);
- this.cleanProjects("configured projects", this.projectService.configuredProjects);
- this.cleanProjects("external projects", this.projectService.externalProjects);
- if (this.host.gc) {
- this.logger.info("host.gc()");
- this.host.gc();
- }
- };
- Session.prototype.getEncodedSemanticClassifications = function (args) {
- var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
- return project.getLanguageService().getEncodedSemanticClassifications(file, args);
- };
- Session.prototype.getProject = function (projectFileName) {
- return projectFileName && this.projectService.findProject(projectFileName);
- };
- Session.prototype.getCompilerOptionsDiagnostics = function (args) {
- var project = this.getProject(args.projectFileName);
- return this.convertToDiagnosticsWithLinePosition(project.getLanguageService().getCompilerOptionsDiagnostics(), undefined);
- };
- Session.prototype.convertToDiagnosticsWithLinePosition = function (diagnostics, scriptInfo) {
- var _this = this;
- return diagnostics.map(function (d) { return ({
- message: ts.flattenDiagnosticMessageText(d.messageText, _this.host.newLine),
- start: d.start,
- length: d.length,
- category: ts.DiagnosticCategory[d.category].toLowerCase(),
- code: d.code,
- startLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start),
- endLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start + d.length)
- }); });
- };
- Session.prototype.getDiagnosticsWorker = function (args, selector, includeLinePosition) {
- var _a = this.getFileAndProject(args), project = _a.project, file = _a.file;
- if (shouldSkipSematicCheck(project)) {
- return [];
- }
- var scriptInfo = project.getScriptInfoForNormalizedPath(file);
- var diagnostics = selector(project, file);
- return includeLinePosition
- ? this.convertToDiagnosticsWithLinePosition(diagnostics, scriptInfo)
- : diagnostics.map(function (d) { return formatDiag(file, project, d); });
- };
- Session.prototype.getDefinition = function (args, simplifiedResult) {
- var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
- var scriptInfo = project.getScriptInfoForNormalizedPath(file);
- var position = this.getPosition(args, scriptInfo);
- var definitions = project.getLanguageService().getDefinitionAtPosition(file, position);
- if (!definitions) {
- return undefined;
- }
- if (simplifiedResult) {
- return definitions.map(function (def) {
- var defScriptInfo = project.getScriptInfo(def.fileName);
- return {
- file: def.fileName,
- start: defScriptInfo.positionToLineOffset(def.textSpan.start),
- end: defScriptInfo.positionToLineOffset(ts.textSpanEnd(def.textSpan))
- };
- });
- }
- else {
- return definitions;
- }
- };
- Session.prototype.getTypeDefinition = function (args) {
- var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
- var scriptInfo = project.getScriptInfoForNormalizedPath(file);
- var position = this.getPosition(args, scriptInfo);
- var definitions = project.getLanguageService().getTypeDefinitionAtPosition(file, position);
- if (!definitions) {
- return undefined;
- }
- return definitions.map(function (def) {
- var defScriptInfo = project.getScriptInfo(def.fileName);
- return {
- file: def.fileName,
- start: defScriptInfo.positionToLineOffset(def.textSpan.start),
- end: defScriptInfo.positionToLineOffset(ts.textSpanEnd(def.textSpan))
- };
- });
- };
- Session.prototype.getImplementation = function (args, simplifiedResult) {
- var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
- var scriptInfo = project.getScriptInfoForNormalizedPath(file);
- var position = this.getPosition(args, scriptInfo);
- var implementations = project.getLanguageService().getImplementationAtPosition(file, position);
- if (!implementations) {
- return [];
- }
- if (simplifiedResult) {
- return implementations.map(function (impl) { return ({
- file: impl.fileName,
- start: scriptInfo.positionToLineOffset(impl.textSpan.start),
- end: scriptInfo.positionToLineOffset(ts.textSpanEnd(impl.textSpan))
- }); });
- }
- else {
- return implementations;
- }
- };
- Session.prototype.getOccurrences = function (args) {
- var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
- var scriptInfo = project.getScriptInfoForNormalizedPath(file);
- var position = this.getPosition(args, scriptInfo);
- var occurrences = project.getLanguageService().getOccurrencesAtPosition(file, position);
- if (!occurrences) {
- return undefined;
- }
- return occurrences.map(function (occurrence) {
- var fileName = occurrence.fileName, isWriteAccess = occurrence.isWriteAccess, textSpan = occurrence.textSpan;
- var scriptInfo = project.getScriptInfo(fileName);
- var start = scriptInfo.positionToLineOffset(textSpan.start);
- var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan));
- return {
- start: start,
- end: end,
- file: fileName,
- isWriteAccess: isWriteAccess
- };
- });
- };
- Session.prototype.getSyntacticDiagnosticsSync = function (args) {
- return this.getDiagnosticsWorker(args, function (project, file) { return project.getLanguageService().getSyntacticDiagnostics(file); }, args.includeLinePosition);
- };
- Session.prototype.getSemanticDiagnosticsSync = function (args) {
- return this.getDiagnosticsWorker(args, function (project, file) { return project.getLanguageService().getSemanticDiagnostics(file); }, args.includeLinePosition);
- };
- Session.prototype.getDocumentHighlights = function (args, simplifiedResult) {
- var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
- var scriptInfo = project.getScriptInfoForNormalizedPath(file);
- var position = this.getPosition(args, scriptInfo);
- var documentHighlights = project.getLanguageService().getDocumentHighlights(file, position, args.filesToSearch);
- if (!documentHighlights) {
- return undefined;
- }
- if (simplifiedResult) {
- return documentHighlights.map(convertToDocumentHighlightsItem);
- }
- else {
- return documentHighlights;
- }
- function convertToDocumentHighlightsItem(documentHighlights) {
- var fileName = documentHighlights.fileName, highlightSpans = documentHighlights.highlightSpans;
- var scriptInfo = project.getScriptInfo(fileName);
- return {
- file: fileName,
- highlightSpans: highlightSpans.map(convertHighlightSpan)
- };
- function convertHighlightSpan(highlightSpan) {
- var textSpan = highlightSpan.textSpan, kind = highlightSpan.kind;
- var start = scriptInfo.positionToLineOffset(textSpan.start);
- var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan));
- return { start: start, end: end, kind: kind };
- }
- }
- };
- Session.prototype.setCompilerOptionsForInferredProjects = function (args) {
- this.projectService.setCompilerOptionsForInferredProjects(args.options);
- };
- Session.prototype.getProjectInfo = function (args) {
- return this.getProjectInfoWorker(args.file, args.projectFileName, args.needFileNameList);
- };
- Session.prototype.getProjectInfoWorker = function (uncheckedFileName, projectFileName, needFileNameList) {
- var project = this.getFileAndProjectWorker(uncheckedFileName, projectFileName, true, true).project;
- var projectInfo = {
- configFileName: project.getProjectName(),
- languageServiceDisabled: !project.languageServiceEnabled,
- fileNames: needFileNameList ? project.getFileNames() : undefined
- };
- return projectInfo;
- };
- Session.prototype.getRenameInfo = function (args) {
- var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
- var scriptInfo = project.getScriptInfoForNormalizedPath(file);
- var position = this.getPosition(args, scriptInfo);
- return project.getLanguageService().getRenameInfo(file, position);
- };
- Session.prototype.getProjects = function (args) {
- var projects;
- if (args.projectFileName) {
- var project = this.getProject(args.projectFileName);
- if (project) {
- projects = [project];
- }
- }
- else {
- var scriptInfo = this.projectService.getScriptInfo(args.file);
- projects = scriptInfo.containingProjects;
- }
- projects = ts.filter(projects, function (p) { return p.languageServiceEnabled; });
- if (!projects || !projects.length) {
- return server.Errors.ThrowNoProject();
- }
- return projects;
- };
- Session.prototype.getRenameLocations = function (args, simplifiedResult) {
- var file = server.toNormalizedPath(args.file);
- var info = this.projectService.getScriptInfoForNormalizedPath(file);
- var position = this.getPosition(args, info);
- var projects = this.getProjects(args);
- if (simplifiedResult) {
- var defaultProject = projects[0];
- var renameInfo = defaultProject.getLanguageService().getRenameInfo(file, position);
- if (!renameInfo) {
- return undefined;
- }
- if (!renameInfo.canRename) {
- return {
- info: renameInfo,
- locs: []
- };
+ });
+ return allFixes;
+ }
+ function getDocCommentTemplateAtPosition(fileName, position) {
+ return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position);
+ }
+ function isValidBraceCompletionAtPosition(fileName, position, openingBrace) {
+ if (openingBrace === 60) {
+ return false;
+ }
+ var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
+ if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) {
+ return false;
+ }
+ if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) {
+ return openingBrace === 123;
+ }
+ if (ts.isInTemplateString(sourceFile, position)) {
+ return false;
+ }
+ return true;
+ }
+ function getTodoComments(fileName, descriptors) {
+ synchronizeHostData();
+ var sourceFile = getValidSourceFile(fileName);
+ cancellationToken.throwIfCancellationRequested();
+ var fileContents = sourceFile.text;
+ var result = [];
+ if (descriptors.length > 0) {
+ var regExp = getTodoCommentsRegExp();
+ var matchArray = void 0;
+ while (matchArray = regExp.exec(fileContents)) {
+ cancellationToken.throwIfCancellationRequested();
+ var firstDescriptorCaptureIndex = 3;
+ ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex);
+ var preamble = matchArray[1];
+ var matchPosition = matchArray.index + preamble.length;
+ var token = ts.getTokenAtPosition(sourceFile, matchPosition);
+ if (!ts.isInsideComment(sourceFile, token, matchPosition)) {
+ continue;
}
- var fileSpans = server.combineProjectOutput(projects, function (project) {
- var renameLocations = project.getLanguageService().findRenameLocations(file, position, args.findInStrings, args.findInComments);
- if (!renameLocations) {
- return [];
- }
- return renameLocations.map(function (location) {
- var locationScriptInfo = project.getScriptInfo(location.fileName);
- return {
- file: location.fileName,
- start: locationScriptInfo.positionToLineOffset(location.textSpan.start),
- end: locationScriptInfo.positionToLineOffset(ts.textSpanEnd(location.textSpan))
- };
- });
- }, compareRenameLocation, function (a, b) { return a.file === b.file && a.start.line === b.start.line && a.start.offset === b.start.offset; });
- var locs = fileSpans.reduce(function (accum, cur) {
- var curFileAccum;
- if (accum.length > 0) {
- curFileAccum = accum[accum.length - 1];
- if (curFileAccum.file !== cur.file) {
- curFileAccum = undefined;
- }
- }
- if (!curFileAccum) {
- curFileAccum = { file: cur.file, locs: [] };
- accum.push(curFileAccum);
+ var descriptor = undefined;
+ for (var i = 0, n = descriptors.length; i < n; i++) {
+ if (matchArray[i + firstDescriptorCaptureIndex]) {
+ descriptor = descriptors[i];
}
- curFileAccum.locs.push({ start: cur.start, end: cur.end });
- return accum;
- }, []);
- return { info: renameInfo, locs: locs };
- }
- else {
- return server.combineProjectOutput(projects, function (p) { return p.getLanguageService().findRenameLocations(file, position, args.findInStrings, args.findInComments); }, undefined, renameLocationIsEqualTo);
- }
- function renameLocationIsEqualTo(a, b) {
- if (a === b) {
- return true;
}
- if (!a || !b) {
- return false;
+ ts.Debug.assert(descriptor !== undefined);
+ if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) {
+ continue;
}
- return a.fileName === b.fileName &&
- a.textSpan.start === b.textSpan.start &&
- a.textSpan.length === b.textSpan.length;
+ var message = matchArray[2];
+ result.push({
+ descriptor: descriptor,
+ message: message,
+ position: matchPosition
+ });
}
- function compareRenameLocation(a, b) {
- if (a.file < b.file) {
- return -1;
- }
- else if (a.file > b.file) {
- return 1;
+ }
+ return result;
+ function escapeRegExp(str) {
+ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
+ }
+ function getTodoCommentsRegExp() {
+ var singleLineCommentStart = /(?:\/\/+\s*)/.source;
+ var multiLineCommentStart = /(?:\/\*+\s*)/.source;
+ var anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source;
+ var preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")";
+ var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")";
+ var endOfLineOrEndOfComment = /(?:$|\*\/)/.source;
+ var messageRemainder = /(?:.*?)/.source;
+ var messagePortion = "(" + literals + messageRemainder + ")";
+ var regExpString = preamble + messagePortion + endOfLineOrEndOfComment;
+ return new RegExp(regExpString, "gim");
+ }
+ function isLetterOrDigit(char) {
+ return (char >= 97 && char <= 122) ||
+ (char >= 65 && char <= 90) ||
+ (char >= 48 && char <= 57);
+ }
+ }
+ function getRenameInfo(fileName, position) {
+ synchronizeHostData();
+ var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings());
+ return ts.Rename.getRenameInfo(program.getTypeChecker(), defaultLibFileName, getCanonicalFileName, getValidSourceFile(fileName), position);
+ }
+ return {
+ dispose: dispose,
+ cleanupSemanticCache: cleanupSemanticCache,
+ getSyntacticDiagnostics: getSyntacticDiagnostics,
+ getSemanticDiagnostics: getSemanticDiagnostics,
+ getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,
+ getSyntacticClassifications: getSyntacticClassifications,
+ getSemanticClassifications: getSemanticClassifications,
+ getEncodedSyntacticClassifications: getEncodedSyntacticClassifications,
+ getEncodedSemanticClassifications: getEncodedSemanticClassifications,
+ getCompletionsAtPosition: getCompletionsAtPosition,
+ getCompletionEntryDetails: getCompletionEntryDetails,
+ getCompletionEntrySymbol: getCompletionEntrySymbol,
+ getSignatureHelpItems: getSignatureHelpItems,
+ getQuickInfoAtPosition: getQuickInfoAtPosition,
+ getDefinitionAtPosition: getDefinitionAtPosition,
+ getImplementationAtPosition: getImplementationAtPosition,
+ getTypeDefinitionAtPosition: getTypeDefinitionAtPosition,
+ getReferencesAtPosition: getReferencesAtPosition,
+ findReferences: findReferences,
+ getOccurrencesAtPosition: getOccurrencesAtPosition,
+ getDocumentHighlights: getDocumentHighlights,
+ getNameOrDottedNameSpan: getNameOrDottedNameSpan,
+ getBreakpointStatementAtPosition: getBreakpointStatementAtPosition,
+ getNavigateToItems: getNavigateToItems,
+ getRenameInfo: getRenameInfo,
+ findRenameLocations: findRenameLocations,
+ getNavigationBarItems: getNavigationBarItems,
+ getNavigationTree: getNavigationTree,
+ getOutliningSpans: getOutliningSpans,
+ getTodoComments: getTodoComments,
+ getBraceMatchingAtPosition: getBraceMatchingAtPosition,
+ getIndentationAtPosition: getIndentationAtPosition,
+ getFormattingEditsForRange: getFormattingEditsForRange,
+ getFormattingEditsForDocument: getFormattingEditsForDocument,
+ getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke,
+ getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition,
+ isValidBraceCompletionAtPosition: isValidBraceCompletionAtPosition,
+ getCodeFixesAtPosition: getCodeFixesAtPosition,
+ getEmitOutput: getEmitOutput,
+ getNonBoundSourceFile: getNonBoundSourceFile,
+ getSourceFile: getSourceFile,
+ getProgram: getProgram
+ };
+ }
+ ts.createLanguageService = createLanguageService;
+ function getNameTable(sourceFile) {
+ if (!sourceFile.nameTable) {
+ initializeNameTable(sourceFile);
+ }
+ return sourceFile.nameTable;
+ }
+ ts.getNameTable = getNameTable;
+ function initializeNameTable(sourceFile) {
+ var nameTable = ts.createMap();
+ walk(sourceFile);
+ sourceFile.nameTable = nameTable;
+ function walk(node) {
+ switch (node.kind) {
+ case 70:
+ nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1;
+ break;
+ case 9:
+ case 8:
+ if (ts.isDeclarationName(node) ||
+ node.parent.kind === 241 ||
+ isArgumentOfElementAccessExpression(node) ||
+ ts.isLiteralComputedPropertyDeclarationName(node)) {
+ nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1;
}
- else {
- if (a.start.line < b.start.line) {
- return 1;
- }
- else if (a.start.line > b.start.line) {
- return -1;
- }
- else {
- return b.start.offset - a.start.offset;
+ break;
+ default:
+ ts.forEachChild(node, walk);
+ if (node.jsDocComments) {
+ for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
+ var jsDocComment = _a[_i];
+ ts.forEachChild(jsDocComment, walk);
}
}
- }
- };
- Session.prototype.getReferences = function (args, simplifiedResult) {
- var file = server.toNormalizedPath(args.file);
- var projects = this.getProjects(args);
- var defaultProject = projects[0];
- var scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file);
- var position = this.getPosition(args, scriptInfo);
- if (simplifiedResult) {
- var nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position);
- if (!nameInfo) {
- return undefined;
- }
- var displayString = ts.displayPartsToString(nameInfo.displayParts);
- var nameSpan = nameInfo.textSpan;
- var nameColStart = scriptInfo.positionToLineOffset(nameSpan.start).offset;
- var nameText = scriptInfo.snap().getText(nameSpan.start, ts.textSpanEnd(nameSpan));
- var refs = server.combineProjectOutput(projects, function (project) {
- var references = project.getLanguageService().getReferencesAtPosition(file, position);
- if (!references) {
- return [];
- }
- return references.map(function (ref) {
- var refScriptInfo = project.getScriptInfo(ref.fileName);
+ }
+ }
+ }
+ function isArgumentOfElementAccessExpression(node) {
+ return node &&
+ node.parent &&
+ node.parent.kind === 174 &&
+ node.parent.argumentExpression === node;
+ }
+ function getDefaultLibFilePath(options) {
+ if (typeof __dirname !== "undefined") {
+ return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options);
+ }
+ throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. ");
+ }
+ ts.getDefaultLibFilePath = getDefaultLibFilePath;
+ function initializeServices() {
+ ts.objectAllocator = getServicesObjectAllocator();
+ }
+ initializeServices();
+})(ts || (ts = {}));
+var debugObjectHost = (function () { return this; })();
+var ts;
+(function (ts) {
+ function logInternalError(logger, err) {
+ if (logger) {
+ logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message);
+ }
+ }
+ var ScriptSnapshotShimAdapter = (function () {
+ function ScriptSnapshotShimAdapter(scriptSnapshotShim) {
+ this.scriptSnapshotShim = scriptSnapshotShim;
+ }
+ ScriptSnapshotShimAdapter.prototype.getText = function (start, end) {
+ return this.scriptSnapshotShim.getText(start, end);
+ };
+ ScriptSnapshotShimAdapter.prototype.getLength = function () {
+ return this.scriptSnapshotShim.getLength();
+ };
+ ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) {
+ var oldSnapshotShim = oldSnapshot;
+ var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim);
+ if (encoded == null) {
+ return null;
+ }
+ var decoded = JSON.parse(encoded);
+ return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength);
+ };
+ ScriptSnapshotShimAdapter.prototype.dispose = function () {
+ if ("dispose" in this.scriptSnapshotShim) {
+ this.scriptSnapshotShim.dispose();
+ }
+ };
+ return ScriptSnapshotShimAdapter;
+ }());
+ var LanguageServiceShimHostAdapter = (function () {
+ function LanguageServiceShimHostAdapter(shimHost) {
+ var _this = this;
+ this.shimHost = shimHost;
+ this.loggingEnabled = false;
+ this.tracingEnabled = false;
+ if ("getModuleResolutionsForFile" in this.shimHost) {
+ this.resolveModuleNames = function (moduleNames, containingFile) {
+ var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile));
+ return ts.map(moduleNames, function (name) {
+ var result = ts.getProperty(resolutionsInFile, name);
+ return result ? { resolvedFileName: result } : undefined;
+ });
+ };
+ }
+ if ("directoryExists" in this.shimHost) {
+ this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); };
+ }
+ if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) {
+ this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) {
+ var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile));
+ return ts.map(typeDirectiveNames, function (name) { return ts.getProperty(typeDirectivesForFile, name); });
+ };
+ }
+ }
+ LanguageServiceShimHostAdapter.prototype.log = function (s) {
+ if (this.loggingEnabled) {
+ this.shimHost.log(s);
+ }
+ };
+ LanguageServiceShimHostAdapter.prototype.trace = function (s) {
+ if (this.tracingEnabled) {
+ this.shimHost.trace(s);
+ }
+ };
+ LanguageServiceShimHostAdapter.prototype.error = function (s) {
+ this.shimHost.error(s);
+ };
+ LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () {
+ if (!this.shimHost.getProjectVersion) {
+ return undefined;
+ }
+ return this.shimHost.getProjectVersion();
+ };
+ LanguageServiceShimHostAdapter.prototype.getTypeRootsVersion = function () {
+ if (!this.shimHost.getTypeRootsVersion) {
+ return 0;
+ }
+ return this.shimHost.getTypeRootsVersion();
+ };
+ LanguageServiceShimHostAdapter.prototype.useCaseSensitiveFileNames = function () {
+ return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false;
+ };
+ LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () {
+ var settingsJson = this.shimHost.getCompilationSettings();
+ if (settingsJson == null || settingsJson == "") {
+ throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings");
+ }
+ return JSON.parse(settingsJson);
+ };
+ LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () {
+ var encoded = this.shimHost.getScriptFileNames();
+ return this.files = JSON.parse(encoded);
+ };
+ LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) {
+ var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName);
+ return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot);
+ };
+ LanguageServiceShimHostAdapter.prototype.getScriptKind = function (fileName) {
+ if ("getScriptKind" in this.shimHost) {
+ return this.shimHost.getScriptKind(fileName);
+ }
+ else {
+ return 0;
+ }
+ };
+ LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) {
+ return this.shimHost.getScriptVersion(fileName);
+ };
+ LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () {
+ var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages();
+ if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") {
+ return null;
+ }
+ try {
+ return JSON.parse(diagnosticMessagesJson);
+ }
+ catch (e) {
+ this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format");
+ return null;
+ }
+ };
+ LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () {
+ var hostCancellationToken = this.shimHost.getCancellationToken();
+ return new ThrottledCancellationToken(hostCancellationToken);
+ };
+ LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () {
+ return this.shimHost.getCurrentDirectory();
+ };
+ LanguageServiceShimHostAdapter.prototype.getDirectories = function (path) {
+ return JSON.parse(this.shimHost.getDirectories(path));
+ };
+ LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) {
+ return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
+ };
+ LanguageServiceShimHostAdapter.prototype.readDirectory = function (path, extensions, exclude, include, depth) {
+ var pattern = ts.getFileMatcherPatterns(path, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory());
+ return JSON.parse(this.shimHost.readDirectory(path, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth));
+ };
+ LanguageServiceShimHostAdapter.prototype.readFile = function (path, encoding) {
+ return this.shimHost.readFile(path, encoding);
+ };
+ LanguageServiceShimHostAdapter.prototype.fileExists = function (path) {
+ return this.shimHost.fileExists(path);
+ };
+ return LanguageServiceShimHostAdapter;
+ }());
+ ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter;
+ var ThrottledCancellationToken = (function () {
+ function ThrottledCancellationToken(hostCancellationToken) {
+ this.hostCancellationToken = hostCancellationToken;
+ this.lastCancellationCheckTime = 0;
+ }
+ ThrottledCancellationToken.prototype.isCancellationRequested = function () {
+ var time = ts.timestamp();
+ var duration = Math.abs(time - this.lastCancellationCheckTime);
+ if (duration > 10) {
+ this.lastCancellationCheckTime = time;
+ return this.hostCancellationToken.isCancellationRequested();
+ }
+ return false;
+ };
+ return ThrottledCancellationToken;
+ }());
+ var CoreServicesShimHostAdapter = (function () {
+ function CoreServicesShimHostAdapter(shimHost) {
+ var _this = this;
+ this.shimHost = shimHost;
+ this.useCaseSensitiveFileNames = this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false;
+ if ("directoryExists" in this.shimHost) {
+ this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); };
+ }
+ if ("realpath" in this.shimHost) {
+ this.realpath = function (path) { return _this.shimHost.realpath(path); };
+ }
+ }
+ CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extensions, exclude, include, depth) {
+ try {
+ var pattern = ts.getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory());
+ return JSON.parse(this.shimHost.readDirectory(rootDir, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth));
+ }
+ catch (e) {
+ var results = [];
+ for (var _i = 0, extensions_2 = extensions; _i < extensions_2.length; _i++) {
+ var extension = extensions_2[_i];
+ for (var _a = 0, _b = this.readDirectoryFallback(rootDir, extension, exclude); _a < _b.length; _a++) {
+ var file = _b[_a];
+ if (!ts.contains(results, file)) {
+ results.push(file);
+ }
+ }
+ }
+ return results;
+ }
+ };
+ CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) {
+ return this.shimHost.fileExists(fileName);
+ };
+ CoreServicesShimHostAdapter.prototype.readFile = function (fileName) {
+ return this.shimHost.readFile(fileName);
+ };
+ CoreServicesShimHostAdapter.prototype.readDirectoryFallback = function (rootDir, extension, exclude) {
+ return JSON.parse(this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)));
+ };
+ CoreServicesShimHostAdapter.prototype.getDirectories = function (path) {
+ return JSON.parse(this.shimHost.getDirectories(path));
+ };
+ return CoreServicesShimHostAdapter;
+ }());
+ ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter;
+ function simpleForwardCall(logger, actionDescription, action, logPerformance) {
+ var start;
+ if (logPerformance) {
+ logger.log(actionDescription);
+ start = ts.timestamp();
+ }
+ var result = action();
+ if (logPerformance) {
+ var end = ts.timestamp();
+ logger.log(actionDescription + " completed in " + (end - start) + " msec");
+ if (typeof result === "string") {
+ var str = result;
+ if (str.length > 128) {
+ str = str.substring(0, 128) + "...";
+ }
+ logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'");
+ }
+ }
+ return result;
+ }
+ function forwardJSONCall(logger, actionDescription, action, logPerformance) {
+ return forwardCall(logger, actionDescription, true, action, logPerformance);
+ }
+ function forwardCall(logger, actionDescription, returnJson, action, logPerformance) {
+ try {
+ var result = simpleForwardCall(logger, actionDescription, action, logPerformance);
+ return returnJson ? JSON.stringify({ result: result }) : result;
+ }
+ catch (err) {
+ if (err instanceof ts.OperationCanceledException) {
+ return JSON.stringify({ canceled: true });
+ }
+ logInternalError(logger, err);
+ err.description = actionDescription;
+ return JSON.stringify({ error: err });
+ }
+ }
+ var ShimBase = (function () {
+ function ShimBase(factory) {
+ this.factory = factory;
+ factory.registerShim(this);
+ }
+ ShimBase.prototype.dispose = function (_dummy) {
+ this.factory.unregisterShim(this);
+ };
+ return ShimBase;
+ }());
+ function realizeDiagnostics(diagnostics, newLine) {
+ return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine); });
+ }
+ ts.realizeDiagnostics = realizeDiagnostics;
+ function realizeDiagnostic(diagnostic, newLine) {
+ return {
+ message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine),
+ start: diagnostic.start,
+ length: diagnostic.length,
+ category: ts.DiagnosticCategory[diagnostic.category].toLowerCase(),
+ code: diagnostic.code
+ };
+ }
+ var LanguageServiceShimObject = (function (_super) {
+ __extends(LanguageServiceShimObject, _super);
+ function LanguageServiceShimObject(factory, host, languageService) {
+ var _this = _super.call(this, factory) || this;
+ _this.host = host;
+ _this.languageService = languageService;
+ _this.logPerformance = false;
+ _this.logger = _this.host;
+ return _this;
+ }
+ LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) {
+ return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);
+ };
+ LanguageServiceShimObject.prototype.dispose = function (dummy) {
+ this.logger.log("dispose()");
+ this.languageService.dispose();
+ this.languageService = null;
+ if (debugObjectHost && debugObjectHost.CollectGarbage) {
+ debugObjectHost.CollectGarbage();
+ this.logger.log("CollectGarbage()");
+ }
+ this.logger = null;
+ _super.prototype.dispose.call(this, dummy);
+ };
+ LanguageServiceShimObject.prototype.refresh = function (throwOnError) {
+ this.forwardJSONCall("refresh(" + throwOnError + ")", function () { return null; });
+ };
+ LanguageServiceShimObject.prototype.cleanupSemanticCache = function () {
+ var _this = this;
+ this.forwardJSONCall("cleanupSemanticCache()", function () {
+ _this.languageService.cleanupSemanticCache();
+ return null;
+ });
+ };
+ LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) {
+ var newLine = ts.getNewLineOrDefaultFromHost(this.host);
+ return ts.realizeDiagnostics(diagnostics, newLine);
+ };
+ LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) {
+ var _this = this;
+ return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); });
+ };
+ LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) {
+ var _this = this;
+ return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); });
+ };
+ LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) {
+ var _this = this;
+ return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); });
+ };
+ LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) {
+ var _this = this;
+ return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); });
+ };
+ LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) {
+ var _this = this;
+ return this.forwardJSONCall("getSyntacticDiagnostics('" + fileName + "')", function () {
+ var diagnostics = _this.languageService.getSyntacticDiagnostics(fileName);
+ return _this.realizeDiagnostics(diagnostics);
+ });
+ };
+ LanguageServiceShimObject.prototype.getSemanticDiagnostics = function (fileName) {
+ var _this = this;
+ return this.forwardJSONCall("getSemanticDiagnostics('" + fileName + "')", function () {
+ var diagnostics = _this.languageService.getSemanticDiagnostics(fileName);
+ return _this.realizeDiagnostics(diagnostics);
+ });
+ };
+ LanguageServiceShimObject.prototype.getCompilerOptionsDiagnostics = function () {
+ var _this = this;
+ return this.forwardJSONCall("getCompilerOptionsDiagnostics()", function () {
+ var diagnostics = _this.languageService.getCompilerOptionsDiagnostics();
+ return _this.realizeDiagnostics(diagnostics);
+ });
+ };
+ LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) {
+ var _this = this;
+ return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); });
+ };
+ LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBreakpointStatementAtPosition(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { return _this.languageService.getSignatureHelpItems(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDefinitionAtPosition(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.getImplementationAtPosition = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getImplementationAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getImplementationAtPosition(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) {
+ var _this = this;
+ return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); });
+ };
+ LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBraceMatchingAtPosition(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.isValidBraceCompletionAtPosition = function (fileName, position, openingBrace) {
+ var _this = this;
+ return this.forwardJSONCall("isValidBraceCompletionAtPosition('" + fileName + "', " + position + ", " + openingBrace + ")", function () { return _this.languageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace); });
+ };
+ LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options) {
+ var _this = this;
+ return this.forwardJSONCall("getIndentationAtPosition('" + fileName + "', " + position + ")", function () {
+ var localOptions = JSON.parse(options);
+ return _this.languageService.getIndentationAtPosition(fileName, position, localOptions);
+ });
+ };
+ LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getReferencesAtPosition(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.findReferences = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { return _this.languageService.findReferences(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getOccurrencesAtPosition(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) {
+ var _this = this;
+ return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () {
+ var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch));
+ var normalizedName = ts.normalizeSlashes(fileName).toLowerCase();
+ return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; });
+ });
+ };
+ LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getCompletionsAtPosition(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) {
+ var _this = this;
+ return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", '" + entryName + "')", function () { return _this.languageService.getCompletionEntryDetails(fileName, position, entryName); });
+ };
+ LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options) {
+ var _this = this;
+ return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () {
+ var localOptions = JSON.parse(options);
+ return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions);
+ });
+ };
+ LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options) {
+ var _this = this;
+ return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () {
+ var localOptions = JSON.parse(options);
+ return _this.languageService.getFormattingEditsForDocument(fileName, localOptions);
+ });
+ };
+ LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options) {
+ var _this = this;
+ return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () {
+ var localOptions = JSON.parse(options);
+ return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions);
+ });
+ };
+ LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getDocCommentTemplateAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDocCommentTemplateAtPosition(fileName, position); });
+ };
+ LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount, fileName) {
+ var _this = this;
+ return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ", " + fileName + ")", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount, fileName); });
+ };
+ LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) {
+ var _this = this;
+ return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); });
+ };
+ LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) {
+ var _this = this;
+ return this.forwardJSONCall("getNavigationTree('" + fileName + "')", function () { return _this.languageService.getNavigationTree(fileName); });
+ };
+ LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) {
+ var _this = this;
+ return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); });
+ };
+ LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) {
+ var _this = this;
+ return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); });
+ };
+ LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) {
+ var _this = this;
+ return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { return _this.languageService.getEmitOutput(fileName); });
+ };
+ LanguageServiceShimObject.prototype.getEmitOutputObject = function (fileName) {
+ var _this = this;
+ return forwardCall(this.logger, "getEmitOutput('" + fileName + "')", false, function () { return _this.languageService.getEmitOutput(fileName); }, this.logPerformance);
+ };
+ return LanguageServiceShimObject;
+ }(ShimBase));
+ function convertClassifications(classifications) {
+ return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState };
+ }
+ var ClassifierShimObject = (function (_super) {
+ __extends(ClassifierShimObject, _super);
+ function ClassifierShimObject(factory, logger) {
+ var _this = _super.call(this, factory) || this;
+ _this.logger = logger;
+ _this.logPerformance = false;
+ _this.classifier = ts.createClassifier();
+ return _this;
+ }
+ ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) {
+ var _this = this;
+ return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); }, this.logPerformance);
+ };
+ ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) {
+ var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics);
+ var result = "";
+ for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) {
+ var item = _a[_i];
+ result += item.length + "\n";
+ result += item.classification + "\n";
+ }
+ result += classification.finalLexState;
+ return result;
+ };
+ return ClassifierShimObject;
+ }(ShimBase));
+ var CoreServicesShimObject = (function (_super) {
+ __extends(CoreServicesShimObject, _super);
+ function CoreServicesShimObject(factory, logger, host) {
+ var _this = _super.call(this, factory) || this;
+ _this.logger = logger;
+ _this.host = host;
+ _this.logPerformance = false;
+ return _this;
+ }
+ CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) {
+ return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);
+ };
+ CoreServicesShimObject.prototype.resolveModuleName = function (fileName, moduleName, compilerOptionsJson) {
+ var _this = this;
+ return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () {
+ var compilerOptions = JSON.parse(compilerOptionsJson);
+ var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host);
+ return {
+ resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined,
+ failedLookupLocations: result.failedLookupLocations
+ };
+ });
+ };
+ CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) {
+ var _this = this;
+ return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () {
+ var compilerOptions = JSON.parse(compilerOptionsJson);
+ var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host);
+ return {
+ resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined,
+ primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true,
+ failedLookupLocations: result.failedLookupLocations
+ };
+ });
+ };
+ CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) {
+ var _this = this;
+ return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () {
+ var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), true, true);
+ return {
+ referencedFiles: _this.convertFileReferences(result.referencedFiles),
+ importedFiles: _this.convertFileReferences(result.importedFiles),
+ ambientExternalModules: result.ambientExternalModules,
+ isLibFile: result.isLibFile,
+ typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives)
+ };
+ });
+ };
+ CoreServicesShimObject.prototype.getAutomaticTypeDirectiveNames = function (compilerOptionsJson) {
+ var _this = this;
+ return this.forwardJSONCall("getAutomaticTypeDirectiveNames('" + compilerOptionsJson + "')", function () {
+ var compilerOptions = JSON.parse(compilerOptionsJson);
+ return ts.getAutomaticTypeDirectiveNames(compilerOptions, _this.host);
+ });
+ };
+ CoreServicesShimObject.prototype.convertFileReferences = function (refs) {
+ if (!refs) {
+ return undefined;
+ }
+ var result = [];
+ for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) {
+ var ref = refs_2[_i];
+ result.push({
+ path: ts.normalizeSlashes(ref.fileName),
+ position: ref.pos,
+ length: ref.end - ref.pos
+ });
+ }
+ return result;
+ };
+ CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) {
+ var _this = this;
+ return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () {
+ var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength());
+ var result = ts.parseConfigFileTextToJson(fileName, text);
+ if (result.error) {
+ return {
+ options: {},
+ typingOptions: {},
+ files: [],
+ raw: {},
+ errors: [realizeDiagnostic(result.error, "\r\n")]
+ };
+ }
+ var normalizedFileName = ts.normalizeSlashes(fileName);
+ var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName);
+ return {
+ options: configFile.options,
+ typingOptions: configFile.typingOptions,
+ files: configFile.fileNames,
+ raw: configFile.raw,
+ errors: realizeDiagnostics(configFile.errors, "\r\n")
+ };
+ });
+ };
+ CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () {
+ return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); });
+ };
+ CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) {
+ var _this = this;
+ var getCanonicalFileName = ts.createGetCanonicalFileName(false);
+ return this.forwardJSONCall("discoverTypings()", function () {
+ var info = JSON.parse(discoverTypingsJson);
+ return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions);
+ });
+ };
+ return CoreServicesShimObject;
+ }(ShimBase));
+ var TypeScriptServicesFactory = (function () {
+ function TypeScriptServicesFactory() {
+ this._shims = [];
+ }
+ TypeScriptServicesFactory.prototype.getServicesVersion = function () {
+ return ts.servicesVersion;
+ };
+ TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) {
+ try {
+ if (this.documentRegistry === undefined) {
+ this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory());
+ }
+ var hostAdapter = new LanguageServiceShimHostAdapter(host);
+ var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry);
+ return new LanguageServiceShimObject(this, host, languageService);
+ }
+ catch (err) {
+ logInternalError(host, err);
+ throw err;
+ }
+ };
+ TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) {
+ try {
+ return new ClassifierShimObject(this, logger);
+ }
+ catch (err) {
+ logInternalError(logger, err);
+ throw err;
+ }
+ };
+ TypeScriptServicesFactory.prototype.createCoreServicesShim = function (host) {
+ try {
+ var adapter = new CoreServicesShimHostAdapter(host);
+ return new CoreServicesShimObject(this, host, adapter);
+ }
+ catch (err) {
+ logInternalError(host, err);
+ throw err;
+ }
+ };
+ TypeScriptServicesFactory.prototype.close = function () {
+ this._shims = [];
+ this.documentRegistry = undefined;
+ };
+ TypeScriptServicesFactory.prototype.registerShim = function (shim) {
+ this._shims.push(shim);
+ };
+ TypeScriptServicesFactory.prototype.unregisterShim = function (shim) {
+ for (var i = 0, n = this._shims.length; i < n; i++) {
+ if (this._shims[i] === shim) {
+ delete this._shims[i];
+ return;
+ }
+ }
+ throw new Error("Invalid operation");
+ };
+ return TypeScriptServicesFactory;
+ }());
+ ts.TypeScriptServicesFactory = TypeScriptServicesFactory;
+ if (typeof module !== "undefined" && module.exports) {
+ module.exports = ts;
+ }
+})(ts || (ts = {}));
+var TypeScript;
+(function (TypeScript) {
+ var Services;
+ (function (Services) {
+ Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory;
+ })(Services = TypeScript.Services || (TypeScript.Services = {}));
+})(TypeScript || (TypeScript = {}));
+var toolsVersion = "2.1";
+var ts;
+(function (ts) {
+ var server;
+ (function (server) {
+ (function (LogLevel) {
+ LogLevel[LogLevel["terse"] = 0] = "terse";
+ LogLevel[LogLevel["normal"] = 1] = "normal";
+ LogLevel[LogLevel["requestTime"] = 2] = "requestTime";
+ LogLevel[LogLevel["verbose"] = 3] = "verbose";
+ })(server.LogLevel || (server.LogLevel = {}));
+ var LogLevel = server.LogLevel;
+ server.emptyArray = [];
+ var Msg;
+ (function (Msg) {
+ Msg.Err = "Err";
+ Msg.Info = "Info";
+ Msg.Perf = "Perf";
+ })(Msg = server.Msg || (server.Msg = {}));
+ function getProjectRootPath(project) {
+ switch (project.projectKind) {
+ case server.ProjectKind.Configured:
+ return ts.getDirectoryPath(project.getProjectName());
+ case server.ProjectKind.Inferred:
+ return "";
+ case server.ProjectKind.External:
+ var projectName = ts.normalizeSlashes(project.getProjectName());
+ return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName;
+ }
+ }
+ function createInstallTypingsRequest(project, typingOptions, cachePath) {
+ return {
+ projectName: project.getProjectName(),
+ fileNames: project.getFileNames(),
+ compilerOptions: project.getCompilerOptions(),
+ typingOptions: typingOptions,
+ projectRootPath: getProjectRootPath(project),
+ cachePath: cachePath,
+ kind: "discover"
+ };
+ }
+ server.createInstallTypingsRequest = createInstallTypingsRequest;
+ var Errors;
+ (function (Errors) {
+ function ThrowNoProject() {
+ throw new Error("No Project.");
+ }
+ Errors.ThrowNoProject = ThrowNoProject;
+ function ThrowProjectLanguageServiceDisabled() {
+ throw new Error("The project's language service is disabled.");
+ }
+ Errors.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled;
+ function ThrowProjectDoesNotContainDocument(fileName, project) {
+ throw new Error("Project '" + project.getProjectName() + "' does not contain document '" + fileName + "'");
+ }
+ Errors.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument;
+ })(Errors = server.Errors || (server.Errors = {}));
+ function getDefaultFormatCodeSettings(host) {
+ return {
+ indentSize: 4,
+ tabSize: 4,
+ newLineCharacter: host.newLine || "\n",
+ convertTabsToSpaces: true,
+ indentStyle: ts.IndentStyle.Smart,
+ insertSpaceAfterCommaDelimiter: true,
+ insertSpaceAfterSemicolonInForStatements: true,
+ insertSpaceBeforeAndAfterBinaryOperators: true,
+ insertSpaceAfterKeywordsInControlFlowStatements: true,
+ insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
+ insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
+ insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,
+ placeOpenBraceOnNewLineForFunctions: false,
+ placeOpenBraceOnNewLineForControlBlocks: false,
+ };
+ }
+ server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings;
+ function mergeMaps(target, source) {
+ for (var key in source) {
+ if (ts.hasProperty(source, key)) {
+ target[key] = source[key];
+ }
+ }
+ }
+ server.mergeMaps = mergeMaps;
+ function removeItemFromSet(items, itemToRemove) {
+ if (items.length === 0) {
+ return;
+ }
+ var index = items.indexOf(itemToRemove);
+ if (index < 0) {
+ return;
+ }
+ if (index === items.length - 1) {
+ items.pop();
+ }
+ else {
+ items[index] = items.pop();
+ }
+ }
+ server.removeItemFromSet = removeItemFromSet;
+ function toNormalizedPath(fileName) {
+ return ts.normalizePath(fileName);
+ }
+ server.toNormalizedPath = toNormalizedPath;
+ function normalizedPathToPath(normalizedPath, currentDirectory, getCanonicalFileName) {
+ var f = ts.isRootedDiskPath(normalizedPath) ? normalizedPath : ts.getNormalizedAbsolutePath(normalizedPath, currentDirectory);
+ return getCanonicalFileName(f);
+ }
+ server.normalizedPathToPath = normalizedPathToPath;
+ function asNormalizedPath(fileName) {
+ return fileName;
+ }
+ server.asNormalizedPath = asNormalizedPath;
+ function createNormalizedPathMap() {
+ var map = Object.create(null);
+ return {
+ get: function (path) {
+ return map[path];
+ },
+ set: function (path, value) {
+ map[path] = value;
+ },
+ contains: function (path) {
+ return ts.hasProperty(map, path);
+ },
+ remove: function (path) {
+ delete map[path];
+ }
+ };
+ }
+ server.createNormalizedPathMap = createNormalizedPathMap;
+ function throwLanguageServiceIsDisabledError() {
+ throw new Error("LanguageService is disabled");
+ }
+ server.nullLanguageService = {
+ cleanupSemanticCache: throwLanguageServiceIsDisabledError,
+ getSyntacticDiagnostics: throwLanguageServiceIsDisabledError,
+ getSemanticDiagnostics: throwLanguageServiceIsDisabledError,
+ getCompilerOptionsDiagnostics: throwLanguageServiceIsDisabledError,
+ getSyntacticClassifications: throwLanguageServiceIsDisabledError,
+ getEncodedSyntacticClassifications: throwLanguageServiceIsDisabledError,
+ getSemanticClassifications: throwLanguageServiceIsDisabledError,
+ getEncodedSemanticClassifications: throwLanguageServiceIsDisabledError,
+ getCompletionsAtPosition: throwLanguageServiceIsDisabledError,
+ findReferences: throwLanguageServiceIsDisabledError,
+ getCompletionEntryDetails: throwLanguageServiceIsDisabledError,
+ getQuickInfoAtPosition: throwLanguageServiceIsDisabledError,
+ findRenameLocations: throwLanguageServiceIsDisabledError,
+ getNameOrDottedNameSpan: throwLanguageServiceIsDisabledError,
+ getBreakpointStatementAtPosition: throwLanguageServiceIsDisabledError,
+ getBraceMatchingAtPosition: throwLanguageServiceIsDisabledError,
+ getSignatureHelpItems: throwLanguageServiceIsDisabledError,
+ getDefinitionAtPosition: throwLanguageServiceIsDisabledError,
+ getRenameInfo: throwLanguageServiceIsDisabledError,
+ getTypeDefinitionAtPosition: throwLanguageServiceIsDisabledError,
+ getReferencesAtPosition: throwLanguageServiceIsDisabledError,
+ getDocumentHighlights: throwLanguageServiceIsDisabledError,
+ getOccurrencesAtPosition: throwLanguageServiceIsDisabledError,
+ getNavigateToItems: throwLanguageServiceIsDisabledError,
+ getNavigationBarItems: throwLanguageServiceIsDisabledError,
+ getNavigationTree: throwLanguageServiceIsDisabledError,
+ getOutliningSpans: throwLanguageServiceIsDisabledError,
+ getTodoComments: throwLanguageServiceIsDisabledError,
+ getIndentationAtPosition: throwLanguageServiceIsDisabledError,
+ getFormattingEditsForRange: throwLanguageServiceIsDisabledError,
+ getFormattingEditsForDocument: throwLanguageServiceIsDisabledError,
+ getFormattingEditsAfterKeystroke: throwLanguageServiceIsDisabledError,
+ getDocCommentTemplateAtPosition: throwLanguageServiceIsDisabledError,
+ isValidBraceCompletionAtPosition: throwLanguageServiceIsDisabledError,
+ getEmitOutput: throwLanguageServiceIsDisabledError,
+ getProgram: throwLanguageServiceIsDisabledError,
+ getNonBoundSourceFile: throwLanguageServiceIsDisabledError,
+ dispose: throwLanguageServiceIsDisabledError,
+ getCompletionEntrySymbol: throwLanguageServiceIsDisabledError,
+ getImplementationAtPosition: throwLanguageServiceIsDisabledError,
+ getSourceFile: throwLanguageServiceIsDisabledError,
+ getCodeFixesAtPosition: throwLanguageServiceIsDisabledError
+ };
+ server.nullLanguageServiceHost = {
+ setCompilationSettings: function () { return undefined; },
+ notifyFileRemoved: function () { return undefined; }
+ };
+ function isInferredProjectName(name) {
+ return /dev\/null\/inferredProject\d+\*/.test(name);
+ }
+ server.isInferredProjectName = isInferredProjectName;
+ function makeInferredProjectName(counter) {
+ return "/dev/null/inferredProject" + counter + "*";
+ }
+ server.makeInferredProjectName = makeInferredProjectName;
+ var ThrottledOperations = (function () {
+ function ThrottledOperations(host) {
+ this.host = host;
+ this.pendingTimeouts = ts.createMap();
+ }
+ ThrottledOperations.prototype.schedule = function (operationId, delay, cb) {
+ if (ts.hasProperty(this.pendingTimeouts, operationId)) {
+ this.host.clearTimeout(this.pendingTimeouts[operationId]);
+ }
+ this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb);
+ };
+ ThrottledOperations.run = function (self, operationId, cb) {
+ delete self.pendingTimeouts[operationId];
+ cb();
+ };
+ return ThrottledOperations;
+ }());
+ server.ThrottledOperations = ThrottledOperations;
+ var GcTimer = (function () {
+ function GcTimer(host, delay, logger) {
+ this.host = host;
+ this.delay = delay;
+ this.logger = logger;
+ }
+ GcTimer.prototype.scheduleCollect = function () {
+ if (!this.host.gc || this.timerId != undefined) {
+ return;
+ }
+ this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this);
+ };
+ GcTimer.run = function (self) {
+ self.timerId = undefined;
+ var log = self.logger.hasLevel(LogLevel.requestTime);
+ var before = log && self.host.getMemoryUsage();
+ self.host.gc();
+ if (log) {
+ var after = self.host.getMemoryUsage();
+ self.logger.perftrc("GC::before " + before + ", after " + after);
+ }
+ };
+ return GcTimer;
+ }());
+ server.GcTimer = GcTimer;
+ })(server = ts.server || (ts.server = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var server;
+ (function (server) {
+ var ScriptInfo = (function () {
+ function ScriptInfo(host, fileName, content, scriptKind, isOpen, hasMixedContent) {
+ if (isOpen === void 0) { isOpen = false; }
+ if (hasMixedContent === void 0) { hasMixedContent = false; }
+ this.host = host;
+ this.fileName = fileName;
+ this.scriptKind = scriptKind;
+ this.isOpen = isOpen;
+ this.hasMixedContent = hasMixedContent;
+ this.containingProjects = [];
+ this.path = ts.toPath(fileName, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
+ this.svc = server.ScriptVersionCache.fromString(host, content);
+ this.scriptKind = scriptKind
+ ? scriptKind
+ : ts.getScriptKindFromFileName(fileName);
+ }
+ ScriptInfo.prototype.getFormatCodeSettings = function () {
+ return this.formatCodeSettings;
+ };
+ ScriptInfo.prototype.attachToProject = function (project) {
+ var isNew = !this.isAttached(project);
+ if (isNew) {
+ this.containingProjects.push(project);
+ }
+ return isNew;
+ };
+ ScriptInfo.prototype.isAttached = function (project) {
+ switch (this.containingProjects.length) {
+ case 0: return false;
+ case 1: return this.containingProjects[0] === project;
+ case 2: return this.containingProjects[0] === project || this.containingProjects[1] === project;
+ default: return ts.contains(this.containingProjects, project);
+ }
+ };
+ ScriptInfo.prototype.detachFromProject = function (project) {
+ switch (this.containingProjects.length) {
+ case 0:
+ return;
+ case 1:
+ if (this.containingProjects[0] === project) {
+ this.containingProjects.pop();
+ }
+ break;
+ case 2:
+ if (this.containingProjects[0] === project) {
+ this.containingProjects[0] = this.containingProjects.pop();
+ }
+ else if (this.containingProjects[1] === project) {
+ this.containingProjects.pop();
+ }
+ break;
+ default:
+ server.removeItemFromSet(this.containingProjects, project);
+ break;
+ }
+ };
+ ScriptInfo.prototype.detachAllProjects = function () {
+ for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) {
+ var p = _a[_i];
+ p.removeFile(this, false);
+ }
+ this.containingProjects.length = 0;
+ };
+ ScriptInfo.prototype.getDefaultProject = function () {
+ if (this.containingProjects.length === 0) {
+ return server.Errors.ThrowNoProject();
+ }
+ return this.containingProjects[0];
+ };
+ ScriptInfo.prototype.setFormatOptions = function (formatSettings) {
+ if (formatSettings) {
+ if (!this.formatCodeSettings) {
+ this.formatCodeSettings = server.getDefaultFormatCodeSettings(this.host);
+ }
+ server.mergeMaps(this.formatCodeSettings, formatSettings);
+ }
+ };
+ ScriptInfo.prototype.setWatcher = function (watcher) {
+ this.stopWatcher();
+ this.fileWatcher = watcher;
+ };
+ ScriptInfo.prototype.stopWatcher = function () {
+ if (this.fileWatcher) {
+ this.fileWatcher.close();
+ this.fileWatcher = undefined;
+ }
+ };
+ ScriptInfo.prototype.getLatestVersion = function () {
+ return this.svc.latestVersion().toString();
+ };
+ ScriptInfo.prototype.reload = function (script) {
+ this.svc.reload(script);
+ this.markContainingProjectsAsDirty();
+ };
+ ScriptInfo.prototype.saveTo = function (fileName) {
+ var snap = this.snap();
+ this.host.writeFile(fileName, snap.getText(0, snap.getLength()));
+ };
+ ScriptInfo.prototype.reloadFromFile = function (tempFileName) {
+ if (this.hasMixedContent) {
+ this.reload("");
+ }
+ else {
+ this.svc.reloadFromFile(tempFileName || this.fileName);
+ this.markContainingProjectsAsDirty();
+ }
+ };
+ ScriptInfo.prototype.snap = function () {
+ return this.svc.getSnapshot();
+ };
+ ScriptInfo.prototype.getLineInfo = function (line) {
+ var snap = this.snap();
+ return snap.index.lineNumberToInfo(line);
+ };
+ ScriptInfo.prototype.editContent = function (start, end, newText) {
+ this.svc.edit(start, end - start, newText);
+ this.markContainingProjectsAsDirty();
+ };
+ ScriptInfo.prototype.markContainingProjectsAsDirty = function () {
+ for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) {
+ var p = _a[_i];
+ p.markAsDirty();
+ }
+ };
+ ScriptInfo.prototype.lineToTextSpan = function (line) {
+ var index = this.snap().index;
+ var lineInfo = index.lineNumberToInfo(line + 1);
+ var len;
+ if (lineInfo.leaf) {
+ len = lineInfo.leaf.text.length;
+ }
+ else {
+ var nextLineInfo = index.lineNumberToInfo(line + 2);
+ len = nextLineInfo.offset - lineInfo.offset;
+ }
+ return ts.createTextSpan(lineInfo.offset, len);
+ };
+ ScriptInfo.prototype.lineOffsetToPosition = function (line, offset) {
+ var index = this.snap().index;
+ var lineInfo = index.lineNumberToInfo(line);
+ return (lineInfo.offset + offset - 1);
+ };
+ ScriptInfo.prototype.positionToLineOffset = function (position) {
+ var index = this.snap().index;
+ var lineOffset = index.charOffsetToLineNumberAndPos(position);
+ return { line: lineOffset.line, offset: lineOffset.offset + 1 };
+ };
+ return ScriptInfo;
+ }());
+ server.ScriptInfo = ScriptInfo;
+ })(server = ts.server || (ts.server = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var server;
+ (function (server) {
+ var LSHost = (function () {
+ function LSHost(host, project, cancellationToken) {
+ var _this = this;
+ this.host = host;
+ this.project = project;
+ this.cancellationToken = cancellationToken;
+ this.getCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);
+ this.resolvedModuleNames = ts.createFileMap();
+ this.resolvedTypeReferenceDirectives = ts.createFileMap();
+ if (host.trace) {
+ this.trace = function (s) { return host.trace(s); };
+ }
+ this.resolveModuleName = function (moduleName, containingFile, compilerOptions, host) {
+ var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host);
+ if (primaryResult.resolvedModule) {
+ if (ts.fileExtensionIsAny(primaryResult.resolvedModule.resolvedFileName, ts.supportedTypeScriptExtensions)) {
+ return primaryResult;
+ }
+ }
+ var secondaryLookupFailedLookupLocations = [];
+ var globalCache = _this.project.projectService.typingsInstaller.globalTypingsCacheLocation;
+ if (_this.project.getTypingOptions().enableAutoDiscovery && globalCache) {
+ var traceEnabled = ts.isTraceEnabled(compilerOptions, host);
+ if (traceEnabled) {
+ ts.trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, _this.project.getProjectName(), moduleName, globalCache);
+ }
+ var state = { compilerOptions: compilerOptions, host: host, skipTsx: false, traceEnabled: traceEnabled };
+ var resolvedName = ts.loadModuleFromNodeModules(moduleName, globalCache, secondaryLookupFailedLookupLocations, state, true);
+ if (resolvedName) {
+ return ts.createResolvedModule(resolvedName, true, primaryResult.failedLookupLocations.concat(secondaryLookupFailedLookupLocations));
+ }
+ }
+ if (!primaryResult.resolvedModule && secondaryLookupFailedLookupLocations.length) {
+ primaryResult.failedLookupLocations = primaryResult.failedLookupLocations.concat(secondaryLookupFailedLookupLocations);
+ }
+ return primaryResult;
+ };
+ }
+ LSHost.prototype.resolveNamesWithLocalCache = function (names, containingFile, cache, loader, getResult) {
+ var path = ts.toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName);
+ var currentResolutionsInFile = cache.get(path);
+ var newResolutions = ts.createMap();
+ var resolvedModules = [];
+ var compilerOptions = this.getCompilationSettings();
+ var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName;
+ for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
+ var name_52 = names_3[_i];
+ var resolution = newResolutions[name_52];
+ if (!resolution) {
+ var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_52];
+ if (moduleResolutionIsValid(existingResolution)) {
+ resolution = existingResolution;
+ }
+ else {
+ newResolutions[name_52] = resolution = loader(name_52, containingFile, compilerOptions, this);
+ }
+ }
+ ts.Debug.assert(resolution !== undefined);
+ resolvedModules.push(getResult(resolution));
+ }
+ cache.set(path, newResolutions);
+ return resolvedModules;
+ function moduleResolutionIsValid(resolution) {
+ if (!resolution) {
+ return false;
+ }
+ var result = getResult(resolution);
+ if (result) {
+ if (result.resolvedFileName && result.resolvedFileName === lastDeletedFileName) {
+ return false;
+ }
+ return true;
+ }
+ return resolution.failedLookupLocations.length === 0;
+ }
+ };
+ LSHost.prototype.getProjectVersion = function () {
+ return this.project.getProjectVersion();
+ };
+ LSHost.prototype.getCompilationSettings = function () {
+ return this.compilationSettings;
+ };
+ LSHost.prototype.useCaseSensitiveFileNames = function () {
+ return this.host.useCaseSensitiveFileNames;
+ };
+ LSHost.prototype.getCancellationToken = function () {
+ return this.cancellationToken;
+ };
+ LSHost.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) {
+ return this.resolveNamesWithLocalCache(typeDirectiveNames, containingFile, this.resolvedTypeReferenceDirectives, ts.resolveTypeReferenceDirective, function (m) { return m.resolvedTypeReferenceDirective; });
+ };
+ LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) {
+ return this.resolveNamesWithLocalCache(moduleNames, containingFile, this.resolvedModuleNames, this.resolveModuleName, function (m) { return m.resolvedModule; });
+ };
+ LSHost.prototype.getDefaultLibFileName = function () {
+ var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath()));
+ return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings));
+ };
+ LSHost.prototype.getScriptSnapshot = function (filename) {
+ var scriptInfo = this.project.getScriptInfoLSHost(filename);
+ if (scriptInfo) {
+ return scriptInfo.snap();
+ }
+ };
+ LSHost.prototype.getScriptFileNames = function () {
+ return this.project.getRootFilesLSHost();
+ };
+ LSHost.prototype.getTypeRootsVersion = function () {
+ return this.project.typesVersion;
+ };
+ LSHost.prototype.getScriptKind = function (fileName) {
+ var info = this.project.getScriptInfoLSHost(fileName);
+ return info && info.scriptKind;
+ };
+ LSHost.prototype.getScriptVersion = function (filename) {
+ var info = this.project.getScriptInfoLSHost(filename);
+ return info && info.getLatestVersion();
+ };
+ LSHost.prototype.getCurrentDirectory = function () {
+ return this.host.getCurrentDirectory();
+ };
+ LSHost.prototype.resolvePath = function (path) {
+ return this.host.resolvePath(path);
+ };
+ LSHost.prototype.fileExists = function (path) {
+ return this.host.fileExists(path);
+ };
+ LSHost.prototype.readFile = function (fileName) {
+ return this.host.readFile(fileName);
+ };
+ LSHost.prototype.directoryExists = function (path) {
+ return this.host.directoryExists(path);
+ };
+ LSHost.prototype.readDirectory = function (path, extensions, exclude, include) {
+ return this.host.readDirectory(path, extensions, exclude, include);
+ };
+ LSHost.prototype.getDirectories = function (path) {
+ return this.host.getDirectories(path);
+ };
+ LSHost.prototype.notifyFileRemoved = function (info) {
+ this.resolvedModuleNames.remove(info.path);
+ this.resolvedTypeReferenceDirectives.remove(info.path);
+ };
+ LSHost.prototype.setCompilationSettings = function (opt) {
+ this.compilationSettings = opt;
+ this.resolvedModuleNames.clear();
+ this.resolvedTypeReferenceDirectives.clear();
+ };
+ return LSHost;
+ }());
+ server.LSHost = LSHost;
+ })(server = ts.server || (ts.server = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var server;
+ (function (server) {
+ server.nullTypingsInstaller = {
+ enqueueInstallTypingsRequest: function () { },
+ attach: function () { },
+ onProjectClosed: function () { },
+ globalTypingsCacheLocation: undefined
+ };
+ var TypingsCacheEntry = (function () {
+ function TypingsCacheEntry() {
+ }
+ return TypingsCacheEntry;
+ }());
+ function setIsEqualTo(arr1, arr2) {
+ if (arr1 === arr2) {
+ return true;
+ }
+ if ((arr1 || server.emptyArray).length === 0 && (arr2 || server.emptyArray).length === 0) {
+ return true;
+ }
+ var set = ts.createMap();
+ var unique = 0;
+ for (var _i = 0, arr1_1 = arr1; _i < arr1_1.length; _i++) {
+ var v = arr1_1[_i];
+ if (set[v] !== true) {
+ set[v] = true;
+ unique++;
+ }
+ }
+ for (var _a = 0, arr2_1 = arr2; _a < arr2_1.length; _a++) {
+ var v = arr2_1[_a];
+ if (!ts.hasProperty(set, v)) {
+ return false;
+ }
+ if (set[v] === true) {
+ set[v] = false;
+ unique--;
+ }
+ }
+ return unique === 0;
+ }
+ function typingOptionsChanged(opt1, opt2) {
+ return opt1.enableAutoDiscovery !== opt2.enableAutoDiscovery ||
+ !setIsEqualTo(opt1.include, opt2.include) ||
+ !setIsEqualTo(opt1.exclude, opt2.exclude);
+ }
+ function compilerOptionsChanged(opt1, opt2) {
+ return opt1.allowJs != opt2.allowJs;
+ }
+ function toTypingsArray(arr) {
+ arr.sort();
+ return arr;
+ }
+ var TypingsCache = (function () {
+ function TypingsCache(installer) {
+ this.installer = installer;
+ this.perProjectCache = ts.createMap();
+ }
+ TypingsCache.prototype.getTypingsForProject = function (project, forceRefresh) {
+ var typingOptions = project.getTypingOptions();
+ if (!typingOptions || !typingOptions.enableAutoDiscovery) {
+ return server.emptyArray;
+ }
+ var entry = this.perProjectCache[project.getProjectName()];
+ var result = entry ? entry.typings : server.emptyArray;
+ if (forceRefresh || !entry || typingOptionsChanged(typingOptions, entry.typingOptions) || compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions)) {
+ this.perProjectCache[project.getProjectName()] = {
+ compilerOptions: project.getCompilerOptions(),
+ typingOptions: typingOptions,
+ typings: result,
+ poisoned: true
+ };
+ this.installer.enqueueInstallTypingsRequest(project, typingOptions);
+ }
+ return result;
+ };
+ TypingsCache.prototype.invalidateCachedTypingsForProject = function (project) {
+ var typingOptions = project.getTypingOptions();
+ if (!typingOptions.enableAutoDiscovery) {
+ return;
+ }
+ this.installer.enqueueInstallTypingsRequest(project, typingOptions);
+ };
+ TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typingOptions, newTypings) {
+ this.perProjectCache[projectName] = {
+ compilerOptions: compilerOptions,
+ typingOptions: typingOptions,
+ typings: toTypingsArray(newTypings),
+ poisoned: false
+ };
+ };
+ TypingsCache.prototype.onProjectClosed = function (project) {
+ delete this.perProjectCache[project.getProjectName()];
+ this.installer.onProjectClosed(project);
+ };
+ return TypingsCache;
+ }());
+ server.TypingsCache = TypingsCache;
+ })(server = ts.server || (ts.server = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var server;
+ (function (server) {
+ var crypto = require("crypto");
+ function shouldEmitFile(scriptInfo) {
+ return !scriptInfo.hasMixedContent;
+ }
+ server.shouldEmitFile = shouldEmitFile;
+ var BuilderFileInfo = (function () {
+ function BuilderFileInfo(scriptInfo, project) {
+ this.scriptInfo = scriptInfo;
+ this.project = project;
+ }
+ BuilderFileInfo.prototype.isExternalModuleOrHasOnlyAmbientExternalModules = function () {
+ var sourceFile = this.getSourceFile();
+ return ts.isExternalModule(sourceFile) || this.containsOnlyAmbientModules(sourceFile);
+ };
+ BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) {
+ for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
+ var statement = _a[_i];
+ if (statement.kind !== 226 || statement.name.kind !== 9) {
+ return false;
+ }
+ }
+ return true;
+ };
+ BuilderFileInfo.prototype.computeHash = function (text) {
+ return crypto.createHash("md5")
+ .update(text)
+ .digest("base64");
+ };
+ BuilderFileInfo.prototype.getSourceFile = function () {
+ return this.project.getSourceFile(this.scriptInfo.path);
+ };
+ BuilderFileInfo.prototype.updateShapeSignature = function () {
+ var sourceFile = this.getSourceFile();
+ if (!sourceFile) {
+ return true;
+ }
+ var lastSignature = this.lastCheckedShapeSignature;
+ if (sourceFile.isDeclarationFile) {
+ this.lastCheckedShapeSignature = this.computeHash(sourceFile.text);
+ }
+ else {
+ var emitOutput = this.project.getFileEmitOutput(this.scriptInfo, true);
+ if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) {
+ this.lastCheckedShapeSignature = this.computeHash(emitOutput.outputFiles[0].text);
+ }
+ }
+ return !lastSignature || this.lastCheckedShapeSignature !== lastSignature;
+ };
+ return BuilderFileInfo;
+ }());
+ server.BuilderFileInfo = BuilderFileInfo;
+ var AbstractBuilder = (function () {
+ function AbstractBuilder(project, ctor) {
+ this.project = project;
+ this.ctor = ctor;
+ this.fileInfos = ts.createFileMap();
+ }
+ AbstractBuilder.prototype.getFileInfo = function (path) {
+ return this.fileInfos.get(path);
+ };
+ AbstractBuilder.prototype.getOrCreateFileInfo = function (path) {
+ var fileInfo = this.getFileInfo(path);
+ if (!fileInfo) {
+ var scriptInfo = this.project.getScriptInfo(path);
+ fileInfo = new this.ctor(scriptInfo, this.project);
+ this.setFileInfo(path, fileInfo);
+ }
+ return fileInfo;
+ };
+ AbstractBuilder.prototype.getFileInfoPaths = function () {
+ return this.fileInfos.getKeys();
+ };
+ AbstractBuilder.prototype.setFileInfo = function (path, info) {
+ this.fileInfos.set(path, info);
+ };
+ AbstractBuilder.prototype.removeFileInfo = function (path) {
+ this.fileInfos.remove(path);
+ };
+ AbstractBuilder.prototype.forEachFileInfo = function (action) {
+ this.fileInfos.forEachValue(function (_path, value) { return action(value); });
+ };
+ AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) {
+ var fileInfo = this.getFileInfo(scriptInfo.path);
+ if (!fileInfo) {
+ return false;
+ }
+ var _a = this.project.getFileEmitOutput(fileInfo.scriptInfo, false), emitSkipped = _a.emitSkipped, outputFiles = _a.outputFiles;
+ if (!emitSkipped) {
+ var projectRootPath = this.project.getProjectRootPath();
+ for (var _i = 0, outputFiles_1 = outputFiles; _i < outputFiles_1.length; _i++) {
+ var outputFile = outputFiles_1[_i];
+ var outputFileAbsoluteFileName = ts.getNormalizedAbsolutePath(outputFile.name, projectRootPath ? projectRootPath : ts.getDirectoryPath(scriptInfo.fileName));
+ writeFile(outputFileAbsoluteFileName, outputFile.text, outputFile.writeByteOrderMark);
+ }
+ }
+ return !emitSkipped;
+ };
+ return AbstractBuilder;
+ }());
+ var NonModuleBuilder = (function (_super) {
+ __extends(NonModuleBuilder, _super);
+ function NonModuleBuilder(project) {
+ var _this = _super.call(this, project, BuilderFileInfo) || this;
+ _this.project = project;
+ return _this;
+ }
+ NonModuleBuilder.prototype.onProjectUpdateGraph = function () {
+ };
+ NonModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) {
+ var info = this.getOrCreateFileInfo(scriptInfo.path);
+ var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName];
+ if (info.updateShapeSignature()) {
+ var options = this.project.getCompilerOptions();
+ if (options && (options.out || options.outFile)) {
+ return singleFileResult;
+ }
+ return this.project.getAllEmittableFiles();
+ }
+ return singleFileResult;
+ };
+ return NonModuleBuilder;
+ }(AbstractBuilder));
+ var ModuleBuilderFileInfo = (function (_super) {
+ __extends(ModuleBuilderFileInfo, _super);
+ function ModuleBuilderFileInfo() {
+ var _this = _super.apply(this, arguments) || this;
+ _this.references = [];
+ _this.referencedBy = [];
+ return _this;
+ }
+ ModuleBuilderFileInfo.compareFileInfos = function (lf, rf) {
+ var l = lf.scriptInfo.fileName;
+ var r = rf.scriptInfo.fileName;
+ return (l < r ? -1 : (l > r ? 1 : 0));
+ };
+ ;
+ ModuleBuilderFileInfo.addToReferenceList = function (array, fileInfo) {
+ if (array.length === 0) {
+ array.push(fileInfo);
+ return;
+ }
+ var insertIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos);
+ if (insertIndex < 0) {
+ array.splice(~insertIndex, 0, fileInfo);
+ }
+ };
+ ModuleBuilderFileInfo.removeFromReferenceList = function (array, fileInfo) {
+ if (!array || array.length === 0) {
+ return;
+ }
+ if (array[0] === fileInfo) {
+ array.splice(0, 1);
+ return;
+ }
+ var removeIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos);
+ if (removeIndex >= 0) {
+ array.splice(removeIndex, 1);
+ }
+ };
+ ModuleBuilderFileInfo.prototype.addReferencedBy = function (fileInfo) {
+ ModuleBuilderFileInfo.addToReferenceList(this.referencedBy, fileInfo);
+ };
+ ModuleBuilderFileInfo.prototype.removeReferencedBy = function (fileInfo) {
+ ModuleBuilderFileInfo.removeFromReferenceList(this.referencedBy, fileInfo);
+ };
+ ModuleBuilderFileInfo.prototype.removeFileReferences = function () {
+ for (var _i = 0, _a = this.references; _i < _a.length; _i++) {
+ var reference = _a[_i];
+ reference.removeReferencedBy(this);
+ }
+ this.references = [];
+ };
+ return ModuleBuilderFileInfo;
+ }(BuilderFileInfo));
+ var ModuleBuilder = (function (_super) {
+ __extends(ModuleBuilder, _super);
+ function ModuleBuilder(project) {
+ var _this = _super.call(this, project, ModuleBuilderFileInfo) || this;
+ _this.project = project;
+ return _this;
+ }
+ ModuleBuilder.prototype.getReferencedFileInfos = function (fileInfo) {
+ var _this = this;
+ if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) {
+ return [];
+ }
+ var referencedFilePaths = this.project.getReferencedFiles(fileInfo.scriptInfo.path);
+ if (referencedFilePaths.length > 0) {
+ return ts.map(referencedFilePaths, function (f) { return _this.getOrCreateFileInfo(f); }).sort(ModuleBuilderFileInfo.compareFileInfos);
+ }
+ return [];
+ };
+ ModuleBuilder.prototype.onProjectUpdateGraph = function () {
+ this.ensureProjectDependencyGraphUpToDate();
+ };
+ ModuleBuilder.prototype.ensureProjectDependencyGraphUpToDate = function () {
+ var _this = this;
+ if (!this.projectVersionForDependencyGraph || this.project.getProjectVersion() !== this.projectVersionForDependencyGraph) {
+ var currentScriptInfos = this.project.getScriptInfos();
+ for (var _i = 0, currentScriptInfos_1 = currentScriptInfos; _i < currentScriptInfos_1.length; _i++) {
+ var scriptInfo = currentScriptInfos_1[_i];
+ var fileInfo = this.getOrCreateFileInfo(scriptInfo.path);
+ this.updateFileReferences(fileInfo);
+ }
+ this.forEachFileInfo(function (fileInfo) {
+ if (!_this.project.containsScriptInfo(fileInfo.scriptInfo)) {
+ fileInfo.removeFileReferences();
+ _this.removeFileInfo(fileInfo.scriptInfo.path);
+ }
+ });
+ this.projectVersionForDependencyGraph = this.project.getProjectVersion();
+ }
+ };
+ ModuleBuilder.prototype.updateFileReferences = function (fileInfo) {
+ if (fileInfo.scriptVersionForReferences === fileInfo.scriptInfo.getLatestVersion()) {
+ return;
+ }
+ var newReferences = this.getReferencedFileInfos(fileInfo);
+ var oldReferences = fileInfo.references;
+ var oldIndex = 0;
+ var newIndex = 0;
+ while (oldIndex < oldReferences.length && newIndex < newReferences.length) {
+ var oldReference = oldReferences[oldIndex];
+ var newReference = newReferences[newIndex];
+ var compare = ModuleBuilderFileInfo.compareFileInfos(oldReference, newReference);
+ if (compare < 0) {
+ oldReference.removeReferencedBy(fileInfo);
+ oldIndex++;
+ }
+ else if (compare > 0) {
+ newReference.addReferencedBy(fileInfo);
+ newIndex++;
+ }
+ else {
+ oldIndex++;
+ newIndex++;
+ }
+ }
+ for (var i = oldIndex; i < oldReferences.length; i++) {
+ oldReferences[i].removeReferencedBy(fileInfo);
+ }
+ for (var i = newIndex; i < newReferences.length; i++) {
+ newReferences[i].addReferencedBy(fileInfo);
+ }
+ fileInfo.references = newReferences;
+ fileInfo.scriptVersionForReferences = fileInfo.scriptInfo.getLatestVersion();
+ };
+ ModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) {
+ this.ensureProjectDependencyGraphUpToDate();
+ var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName];
+ var fileInfo = this.getFileInfo(scriptInfo.path);
+ if (!fileInfo || !fileInfo.updateShapeSignature()) {
+ return singleFileResult;
+ }
+ if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) {
+ return this.project.getAllEmittableFiles();
+ }
+ var options = this.project.getCompilerOptions();
+ if (options && (options.isolatedModules || options.out || options.outFile)) {
+ return singleFileResult;
+ }
+ var queue = fileInfo.referencedBy.slice(0);
+ var fileNameSet = ts.createMap();
+ fileNameSet[scriptInfo.fileName] = scriptInfo;
+ while (queue.length > 0) {
+ var processingFileInfo = queue.pop();
+ if (processingFileInfo.updateShapeSignature() && processingFileInfo.referencedBy.length > 0) {
+ for (var _i = 0, _a = processingFileInfo.referencedBy; _i < _a.length; _i++) {
+ var potentialFileInfo = _a[_i];
+ if (!fileNameSet[potentialFileInfo.scriptInfo.fileName]) {
+ queue.push(potentialFileInfo);
+ }
+ }
+ }
+ fileNameSet[processingFileInfo.scriptInfo.fileName] = processingFileInfo.scriptInfo;
+ }
+ var result = [];
+ for (var fileName in fileNameSet) {
+ if (shouldEmitFile(fileNameSet[fileName])) {
+ result.push(fileName);
+ }
+ }
+ return result;
+ };
+ return ModuleBuilder;
+ }(AbstractBuilder));
+ function createBuilder(project) {
+ var moduleKind = project.getCompilerOptions().module;
+ switch (moduleKind) {
+ case ts.ModuleKind.None:
+ return new NonModuleBuilder(project);
+ default:
+ return new ModuleBuilder(project);
+ }
+ }
+ server.createBuilder = createBuilder;
+ })(server = ts.server || (ts.server = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var server;
+ (function (server) {
+ (function (ProjectKind) {
+ ProjectKind[ProjectKind["Inferred"] = 0] = "Inferred";
+ ProjectKind[ProjectKind["Configured"] = 1] = "Configured";
+ ProjectKind[ProjectKind["External"] = 2] = "External";
+ })(server.ProjectKind || (server.ProjectKind = {}));
+ var ProjectKind = server.ProjectKind;
+ function remove(items, item) {
+ var index = items.indexOf(item);
+ if (index >= 0) {
+ items.splice(index, 1);
+ }
+ }
+ function countEachFileTypes(infos) {
+ var result = { js: 0, jsx: 0, ts: 0, tsx: 0, dts: 0 };
+ for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
+ var info = infos_1[_i];
+ switch (info.scriptKind) {
+ case 1:
+ result.js += 1;
+ break;
+ case 2:
+ result.jsx += 1;
+ break;
+ case 3:
+ ts.fileExtensionIs(info.fileName, ".d.ts")
+ ? result.dts += 1
+ : result.ts += 1;
+ break;
+ case 4:
+ result.tsx += 1;
+ break;
+ }
+ }
+ return result;
+ }
+ function hasOneOrMoreJsAndNoTsFiles(project) {
+ var counts = countEachFileTypes(project.getScriptInfos());
+ return counts.js > 0 && counts.ts === 0 && counts.tsx === 0;
+ }
+ function allRootFilesAreJsOrDts(project) {
+ var counts = countEachFileTypes(project.getRootScriptInfos());
+ return counts.ts === 0 && counts.tsx === 0;
+ }
+ server.allRootFilesAreJsOrDts = allRootFilesAreJsOrDts;
+ function allFilesAreJsOrDts(project) {
+ var counts = countEachFileTypes(project.getScriptInfos());
+ return counts.ts === 0 && counts.tsx === 0;
+ }
+ server.allFilesAreJsOrDts = allFilesAreJsOrDts;
+ var Project = (function () {
+ function Project(projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) {
+ this.projectKind = projectKind;
+ this.projectService = projectService;
+ this.documentRegistry = documentRegistry;
+ this.languageServiceEnabled = languageServiceEnabled;
+ this.compilerOptions = compilerOptions;
+ this.compileOnSaveEnabled = compileOnSaveEnabled;
+ this.rootFiles = [];
+ this.rootFilesMap = ts.createFileMap();
+ this.lastReportedVersion = 0;
+ this.projectStructureVersion = 0;
+ this.projectStateVersion = 0;
+ this.typesVersion = 0;
+ if (!this.compilerOptions) {
+ this.compilerOptions = ts.getDefaultCompilerOptions();
+ this.compilerOptions.allowNonTsExtensions = true;
+ this.compilerOptions.allowJs = true;
+ }
+ else if (hasExplicitListOfFiles) {
+ this.compilerOptions.allowNonTsExtensions = true;
+ }
+ if (languageServiceEnabled) {
+ this.enableLanguageService();
+ }
+ else {
+ this.disableLanguageService();
+ }
+ this.builder = server.createBuilder(this);
+ this.markAsDirty();
+ }
+ Project.prototype.isNonTsProject = function () {
+ this.updateGraph();
+ return allFilesAreJsOrDts(this);
+ };
+ Project.prototype.isJsOnlyProject = function () {
+ this.updateGraph();
+ return hasOneOrMoreJsAndNoTsFiles(this);
+ };
+ Project.prototype.getProjectErrors = function () {
+ return this.projectErrors;
+ };
+ Project.prototype.getLanguageService = function (ensureSynchronized) {
+ if (ensureSynchronized === void 0) { ensureSynchronized = true; }
+ if (ensureSynchronized) {
+ this.updateGraph();
+ }
+ return this.languageService;
+ };
+ Project.prototype.getCompileOnSaveAffectedFileList = function (scriptInfo) {
+ if (!this.languageServiceEnabled) {
+ return [];
+ }
+ this.updateGraph();
+ return this.builder.getFilesAffectedBy(scriptInfo);
+ };
+ Project.prototype.getProjectVersion = function () {
+ return this.projectStateVersion.toString();
+ };
+ Project.prototype.enableLanguageService = function () {
+ var lsHost = new server.LSHost(this.projectService.host, this, this.projectService.cancellationToken);
+ lsHost.setCompilationSettings(this.compilerOptions);
+ this.languageService = ts.createLanguageService(lsHost, this.documentRegistry);
+ this.lsHost = lsHost;
+ this.languageServiceEnabled = true;
+ };
+ Project.prototype.disableLanguageService = function () {
+ this.languageService = server.nullLanguageService;
+ this.lsHost = server.nullLanguageServiceHost;
+ this.languageServiceEnabled = false;
+ };
+ Project.prototype.getSourceFile = function (path) {
+ if (!this.program) {
+ return undefined;
+ }
+ return this.program.getSourceFileByPath(path);
+ };
+ Project.prototype.updateTypes = function () {
+ this.typesVersion++;
+ this.markAsDirty();
+ this.updateGraph();
+ };
+ Project.prototype.close = function () {
+ if (this.program) {
+ for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) {
+ var f = _a[_i];
+ var info = this.projectService.getScriptInfo(f.fileName);
+ info.detachFromProject(this);
+ }
+ }
+ else {
+ for (var _b = 0, _c = this.rootFiles; _b < _c.length; _b++) {
+ var root = _c[_b];
+ root.detachFromProject(this);
+ }
+ }
+ this.rootFiles = undefined;
+ this.rootFilesMap = undefined;
+ this.program = undefined;
+ this.languageService.dispose();
+ };
+ Project.prototype.getCompilerOptions = function () {
+ return this.compilerOptions;
+ };
+ Project.prototype.hasRoots = function () {
+ return this.rootFiles && this.rootFiles.length > 0;
+ };
+ Project.prototype.getRootFiles = function () {
+ return this.rootFiles && this.rootFiles.map(function (info) { return info.fileName; });
+ };
+ Project.prototype.getRootFilesLSHost = function () {
+ var result = [];
+ if (this.rootFiles) {
+ for (var _i = 0, _a = this.rootFiles; _i < _a.length; _i++) {
+ var f = _a[_i];
+ result.push(f.fileName);
+ }
+ if (this.typingFiles) {
+ for (var _b = 0, _c = this.typingFiles; _b < _c.length; _b++) {
+ var f = _c[_b];
+ result.push(f);
+ }
+ }
+ }
+ return result;
+ };
+ Project.prototype.getRootScriptInfos = function () {
+ return this.rootFiles;
+ };
+ Project.prototype.getScriptInfos = function () {
+ var _this = this;
+ return ts.map(this.program.getSourceFiles(), function (sourceFile) {
+ var scriptInfo = _this.projectService.getScriptInfoForPath(sourceFile.path);
+ if (!scriptInfo) {
+ ts.Debug.assert(false, "scriptInfo for a file '" + sourceFile.fileName + "' is missing.");
+ }
+ return scriptInfo;
+ });
+ };
+ Project.prototype.getFileEmitOutput = function (info, emitOnlyDtsFiles) {
+ if (!this.languageServiceEnabled) {
+ return undefined;
+ }
+ return this.getLanguageService().getEmitOutput(info.fileName, emitOnlyDtsFiles);
+ };
+ Project.prototype.getFileNames = function () {
+ if (!this.program) {
+ return [];
+ }
+ if (!this.languageServiceEnabled) {
+ var rootFiles = this.getRootFiles();
+ if (this.compilerOptions) {
+ var defaultLibrary = ts.getDefaultLibFilePath(this.compilerOptions);
+ if (defaultLibrary) {
+ (rootFiles || (rootFiles = [])).push(server.asNormalizedPath(defaultLibrary));
+ }
+ }
+ return rootFiles;
+ }
+ var sourceFiles = this.program.getSourceFiles();
+ return sourceFiles.map(function (sourceFile) { return server.asNormalizedPath(sourceFile.fileName); });
+ };
+ Project.prototype.getAllEmittableFiles = function () {
+ if (!this.languageServiceEnabled) {
+ return [];
+ }
+ var defaultLibraryFileName = ts.getDefaultLibFileName(this.compilerOptions);
+ var infos = this.getScriptInfos();
+ var result = [];
+ for (var _i = 0, infos_2 = infos; _i < infos_2.length; _i++) {
+ var info = infos_2[_i];
+ if (ts.getBaseFileName(info.fileName) !== defaultLibraryFileName && server.shouldEmitFile(info)) {
+ result.push(info.fileName);
+ }
+ }
+ return result;
+ };
+ Project.prototype.containsScriptInfo = function (info) {
+ return this.isRoot(info) || (this.program && this.program.getSourceFileByPath(info.path) !== undefined);
+ };
+ Project.prototype.containsFile = function (filename, requireOpen) {
+ var info = this.projectService.getScriptInfoForNormalizedPath(filename);
+ if (info && (info.isOpen || !requireOpen)) {
+ return this.containsScriptInfo(info);
+ }
+ };
+ Project.prototype.isRoot = function (info) {
+ return this.rootFilesMap && this.rootFilesMap.contains(info.path);
+ };
+ Project.prototype.addRoot = function (info) {
+ if (!this.isRoot(info)) {
+ this.rootFiles.push(info);
+ this.rootFilesMap.set(info.path, info);
+ info.attachToProject(this);
+ this.markAsDirty();
+ }
+ };
+ Project.prototype.removeFile = function (info, detachFromProject) {
+ if (detachFromProject === void 0) { detachFromProject = true; }
+ this.removeRootFileIfNecessary(info);
+ this.lsHost.notifyFileRemoved(info);
+ if (detachFromProject) {
+ info.detachFromProject(this);
+ }
+ this.markAsDirty();
+ };
+ Project.prototype.markAsDirty = function () {
+ this.projectStateVersion++;
+ };
+ Project.prototype.updateGraph = function () {
+ if (!this.languageServiceEnabled) {
+ return true;
+ }
+ var hasChanges = this.updateGraphWorker();
+ var cachedTypings = this.projectService.typingsCache.getTypingsForProject(this, hasChanges);
+ if (this.setTypings(cachedTypings)) {
+ hasChanges = this.updateGraphWorker() || hasChanges;
+ }
+ if (hasChanges) {
+ this.projectStructureVersion++;
+ }
+ return !hasChanges;
+ };
+ Project.prototype.setTypings = function (typings) {
+ if (ts.arrayIsEqualTo(this.typingFiles, typings)) {
+ return false;
+ }
+ this.typingFiles = typings;
+ this.markAsDirty();
+ return true;
+ };
+ Project.prototype.updateGraphWorker = function () {
+ var oldProgram = this.program;
+ this.program = this.languageService.getProgram();
+ var hasChanges = false;
+ if (!oldProgram || (this.program !== oldProgram && !oldProgram.structureIsReused)) {
+ hasChanges = true;
+ if (oldProgram) {
+ for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) {
+ var f = _a[_i];
+ if (this.program.getSourceFileByPath(f.path)) {
+ continue;
+ }
+ var scriptInfoToDetach = this.projectService.getScriptInfo(f.fileName);
+ if (scriptInfoToDetach) {
+ scriptInfoToDetach.detachFromProject(this);
+ }
+ }
+ }
+ }
+ this.builder.onProjectUpdateGraph();
+ return hasChanges;
+ };
+ Project.prototype.getScriptInfoLSHost = function (fileName) {
+ var scriptInfo = this.projectService.getOrCreateScriptInfo(fileName, false);
+ if (scriptInfo) {
+ scriptInfo.attachToProject(this);
+ }
+ return scriptInfo;
+ };
+ Project.prototype.getScriptInfoForNormalizedPath = function (fileName) {
+ var scriptInfo = this.projectService.getOrCreateScriptInfoForNormalizedPath(fileName, false);
+ if (scriptInfo && !scriptInfo.isAttached(this)) {
+ return server.Errors.ThrowProjectDoesNotContainDocument(fileName, this);
+ }
+ return scriptInfo;
+ };
+ Project.prototype.getScriptInfo = function (uncheckedFileName) {
+ return this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName));
+ };
+ Project.prototype.filesToString = function () {
+ if (!this.program) {
+ return "";
+ }
+ var strBuilder = "";
+ for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) {
+ var file = _a[_i];
+ strBuilder += file.fileName + "\n";
+ }
+ return strBuilder;
+ };
+ Project.prototype.setCompilerOptions = function (compilerOptions) {
+ if (compilerOptions) {
+ if (this.projectKind === ProjectKind.Inferred) {
+ compilerOptions.allowJs = true;
+ }
+ compilerOptions.allowNonTsExtensions = true;
+ this.compilerOptions = compilerOptions;
+ this.lsHost.setCompilationSettings(compilerOptions);
+ this.markAsDirty();
+ }
+ };
+ Project.prototype.reloadScript = function (filename, tempFileName) {
+ var script = this.projectService.getScriptInfoForNormalizedPath(filename);
+ if (script) {
+ ts.Debug.assert(script.isAttached(this));
+ script.reloadFromFile(tempFileName);
+ return true;
+ }
+ return false;
+ };
+ Project.prototype.getChangesSinceVersion = function (lastKnownVersion) {
+ this.updateGraph();
+ var info = {
+ projectName: this.getProjectName(),
+ version: this.projectStructureVersion,
+ isInferred: this.projectKind === ProjectKind.Inferred,
+ options: this.getCompilerOptions()
+ };
+ if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) {
+ if (this.projectStructureVersion == this.lastReportedVersion) {
+ return { info: info, projectErrors: this.projectErrors };
+ }
+ var lastReportedFileNames = this.lastReportedFileNames;
+ var currentFiles = ts.arrayToMap(this.getFileNames(), function (x) { return x; });
+ var added = [];
+ var removed = [];
+ for (var id in currentFiles) {
+ if (!ts.hasProperty(lastReportedFileNames, id)) {
+ added.push(id);
+ }
+ }
+ for (var id in lastReportedFileNames) {
+ if (!ts.hasProperty(currentFiles, id)) {
+ removed.push(id);
+ }
+ }
+ this.lastReportedFileNames = currentFiles;
+ this.lastReportedVersion = this.projectStructureVersion;
+ return { info: info, changes: { added: added, removed: removed }, projectErrors: this.projectErrors };
+ }
+ else {
+ var projectFileNames = this.getFileNames();
+ this.lastReportedFileNames = ts.arrayToMap(projectFileNames, function (x) { return x; });
+ this.lastReportedVersion = this.projectStructureVersion;
+ return { info: info, files: projectFileNames, projectErrors: this.projectErrors };
+ }
+ };
+ Project.prototype.getReferencedFiles = function (path) {
+ var _this = this;
+ if (!this.languageServiceEnabled) {
+ return [];
+ }
+ var sourceFile = this.getSourceFile(path);
+ if (!sourceFile) {
+ return [];
+ }
+ var referencedFiles = ts.createMap();
+ if (sourceFile.imports && sourceFile.imports.length > 0) {
+ var checker = this.program.getTypeChecker();
+ for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {
+ var importName = _a[_i];
+ var symbol = checker.getSymbolAtLocation(importName);
+ if (symbol && symbol.declarations && symbol.declarations[0]) {
+ var declarationSourceFile = symbol.declarations[0].getSourceFile();
+ if (declarationSourceFile) {
+ referencedFiles[declarationSourceFile.path] = true;
+ }
+ }
+ }
+ }
+ var currentDirectory = ts.getDirectoryPath(path);
+ var getCanonicalFileName = ts.createGetCanonicalFileName(this.projectService.host.useCaseSensitiveFileNames);
+ if (sourceFile.referencedFiles && sourceFile.referencedFiles.length > 0) {
+ for (var _b = 0, _c = sourceFile.referencedFiles; _b < _c.length; _b++) {
+ var referencedFile = _c[_b];
+ var referencedPath = ts.toPath(referencedFile.fileName, currentDirectory, getCanonicalFileName);
+ referencedFiles[referencedPath] = true;
+ }
+ }
+ if (sourceFile.resolvedTypeReferenceDirectiveNames) {
+ for (var typeName in sourceFile.resolvedTypeReferenceDirectiveNames) {
+ var resolvedTypeReferenceDirective = sourceFile.resolvedTypeReferenceDirectiveNames[typeName];
+ if (!resolvedTypeReferenceDirective) {
+ continue;
+ }
+ var fileName = resolvedTypeReferenceDirective.resolvedFileName;
+ var typeFilePath = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
+ referencedFiles[typeFilePath] = true;
+ }
+ }
+ var allFileNames = ts.map(Object.keys(referencedFiles), function (key) { return key; });
+ return ts.filter(allFileNames, function (file) { return _this.projectService.host.fileExists(file); });
+ };
+ Project.prototype.removeRootFileIfNecessary = function (info) {
+ if (this.isRoot(info)) {
+ remove(this.rootFiles, info);
+ this.rootFilesMap.remove(info.path);
+ }
+ };
+ return Project;
+ }());
+ server.Project = Project;
+ var InferredProject = (function (_super) {
+ __extends(InferredProject, _super);
+ function InferredProject(projectService, documentRegistry, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) {
+ var _this = _super.call(this, ProjectKind.Inferred, projectService, documentRegistry, undefined, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
+ _this.compileOnSaveEnabled = compileOnSaveEnabled;
+ _this.directoriesWatchedForTsconfig = [];
+ _this.inferredProjectName = server.makeInferredProjectName(InferredProject.NextId);
+ InferredProject.NextId++;
+ return _this;
+ }
+ InferredProject.prototype.getProjectName = function () {
+ return this.inferredProjectName;
+ };
+ InferredProject.prototype.getProjectRootPath = function () {
+ if (this.projectService.useSingleInferredProject) {
+ return undefined;
+ }
+ var rootFiles = this.getRootFiles();
+ return ts.getDirectoryPath(rootFiles[0]);
+ };
+ InferredProject.prototype.close = function () {
+ _super.prototype.close.call(this);
+ for (var _i = 0, _a = this.directoriesWatchedForTsconfig; _i < _a.length; _i++) {
+ var directory = _a[_i];
+ this.projectService.stopWatchingDirectory(directory);
+ }
+ };
+ InferredProject.prototype.getTypingOptions = function () {
+ return {
+ enableAutoDiscovery: allRootFilesAreJsOrDts(this),
+ include: [],
+ exclude: []
+ };
+ };
+ return InferredProject;
+ }(Project));
+ InferredProject.NextId = 1;
+ server.InferredProject = InferredProject;
+ var ConfiguredProject = (function (_super) {
+ __extends(ConfiguredProject, _super);
+ function ConfiguredProject(configFileName, projectService, documentRegistry, hasExplicitListOfFiles, compilerOptions, wildcardDirectories, languageServiceEnabled, compileOnSaveEnabled) {
+ var _this = _super.call(this, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
+ _this.configFileName = configFileName;
+ _this.wildcardDirectories = wildcardDirectories;
+ _this.compileOnSaveEnabled = compileOnSaveEnabled;
+ _this.openRefCount = 0;
+ return _this;
+ }
+ ConfiguredProject.prototype.getProjectRootPath = function () {
+ return ts.getDirectoryPath(this.configFileName);
+ };
+ ConfiguredProject.prototype.setProjectErrors = function (projectErrors) {
+ this.projectErrors = projectErrors;
+ };
+ ConfiguredProject.prototype.setTypingOptions = function (newTypingOptions) {
+ this.typingOptions = newTypingOptions;
+ };
+ ConfiguredProject.prototype.getTypingOptions = function () {
+ return this.typingOptions;
+ };
+ ConfiguredProject.prototype.getProjectName = function () {
+ return this.configFileName;
+ };
+ ConfiguredProject.prototype.watchConfigFile = function (callback) {
+ var _this = this;
+ this.projectFileWatcher = this.projectService.host.watchFile(this.configFileName, function (_) { return callback(_this); });
+ };
+ ConfiguredProject.prototype.watchTypeRoots = function (callback) {
+ var _this = this;
+ var roots = this.getEffectiveTypeRoots();
+ var watchers = [];
+ for (var _i = 0, roots_1 = roots; _i < roots_1.length; _i++) {
+ var root = roots_1[_i];
+ this.projectService.logger.info("Add type root watcher for: " + root);
+ watchers.push(this.projectService.host.watchDirectory(root, function (path) { return callback(_this, path); }, false));
+ }
+ this.typeRootsWatchers = watchers;
+ };
+ ConfiguredProject.prototype.watchConfigDirectory = function (callback) {
+ var _this = this;
+ if (this.directoryWatcher) {
+ return;
+ }
+ var directoryToWatch = ts.getDirectoryPath(this.configFileName);
+ this.projectService.logger.info("Add recursive watcher for: " + directoryToWatch);
+ this.directoryWatcher = this.projectService.host.watchDirectory(directoryToWatch, function (path) { return callback(_this, path); }, true);
+ };
+ ConfiguredProject.prototype.watchWildcards = function (callback) {
+ var _this = this;
+ if (!this.wildcardDirectories) {
+ return;
+ }
+ var configDirectoryPath = ts.getDirectoryPath(this.configFileName);
+ this.directoriesWatchedForWildcards = ts.reduceProperties(this.wildcardDirectories, function (watchers, flag, directory) {
+ if (ts.comparePaths(configDirectoryPath, directory, ".", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) {
+ var recursive = (flag & 1) !== 0;
+ _this.projectService.logger.info("Add " + (recursive ? "recursive " : "") + "watcher for: " + directory);
+ watchers[directory] = _this.projectService.host.watchDirectory(directory, function (path) { return callback(_this, path); }, recursive);
+ }
+ return watchers;
+ }, {});
+ };
+ ConfiguredProject.prototype.stopWatchingDirectory = function () {
+ if (this.directoryWatcher) {
+ this.directoryWatcher.close();
+ this.directoryWatcher = undefined;
+ }
+ };
+ ConfiguredProject.prototype.close = function () {
+ _super.prototype.close.call(this);
+ if (this.projectFileWatcher) {
+ this.projectFileWatcher.close();
+ }
+ if (this.typeRootsWatchers) {
+ for (var _i = 0, _a = this.typeRootsWatchers; _i < _a.length; _i++) {
+ var watcher = _a[_i];
+ watcher.close();
+ }
+ this.typeRootsWatchers = undefined;
+ }
+ for (var id in this.directoriesWatchedForWildcards) {
+ this.directoriesWatchedForWildcards[id].close();
+ }
+ this.directoriesWatchedForWildcards = undefined;
+ this.stopWatchingDirectory();
+ };
+ ConfiguredProject.prototype.addOpenRef = function () {
+ this.openRefCount++;
+ };
+ ConfiguredProject.prototype.deleteOpenRef = function () {
+ this.openRefCount--;
+ return this.openRefCount;
+ };
+ ConfiguredProject.prototype.getEffectiveTypeRoots = function () {
+ return ts.getEffectiveTypeRoots(this.getCompilerOptions(), this.projectService.host) || [];
+ };
+ return ConfiguredProject;
+ }(Project));
+ server.ConfiguredProject = ConfiguredProject;
+ var ExternalProject = (function (_super) {
+ __extends(ExternalProject, _super);
+ function ExternalProject(externalProjectName, projectService, documentRegistry, compilerOptions, languageServiceEnabled, compileOnSaveEnabled, projectFilePath) {
+ var _this = _super.call(this, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
+ _this.externalProjectName = externalProjectName;
+ _this.compileOnSaveEnabled = compileOnSaveEnabled;
+ _this.projectFilePath = projectFilePath;
+ return _this;
+ }
+ ExternalProject.prototype.getProjectRootPath = function () {
+ if (this.projectFilePath) {
+ return ts.getDirectoryPath(this.projectFilePath);
+ }
+ return ts.getDirectoryPath(ts.normalizeSlashes(this.externalProjectName));
+ };
+ ExternalProject.prototype.getTypingOptions = function () {
+ return this.typingOptions;
+ };
+ ExternalProject.prototype.setProjectErrors = function (projectErrors) {
+ this.projectErrors = projectErrors;
+ };
+ ExternalProject.prototype.setTypingOptions = function (newTypingOptions) {
+ if (!newTypingOptions) {
+ newTypingOptions = {
+ enableAutoDiscovery: allRootFilesAreJsOrDts(this),
+ include: [],
+ exclude: []
+ };
+ }
+ else {
+ if (newTypingOptions.enableAutoDiscovery === undefined) {
+ newTypingOptions.enableAutoDiscovery = allRootFilesAreJsOrDts(this);
+ }
+ if (!newTypingOptions.include) {
+ newTypingOptions.include = [];
+ }
+ if (!newTypingOptions.exclude) {
+ newTypingOptions.exclude = [];
+ }
+ }
+ this.typingOptions = newTypingOptions;
+ };
+ ExternalProject.prototype.getProjectName = function () {
+ return this.externalProjectName;
+ };
+ return ExternalProject;
+ }(Project));
+ server.ExternalProject = ExternalProject;
+ })(server = ts.server || (ts.server = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var server;
+ (function (server) {
+ server.maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
+ function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions) {
+ var map = ts.createMap();
+ for (var _i = 0, commandLineOptions_1 = commandLineOptions; _i < commandLineOptions_1.length; _i++) {
+ var option = commandLineOptions_1[_i];
+ if (typeof option.type === "object") {
+ var optionMap = option.type;
+ for (var id in optionMap) {
+ ts.Debug.assert(typeof optionMap[id] === "number");
+ }
+ map[option.name] = optionMap;
+ }
+ }
+ return map;
+ }
+ var compilerOptionConverters = prepareConvertersForEnumLikeCompilerOptions(ts.optionDeclarations);
+ var indentStyle = ts.createMap({
+ "none": ts.IndentStyle.None,
+ "block": ts.IndentStyle.Block,
+ "smart": ts.IndentStyle.Smart
+ });
+ function convertFormatOptions(protocolOptions) {
+ if (typeof protocolOptions.indentStyle === "string") {
+ protocolOptions.indentStyle = indentStyle[protocolOptions.indentStyle.toLowerCase()];
+ ts.Debug.assert(protocolOptions.indentStyle !== undefined);
+ }
+ return protocolOptions;
+ }
+ server.convertFormatOptions = convertFormatOptions;
+ function convertCompilerOptions(protocolOptions) {
+ for (var id in compilerOptionConverters) {
+ var propertyValue = protocolOptions[id];
+ if (typeof propertyValue === "string") {
+ var mappedValues = compilerOptionConverters[id];
+ protocolOptions[id] = mappedValues[propertyValue.toLowerCase()];
+ }
+ }
+ return protocolOptions;
+ }
+ server.convertCompilerOptions = convertCompilerOptions;
+ function tryConvertScriptKindName(scriptKindName) {
+ return typeof scriptKindName === "string"
+ ? convertScriptKindName(scriptKindName)
+ : scriptKindName;
+ }
+ server.tryConvertScriptKindName = tryConvertScriptKindName;
+ function convertScriptKindName(scriptKindName) {
+ switch (scriptKindName) {
+ case "JS":
+ return 1;
+ case "JSX":
+ return 2;
+ case "TS":
+ return 3;
+ case "TSX":
+ return 4;
+ default:
+ return 0;
+ }
+ }
+ server.convertScriptKindName = convertScriptKindName;
+ function combineProjectOutput(projects, action, comparer, areEqual) {
+ var result = projects.reduce(function (previous, current) { return ts.concatenate(previous, action(current)); }, []).sort(comparer);
+ return projects.length > 1 ? ts.deduplicate(result, areEqual) : result;
+ }
+ server.combineProjectOutput = combineProjectOutput;
+ var fileNamePropertyReader = {
+ getFileName: function (x) { return x; },
+ getScriptKind: function (_) { return undefined; },
+ hasMixedContent: function (_) { return false; }
+ };
+ var externalFilePropertyReader = {
+ getFileName: function (x) { return x.fileName; },
+ getScriptKind: function (x) { return tryConvertScriptKindName(x.scriptKind); },
+ hasMixedContent: function (x) { return x.hasMixedContent; }
+ };
+ function findProjectByName(projectName, projects) {
+ for (var _i = 0, projects_1 = projects; _i < projects_1.length; _i++) {
+ var proj = projects_1[_i];
+ if (proj.getProjectName() === projectName) {
+ return proj;
+ }
+ }
+ }
+ function createFileNotFoundDiagnostic(fileName) {
+ return ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName);
+ }
+ function isRootFileInInferredProject(info) {
+ if (info.containingProjects.length === 0) {
+ return false;
+ }
+ return info.containingProjects[0].projectKind === server.ProjectKind.Inferred && info.containingProjects[0].isRoot(info);
+ }
+ var DirectoryWatchers = (function () {
+ function DirectoryWatchers(projectService) {
+ this.projectService = projectService;
+ this.directoryWatchersForTsconfig = ts.createMap();
+ this.directoryWatchersRefCount = ts.createMap();
+ }
+ DirectoryWatchers.prototype.stopWatchingDirectory = function (directory) {
+ this.directoryWatchersRefCount[directory]--;
+ if (this.directoryWatchersRefCount[directory] === 0) {
+ this.projectService.logger.info("Close directory watcher for: " + directory);
+ this.directoryWatchersForTsconfig[directory].close();
+ delete this.directoryWatchersForTsconfig[directory];
+ }
+ };
+ DirectoryWatchers.prototype.startWatchingContainingDirectoriesForFile = function (fileName, project, callback) {
+ var currentPath = ts.getDirectoryPath(fileName);
+ var parentPath = ts.getDirectoryPath(currentPath);
+ while (currentPath != parentPath) {
+ if (!this.directoryWatchersForTsconfig[currentPath]) {
+ this.projectService.logger.info("Add watcher for: " + currentPath);
+ this.directoryWatchersForTsconfig[currentPath] = this.projectService.host.watchDirectory(currentPath, callback);
+ this.directoryWatchersRefCount[currentPath] = 1;
+ }
+ else {
+ this.directoryWatchersRefCount[currentPath] += 1;
+ }
+ project.directoriesWatchedForTsconfig.push(currentPath);
+ currentPath = parentPath;
+ parentPath = ts.getDirectoryPath(parentPath);
+ }
+ };
+ return DirectoryWatchers;
+ }());
+ var ProjectService = (function () {
+ function ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, eventHandler) {
+ if (typingsInstaller === void 0) { typingsInstaller = server.nullTypingsInstaller; }
+ this.host = host;
+ this.logger = logger;
+ this.cancellationToken = cancellationToken;
+ this.useSingleInferredProject = useSingleInferredProject;
+ this.typingsInstaller = typingsInstaller;
+ this.eventHandler = eventHandler;
+ this.filenameToScriptInfo = ts.createFileMap();
+ this.externalProjectToConfiguredProjectMap = ts.createMap();
+ this.externalProjects = [];
+ this.inferredProjects = [];
+ this.configuredProjects = [];
+ this.openFiles = [];
+ this.toCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
+ this.directoryWatchers = new DirectoryWatchers(this);
+ this.throttledOperations = new server.ThrottledOperations(host);
+ this.typingsInstaller.attach(this);
+ this.typingsCache = new server.TypingsCache(this.typingsInstaller);
+ this.hostConfiguration = {
+ formatCodeOptions: server.getDefaultFormatCodeSettings(this.host),
+ hostInfo: "Unknown host"
+ };
+ this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory());
+ }
+ ProjectService.prototype.getChangedFiles_TestOnly = function () {
+ return this.changedFiles;
+ };
+ ProjectService.prototype.ensureInferredProjectsUpToDate_TestOnly = function () {
+ this.ensureInferredProjectsUpToDate();
+ };
+ ProjectService.prototype.getCompilerOptionsForInferredProjects = function () {
+ return this.compilerOptionsForInferredProjects;
+ };
+ ProjectService.prototype.updateTypingsForProject = function (response) {
+ var project = this.findProject(response.projectName);
+ if (!project) {
+ return;
+ }
+ switch (response.kind) {
+ case "set":
+ this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typingOptions, response.typings);
+ project.updateGraph();
+ break;
+ case "invalidate":
+ this.typingsCache.invalidateCachedTypingsForProject(project);
+ break;
+ }
+ };
+ ProjectService.prototype.setCompilerOptionsForInferredProjects = function (projectCompilerOptions) {
+ this.compilerOptionsForInferredProjects = convertCompilerOptions(projectCompilerOptions);
+ this.compileOnSaveForInferredProjects = projectCompilerOptions.compileOnSave;
+ for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) {
+ var proj = _a[_i];
+ proj.setCompilerOptions(this.compilerOptionsForInferredProjects);
+ proj.compileOnSaveEnabled = projectCompilerOptions.compileOnSave;
+ }
+ this.updateProjectGraphs(this.inferredProjects);
+ };
+ ProjectService.prototype.stopWatchingDirectory = function (directory) {
+ this.directoryWatchers.stopWatchingDirectory(directory);
+ };
+ ProjectService.prototype.findProject = function (projectName) {
+ if (projectName === undefined) {
+ return undefined;
+ }
+ if (server.isInferredProjectName(projectName)) {
+ this.ensureInferredProjectsUpToDate();
+ return findProjectByName(projectName, this.inferredProjects);
+ }
+ return this.findExternalProjectByProjectName(projectName) || this.findConfiguredProjectByProjectName(server.toNormalizedPath(projectName));
+ };
+ ProjectService.prototype.getDefaultProjectForFile = function (fileName, refreshInferredProjects) {
+ if (refreshInferredProjects) {
+ this.ensureInferredProjectsUpToDate();
+ }
+ var scriptInfo = this.getScriptInfoForNormalizedPath(fileName);
+ return scriptInfo && scriptInfo.getDefaultProject();
+ };
+ ProjectService.prototype.ensureInferredProjectsUpToDate = function () {
+ if (this.changedFiles) {
+ var projectsToUpdate = void 0;
+ if (this.changedFiles.length === 1) {
+ projectsToUpdate = this.changedFiles[0].containingProjects;
+ }
+ else {
+ projectsToUpdate = [];
+ for (var _i = 0, _a = this.changedFiles; _i < _a.length; _i++) {
+ var f = _a[_i];
+ projectsToUpdate = projectsToUpdate.concat(f.containingProjects);
+ }
+ }
+ this.updateProjectGraphs(projectsToUpdate);
+ this.changedFiles = undefined;
+ }
+ };
+ ProjectService.prototype.findContainingExternalProject = function (fileName) {
+ for (var _i = 0, _a = this.externalProjects; _i < _a.length; _i++) {
+ var proj = _a[_i];
+ if (proj.containsFile(fileName)) {
+ return proj;
+ }
+ }
+ return undefined;
+ };
+ ProjectService.prototype.getFormatCodeOptions = function (file) {
+ var formatCodeSettings;
+ if (file) {
+ var info = this.getScriptInfoForNormalizedPath(file);
+ if (info) {
+ formatCodeSettings = info.getFormatCodeSettings();
+ }
+ }
+ return formatCodeSettings || this.hostConfiguration.formatCodeOptions;
+ };
+ ProjectService.prototype.updateProjectGraphs = function (projects) {
+ var shouldRefreshInferredProjects = false;
+ for (var _i = 0, projects_2 = projects; _i < projects_2.length; _i++) {
+ var p = projects_2[_i];
+ if (!p.updateGraph()) {
+ shouldRefreshInferredProjects = true;
+ }
+ }
+ if (shouldRefreshInferredProjects) {
+ this.refreshInferredProjects();
+ }
+ };
+ ProjectService.prototype.onSourceFileChanged = function (fileName) {
+ var info = this.getScriptInfoForNormalizedPath(fileName);
+ if (!info) {
+ this.logger.info("Error: got watch notification for unknown file: " + fileName);
+ return;
+ }
+ if (!this.host.fileExists(fileName)) {
+ this.handleDeletedFile(info);
+ }
+ else {
+ if (info && (!info.isOpen)) {
+ info.reloadFromFile();
+ this.updateProjectGraphs(info.containingProjects);
+ }
+ }
+ };
+ ProjectService.prototype.handleDeletedFile = function (info) {
+ this.logger.info(info.fileName + " deleted");
+ info.stopWatcher();
+ if (!info.isOpen) {
+ this.filenameToScriptInfo.remove(info.path);
+ this.lastDeletedFile = info;
+ var containingProjects = info.containingProjects.slice();
+ info.detachAllProjects();
+ this.updateProjectGraphs(containingProjects);
+ this.lastDeletedFile = undefined;
+ if (!this.eventHandler) {
+ return;
+ }
+ for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {
+ var openFile = _a[_i];
+ this.eventHandler({ eventName: "context", data: { project: openFile.getDefaultProject(), fileName: openFile.fileName } });
+ }
+ }
+ this.printProjects();
+ };
+ ProjectService.prototype.onTypeRootFileChanged = function (project, fileName) {
+ var _this = this;
+ this.logger.info("Type root file " + fileName + " changed");
+ this.throttledOperations.schedule(project.configFileName + " * type root", 250, function () {
+ project.updateTypes();
+ _this.updateConfiguredProject(project);
+ _this.refreshInferredProjects();
+ });
+ };
+ ProjectService.prototype.onSourceFileInDirectoryChangedForConfiguredProject = function (project, fileName) {
+ var _this = this;
+ if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions())) {
+ return;
+ }
+ this.logger.info("Detected source file changes: " + fileName);
+ this.throttledOperations.schedule(project.configFileName, 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); });
+ };
+ ProjectService.prototype.handleChangeInSourceFileForConfiguredProject = function (project, triggerFile) {
+ var _this = this;
+ var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
+ this.reportConfigFileDiagnostics(project.getProjectName(), configFileErrors, triggerFile);
+ var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); }));
+ var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); }));
+ if (!ts.arrayIsEqualTo(currentRootFiles.sort(), newRootFiles.sort())) {
+ this.logger.info("Updating configured project");
+ this.updateConfiguredProject(project);
+ this.refreshInferredProjects();
+ }
+ };
+ ProjectService.prototype.onConfigChangedForConfiguredProject = function (project) {
+ this.logger.info("Config file changed: " + project.configFileName);
+ this.updateConfiguredProject(project);
+ this.refreshInferredProjects();
+ };
+ ProjectService.prototype.onConfigFileAddedForInferredProject = function (fileName) {
+ if (ts.getBaseFileName(fileName) != "tsconfig.json") {
+ this.logger.info(fileName + " is not tsconfig.json");
+ return;
+ }
+ var configFileErrors = this.convertConfigFileContentToProjectOptions(fileName).configFileErrors;
+ this.reportConfigFileDiagnostics(fileName, configFileErrors, fileName);
+ this.logger.info("Detected newly added tsconfig file: " + fileName);
+ this.reloadProjects();
+ };
+ ProjectService.prototype.getCanonicalFileName = function (fileName) {
+ var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
+ return ts.normalizePath(name);
+ };
+ ProjectService.prototype.removeProject = function (project) {
+ this.logger.info("remove project: " + project.getRootFiles().toString());
+ project.close();
+ switch (project.projectKind) {
+ case server.ProjectKind.External:
+ server.removeItemFromSet(this.externalProjects, project);
+ break;
+ case server.ProjectKind.Configured:
+ server.removeItemFromSet(this.configuredProjects, project);
+ break;
+ case server.ProjectKind.Inferred:
+ server.removeItemFromSet(this.inferredProjects, project);
+ break;
+ }
+ };
+ ProjectService.prototype.assignScriptInfoToInferredProjectIfNecessary = function (info, addToListOfOpenFiles) {
+ var externalProject = this.findContainingExternalProject(info.fileName);
+ if (externalProject) {
+ if (addToListOfOpenFiles) {
+ this.openFiles.push(info);
+ }
+ return;
+ }
+ var foundConfiguredProject = false;
+ for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) {
+ var p = _a[_i];
+ if (p.projectKind === server.ProjectKind.Configured) {
+ foundConfiguredProject = true;
+ if (addToListOfOpenFiles) {
+ (p).addOpenRef();
+ }
+ }
+ }
+ if (foundConfiguredProject) {
+ if (addToListOfOpenFiles) {
+ this.openFiles.push(info);
+ }
+ return;
+ }
+ if (info.containingProjects.length === 0) {
+ var inferredProject = this.createInferredProjectWithRootFileIfNecessary(info);
+ if (!this.useSingleInferredProject) {
+ for (var _b = 0, _c = this.openFiles; _b < _c.length; _b++) {
+ var f = _c[_b];
+ if (f.containingProjects.length === 0) {
+ continue;
+ }
+ var defaultProject = f.getDefaultProject();
+ if (isRootFileInInferredProject(info) && defaultProject !== inferredProject && inferredProject.containsScriptInfo(f)) {
+ this.removeProject(defaultProject);
+ f.attachToProject(inferredProject);
+ }
+ }
+ }
+ }
+ if (addToListOfOpenFiles) {
+ this.openFiles.push(info);
+ }
+ };
+ ProjectService.prototype.closeOpenFile = function (info) {
+ info.reloadFromFile();
+ server.removeItemFromSet(this.openFiles, info);
+ info.isOpen = false;
+ var projectsToRemove;
+ for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) {
+ var p = _a[_i];
+ if (p.projectKind === server.ProjectKind.Configured) {
+ if (p.deleteOpenRef() === 0) {
+ (projectsToRemove || (projectsToRemove = [])).push(p);
+ }
+ }
+ else if (p.projectKind === server.ProjectKind.Inferred && p.isRoot(info)) {
+ (projectsToRemove || (projectsToRemove = [])).push(p);
+ }
+ }
+ if (projectsToRemove) {
+ for (var _b = 0, projectsToRemove_1 = projectsToRemove; _b < projectsToRemove_1.length; _b++) {
+ var project = projectsToRemove_1[_b];
+ this.removeProject(project);
+ }
+ var orphanFiles = void 0;
+ for (var _c = 0, _d = this.openFiles; _c < _d.length; _c++) {
+ var f = _d[_c];
+ if (f.containingProjects.length === 0) {
+ (orphanFiles || (orphanFiles = [])).push(f);
+ }
+ }
+ if (orphanFiles) {
+ for (var _e = 0, orphanFiles_1 = orphanFiles; _e < orphanFiles_1.length; _e++) {
+ var f = orphanFiles_1[_e];
+ this.assignScriptInfoToInferredProjectIfNecessary(f, false);
+ }
+ }
+ }
+ if (info.containingProjects.length === 0) {
+ this.filenameToScriptInfo.remove(info.path);
+ }
+ };
+ ProjectService.prototype.openOrUpdateConfiguredProjectForFile = function (fileName) {
+ var searchPath = ts.getDirectoryPath(fileName);
+ this.logger.info("Search path: " + searchPath);
+ var configFileName = this.findConfigFile(server.asNormalizedPath(searchPath));
+ if (!configFileName) {
+ this.logger.info("No config files found.");
+ return {};
+ }
+ this.logger.info("Config file name: " + configFileName);
+ var project = this.findConfiguredProjectByProjectName(configFileName);
+ if (!project) {
+ var _a = this.openConfigFile(configFileName, fileName), success = _a.success, errors = _a.errors;
+ if (!success) {
+ return { configFileName: configFileName, configFileErrors: errors };
+ }
+ this.logger.info("Opened configuration file " + configFileName);
+ if (errors && errors.length > 0) {
+ return { configFileName: configFileName, configFileErrors: errors };
+ }
+ }
+ else {
+ this.updateConfiguredProject(project);
+ }
+ return { configFileName: configFileName };
+ };
+ ProjectService.prototype.findConfigFile = function (searchPath) {
+ while (true) {
+ var tsconfigFileName = server.asNormalizedPath(ts.combinePaths(searchPath, "tsconfig.json"));
+ if (this.host.fileExists(tsconfigFileName)) {
+ return tsconfigFileName;
+ }
+ var jsconfigFileName = server.asNormalizedPath(ts.combinePaths(searchPath, "jsconfig.json"));
+ if (this.host.fileExists(jsconfigFileName)) {
+ return jsconfigFileName;
+ }
+ var parentPath = server.asNormalizedPath(ts.getDirectoryPath(searchPath));
+ if (parentPath === searchPath) {
+ break;
+ }
+ searchPath = parentPath;
+ }
+ return undefined;
+ };
+ ProjectService.prototype.printProjects = function () {
+ if (!this.logger.hasLevel(server.LogLevel.verbose)) {
+ return;
+ }
+ this.logger.startGroup();
+ var counter = 0;
+ counter = printProjects(this.logger, this.externalProjects, counter);
+ counter = printProjects(this.logger, this.configuredProjects, counter);
+ counter = printProjects(this.logger, this.inferredProjects, counter);
+ this.logger.info("Open files: ");
+ for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {
+ var rootFile = _a[_i];
+ this.logger.info(rootFile.fileName);
+ }
+ this.logger.endGroup();
+ function printProjects(logger, projects, counter) {
+ for (var _i = 0, projects_3 = projects; _i < projects_3.length; _i++) {
+ var project = projects_3[_i];
+ project.updateGraph();
+ logger.info("Project '" + project.getProjectName() + "' (" + server.ProjectKind[project.projectKind] + ") " + counter);
+ logger.info(project.filesToString());
+ logger.info("-----------------------------------------------");
+ counter++;
+ }
+ return counter;
+ }
+ };
+ ProjectService.prototype.findConfiguredProjectByProjectName = function (configFileName) {
+ return findProjectByName(configFileName, this.configuredProjects);
+ };
+ ProjectService.prototype.findExternalProjectByProjectName = function (projectFileName) {
+ return findProjectByName(projectFileName, this.externalProjects);
+ };
+ ProjectService.prototype.convertConfigFileContentToProjectOptions = function (configFilename) {
+ configFilename = ts.normalizePath(configFilename);
+ var configFileContent = this.host.readFile(configFilename);
+ var errors;
+ var result = ts.parseConfigFileTextToJson(configFilename, configFileContent);
+ var config = result.config;
+ if (result.error) {
+ var _a = ts.sanitizeConfigFile(configFilename, configFileContent), sanitizedConfig = _a.configJsonObject, diagnostics = _a.diagnostics;
+ config = sanitizedConfig;
+ errors = diagnostics.length ? diagnostics : [result.error];
+ }
+ var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename);
+ if (parsedCommandLine.errors.length) {
+ errors = ts.concatenate(errors, parsedCommandLine.errors);
+ }
+ ts.Debug.assert(!!parsedCommandLine.fileNames);
+ if (parsedCommandLine.fileNames.length === 0) {
+ (errors || (errors = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename));
+ return { success: false, configFileErrors: errors };
+ }
+ var projectOptions = {
+ files: parsedCommandLine.fileNames,
+ compilerOptions: parsedCommandLine.options,
+ configHasFilesProperty: config["files"] !== undefined,
+ wildcardDirectories: ts.createMap(parsedCommandLine.wildcardDirectories),
+ typingOptions: parsedCommandLine.typingOptions,
+ compileOnSave: parsedCommandLine.compileOnSave
+ };
+ return { success: true, projectOptions: projectOptions, configFileErrors: errors };
+ };
+ ProjectService.prototype.exceededTotalSizeLimitForNonTsFiles = function (options, fileNames, propertyReader) {
+ if (options && options.disableSizeLimit || !this.host.getFileSize) {
+ return false;
+ }
+ var totalNonTsFileSize = 0;
+ for (var _i = 0, fileNames_3 = fileNames; _i < fileNames_3.length; _i++) {
+ var f = fileNames_3[_i];
+ var fileName = propertyReader.getFileName(f);
+ if (ts.hasTypeScriptFileExtension(fileName)) {
+ continue;
+ }
+ totalNonTsFileSize += this.host.getFileSize(fileName);
+ if (totalNonTsFileSize > server.maxProgramSizeForNonTsFiles) {
+ return true;
+ }
+ }
+ return false;
+ };
+ ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typingOptions) {
+ var compilerOptions = convertCompilerOptions(options);
+ var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave);
+ this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typingOptions, undefined);
+ this.externalProjects.push(project);
+ return project;
+ };
+ ProjectService.prototype.reportConfigFileDiagnostics = function (configFileName, diagnostics, triggerFile) {
+ if (!this.eventHandler) {
+ return;
+ }
+ this.eventHandler({
+ eventName: "configFileDiag",
+ data: { configFileName: configFileName, diagnostics: diagnostics || [], triggerFile: triggerFile }
+ });
+ };
+ ProjectService.prototype.createAndAddConfiguredProject = function (configFileName, projectOptions, configFileErrors, clientFileName) {
+ var _this = this;
+ var sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader);
+ var project = new server.ConfiguredProject(configFileName, this, this.documentRegistry, projectOptions.configHasFilesProperty, projectOptions.compilerOptions, projectOptions.wildcardDirectories, !sizeLimitExceeded, projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave);
+ this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typingOptions, configFileErrors);
+ project.watchConfigFile(function (project) { return _this.onConfigChangedForConfiguredProject(project); });
+ if (!sizeLimitExceeded) {
+ this.watchConfigDirectoryForProject(project, projectOptions);
+ }
+ project.watchWildcards(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); });
+ project.watchTypeRoots(function (project, path) { return _this.onTypeRootFileChanged(project, path); });
+ this.configuredProjects.push(project);
+ return project;
+ };
+ ProjectService.prototype.watchConfigDirectoryForProject = function (project, options) {
+ var _this = this;
+ if (!options.configHasFilesProperty) {
+ project.watchConfigDirectory(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); });
+ }
+ };
+ ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typingOptions, configFileErrors) {
+ var errors;
+ for (var _i = 0, files_4 = files; _i < files_4.length; _i++) {
+ var f = files_4[_i];
+ var rootFilename = propertyReader.getFileName(f);
+ var scriptKind = propertyReader.getScriptKind(f);
+ var hasMixedContent = propertyReader.hasMixedContent(f);
+ if (this.host.fileExists(rootFilename)) {
+ var info = this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(rootFilename), clientFileName == rootFilename, undefined, scriptKind, hasMixedContent);
+ project.addRoot(info);
+ }
+ else {
+ (errors || (errors = [])).push(createFileNotFoundDiagnostic(rootFilename));
+ }
+ }
+ project.setProjectErrors(ts.concatenate(configFileErrors, errors));
+ project.setTypingOptions(typingOptions);
+ project.updateGraph();
+ };
+ ProjectService.prototype.openConfigFile = function (configFileName, clientFileName) {
+ var conversionResult = this.convertConfigFileContentToProjectOptions(configFileName);
+ var projectOptions = conversionResult.success
+ ? conversionResult.projectOptions
+ : { files: [], compilerOptions: {} };
+ var project = this.createAndAddConfiguredProject(configFileName, projectOptions, conversionResult.configFileErrors, clientFileName);
+ return {
+ success: conversionResult.success,
+ project: project,
+ errors: project.getProjectErrors()
+ };
+ };
+ ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypingOptions, compileOnSave, configFileErrors) {
+ var oldRootScriptInfos = project.getRootScriptInfos();
+ var newRootScriptInfos = [];
+ var newRootScriptInfoMap = server.createNormalizedPathMap();
+ var projectErrors;
+ var rootFilesChanged = false;
+ for (var _i = 0, newUncheckedFiles_1 = newUncheckedFiles; _i < newUncheckedFiles_1.length; _i++) {
+ var f = newUncheckedFiles_1[_i];
+ var newRootFile = propertyReader.getFileName(f);
+ if (!this.host.fileExists(newRootFile)) {
+ (projectErrors || (projectErrors = [])).push(createFileNotFoundDiagnostic(newRootFile));
+ continue;
+ }
+ var normalizedPath = server.toNormalizedPath(newRootFile);
+ var scriptInfo = this.getScriptInfoForNormalizedPath(normalizedPath);
+ if (!scriptInfo || !project.isRoot(scriptInfo)) {
+ rootFilesChanged = true;
+ if (!scriptInfo) {
+ var scriptKind = propertyReader.getScriptKind(f);
+ var hasMixedContent = propertyReader.hasMixedContent(f);
+ scriptInfo = this.getOrCreateScriptInfoForNormalizedPath(normalizedPath, false, undefined, scriptKind, hasMixedContent);
+ }
+ }
+ newRootScriptInfos.push(scriptInfo);
+ newRootScriptInfoMap.set(scriptInfo.fileName, scriptInfo);
+ }
+ if (rootFilesChanged || newRootScriptInfos.length !== oldRootScriptInfos.length) {
+ var toAdd = void 0;
+ var toRemove = void 0;
+ for (var _a = 0, oldRootScriptInfos_1 = oldRootScriptInfos; _a < oldRootScriptInfos_1.length; _a++) {
+ var oldFile = oldRootScriptInfos_1[_a];
+ if (!newRootScriptInfoMap.contains(oldFile.fileName)) {
+ (toRemove || (toRemove = [])).push(oldFile);
+ }
+ }
+ for (var _b = 0, newRootScriptInfos_1 = newRootScriptInfos; _b < newRootScriptInfos_1.length; _b++) {
+ var newFile = newRootScriptInfos_1[_b];
+ if (!project.isRoot(newFile)) {
+ (toAdd || (toAdd = [])).push(newFile);
+ }
+ }
+ if (toRemove) {
+ for (var _c = 0, toRemove_1 = toRemove; _c < toRemove_1.length; _c++) {
+ var f = toRemove_1[_c];
+ project.removeFile(f);
+ }
+ }
+ if (toAdd) {
+ for (var _d = 0, toAdd_1 = toAdd; _d < toAdd_1.length; _d++) {
+ var f = toAdd_1[_d];
+ if (f.isOpen && isRootFileInInferredProject(f)) {
+ var inferredProject = f.containingProjects[0];
+ inferredProject.removeFile(f);
+ if (!inferredProject.hasRoots()) {
+ this.removeProject(inferredProject);
+ }
+ }
+ project.addRoot(f);
+ }
+ }
+ }
+ project.setCompilerOptions(newOptions);
+ project.setTypingOptions(newTypingOptions);
+ if (compileOnSave !== undefined) {
+ project.compileOnSaveEnabled = compileOnSave;
+ }
+ project.setProjectErrors(ts.concatenate(configFileErrors, projectErrors));
+ project.updateGraph();
+ };
+ ProjectService.prototype.updateConfiguredProject = function (project) {
+ if (!this.host.fileExists(project.configFileName)) {
+ this.logger.info("Config file deleted");
+ this.removeProject(project);
+ return;
+ }
+ var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
+ if (!success) {
+ this.updateNonInferredProject(project, [], fileNamePropertyReader, {}, {}, false, configFileErrors);
+ return configFileErrors;
+ }
+ if (this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader)) {
+ project.setCompilerOptions(projectOptions.compilerOptions);
+ if (!project.languageServiceEnabled) {
+ return;
+ }
+ project.disableLanguageService();
+ project.stopWatchingDirectory();
+ }
+ else {
+ if (!project.languageServiceEnabled) {
+ project.enableLanguageService();
+ }
+ this.watchConfigDirectoryForProject(project, projectOptions);
+ this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typingOptions, projectOptions.compileOnSave, configFileErrors);
+ }
+ };
+ ProjectService.prototype.createInferredProjectWithRootFileIfNecessary = function (root) {
+ var _this = this;
+ var useExistingProject = this.useSingleInferredProject && this.inferredProjects.length;
+ var project = useExistingProject
+ ? this.inferredProjects[0]
+ : new server.InferredProject(this, this.documentRegistry, true, this.compilerOptionsForInferredProjects, this.compileOnSaveForInferredProjects);
+ project.addRoot(root);
+ this.directoryWatchers.startWatchingContainingDirectoriesForFile(root.fileName, project, function (fileName) { return _this.onConfigFileAddedForInferredProject(fileName); });
+ project.updateGraph();
+ if (!useExistingProject) {
+ this.inferredProjects.push(project);
+ }
+ return project;
+ };
+ ProjectService.prototype.getOrCreateScriptInfo = function (uncheckedFileName, openedByClient, fileContent, scriptKind) {
+ return this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName), openedByClient, fileContent, scriptKind);
+ };
+ ProjectService.prototype.getScriptInfo = function (uncheckedFileName) {
+ return this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName));
+ };
+ ProjectService.prototype.getOrCreateScriptInfoForNormalizedPath = function (fileName, openedByClient, fileContent, scriptKind, hasMixedContent) {
+ var _this = this;
+ var info = this.getScriptInfoForNormalizedPath(fileName);
+ if (!info) {
+ var content = void 0;
+ if (this.host.fileExists(fileName)) {
+ content = fileContent || (hasMixedContent ? "" : this.host.readFile(fileName));
+ }
+ if (!content) {
+ if (openedByClient) {
+ content = "";
+ }
+ }
+ if (content !== undefined) {
+ info = new server.ScriptInfo(this.host, fileName, content, scriptKind, openedByClient, hasMixedContent);
+ this.filenameToScriptInfo.set(info.path, info);
+ if (!info.isOpen && !hasMixedContent) {
+ info.setWatcher(this.host.watchFile(fileName, function (_) { return _this.onSourceFileChanged(fileName); }));
+ }
+ }
+ }
+ if (info) {
+ if (fileContent !== undefined) {
+ info.reload(fileContent);
+ }
+ if (openedByClient) {
+ info.isOpen = true;
+ }
+ }
+ return info;
+ };
+ ProjectService.prototype.getScriptInfoForNormalizedPath = function (fileName) {
+ return this.getScriptInfoForPath(server.normalizedPathToPath(fileName, this.host.getCurrentDirectory(), this.toCanonicalFileName));
+ };
+ ProjectService.prototype.getScriptInfoForPath = function (fileName) {
+ return this.filenameToScriptInfo.get(fileName);
+ };
+ ProjectService.prototype.setHostConfiguration = function (args) {
+ if (args.file) {
+ var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(args.file));
+ if (info) {
+ info.setFormatOptions(convertFormatOptions(args.formatOptions));
+ this.logger.info("Host configuration update for file " + args.file);
+ }
+ }
+ else {
+ if (args.hostInfo !== undefined) {
+ this.hostConfiguration.hostInfo = args.hostInfo;
+ this.logger.info("Host information " + args.hostInfo);
+ }
+ if (args.formatOptions) {
+ server.mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions));
+ this.logger.info("Format host information updated");
+ }
+ }
+ };
+ ProjectService.prototype.closeLog = function () {
+ this.logger.close();
+ };
+ ProjectService.prototype.reloadProjects = function () {
+ this.logger.info("reload projects.");
+ for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {
+ var info = _a[_i];
+ this.openOrUpdateConfiguredProjectForFile(info.fileName);
+ }
+ this.refreshInferredProjects();
+ };
+ ProjectService.prototype.refreshInferredProjects = function () {
+ this.logger.info("updating project structure from ...");
+ this.printProjects();
+ var orphantedFiles = [];
+ for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {
+ var info = _a[_i];
+ if (info.containingProjects.length === 0) {
+ orphantedFiles.push(info);
+ }
+ else {
+ if (isRootFileInInferredProject(info) && info.containingProjects.length > 1) {
+ var inferredProject = info.containingProjects[0];
+ ts.Debug.assert(inferredProject.projectKind === server.ProjectKind.Inferred);
+ inferredProject.removeFile(info);
+ if (!inferredProject.hasRoots()) {
+ this.removeProject(inferredProject);
+ }
+ }
+ }
+ }
+ for (var _b = 0, orphantedFiles_1 = orphantedFiles; _b < orphantedFiles_1.length; _b++) {
+ var f = orphantedFiles_1[_b];
+ this.assignScriptInfoToInferredProjectIfNecessary(f, false);
+ }
+ for (var _c = 0, _d = this.inferredProjects; _c < _d.length; _c++) {
+ var p = _d[_c];
+ p.updateGraph();
+ }
+ this.printProjects();
+ };
+ ProjectService.prototype.openClientFile = function (fileName, fileContent, scriptKind) {
+ return this.openClientFileWithNormalizedPath(server.toNormalizedPath(fileName), fileContent, scriptKind);
+ };
+ ProjectService.prototype.openClientFileWithNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent) {
+ var _a = this.findContainingExternalProject(fileName)
+ ? {}
+ : this.openOrUpdateConfiguredProjectForFile(fileName), _b = _a.configFileName, configFileName = _b === void 0 ? undefined : _b, _c = _a.configFileErrors, configFileErrors = _c === void 0 ? undefined : _c;
+ var info = this.getOrCreateScriptInfoForNormalizedPath(fileName, true, fileContent, scriptKind, hasMixedContent);
+ this.assignScriptInfoToInferredProjectIfNecessary(info, true);
+ this.printProjects();
+ return { configFileName: configFileName, configFileErrors: configFileErrors };
+ };
+ ProjectService.prototype.closeClientFile = function (uncheckedFileName) {
+ var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName));
+ if (info) {
+ this.closeOpenFile(info);
+ info.isOpen = false;
+ }
+ this.printProjects();
+ };
+ ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) {
+ var _loop_3 = function (proj) {
+ var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; });
+ result.push(proj.getChangesSinceVersion(knownProject && knownProject.version));
+ };
+ for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) {
+ var proj = currentProjects_1[_i];
+ _loop_3(proj);
+ }
+ };
+ ProjectService.prototype.synchronizeProjectList = function (knownProjects) {
+ var files = [];
+ this.collectChanges(knownProjects, this.externalProjects, files);
+ this.collectChanges(knownProjects, this.configuredProjects, files);
+ this.collectChanges(knownProjects, this.inferredProjects, files);
+ return files;
+ };
+ ProjectService.prototype.applyChangesInOpenFiles = function (openFiles, changedFiles, closedFiles) {
+ var recordChangedFiles = changedFiles && !openFiles && !closedFiles;
+ if (openFiles) {
+ for (var _i = 0, openFiles_1 = openFiles; _i < openFiles_1.length; _i++) {
+ var file = openFiles_1[_i];
+ var scriptInfo = this.getScriptInfo(file.fileName);
+ ts.Debug.assert(!scriptInfo || !scriptInfo.isOpen);
+ var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName);
+ this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent);
+ }
+ }
+ if (changedFiles) {
+ for (var _a = 0, changedFiles_1 = changedFiles; _a < changedFiles_1.length; _a++) {
+ var file = changedFiles_1[_a];
+ var scriptInfo = this.getScriptInfo(file.fileName);
+ ts.Debug.assert(!!scriptInfo);
+ for (var i = file.changes.length - 1; i >= 0; i--) {
+ var change = file.changes[i];
+ scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
+ }
+ if (recordChangedFiles) {
+ if (!this.changedFiles) {
+ this.changedFiles = [scriptInfo];
+ }
+ else if (this.changedFiles.indexOf(scriptInfo) < 0) {
+ this.changedFiles.push(scriptInfo);
+ }
+ }
+ }
+ }
+ if (closedFiles) {
+ for (var _b = 0, closedFiles_1 = closedFiles; _b < closedFiles_1.length; _b++) {
+ var file = closedFiles_1[_b];
+ this.closeClientFile(file);
+ }
+ }
+ if (openFiles || closedFiles) {
+ this.refreshInferredProjects();
+ }
+ };
+ ProjectService.prototype.closeConfiguredProject = function (configFile) {
+ var configuredProject = this.findConfiguredProjectByProjectName(configFile);
+ if (configuredProject && configuredProject.deleteOpenRef() === 0) {
+ this.removeProject(configuredProject);
+ }
+ };
+ ProjectService.prototype.closeExternalProject = function (uncheckedFileName, suppressRefresh) {
+ if (suppressRefresh === void 0) { suppressRefresh = false; }
+ var fileName = server.toNormalizedPath(uncheckedFileName);
+ var configFiles = this.externalProjectToConfiguredProjectMap[fileName];
+ if (configFiles) {
+ var shouldRefreshInferredProjects = false;
+ for (var _i = 0, configFiles_1 = configFiles; _i < configFiles_1.length; _i++) {
+ var configFile = configFiles_1[_i];
+ if (this.closeConfiguredProject(configFile)) {
+ shouldRefreshInferredProjects = true;
+ }
+ }
+ delete this.externalProjectToConfiguredProjectMap[fileName];
+ if (shouldRefreshInferredProjects && !suppressRefresh) {
+ this.refreshInferredProjects();
+ }
+ }
+ else {
+ var externalProject = this.findExternalProjectByProjectName(uncheckedFileName);
+ if (externalProject) {
+ this.removeProject(externalProject);
+ if (!suppressRefresh) {
+ this.refreshInferredProjects();
+ }
+ }
+ }
+ };
+ ProjectService.prototype.openExternalProject = function (proj) {
+ var tsConfigFiles;
+ var rootFiles = [];
+ for (var _i = 0, _a = proj.rootFiles; _i < _a.length; _i++) {
+ var file = _a[_i];
+ var normalized = server.toNormalizedPath(file.fileName);
+ if (ts.getBaseFileName(normalized) === "tsconfig.json") {
+ (tsConfigFiles || (tsConfigFiles = [])).push(normalized);
+ }
+ else {
+ rootFiles.push(file);
+ }
+ }
+ if (tsConfigFiles) {
+ tsConfigFiles.sort();
+ }
+ var externalProject = this.findExternalProjectByProjectName(proj.projectFileName);
+ var exisingConfigFiles;
+ if (externalProject) {
+ if (!tsConfigFiles) {
+ this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typingOptions, proj.options.compileOnSave, undefined);
+ return;
+ }
+ this.closeExternalProject(proj.projectFileName, true);
+ }
+ else if (this.externalProjectToConfiguredProjectMap[proj.projectFileName]) {
+ if (!tsConfigFiles) {
+ this.closeExternalProject(proj.projectFileName, true);
+ }
+ else {
+ var oldConfigFiles = this.externalProjectToConfiguredProjectMap[proj.projectFileName];
+ var iNew = 0;
+ var iOld = 0;
+ while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) {
+ var newConfig = tsConfigFiles[iNew];
+ var oldConfig = oldConfigFiles[iOld];
+ if (oldConfig < newConfig) {
+ this.closeConfiguredProject(oldConfig);
+ iOld++;
+ }
+ else if (oldConfig > newConfig) {
+ iNew++;
+ }
+ else {
+ (exisingConfigFiles || (exisingConfigFiles = [])).push(oldConfig);
+ iOld++;
+ iNew++;
+ }
+ }
+ for (var i = iOld; i < oldConfigFiles.length; i++) {
+ this.closeConfiguredProject(oldConfigFiles[i]);
+ }
+ }
+ }
+ if (tsConfigFiles) {
+ this.externalProjectToConfiguredProjectMap[proj.projectFileName] = tsConfigFiles;
+ for (var _b = 0, tsConfigFiles_1 = tsConfigFiles; _b < tsConfigFiles_1.length; _b++) {
+ var tsconfigFile = tsConfigFiles_1[_b];
+ var project = this.findConfiguredProjectByProjectName(tsconfigFile);
+ if (!project) {
+ var result = this.openConfigFile(tsconfigFile);
+ project = result.success && result.project;
+ }
+ if (project && !ts.contains(exisingConfigFiles, tsconfigFile)) {
+ project.addOpenRef();
+ }
+ }
+ }
+ else {
+ delete this.externalProjectToConfiguredProjectMap[proj.projectFileName];
+ this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typingOptions);
+ }
+ this.refreshInferredProjects();
+ };
+ return ProjectService;
+ }());
+ server.ProjectService = ProjectService;
+ })(server = ts.server || (ts.server = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var server;
+ (function (server) {
+ function hrTimeToMilliseconds(time) {
+ var seconds = time[0];
+ var nanoseconds = time[1];
+ return ((1e9 * seconds) + nanoseconds) / 1000000.0;
+ }
+ function shouldSkipSematicCheck(project) {
+ if (project.getCompilerOptions().skipLibCheck !== undefined) {
+ return false;
+ }
+ if ((project.projectKind === server.ProjectKind.Inferred || project.projectKind === server.ProjectKind.External) && project.isJsOnlyProject()) {
+ return true;
+ }
+ return false;
+ }
+ function compareNumber(a, b) {
+ return a - b;
+ }
+ function compareFileStart(a, b) {
+ if (a.file < b.file) {
+ return -1;
+ }
+ else if (a.file == b.file) {
+ var n = compareNumber(a.start.line, b.start.line);
+ if (n === 0) {
+ return compareNumber(a.start.offset, b.start.offset);
+ }
+ else
+ return n;
+ }
+ else {
+ return 1;
+ }
+ }
+ function formatDiag(fileName, project, diag) {
+ var scriptInfo = project.getScriptInfoForNormalizedPath(fileName);
+ return {
+ start: scriptInfo.positionToLineOffset(diag.start),
+ end: scriptInfo.positionToLineOffset(diag.start + diag.length),
+ text: ts.flattenDiagnosticMessageText(diag.messageText, "\n"),
+ code: diag.code
+ };
+ }
+ function formatConfigFileDiag(diag) {
+ return {
+ start: undefined,
+ end: undefined,
+ text: ts.flattenDiagnosticMessageText(diag.messageText, "\n")
+ };
+ }
+ function allEditsBeforePos(edits, pos) {
+ for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) {
+ var edit = edits_1[_i];
+ if (ts.textSpanEnd(edit.span) >= pos) {
+ return false;
+ }
+ }
+ return true;
+ }
+ var CommandNames;
+ (function (CommandNames) {
+ CommandNames.Brace = "brace";
+ CommandNames.BraceFull = "brace-full";
+ CommandNames.BraceCompletion = "braceCompletion";
+ CommandNames.Change = "change";
+ CommandNames.Close = "close";
+ CommandNames.Completions = "completions";
+ CommandNames.CompletionsFull = "completions-full";
+ CommandNames.CompletionDetails = "completionEntryDetails";
+ CommandNames.CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
+ CommandNames.CompileOnSaveEmitFile = "compileOnSaveEmitFile";
+ CommandNames.Configure = "configure";
+ CommandNames.Definition = "definition";
+ CommandNames.DefinitionFull = "definition-full";
+ CommandNames.Exit = "exit";
+ CommandNames.Format = "format";
+ CommandNames.Formatonkey = "formatonkey";
+ CommandNames.FormatFull = "format-full";
+ CommandNames.FormatonkeyFull = "formatonkey-full";
+ CommandNames.FormatRangeFull = "formatRange-full";
+ CommandNames.Geterr = "geterr";
+ CommandNames.GeterrForProject = "geterrForProject";
+ CommandNames.Implementation = "implementation";
+ CommandNames.ImplementationFull = "implementation-full";
+ CommandNames.SemanticDiagnosticsSync = "semanticDiagnosticsSync";
+ CommandNames.SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
+ CommandNames.NavBar = "navbar";
+ CommandNames.NavBarFull = "navbar-full";
+ CommandNames.NavTree = "navtree";
+ CommandNames.NavTreeFull = "navtree-full";
+ CommandNames.Navto = "navto";
+ CommandNames.NavtoFull = "navto-full";
+ CommandNames.Occurrences = "occurrences";
+ CommandNames.DocumentHighlights = "documentHighlights";
+ CommandNames.DocumentHighlightsFull = "documentHighlights-full";
+ CommandNames.Open = "open";
+ CommandNames.Quickinfo = "quickinfo";
+ CommandNames.QuickinfoFull = "quickinfo-full";
+ CommandNames.References = "references";
+ CommandNames.ReferencesFull = "references-full";
+ CommandNames.Reload = "reload";
+ CommandNames.Rename = "rename";
+ CommandNames.RenameInfoFull = "rename-full";
+ CommandNames.RenameLocationsFull = "renameLocations-full";
+ CommandNames.Saveto = "saveto";
+ CommandNames.SignatureHelp = "signatureHelp";
+ CommandNames.SignatureHelpFull = "signatureHelp-full";
+ CommandNames.TypeDefinition = "typeDefinition";
+ CommandNames.ProjectInfo = "projectInfo";
+ CommandNames.ReloadProjects = "reloadProjects";
+ CommandNames.Unknown = "unknown";
+ CommandNames.OpenExternalProject = "openExternalProject";
+ CommandNames.OpenExternalProjects = "openExternalProjects";
+ CommandNames.CloseExternalProject = "closeExternalProject";
+ CommandNames.SynchronizeProjectList = "synchronizeProjectList";
+ CommandNames.ApplyChangedToOpenFiles = "applyChangedToOpenFiles";
+ CommandNames.EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full";
+ CommandNames.Cleanup = "cleanup";
+ CommandNames.OutliningSpans = "outliningSpans";
+ CommandNames.TodoComments = "todoComments";
+ CommandNames.Indentation = "indentation";
+ CommandNames.DocCommentTemplate = "docCommentTemplate";
+ CommandNames.CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full";
+ CommandNames.NameOrDottedNameSpan = "nameOrDottedNameSpan";
+ CommandNames.BreakpointStatement = "breakpointStatement";
+ CommandNames.CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
+ CommandNames.GetCodeFixes = "getCodeFixes";
+ CommandNames.GetCodeFixesFull = "getCodeFixes-full";
+ CommandNames.GetSupportedCodeFixes = "getSupportedCodeFixes";
+ })(CommandNames = server.CommandNames || (server.CommandNames = {}));
+ function formatMessage(msg, logger, byteLength, newLine) {
+ var verboseLogging = logger.hasLevel(server.LogLevel.verbose);
+ var json = JSON.stringify(msg);
+ if (verboseLogging) {
+ logger.info(msg.type + ": " + json);
+ }
+ var len = byteLength(json, "utf8");
+ return "Content-Length: " + (1 + len) + "\r\n\r\n" + json + newLine;
+ }
+ server.formatMessage = formatMessage;
+ var Session = (function () {
+ function Session(host, cancellationToken, useSingleInferredProject, typingsInstaller, byteLength, hrtime, logger, canUseEvents, eventHandler) {
+ var _this = this;
+ this.host = host;
+ this.typingsInstaller = typingsInstaller;
+ this.byteLength = byteLength;
+ this.hrtime = hrtime;
+ this.logger = logger;
+ this.canUseEvents = canUseEvents;
+ this.changeSeq = 0;
+ this.handlers = ts.createMap((_a = {},
+ _a[CommandNames.OpenExternalProject] = function (request) {
+ _this.projectService.openExternalProject(request.arguments);
+ return _this.requiredResponse(true);
+ },
+ _a[CommandNames.OpenExternalProjects] = function (request) {
+ for (var _i = 0, _a = request.arguments.projects; _i < _a.length; _i++) {
+ var proj = _a[_i];
+ _this.projectService.openExternalProject(proj);
+ }
+ return _this.requiredResponse(true);
+ },
+ _a[CommandNames.CloseExternalProject] = function (request) {
+ _this.projectService.closeExternalProject(request.arguments.projectFileName);
+ return _this.requiredResponse(true);
+ },
+ _a[CommandNames.SynchronizeProjectList] = function (request) {
+ var result = _this.projectService.synchronizeProjectList(request.arguments.knownProjects);
+ if (!result.some(function (p) { return p.projectErrors && p.projectErrors.length !== 0; })) {
+ return _this.requiredResponse(result);
+ }
+ var converted = ts.map(result, function (p) {
+ if (!p.projectErrors || p.projectErrors.length === 0) {
+ return p;
+ }
+ return {
+ info: p.info,
+ changes: p.changes,
+ files: p.files,
+ projectErrors: _this.convertToDiagnosticsWithLinePosition(p.projectErrors, undefined)
+ };
+ });
+ return _this.requiredResponse(converted);
+ },
+ _a[CommandNames.ApplyChangedToOpenFiles] = function (request) {
+ _this.projectService.applyChangesInOpenFiles(request.arguments.openFiles, request.arguments.changedFiles, request.arguments.closedFiles);
+ _this.changeSeq++;
+ return _this.requiredResponse(true);
+ },
+ _a[CommandNames.Exit] = function () {
+ _this.exit();
+ return _this.notRequired();
+ },
+ _a[CommandNames.Definition] = function (request) {
+ return _this.requiredResponse(_this.getDefinition(request.arguments, true));
+ },
+ _a[CommandNames.DefinitionFull] = function (request) {
+ return _this.requiredResponse(_this.getDefinition(request.arguments, false));
+ },
+ _a[CommandNames.TypeDefinition] = function (request) {
+ return _this.requiredResponse(_this.getTypeDefinition(request.arguments));
+ },
+ _a[CommandNames.Implementation] = function (request) {
+ return _this.requiredResponse(_this.getImplementation(request.arguments, true));
+ },
+ _a[CommandNames.ImplementationFull] = function (request) {
+ return _this.requiredResponse(_this.getImplementation(request.arguments, false));
+ },
+ _a[CommandNames.References] = function (request) {
+ return _this.requiredResponse(_this.getReferences(request.arguments, true));
+ },
+ _a[CommandNames.ReferencesFull] = function (request) {
+ return _this.requiredResponse(_this.getReferences(request.arguments, false));
+ },
+ _a[CommandNames.Rename] = function (request) {
+ return _this.requiredResponse(_this.getRenameLocations(request.arguments, true));
+ },
+ _a[CommandNames.RenameLocationsFull] = function (request) {
+ return _this.requiredResponse(_this.getRenameLocations(request.arguments, false));
+ },
+ _a[CommandNames.RenameInfoFull] = function (request) {
+ return _this.requiredResponse(_this.getRenameInfo(request.arguments));
+ },
+ _a[CommandNames.Open] = function (request) {
+ _this.openClientFile(server.toNormalizedPath(request.arguments.file), request.arguments.fileContent, server.convertScriptKindName(request.arguments.scriptKindName));
+ return _this.notRequired();
+ },
+ _a[CommandNames.Quickinfo] = function (request) {
+ return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, true));
+ },
+ _a[CommandNames.QuickinfoFull] = function (request) {
+ return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, false));
+ },
+ _a[CommandNames.OutliningSpans] = function (request) {
+ return _this.requiredResponse(_this.getOutliningSpans(request.arguments));
+ },
+ _a[CommandNames.TodoComments] = function (request) {
+ return _this.requiredResponse(_this.getTodoComments(request.arguments));
+ },
+ _a[CommandNames.Indentation] = function (request) {
+ return _this.requiredResponse(_this.getIndentation(request.arguments));
+ },
+ _a[CommandNames.NameOrDottedNameSpan] = function (request) {
+ return _this.requiredResponse(_this.getNameOrDottedNameSpan(request.arguments));
+ },
+ _a[CommandNames.BreakpointStatement] = function (request) {
+ return _this.requiredResponse(_this.getBreakpointStatement(request.arguments));
+ },
+ _a[CommandNames.BraceCompletion] = function (request) {
+ return _this.requiredResponse(_this.isValidBraceCompletion(request.arguments));
+ },
+ _a[CommandNames.DocCommentTemplate] = function (request) {
+ return _this.requiredResponse(_this.getDocCommentTemplate(request.arguments));
+ },
+ _a[CommandNames.Format] = function (request) {
+ return _this.requiredResponse(_this.getFormattingEditsForRange(request.arguments));
+ },
+ _a[CommandNames.Formatonkey] = function (request) {
+ return _this.requiredResponse(_this.getFormattingEditsAfterKeystroke(request.arguments));
+ },
+ _a[CommandNames.FormatFull] = function (request) {
+ return _this.requiredResponse(_this.getFormattingEditsForDocumentFull(request.arguments));
+ },
+ _a[CommandNames.FormatonkeyFull] = function (request) {
+ return _this.requiredResponse(_this.getFormattingEditsAfterKeystrokeFull(request.arguments));
+ },
+ _a[CommandNames.FormatRangeFull] = function (request) {
+ return _this.requiredResponse(_this.getFormattingEditsForRangeFull(request.arguments));
+ },
+ _a[CommandNames.Completions] = function (request) {
+ return _this.requiredResponse(_this.getCompletions(request.arguments, true));
+ },
+ _a[CommandNames.CompletionsFull] = function (request) {
+ return _this.requiredResponse(_this.getCompletions(request.arguments, false));
+ },
+ _a[CommandNames.CompletionDetails] = function (request) {
+ return _this.requiredResponse(_this.getCompletionEntryDetails(request.arguments));
+ },
+ _a[CommandNames.CompileOnSaveAffectedFileList] = function (request) {
+ return _this.requiredResponse(_this.getCompileOnSaveAffectedFileList(request.arguments));
+ },
+ _a[CommandNames.CompileOnSaveEmitFile] = function (request) {
+ return _this.requiredResponse(_this.emitFile(request.arguments));
+ },
+ _a[CommandNames.SignatureHelp] = function (request) {
+ return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, true));
+ },
+ _a[CommandNames.SignatureHelpFull] = function (request) {
+ return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, false));
+ },
+ _a[CommandNames.CompilerOptionsDiagnosticsFull] = function (request) {
+ return _this.requiredResponse(_this.getCompilerOptionsDiagnostics(request.arguments));
+ },
+ _a[CommandNames.EncodedSemanticClassificationsFull] = function (request) {
+ return _this.requiredResponse(_this.getEncodedSemanticClassifications(request.arguments));
+ },
+ _a[CommandNames.Cleanup] = function () {
+ _this.cleanup();
+ return _this.requiredResponse(true);
+ },
+ _a[CommandNames.SemanticDiagnosticsSync] = function (request) {
+ return _this.requiredResponse(_this.getSemanticDiagnosticsSync(request.arguments));
+ },
+ _a[CommandNames.SyntacticDiagnosticsSync] = function (request) {
+ return _this.requiredResponse(_this.getSyntacticDiagnosticsSync(request.arguments));
+ },
+ _a[CommandNames.Geterr] = function (request) {
+ var geterrArgs = request.arguments;
+ return { response: _this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false };
+ },
+ _a[CommandNames.GeterrForProject] = function (request) {
+ var _a = request.arguments, file = _a.file, delay = _a.delay;
+ return { response: _this.getDiagnosticsForProject(delay, file), responseRequired: false };
+ },
+ _a[CommandNames.Change] = function (request) {
+ _this.change(request.arguments);
+ return _this.notRequired();
+ },
+ _a[CommandNames.Configure] = function (request) {
+ _this.projectService.setHostConfiguration(request.arguments);
+ _this.output(undefined, CommandNames.Configure, request.seq);
+ return _this.notRequired();
+ },
+ _a[CommandNames.Reload] = function (request) {
+ _this.reload(request.arguments, request.seq);
+ return _this.requiredResponse({ reloadFinished: true });
+ },
+ _a[CommandNames.Saveto] = function (request) {
+ var savetoArgs = request.arguments;
+ _this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile);
+ return _this.notRequired();
+ },
+ _a[CommandNames.Close] = function (request) {
+ var closeArgs = request.arguments;
+ _this.closeClientFile(closeArgs.file);
+ return _this.notRequired();
+ },
+ _a[CommandNames.Navto] = function (request) {
+ return _this.requiredResponse(_this.getNavigateToItems(request.arguments, true));
+ },
+ _a[CommandNames.NavtoFull] = function (request) {
+ return _this.requiredResponse(_this.getNavigateToItems(request.arguments, false));
+ },
+ _a[CommandNames.Brace] = function (request) {
+ return _this.requiredResponse(_this.getBraceMatching(request.arguments, true));
+ },
+ _a[CommandNames.BraceFull] = function (request) {
+ return _this.requiredResponse(_this.getBraceMatching(request.arguments, false));
+ },
+ _a[CommandNames.NavBar] = function (request) {
+ return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, true));
+ },
+ _a[CommandNames.NavBarFull] = function (request) {
+ return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, false));
+ },
+ _a[CommandNames.NavTree] = function (request) {
+ return _this.requiredResponse(_this.getNavigationTree(request.arguments, true));
+ },
+ _a[CommandNames.NavTreeFull] = function (request) {
+ return _this.requiredResponse(_this.getNavigationTree(request.arguments, false));
+ },
+ _a[CommandNames.Occurrences] = function (request) {
+ return _this.requiredResponse(_this.getOccurrences(request.arguments));
+ },
+ _a[CommandNames.DocumentHighlights] = function (request) {
+ return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, true));
+ },
+ _a[CommandNames.DocumentHighlightsFull] = function (request) {
+ return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, false));
+ },
+ _a[CommandNames.CompilerOptionsForInferredProjects] = function (request) {
+ _this.setCompilerOptionsForInferredProjects(request.arguments);
+ return _this.requiredResponse(true);
+ },
+ _a[CommandNames.ProjectInfo] = function (request) {
+ return _this.requiredResponse(_this.getProjectInfo(request.arguments));
+ },
+ _a[CommandNames.ReloadProjects] = function () {
+ _this.projectService.reloadProjects();
+ return _this.notRequired();
+ },
+ _a[CommandNames.GetCodeFixes] = function (request) {
+ return _this.requiredResponse(_this.getCodeFixes(request.arguments, true));
+ },
+ _a[CommandNames.GetCodeFixesFull] = function (request) {
+ return _this.requiredResponse(_this.getCodeFixes(request.arguments, false));
+ },
+ _a[CommandNames.GetSupportedCodeFixes] = function () {
+ return _this.requiredResponse(_this.getSupportedCodeFixes());
+ },
+ _a));
+ this.eventHander = canUseEvents
+ ? eventHandler || (function (event) { return _this.defaultEventHandler(event); })
+ : undefined;
+ this.projectService = new server.ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, this.eventHander);
+ this.gcTimer = new server.GcTimer(host, 7000, logger);
+ var _a;
+ }
+ Session.prototype.defaultEventHandler = function (event) {
+ var _this = this;
+ switch (event.eventName) {
+ case "context":
+ var _a = event.data, project = _a.project, fileName = _a.fileName;
+ this.projectService.logger.info("got context event, updating diagnostics for " + fileName);
+ this.updateErrorCheck([{ fileName: fileName, project: project }], this.changeSeq, function (n) { return n === _this.changeSeq; }, 100);
+ break;
+ case "configFileDiag":
+ var _b = event.data, triggerFile = _b.triggerFile, configFileName = _b.configFileName, diagnostics = _b.diagnostics;
+ this.configFileDiagnosticEvent(triggerFile, configFileName, diagnostics);
+ }
+ };
+ Session.prototype.logError = function (err, cmd) {
+ var msg = "Exception on executing command " + cmd;
+ if (err.message) {
+ msg += ":\n" + err.message;
+ if (err.stack) {
+ msg += "\n" + err.stack;
+ }
+ }
+ this.logger.msg(msg, server.Msg.Err);
+ };
+ Session.prototype.send = function (msg) {
+ if (msg.type === "event" && !this.canUseEvents) {
+ if (this.logger.hasLevel(server.LogLevel.verbose)) {
+ this.logger.info("Session does not support events: ignored event: " + JSON.stringify(msg));
+ }
+ return;
+ }
+ this.host.write(formatMessage(msg, this.logger, this.byteLength, this.host.newLine));
+ };
+ Session.prototype.configFileDiagnosticEvent = function (triggerFile, configFile, diagnostics) {
+ var bakedDiags = ts.map(diagnostics, formatConfigFileDiag);
+ var ev = {
+ seq: 0,
+ type: "event",
+ event: "configFileDiag",
+ body: {
+ triggerFile: triggerFile,
+ configFile: configFile,
+ diagnostics: bakedDiags
+ }
+ };
+ this.send(ev);
+ };
+ Session.prototype.event = function (info, eventName) {
+ var ev = {
+ seq: 0,
+ type: "event",
+ event: eventName,
+ body: info,
+ };
+ this.send(ev);
+ };
+ Session.prototype.output = function (info, cmdName, reqSeq, errorMsg) {
+ if (reqSeq === void 0) { reqSeq = 0; }
+ var res = {
+ seq: 0,
+ type: "response",
+ command: cmdName,
+ request_seq: reqSeq,
+ success: !errorMsg,
+ };
+ if (!errorMsg) {
+ res.body = info;
+ }
+ else {
+ res.message = errorMsg;
+ }
+ this.send(res);
+ };
+ Session.prototype.semanticCheck = function (file, project) {
+ try {
+ var diags = [];
+ if (!shouldSkipSematicCheck(project)) {
+ diags = project.getLanguageService().getSemanticDiagnostics(file);
+ }
+ var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); });
+ this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag");
+ }
+ catch (err) {
+ this.logError(err, "semantic check");
+ }
+ };
+ Session.prototype.syntacticCheck = function (file, project) {
+ try {
+ var diags = project.getLanguageService().getSyntacticDiagnostics(file);
+ if (diags) {
+ var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); });
+ this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag");
+ }
+ }
+ catch (err) {
+ this.logError(err, "syntactic check");
+ }
+ };
+ Session.prototype.updateProjectStructure = function (seq, matchSeq, ms) {
+ var _this = this;
+ if (ms === void 0) { ms = 1500; }
+ this.host.setTimeout(function () {
+ if (matchSeq(seq)) {
+ _this.projectService.refreshInferredProjects();
+ }
+ }, ms);
+ };
+ Session.prototype.updateErrorCheck = function (checkList, seq, matchSeq, ms, followMs, requireOpen) {
+ var _this = this;
+ if (ms === void 0) { ms = 1500; }
+ if (followMs === void 0) { followMs = 200; }
+ if (requireOpen === void 0) { requireOpen = true; }
+ if (followMs > ms) {
+ followMs = ms;
+ }
+ if (this.errorTimer) {
+ this.host.clearTimeout(this.errorTimer);
+ }
+ if (this.immediateId) {
+ this.host.clearImmediate(this.immediateId);
+ this.immediateId = undefined;
+ }
+ var index = 0;
+ var checkOne = function () {
+ if (matchSeq(seq)) {
+ var checkSpec_1 = checkList[index];
+ index++;
+ if (checkSpec_1.project.containsFile(checkSpec_1.fileName, requireOpen)) {
+ _this.syntacticCheck(checkSpec_1.fileName, checkSpec_1.project);
+ _this.immediateId = _this.host.setImmediate(function () {
+ _this.semanticCheck(checkSpec_1.fileName, checkSpec_1.project);
+ _this.immediateId = undefined;
+ if (checkList.length > index) {
+ _this.errorTimer = _this.host.setTimeout(checkOne, followMs);
+ }
+ else {
+ _this.errorTimer = undefined;
+ }
+ });
+ }
+ }
+ };
+ if ((checkList.length > index) && (matchSeq(seq))) {
+ this.errorTimer = this.host.setTimeout(checkOne, ms);
+ }
+ };
+ Session.prototype.cleanProjects = function (caption, projects) {
+ if (!projects) {
+ return;
+ }
+ this.logger.info("cleaning " + caption);
+ for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) {
+ var p = projects_4[_i];
+ p.getLanguageService(false).cleanupSemanticCache();
+ }
+ };
+ Session.prototype.cleanup = function () {
+ this.cleanProjects("inferred projects", this.projectService.inferredProjects);
+ this.cleanProjects("configured projects", this.projectService.configuredProjects);
+ this.cleanProjects("external projects", this.projectService.externalProjects);
+ if (this.host.gc) {
+ this.logger.info("host.gc()");
+ this.host.gc();
+ }
+ };
+ Session.prototype.getEncodedSemanticClassifications = function (args) {
+ var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
+ return project.getLanguageService().getEncodedSemanticClassifications(file, args);
+ };
+ Session.prototype.getProject = function (projectFileName) {
+ return projectFileName && this.projectService.findProject(projectFileName);
+ };
+ Session.prototype.getCompilerOptionsDiagnostics = function (args) {
+ var project = this.getProject(args.projectFileName);
+ return this.convertToDiagnosticsWithLinePosition(project.getLanguageService().getCompilerOptionsDiagnostics(), undefined);
+ };
+ Session.prototype.convertToDiagnosticsWithLinePosition = function (diagnostics, scriptInfo) {
+ var _this = this;
+ return diagnostics.map(function (d) { return ({
+ message: ts.flattenDiagnosticMessageText(d.messageText, _this.host.newLine),
+ start: d.start,
+ length: d.length,
+ category: ts.DiagnosticCategory[d.category].toLowerCase(),
+ code: d.code,
+ startLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start),
+ endLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start + d.length)
+ }); });
+ };
+ Session.prototype.getDiagnosticsWorker = function (args, isSemantic, selector, includeLinePosition) {
+ var _a = this.getFileAndProject(args), project = _a.project, file = _a.file;
+ if (isSemantic && shouldSkipSematicCheck(project)) {
+ return [];
+ }
+ var scriptInfo = project.getScriptInfoForNormalizedPath(file);
+ var diagnostics = selector(project, file);
+ return includeLinePosition
+ ? this.convertToDiagnosticsWithLinePosition(diagnostics, scriptInfo)
+ : diagnostics.map(function (d) { return formatDiag(file, project, d); });
+ };
+ Session.prototype.getDefinition = function (args, simplifiedResult) {
+ var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
+ var scriptInfo = project.getScriptInfoForNormalizedPath(file);
+ var position = this.getPosition(args, scriptInfo);
+ var definitions = project.getLanguageService().getDefinitionAtPosition(file, position);
+ if (!definitions) {
+ return undefined;
+ }
+ if (simplifiedResult) {
+ return definitions.map(function (def) {
+ var defScriptInfo = project.getScriptInfo(def.fileName);
+ return {
+ file: def.fileName,
+ start: defScriptInfo.positionToLineOffset(def.textSpan.start),
+ end: defScriptInfo.positionToLineOffset(ts.textSpanEnd(def.textSpan))
+ };
+ });
+ }
+ else {
+ return definitions;
+ }
+ };
+ Session.prototype.getTypeDefinition = function (args) {
+ var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
+ var scriptInfo = project.getScriptInfoForNormalizedPath(file);
+ var position = this.getPosition(args, scriptInfo);
+ var definitions = project.getLanguageService().getTypeDefinitionAtPosition(file, position);
+ if (!definitions) {
+ return undefined;
+ }
+ return definitions.map(function (def) {
+ var defScriptInfo = project.getScriptInfo(def.fileName);
+ return {
+ file: def.fileName,
+ start: defScriptInfo.positionToLineOffset(def.textSpan.start),
+ end: defScriptInfo.positionToLineOffset(ts.textSpanEnd(def.textSpan))
+ };
+ });
+ };
+ Session.prototype.getImplementation = function (args, simplifiedResult) {
+ var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
+ var scriptInfo = project.getScriptInfoForNormalizedPath(file);
+ var position = this.getPosition(args, scriptInfo);
+ var implementations = project.getLanguageService().getImplementationAtPosition(file, position);
+ if (!implementations) {
+ return [];
+ }
+ if (simplifiedResult) {
+ return implementations.map(function (impl) { return ({
+ file: impl.fileName,
+ start: scriptInfo.positionToLineOffset(impl.textSpan.start),
+ end: scriptInfo.positionToLineOffset(ts.textSpanEnd(impl.textSpan))
+ }); });
+ }
+ else {
+ return implementations;
+ }
+ };
+ Session.prototype.getOccurrences = function (args) {
+ var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
+ var scriptInfo = project.getScriptInfoForNormalizedPath(file);
+ var position = this.getPosition(args, scriptInfo);
+ var occurrences = project.getLanguageService().getOccurrencesAtPosition(file, position);
+ if (!occurrences) {
+ return undefined;
+ }
+ return occurrences.map(function (occurrence) {
+ var fileName = occurrence.fileName, isWriteAccess = occurrence.isWriteAccess, textSpan = occurrence.textSpan;
+ var scriptInfo = project.getScriptInfo(fileName);
+ var start = scriptInfo.positionToLineOffset(textSpan.start);
+ var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan));
+ return {
+ start: start,
+ end: end,
+ file: fileName,
+ isWriteAccess: isWriteAccess,
+ };
+ });
+ };
+ Session.prototype.getSyntacticDiagnosticsSync = function (args) {
+ return this.getDiagnosticsWorker(args, false, function (project, file) { return project.getLanguageService().getSyntacticDiagnostics(file); }, args.includeLinePosition);
+ };
+ Session.prototype.getSemanticDiagnosticsSync = function (args) {
+ return this.getDiagnosticsWorker(args, true, function (project, file) { return project.getLanguageService().getSemanticDiagnostics(file); }, args.includeLinePosition);
+ };
+ Session.prototype.getDocumentHighlights = function (args, simplifiedResult) {
+ var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
+ var scriptInfo = project.getScriptInfoForNormalizedPath(file);
+ var position = this.getPosition(args, scriptInfo);
+ var documentHighlights = project.getLanguageService().getDocumentHighlights(file, position, args.filesToSearch);
+ if (!documentHighlights) {
+ return undefined;
+ }
+ if (simplifiedResult) {
+ return documentHighlights.map(convertToDocumentHighlightsItem);
+ }
+ else {
+ return documentHighlights;
+ }
+ function convertToDocumentHighlightsItem(documentHighlights) {
+ var fileName = documentHighlights.fileName, highlightSpans = documentHighlights.highlightSpans;
+ var scriptInfo = project.getScriptInfo(fileName);
+ return {
+ file: fileName,
+ highlightSpans: highlightSpans.map(convertHighlightSpan)
+ };
+ function convertHighlightSpan(highlightSpan) {
+ var textSpan = highlightSpan.textSpan, kind = highlightSpan.kind;
+ var start = scriptInfo.positionToLineOffset(textSpan.start);
+ var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan));
+ return { start: start, end: end, kind: kind };
+ }
+ }
+ };
+ Session.prototype.setCompilerOptionsForInferredProjects = function (args) {
+ this.projectService.setCompilerOptionsForInferredProjects(args.options);
+ };
+ Session.prototype.getProjectInfo = function (args) {
+ return this.getProjectInfoWorker(args.file, args.projectFileName, args.needFileNameList);
+ };
+ Session.prototype.getProjectInfoWorker = function (uncheckedFileName, projectFileName, needFileNameList) {
+ var project = this.getFileAndProjectWorker(uncheckedFileName, projectFileName, true, true).project;
+ var projectInfo = {
+ configFileName: project.getProjectName(),
+ languageServiceDisabled: !project.languageServiceEnabled,
+ fileNames: needFileNameList ? project.getFileNames() : undefined
+ };
+ return projectInfo;
+ };
+ Session.prototype.getRenameInfo = function (args) {
+ var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
+ var scriptInfo = project.getScriptInfoForNormalizedPath(file);
+ var position = this.getPosition(args, scriptInfo);
+ return project.getLanguageService().getRenameInfo(file, position);
+ };
+ Session.prototype.getProjects = function (args) {
+ var projects;
+ if (args.projectFileName) {
+ var project = this.getProject(args.projectFileName);
+ if (project) {
+ projects = [project];
+ }
+ }
+ else {
+ var scriptInfo = this.projectService.getScriptInfo(args.file);
+ projects = scriptInfo.containingProjects;
+ }
+ projects = ts.filter(projects, function (p) { return p.languageServiceEnabled; });
+ if (!projects || !projects.length) {
+ return server.Errors.ThrowNoProject();
+ }
+ return projects;
+ };
+ Session.prototype.getRenameLocations = function (args, simplifiedResult) {
+ var file = server.toNormalizedPath(args.file);
+ var info = this.projectService.getScriptInfoForNormalizedPath(file);
+ var position = this.getPosition(args, info);
+ var projects = this.getProjects(args);
+ if (simplifiedResult) {
+ var defaultProject = projects[0];
+ var renameInfo = defaultProject.getLanguageService().getRenameInfo(file, position);
+ if (!renameInfo) {
+ return undefined;
+ }
+ if (!renameInfo.canRename) {
+ return {
+ info: renameInfo,
+ locs: []
+ };
+ }
+ var fileSpans = server.combineProjectOutput(projects, function (project) {
+ var renameLocations = project.getLanguageService().findRenameLocations(file, position, args.findInStrings, args.findInComments);
+ if (!renameLocations) {
+ return [];
+ }
+ return renameLocations.map(function (location) {
+ var locationScriptInfo = project.getScriptInfo(location.fileName);
+ return {
+ file: location.fileName,
+ start: locationScriptInfo.positionToLineOffset(location.textSpan.start),
+ end: locationScriptInfo.positionToLineOffset(ts.textSpanEnd(location.textSpan)),
+ };
+ });
+ }, compareRenameLocation, function (a, b) { return a.file === b.file && a.start.line === b.start.line && a.start.offset === b.start.offset; });
+ var locs = fileSpans.reduce(function (accum, cur) {
+ var curFileAccum;
+ if (accum.length > 0) {
+ curFileAccum = accum[accum.length - 1];
+ if (curFileAccum.file !== cur.file) {
+ curFileAccum = undefined;
+ }
+ }
+ if (!curFileAccum) {
+ curFileAccum = { file: cur.file, locs: [] };
+ accum.push(curFileAccum);
+ }
+ curFileAccum.locs.push({ start: cur.start, end: cur.end });
+ return accum;
+ }, []);
+ return { info: renameInfo, locs: locs };
+ }
+ else {
+ return server.combineProjectOutput(projects, function (p) { return p.getLanguageService().findRenameLocations(file, position, args.findInStrings, args.findInComments); }, undefined, renameLocationIsEqualTo);
+ }
+ function renameLocationIsEqualTo(a, b) {
+ if (a === b) {
+ return true;
+ }
+ if (!a || !b) {
+ return false;
+ }
+ return a.fileName === b.fileName &&
+ a.textSpan.start === b.textSpan.start &&
+ a.textSpan.length === b.textSpan.length;
+ }
+ function compareRenameLocation(a, b) {
+ if (a.file < b.file) {
+ return -1;
+ }
+ else if (a.file > b.file) {
+ return 1;
+ }
+ else {
+ if (a.start.line < b.start.line) {
+ return 1;
+ }
+ else if (a.start.line > b.start.line) {
+ return -1;
+ }
+ else {
+ return b.start.offset - a.start.offset;
+ }
+ }
+ }
+ };
+ Session.prototype.getReferences = function (args, simplifiedResult) {
+ var file = server.toNormalizedPath(args.file);
+ var projects = this.getProjects(args);
+ var defaultProject = projects[0];
+ var scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file);
+ var position = this.getPosition(args, scriptInfo);
+ if (simplifiedResult) {
+ var nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position);
+ if (!nameInfo) {
+ return undefined;
+ }
+ var displayString = ts.displayPartsToString(nameInfo.displayParts);
+ var nameSpan = nameInfo.textSpan;
+ var nameColStart = scriptInfo.positionToLineOffset(nameSpan.start).offset;
+ var nameText = scriptInfo.snap().getText(nameSpan.start, ts.textSpanEnd(nameSpan));
+ var refs = server.combineProjectOutput(projects, function (project) {
+ var references = project.getLanguageService().getReferencesAtPosition(file, position);
+ if (!references) {
+ return [];
+ }
+ return references.map(function (ref) {
+ var refScriptInfo = project.getScriptInfo(ref.fileName);
var start = refScriptInfo.positionToLineOffset(ref.textSpan.start);
var refLineSpan = refScriptInfo.lineToTextSpan(start.line - 1);
var lineText = refScriptInfo.snap().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, "");
@@ -64204,7 +66719,7 @@ var ts;
if (this.eventHander) {
this.eventHander({
eventName: "configFileDiag",
- data: { fileName: fileName, configFileName: configFileName, diagnostics: configFileErrors || [] }
+ data: { triggerFile: fileName, configFileName: configFileName, diagnostics: configFileErrors || [] }
});
}
};
@@ -64244,7 +66759,7 @@ var ts;
Session.prototype.getIndentation = function (args) {
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file));
- var options = args.options || this.projectService.getFormatCodeOptions(file);
+ var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
var indentation = project.getLanguageService(false).getIndentationAtPosition(file, position, options);
return { position: position, indentation: indentation };
};
@@ -64279,7 +66794,7 @@ var ts;
start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start),
end: scriptInfo.positionToLineOffset(ts.textSpanEnd(quickInfo.textSpan)),
displayString: displayString,
- documentation: docString
+ documentation: docString,
};
}
else {
@@ -64300,17 +66815,17 @@ var ts;
};
Session.prototype.getFormattingEditsForRangeFull = function (args) {
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
- var options = args.options || this.projectService.getFormatCodeOptions(file);
+ var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
return project.getLanguageService(false).getFormattingEditsForRange(file, args.position, args.endPosition, options);
};
Session.prototype.getFormattingEditsForDocumentFull = function (args) {
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
- var options = args.options || this.projectService.getFormatCodeOptions(file);
+ var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
return project.getLanguageService(false).getFormattingEditsForDocument(file, options);
};
Session.prototype.getFormattingEditsAfterKeystrokeFull = function (args) {
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
- var options = args.options || this.projectService.getFormatCodeOptions(file);
+ var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
return project.getLanguageService(false).getFormattingEditsAfterKeystroke(file, args.position, args.key, options);
};
Session.prototype.getFormattingEditsAfterKeystroke = function (args) {
@@ -64377,7 +66892,7 @@ var ts;
result.push({ name: name_53, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan });
}
return result;
- }, []).sort(function (a, b) { return a.name.localeCompare(b.name); });
+ }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); });
}
else {
return completions;
@@ -64440,7 +66955,7 @@ var ts;
},
selectedItemIndex: helpItems.selectedItemIndex,
argumentIndex: helpItems.argumentIndex,
- argumentCount: helpItems.argumentCount
+ argumentCount: helpItems.argumentCount,
};
}
else {
@@ -64477,10 +66992,11 @@ var ts;
};
Session.prototype.reload = function (args, reqSeq) {
var file = server.toNormalizedPath(args.file);
+ var tempFileName = args.tmpfile && server.toNormalizedPath(args.tmpfile);
var project = this.projectService.getDefaultProjectForFile(file, true);
if (project) {
this.changeSeq++;
- if (project.reloadScript(file)) {
+ if (project.reloadScript(file, tempFileName)) {
this.output(undefined, CommandNames.Reload, reqSeq);
}
}
@@ -64561,7 +67077,7 @@ var ts;
kind: navItem.kind,
file: navItem.fileName,
start: start,
- end: end
+ end: end,
};
if (navItem.kindModifiers && (navItem.kindModifiers !== "")) {
bakedItem.kindModifiers = navItem.kindModifiers;
@@ -64670,7 +67186,7 @@ var ts;
if (languageServiceDisabled) {
return;
}
- var fileNamesInProject = fileNames.filter(function (value, index, array) { return value.indexOf("lib.d.ts") < 0; });
+ var fileNamesInProject = fileNames.filter(function (value) { return value.indexOf("lib.d.ts") < 0; });
var highPriorityFiles = [];
var mediumPriorityFiles = [];
var lowPriorityFiles = [];
@@ -64790,7 +67306,7 @@ var ts;
this.goSubtree = true;
this.done = false;
}
- BaseLineIndexWalker.prototype.leaf = function (rangeStart, rangeLength, ll) {
+ BaseLineIndexWalker.prototype.leaf = function (_rangeStart, _rangeLength, _ll) {
};
return BaseLineIndexWalker;
}());
@@ -64885,14 +67401,14 @@ var ts;
}
return this.lineIndex;
};
- EditWalker.prototype.post = function (relativeStart, relativeLength, lineCollection, parent, nodeType) {
+ EditWalker.prototype.post = function (_relativeStart, _relativeLength, lineCollection) {
if (lineCollection === this.lineCollectionAtBranch) {
this.state = CharRangeSection.End;
}
this.stack.length--;
return undefined;
};
- EditWalker.prototype.pre = function (relativeStart, relativeLength, lineCollection, parent, nodeType) {
+ EditWalker.prototype.pre = function (_relativeStart, _relativeLength, lineCollection, _parent, nodeType) {
var currentNode = this.stack[this.stack.length - 1];
if ((this.state === CharRangeSection.Entire) && (nodeType === CharRangeSection.Start)) {
this.state = CharRangeSection.Start;
@@ -65117,7 +67633,7 @@ var ts;
var starts = [-1];
var count = 1;
var pos = 0;
- this.index.every(function (ll, s, len) {
+ this.index.every(function (ll) {
starts[count] = pos;
count++;
pos += ll.text.length;
@@ -65261,1415 +67777,728 @@ var ts;
walker.insertLines(newText);
}
if (this.checkEdits) {
- var updatedText = this.getText(0, this.root.charCount());
- ts.Debug.assert(checkText == updatedText, "buffer edit mismatch");
- }
- return walker.lineIndex;
- }
- };
- LineIndex.buildTreeFromBottom = function (nodes) {
- var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity);
- var interiorNodes = [];
- var nodeIndex = 0;
- for (var i = 0; i < nodeCount; i++) {
- interiorNodes[i] = new LineNode();
- var charCount = 0;
- var lineCount = 0;
- for (var j = 0; j < lineCollectionCapacity; j++) {
- if (nodeIndex < nodes.length) {
- interiorNodes[i].add(nodes[nodeIndex]);
- charCount += nodes[nodeIndex].charCount();
- lineCount += nodes[nodeIndex].lineCount();
- }
- else {
- break;
- }
- nodeIndex++;
- }
- interiorNodes[i].totalChars = charCount;
- interiorNodes[i].totalLines = lineCount;
- }
- if (interiorNodes.length === 1) {
- return interiorNodes[0];
- }
- else {
- return this.buildTreeFromBottom(interiorNodes);
- }
- };
- LineIndex.linesFromText = function (text) {
- var lineStarts = ts.computeLineStarts(text);
- if (lineStarts.length === 0) {
- return { lines: [], lineMap: lineStarts };
- }
- var lines = new Array(lineStarts.length);
- var lc = lineStarts.length - 1;
- for (var lmi = 0; lmi < lc; lmi++) {
- lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]);
- }
- var endText = text.substring(lineStarts[lc]);
- if (endText.length > 0) {
- lines[lc] = endText;
- }
- else {
- lines.length--;
- }
- return { lines: lines, lineMap: lineStarts };
- };
- return LineIndex;
- }());
- server.LineIndex = LineIndex;
- var LineNode = (function () {
- function LineNode() {
- this.totalChars = 0;
- this.totalLines = 0;
- this.children = [];
- }
- LineNode.prototype.isLeaf = function () {
- return false;
- };
- LineNode.prototype.updateCounts = function () {
- this.totalChars = 0;
- this.totalLines = 0;
- for (var i = 0, len = this.children.length; i < len; i++) {
- var child = this.children[i];
- this.totalChars += child.charCount();
- this.totalLines += child.lineCount();
- }
- };
- LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) {
- if (walkFns.pre) {
- walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType);
- }
- if (walkFns.goSubtree) {
- this.children[childIndex].walk(rangeStart, rangeLength, walkFns);
- if (walkFns.post) {
- walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType);
- }
- }
- else {
- walkFns.goSubtree = true;
- }
- return walkFns.done;
- };
- LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) {
- if (walkFns.pre && (!walkFns.done)) {
- walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType);
- walkFns.goSubtree = true;
- }
- };
- LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) {
- var childIndex = 0;
- var child = this.children[0];
- var childCharCount = child.charCount();
- var adjustedStart = rangeStart;
- while (adjustedStart >= childCharCount) {
- this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart);
- adjustedStart -= childCharCount;
- childIndex++;
- child = this.children[childIndex];
- childCharCount = child.charCount();
- }
- if ((adjustedStart + rangeLength) <= childCharCount) {
- if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) {
- return;
- }
- }
- else {
- if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) {
- return;
- }
- var adjustedLength = rangeLength - (childCharCount - adjustedStart);
- childIndex++;
- child = this.children[childIndex];
- childCharCount = child.charCount();
- while (adjustedLength > childCharCount) {
- if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) {
- return;
- }
- adjustedLength -= childCharCount;
- childIndex++;
- child = this.children[childIndex];
- childCharCount = child.charCount();
- }
- if (adjustedLength > 0) {
- if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) {
- return;
- }
- }
- }
- if (walkFns.pre) {
- var clen = this.children.length;
- if (childIndex < (clen - 1)) {
- for (var ej = childIndex + 1; ej < clen; ej++) {
- this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd);
- }
- }
- }
- };
- LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) {
- var childInfo = this.childFromCharOffset(lineNumber, charOffset);
- if (!childInfo.child) {
- return {
- line: lineNumber,
- offset: charOffset
- };
- }
- else if (childInfo.childIndex < this.children.length) {
- if (childInfo.child.isLeaf()) {
- return {
- line: childInfo.lineNumber,
- offset: childInfo.charOffset,
- text: (childInfo.child).text,
- leaf: (childInfo.child)
- };
- }
- else {
- var lineNode = (childInfo.child);
- return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset);
- }
- }
- else {
- var lineInfo = this.lineNumberToInfo(this.lineCount(), 0);
- return { line: this.lineCount(), offset: lineInfo.leaf.charCount() };
- }
- };
- LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) {
- var childInfo = this.childFromLineNumber(lineNumber, charOffset);
- if (!childInfo.child) {
- return {
- line: lineNumber,
- offset: charOffset
- };
- }
- else if (childInfo.child.isLeaf()) {
- return {
- line: lineNumber,
- offset: childInfo.charOffset,
- text: (childInfo.child).text,
- leaf: (childInfo.child)
- };
- }
- else {
- var lineNode = (childInfo.child);
- return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset);
- }
- };
- LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) {
- var child;
- var relativeLineNumber = lineNumber;
- var i;
- var len;
- for (i = 0, len = this.children.length; i < len; i++) {
- child = this.children[i];
- var childLineCount = child.lineCount();
- if (childLineCount >= relativeLineNumber) {
- break;
- }
- else {
- relativeLineNumber -= childLineCount;
- charOffset += child.charCount();
- }
- }
- return {
- child: child,
- childIndex: i,
- relativeLineNumber: relativeLineNumber,
- charOffset: charOffset
- };
- };
- LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) {
- var child;
- var i;
- var len;
- for (i = 0, len = this.children.length; i < len; i++) {
- child = this.children[i];
- if (child.charCount() > charOffset) {
- break;
- }
- else {
- charOffset -= child.charCount();
- lineNumber += child.lineCount();
- }
- }
- return {
- child: child,
- childIndex: i,
- charOffset: charOffset,
- lineNumber: lineNumber
- };
- };
- LineNode.prototype.splitAfter = function (childIndex) {
- var splitNode;
- var clen = this.children.length;
- childIndex++;
- var endLength = childIndex;
- if (childIndex < clen) {
- splitNode = new LineNode();
- while (childIndex < clen) {
- splitNode.add(this.children[childIndex]);
- childIndex++;
- }
- splitNode.updateCounts();
- }
- this.children.length = endLength;
- return splitNode;
- };
- LineNode.prototype.remove = function (child) {
- var childIndex = this.findChildIndex(child);
- var clen = this.children.length;
- if (childIndex < (clen - 1)) {
- for (var i = childIndex; i < (clen - 1); i++) {
- this.children[i] = this.children[i + 1];
- }
- }
- this.children.length--;
- };
- LineNode.prototype.findChildIndex = function (child) {
- var childIndex = 0;
- var clen = this.children.length;
- while ((this.children[childIndex] !== child) && (childIndex < clen))
- childIndex++;
- return childIndex;
- };
- LineNode.prototype.insertAt = function (child, nodes) {
- var childIndex = this.findChildIndex(child);
- var clen = this.children.length;
- var nodeCount = nodes.length;
- if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) {
- this.add(nodes[0]);
- this.updateCounts();
- return [];
- }
- else {
- var shiftNode = this.splitAfter(childIndex);
- var nodeIndex = 0;
- childIndex++;
- while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) {
- this.children[childIndex] = nodes[nodeIndex];
- childIndex++;
- nodeIndex++;
- }
- var splitNodes = [];
- var splitNodeCount = 0;
- if (nodeIndex < nodeCount) {
- splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity);
- splitNodes = new Array(splitNodeCount);
- var splitNodeIndex = 0;
- for (var i = 0; i < splitNodeCount; i++) {
- splitNodes[i] = new LineNode();
- }
- var splitNode = splitNodes[0];
- while (nodeIndex < nodeCount) {
- splitNode.add(nodes[nodeIndex]);
- nodeIndex++;
- if (splitNode.children.length === lineCollectionCapacity) {
- splitNodeIndex++;
- splitNode = splitNodes[splitNodeIndex];
- }
- }
- for (var i = splitNodes.length - 1; i >= 0; i--) {
- if (splitNodes[i].children.length === 0) {
- splitNodes.length--;
- }
- }
- }
- if (shiftNode) {
- splitNodes[splitNodes.length] = shiftNode;
- }
- this.updateCounts();
- for (var i = 0; i < splitNodeCount; i++) {
- splitNodes[i].updateCounts();
- }
- return splitNodes;
- }
- };
- LineNode.prototype.add = function (collection) {
- this.children[this.children.length] = collection;
- return (this.children.length < lineCollectionCapacity);
- };
- LineNode.prototype.charCount = function () {
- return this.totalChars;
- };
- LineNode.prototype.lineCount = function () {
- return this.totalLines;
- };
- return LineNode;
- }());
- server.LineNode = LineNode;
- var LineLeaf = (function () {
- function LineLeaf(text) {
- this.text = text;
- }
- LineLeaf.prototype.isLeaf = function () {
- return true;
- };
- LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) {
- walkFns.leaf(rangeStart, rangeLength, this);
- };
- LineLeaf.prototype.charCount = function () {
- return this.text.length;
- };
- LineLeaf.prototype.lineCount = function () {
- return 1;
- };
- return LineLeaf;
- }());
- server.LineLeaf = LineLeaf;
- })(server = ts.server || (ts.server = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- var server;
- (function (server) {
- var net = require("net");
- var childProcess = require("child_process");
- var os = require("os");
- function getGlobalTypingsCacheLocation() {
- var basePath;
- switch (process.platform) {
- case "win32":
- basePath = process.env.LOCALAPPDATA || process.env.APPDATA || os.homedir();
- break;
- case "linux":
- basePath = os.homedir();
- break;
- case "darwin":
- basePath = ts.combinePaths(os.homedir(), "Library/Application Support/");
- break;
- }
- ts.Debug.assert(basePath !== undefined);
- return ts.combinePaths(ts.normalizeSlashes(basePath), "Microsoft/TypeScript");
- }
- var readline = require("readline");
- var fs = require("fs");
- var rl = readline.createInterface({
- input: process.stdin,
- output: process.stdout,
- terminal: false
- });
- var Logger = (function () {
- function Logger(logFilename, traceToConsole, level) {
- this.logFilename = logFilename;
- this.traceToConsole = traceToConsole;
- this.level = level;
- this.fd = -1;
- this.seq = 0;
- this.inGroup = false;
- this.firstInGroup = true;
- }
- Logger.padStringRight = function (str, padding) {
- return (str + padding).slice(0, padding.length);
- };
- Logger.prototype.close = function () {
- if (this.fd >= 0) {
- fs.close(this.fd);
- }
- };
- Logger.prototype.getLogFileName = function () {
- return this.logFilename;
- };
- Logger.prototype.perftrc = function (s) {
- this.msg(s, server.Msg.Perf);
- };
- Logger.prototype.info = function (s) {
- this.msg(s, server.Msg.Info);
- };
- Logger.prototype.startGroup = function () {
- this.inGroup = true;
- this.firstInGroup = true;
- };
- Logger.prototype.endGroup = function () {
- this.inGroup = false;
- this.seq++;
- this.firstInGroup = true;
- };
- Logger.prototype.loggingEnabled = function () {
- return !!this.logFilename || this.traceToConsole;
- };
- Logger.prototype.hasLevel = function (level) {
- return this.loggingEnabled() && this.level >= level;
- };
- Logger.prototype.msg = function (s, type) {
- if (type === void 0) { type = server.Msg.Err; }
- if (this.fd < 0) {
- if (this.logFilename) {
- this.fd = fs.openSync(this.logFilename, "w");
- }
- }
- if (this.fd >= 0 || this.traceToConsole) {
- s = s + "\n";
- var prefix = Logger.padStringRight(type + " " + this.seq.toString(), " ");
- if (this.firstInGroup) {
- s = prefix + s;
- this.firstInGroup = false;
- }
- if (!this.inGroup) {
- this.seq++;
- this.firstInGroup = true;
- }
- if (this.fd >= 0) {
- var buf = new Buffer(s);
- fs.writeSync(this.fd, buf, 0, buf.length, null);
- }
- if (this.traceToConsole) {
- console.warn(s);
- }
- }
- };
- return Logger;
- }());
- var NodeTypingsInstaller = (function () {
- function NodeTypingsInstaller(logger, eventPort, globalTypingsCacheLocation, newLine) {
- var _this = this;
- this.logger = logger;
- this.eventPort = eventPort;
- this.globalTypingsCacheLocation = globalTypingsCacheLocation;
- this.newLine = newLine;
- if (eventPort) {
- var s_1 = net.connect({ port: eventPort }, function () {
- _this.socket = s_1;
- });
- }
- }
- NodeTypingsInstaller.prototype.attach = function (projectService) {
- var _this = this;
- this.projectService = projectService;
- if (this.logger.hasLevel(server.LogLevel.requestTime)) {
- this.logger.info("Binding...");
- }
- var args = ["--globalTypingsCacheLocation", this.globalTypingsCacheLocation];
- if (this.logger.loggingEnabled() && this.logger.getLogFileName()) {
- args.push("--logFile", ts.combinePaths(ts.getDirectoryPath(ts.normalizeSlashes(this.logger.getLogFileName())), "ti-" + process.pid + ".log"));
- }
- var execArgv = [];
- {
- for (var _i = 0, _a = process.execArgv; _i < _a.length; _i++) {
- var arg = _a[_i];
- var match = /^--(debug|inspect)(=(\d+))?$/.exec(arg);
- if (match) {
- var currentPort = match[3] !== undefined
- ? +match[3]
- : match[1] === "debug" ? 5858 : 9229;
- execArgv.push("--" + match[1] + "=" + (currentPort + 1));
+ var updatedText = this.getText(0, this.root.charCount());
+ ts.Debug.assert(checkText == updatedText, "buffer edit mismatch");
+ }
+ return walker.lineIndex;
+ }
+ };
+ LineIndex.buildTreeFromBottom = function (nodes) {
+ var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity);
+ var interiorNodes = [];
+ var nodeIndex = 0;
+ for (var i = 0; i < nodeCount; i++) {
+ interiorNodes[i] = new LineNode();
+ var charCount = 0;
+ var lineCount = 0;
+ for (var j = 0; j < lineCollectionCapacity; j++) {
+ if (nodeIndex < nodes.length) {
+ interiorNodes[i].add(nodes[nodeIndex]);
+ charCount += nodes[nodeIndex].charCount();
+ lineCount += nodes[nodeIndex].lineCount();
+ }
+ else {
break;
}
+ nodeIndex++;
}
+ interiorNodes[i].totalChars = charCount;
+ interiorNodes[i].totalLines = lineCount;
}
- this.installer = childProcess.fork(ts.combinePaths(__dirname, "typingsInstaller.js"), args, { execArgv: execArgv });
- this.installer.on("message", function (m) { return _this.handleMessage(m); });
- process.on("exit", function () {
- _this.installer.kill();
- });
- };
- NodeTypingsInstaller.prototype.onProjectClosed = function (p) {
- this.installer.send({ projectName: p.getProjectName(), kind: "closeProject" });
- };
- NodeTypingsInstaller.prototype.enqueueInstallTypingsRequest = function (project, typingOptions) {
- var request = server.createInstallTypingsRequest(project, typingOptions);
- if (this.logger.hasLevel(server.LogLevel.verbose)) {
- this.logger.info("Sending request: " + JSON.stringify(request));
+ if (interiorNodes.length === 1) {
+ return interiorNodes[0];
+ }
+ else {
+ return this.buildTreeFromBottom(interiorNodes);
}
- this.installer.send(request);
};
- NodeTypingsInstaller.prototype.handleMessage = function (response) {
- if (this.logger.hasLevel(server.LogLevel.verbose)) {
- this.logger.info("Received response: " + JSON.stringify(response));
+ LineIndex.linesFromText = function (text) {
+ var lineStarts = ts.computeLineStarts(text);
+ if (lineStarts.length === 0) {
+ return { lines: [], lineMap: lineStarts };
}
- this.projectService.updateTypingsForProject(response);
- if (response.kind == "set" && this.socket) {
- this.socket.write(server.formatMessage({ seq: 0, type: "event", message: response }, this.logger, Buffer.byteLength, this.newLine), "utf8");
+ var lines = new Array(lineStarts.length);
+ var lc = lineStarts.length - 1;
+ for (var lmi = 0; lmi < lc; lmi++) {
+ lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]);
+ }
+ var endText = text.substring(lineStarts[lc]);
+ if (endText.length > 0) {
+ lines[lc] = endText;
+ }
+ else {
+ lines.length--;
}
+ return { lines: lines, lineMap: lineStarts };
};
- return NodeTypingsInstaller;
+ return LineIndex;
}());
- var IOSession = (function (_super) {
- __extends(IOSession, _super);
- function IOSession(host, cancellationToken, installerEventPort, canUseEvents, useSingleInferredProject, globalTypingsCacheLocation, logger) {
- return _super.call(this, host, cancellationToken, useSingleInferredProject, new NodeTypingsInstaller(logger, installerEventPort, globalTypingsCacheLocation, host.newLine), Buffer.byteLength, process.hrtime, logger, canUseEvents) || this;
+ server.LineIndex = LineIndex;
+ var LineNode = (function () {
+ function LineNode() {
+ this.totalChars = 0;
+ this.totalLines = 0;
+ this.children = [];
}
- IOSession.prototype.exit = function () {
- this.logger.info("Exiting...");
- this.projectService.closeLog();
- process.exit(0);
+ LineNode.prototype.isLeaf = function () {
+ return false;
};
- IOSession.prototype.listen = function () {
- var _this = this;
- rl.on("line", function (input) {
- var message = input.trim();
- _this.onMessage(message);
- });
- rl.on("close", function () {
- _this.exit();
- });
+ LineNode.prototype.updateCounts = function () {
+ this.totalChars = 0;
+ this.totalLines = 0;
+ for (var i = 0, len = this.children.length; i < len; i++) {
+ var child = this.children[i];
+ this.totalChars += child.charCount();
+ this.totalLines += child.lineCount();
+ }
};
- return IOSession;
- }(server.Session));
- function parseLoggingEnvironmentString(logEnvStr) {
- var logEnv = { logToFile: true };
- var args = logEnvStr.split(" ");
- for (var i = 0, len = args.length; i < (len - 1); i += 2) {
- var option = args[i];
- var value = args[i + 1];
- if (option && value) {
- switch (option) {
- case "-file":
- logEnv.file = ts.stripQuotes(value);
- break;
- case "-level":
- var level = server.LogLevel[value];
- logEnv.detailLevel = typeof level === "number" ? level : server.LogLevel.normal;
- break;
- case "-traceToConsole":
- logEnv.traceToConsole = value.toLowerCase() === "true";
- break;
- case "-logToFile":
- logEnv.logToFile = value.toLowerCase() === "true";
- break;
- }
+ LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) {
+ if (walkFns.pre) {
+ walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType);
}
- }
- return logEnv;
- }
- function createLoggerFromEnv() {
- var fileName = undefined;
- var detailLevel = server.LogLevel.normal;
- var traceToConsole = false;
- var logEnvStr = process.env["TSS_LOG"];
- if (logEnvStr) {
- var logEnv = parseLoggingEnvironmentString(logEnvStr);
- if (logEnv.logToFile) {
- if (logEnv.file) {
- fileName = logEnv.file;
- }
- else {
- fileName = __dirname + "/.log" + process.pid.toString();
+ if (walkFns.goSubtree) {
+ this.children[childIndex].walk(rangeStart, rangeLength, walkFns);
+ if (walkFns.post) {
+ walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType);
}
}
- if (logEnv.detailLevel) {
- detailLevel = logEnv.detailLevel;
+ else {
+ walkFns.goSubtree = true;
}
- traceToConsole = logEnv.traceToConsole;
- }
- return new Logger(fileName, traceToConsole, detailLevel);
- }
- function createPollingWatchedFileSet(interval, chunkSize) {
- if (interval === void 0) { interval = 2500; }
- if (chunkSize === void 0) { chunkSize = 30; }
- var watchedFiles = [];
- var nextFileToCheck = 0;
- var watchTimer;
- function getModifiedTime(fileName) {
- return fs.statSync(fileName).mtime;
- }
- function poll(checkedIndex) {
- var watchedFile = watchedFiles[checkedIndex];
- if (!watchedFile) {
- return;
+ return walkFns.done;
+ };
+ LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) {
+ if (walkFns.pre && (!walkFns.done)) {
+ walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType);
+ walkFns.goSubtree = true;
}
- fs.stat(watchedFile.fileName, function (err, stats) {
- if (err) {
- watchedFile.callback(watchedFile.fileName);
+ };
+ LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) {
+ var childIndex = 0;
+ var child = this.children[0];
+ var childCharCount = child.charCount();
+ var adjustedStart = rangeStart;
+ while (adjustedStart >= childCharCount) {
+ this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart);
+ adjustedStart -= childCharCount;
+ childIndex++;
+ child = this.children[childIndex];
+ childCharCount = child.charCount();
+ }
+ if ((adjustedStart + rangeLength) <= childCharCount) {
+ if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) {
+ return;
}
- else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) {
- watchedFile.mtime = getModifiedTime(watchedFile.fileName);
- watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0);
+ }
+ else {
+ if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) {
+ return;
}
- });
- }
- function startWatchTimer() {
- watchTimer = setInterval(function () {
- var count = 0;
- var nextToCheck = nextFileToCheck;
- var firstCheck = -1;
- while ((count < chunkSize) && (nextToCheck !== firstCheck)) {
- poll(nextToCheck);
- if (firstCheck < 0) {
- firstCheck = nextToCheck;
+ var adjustedLength = rangeLength - (childCharCount - adjustedStart);
+ childIndex++;
+ child = this.children[childIndex];
+ childCharCount = child.charCount();
+ while (adjustedLength > childCharCount) {
+ if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) {
+ return;
}
- nextToCheck++;
- if (nextToCheck === watchedFiles.length) {
- nextToCheck = 0;
+ adjustedLength -= childCharCount;
+ childIndex++;
+ child = this.children[childIndex];
+ childCharCount = child.charCount();
+ }
+ if (adjustedLength > 0) {
+ if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) {
+ return;
}
- count++;
}
- nextFileToCheck = nextToCheck;
- }, interval);
- }
- function addFile(fileName, callback) {
- var file = {
- fileName: fileName,
- callback: callback,
- mtime: getModifiedTime(fileName)
- };
- watchedFiles.push(file);
- if (watchedFiles.length === 1) {
- startWatchTimer();
- }
- return file;
- }
- function removeFile(file) {
- ts.unorderedRemoveItem(watchedFiles, file);
- }
- return {
- getModifiedTime: getModifiedTime,
- poll: poll,
- startWatchTimer: startWatchTimer,
- addFile: addFile,
- removeFile: removeFile
- };
- }
- var pollingWatchedFileSet = createPollingWatchedFileSet();
- var logger = createLoggerFromEnv();
- var pending = [];
- var canWrite = true;
- function writeMessage(buf) {
- if (!canWrite) {
- pending.push(buf);
- }
- else {
- canWrite = false;
- process.stdout.write(buf, setCanWriteFlagAndWriteMessageIfNecessary);
- }
- }
- function setCanWriteFlagAndWriteMessageIfNecessary() {
- canWrite = true;
- if (pending.length) {
- writeMessage(pending.shift());
- }
- }
- var sys = ts.sys;
- sys.write = function (s) { return writeMessage(new Buffer(s, "utf8")); };
- sys.watchFile = function (fileName, callback) {
- var watchedFile = pollingWatchedFileSet.addFile(fileName, callback);
- return {
- close: function () { return pollingWatchedFileSet.removeFile(watchedFile); }
- };
- };
- sys.setTimeout = setTimeout;
- sys.clearTimeout = clearTimeout;
- sys.setImmediate = setImmediate;
- sys.clearImmediate = clearImmediate;
- if (typeof global !== "undefined" && global.gc) {
- sys.gc = function () { return global.gc(); };
- }
- var cancellationToken;
- try {
- var factory = require("./cancellationToken");
- cancellationToken = factory(sys.args);
- }
- catch (e) {
- cancellationToken = {
- isCancellationRequested: function () { return false; }
- };
- }
- ;
- var eventPort;
- {
- var index = sys.args.indexOf("--eventPort");
- if (index >= 0 && index < sys.args.length - 1) {
- var v = parseInt(sys.args[index + 1]);
- if (!isNaN(v)) {
- eventPort = v;
}
- }
- }
- var useSingleInferredProject = sys.args.indexOf("--useSingleInferredProject") >= 0;
- var ioSession = new IOSession(sys, cancellationToken, eventPort, eventPort === undefined, useSingleInferredProject, getGlobalTypingsCacheLocation(), logger);
- process.on("uncaughtException", function (err) {
- ioSession.logError(err, "unknown");
- });
- process.noAsar = true;
- ioSession.listen();
- })(server = ts.server || (ts.server = {}));
-})(ts || (ts = {}));
-var debugObjectHost = (function () { return this; })();
-var ts;
-(function (ts) {
- function logInternalError(logger, err) {
- if (logger) {
- logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message);
- }
- }
- var ScriptSnapshotShimAdapter = (function () {
- function ScriptSnapshotShimAdapter(scriptSnapshotShim) {
- this.scriptSnapshotShim = scriptSnapshotShim;
- }
- ScriptSnapshotShimAdapter.prototype.getText = function (start, end) {
- return this.scriptSnapshotShim.getText(start, end);
- };
- ScriptSnapshotShimAdapter.prototype.getLength = function () {
- return this.scriptSnapshotShim.getLength();
- };
- ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) {
- var oldSnapshotShim = oldSnapshot;
- var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim);
- if (encoded == null) {
- return null;
- }
- var decoded = JSON.parse(encoded);
- return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength);
- };
- ScriptSnapshotShimAdapter.prototype.dispose = function () {
- if ("dispose" in this.scriptSnapshotShim) {
- this.scriptSnapshotShim.dispose();
- }
- };
- return ScriptSnapshotShimAdapter;
- }());
- var LanguageServiceShimHostAdapter = (function () {
- function LanguageServiceShimHostAdapter(shimHost) {
- var _this = this;
- this.shimHost = shimHost;
- this.loggingEnabled = false;
- this.tracingEnabled = false;
- if ("getModuleResolutionsForFile" in this.shimHost) {
- this.resolveModuleNames = function (moduleNames, containingFile) {
- var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile));
- return ts.map(moduleNames, function (name) {
- var result = ts.getProperty(resolutionsInFile, name);
- return result ? { resolvedFileName: result } : undefined;
- });
- };
- }
- if ("directoryExists" in this.shimHost) {
- this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); };
- }
- if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) {
- this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) {
- var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile));
- return ts.map(typeDirectiveNames, function (name) { return ts.getProperty(typeDirectivesForFile, name); });
- };
- }
- }
- LanguageServiceShimHostAdapter.prototype.log = function (s) {
- if (this.loggingEnabled) {
- this.shimHost.log(s);
- }
- };
- LanguageServiceShimHostAdapter.prototype.trace = function (s) {
- if (this.tracingEnabled) {
- this.shimHost.trace(s);
- }
- };
- LanguageServiceShimHostAdapter.prototype.error = function (s) {
- this.shimHost.error(s);
- };
- LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () {
- if (!this.shimHost.getProjectVersion) {
- return undefined;
- }
- return this.shimHost.getProjectVersion();
- };
- LanguageServiceShimHostAdapter.prototype.getTypeRootsVersion = function () {
- if (!this.shimHost.getTypeRootsVersion) {
- return 0;
- }
- return this.shimHost.getTypeRootsVersion();
- };
- LanguageServiceShimHostAdapter.prototype.useCaseSensitiveFileNames = function () {
- return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false;
- };
- LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () {
- var settingsJson = this.shimHost.getCompilationSettings();
- if (settingsJson == null || settingsJson == "") {
- throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings");
- }
- return JSON.parse(settingsJson);
- };
- LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () {
- var encoded = this.shimHost.getScriptFileNames();
- return this.files = JSON.parse(encoded);
- };
- LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) {
- var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName);
- return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot);
- };
- LanguageServiceShimHostAdapter.prototype.getScriptKind = function (fileName) {
- if ("getScriptKind" in this.shimHost) {
- return this.shimHost.getScriptKind(fileName);
- }
- else {
- return 0;
- }
- };
- LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) {
- return this.shimHost.getScriptVersion(fileName);
- };
- LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () {
- var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages();
- if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") {
- return null;
- }
- try {
- return JSON.parse(diagnosticMessagesJson);
- }
- catch (e) {
- this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format");
- return null;
- }
- };
- LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () {
- var hostCancellationToken = this.shimHost.getCancellationToken();
- return new ThrottledCancellationToken(hostCancellationToken);
- };
- LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () {
- return this.shimHost.getCurrentDirectory();
- };
- LanguageServiceShimHostAdapter.prototype.getDirectories = function (path) {
- return JSON.parse(this.shimHost.getDirectories(path));
- };
- LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) {
- return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
- };
- LanguageServiceShimHostAdapter.prototype.readDirectory = function (path, extensions, exclude, include, depth) {
- var pattern = ts.getFileMatcherPatterns(path, extensions, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory());
- return JSON.parse(this.shimHost.readDirectory(path, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth));
- };
- LanguageServiceShimHostAdapter.prototype.readFile = function (path, encoding) {
- return this.shimHost.readFile(path, encoding);
- };
- LanguageServiceShimHostAdapter.prototype.fileExists = function (path) {
- return this.shimHost.fileExists(path);
- };
- return LanguageServiceShimHostAdapter;
- }());
- ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter;
- var ThrottledCancellationToken = (function () {
- function ThrottledCancellationToken(hostCancellationToken) {
- this.hostCancellationToken = hostCancellationToken;
- this.lastCancellationCheckTime = 0;
- }
- ThrottledCancellationToken.prototype.isCancellationRequested = function () {
- var time = ts.timestamp();
- var duration = Math.abs(time - this.lastCancellationCheckTime);
- if (duration > 10) {
- this.lastCancellationCheckTime = time;
- return this.hostCancellationToken.isCancellationRequested();
- }
- return false;
- };
- return ThrottledCancellationToken;
- }());
- var CoreServicesShimHostAdapter = (function () {
- function CoreServicesShimHostAdapter(shimHost) {
- var _this = this;
- this.shimHost = shimHost;
- this.useCaseSensitiveFileNames = this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false;
- if ("directoryExists" in this.shimHost) {
- this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); };
- }
- if ("realpath" in this.shimHost) {
- this.realpath = function (path) { return _this.shimHost.realpath(path); };
- }
- }
- CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extensions, exclude, include, depth) {
- try {
- var pattern = ts.getFileMatcherPatterns(rootDir, extensions, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory());
- return JSON.parse(this.shimHost.readDirectory(rootDir, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth));
- }
- catch (e) {
- var results = [];
- for (var _i = 0, extensions_2 = extensions; _i < extensions_2.length; _i++) {
- var extension = extensions_2[_i];
- for (var _a = 0, _b = this.readDirectoryFallback(rootDir, extension, exclude); _a < _b.length; _a++) {
- var file = _b[_a];
- if (!ts.contains(results, file)) {
- results.push(file);
+ if (walkFns.pre) {
+ var clen = this.children.length;
+ if (childIndex < (clen - 1)) {
+ for (var ej = childIndex + 1; ej < clen; ej++) {
+ this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd);
}
}
}
- return results;
- }
- };
- CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) {
- return this.shimHost.fileExists(fileName);
- };
- CoreServicesShimHostAdapter.prototype.readFile = function (fileName) {
- return this.shimHost.readFile(fileName);
- };
- CoreServicesShimHostAdapter.prototype.readDirectoryFallback = function (rootDir, extension, exclude) {
- return JSON.parse(this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)));
- };
- CoreServicesShimHostAdapter.prototype.getDirectories = function (path) {
- return JSON.parse(this.shimHost.getDirectories(path));
- };
- return CoreServicesShimHostAdapter;
- }());
- ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter;
- function simpleForwardCall(logger, actionDescription, action, logPerformance) {
- var start;
- if (logPerformance) {
- logger.log(actionDescription);
- start = ts.timestamp();
- }
- var result = action();
- if (logPerformance) {
- var end = ts.timestamp();
- logger.log(actionDescription + " completed in " + (end - start) + " msec");
- if (typeof result === "string") {
- var str = result;
- if (str.length > 128) {
- str = str.substring(0, 128) + "...";
+ };
+ LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) {
+ var childInfo = this.childFromCharOffset(lineNumber, charOffset);
+ if (!childInfo.child) {
+ return {
+ line: lineNumber,
+ offset: charOffset,
+ };
}
- logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'");
- }
- }
- return result;
- }
- function forwardJSONCall(logger, actionDescription, action, logPerformance) {
- return forwardCall(logger, actionDescription, true, action, logPerformance);
- }
- function forwardCall(logger, actionDescription, returnJson, action, logPerformance) {
- try {
- var result = simpleForwardCall(logger, actionDescription, action, logPerformance);
- return returnJson ? JSON.stringify({ result: result }) : result;
- }
- catch (err) {
- if (err instanceof ts.OperationCanceledException) {
- return JSON.stringify({ canceled: true });
- }
- logInternalError(logger, err);
- err.description = actionDescription;
- return JSON.stringify({ error: err });
- }
- }
- var ShimBase = (function () {
- function ShimBase(factory) {
- this.factory = factory;
- factory.registerShim(this);
- }
- ShimBase.prototype.dispose = function (dummy) {
- this.factory.unregisterShim(this);
- };
- return ShimBase;
- }());
- function realizeDiagnostics(diagnostics, newLine) {
- return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine); });
- }
- ts.realizeDiagnostics = realizeDiagnostics;
- function realizeDiagnostic(diagnostic, newLine) {
- return {
- message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine),
- start: diagnostic.start,
- length: diagnostic.length,
- category: ts.DiagnosticCategory[diagnostic.category].toLowerCase(),
- code: diagnostic.code
- };
- }
- var LanguageServiceShimObject = (function (_super) {
- __extends(LanguageServiceShimObject, _super);
- function LanguageServiceShimObject(factory, host, languageService) {
- var _this = _super.call(this, factory) || this;
- _this.host = host;
- _this.languageService = languageService;
- _this.logPerformance = false;
- _this.logger = _this.host;
- return _this;
- }
- LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) {
- return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);
- };
- LanguageServiceShimObject.prototype.dispose = function (dummy) {
- this.logger.log("dispose()");
- this.languageService.dispose();
- this.languageService = null;
- if (debugObjectHost && debugObjectHost.CollectGarbage) {
- debugObjectHost.CollectGarbage();
- this.logger.log("CollectGarbage()");
+ else if (childInfo.childIndex < this.children.length) {
+ if (childInfo.child.isLeaf()) {
+ return {
+ line: childInfo.lineNumber,
+ offset: childInfo.charOffset,
+ text: (childInfo.child).text,
+ leaf: (childInfo.child)
+ };
+ }
+ else {
+ var lineNode = (childInfo.child);
+ return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset);
+ }
+ }
+ else {
+ var lineInfo = this.lineNumberToInfo(this.lineCount(), 0);
+ return { line: this.lineCount(), offset: lineInfo.leaf.charCount() };
+ }
+ };
+ LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) {
+ var childInfo = this.childFromLineNumber(lineNumber, charOffset);
+ if (!childInfo.child) {
+ return {
+ line: lineNumber,
+ offset: charOffset
+ };
+ }
+ else if (childInfo.child.isLeaf()) {
+ return {
+ line: lineNumber,
+ offset: childInfo.charOffset,
+ text: (childInfo.child).text,
+ leaf: (childInfo.child)
+ };
+ }
+ else {
+ var lineNode = (childInfo.child);
+ return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset);
+ }
+ };
+ LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) {
+ var child;
+ var relativeLineNumber = lineNumber;
+ var i;
+ var len;
+ for (i = 0, len = this.children.length; i < len; i++) {
+ child = this.children[i];
+ var childLineCount = child.lineCount();
+ if (childLineCount >= relativeLineNumber) {
+ break;
+ }
+ else {
+ relativeLineNumber -= childLineCount;
+ charOffset += child.charCount();
+ }
+ }
+ return {
+ child: child,
+ childIndex: i,
+ relativeLineNumber: relativeLineNumber,
+ charOffset: charOffset
+ };
+ };
+ LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) {
+ var child;
+ var i;
+ var len;
+ for (i = 0, len = this.children.length; i < len; i++) {
+ child = this.children[i];
+ if (child.charCount() > charOffset) {
+ break;
+ }
+ else {
+ charOffset -= child.charCount();
+ lineNumber += child.lineCount();
+ }
+ }
+ return {
+ child: child,
+ childIndex: i,
+ charOffset: charOffset,
+ lineNumber: lineNumber
+ };
+ };
+ LineNode.prototype.splitAfter = function (childIndex) {
+ var splitNode;
+ var clen = this.children.length;
+ childIndex++;
+ var endLength = childIndex;
+ if (childIndex < clen) {
+ splitNode = new LineNode();
+ while (childIndex < clen) {
+ splitNode.add(this.children[childIndex]);
+ childIndex++;
+ }
+ splitNode.updateCounts();
+ }
+ this.children.length = endLength;
+ return splitNode;
+ };
+ LineNode.prototype.remove = function (child) {
+ var childIndex = this.findChildIndex(child);
+ var clen = this.children.length;
+ if (childIndex < (clen - 1)) {
+ for (var i = childIndex; i < (clen - 1); i++) {
+ this.children[i] = this.children[i + 1];
+ }
+ }
+ this.children.length--;
+ };
+ LineNode.prototype.findChildIndex = function (child) {
+ var childIndex = 0;
+ var clen = this.children.length;
+ while ((this.children[childIndex] !== child) && (childIndex < clen))
+ childIndex++;
+ return childIndex;
+ };
+ LineNode.prototype.insertAt = function (child, nodes) {
+ var childIndex = this.findChildIndex(child);
+ var clen = this.children.length;
+ var nodeCount = nodes.length;
+ if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) {
+ this.add(nodes[0]);
+ this.updateCounts();
+ return [];
+ }
+ else {
+ var shiftNode = this.splitAfter(childIndex);
+ var nodeIndex = 0;
+ childIndex++;
+ while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) {
+ this.children[childIndex] = nodes[nodeIndex];
+ childIndex++;
+ nodeIndex++;
+ }
+ var splitNodes = [];
+ var splitNodeCount = 0;
+ if (nodeIndex < nodeCount) {
+ splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity);
+ splitNodes = new Array(splitNodeCount);
+ var splitNodeIndex = 0;
+ for (var i = 0; i < splitNodeCount; i++) {
+ splitNodes[i] = new LineNode();
+ }
+ var splitNode = splitNodes[0];
+ while (nodeIndex < nodeCount) {
+ splitNode.add(nodes[nodeIndex]);
+ nodeIndex++;
+ if (splitNode.children.length === lineCollectionCapacity) {
+ splitNodeIndex++;
+ splitNode = splitNodes[splitNodeIndex];
+ }
+ }
+ for (var i = splitNodes.length - 1; i >= 0; i--) {
+ if (splitNodes[i].children.length === 0) {
+ splitNodes.length--;
+ }
+ }
+ }
+ if (shiftNode) {
+ splitNodes[splitNodes.length] = shiftNode;
+ }
+ this.updateCounts();
+ for (var i = 0; i < splitNodeCount; i++) {
+ splitNodes[i].updateCounts();
+ }
+ return splitNodes;
+ }
+ };
+ LineNode.prototype.add = function (collection) {
+ this.children[this.children.length] = collection;
+ return (this.children.length < lineCollectionCapacity);
+ };
+ LineNode.prototype.charCount = function () {
+ return this.totalChars;
+ };
+ LineNode.prototype.lineCount = function () {
+ return this.totalLines;
+ };
+ return LineNode;
+ }());
+ server.LineNode = LineNode;
+ var LineLeaf = (function () {
+ function LineLeaf(text) {
+ this.text = text;
}
- this.logger = null;
- _super.prototype.dispose.call(this, dummy);
- };
- LanguageServiceShimObject.prototype.refresh = function (throwOnError) {
- this.forwardJSONCall("refresh(" + throwOnError + ")", function () { return null; });
- };
- LanguageServiceShimObject.prototype.cleanupSemanticCache = function () {
- var _this = this;
- this.forwardJSONCall("cleanupSemanticCache()", function () {
- _this.languageService.cleanupSemanticCache();
- return null;
- });
- };
- LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) {
- var newLine = ts.getNewLineOrDefaultFromHost(this.host);
- return ts.realizeDiagnostics(diagnostics, newLine);
- };
- LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) {
- var _this = this;
- return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); });
- };
- LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) {
- var _this = this;
- return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); });
- };
- LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) {
- var _this = this;
- return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); });
- };
- LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) {
- var _this = this;
- return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); });
- };
- LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) {
- var _this = this;
- return this.forwardJSONCall("getSyntacticDiagnostics('" + fileName + "')", function () {
- var diagnostics = _this.languageService.getSyntacticDiagnostics(fileName);
- return _this.realizeDiagnostics(diagnostics);
- });
- };
- LanguageServiceShimObject.prototype.getSemanticDiagnostics = function (fileName) {
- var _this = this;
- return this.forwardJSONCall("getSemanticDiagnostics('" + fileName + "')", function () {
- var diagnostics = _this.languageService.getSemanticDiagnostics(fileName);
- return _this.realizeDiagnostics(diagnostics);
- });
- };
- LanguageServiceShimObject.prototype.getCompilerOptionsDiagnostics = function () {
- var _this = this;
- return this.forwardJSONCall("getCompilerOptionsDiagnostics()", function () {
- var diagnostics = _this.languageService.getCompilerOptionsDiagnostics();
- return _this.realizeDiagnostics(diagnostics);
- });
- };
- LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position); });
- };
- LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) {
- var _this = this;
- return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); });
- };
- LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBreakpointStatementAtPosition(fileName, position); });
- };
- LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { return _this.languageService.getSignatureHelpItems(fileName, position); });
- };
- LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDefinitionAtPosition(fileName, position); });
- };
- LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position); });
- };
- LanguageServiceShimObject.prototype.getImplementationAtPosition = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getImplementationAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getImplementationAtPosition(fileName, position); });
- };
- LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position); });
- };
- LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) {
- var _this = this;
- return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); });
- };
- LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBraceMatchingAtPosition(fileName, position); });
- };
- LanguageServiceShimObject.prototype.isValidBraceCompletionAtPosition = function (fileName, position, openingBrace) {
- var _this = this;
- return this.forwardJSONCall("isValidBraceCompletionAtPosition('" + fileName + "', " + position + ", " + openingBrace + ")", function () { return _this.languageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace); });
- };
- LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options) {
- var _this = this;
- return this.forwardJSONCall("getIndentationAtPosition('" + fileName + "', " + position + ")", function () {
- var localOptions = JSON.parse(options);
- return _this.languageService.getIndentationAtPosition(fileName, position, localOptions);
- });
- };
- LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getReferencesAtPosition(fileName, position); });
- };
- LanguageServiceShimObject.prototype.findReferences = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { return _this.languageService.findReferences(fileName, position); });
- };
- LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getOccurrencesAtPosition(fileName, position); });
- };
- LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) {
- var _this = this;
- return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () {
- var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch));
- var normalizedName = ts.normalizeSlashes(fileName).toLowerCase();
- return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; });
- });
- };
- LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getCompletionsAtPosition(fileName, position); });
- };
- LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) {
- var _this = this;
- return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", '" + entryName + "')", function () { return _this.languageService.getCompletionEntryDetails(fileName, position, entryName); });
- };
- LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options) {
- var _this = this;
- return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () {
- var localOptions = JSON.parse(options);
- return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions);
- });
- };
- LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options) {
- var _this = this;
- return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () {
- var localOptions = JSON.parse(options);
- return _this.languageService.getFormattingEditsForDocument(fileName, localOptions);
- });
- };
- LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options) {
- var _this = this;
- return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () {
- var localOptions = JSON.parse(options);
- return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions);
- });
- };
- LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) {
- var _this = this;
- return this.forwardJSONCall("getDocCommentTemplateAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDocCommentTemplateAtPosition(fileName, position); });
- };
- LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount, fileName) {
- var _this = this;
- return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ", " + fileName + ")", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount, fileName); });
- };
- LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) {
- var _this = this;
- return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); });
- };
- LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) {
- var _this = this;
- return this.forwardJSONCall("getNavigationTree('" + fileName + "')", function () { return _this.languageService.getNavigationTree(fileName); });
- };
- LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) {
- var _this = this;
- return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); });
- };
- LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) {
- var _this = this;
- return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); });
- };
- LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) {
- var _this = this;
- return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { return _this.languageService.getEmitOutput(fileName); });
- };
- LanguageServiceShimObject.prototype.getEmitOutputObject = function (fileName) {
- var _this = this;
- return forwardCall(this.logger, "getEmitOutput('" + fileName + "')", false, function () { return _this.languageService.getEmitOutput(fileName); }, this.logPerformance);
- };
- return LanguageServiceShimObject;
- }(ShimBase));
- function convertClassifications(classifications) {
- return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState };
- }
- var ClassifierShimObject = (function (_super) {
- __extends(ClassifierShimObject, _super);
- function ClassifierShimObject(factory, logger) {
- var _this = _super.call(this, factory) || this;
- _this.logger = logger;
- _this.logPerformance = false;
- _this.classifier = ts.createClassifier();
- return _this;
- }
- ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) {
- var _this = this;
- return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); }, this.logPerformance);
- };
- ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) {
- var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics);
- var result = "";
- for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) {
- var item = _a[_i];
- result += item.length + "\n";
- result += item.classification + "\n";
+ LineLeaf.prototype.isLeaf = function () {
+ return true;
+ };
+ LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) {
+ walkFns.leaf(rangeStart, rangeLength, this);
+ };
+ LineLeaf.prototype.charCount = function () {
+ return this.text.length;
+ };
+ LineLeaf.prototype.lineCount = function () {
+ return 1;
+ };
+ return LineLeaf;
+ }());
+ server.LineLeaf = LineLeaf;
+ })(server = ts.server || (ts.server = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var server;
+ (function (server) {
+ var net = require("net");
+ var childProcess = require("child_process");
+ var os = require("os");
+ function getGlobalTypingsCacheLocation() {
+ var basePath;
+ switch (process.platform) {
+ case "win32":
+ basePath = process.env.LOCALAPPDATA || process.env.APPDATA || os.homedir();
+ break;
+ case "linux":
+ basePath = os.homedir();
+ break;
+ case "darwin":
+ basePath = ts.combinePaths(os.homedir(), "Library/Application Support/");
+ break;
}
- result += classification.finalLexState;
- return result;
- };
- return ClassifierShimObject;
- }(ShimBase));
- var CoreServicesShimObject = (function (_super) {
- __extends(CoreServicesShimObject, _super);
- function CoreServicesShimObject(factory, logger, host) {
- var _this = _super.call(this, factory) || this;
- _this.logger = logger;
- _this.host = host;
- _this.logPerformance = false;
- return _this;
+ ts.Debug.assert(basePath !== undefined);
+ return ts.combinePaths(ts.normalizeSlashes(basePath), "Microsoft/TypeScript");
}
- CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) {
- return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);
- };
- CoreServicesShimObject.prototype.resolveModuleName = function (fileName, moduleName, compilerOptionsJson) {
- var _this = this;
- return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () {
- var compilerOptions = JSON.parse(compilerOptionsJson);
- var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host);
- return {
- resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined,
- failedLookupLocations: result.failedLookupLocations
- };
- });
- };
- CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) {
- var _this = this;
- return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () {
- var compilerOptions = JSON.parse(compilerOptionsJson);
- var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host);
- return {
- resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined,
- primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true,
- failedLookupLocations: result.failedLookupLocations
- };
- });
- };
- CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) {
- var _this = this;
- return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () {
- var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), true, true);
- return {
- referencedFiles: _this.convertFileReferences(result.referencedFiles),
- importedFiles: _this.convertFileReferences(result.importedFiles),
- ambientExternalModules: result.ambientExternalModules,
- isLibFile: result.isLibFile,
- typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives)
- };
- });
- };
- CoreServicesShimObject.prototype.getAutomaticTypeDirectiveNames = function (compilerOptionsJson) {
- var _this = this;
- return this.forwardJSONCall("getAutomaticTypeDirectiveNames('" + compilerOptionsJson + "')", function () {
- var compilerOptions = JSON.parse(compilerOptionsJson);
- return ts.getAutomaticTypeDirectiveNames(compilerOptions, _this.host);
- });
- };
- CoreServicesShimObject.prototype.convertFileReferences = function (refs) {
- if (!refs) {
- return undefined;
+ var readline = require("readline");
+ var fs = require("fs");
+ var rl = readline.createInterface({
+ input: process.stdin,
+ output: process.stdout,
+ terminal: false,
+ });
+ var Logger = (function () {
+ function Logger(logFilename, traceToConsole, level) {
+ this.logFilename = logFilename;
+ this.traceToConsole = traceToConsole;
+ this.level = level;
+ this.fd = -1;
+ this.seq = 0;
+ this.inGroup = false;
+ this.firstInGroup = true;
}
- var result = [];
- for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) {
- var ref = refs_2[_i];
- result.push({
- path: ts.normalizeSlashes(ref.fileName),
- position: ref.pos,
- length: ref.end - ref.pos
+ Logger.padStringRight = function (str, padding) {
+ return (str + padding).slice(0, padding.length);
+ };
+ Logger.prototype.close = function () {
+ if (this.fd >= 0) {
+ fs.close(this.fd);
+ }
+ };
+ Logger.prototype.getLogFileName = function () {
+ return this.logFilename;
+ };
+ Logger.prototype.perftrc = function (s) {
+ this.msg(s, server.Msg.Perf);
+ };
+ Logger.prototype.info = function (s) {
+ this.msg(s, server.Msg.Info);
+ };
+ Logger.prototype.startGroup = function () {
+ this.inGroup = true;
+ this.firstInGroup = true;
+ };
+ Logger.prototype.endGroup = function () {
+ this.inGroup = false;
+ this.seq++;
+ this.firstInGroup = true;
+ };
+ Logger.prototype.loggingEnabled = function () {
+ return !!this.logFilename || this.traceToConsole;
+ };
+ Logger.prototype.hasLevel = function (level) {
+ return this.loggingEnabled() && this.level >= level;
+ };
+ Logger.prototype.msg = function (s, type) {
+ if (type === void 0) { type = server.Msg.Err; }
+ if (this.fd < 0) {
+ if (this.logFilename) {
+ this.fd = fs.openSync(this.logFilename, "w");
+ }
+ }
+ if (this.fd >= 0 || this.traceToConsole) {
+ s = s + "\n";
+ var prefix = Logger.padStringRight(type + " " + this.seq.toString(), " ");
+ if (this.firstInGroup) {
+ s = prefix + s;
+ this.firstInGroup = false;
+ }
+ if (!this.inGroup) {
+ this.seq++;
+ this.firstInGroup = true;
+ }
+ if (this.fd >= 0) {
+ var buf = new Buffer(s);
+ fs.writeSync(this.fd, buf, 0, buf.length, null);
+ }
+ if (this.traceToConsole) {
+ console.warn(s);
+ }
+ }
+ };
+ return Logger;
+ }());
+ var NodeTypingsInstaller = (function () {
+ function NodeTypingsInstaller(logger, eventPort, globalTypingsCacheLocation, newLine) {
+ var _this = this;
+ this.logger = logger;
+ this.globalTypingsCacheLocation = globalTypingsCacheLocation;
+ this.newLine = newLine;
+ if (eventPort) {
+ var s_1 = net.connect({ port: eventPort }, function () {
+ _this.socket = s_1;
+ });
+ }
+ }
+ NodeTypingsInstaller.prototype.attach = function (projectService) {
+ var _this = this;
+ this.projectService = projectService;
+ if (this.logger.hasLevel(server.LogLevel.requestTime)) {
+ this.logger.info("Binding...");
+ }
+ var args = ["--globalTypingsCacheLocation", this.globalTypingsCacheLocation];
+ if (this.logger.loggingEnabled() && this.logger.getLogFileName()) {
+ args.push("--logFile", ts.combinePaths(ts.getDirectoryPath(ts.normalizeSlashes(this.logger.getLogFileName())), "ti-" + process.pid + ".log"));
+ }
+ var execArgv = [];
+ {
+ for (var _i = 0, _a = process.execArgv; _i < _a.length; _i++) {
+ var arg = _a[_i];
+ var match = /^--(debug|inspect)(=(\d+))?$/.exec(arg);
+ if (match) {
+ var currentPort = match[3] !== undefined
+ ? +match[3]
+ : match[1] === "debug" ? 5858 : 9229;
+ execArgv.push("--" + match[1] + "=" + (currentPort + 1));
+ break;
+ }
+ }
+ }
+ this.installer = childProcess.fork(ts.combinePaths(__dirname, "typingsInstaller.js"), args, { execArgv: execArgv });
+ this.installer.on("message", function (m) { return _this.handleMessage(m); });
+ process.on("exit", function () {
+ _this.installer.kill();
});
+ };
+ NodeTypingsInstaller.prototype.onProjectClosed = function (p) {
+ this.installer.send({ projectName: p.getProjectName(), kind: "closeProject" });
+ };
+ NodeTypingsInstaller.prototype.enqueueInstallTypingsRequest = function (project, typingOptions) {
+ var request = server.createInstallTypingsRequest(project, typingOptions);
+ if (this.logger.hasLevel(server.LogLevel.verbose)) {
+ this.logger.info("Sending request: " + JSON.stringify(request));
+ }
+ this.installer.send(request);
+ };
+ NodeTypingsInstaller.prototype.handleMessage = function (response) {
+ if (this.logger.hasLevel(server.LogLevel.verbose)) {
+ this.logger.info("Received response: " + JSON.stringify(response));
+ }
+ this.projectService.updateTypingsForProject(response);
+ if (response.kind == "set" && this.socket) {
+ this.socket.write(server.formatMessage({ seq: 0, type: "event", message: response }, this.logger, Buffer.byteLength, this.newLine), "utf8");
+ }
+ };
+ return NodeTypingsInstaller;
+ }());
+ var IOSession = (function (_super) {
+ __extends(IOSession, _super);
+ function IOSession(host, cancellationToken, installerEventPort, canUseEvents, useSingleInferredProject, disableAutomaticTypingAcquisition, globalTypingsCacheLocation, logger) {
+ return _super.call(this, host, cancellationToken, useSingleInferredProject, disableAutomaticTypingAcquisition
+ ? server.nullTypingsInstaller
+ : new NodeTypingsInstaller(logger, installerEventPort, globalTypingsCacheLocation, host.newLine), Buffer.byteLength, process.hrtime, logger, canUseEvents) || this;
}
- return result;
- };
- CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) {
- var _this = this;
- return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () {
- var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength());
- var result = ts.parseConfigFileTextToJson(fileName, text);
- if (result.error) {
- return {
- options: {},
- typingOptions: {},
- files: [],
- raw: {},
- errors: [realizeDiagnostic(result.error, "\r\n")]
- };
+ IOSession.prototype.exit = function () {
+ this.logger.info("Exiting...");
+ this.projectService.closeLog();
+ process.exit(0);
+ };
+ IOSession.prototype.listen = function () {
+ var _this = this;
+ rl.on("line", function (input) {
+ var message = input.trim();
+ _this.onMessage(message);
+ });
+ rl.on("close", function () {
+ _this.exit();
+ });
+ };
+ return IOSession;
+ }(server.Session));
+ function parseLoggingEnvironmentString(logEnvStr) {
+ var logEnv = { logToFile: true };
+ var args = logEnvStr.split(" ");
+ for (var i = 0, len = args.length; i < (len - 1); i += 2) {
+ var option = args[i];
+ var value = args[i + 1];
+ if (option && value) {
+ switch (option) {
+ case "-file":
+ logEnv.file = ts.stripQuotes(value);
+ break;
+ case "-level":
+ var level = server.LogLevel[value];
+ logEnv.detailLevel = typeof level === "number" ? level : server.LogLevel.normal;
+ break;
+ case "-traceToConsole":
+ logEnv.traceToConsole = value.toLowerCase() === "true";
+ break;
+ case "-logToFile":
+ logEnv.logToFile = value.toLowerCase() === "true";
+ break;
+ }
}
- var normalizedFileName = ts.normalizeSlashes(fileName);
- var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName);
- return {
- options: configFile.options,
- typingOptions: configFile.typingOptions,
- files: configFile.fileNames,
- raw: configFile.raw,
- errors: realizeDiagnostics(configFile.errors, "\r\n")
- };
- });
- };
- CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () {
- return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); });
- };
- CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) {
- var _this = this;
- var getCanonicalFileName = ts.createGetCanonicalFileName(false);
- return this.forwardJSONCall("discoverTypings()", function () {
- var info = JSON.parse(discoverTypingsJson);
- return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.compilerOptions);
- });
- };
- return CoreServicesShimObject;
- }(ShimBase));
- var TypeScriptServicesFactory = (function () {
- function TypeScriptServicesFactory() {
- this._shims = [];
+ }
+ return logEnv;
}
- TypeScriptServicesFactory.prototype.getServicesVersion = function () {
- return ts.servicesVersion;
- };
- TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) {
- try {
- if (this.documentRegistry === undefined) {
- this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory());
+ function createLoggerFromEnv() {
+ var fileName = undefined;
+ var detailLevel = server.LogLevel.normal;
+ var traceToConsole = false;
+ var logEnvStr = process.env["TSS_LOG"];
+ if (logEnvStr) {
+ var logEnv = parseLoggingEnvironmentString(logEnvStr);
+ if (logEnv.logToFile) {
+ if (logEnv.file) {
+ fileName = logEnv.file;
+ }
+ else {
+ fileName = __dirname + "/.log" + process.pid.toString();
+ }
}
- var hostAdapter = new LanguageServiceShimHostAdapter(host);
- var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry);
- return new LanguageServiceShimObject(this, host, languageService);
+ if (logEnv.detailLevel) {
+ detailLevel = logEnv.detailLevel;
+ }
+ traceToConsole = logEnv.traceToConsole;
}
- catch (err) {
- logInternalError(host, err);
- throw err;
+ return new Logger(fileName, traceToConsole, detailLevel);
+ }
+ function createPollingWatchedFileSet(interval, chunkSize) {
+ if (interval === void 0) { interval = 2500; }
+ if (chunkSize === void 0) { chunkSize = 30; }
+ var watchedFiles = [];
+ var nextFileToCheck = 0;
+ var watchTimer;
+ function getModifiedTime(fileName) {
+ return fs.statSync(fileName).mtime;
}
- };
- TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) {
- try {
- return new ClassifierShimObject(this, logger);
+ function poll(checkedIndex) {
+ var watchedFile = watchedFiles[checkedIndex];
+ if (!watchedFile) {
+ return;
+ }
+ fs.stat(watchedFile.fileName, function (err, stats) {
+ if (err) {
+ watchedFile.callback(watchedFile.fileName);
+ }
+ else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) {
+ watchedFile.mtime = getModifiedTime(watchedFile.fileName);
+ watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0);
+ }
+ });
}
- catch (err) {
- logInternalError(logger, err);
- throw err;
+ function startWatchTimer() {
+ watchTimer = setInterval(function () {
+ var count = 0;
+ var nextToCheck = nextFileToCheck;
+ var firstCheck = -1;
+ while ((count < chunkSize) && (nextToCheck !== firstCheck)) {
+ poll(nextToCheck);
+ if (firstCheck < 0) {
+ firstCheck = nextToCheck;
+ }
+ nextToCheck++;
+ if (nextToCheck === watchedFiles.length) {
+ nextToCheck = 0;
+ }
+ count++;
+ }
+ nextFileToCheck = nextToCheck;
+ }, interval);
}
- };
- TypeScriptServicesFactory.prototype.createCoreServicesShim = function (host) {
- try {
- var adapter = new CoreServicesShimHostAdapter(host);
- return new CoreServicesShimObject(this, host, adapter);
+ function addFile(fileName, callback) {
+ var file = {
+ fileName: fileName,
+ callback: callback,
+ mtime: getModifiedTime(fileName)
+ };
+ watchedFiles.push(file);
+ if (watchedFiles.length === 1) {
+ startWatchTimer();
+ }
+ return file;
}
- catch (err) {
- logInternalError(host, err);
- throw err;
+ function removeFile(file) {
+ ts.unorderedRemoveItem(watchedFiles, file);
}
+ return {
+ getModifiedTime: getModifiedTime,
+ poll: poll,
+ startWatchTimer: startWatchTimer,
+ addFile: addFile,
+ removeFile: removeFile
+ };
+ }
+ var pollingWatchedFileSet = createPollingWatchedFileSet();
+ var logger = createLoggerFromEnv();
+ var pending = [];
+ var canWrite = true;
+ function writeMessage(buf) {
+ if (!canWrite) {
+ pending.push(buf);
+ }
+ else {
+ canWrite = false;
+ process.stdout.write(buf, setCanWriteFlagAndWriteMessageIfNecessary);
+ }
+ }
+ function setCanWriteFlagAndWriteMessageIfNecessary() {
+ canWrite = true;
+ if (pending.length) {
+ writeMessage(pending.shift());
+ }
+ }
+ var sys = ts.sys;
+ sys.write = function (s) { return writeMessage(new Buffer(s, "utf8")); };
+ sys.watchFile = function (fileName, callback) {
+ var watchedFile = pollingWatchedFileSet.addFile(fileName, callback);
+ return {
+ close: function () { return pollingWatchedFileSet.removeFile(watchedFile); }
+ };
};
- TypeScriptServicesFactory.prototype.close = function () {
- this._shims = [];
- this.documentRegistry = undefined;
- };
- TypeScriptServicesFactory.prototype.registerShim = function (shim) {
- this._shims.push(shim);
- };
- TypeScriptServicesFactory.prototype.unregisterShim = function (shim) {
- for (var i = 0, n = this._shims.length; i < n; i++) {
- if (this._shims[i] === shim) {
- delete this._shims[i];
- return;
+ sys.setTimeout = setTimeout;
+ sys.clearTimeout = clearTimeout;
+ sys.setImmediate = setImmediate;
+ sys.clearImmediate = clearImmediate;
+ if (typeof global !== "undefined" && global.gc) {
+ sys.gc = function () { return global.gc(); };
+ }
+ var cancellationToken;
+ try {
+ var factory = require("./cancellationToken");
+ cancellationToken = factory(sys.args);
+ }
+ catch (e) {
+ cancellationToken = {
+ isCancellationRequested: function () { return false; }
+ };
+ }
+ ;
+ var eventPort;
+ {
+ var index = sys.args.indexOf("--eventPort");
+ if (index >= 0 && index < sys.args.length - 1) {
+ var v = parseInt(sys.args[index + 1]);
+ if (!isNaN(v)) {
+ eventPort = v;
}
}
- throw new Error("Invalid operation");
- };
- return TypeScriptServicesFactory;
- }());
- ts.TypeScriptServicesFactory = TypeScriptServicesFactory;
- if (typeof module !== "undefined" && module.exports) {
- module.exports = ts;
- }
+ }
+ var useSingleInferredProject = sys.args.indexOf("--useSingleInferredProject") >= 0;
+ var disableAutomaticTypingAcquisition = sys.args.indexOf("--disableAutomaticTypingAcquisition") >= 0;
+ var ioSession = new IOSession(sys, cancellationToken, eventPort, eventPort === undefined, useSingleInferredProject, disableAutomaticTypingAcquisition, getGlobalTypingsCacheLocation(), logger);
+ process.on("uncaughtException", function (err) {
+ ioSession.logError(err, "unknown");
+ });
+ process.noAsar = true;
+ ioSession.listen();
+ })(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
-var TypeScript;
-(function (TypeScript) {
- var Services;
- (function (Services) {
- Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory;
- })(Services = TypeScript.Services || (TypeScript.Services = {}));
-})(TypeScript || (TypeScript = {}));
-var toolsVersion = "2.1";
+
+//# sourceMappingURL=tsserver.js.map
diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts
index c23bccf0a6828..63580ce8dcd7f 100644
--- a/lib/tsserverlibrary.d.ts
+++ b/lib/tsserverlibrary.d.ts
@@ -1,9487 +1,3252 @@
+/*! *****************************************************************************
+Copyright (c) Microsoft Corporation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at http://www.apache.org/licenses/LICENSE-2.0
+
+THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
+WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
+MERCHANTABLITY OR NON-INFRINGEMENT.
+
+See the Apache Version 2.0 License for specific language governing permissions
+and limitations under the License.
+***************************************************************************** */
+
///
///
-declare namespace ts.server.protocol {
- namespace CommandTypes {
- type Brace = "brace";
- type BraceFull = "brace-full";
- type BraceCompletion = "braceCompletion";
- type Change = "change";
- type Close = "close";
- type Completions = "completions";
- type CompletionsFull = "completions-full";
- type CompletionDetails = "completionEntryDetails";
- type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
- type CompileOnSaveEmitFile = "compileOnSaveEmitFile";
- type Configure = "configure";
- type Definition = "definition";
- type DefinitionFull = "definition-full";
- type Implementation = "implementation";
- type ImplementationFull = "implementation-full";
- type Exit = "exit";
- type Format = "format";
- type Formatonkey = "formatonkey";
- type FormatFull = "format-full";
- type FormatonkeyFull = "formatonkey-full";
- type FormatRangeFull = "formatRange-full";
- type Geterr = "geterr";
- type GeterrForProject = "geterrForProject";
- type SemanticDiagnosticsSync = "semanticDiagnosticsSync";
- type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
- type NavBar = "navbar";
- type NavBarFull = "navbar-full";
- type Navto = "navto";
- type NavtoFull = "navto-full";
- type NavTree = "navtree";
- type NavTreeFull = "navtree-full";
- type Occurrences = "occurrences";
- type DocumentHighlights = "documentHighlights";
- type DocumentHighlightsFull = "documentHighlights-full";
- type Open = "open";
- type Quickinfo = "quickinfo";
- type QuickinfoFull = "quickinfo-full";
- type References = "references";
- type ReferencesFull = "references-full";
- type Reload = "reload";
- type Rename = "rename";
- type RenameInfoFull = "rename-full";
- type RenameLocationsFull = "renameLocations-full";
- type Saveto = "saveto";
- type SignatureHelp = "signatureHelp";
- type SignatureHelpFull = "signatureHelp-full";
- type TypeDefinition = "typeDefinition";
- type ProjectInfo = "projectInfo";
- type ReloadProjects = "reloadProjects";
- type Unknown = "unknown";
- type OpenExternalProject = "openExternalProject";
- type OpenExternalProjects = "openExternalProjects";
- type CloseExternalProject = "closeExternalProject";
- type SynchronizeProjectList = "synchronizeProjectList";
- type ApplyChangedToOpenFiles = "applyChangedToOpenFiles";
- type EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full";
- type Cleanup = "cleanup";
- type OutliningSpans = "outliningSpans";
- type TodoComments = "todoComments";
- type Indentation = "indentation";
- type DocCommentTemplate = "docCommentTemplate";
- type CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full";
- type NameOrDottedNameSpan = "nameOrDottedNameSpan";
- type BreakpointStatement = "breakpointStatement";
- type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
- type GetCodeFixes = "getCodeFixes";
- type GetCodeFixesFull = "getCodeFixes-full";
- type GetSupportedCodeFixes = "getSupportedCodeFixes";
+declare namespace ts {
+ interface MapLike {
+ [index: string]: T;
}
- interface Message {
- seq: number;
- type: string;
+ interface Map extends MapLike {
+ __mapBrand: any;
}
- interface Request extends Message {
- command: string;
- arguments?: any;
+ type Path = string & {
+ __pathBrand: any;
+ };
+ interface FileMap {
+ get(fileName: Path): T;
+ set(fileName: Path, value: T): void;
+ contains(fileName: Path): boolean;
+ remove(fileName: Path): void;
+ forEachValue(f: (key: Path, v: T) => void): void;
+ getKeys(): Path[];
+ clear(): void;
}
- interface ReloadProjectsRequest extends Message {
- command: CommandTypes.ReloadProjects;
+ interface TextRange {
+ pos: number;
+ end: number;
}
- interface Event extends Message {
- event: string;
- body?: any;
+ const enum SyntaxKind {
+ Unknown = 0,
+ EndOfFileToken = 1,
+ SingleLineCommentTrivia = 2,
+ MultiLineCommentTrivia = 3,
+ NewLineTrivia = 4,
+ WhitespaceTrivia = 5,
+ ShebangTrivia = 6,
+ ConflictMarkerTrivia = 7,
+ NumericLiteral = 8,
+ StringLiteral = 9,
+ JsxText = 10,
+ RegularExpressionLiteral = 11,
+ NoSubstitutionTemplateLiteral = 12,
+ TemplateHead = 13,
+ TemplateMiddle = 14,
+ TemplateTail = 15,
+ OpenBraceToken = 16,
+ CloseBraceToken = 17,
+ OpenParenToken = 18,
+ CloseParenToken = 19,
+ OpenBracketToken = 20,
+ CloseBracketToken = 21,
+ DotToken = 22,
+ DotDotDotToken = 23,
+ SemicolonToken = 24,
+ CommaToken = 25,
+ LessThanToken = 26,
+ LessThanSlashToken = 27,
+ GreaterThanToken = 28,
+ LessThanEqualsToken = 29,
+ GreaterThanEqualsToken = 30,
+ EqualsEqualsToken = 31,
+ ExclamationEqualsToken = 32,
+ EqualsEqualsEqualsToken = 33,
+ ExclamationEqualsEqualsToken = 34,
+ EqualsGreaterThanToken = 35,
+ PlusToken = 36,
+ MinusToken = 37,
+ AsteriskToken = 38,
+ AsteriskAsteriskToken = 39,
+ SlashToken = 40,
+ PercentToken = 41,
+ PlusPlusToken = 42,
+ MinusMinusToken = 43,
+ LessThanLessThanToken = 44,
+ GreaterThanGreaterThanToken = 45,
+ GreaterThanGreaterThanGreaterThanToken = 46,
+ AmpersandToken = 47,
+ BarToken = 48,
+ CaretToken = 49,
+ ExclamationToken = 50,
+ TildeToken = 51,
+ AmpersandAmpersandToken = 52,
+ BarBarToken = 53,
+ QuestionToken = 54,
+ ColonToken = 55,
+ AtToken = 56,
+ EqualsToken = 57,
+ PlusEqualsToken = 58,
+ MinusEqualsToken = 59,
+ AsteriskEqualsToken = 60,
+ AsteriskAsteriskEqualsToken = 61,
+ SlashEqualsToken = 62,
+ PercentEqualsToken = 63,
+ LessThanLessThanEqualsToken = 64,
+ GreaterThanGreaterThanEqualsToken = 65,
+ GreaterThanGreaterThanGreaterThanEqualsToken = 66,
+ AmpersandEqualsToken = 67,
+ BarEqualsToken = 68,
+ CaretEqualsToken = 69,
+ Identifier = 70,
+ BreakKeyword = 71,
+ CaseKeyword = 72,
+ CatchKeyword = 73,
+ ClassKeyword = 74,
+ ConstKeyword = 75,
+ ContinueKeyword = 76,
+ DebuggerKeyword = 77,
+ DefaultKeyword = 78,
+ DeleteKeyword = 79,
+ DoKeyword = 80,
+ ElseKeyword = 81,
+ EnumKeyword = 82,
+ ExportKeyword = 83,
+ ExtendsKeyword = 84,
+ FalseKeyword = 85,
+ FinallyKeyword = 86,
+ ForKeyword = 87,
+ FunctionKeyword = 88,
+ IfKeyword = 89,
+ ImportKeyword = 90,
+ InKeyword = 91,
+ InstanceOfKeyword = 92,
+ NewKeyword = 93,
+ NullKeyword = 94,
+ ReturnKeyword = 95,
+ SuperKeyword = 96,
+ SwitchKeyword = 97,
+ ThisKeyword = 98,
+ ThrowKeyword = 99,
+ TrueKeyword = 100,
+ TryKeyword = 101,
+ TypeOfKeyword = 102,
+ VarKeyword = 103,
+ VoidKeyword = 104,
+ WhileKeyword = 105,
+ WithKeyword = 106,
+ ImplementsKeyword = 107,
+ InterfaceKeyword = 108,
+ LetKeyword = 109,
+ PackageKeyword = 110,
+ PrivateKeyword = 111,
+ ProtectedKeyword = 112,
+ PublicKeyword = 113,
+ StaticKeyword = 114,
+ YieldKeyword = 115,
+ AbstractKeyword = 116,
+ AsKeyword = 117,
+ AnyKeyword = 118,
+ AsyncKeyword = 119,
+ AwaitKeyword = 120,
+ BooleanKeyword = 121,
+ ConstructorKeyword = 122,
+ DeclareKeyword = 123,
+ GetKeyword = 124,
+ IsKeyword = 125,
+ ModuleKeyword = 126,
+ NamespaceKeyword = 127,
+ NeverKeyword = 128,
+ ReadonlyKeyword = 129,
+ RequireKeyword = 130,
+ NumberKeyword = 131,
+ SetKeyword = 132,
+ StringKeyword = 133,
+ SymbolKeyword = 134,
+ TypeKeyword = 135,
+ UndefinedKeyword = 136,
+ FromKeyword = 137,
+ GlobalKeyword = 138,
+ OfKeyword = 139,
+ QualifiedName = 140,
+ ComputedPropertyName = 141,
+ TypeParameter = 142,
+ Parameter = 143,
+ Decorator = 144,
+ PropertySignature = 145,
+ PropertyDeclaration = 146,
+ MethodSignature = 147,
+ MethodDeclaration = 148,
+ Constructor = 149,
+ GetAccessor = 150,
+ SetAccessor = 151,
+ CallSignature = 152,
+ ConstructSignature = 153,
+ IndexSignature = 154,
+ TypePredicate = 155,
+ TypeReference = 156,
+ FunctionType = 157,
+ ConstructorType = 158,
+ TypeQuery = 159,
+ TypeLiteral = 160,
+ ArrayType = 161,
+ TupleType = 162,
+ UnionType = 163,
+ IntersectionType = 164,
+ ParenthesizedType = 165,
+ ThisType = 166,
+ LiteralType = 167,
+ ObjectBindingPattern = 168,
+ ArrayBindingPattern = 169,
+ BindingElement = 170,
+ ArrayLiteralExpression = 171,
+ ObjectLiteralExpression = 172,
+ PropertyAccessExpression = 173,
+ ElementAccessExpression = 174,
+ CallExpression = 175,
+ NewExpression = 176,
+ TaggedTemplateExpression = 177,
+ TypeAssertionExpression = 178,
+ ParenthesizedExpression = 179,
+ FunctionExpression = 180,
+ ArrowFunction = 181,
+ DeleteExpression = 182,
+ TypeOfExpression = 183,
+ VoidExpression = 184,
+ AwaitExpression = 185,
+ PrefixUnaryExpression = 186,
+ PostfixUnaryExpression = 187,
+ BinaryExpression = 188,
+ ConditionalExpression = 189,
+ TemplateExpression = 190,
+ YieldExpression = 191,
+ SpreadElementExpression = 192,
+ ClassExpression = 193,
+ OmittedExpression = 194,
+ ExpressionWithTypeArguments = 195,
+ AsExpression = 196,
+ NonNullExpression = 197,
+ TemplateSpan = 198,
+ SemicolonClassElement = 199,
+ Block = 200,
+ VariableStatement = 201,
+ EmptyStatement = 202,
+ ExpressionStatement = 203,
+ IfStatement = 204,
+ DoStatement = 205,
+ WhileStatement = 206,
+ ForStatement = 207,
+ ForInStatement = 208,
+ ForOfStatement = 209,
+ ContinueStatement = 210,
+ BreakStatement = 211,
+ ReturnStatement = 212,
+ WithStatement = 213,
+ SwitchStatement = 214,
+ LabeledStatement = 215,
+ ThrowStatement = 216,
+ TryStatement = 217,
+ DebuggerStatement = 218,
+ VariableDeclaration = 219,
+ VariableDeclarationList = 220,
+ FunctionDeclaration = 221,
+ ClassDeclaration = 222,
+ InterfaceDeclaration = 223,
+ TypeAliasDeclaration = 224,
+ EnumDeclaration = 225,
+ ModuleDeclaration = 226,
+ ModuleBlock = 227,
+ CaseBlock = 228,
+ NamespaceExportDeclaration = 229,
+ ImportEqualsDeclaration = 230,
+ ImportDeclaration = 231,
+ ImportClause = 232,
+ NamespaceImport = 233,
+ NamedImports = 234,
+ ImportSpecifier = 235,
+ ExportAssignment = 236,
+ ExportDeclaration = 237,
+ NamedExports = 238,
+ ExportSpecifier = 239,
+ MissingDeclaration = 240,
+ ExternalModuleReference = 241,
+ JsxElement = 242,
+ JsxSelfClosingElement = 243,
+ JsxOpeningElement = 244,
+ JsxClosingElement = 245,
+ JsxAttribute = 246,
+ JsxSpreadAttribute = 247,
+ JsxExpression = 248,
+ CaseClause = 249,
+ DefaultClause = 250,
+ HeritageClause = 251,
+ CatchClause = 252,
+ PropertyAssignment = 253,
+ ShorthandPropertyAssignment = 254,
+ EnumMember = 255,
+ SourceFile = 256,
+ JSDocTypeExpression = 257,
+ JSDocAllType = 258,
+ JSDocUnknownType = 259,
+ JSDocArrayType = 260,
+ JSDocUnionType = 261,
+ JSDocTupleType = 262,
+ JSDocNullableType = 263,
+ JSDocNonNullableType = 264,
+ JSDocRecordType = 265,
+ JSDocRecordMember = 266,
+ JSDocTypeReference = 267,
+ JSDocOptionalType = 268,
+ JSDocFunctionType = 269,
+ JSDocVariadicType = 270,
+ JSDocConstructorType = 271,
+ JSDocThisType = 272,
+ JSDocComment = 273,
+ JSDocTag = 274,
+ JSDocParameterTag = 275,
+ JSDocReturnTag = 276,
+ JSDocTypeTag = 277,
+ JSDocTemplateTag = 278,
+ JSDocTypedefTag = 279,
+ JSDocPropertyTag = 280,
+ JSDocTypeLiteral = 281,
+ JSDocLiteralType = 282,
+ JSDocNullKeyword = 283,
+ JSDocUndefinedKeyword = 284,
+ JSDocNeverKeyword = 285,
+ SyntaxList = 286,
+ NotEmittedStatement = 287,
+ PartiallyEmittedExpression = 288,
+ Count = 289,
+ FirstAssignment = 57,
+ LastAssignment = 69,
+ FirstCompoundAssignment = 58,
+ LastCompoundAssignment = 69,
+ FirstReservedWord = 71,
+ LastReservedWord = 106,
+ FirstKeyword = 71,
+ LastKeyword = 139,
+ FirstFutureReservedWord = 107,
+ LastFutureReservedWord = 115,
+ FirstTypeNode = 155,
+ LastTypeNode = 167,
+ FirstPunctuation = 16,
+ LastPunctuation = 69,
+ FirstToken = 0,
+ LastToken = 139,
+ FirstTriviaToken = 2,
+ LastTriviaToken = 7,
+ FirstLiteralToken = 8,
+ LastLiteralToken = 12,
+ FirstTemplateToken = 12,
+ LastTemplateToken = 15,
+ FirstBinaryOperator = 26,
+ LastBinaryOperator = 69,
+ FirstNode = 140,
+ FirstJSDocNode = 257,
+ LastJSDocNode = 282,
+ FirstJSDocTagNode = 273,
+ LastJSDocTagNode = 285,
}
- interface Response extends Message {
- request_seq: number;
- success: boolean;
- command: string;
- message?: string;
- body?: any;
+ const enum NodeFlags {
+ None = 0,
+ Let = 1,
+ Const = 2,
+ NestedNamespace = 4,
+ Synthesized = 8,
+ Namespace = 16,
+ ExportContext = 32,
+ ContainsThis = 64,
+ HasImplicitReturn = 128,
+ HasExplicitReturn = 256,
+ GlobalAugmentation = 512,
+ HasClassExtends = 1024,
+ HasDecorators = 2048,
+ HasParamDecorators = 4096,
+ HasAsyncFunctions = 8192,
+ HasJsxSpreadAttributes = 16384,
+ DisallowInContext = 32768,
+ YieldContext = 65536,
+ DecoratorContext = 131072,
+ AwaitContext = 262144,
+ ThisNodeHasError = 524288,
+ JavaScriptFile = 1048576,
+ ThisNodeOrAnySubNodesHasError = 2097152,
+ HasAggregatedChildData = 4194304,
+ BlockScoped = 3,
+ ReachabilityCheckFlags = 384,
+ EmitHelperFlags = 31744,
+ ReachabilityAndEmitFlags = 32128,
+ ContextFlags = 1540096,
+ TypeExcludesFlags = 327680,
}
- interface FileRequestArgs {
- file: string;
- projectFileName?: string;
+ const enum ModifierFlags {
+ None = 0,
+ Export = 1,
+ Ambient = 2,
+ Public = 4,
+ Private = 8,
+ Protected = 16,
+ Static = 32,
+ Readonly = 64,
+ Abstract = 128,
+ Async = 256,
+ Default = 512,
+ Const = 2048,
+ HasComputedFlags = 536870912,
+ AccessibilityModifier = 28,
+ ParameterPropertyModifier = 92,
+ NonPublicAccessibilityModifier = 24,
+ TypeScriptModifier = 2270,
}
- interface DocCommentTemplateRequest extends FileLocationRequest {
- command: CommandTypes.DocCommentTemplate;
+ const enum JsxFlags {
+ None = 0,
+ IntrinsicNamedElement = 1,
+ IntrinsicIndexedElement = 2,
+ IntrinsicElement = 3,
}
- interface DocCommandTemplateResponse extends Response {
- body?: TextInsertion;
+ interface Node extends TextRange {
+ kind: SyntaxKind;
+ flags: NodeFlags;
+ decorators?: NodeArray;
+ modifiers?: ModifiersArray;
+ parent?: Node;
}
- interface TodoCommentRequest extends FileRequest {
- command: CommandTypes.TodoComments;
- arguments: TodoCommentRequestArgs;
+ interface NodeArray extends Array, TextRange {
+ hasTrailingComma?: boolean;
}
- interface TodoCommentRequestArgs extends FileRequestArgs {
- descriptors: TodoCommentDescriptor[];
+ interface Token extends Node {
+ kind: TKind;
}
- interface TodoCommentsResponse extends Response {
- body?: TodoComment[];
+ type DotDotDotToken = Token;
+ type QuestionToken = Token;
+ type ColonToken = Token;
+ type EqualsToken = Token;
+ type AsteriskToken = Token;
+ type EqualsGreaterThanToken = Token;
+ type EndOfFileToken = Token;
+ type AtToken = Token;
+ type Modifier = Token | Token | Token | Token | Token | Token | Token | Token | Token | Token | Token;
+ type ModifiersArray = NodeArray;
+ interface Identifier extends PrimaryExpression {
+ kind: SyntaxKind.Identifier;
+ text: string;
+ originalKeywordKind?: SyntaxKind;
}
- interface OutliningSpansRequest extends FileRequest {
- command: CommandTypes.OutliningSpans;
+ interface TransientIdentifier extends Identifier {
+ resolvedSymbol: Symbol;
}
- interface OutliningSpansResponse extends Response {
- body?: OutliningSpan[];
+ interface QualifiedName extends Node {
+ kind: SyntaxKind.QualifiedName;
+ left: EntityName;
+ right: Identifier;
}
- interface IndentationRequest extends FileLocationRequest {
- command: CommandTypes.Indentation;
- arguments: IndentationRequestArgs;
+ type EntityName = Identifier | QualifiedName;
+ type PropertyName = Identifier | LiteralExpression | ComputedPropertyName;
+ type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern;
+ interface Declaration extends Node {
+ _declarationBrand: any;
+ name?: DeclarationName;
}
- interface IndentationResponse extends Response {
- body?: IndentationResult;
+ interface DeclarationStatement extends Declaration, Statement {
+ name?: Identifier | LiteralExpression;
}
- interface IndentationResult {
- position: number;
- indentation: number;
- }
- interface IndentationRequestArgs extends FileLocationRequestArgs {
- options?: EditorSettings;
+ interface ComputedPropertyName extends Node {
+ kind: SyntaxKind.ComputedPropertyName;
+ expression: Expression;
}
- interface ProjectInfoRequestArgs extends FileRequestArgs {
- needFileNameList: boolean;
+ interface Decorator extends Node {
+ kind: SyntaxKind.Decorator;
+ expression: LeftHandSideExpression;
}
- interface ProjectInfoRequest extends Request {
- command: CommandTypes.ProjectInfo;
- arguments: ProjectInfoRequestArgs;
+ interface TypeParameterDeclaration extends Declaration {
+ kind: SyntaxKind.TypeParameter;
+ name: Identifier;
+ constraint?: TypeNode;
+ expression?: Expression;
}
- interface CompilerOptionsDiagnosticsRequest extends Request {
- arguments: CompilerOptionsDiagnosticsRequestArgs;
+ interface SignatureDeclaration extends Declaration {
+ name?: PropertyName;
+ typeParameters?: NodeArray;
+ parameters: NodeArray;
+ type?: TypeNode;
}
- interface CompilerOptionsDiagnosticsRequestArgs {
- projectFileName: string;
+ interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement {
+ kind: SyntaxKind.CallSignature;
}
- interface ProjectInfo {
- configFileName: string;
- fileNames?: string[];
- languageServiceDisabled?: boolean;
+ interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement {
+ kind: SyntaxKind.ConstructSignature;
}
- interface DiagnosticWithLinePosition {
- message: string;
- start: number;
- length: number;
- startLocation: Location;
- endLocation: Location;
- category: string;
- code: number;
+ type BindingName = Identifier | BindingPattern;
+ interface VariableDeclaration extends Declaration {
+ kind: SyntaxKind.VariableDeclaration;
+ parent?: VariableDeclarationList;
+ name: BindingName;
+ type?: TypeNode;
+ initializer?: Expression;
}
- interface ProjectInfoResponse extends Response {
- body?: ProjectInfo;
+ interface VariableDeclarationList extends Node {
+ kind: SyntaxKind.VariableDeclarationList;
+ declarations: NodeArray;
}
- interface FileRequest extends Request {
- arguments: FileRequestArgs;
+ interface ParameterDeclaration extends Declaration {
+ kind: SyntaxKind.Parameter;
+ dotDotDotToken?: DotDotDotToken;
+ name: BindingName;
+ questionToken?: QuestionToken;
+ type?: TypeNode;
+ initializer?: Expression;
}
- interface FileLocationRequestArgs extends FileRequestArgs {
- line: number;
- offset: number;
- position?: number;
+ interface BindingElement extends Declaration {
+ kind: SyntaxKind.BindingElement;
+ propertyName?: PropertyName;
+ dotDotDotToken?: DotDotDotToken;
+ name: BindingName;
+ initializer?: Expression;
}
- interface CodeFixRequest extends Request {
- command: CommandTypes.GetCodeFixes;
- arguments: CodeFixRequestArgs;
+ interface PropertySignature extends TypeElement {
+ kind: SyntaxKind.PropertySignature | SyntaxKind.JSDocRecordMember;
+ name: PropertyName;
+ questionToken?: QuestionToken;
+ type?: TypeNode;
+ initializer?: Expression;
}
- interface CodeFixRequestArgs extends FileRequestArgs {
- startLine: number;
- startOffset: number;
- startPosition?: number;
- endLine: number;
- endOffset: number;
- endPosition?: number;
- errorCodes?: number[];
+ interface PropertyDeclaration extends ClassElement {
+ kind: SyntaxKind.PropertyDeclaration;
+ questionToken?: QuestionToken;
+ name: PropertyName;
+ type?: TypeNode;
+ initializer?: Expression;
}
- interface GetCodeFixesResponse extends Response {
- body?: CodeAction[];
+ interface ObjectLiteralElement extends Declaration {
+ _objectLiteralBrandBrand: any;
+ name?: PropertyName;
}
- interface FileLocationRequest extends FileRequest {
- arguments: FileLocationRequestArgs;
+ type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration;
+ interface PropertyAssignment extends ObjectLiteralElement {
+ kind: SyntaxKind.PropertyAssignment;
+ name: PropertyName;
+ questionToken?: QuestionToken;
+ initializer: Expression;
}
- interface GetSupportedCodeFixesRequest extends Request {
- command: CommandTypes.GetSupportedCodeFixes;
+ interface ShorthandPropertyAssignment extends ObjectLiteralElement {
+ kind: SyntaxKind.ShorthandPropertyAssignment;
+ name: Identifier;
+ questionToken?: QuestionToken;
+ equalsToken?: Token;
+ objectAssignmentInitializer?: Expression;
}
- interface GetSupportedCodeFixesResponse extends Response {
- body?: string[];
+ interface VariableLikeDeclaration extends Declaration {
+ propertyName?: PropertyName;
+ dotDotDotToken?: DotDotDotToken;
+ name: DeclarationName;
+ questionToken?: QuestionToken;
+ type?: TypeNode;
+ initializer?: Expression;
}
- interface EncodedSemanticClassificationsRequest extends FileRequest {
- arguments: EncodedSemanticClassificationsRequestArgs;
+ interface PropertyLikeDeclaration extends Declaration {
+ name: PropertyName;
}
- interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs {
- start: number;
- length: number;
+ interface BindingPattern extends Node {
+ elements: NodeArray;
}
- interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs {
- filesToSearch: string[];
+ interface ObjectBindingPattern extends BindingPattern {
+ kind: SyntaxKind.ObjectBindingPattern;
+ elements: NodeArray;
}
- interface DefinitionRequest extends FileLocationRequest {
- command: CommandTypes.Definition;
+ type ArrayBindingElement = BindingElement | OmittedExpression;
+ interface ArrayBindingPattern extends BindingPattern {
+ kind: SyntaxKind.ArrayBindingPattern;
+ elements: NodeArray;
}
- interface TypeDefinitionRequest extends FileLocationRequest {
- command: CommandTypes.TypeDefinition;
+ interface FunctionLikeDeclaration extends SignatureDeclaration {
+ _functionLikeDeclarationBrand: any;
+ asteriskToken?: AsteriskToken;
+ questionToken?: QuestionToken;
+ body?: Block | Expression;
}
- interface ImplementationRequest extends FileLocationRequest {
- command: CommandTypes.Implementation;
+ interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement {
+ kind: SyntaxKind.FunctionDeclaration;
+ name?: Identifier;
+ body?: FunctionBody;
}
- interface Location {
- line: number;
- offset: number;
+ interface MethodSignature extends SignatureDeclaration, TypeElement {
+ kind: SyntaxKind.MethodSignature;
+ name: PropertyName;
}
- interface TextSpan {
- start: Location;
- end: Location;
+ interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
+ kind: SyntaxKind.MethodDeclaration;
+ name: PropertyName;
+ body?: FunctionBody;
}
- interface FileSpan extends TextSpan {
- file: string;
+ interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
+ kind: SyntaxKind.Constructor;
+ body?: FunctionBody;
}
- interface DefinitionResponse extends Response {
- body?: FileSpan[];
+ interface SemicolonClassElement extends ClassElement {
+ kind: SyntaxKind.SemicolonClassElement;
}
- interface TypeDefinitionResponse extends Response {
- body?: FileSpan[];
+ interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
+ kind: SyntaxKind.GetAccessor;
+ name: PropertyName;
+ body: FunctionBody;
}
- interface ImplementationResponse extends Response {
- body?: FileSpan[];
+ interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
+ kind: SyntaxKind.SetAccessor;
+ name: PropertyName;
+ body: FunctionBody;
}
- interface BraceCompletionRequest extends FileLocationRequest {
- command: CommandTypes.BraceCompletion;
- arguments: BraceCompletionRequestArgs;
+ type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration;
+ interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement {
+ kind: SyntaxKind.IndexSignature;
}
- interface BraceCompletionRequestArgs extends FileLocationRequestArgs {
- openingBrace: string;
+ interface TypeNode extends Node {
+ _typeNodeBrand: any;
}
- interface OccurrencesRequest extends FileLocationRequest {
- command: CommandTypes.Occurrences;
+ interface KeywordTypeNode extends TypeNode {
+ kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword;
}
- interface OccurrencesResponseItem extends FileSpan {
- isWriteAccess: boolean;
+ interface ThisTypeNode extends TypeNode {
+ kind: SyntaxKind.ThisType;
}
- interface OccurrencesResponse extends Response {
- body?: OccurrencesResponseItem[];
+ interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration {
+ kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType;
}
- interface DocumentHighlightsRequest extends FileLocationRequest {
- command: CommandTypes.DocumentHighlights;
- arguments: DocumentHighlightsRequestArgs;
+ interface FunctionTypeNode extends FunctionOrConstructorTypeNode {
+ kind: SyntaxKind.FunctionType;
}
- interface HighlightSpan extends TextSpan {
- kind: string;
+ interface ConstructorTypeNode extends FunctionOrConstructorTypeNode {
+ kind: SyntaxKind.ConstructorType;
}
- interface DocumentHighlightsItem {
- file: string;
- highlightSpans: HighlightSpan[];
+ interface TypeReferenceNode extends TypeNode {
+ kind: SyntaxKind.TypeReference;
+ typeName: EntityName;
+ typeArguments?: NodeArray;
}
- interface DocumentHighlightsResponse extends Response {
- body?: DocumentHighlightsItem[];
+ interface TypePredicateNode extends TypeNode {
+ kind: SyntaxKind.TypePredicate;
+ parameterName: Identifier | ThisTypeNode;
+ type: TypeNode;
}
- interface ReferencesRequest extends FileLocationRequest {
- command: CommandTypes.References;
+ interface TypeQueryNode extends TypeNode {
+ kind: SyntaxKind.TypeQuery;
+ exprName: EntityName;
}
- interface ReferencesResponseItem extends FileSpan {
- lineText: string;
- isWriteAccess: boolean;
- isDefinition: boolean;
+ interface TypeLiteralNode extends TypeNode, Declaration {
+ kind: SyntaxKind.TypeLiteral;
+ members: NodeArray;
}
- interface ReferencesResponseBody {
- refs: ReferencesResponseItem[];
- symbolName: string;
- symbolStartOffset: number;
- symbolDisplayString: string;
+ interface ArrayTypeNode extends TypeNode {
+ kind: SyntaxKind.ArrayType;
+ elementType: TypeNode;
}
- interface ReferencesResponse extends Response {
- body?: ReferencesResponseBody;
+ interface TupleTypeNode extends TypeNode {
+ kind: SyntaxKind.TupleType;
+ elementTypes: NodeArray;
}
- interface RenameRequestArgs extends FileLocationRequestArgs {
- findInComments?: boolean;
- findInStrings?: boolean;
+ interface UnionOrIntersectionTypeNode extends TypeNode {
+ kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType;
+ types: NodeArray;
}
- interface RenameRequest extends FileLocationRequest {
- command: CommandTypes.Rename;
- arguments: RenameRequestArgs;
+ interface UnionTypeNode extends UnionOrIntersectionTypeNode {
+ kind: SyntaxKind.UnionType;
}
- interface RenameInfo {
- canRename: boolean;
- localizedErrorMessage?: string;
- displayName: string;
- fullDisplayName: string;
- kind: string;
- kindModifiers: string;
+ interface IntersectionTypeNode extends UnionOrIntersectionTypeNode {
+ kind: SyntaxKind.IntersectionType;
}
- interface SpanGroup {
- file: string;
- locs: TextSpan[];
+ interface ParenthesizedTypeNode extends TypeNode {
+ kind: SyntaxKind.ParenthesizedType;
+ type: TypeNode;
}
- interface RenameResponseBody {
- info: RenameInfo;
- locs: SpanGroup[];
+ interface LiteralTypeNode extends TypeNode {
+ kind: SyntaxKind.LiteralType;
+ literal: Expression;
}
- interface RenameResponse extends Response {
- body?: RenameResponseBody;
+ interface StringLiteral extends LiteralExpression {
+ kind: SyntaxKind.StringLiteral;
}
- interface ExternalFile {
- fileName: string;
- scriptKind?: ScriptKind;
- hasMixedContent?: boolean;
- content?: string;
+ interface Expression extends Node {
+ _expressionBrand: any;
+ contextualType?: Type;
}
- interface ExternalProject {
- projectFileName: string;
- rootFiles: ExternalFile[];
- options: ExternalProjectCompilerOptions;
- typingOptions?: TypingOptions;
+ interface OmittedExpression extends Expression {
+ kind: SyntaxKind.OmittedExpression;
}
- interface ExternalProjectCompilerOptions extends CompilerOptions {
- compileOnSave?: boolean;
+ interface UnaryExpression extends Expression {
+ _unaryExpressionBrand: any;
}
- interface ProjectVersionInfo {
- projectName: string;
- isInferred: boolean;
- version: number;
- options: CompilerOptions;
+ interface IncrementExpression extends UnaryExpression {
+ _incrementExpressionBrand: any;
}
- interface ProjectChanges {
- added: string[];
- removed: string[];
+ type PrefixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken;
+ interface PrefixUnaryExpression extends IncrementExpression {
+ kind: SyntaxKind.PrefixUnaryExpression;
+ operator: PrefixUnaryOperator;
+ operand: UnaryExpression;
}
- interface ProjectFiles {
- info?: ProjectVersionInfo;
- files?: string[];
- changes?: ProjectChanges;
+ type PostfixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken;
+ interface PostfixUnaryExpression extends IncrementExpression {
+ kind: SyntaxKind.PostfixUnaryExpression;
+ operand: LeftHandSideExpression;
+ operator: PostfixUnaryOperator;
}
- interface ProjectFilesWithDiagnostics extends ProjectFiles {
- projectErrors: DiagnosticWithLinePosition[];
+ interface PostfixExpression extends UnaryExpression {
+ _postfixExpressionBrand: any;
}
- interface ChangedOpenFile {
- fileName: string;
- changes: ts.TextChange[];
+ interface LeftHandSideExpression extends IncrementExpression {
+ _leftHandSideExpressionBrand: any;
}
- interface ConfigureRequestArguments {
- hostInfo?: string;
- file?: string;
- formatOptions?: FormatCodeSettings;
+ interface MemberExpression extends LeftHandSideExpression {
+ _memberExpressionBrand: any;
}
- interface ConfigureRequest extends Request {
- command: CommandTypes.Configure;
- arguments: ConfigureRequestArguments;
+ interface PrimaryExpression extends MemberExpression {
+ _primaryExpressionBrand: any;
}
- interface ConfigureResponse extends Response {
+ interface NullLiteral extends PrimaryExpression {
+ kind: SyntaxKind.NullKeyword;
}
- interface OpenRequestArgs extends FileRequestArgs {
- fileContent?: string;
- scriptKindName?: "TS" | "JS" | "TSX" | "JSX";
+ interface BooleanLiteral extends PrimaryExpression {
+ kind: SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword;
}
- interface OpenRequest extends Request {
- command: CommandTypes.Open;
- arguments: OpenRequestArgs;
+ interface ThisExpression extends PrimaryExpression {
+ kind: SyntaxKind.ThisKeyword;
}
- interface OpenExternalProjectRequest extends Request {
- command: CommandTypes.OpenExternalProject;
- arguments: OpenExternalProjectArgs;
+ interface SuperExpression extends PrimaryExpression {
+ kind: SyntaxKind.SuperKeyword;
}
- type OpenExternalProjectArgs = ExternalProject;
- interface OpenExternalProjectsRequest extends Request {
- command: CommandTypes.OpenExternalProjects;
- arguments: OpenExternalProjectsArgs;
+ interface DeleteExpression extends UnaryExpression {
+ kind: SyntaxKind.DeleteExpression;
+ expression: UnaryExpression;
}
- interface OpenExternalProjectsArgs {
- projects: ExternalProject[];
+ interface TypeOfExpression extends UnaryExpression {
+ kind: SyntaxKind.TypeOfExpression;
+ expression: UnaryExpression;
}
- interface OpenExternalProjectResponse extends Response {
+ interface VoidExpression extends UnaryExpression {
+ kind: SyntaxKind.VoidExpression;
+ expression: UnaryExpression;
}
- interface OpenExternalProjectsResponse extends Response {
+ interface AwaitExpression extends UnaryExpression {
+ kind: SyntaxKind.AwaitExpression;
+ expression: UnaryExpression;
}
- interface CloseExternalProjectRequest extends Request {
- command: CommandTypes.CloseExternalProject;
- arguments: CloseExternalProjectRequestArgs;
+ interface YieldExpression extends Expression {
+ kind: SyntaxKind.YieldExpression;
+ asteriskToken?: AsteriskToken;
+ expression?: Expression;
}
- interface CloseExternalProjectRequestArgs {
- projectFileName: string;
+ type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken;
+ type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken;
+ type MultiplicativeOperatorOrHigher = ExponentiationOperator | MultiplicativeOperator;
+ type AdditiveOperator = SyntaxKind.PlusToken | SyntaxKind.MinusToken;
+ type AdditiveOperatorOrHigher = MultiplicativeOperatorOrHigher | AdditiveOperator;
+ type ShiftOperator = SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken;
+ type ShiftOperatorOrHigher = AdditiveOperatorOrHigher | ShiftOperator;
+ type RelationalOperator = SyntaxKind.LessThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.InstanceOfKeyword | SyntaxKind.InKeyword;
+ type RelationalOperatorOrHigher = ShiftOperatorOrHigher | RelationalOperator;
+ type EqualityOperator = SyntaxKind.EqualsEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.ExclamationEqualsToken;
+ type EqualityOperatorOrHigher = RelationalOperatorOrHigher | EqualityOperator;
+ type BitwiseOperator = SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken;
+ type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator;
+ type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken;
+ type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator;
+ type CompoundAssignmentOperator = SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken;
+ type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator;
+ type AssignmentOperatorOrHigher = LogicalOperatorOrHigher | AssignmentOperator;
+ type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken;
+ type BinaryOperatorToken = Token;
+ interface BinaryExpression extends Expression, Declaration {
+ kind: SyntaxKind.BinaryExpression;
+ left: Expression;
+ operatorToken: BinaryOperatorToken;
+ right: Expression;
}
- interface CloseExternalProjectResponse extends Response {
+ interface ConditionalExpression extends Expression {
+ kind: SyntaxKind.ConditionalExpression;
+ condition: Expression;
+ questionToken: QuestionToken;
+ whenTrue: Expression;
+ colonToken: ColonToken;
+ whenFalse: Expression;
}
- interface SynchronizeProjectListRequest extends Request {
- arguments: SynchronizeProjectListRequestArgs;
+ type FunctionBody = Block;
+ type ConciseBody = FunctionBody | Expression;
+ interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration {
+ kind: SyntaxKind.FunctionExpression;
+ name?: Identifier;
+ body: FunctionBody;
}
- interface SynchronizeProjectListRequestArgs {
- knownProjects: protocol.ProjectVersionInfo[];
+ interface ArrowFunction extends Expression, FunctionLikeDeclaration {
+ kind: SyntaxKind.ArrowFunction;
+ equalsGreaterThanToken: EqualsGreaterThanToken;
+ body: ConciseBody;
}
- interface ApplyChangedToOpenFilesRequest extends Request {
- arguments: ApplyChangedToOpenFilesRequestArgs;
+ interface LiteralLikeNode extends Node {
+ text: string;
+ isUnterminated?: boolean;
+ hasExtendedUnicodeEscape?: boolean;
}
- interface ApplyChangedToOpenFilesRequestArgs {
- openFiles?: ExternalFile[];
- changedFiles?: ChangedOpenFile[];
- closedFiles?: string[];
+ interface LiteralExpression extends LiteralLikeNode, PrimaryExpression {
+ _literalExpressionBrand: any;
}
- interface SetCompilerOptionsForInferredProjectsRequest extends Request {
- command: CommandTypes.CompilerOptionsForInferredProjects;
- arguments: SetCompilerOptionsForInferredProjectsArgs;
+ interface RegularExpressionLiteral extends LiteralExpression {
+ kind: SyntaxKind.RegularExpressionLiteral;
}
- interface SetCompilerOptionsForInferredProjectsArgs {
- options: ExternalProjectCompilerOptions;
+ interface NoSubstitutionTemplateLiteral extends LiteralExpression {
+ kind: SyntaxKind.NoSubstitutionTemplateLiteral;
}
- interface SetCompilerOptionsForInferredProjectsResponse extends Response {
+ interface NumericLiteral extends LiteralExpression {
+ kind: SyntaxKind.NumericLiteral;
+ trailingComment?: string;
}
- interface ExitRequest extends Request {
- command: CommandTypes.Exit;
+ interface TemplateHead extends LiteralLikeNode {
+ kind: SyntaxKind.TemplateHead;
}
- interface CloseRequest extends FileRequest {
- command: CommandTypes.Close;
+ interface TemplateMiddle extends LiteralLikeNode {
+ kind: SyntaxKind.TemplateMiddle;
}
- interface CompileOnSaveAffectedFileListRequest extends FileRequest {
- command: CommandTypes.CompileOnSaveAffectedFileList;
+ interface TemplateTail extends LiteralLikeNode {
+ kind: SyntaxKind.TemplateTail;
}
- interface CompileOnSaveAffectedFileListSingleProject {
- projectFileName: string;
- fileNames: string[];
+ type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral;
+ interface TemplateExpression extends PrimaryExpression {
+ kind: SyntaxKind.TemplateExpression;
+ head: TemplateHead;
+ templateSpans: NodeArray;
}
- interface CompileOnSaveAffectedFileListResponse extends Response {
- body: CompileOnSaveAffectedFileListSingleProject[];
+ interface TemplateSpan extends Node {
+ kind: SyntaxKind.TemplateSpan;
+ expression: Expression;
+ literal: TemplateMiddle | TemplateTail;
}
- interface CompileOnSaveEmitFileRequest extends FileRequest {
- command: CommandTypes.CompileOnSaveEmitFile;
- arguments: CompileOnSaveEmitFileRequestArgs;
+ interface ParenthesizedExpression extends PrimaryExpression {
+ kind: SyntaxKind.ParenthesizedExpression;
+ expression: Expression;
}
- interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs {
- forced?: boolean;
+ interface ArrayLiteralExpression extends PrimaryExpression {
+ kind: SyntaxKind.ArrayLiteralExpression;
+ elements: NodeArray;
}
- interface QuickInfoRequest extends FileLocationRequest {
- command: CommandTypes.Quickinfo;
+ interface SpreadElementExpression extends Expression {
+ kind: SyntaxKind.SpreadElementExpression;
+ expression: Expression;
}
- interface QuickInfoResponseBody {
- kind: string;
- kindModifiers: string;
- start: Location;
- end: Location;
- displayString: string;
- documentation: string;
+ interface ObjectLiteralExpressionBase extends PrimaryExpression, Declaration {
+ properties: NodeArray;
}
- interface QuickInfoResponse extends Response {
- body?: QuickInfoResponseBody;
+ interface ObjectLiteralExpression extends ObjectLiteralExpressionBase {
+ kind: SyntaxKind.ObjectLiteralExpression;
}
- interface FormatRequestArgs extends FileLocationRequestArgs {
- endLine: number;
- endOffset: number;
- endPosition?: number;
- options?: FormatCodeSettings;
- }
- interface FormatRequest extends FileLocationRequest {
- command: CommandTypes.Format;
- arguments: FormatRequestArgs;
+ type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression;
+ type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression;
+ interface PropertyAccessExpression extends MemberExpression, Declaration {
+ kind: SyntaxKind.PropertyAccessExpression;
+ expression: LeftHandSideExpression;
+ name: Identifier;
}
- interface CodeEdit {
- start: Location;
- end: Location;
- newText: string;
+ interface SuperPropertyAccessExpression extends PropertyAccessExpression {
+ expression: SuperExpression;
}
- interface FileCodeEdits {
- fileName: string;
- textChanges: CodeEdit[];
+ interface PropertyAccessEntityNameExpression extends PropertyAccessExpression {
+ _propertyAccessExpressionLikeQualifiedNameBrand?: any;
+ expression: EntityNameExpression;
}
- interface CodeFixResponse extends Response {
- body?: CodeAction[];
+ interface ElementAccessExpression extends MemberExpression {
+ kind: SyntaxKind.ElementAccessExpression;
+ expression: LeftHandSideExpression;
+ argumentExpression?: Expression;
}
- interface CodeAction {
- description: string;
- changes: FileCodeEdits[];
+ interface SuperElementAccessExpression extends ElementAccessExpression {
+ expression: SuperExpression;
}
- interface FormatResponse extends Response {
- body?: CodeEdit[];
+ type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression;
+ interface CallExpression extends LeftHandSideExpression, Declaration {
+ kind: SyntaxKind.CallExpression;
+ expression: LeftHandSideExpression;
+ typeArguments?: NodeArray;
+ arguments: NodeArray;
}
- interface FormatOnKeyRequestArgs extends FileLocationRequestArgs {
- key: string;
- options?: FormatCodeSettings;
+ interface SuperCall extends CallExpression {
+ expression: SuperExpression;
}
- interface FormatOnKeyRequest extends FileLocationRequest {
- command: CommandTypes.Formatonkey;
- arguments: FormatOnKeyRequestArgs;
+ interface ExpressionWithTypeArguments extends TypeNode {
+ kind: SyntaxKind.ExpressionWithTypeArguments;
+ expression: LeftHandSideExpression;
+ typeArguments?: NodeArray;
}
- interface CompletionsRequestArgs extends FileLocationRequestArgs {
- prefix?: string;
+ interface NewExpression extends PrimaryExpression, Declaration {
+ kind: SyntaxKind.NewExpression;
+ expression: LeftHandSideExpression;
+ typeArguments?: NodeArray;
+ arguments: NodeArray;
}
- interface CompletionsRequest extends FileLocationRequest {
- command: CommandTypes.Completions;
- arguments: CompletionsRequestArgs;
+ interface TaggedTemplateExpression extends MemberExpression {
+ kind: SyntaxKind.TaggedTemplateExpression;
+ tag: LeftHandSideExpression;
+ template: TemplateLiteral;
}
- interface CompletionDetailsRequestArgs extends FileLocationRequestArgs {
- entryNames: string[];
+ type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
+ interface AsExpression extends Expression {
+ kind: SyntaxKind.AsExpression;
+ expression: Expression;
+ type: TypeNode;
}
- interface CompletionDetailsRequest extends FileLocationRequest {
- command: CommandTypes.CompletionDetails;
- arguments: CompletionDetailsRequestArgs;
+ interface TypeAssertion extends UnaryExpression {
+ kind: SyntaxKind.TypeAssertionExpression;
+ type: TypeNode;
+ expression: UnaryExpression;
}
- interface SymbolDisplayPart {
- text: string;
- kind: string;
+ type AssertionExpression = TypeAssertion | AsExpression;
+ interface NonNullExpression extends LeftHandSideExpression {
+ kind: SyntaxKind.NonNullExpression;
+ expression: Expression;
}
- interface CompletionEntry {
- name: string;
- kind: string;
- kindModifiers: string;
- sortText: string;
- replacementSpan?: TextSpan;
+ interface JsxElement extends PrimaryExpression {
+ kind: SyntaxKind.JsxElement;
+ openingElement: JsxOpeningElement;
+ children: NodeArray;
+ closingElement: JsxClosingElement;
}
- interface CompletionEntryDetails {
- name: string;
- kind: string;
- kindModifiers: string;
- displayParts: SymbolDisplayPart[];
- documentation: SymbolDisplayPart[];
+ type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression;
+ interface JsxOpeningElement extends Expression {
+ kind: SyntaxKind.JsxOpeningElement;
+ tagName: JsxTagNameExpression;
+ attributes: NodeArray;
}
- interface CompletionsResponse extends Response {
- body?: CompletionEntry[];
+ interface JsxSelfClosingElement extends PrimaryExpression {
+ kind: SyntaxKind.JsxSelfClosingElement;
+ tagName: JsxTagNameExpression;
+ attributes: NodeArray;
}
- interface CompletionDetailsResponse extends Response {
- body?: CompletionEntryDetails[];
+ type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement;
+ type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute;
+ interface JsxAttribute extends Node {
+ kind: SyntaxKind.JsxAttribute;
+ name: Identifier;
+ initializer?: StringLiteral | JsxExpression;
}
- interface SignatureHelpParameter {
- name: string;
- documentation: SymbolDisplayPart[];
- displayParts: SymbolDisplayPart[];
- isOptional: boolean;
+ interface JsxSpreadAttribute extends Node {
+ kind: SyntaxKind.JsxSpreadAttribute;
+ expression: Expression;
}
- interface SignatureHelpItem {
- isVariadic: boolean;
- prefixDisplayParts: SymbolDisplayPart[];
- suffixDisplayParts: SymbolDisplayPart[];
- separatorDisplayParts: SymbolDisplayPart[];
- parameters: SignatureHelpParameter[];
- documentation: SymbolDisplayPart[];
+ interface JsxClosingElement extends Node {
+ kind: SyntaxKind.JsxClosingElement;
+ tagName: JsxTagNameExpression;
}
- interface SignatureHelpItems {
- items: SignatureHelpItem[];
- applicableSpan: TextSpan;
- selectedItemIndex: number;
- argumentIndex: number;
- argumentCount: number;
+ interface JsxExpression extends Expression {
+ kind: SyntaxKind.JsxExpression;
+ expression?: Expression;
}
- interface SignatureHelpRequestArgs extends FileLocationRequestArgs {
+ interface JsxText extends Node {
+ kind: SyntaxKind.JsxText;
}
- interface SignatureHelpRequest extends FileLocationRequest {
- command: CommandTypes.SignatureHelp;
- arguments: SignatureHelpRequestArgs;
+ type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement;
+ interface Statement extends Node {
+ _statementBrand: any;
}
- interface SignatureHelpResponse extends Response {
- body?: SignatureHelpItems;
+ interface EmptyStatement extends Statement {
+ kind: SyntaxKind.EmptyStatement;
}
- interface SemanticDiagnosticsSyncRequest extends FileRequest {
- command: CommandTypes.SemanticDiagnosticsSync;
- arguments: SemanticDiagnosticsSyncRequestArgs;
+ interface DebuggerStatement extends Statement {
+ kind: SyntaxKind.DebuggerStatement;
}
- interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs {
- includeLinePosition?: boolean;
+ interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement {
+ kind: SyntaxKind.MissingDeclaration;
+ name?: Identifier;
}
- interface SemanticDiagnosticsSyncResponse extends Response {
- body?: Diagnostic[] | DiagnosticWithLinePosition[];
+ type BlockLike = SourceFile | Block | ModuleBlock | CaseClause;
+ interface Block extends Statement {
+ kind: SyntaxKind.Block;
+ statements: NodeArray;
}
- interface SyntacticDiagnosticsSyncRequest extends FileRequest {
- command: CommandTypes.SyntacticDiagnosticsSync;
- arguments: SyntacticDiagnosticsSyncRequestArgs;
+ interface VariableStatement extends Statement {
+ kind: SyntaxKind.VariableStatement;
+ declarationList: VariableDeclarationList;
}
- interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs {
- includeLinePosition?: boolean;
+ interface ExpressionStatement extends Statement {
+ kind: SyntaxKind.ExpressionStatement;
+ expression: Expression;
}
- interface SyntacticDiagnosticsSyncResponse extends Response {
- body?: Diagnostic[] | DiagnosticWithLinePosition[];
+ interface IfStatement extends Statement {
+ kind: SyntaxKind.IfStatement;
+ expression: Expression;
+ thenStatement: Statement;
+ elseStatement?: Statement;
}
- interface GeterrForProjectRequestArgs {
- file: string;
- delay: number;
+ interface IterationStatement extends Statement {
+ statement: Statement;
}
- interface GeterrForProjectRequest extends Request {
- command: CommandTypes.GeterrForProject;
- arguments: GeterrForProjectRequestArgs;
+ interface DoStatement extends IterationStatement {
+ kind: SyntaxKind.DoStatement;
+ expression: Expression;
}
- interface GeterrRequestArgs {
- files: string[];
- delay: number;
+ interface WhileStatement extends IterationStatement {
+ kind: SyntaxKind.WhileStatement;
+ expression: Expression;
}
- interface GeterrRequest extends Request {
- command: CommandTypes.Geterr;
- arguments: GeterrRequestArgs;
+ type ForInitializer = VariableDeclarationList | Expression;
+ interface ForStatement extends IterationStatement {
+ kind: SyntaxKind.ForStatement;
+ initializer?: ForInitializer;
+ condition?: Expression;
+ incrementor?: Expression;
}
- interface Diagnostic {
- start: Location;
- end: Location;
- text: string;
- code?: number;
+ interface ForInStatement extends IterationStatement {
+ kind: SyntaxKind.ForInStatement;
+ initializer: ForInitializer;
+ expression: Expression;
}
- interface DiagnosticEventBody {
- file: string;
- diagnostics: Diagnostic[];
+ interface ForOfStatement extends IterationStatement {
+ kind: SyntaxKind.ForOfStatement;
+ initializer: ForInitializer;
+ expression: Expression;
}
- interface DiagnosticEvent extends Event {
- body?: DiagnosticEventBody;
+ interface BreakStatement extends Statement {
+ kind: SyntaxKind.BreakStatement;
+ label?: Identifier;
}
- interface ConfigFileDiagnosticEventBody {
- triggerFile: string;
- configFile: string;
- diagnostics: Diagnostic[];
+ interface ContinueStatement extends Statement {
+ kind: SyntaxKind.ContinueStatement;
+ label?: Identifier;
}
- interface ConfigFileDiagnosticEvent extends Event {
- body?: ConfigFileDiagnosticEventBody;
- event: "configFileDiag";
+ type BreakOrContinueStatement = BreakStatement | ContinueStatement;
+ interface ReturnStatement extends Statement {
+ kind: SyntaxKind.ReturnStatement;
+ expression?: Expression;
}
- interface ReloadRequestArgs extends FileRequestArgs {
- tmpfile: string;
+ interface WithStatement extends Statement {
+ kind: SyntaxKind.WithStatement;
+ expression: Expression;
+ statement: Statement;
}
- interface ReloadRequest extends FileRequest {
- command: CommandTypes.Reload;
- arguments: ReloadRequestArgs;
+ interface SwitchStatement extends Statement {
+ kind: SyntaxKind.SwitchStatement;
+ expression: Expression;
+ caseBlock: CaseBlock;
+ possiblyExhaustive?: boolean;
}
- interface ReloadResponse extends Response {
+ interface CaseBlock extends Node {
+ kind: SyntaxKind.CaseBlock;
+ clauses: NodeArray;
}
- interface SavetoRequestArgs extends FileRequestArgs {
- tmpfile: string;
+ interface CaseClause extends Node {
+ kind: SyntaxKind.CaseClause;
+ expression: Expression;
+ statements: NodeArray;
}
- interface SavetoRequest extends FileRequest {
- command: CommandTypes.Saveto;
- arguments: SavetoRequestArgs;
+ interface DefaultClause extends Node {
+ kind: SyntaxKind.DefaultClause;
+ statements: NodeArray;
}
- interface NavtoRequestArgs extends FileRequestArgs {
- searchValue: string;
- maxResultCount?: number;
- currentFileOnly?: boolean;
- projectFileName?: string;
+ type CaseOrDefaultClause = CaseClause | DefaultClause;
+ interface LabeledStatement extends Statement {
+ kind: SyntaxKind.LabeledStatement;
+ label: Identifier;
+ statement: Statement;
}
- interface NavtoRequest extends FileRequest {
- command: CommandTypes.Navto;
- arguments: NavtoRequestArgs;
+ interface ThrowStatement extends Statement {
+ kind: SyntaxKind.ThrowStatement;
+ expression: Expression;
}
- interface NavtoItem {
- name: string;
- kind: string;
- matchKind?: string;
- isCaseSensitive?: boolean;
- kindModifiers?: string;
- file: string;
- start: Location;
- end: Location;
- containerName?: string;
- containerKind?: string;
+ interface TryStatement extends Statement {
+ kind: SyntaxKind.TryStatement;
+ tryBlock: Block;
+ catchClause?: CatchClause;
+ finallyBlock?: Block;
}
- interface NavtoResponse extends Response {
- body?: NavtoItem[];
+ interface CatchClause extends Node {
+ kind: SyntaxKind.CatchClause;
+ variableDeclaration: VariableDeclaration;
+ block: Block;
}
- interface ChangeRequestArgs extends FormatRequestArgs {
- insertString?: string;
+ type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration;
+ interface ClassLikeDeclaration extends Declaration {
+ name?: Identifier;
+ typeParameters?: NodeArray;
+ heritageClauses?: NodeArray;
+ members: NodeArray;
}
- interface ChangeRequest extends FileLocationRequest {
- command: CommandTypes.Change;
- arguments: ChangeRequestArgs;
+ interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement {
+ kind: SyntaxKind.ClassDeclaration;
+ name?: Identifier;
}
- interface BraceResponse extends Response {
- body?: TextSpan[];
+ interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
+ kind: SyntaxKind.ClassExpression;
}
- interface BraceRequest extends FileLocationRequest {
- command: CommandTypes.Brace;
+ interface ClassElement extends Declaration {
+ _classElementBrand: any;
+ name?: PropertyName;
}
- interface NavBarRequest extends FileRequest {
- command: CommandTypes.NavBar;
+ interface TypeElement extends Declaration {
+ _typeElementBrand: any;
+ name?: PropertyName;
+ questionToken?: QuestionToken;
}
- interface NavTreeRequest extends FileRequest {
- command: CommandTypes.NavTree;
+ interface InterfaceDeclaration extends DeclarationStatement {
+ kind: SyntaxKind.InterfaceDeclaration;
+ name: Identifier;
+ typeParameters?: NodeArray;
+ heritageClauses?: NodeArray;
+ members: NodeArray;
}
- interface NavigationBarItem {
- text: string;
- kind: string;
- kindModifiers?: string;
- spans: TextSpan[];
- childItems?: NavigationBarItem[];
- indent: number;
+ interface HeritageClause extends Node {
+ kind: SyntaxKind.HeritageClause;
+ token: SyntaxKind;
+ types?: NodeArray;
}
- interface NavigationTree {
- text: string;
- kind: string;
- kindModifiers: string;
- spans: TextSpan[];
- childItems?: NavigationTree[];
+ interface TypeAliasDeclaration extends DeclarationStatement {
+ kind: SyntaxKind.TypeAliasDeclaration;
+ name: Identifier;
+ typeParameters?: NodeArray;
+ type: TypeNode;
}
- interface NavBarResponse extends Response {
- body?: NavigationBarItem[];
+ interface EnumMember extends Declaration {
+ kind: SyntaxKind.EnumMember;
+ name: PropertyName;
+ initializer?: Expression;
}
- interface NavTreeResponse extends Response {
- body?: NavigationTree;
+ interface EnumDeclaration extends DeclarationStatement {
+ kind: SyntaxKind.EnumDeclaration;
+ name: Identifier;
+ members: NodeArray;
}
-}
-declare namespace ts {
- interface MapLike {
- [index: string]: T;
+ type ModuleBody = ModuleBlock | ModuleDeclaration;
+ type ModuleName = Identifier | StringLiteral;
+ interface ModuleDeclaration extends DeclarationStatement {
+ kind: SyntaxKind.ModuleDeclaration;
+ name: Identifier | LiteralExpression;
+ body?: ModuleBlock | NamespaceDeclaration;
}
- interface Map extends MapLike {
- __mapBrand: any;
+ interface NamespaceDeclaration extends ModuleDeclaration {
+ name: Identifier;
+ body: ModuleBlock | NamespaceDeclaration;
}
- type Path = string & {
- __pathBrand: any;
- };
- interface FileMap {
- get(fileName: Path): T;
- set(fileName: Path, value: T): void;
- contains(fileName: Path): boolean;
- remove(fileName: Path): void;
- forEachValue(f: (key: Path, v: T) => void): void;
- getKeys(): Path[];
- clear(): void;
+ interface ModuleBlock extends Node, Statement {
+ kind: SyntaxKind.ModuleBlock;
+ statements: NodeArray;
}
- interface TextRange {
- pos: number;
- end: number;
+ type ModuleReference = EntityName | ExternalModuleReference;
+ interface ImportEqualsDeclaration extends DeclarationStatement {
+ kind: SyntaxKind.ImportEqualsDeclaration;
+ name: Identifier;
+ moduleReference: ModuleReference;
}
- const enum SyntaxKind {
- Unknown = 0,
- EndOfFileToken = 1,
- SingleLineCommentTrivia = 2,
- MultiLineCommentTrivia = 3,
- NewLineTrivia = 4,
- WhitespaceTrivia = 5,
- ShebangTrivia = 6,
- ConflictMarkerTrivia = 7,
- NumericLiteral = 8,
- StringLiteral = 9,
- RegularExpressionLiteral = 10,
- NoSubstitutionTemplateLiteral = 11,
- TemplateHead = 12,
- TemplateMiddle = 13,
- TemplateTail = 14,
- OpenBraceToken = 15,
- CloseBraceToken = 16,
- OpenParenToken = 17,
- CloseParenToken = 18,
- OpenBracketToken = 19,
- CloseBracketToken = 20,
- DotToken = 21,
- DotDotDotToken = 22,
- SemicolonToken = 23,
- CommaToken = 24,
- LessThanToken = 25,
- LessThanSlashToken = 26,
- GreaterThanToken = 27,
- LessThanEqualsToken = 28,
- GreaterThanEqualsToken = 29,
- EqualsEqualsToken = 30,
- ExclamationEqualsToken = 31,
- EqualsEqualsEqualsToken = 32,
- ExclamationEqualsEqualsToken = 33,
- EqualsGreaterThanToken = 34,
- PlusToken = 35,
- MinusToken = 36,
- AsteriskToken = 37,
- AsteriskAsteriskToken = 38,
- SlashToken = 39,
- PercentToken = 40,
- PlusPlusToken = 41,
- MinusMinusToken = 42,
- LessThanLessThanToken = 43,
- GreaterThanGreaterThanToken = 44,
- GreaterThanGreaterThanGreaterThanToken = 45,
- AmpersandToken = 46,
- BarToken = 47,
- CaretToken = 48,
- ExclamationToken = 49,
- TildeToken = 50,
- AmpersandAmpersandToken = 51,
- BarBarToken = 52,
- QuestionToken = 53,
- ColonToken = 54,
- AtToken = 55,
- EqualsToken = 56,
- PlusEqualsToken = 57,
- MinusEqualsToken = 58,
- AsteriskEqualsToken = 59,
- AsteriskAsteriskEqualsToken = 60,
- SlashEqualsToken = 61,
- PercentEqualsToken = 62,
- LessThanLessThanEqualsToken = 63,
- GreaterThanGreaterThanEqualsToken = 64,
- GreaterThanGreaterThanGreaterThanEqualsToken = 65,
- AmpersandEqualsToken = 66,
- BarEqualsToken = 67,
- CaretEqualsToken = 68,
- Identifier = 69,
- BreakKeyword = 70,
- CaseKeyword = 71,
- CatchKeyword = 72,
- ClassKeyword = 73,
- ConstKeyword = 74,
- ContinueKeyword = 75,
- DebuggerKeyword = 76,
- DefaultKeyword = 77,
- DeleteKeyword = 78,
- DoKeyword = 79,
- ElseKeyword = 80,
- EnumKeyword = 81,
- ExportKeyword = 82,
- ExtendsKeyword = 83,
- FalseKeyword = 84,
- FinallyKeyword = 85,
- ForKeyword = 86,
- FunctionKeyword = 87,
- IfKeyword = 88,
- ImportKeyword = 89,
- InKeyword = 90,
- InstanceOfKeyword = 91,
- NewKeyword = 92,
- NullKeyword = 93,
- ReturnKeyword = 94,
- SuperKeyword = 95,
- SwitchKeyword = 96,
- ThisKeyword = 97,
- ThrowKeyword = 98,
- TrueKeyword = 99,
- TryKeyword = 100,
- TypeOfKeyword = 101,
- VarKeyword = 102,
- VoidKeyword = 103,
- WhileKeyword = 104,
- WithKeyword = 105,
- ImplementsKeyword = 106,
- InterfaceKeyword = 107,
- LetKeyword = 108,
- PackageKeyword = 109,
- PrivateKeyword = 110,
- ProtectedKeyword = 111,
- PublicKeyword = 112,
- StaticKeyword = 113,
- YieldKeyword = 114,
- AbstractKeyword = 115,
- AsKeyword = 116,
- AnyKeyword = 117,
- AsyncKeyword = 118,
- AwaitKeyword = 119,
- BooleanKeyword = 120,
- ConstructorKeyword = 121,
- DeclareKeyword = 122,
- GetKeyword = 123,
- IsKeyword = 124,
- ModuleKeyword = 125,
- NamespaceKeyword = 126,
- NeverKeyword = 127,
- ReadonlyKeyword = 128,
- RequireKeyword = 129,
- NumberKeyword = 130,
- SetKeyword = 131,
- StringKeyword = 132,
- SymbolKeyword = 133,
- TypeKeyword = 134,
- UndefinedKeyword = 135,
- FromKeyword = 136,
- GlobalKeyword = 137,
- OfKeyword = 138,
- QualifiedName = 139,
- ComputedPropertyName = 140,
- TypeParameter = 141,
- Parameter = 142,
- Decorator = 143,
- PropertySignature = 144,
- PropertyDeclaration = 145,
- MethodSignature = 146,
- MethodDeclaration = 147,
- Constructor = 148,
- GetAccessor = 149,
- SetAccessor = 150,
- CallSignature = 151,
- ConstructSignature = 152,
- IndexSignature = 153,
- TypePredicate = 154,
- TypeReference = 155,
- FunctionType = 156,
- ConstructorType = 157,
- TypeQuery = 158,
- TypeLiteral = 159,
- ArrayType = 160,
- TupleType = 161,
- UnionType = 162,
- IntersectionType = 163,
- ParenthesizedType = 164,
- ThisType = 165,
- LiteralType = 166,
- ObjectBindingPattern = 167,
- ArrayBindingPattern = 168,
- BindingElement = 169,
- ArrayLiteralExpression = 170,
- ObjectLiteralExpression = 171,
- PropertyAccessExpression = 172,
- ElementAccessExpression = 173,
- CallExpression = 174,
- NewExpression = 175,
- TaggedTemplateExpression = 176,
- TypeAssertionExpression = 177,
- ParenthesizedExpression = 178,
- FunctionExpression = 179,
- ArrowFunction = 180,
- DeleteExpression = 181,
- TypeOfExpression = 182,
- VoidExpression = 183,
- AwaitExpression = 184,
- PrefixUnaryExpression = 185,
- PostfixUnaryExpression = 186,
- BinaryExpression = 187,
- ConditionalExpression = 188,
- TemplateExpression = 189,
- YieldExpression = 190,
- SpreadElementExpression = 191,
- ClassExpression = 192,
- OmittedExpression = 193,
- ExpressionWithTypeArguments = 194,
- AsExpression = 195,
- NonNullExpression = 196,
- TemplateSpan = 197,
- SemicolonClassElement = 198,
- Block = 199,
- VariableStatement = 200,
- EmptyStatement = 201,
- ExpressionStatement = 202,
- IfStatement = 203,
- DoStatement = 204,
- WhileStatement = 205,
- ForStatement = 206,
- ForInStatement = 207,
- ForOfStatement = 208,
- ContinueStatement = 209,
- BreakStatement = 210,
- ReturnStatement = 211,
- WithStatement = 212,
- SwitchStatement = 213,
- LabeledStatement = 214,
- ThrowStatement = 215,
- TryStatement = 216,
- DebuggerStatement = 217,
- VariableDeclaration = 218,
- VariableDeclarationList = 219,
- FunctionDeclaration = 220,
- ClassDeclaration = 221,
- InterfaceDeclaration = 222,
- TypeAliasDeclaration = 223,
- EnumDeclaration = 224,
- ModuleDeclaration = 225,
- ModuleBlock = 226,
- CaseBlock = 227,
- NamespaceExportDeclaration = 228,
- ImportEqualsDeclaration = 229,
- ImportDeclaration = 230,
- ImportClause = 231,
- NamespaceImport = 232,
- NamedImports = 233,
- ImportSpecifier = 234,
- ExportAssignment = 235,
- ExportDeclaration = 236,
- NamedExports = 237,
- ExportSpecifier = 238,
- MissingDeclaration = 239,
- ExternalModuleReference = 240,
- JsxElement = 241,
- JsxSelfClosingElement = 242,
- JsxOpeningElement = 243,
- JsxText = 244,
- JsxClosingElement = 245,
- JsxAttribute = 246,
- JsxSpreadAttribute = 247,
- JsxExpression = 248,
- CaseClause = 249,
- DefaultClause = 250,
- HeritageClause = 251,
- CatchClause = 252,
- PropertyAssignment = 253,
- ShorthandPropertyAssignment = 254,
- EnumMember = 255,
- SourceFile = 256,
- JSDocTypeExpression = 257,
- JSDocAllType = 258,
- JSDocUnknownType = 259,
- JSDocArrayType = 260,
- JSDocUnionType = 261,
- JSDocTupleType = 262,
- JSDocNullableType = 263,
- JSDocNonNullableType = 264,
- JSDocRecordType = 265,
- JSDocRecordMember = 266,
- JSDocTypeReference = 267,
- JSDocOptionalType = 268,
- JSDocFunctionType = 269,
- JSDocVariadicType = 270,
- JSDocConstructorType = 271,
- JSDocThisType = 272,
- JSDocComment = 273,
- JSDocTag = 274,
- JSDocParameterTag = 275,
- JSDocReturnTag = 276,
- JSDocTypeTag = 277,
- JSDocTemplateTag = 278,
- JSDocTypedefTag = 279,
- JSDocPropertyTag = 280,
- JSDocTypeLiteral = 281,
- JSDocLiteralType = 282,
- JSDocNullKeyword = 283,
- JSDocUndefinedKeyword = 284,
- JSDocNeverKeyword = 285,
- SyntaxList = 286,
- NotEmittedStatement = 287,
- PartiallyEmittedExpression = 288,
- Count = 289,
- FirstAssignment = 56,
- LastAssignment = 68,
- FirstCompoundAssignment = 57,
- LastCompoundAssignment = 68,
- FirstReservedWord = 70,
- LastReservedWord = 105,
- FirstKeyword = 70,
- LastKeyword = 138,
- FirstFutureReservedWord = 106,
- LastFutureReservedWord = 114,
- FirstTypeNode = 154,
- LastTypeNode = 166,
- FirstPunctuation = 15,
- LastPunctuation = 68,
- FirstToken = 0,
- LastToken = 138,
- FirstTriviaToken = 2,
- LastTriviaToken = 7,
- FirstLiteralToken = 8,
- LastLiteralToken = 11,
- FirstTemplateToken = 11,
- LastTemplateToken = 14,
- FirstBinaryOperator = 25,
- LastBinaryOperator = 68,
- FirstNode = 139,
- FirstJSDocNode = 257,
- LastJSDocNode = 282,
- FirstJSDocTagNode = 273,
- LastJSDocTagNode = 285,
+ interface ExternalModuleReference extends Node {
+ kind: SyntaxKind.ExternalModuleReference;
+ expression?: Expression;
}
- const enum NodeFlags {
- None = 0,
- Let = 1,
- Const = 2,
- NestedNamespace = 4,
- Synthesized = 8,
- Namespace = 16,
- ExportContext = 32,
- ContainsThis = 64,
- HasImplicitReturn = 128,
- HasExplicitReturn = 256,
- GlobalAugmentation = 512,
- HasClassExtends = 1024,
- HasDecorators = 2048,
- HasParamDecorators = 4096,
- HasAsyncFunctions = 8192,
- HasJsxSpreadAttributes = 16384,
- DisallowInContext = 32768,
- YieldContext = 65536,
- DecoratorContext = 131072,
- AwaitContext = 262144,
- ThisNodeHasError = 524288,
- JavaScriptFile = 1048576,
- ThisNodeOrAnySubNodesHasError = 2097152,
- HasAggregatedChildData = 4194304,
- BlockScoped = 3,
- ReachabilityCheckFlags = 384,
- EmitHelperFlags = 31744,
- ReachabilityAndEmitFlags = 32128,
- ContextFlags = 1540096,
- TypeExcludesFlags = 327680,
+ interface ImportDeclaration extends Statement {
+ kind: SyntaxKind.ImportDeclaration;
+ importClause?: ImportClause;
+ moduleSpecifier: Expression;
}
- const enum ModifierFlags {
- None = 0,
- Export = 1,
- Ambient = 2,
- Public = 4,
- Private = 8,
- Protected = 16,
- Static = 32,
- Readonly = 64,
- Abstract = 128,
- Async = 256,
- Default = 512,
- Const = 2048,
- HasComputedFlags = 536870912,
- AccessibilityModifier = 28,
- ParameterPropertyModifier = 92,
- NonPublicAccessibilityModifier = 24,
+ type NamedImportBindings = NamespaceImport | NamedImports;
+ interface ImportClause extends Declaration {
+ kind: SyntaxKind.ImportClause;
+ name?: Identifier;
+ namedBindings?: NamedImportBindings;
}
- const enum JsxFlags {
- None = 0,
- IntrinsicNamedElement = 1,
- IntrinsicIndexedElement = 2,
- IntrinsicElement = 3,
+ interface NamespaceImport extends Declaration {
+ kind: SyntaxKind.NamespaceImport;
+ name: Identifier;
}
- const enum RelationComparisonResult {
- Succeeded = 1,
- Failed = 2,
- FailedAndReported = 3,
+ interface NamespaceExportDeclaration extends DeclarationStatement {
+ kind: SyntaxKind.NamespaceExportDeclaration;
+ name: Identifier;
+ moduleReference: LiteralLikeNode;
}
- interface Node extends TextRange {
- kind: SyntaxKind;
- flags: NodeFlags;
- modifierFlagsCache?: ModifierFlags;
- transformFlags?: TransformFlags;
- decorators?: NodeArray;
- modifiers?: ModifiersArray;
- id?: number;
- parent?: Node;
- original?: Node;
- startsOnNewLine?: boolean;
- jsDocComments?: JSDoc[];
- symbol?: Symbol;
- locals?: SymbolTable;
- nextContainer?: Node;
- localSymbol?: Symbol;
- flowNode?: FlowNode;
- emitNode?: EmitNode;
+ interface ExportDeclaration extends DeclarationStatement {
+ kind: SyntaxKind.ExportDeclaration;
+ exportClause?: NamedExports;
+ moduleSpecifier?: Expression;
}
- interface NodeArray extends Array, TextRange {
- hasTrailingComma?: boolean;
+ interface NamedImports extends Node {
+ kind: SyntaxKind.NamedImports;
+ elements: NodeArray;
}
- interface Token extends Node {
- kind: TKind;
+ interface NamedExports extends Node {
+ kind: SyntaxKind.NamedExports;
+ elements: NodeArray;
}
- type DotDotDotToken = Token;
- type QuestionToken = Token;
- type ColonToken = Token;
- type EqualsToken = Token;
- type AsteriskToken = Token;
- type EqualsGreaterThanToken = Token;
- type EndOfFileToken = Token;
- type AtToken = Token;
- type Modifier = Token | Token | Token | Token | Token | Token | Token | Token | Token | Token | Token;
- type ModifiersArray = NodeArray;
- const enum GeneratedIdentifierKind {
- None = 0,
- Auto = 1,
- Loop = 2,
- Unique = 3,
- Node = 4,
+ type NamedImportsOrExports = NamedImports | NamedExports;
+ interface ImportSpecifier extends Declaration {
+ kind: SyntaxKind.ImportSpecifier;
+ propertyName?: Identifier;
+ name: Identifier;
}
- interface Identifier extends PrimaryExpression {
- kind: SyntaxKind.Identifier;
- text: string;
- originalKeywordKind?: SyntaxKind;
- autoGenerateKind?: GeneratedIdentifierKind;
- autoGenerateId?: number;
+ interface ExportSpecifier extends Declaration {
+ kind: SyntaxKind.ExportSpecifier;
+ propertyName?: Identifier;
+ name: Identifier;
}
- interface TransientIdentifier extends Identifier {
- resolvedSymbol: Symbol;
+ type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier;
+ interface ExportAssignment extends DeclarationStatement {
+ kind: SyntaxKind.ExportAssignment;
+ isExportEquals?: boolean;
+ expression: Expression;
}
- interface QualifiedName extends Node {
- kind: SyntaxKind.QualifiedName;
- left: EntityName;
- right: Identifier;
+ interface FileReference extends TextRange {
+ fileName: string;
}
- type EntityName = Identifier | QualifiedName;
- type PropertyName = Identifier | LiteralExpression | ComputedPropertyName;
- type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern;
- interface Declaration extends Node {
- _declarationBrand: any;
- name?: DeclarationName;
+ interface CommentRange extends TextRange {
+ hasTrailingNewLine?: boolean;
+ kind: SyntaxKind;
}
- interface DeclarationStatement extends Declaration, Statement {
- name?: Identifier | LiteralExpression;
+ interface JSDocTypeExpression extends Node {
+ kind: SyntaxKind.JSDocTypeExpression;
+ type: JSDocType;
}
- interface ComputedPropertyName extends Node {
- kind: SyntaxKind.ComputedPropertyName;
- expression: Expression;
+ interface JSDocType extends TypeNode {
+ _jsDocTypeBrand: any;
}
- interface Decorator extends Node {
- kind: SyntaxKind.Decorator;
- expression: LeftHandSideExpression;
+ interface JSDocAllType extends JSDocType {
+ kind: SyntaxKind.JSDocAllType;
}
- interface TypeParameterDeclaration extends Declaration {
- kind: SyntaxKind.TypeParameter;
- name: Identifier;
- constraint?: TypeNode;
- expression?: Expression;
+ interface JSDocUnknownType extends JSDocType {
+ kind: SyntaxKind.JSDocUnknownType;
}
- interface SignatureDeclaration extends Declaration {
- name?: PropertyName;
- typeParameters?: NodeArray;
- parameters: NodeArray;
- type?: TypeNode;
+ interface JSDocArrayType extends JSDocType {
+ kind: SyntaxKind.JSDocArrayType;
+ elementType: JSDocType;
}
- interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement {
- kind: SyntaxKind.CallSignature;
+ interface JSDocUnionType extends JSDocType {
+ kind: SyntaxKind.JSDocUnionType;
+ types: NodeArray;
}
- interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement {
- kind: SyntaxKind.ConstructSignature;
+ interface JSDocTupleType extends JSDocType {
+ kind: SyntaxKind.JSDocTupleType;
+ types: NodeArray;
}
- type BindingName = Identifier | BindingPattern;
- interface VariableDeclaration extends Declaration {
- kind: SyntaxKind.VariableDeclaration;
- parent?: VariableDeclarationList;
- name: BindingName;
- type?: TypeNode;
- initializer?: Expression;
+ interface JSDocNonNullableType extends JSDocType {
+ kind: SyntaxKind.JSDocNonNullableType;
+ type: JSDocType;
}
- interface VariableDeclarationList extends Node {
- kind: SyntaxKind.VariableDeclarationList;
- declarations: NodeArray;
+ interface JSDocNullableType extends JSDocType {
+ kind: SyntaxKind.JSDocNullableType;
+ type: JSDocType;
}
- interface ParameterDeclaration extends Declaration {
- kind: SyntaxKind.Parameter;
- dotDotDotToken?: DotDotDotToken;
- name: BindingName;
- questionToken?: QuestionToken;
- type?: TypeNode;
- initializer?: Expression;
+ interface JSDocRecordType extends JSDocType {
+ kind: SyntaxKind.JSDocRecordType;
+ literal: TypeLiteralNode;
}
- interface BindingElement extends Declaration {
- kind: SyntaxKind.BindingElement;
- propertyName?: PropertyName;
- dotDotDotToken?: DotDotDotToken;
- name: BindingName;
- initializer?: Expression;
+ interface JSDocTypeReference extends JSDocType {
+ kind: SyntaxKind.JSDocTypeReference;
+ name: EntityName;
+ typeArguments: NodeArray;
}
- interface PropertySignature extends TypeElement {
- kind: SyntaxKind.PropertySignature | SyntaxKind.JSDocRecordMember;
- name: PropertyName;
- questionToken?: QuestionToken;
- type?: TypeNode;
- initializer?: Expression;
+ interface JSDocOptionalType extends JSDocType {
+ kind: SyntaxKind.JSDocOptionalType;
+ type: JSDocType;
}
- interface PropertyDeclaration extends ClassElement {
- kind: SyntaxKind.PropertyDeclaration;
- questionToken?: QuestionToken;
- name: PropertyName;
- type?: TypeNode;
- initializer?: Expression;
+ interface JSDocFunctionType extends JSDocType, SignatureDeclaration {
+ kind: SyntaxKind.JSDocFunctionType;
+ parameters: NodeArray;
+ type: JSDocType;
}
- interface ObjectLiteralElement extends Declaration {
- _objectLiteralBrandBrand: any;
- name?: PropertyName;
+ interface JSDocVariadicType extends JSDocType {
+ kind: SyntaxKind.JSDocVariadicType;
+ type: JSDocType;
}
- type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration;
- interface PropertyAssignment extends ObjectLiteralElement {
- kind: SyntaxKind.PropertyAssignment;
- name: PropertyName;
- questionToken?: QuestionToken;
- initializer: Expression;
+ interface JSDocConstructorType extends JSDocType {
+ kind: SyntaxKind.JSDocConstructorType;
+ type: JSDocType;
}
- interface ShorthandPropertyAssignment extends ObjectLiteralElement {
- kind: SyntaxKind.ShorthandPropertyAssignment;
- name: Identifier;
- questionToken?: QuestionToken;
- equalsToken?: Token;
- objectAssignmentInitializer?: Expression;
+ interface JSDocThisType extends JSDocType {
+ kind: SyntaxKind.JSDocThisType;
+ type: JSDocType;
}
- interface VariableLikeDeclaration extends Declaration {
- propertyName?: PropertyName;
- dotDotDotToken?: DotDotDotToken;
- name: DeclarationName;
- questionToken?: QuestionToken;
- type?: TypeNode;
- initializer?: Expression;
- }
- interface PropertyLikeDeclaration extends Declaration {
- name: PropertyName;
- }
- interface BindingPattern extends Node {
- elements: NodeArray;
- }
- interface ObjectBindingPattern extends BindingPattern {
- kind: SyntaxKind.ObjectBindingPattern;
- elements: NodeArray;
- }
- type ArrayBindingElement = BindingElement | OmittedExpression;
- interface ArrayBindingPattern extends BindingPattern {
- kind: SyntaxKind.ArrayBindingPattern;
- elements: NodeArray;
+ interface JSDocLiteralType extends JSDocType {
+ kind: SyntaxKind.JSDocLiteralType;
+ literal: LiteralTypeNode;
}
- interface FunctionLikeDeclaration extends SignatureDeclaration {
- _functionLikeDeclarationBrand: any;
- asteriskToken?: AsteriskToken;
- questionToken?: QuestionToken;
- body?: Block | Expression;
+ type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
+ interface JSDocRecordMember extends PropertySignature {
+ kind: SyntaxKind.JSDocRecordMember;
+ name: Identifier | LiteralExpression;
+ type?: JSDocType;
}
- interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement {
- kind: SyntaxKind.FunctionDeclaration;
- name?: Identifier;
- body?: FunctionBody;
+ interface JSDoc extends Node {
+ kind: SyntaxKind.JSDocComment;
+ tags: NodeArray | undefined;
+ comment: string | undefined;
}
- interface MethodSignature extends SignatureDeclaration, TypeElement {
- kind: SyntaxKind.MethodSignature;
- name: PropertyName;
+ interface JSDocTag extends Node {
+ atToken: AtToken;
+ tagName: Identifier;
+ comment: string | undefined;
}
- interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
- kind: SyntaxKind.MethodDeclaration;
- name: PropertyName;
- body?: FunctionBody;
+ interface JSDocUnknownTag extends JSDocTag {
+ kind: SyntaxKind.JSDocTag;
}
- interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
- kind: SyntaxKind.Constructor;
- body?: FunctionBody;
+ interface JSDocTemplateTag extends JSDocTag {
+ kind: SyntaxKind.JSDocTemplateTag;
+ typeParameters: NodeArray;
}
- interface SemicolonClassElement extends ClassElement {
- kind: SyntaxKind.SemicolonClassElement;
+ interface JSDocReturnTag extends JSDocTag {
+ kind: SyntaxKind.JSDocReturnTag;
+ typeExpression: JSDocTypeExpression;
}
- interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
- kind: SyntaxKind.GetAccessor;
- name: PropertyName;
- body: FunctionBody;
+ interface JSDocTypeTag extends JSDocTag {
+ kind: SyntaxKind.JSDocTypeTag;
+ typeExpression: JSDocTypeExpression;
}
- interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
- kind: SyntaxKind.SetAccessor;
- name: PropertyName;
- body: FunctionBody;
+ interface JSDocTypedefTag extends JSDocTag, Declaration {
+ kind: SyntaxKind.JSDocTypedefTag;
+ name?: Identifier;
+ typeExpression?: JSDocTypeExpression;
+ jsDocTypeLiteral?: JSDocTypeLiteral;
}
- type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration;
- interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement {
- kind: SyntaxKind.IndexSignature;
+ interface JSDocPropertyTag extends JSDocTag, TypeElement {
+ kind: SyntaxKind.JSDocPropertyTag;
+ name: Identifier;
+ typeExpression: JSDocTypeExpression;
}
- interface TypeNode extends Node {
- _typeNodeBrand: any;
+ interface JSDocTypeLiteral extends JSDocType {
+ kind: SyntaxKind.JSDocTypeLiteral;
+ jsDocPropertyTags?: NodeArray;
+ jsDocTypeTag?: JSDocTypeTag;
}
- interface KeywordTypeNode extends TypeNode {
- kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword;
+ interface JSDocParameterTag extends JSDocTag {
+ kind: SyntaxKind.JSDocParameterTag;
+ preParameterName?: Identifier;
+ typeExpression?: JSDocTypeExpression;
+ postParameterName?: Identifier;
+ parameterName: Identifier;
+ isBracketed: boolean;
}
- interface ThisTypeNode extends TypeNode {
- kind: SyntaxKind.ThisType;
+ const enum FlowFlags {
+ Unreachable = 1,
+ Start = 2,
+ BranchLabel = 4,
+ LoopLabel = 8,
+ Assignment = 16,
+ TrueCondition = 32,
+ FalseCondition = 64,
+ SwitchClause = 128,
+ ArrayMutation = 256,
+ Referenced = 512,
+ Shared = 1024,
+ Label = 12,
+ Condition = 96,
}
- interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration {
- kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType;
+ interface FlowNode {
+ flags: FlowFlags;
+ id?: number;
}
- interface FunctionTypeNode extends FunctionOrConstructorTypeNode {
- kind: SyntaxKind.FunctionType;
+ interface FlowStart extends FlowNode {
+ container?: FunctionExpression | ArrowFunction | MethodDeclaration;
}
- interface ConstructorTypeNode extends FunctionOrConstructorTypeNode {
- kind: SyntaxKind.ConstructorType;
+ interface FlowLabel extends FlowNode {
+ antecedents: FlowNode[];
}
- interface TypeReferenceNode extends TypeNode {
- kind: SyntaxKind.TypeReference;
- typeName: EntityName;
- typeArguments?: NodeArray;
+ interface FlowAssignment extends FlowNode {
+ node: Expression | VariableDeclaration | BindingElement;
+ antecedent: FlowNode;
}
- interface TypePredicateNode extends TypeNode {
- kind: SyntaxKind.TypePredicate;
- parameterName: Identifier | ThisTypeNode;
- type: TypeNode;
+ interface FlowCondition extends FlowNode {
+ expression: Expression;
+ antecedent: FlowNode;
}
- interface TypeQueryNode extends TypeNode {
- kind: SyntaxKind.TypeQuery;
- exprName: EntityName;
+ interface FlowSwitchClause extends FlowNode {
+ switchStatement: SwitchStatement;
+ clauseStart: number;
+ clauseEnd: number;
+ antecedent: FlowNode;
}
- interface TypeLiteralNode extends TypeNode, Declaration {
- kind: SyntaxKind.TypeLiteral;
- members: NodeArray;
+ interface FlowArrayMutation extends FlowNode {
+ node: CallExpression | BinaryExpression;
+ antecedent: FlowNode;
}
- interface ArrayTypeNode extends TypeNode {
- kind: SyntaxKind.ArrayType;
- elementType: TypeNode;
+ type FlowType = Type | IncompleteType;
+ interface IncompleteType {
+ flags: TypeFlags;
+ type: Type;
}
- interface TupleTypeNode extends TypeNode {
- kind: SyntaxKind.TupleType;
- elementTypes: NodeArray;
+ interface AmdDependency {
+ path: string;
+ name: string;
}
- interface UnionOrIntersectionTypeNode extends TypeNode {
- kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType;
- types: NodeArray;
+ interface SourceFile extends Declaration {
+ kind: SyntaxKind.SourceFile;
+ statements: NodeArray;
+ endOfFileToken: Token;
+ fileName: string;
+ path: Path;
+ text: string;
+ amdDependencies: AmdDependency[];
+ moduleName: string;
+ referencedFiles: FileReference[];
+ typeReferenceDirectives: FileReference[];
+ languageVariant: LanguageVariant;
+ isDeclarationFile: boolean;
+ hasNoDefaultLib: boolean;
+ languageVersion: ScriptTarget;
}
- interface UnionTypeNode extends UnionOrIntersectionTypeNode {
- kind: SyntaxKind.UnionType;
+ interface ScriptReferenceHost {
+ getCompilerOptions(): CompilerOptions;
+ getSourceFile(fileName: string): SourceFile;
+ getSourceFileByPath(path: Path): SourceFile;
+ getCurrentDirectory(): string;
}
- interface IntersectionTypeNode extends UnionOrIntersectionTypeNode {
- kind: SyntaxKind.IntersectionType;
+ interface ParseConfigHost {
+ useCaseSensitiveFileNames: boolean;
+ readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[];
+ fileExists(path: string): boolean;
+ readFile(path: string): string;
}
- interface ParenthesizedTypeNode extends TypeNode {
- kind: SyntaxKind.ParenthesizedType;
- type: TypeNode;
+ interface WriteFileCallback {
+ (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void;
}
- interface LiteralTypeNode extends TypeNode {
- kind: SyntaxKind.LiteralType;
- literal: Expression;
+ class OperationCanceledException {
}
- interface StringLiteral extends LiteralExpression {
- kind: SyntaxKind.StringLiteral;
- textSourceNode?: Identifier | StringLiteral;
+ interface CancellationToken {
+ isCancellationRequested(): boolean;
+ throwIfCancellationRequested(): void;
}
- interface Expression extends Node {
- _expressionBrand: any;
- contextualType?: Type;
+ interface Program extends ScriptReferenceHost {
+ getRootFileNames(): string[];
+ getSourceFiles(): SourceFile[];
+ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean): EmitResult;
+ getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[];
+ getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[];
+ getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
+ getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
+ getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
+ getTypeChecker(): TypeChecker;
}
- interface OmittedExpression extends Expression {
- kind: SyntaxKind.OmittedExpression;
+ interface SourceMapSpan {
+ emittedLine: number;
+ emittedColumn: number;
+ sourceLine: number;
+ sourceColumn: number;
+ nameIndex?: number;
+ sourceIndex: number;
}
- interface PartiallyEmittedExpression extends LeftHandSideExpression {
- kind: SyntaxKind.PartiallyEmittedExpression;
- expression: Expression;
+ interface SourceMapData {
+ sourceMapFilePath: string;
+ jsSourceMappingURL: string;
+ sourceMapFile: string;
+ sourceMapSourceRoot: string;
+ sourceMapSources: string[];
+ sourceMapSourcesContent?: string[];
+ inputSourceFileNames: string[];
+ sourceMapNames?: string[];
+ sourceMapMappings: string;
+ sourceMapDecodedMappings: SourceMapSpan[];
}
- interface UnaryExpression extends Expression {
- _unaryExpressionBrand: any;
+ enum ExitStatus {
+ Success = 0,
+ DiagnosticsPresent_OutputsSkipped = 1,
+ DiagnosticsPresent_OutputsGenerated = 2,
}
- interface IncrementExpression extends UnaryExpression {
- _incrementExpressionBrand: any;
+ interface EmitResult {
+ emitSkipped: boolean;
+ diagnostics: Diagnostic[];
+ emittedFiles: string[];
}
- type PrefixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken;
- interface PrefixUnaryExpression extends IncrementExpression {
- kind: SyntaxKind.PrefixUnaryExpression;
- operator: PrefixUnaryOperator;
- operand: UnaryExpression;
+ interface TypeChecker {
+ getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
+ getDeclaredTypeOfSymbol(symbol: Symbol): Type;
+ getPropertiesOfType(type: Type): Symbol[];
+ getPropertyOfType(type: Type, propertyName: string): Symbol;
+ getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
+ getIndexTypeOfType(type: Type, kind: IndexKind): Type;
+ getBaseTypes(type: InterfaceType): ObjectType[];
+ getReturnTypeOfSignature(signature: Signature): Type;
+ getNonNullableType(type: Type): Type;
+ getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
+ getSymbolAtLocation(node: Node): Symbol;
+ getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
+ getShorthandAssignmentValueSymbol(location: Node): Symbol;
+ getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
+ getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol;
+ getTypeAtLocation(node: Node): Type;
+ typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
+ symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
+ getSymbolDisplayBuilder(): SymbolDisplayBuilder;
+ getFullyQualifiedName(symbol: Symbol): string;
+ getAugmentedPropertiesOfType(type: Type): Symbol[];
+ getRootSymbols(symbol: Symbol): Symbol[];
+ getContextualType(node: Expression): Type;
+ getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature;
+ getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature;
+ isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
+ isUndefinedSymbol(symbol: Symbol): boolean;
+ isArgumentsSymbol(symbol: Symbol): boolean;
+ isUnknownSymbol(symbol: Symbol): boolean;
+ getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
+ isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
+ getAliasedSymbol(symbol: Symbol): Symbol;
+ getExportsOfModule(moduleSymbol: Symbol): Symbol[];
+ getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type;
+ getJsxIntrinsicTagNames(): Symbol[];
+ isOptionalParameter(node: ParameterDeclaration): boolean;
+ getAmbientModules(): Symbol[];
}
- type PostfixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken;
- interface PostfixUnaryExpression extends IncrementExpression {
- kind: SyntaxKind.PostfixUnaryExpression;
- operand: LeftHandSideExpression;
- operator: PostfixUnaryOperator;
+ interface SymbolDisplayBuilder {
+ buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
+ buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
+ buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void;
+ buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
+ buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
+ buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
+ buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
+ buildDisplayForParametersAndDelimiters(thisParameter: Symbol, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
+ buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
+ buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
}
- interface PostfixExpression extends UnaryExpression {
- _postfixExpressionBrand: any;
+ interface SymbolWriter {
+ writeKeyword(text: string): void;
+ writeOperator(text: string): void;
+ writePunctuation(text: string): void;
+ writeSpace(text: string): void;
+ writeStringLiteral(text: string): void;
+ writeParameter(text: string): void;
+ writeSymbol(text: string, symbol: Symbol): void;
+ writeLine(): void;
+ increaseIndent(): void;
+ decreaseIndent(): void;
+ clear(): void;
+ trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
+ reportInaccessibleThisError(): void;
}
- interface LeftHandSideExpression extends IncrementExpression {
- _leftHandSideExpressionBrand: any;
+ const enum TypeFormatFlags {
+ None = 0,
+ WriteArrayAsGenericType = 1,
+ UseTypeOfFunction = 2,
+ NoTruncation = 4,
+ WriteArrowStyleSignature = 8,
+ WriteOwnNameForAnyLike = 16,
+ WriteTypeArgumentsOfSignature = 32,
+ InElementType = 64,
+ UseFullyQualifiedType = 128,
+ InFirstTypeArgument = 256,
+ InTypeAlias = 512,
+ UseTypeAliasValue = 1024,
}
- interface MemberExpression extends LeftHandSideExpression {
- _memberExpressionBrand: any;
+ const enum SymbolFormatFlags {
+ None = 0,
+ WriteTypeParametersOrArguments = 1,
+ UseOnlyExternalAliasing = 2,
}
- interface PrimaryExpression extends MemberExpression {
- _primaryExpressionBrand: any;
+ const enum TypePredicateKind {
+ This = 0,
+ Identifier = 1,
}
- interface NullLiteral extends PrimaryExpression {
- kind: SyntaxKind.NullKeyword;
+ interface TypePredicateBase {
+ kind: TypePredicateKind;
+ type: Type;
}
- interface BooleanLiteral extends PrimaryExpression {
- kind: SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword;
+ interface ThisTypePredicate extends TypePredicateBase {
+ kind: TypePredicateKind.This;
}
- interface ThisExpression extends PrimaryExpression {
- kind: SyntaxKind.ThisKeyword;
+ interface IdentifierTypePredicate extends TypePredicateBase {
+ kind: TypePredicateKind.Identifier;
+ parameterName: string;
+ parameterIndex: number;
}
- interface SuperExpression extends PrimaryExpression {
- kind: SyntaxKind.SuperKeyword;
+ type TypePredicate = IdentifierTypePredicate | ThisTypePredicate;
+ const enum SymbolFlags {
+ None = 0,
+ FunctionScopedVariable = 1,
+ BlockScopedVariable = 2,
+ Property = 4,
+ EnumMember = 8,
+ Function = 16,
+ Class = 32,
+ Interface = 64,
+ ConstEnum = 128,
+ RegularEnum = 256,
+ ValueModule = 512,
+ NamespaceModule = 1024,
+ TypeLiteral = 2048,
+ ObjectLiteral = 4096,
+ Method = 8192,
+ Constructor = 16384,
+ GetAccessor = 32768,
+ SetAccessor = 65536,
+ Signature = 131072,
+ TypeParameter = 262144,
+ TypeAlias = 524288,
+ ExportValue = 1048576,
+ ExportType = 2097152,
+ ExportNamespace = 4194304,
+ Alias = 8388608,
+ Instantiated = 16777216,
+ Merged = 33554432,
+ Transient = 67108864,
+ Prototype = 134217728,
+ SyntheticProperty = 268435456,
+ Optional = 536870912,
+ ExportStar = 1073741824,
+ Enum = 384,
+ Variable = 3,
+ Value = 107455,
+ Type = 793064,
+ Namespace = 1920,
+ Module = 1536,
+ Accessor = 98304,
+ FunctionScopedVariableExcludes = 107454,
+ BlockScopedVariableExcludes = 107455,
+ ParameterExcludes = 107455,
+ PropertyExcludes = 0,
+ EnumMemberExcludes = 900095,
+ FunctionExcludes = 106927,
+ ClassExcludes = 899519,
+ InterfaceExcludes = 792968,
+ RegularEnumExcludes = 899327,
+ ConstEnumExcludes = 899967,
+ ValueModuleExcludes = 106639,
+ NamespaceModuleExcludes = 0,
+ MethodExcludes = 99263,
+ GetAccessorExcludes = 41919,
+ SetAccessorExcludes = 74687,
+ TypeParameterExcludes = 530920,
+ TypeAliasExcludes = 793064,
+ AliasExcludes = 8388608,
+ ModuleMember = 8914931,
+ ExportHasLocal = 944,
+ HasExports = 1952,
+ HasMembers = 6240,
+ BlockScoped = 418,
+ PropertyOrAccessor = 98308,
+ Export = 7340032,
+ ClassMember = 106500,
}
- interface DeleteExpression extends UnaryExpression {
- kind: SyntaxKind.DeleteExpression;
- expression: UnaryExpression;
+ interface Symbol {
+ flags: SymbolFlags;
+ name: string;
+ declarations?: Declaration[];
+ valueDeclaration?: Declaration;
+ members?: SymbolTable;
+ exports?: SymbolTable;
+ globalExports?: SymbolTable;
}
- interface TypeOfExpression extends UnaryExpression {
- kind: SyntaxKind.TypeOfExpression;
- expression: UnaryExpression;
+ type SymbolTable = Map;
+ const enum TypeFlags {
+ Any = 1,
+ String = 2,
+ Number = 4,
+ Boolean = 8,
+ Enum = 16,
+ StringLiteral = 32,
+ NumberLiteral = 64,
+ BooleanLiteral = 128,
+ EnumLiteral = 256,
+ ESSymbol = 512,
+ Void = 1024,
+ Undefined = 2048,
+ Null = 4096,
+ Never = 8192,
+ TypeParameter = 16384,
+ Class = 32768,
+ Interface = 65536,
+ Reference = 131072,
+ Tuple = 262144,
+ Union = 524288,
+ Intersection = 1048576,
+ Anonymous = 2097152,
+ Instantiated = 4194304,
+ Literal = 480,
+ StringOrNumberLiteral = 96,
+ PossiblyFalsy = 7406,
+ StringLike = 34,
+ NumberLike = 340,
+ BooleanLike = 136,
+ EnumLike = 272,
+ ObjectType = 2588672,
+ UnionOrIntersection = 1572864,
+ StructuredType = 4161536,
+ StructuredOrTypeParameter = 4177920,
+ Narrowable = 4178943,
+ NotUnionOrUnit = 2589185,
}
- interface VoidExpression extends UnaryExpression {
- kind: SyntaxKind.VoidExpression;
- expression: UnaryExpression;
+ type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
+ interface Type {
+ flags: TypeFlags;
+ symbol?: Symbol;
+ pattern?: DestructuringPattern;
+ aliasSymbol?: Symbol;
+ aliasTypeArguments?: Type[];
}
- interface AwaitExpression extends UnaryExpression {
- kind: SyntaxKind.AwaitExpression;
- expression: UnaryExpression;
+ interface LiteralType extends Type {
+ text: string;
+ freshType?: LiteralType;
+ regularType?: LiteralType;
}
- interface YieldExpression extends Expression {
- kind: SyntaxKind.YieldExpression;
- asteriskToken?: AsteriskToken;
- expression?: Expression;
+ interface EnumType extends Type {
+ memberTypes: Map;
}
- type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken;
- type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken;
- type MultiplicativeOperatorOrHigher = ExponentiationOperator | MultiplicativeOperator;
- type AdditiveOperator = SyntaxKind.PlusToken | SyntaxKind.MinusToken;
- type AdditiveOperatorOrHigher = MultiplicativeOperatorOrHigher | AdditiveOperator;
- type ShiftOperator = SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken;
- type ShiftOperatorOrHigher = AdditiveOperatorOrHigher | ShiftOperator;
- type RelationalOperator = SyntaxKind.LessThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.InstanceOfKeyword | SyntaxKind.InKeyword;
- type RelationalOperatorOrHigher = ShiftOperatorOrHigher | RelationalOperator;
- type EqualityOperator = SyntaxKind.EqualsEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.ExclamationEqualsToken;
- type EqualityOperatorOrHigher = RelationalOperatorOrHigher | EqualityOperator;
- type BitwiseOperator = SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken;
- type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator;
- type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken;
- type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator;
- type CompoundAssignmentOperator = SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken;
- type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator;
- type AssignmentOperatorOrHigher = LogicalOperatorOrHigher | AssignmentOperator;
- type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken;
- type BinaryOperatorToken = Token;
- interface BinaryExpression extends Expression, Declaration {
- kind: SyntaxKind.BinaryExpression;
- left: Expression;
- operatorToken: BinaryOperatorToken;
- right: Expression;
+ interface EnumLiteralType extends LiteralType {
+ baseType: EnumType & UnionType;
}
- interface ConditionalExpression extends Expression {
- kind: SyntaxKind.ConditionalExpression;
- condition: Expression;
- questionToken: QuestionToken;
- whenTrue: Expression;
- colonToken: ColonToken;
- whenFalse: Expression;
+ interface ObjectType extends Type {
+ isObjectLiteralPatternWithComputedProperties?: boolean;
}
- type FunctionBody = Block;
- type ConciseBody = FunctionBody | Expression;
- interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration {
- kind: SyntaxKind.FunctionExpression;
- name?: Identifier;
- body: FunctionBody;
+ interface InterfaceType extends ObjectType {
+ typeParameters: TypeParameter[];
+ outerTypeParameters: TypeParameter[];
+ localTypeParameters: TypeParameter[];
+ thisType: TypeParameter;
}
- interface ArrowFunction extends Expression, FunctionLikeDeclaration {
- kind: SyntaxKind.ArrowFunction;
- equalsGreaterThanToken: EqualsGreaterThanToken;
- body: ConciseBody;
+ interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
+ declaredProperties: Symbol[];
+ declaredCallSignatures: Signature[];
+ declaredConstructSignatures: Signature[];
+ declaredStringIndexInfo: IndexInfo;
+ declaredNumberIndexInfo: IndexInfo;
}
- interface LiteralLikeNode extends Node {
- text: string;
- isUnterminated?: boolean;
- hasExtendedUnicodeEscape?: boolean;
- isOctalLiteral?: boolean;
+ interface TypeReference extends ObjectType {
+ target: GenericType;
+ typeArguments: Type[];
}
- interface LiteralExpression extends LiteralLikeNode, PrimaryExpression {
- _literalExpressionBrand: any;
+ interface GenericType extends InterfaceType, TypeReference {
}
- interface RegularExpressionLiteral extends LiteralExpression {
- kind: SyntaxKind.RegularExpressionLiteral;
+ interface UnionOrIntersectionType extends Type {
+ types: Type[];
}
- interface NoSubstitutionTemplateLiteral extends LiteralExpression {
- kind: SyntaxKind.NoSubstitutionTemplateLiteral;
+ interface UnionType extends UnionOrIntersectionType {
}
- interface NumericLiteral extends LiteralExpression {
- kind: SyntaxKind.NumericLiteral;
- trailingComment?: string;
+ interface IntersectionType extends UnionOrIntersectionType {
}
- interface TemplateHead extends LiteralLikeNode {
- kind: SyntaxKind.TemplateHead;
+ interface TypeParameter extends Type {
+ constraint: Type;
}
- interface TemplateMiddle extends LiteralLikeNode {
- kind: SyntaxKind.TemplateMiddle;
+ const enum SignatureKind {
+ Call = 0,
+ Construct = 1,
}
- interface TemplateTail extends LiteralLikeNode {
- kind: SyntaxKind.TemplateTail;
+ interface Signature {
+ declaration: SignatureDeclaration;
+ typeParameters: TypeParameter[];
+ parameters: Symbol[];
}
- type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral;
- interface TemplateExpression extends PrimaryExpression {
- kind: SyntaxKind.TemplateExpression;
- head: TemplateHead;
- templateSpans: NodeArray;
+ const enum IndexKind {
+ String = 0,
+ Number = 1,
}
- interface TemplateSpan extends Node {
- kind: SyntaxKind.TemplateSpan;
- expression: Expression;
- literal: TemplateMiddle | TemplateTail;
+ interface IndexInfo {
+ type: Type;
+ isReadonly: boolean;
+ declaration?: SignatureDeclaration;
}
- interface ParenthesizedExpression extends PrimaryExpression {
- kind: SyntaxKind.ParenthesizedExpression;
- expression: Expression;
+ interface DiagnosticMessage {
+ key: string;
+ category: DiagnosticCategory;
+ code: number;
+ message: string;
}
- interface ArrayLiteralExpression extends PrimaryExpression {
- kind: SyntaxKind.ArrayLiteralExpression;
- elements: NodeArray;
- multiLine?: boolean;
+ interface DiagnosticMessageChain {
+ messageText: string;
+ category: DiagnosticCategory;
+ code: number;
+ next?: DiagnosticMessageChain;
}
- interface SpreadElementExpression extends Expression {
- kind: SyntaxKind.SpreadElementExpression;
- expression: Expression;
+ interface Diagnostic {
+ file: SourceFile;
+ start: number;
+ length: number;
+ messageText: string | DiagnosticMessageChain;
+ category: DiagnosticCategory;
+ code: number;
}
- interface ObjectLiteralExpressionBase extends PrimaryExpression, Declaration {
- properties: NodeArray;
+ enum DiagnosticCategory {
+ Warning = 0,
+ Error = 1,
+ Message = 2,
}
- interface ObjectLiteralExpression extends ObjectLiteralExpressionBase {
- kind: SyntaxKind.ObjectLiteralExpression;
- multiLine?: boolean;
+ enum ModuleResolutionKind {
+ Classic = 1,
+ NodeJs = 2,
}
- type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression;
- type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression;
- interface PropertyAccessExpression extends MemberExpression, Declaration {
- kind: SyntaxKind.PropertyAccessExpression;
- expression: LeftHandSideExpression;
- name: Identifier;
+ type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike;
+ interface CompilerOptions {
+ allowJs?: boolean;
+ allowSyntheticDefaultImports?: boolean;
+ allowUnreachableCode?: boolean;
+ allowUnusedLabels?: boolean;
+ alwaysStrict?: boolean;
+ baseUrl?: string;
+ charset?: string;
+ declaration?: boolean;
+ declarationDir?: string;
+ disableSizeLimit?: boolean;
+ emitBOM?: boolean;
+ emitDecoratorMetadata?: boolean;
+ experimentalDecorators?: boolean;
+ forceConsistentCasingInFileNames?: boolean;
+ importHelpers?: boolean;
+ inlineSourceMap?: boolean;
+ inlineSources?: boolean;
+ isolatedModules?: boolean;
+ jsx?: JsxEmit;
+ lib?: string[];
+ locale?: string;
+ mapRoot?: string;
+ maxNodeModuleJsDepth?: number;
+ module?: ModuleKind;
+ moduleResolution?: ModuleResolutionKind;
+ newLine?: NewLineKind;
+ noEmit?: boolean;
+ noEmitHelpers?: boolean;
+ noEmitOnError?: boolean;
+ noErrorTruncation?: boolean;
+ noFallthroughCasesInSwitch?: boolean;
+ noImplicitAny?: boolean;
+ noImplicitReturns?: boolean;
+ noImplicitThis?: boolean;
+ noUnusedLocals?: boolean;
+ noUnusedParameters?: boolean;
+ noImplicitUseStrict?: boolean;
+ noLib?: boolean;
+ noResolve?: boolean;
+ out?: string;
+ outDir?: string;
+ outFile?: string;
+ paths?: MapLike;
+ preserveConstEnums?: boolean;
+ project?: string;
+ reactNamespace?: string;
+ removeComments?: boolean;
+ rootDir?: string;
+ rootDirs?: string[];
+ skipLibCheck?: boolean;
+ skipDefaultLibCheck?: boolean;
+ sourceMap?: boolean;
+ sourceRoot?: string;
+ strictNullChecks?: boolean;
+ suppressExcessPropertyErrors?: boolean;
+ suppressImplicitAnyIndexErrors?: boolean;
+ target?: ScriptTarget;
+ traceResolution?: boolean;
+ types?: string[];
+ typeRoots?: string[];
+ [option: string]: CompilerOptionsValue | undefined;
}
- interface SuperPropertyAccessExpression extends PropertyAccessExpression {
- expression: SuperExpression;
+ interface TypingOptions {
+ enableAutoDiscovery?: boolean;
+ include?: string[];
+ exclude?: string[];
+ [option: string]: string[] | boolean | undefined;
}
- interface PropertyAccessEntityNameExpression extends PropertyAccessExpression {
- _propertyAccessExpressionLikeQualifiedNameBrand?: any;
- expression: EntityNameExpression;
+ interface DiscoverTypingsInfo {
+ fileNames: string[];
+ projectRootPath: string;
+ safeListPath: string;
+ packageNameToTypingLocation: Map;
+ typingOptions: TypingOptions;
+ compilerOptions: CompilerOptions;
}
- interface ElementAccessExpression extends MemberExpression {
- kind: SyntaxKind.ElementAccessExpression;
- expression: LeftHandSideExpression;
- argumentExpression?: Expression;
+ enum ModuleKind {
+ None = 0,
+ CommonJS = 1,
+ AMD = 2,
+ UMD = 3,
+ System = 4,
+ ES2015 = 5,
}
- interface SuperElementAccessExpression extends ElementAccessExpression {
- expression: SuperExpression;
+ const enum JsxEmit {
+ None = 0,
+ Preserve = 1,
+ React = 2,
}
- type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression;
- interface CallExpression extends LeftHandSideExpression, Declaration {
- kind: SyntaxKind.CallExpression;
- expression: LeftHandSideExpression;
- typeArguments?: NodeArray;
- arguments: NodeArray;
- }
- interface SuperCall extends CallExpression {
- expression: SuperExpression;
- }
- interface ExpressionWithTypeArguments extends TypeNode {
- kind: SyntaxKind.ExpressionWithTypeArguments;
- expression: LeftHandSideExpression;
- typeArguments?: NodeArray;
- }
- interface NewExpression extends PrimaryExpression, Declaration {
- kind: SyntaxKind.NewExpression;
- expression: LeftHandSideExpression;
- typeArguments?: NodeArray;
- arguments: NodeArray;
- }
- interface TaggedTemplateExpression extends MemberExpression {
- kind: SyntaxKind.TaggedTemplateExpression;
- tag: LeftHandSideExpression;
- template: TemplateLiteral;
- }
- type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
- interface AsExpression extends Expression {
- kind: SyntaxKind.AsExpression;
- expression: Expression;
- type: TypeNode;
- }
- interface TypeAssertion extends UnaryExpression {
- kind: SyntaxKind.TypeAssertionExpression;
- type: TypeNode;
- expression: UnaryExpression;
+ const enum NewLineKind {
+ CarriageReturnLineFeed = 0,
+ LineFeed = 1,
}
- type AssertionExpression = TypeAssertion | AsExpression;
- interface NonNullExpression extends LeftHandSideExpression {
- kind: SyntaxKind.NonNullExpression;
- expression: Expression;
+ interface LineAndCharacter {
+ line: number;
+ character: number;
}
- interface JsxElement extends PrimaryExpression {
- kind: SyntaxKind.JsxElement;
- openingElement: JsxOpeningElement;
- children: NodeArray;
- closingElement: JsxClosingElement;
+ const enum ScriptKind {
+ Unknown = 0,
+ JS = 1,
+ JSX = 2,
+ TS = 3,
+ TSX = 4,
}
- type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression;
- interface JsxOpeningElement extends Expression {
- kind: SyntaxKind.JsxOpeningElement;
- tagName: JsxTagNameExpression;
- attributes: NodeArray;
+ const enum ScriptTarget {
+ ES3 = 0,
+ ES5 = 1,
+ ES2015 = 2,
+ ES2016 = 3,
+ ES2017 = 4,
+ Latest = 4,
}
- interface JsxSelfClosingElement extends PrimaryExpression {
- kind: SyntaxKind.JsxSelfClosingElement;
- tagName: JsxTagNameExpression;
- attributes: NodeArray;
+ const enum LanguageVariant {
+ Standard = 0,
+ JSX = 1,
}
- type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement;
- type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute;
- interface JsxAttribute extends Node {
- kind: SyntaxKind.JsxAttribute;
- name: Identifier;
- initializer?: StringLiteral | JsxExpression;
+ interface ParsedCommandLine {
+ options: CompilerOptions;
+ typingOptions?: TypingOptions;
+ fileNames: string[];
+ raw?: any;
+ errors: Diagnostic[];
+ wildcardDirectories?: MapLike;
+ compileOnSave?: boolean;
}
- interface JsxSpreadAttribute extends Node {
- kind: SyntaxKind.JsxSpreadAttribute;
- expression: Expression;
+ const enum WatchDirectoryFlags {
+ None = 0,
+ Recursive = 1,
}
- interface JsxClosingElement extends Node {
- kind: SyntaxKind.JsxClosingElement;
- tagName: JsxTagNameExpression;
+ interface ExpandResult {
+ fileNames: string[];
+ wildcardDirectories: MapLike;
}
- interface JsxExpression extends Expression {
- kind: SyntaxKind.JsxExpression;
- expression?: Expression;
+ interface ModuleResolutionHost {
+ fileExists(fileName: string): boolean;
+ readFile(fileName: string): string;
+ trace?(s: string): void;
+ directoryExists?(directoryName: string): boolean;
+ realpath?(path: string): string;
+ getCurrentDirectory?(): string;
+ getDirectories?(path: string): string[];
}
- interface JsxText extends Node {
- kind: SyntaxKind.JsxText;
+ interface ResolvedModule {
+ resolvedFileName: string;
+ isExternalLibraryImport?: boolean;
}
- type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement;
- interface Statement extends Node {
- _statementBrand: any;
+ interface ResolvedModuleWithFailedLookupLocations {
+ resolvedModule: ResolvedModule;
+ failedLookupLocations: string[];
}
- interface NotEmittedStatement extends Statement {
- kind: SyntaxKind.NotEmittedStatement;
+ interface ResolvedTypeReferenceDirective {
+ primary: boolean;
+ resolvedFileName?: string;
}
- interface EmptyStatement extends Statement {
- kind: SyntaxKind.EmptyStatement;
+ interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations {
+ resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective;
+ failedLookupLocations: string[];
}
- interface DebuggerStatement extends Statement {
- kind: SyntaxKind.DebuggerStatement;
+ interface CompilerHost extends ModuleResolutionHost {
+ getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
+ getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
+ getCancellationToken?(): CancellationToken;
+ getDefaultLibFileName(options: CompilerOptions): string;
+ getDefaultLibLocation?(): string;
+ writeFile: WriteFileCallback;
+ getCurrentDirectory(): string;
+ getDirectories(path: string): string[];
+ getCanonicalFileName(fileName: string): string;
+ useCaseSensitiveFileNames(): boolean;
+ getNewLine(): string;
+ resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[];
+ getEnvironmentVariable?(name: string): string;
}
- interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement {
- kind: SyntaxKind.MissingDeclaration;
- name?: Identifier;
+ interface TextSpan {
+ start: number;
+ length: number;
}
- type BlockLike = SourceFile | Block | ModuleBlock | CaseClause;
- interface Block extends Statement {
- kind: SyntaxKind.Block;
- statements: NodeArray;
- multiLine?: boolean;
+ interface TextChangeRange {
+ span: TextSpan;
+ newLength: number;
}
- interface VariableStatement extends Statement {
- kind: SyntaxKind.VariableStatement;
- declarationList: VariableDeclarationList;
+ interface SyntaxList extends Node {
+ _children: Node[];
}
- interface ExpressionStatement extends Statement {
- kind: SyntaxKind.ExpressionStatement;
- expression: Expression;
+}
+declare namespace ts {
+ type FileWatcherCallback = (fileName: string, removed?: boolean) => void;
+ type DirectoryWatcherCallback = (fileName: string) => void;
+ interface WatchedFile {
+ fileName: string;
+ callback: FileWatcherCallback;
+ mtime?: Date;
}
- interface IfStatement extends Statement {
- kind: SyntaxKind.IfStatement;
- expression: Expression;
- thenStatement: Statement;
- elseStatement?: Statement;
+ interface System {
+ args: string[];
+ newLine: string;
+ useCaseSensitiveFileNames: boolean;
+ write(s: string): void;
+ readFile(path: string, encoding?: string): string;
+ getFileSize?(path: string): number;
+ writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
+ watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
+ watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
+ resolvePath(path: string): string;
+ fileExists(path: string): boolean;
+ directoryExists(path: string): boolean;
+ createDirectory(path: string): void;
+ getExecutingFilePath(): string;
+ getCurrentDirectory(): string;
+ getDirectories(path: string): string[];
+ readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[];
+ getModifiedTime?(path: string): Date;
+ createHash?(data: string): string;
+ getMemoryUsage?(): number;
+ exit(exitCode?: number): void;
+ realpath?(path: string): string;
}
- interface IterationStatement extends Statement {
- statement: Statement;
+ interface FileWatcher {
+ close(): void;
}
- interface DoStatement extends IterationStatement {
- kind: SyntaxKind.DoStatement;
- expression: Expression;
+ interface DirectoryWatcher extends FileWatcher {
+ directoryName: string;
+ referenceCount: number;
}
- interface WhileStatement extends IterationStatement {
- kind: SyntaxKind.WhileStatement;
- expression: Expression;
+ let sys: System;
+}
+declare namespace ts {
+ function getEffectiveTypeRoots(options: CompilerOptions, host: {
+ directoryExists?: (directoryName: string) => boolean;
+ getCurrentDirectory?: () => string;
+ }): string[] | undefined;
+ function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
+ function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
+ function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
+ function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
+ function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
+}
+declare namespace ts {
+ function getDefaultLibFileName(options: CompilerOptions): string;
+ function textSpanEnd(span: TextSpan): number;
+ function textSpanIsEmpty(span: TextSpan): boolean;
+ function textSpanContainsPosition(span: TextSpan, position: number): boolean;
+ function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
+ function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
+ function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
+ function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
+ function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
+ function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean;
+ function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
+ function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
+ function createTextSpan(start: number, length: number): TextSpan;
+ function createTextSpanFromBounds(start: number, end: number): TextSpan;
+ function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
+ function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
+ function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
+ let unchangedTextChangeRange: TextChangeRange;
+ function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
+ function getTypeParameterOwner(d: Declaration): Declaration;
+ function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
+ function getCombinedModifierFlags(node: Node): ModifierFlags;
+ function getCombinedNodeFlags(node: Node): NodeFlags;
+}
+declare namespace ts {
+ interface ErrorCallback {
+ (message: DiagnosticMessage, length: number): void;
}
- type ForInitializer = VariableDeclarationList | Expression;
- interface ForStatement extends IterationStatement {
- kind: SyntaxKind.ForStatement;
- initializer?: ForInitializer;
- condition?: Expression;
- incrementor?: Expression;
- }
- interface ForInStatement extends IterationStatement {
- kind: SyntaxKind.ForInStatement;
- initializer: ForInitializer;
- expression: Expression;
- }
- interface ForOfStatement extends IterationStatement {
- kind: SyntaxKind.ForOfStatement;
- initializer: ForInitializer;
- expression: Expression;
- }
- interface BreakStatement extends Statement {
- kind: SyntaxKind.BreakStatement;
- label?: Identifier;
- }
- interface ContinueStatement extends Statement {
- kind: SyntaxKind.ContinueStatement;
- label?: Identifier;
- }
- type BreakOrContinueStatement = BreakStatement | ContinueStatement;
- interface ReturnStatement extends Statement {
- kind: SyntaxKind.ReturnStatement;
- expression?: Expression;
- }
- interface WithStatement extends Statement {
- kind: SyntaxKind.WithStatement;
- expression: Expression;
- statement: Statement;
- }
- interface SwitchStatement extends Statement {
- kind: SyntaxKind.SwitchStatement;
- expression: Expression;
- caseBlock: CaseBlock;
- possiblyExhaustive?: boolean;
- }
- interface CaseBlock extends Node {
- kind: SyntaxKind.CaseBlock;
- clauses: NodeArray;
+ interface Scanner {
+ getStartPos(): number;
+ getToken(): SyntaxKind;
+ getTextPos(): number;
+ getTokenPos(): number;
+ getTokenText(): string;
+ getTokenValue(): string;
+ hasExtendedUnicodeEscape(): boolean;
+ hasPrecedingLineBreak(): boolean;
+ isIdentifier(): boolean;
+ isReservedWord(): boolean;
+ isUnterminated(): boolean;
+ reScanGreaterToken(): SyntaxKind;
+ reScanSlashToken(): SyntaxKind;
+ reScanTemplateToken(): SyntaxKind;
+ scanJsxIdentifier(): SyntaxKind;
+ scanJsxAttributeValue(): SyntaxKind;
+ reScanJsxToken(): SyntaxKind;
+ scanJsxToken(): SyntaxKind;
+ scanJSDocToken(): SyntaxKind;
+ scan(): SyntaxKind;
+ getText(): string;
+ setText(text: string, start?: number, length?: number): void;
+ setOnError(onError: ErrorCallback): void;
+ setScriptTarget(scriptTarget: ScriptTarget): void;
+ setLanguageVariant(variant: LanguageVariant): void;
+ setTextPos(textPos: number): void;
+ lookAhead(callback: () => T): T;
+ scanRange(start: number, length: number, callback: () => T): T;
+ tryScan(callback: () => T): T;
}
- interface CaseClause extends Node {
- kind: SyntaxKind.CaseClause;
- expression: Expression;
- statements: NodeArray;
+ function tokenToString(t: SyntaxKind): string;
+ function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
+ function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
+ function isWhiteSpace(ch: number): boolean;
+ function isWhiteSpaceSingleLine(ch: number): boolean;
+ function isLineBreak(ch: number): boolean;
+ function couldStartTrivia(text: string, pos: number): boolean;
+ function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U;
+ function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U;
+ function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U;
+ function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U;
+ function getLeadingCommentRanges(text: string, pos: number): CommentRange[];
+ function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
+ function getShebang(text: string): string;
+ function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
+ function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
+ function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
+}
+declare namespace ts {
+ function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
+ function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
+ function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
+ function isExternalModule(file: SourceFile): boolean;
+ function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
+}
+declare namespace ts {
+ const version = "2.1.0";
+ function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
+ function resolveTripleslashReference(moduleName: string, containingFile: string): string;
+ function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
+ function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
+ interface FormatDiagnosticsHost {
+ getCurrentDirectory(): string;
+ getCanonicalFileName(fileName: string): string;
+ getNewLine(): string;
}
- interface DefaultClause extends Node {
- kind: SyntaxKind.DefaultClause;
- statements: NodeArray;
+ function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string;
+ function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
+ function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
+}
+declare namespace ts {
+ function readConfigFile(fileName: string, readFile: (path: string) => string): {
+ config?: any;
+ error?: Diagnostic;
+ };
+ function parseConfigFileTextToJson(fileName: string, jsonText: string, stripComments?: boolean): {
+ config?: any;
+ error?: Diagnostic;
+ };
+ function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine;
+ function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean;
+ function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
+ options: CompilerOptions;
+ errors: Diagnostic[];
+ };
+ function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
+ options: TypingOptions;
+ errors: Diagnostic[];
+ };
+}
+declare namespace ts {
+ interface Node {
+ getSourceFile(): SourceFile;
+ getChildCount(sourceFile?: SourceFile): number;
+ getChildAt(index: number, sourceFile?: SourceFile): Node;
+ getChildren(sourceFile?: SourceFile): Node[];
+ getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number;
+ getFullStart(): number;
+ getEnd(): number;
+ getWidth(sourceFile?: SourceFile): number;
+ getFullWidth(): number;
+ getLeadingTriviaWidth(sourceFile?: SourceFile): number;
+ getFullText(sourceFile?: SourceFile): string;
+ getText(sourceFile?: SourceFile): string;
+ getFirstToken(sourceFile?: SourceFile): Node;
+ getLastToken(sourceFile?: SourceFile): Node;
}
- type CaseOrDefaultClause = CaseClause | DefaultClause;
- interface LabeledStatement extends Statement {
- kind: SyntaxKind.LabeledStatement;
- label: Identifier;
- statement: Statement;
+ interface Symbol {
+ getFlags(): SymbolFlags;
+ getName(): string;
+ getDeclarations(): Declaration[];
+ getDocumentationComment(): SymbolDisplayPart[];
}
- interface ThrowStatement extends Statement {
- kind: SyntaxKind.ThrowStatement;
- expression: Expression;
+ interface Type {
+ getFlags(): TypeFlags;
+ getSymbol(): Symbol;
+ getProperties(): Symbol[];
+ getProperty(propertyName: string): Symbol;
+ getApparentProperties(): Symbol[];
+ getCallSignatures(): Signature[];
+ getConstructSignatures(): Signature[];
+ getStringIndexType(): Type;
+ getNumberIndexType(): Type;
+ getBaseTypes(): ObjectType[];
+ getNonNullableType(): Type;
}
- interface TryStatement extends Statement {
- kind: SyntaxKind.TryStatement;
- tryBlock: Block;
- catchClause?: CatchClause;
- finallyBlock?: Block;
+ interface Signature {
+ getDeclaration(): SignatureDeclaration;
+ getTypeParameters(): Type[];
+ getParameters(): Symbol[];
+ getReturnType(): Type;
+ getDocumentationComment(): SymbolDisplayPart[];
}
- interface CatchClause extends Node {
- kind: SyntaxKind.CatchClause;
- variableDeclaration: VariableDeclaration;
- block: Block;
+ interface SourceFile {
+ getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
+ getLineStarts(): number[];
+ getPositionOfLineAndCharacter(line: number, character: number): number;
+ update(newText: string, textChangeRange: TextChangeRange): SourceFile;
}
- type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration;
- interface ClassLikeDeclaration extends Declaration {
- name?: Identifier;
- typeParameters?: NodeArray;
- heritageClauses?: NodeArray;
- members: NodeArray;
+ interface IScriptSnapshot {
+ getText(start: number, end: number): string;
+ getLength(): number;
+ getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined;
+ dispose?(): void;
}
- interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement {
- kind: SyntaxKind.ClassDeclaration;
- name?: Identifier;
+ namespace ScriptSnapshot {
+ function fromString(text: string): IScriptSnapshot;
}
- interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
- kind: SyntaxKind.ClassExpression;
+ interface PreProcessedFileInfo {
+ referencedFiles: FileReference[];
+ typeReferenceDirectives: FileReference[];
+ importedFiles: FileReference[];
+ ambientExternalModules: string[];
+ isLibFile: boolean;
}
- interface ClassElement extends Declaration {
- _classElementBrand: any;
- name?: PropertyName;
+ interface HostCancellationToken {
+ isCancellationRequested(): boolean;
}
- interface TypeElement extends Declaration {
- _typeElementBrand: any;
- name?: PropertyName;
- questionToken?: QuestionToken;
+ interface LanguageServiceHost {
+ getCompilationSettings(): CompilerOptions;
+ getNewLine?(): string;
+ getProjectVersion?(): string;
+ getScriptFileNames(): string[];
+ getScriptKind?(fileName: string): ScriptKind;
+ getScriptVersion(fileName: string): string;
+ getScriptSnapshot(fileName: string): IScriptSnapshot | undefined;
+ getLocalizedDiagnosticMessages?(): any;
+ getCancellationToken?(): HostCancellationToken;
+ getCurrentDirectory(): string;
+ getDefaultLibFileName(options: CompilerOptions): string;
+ log?(s: string): void;
+ trace?(s: string): void;
+ error?(s: string): void;
+ useCaseSensitiveFileNames?(): boolean;
+ readDirectory?(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[];
+ readFile?(path: string, encoding?: string): string;
+ fileExists?(path: string): boolean;
+ getTypeRootsVersion?(): number;
+ resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
+ resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[];
+ directoryExists?(directoryName: string): boolean;
+ getDirectories?(directoryName: string): string[];
}
- interface InterfaceDeclaration extends DeclarationStatement {
- kind: SyntaxKind.InterfaceDeclaration;
- name: Identifier;
- typeParameters?: NodeArray;
- heritageClauses?: NodeArray;
- members: NodeArray;
- }
- interface HeritageClause extends Node {
- kind: SyntaxKind.HeritageClause;
- token: SyntaxKind;
- types?: NodeArray;
- }
- interface TypeAliasDeclaration extends DeclarationStatement {
- kind: SyntaxKind.TypeAliasDeclaration;
- name: Identifier;
- typeParameters?: NodeArray;
- type: TypeNode;
- }
- interface EnumMember extends Declaration {
- kind: SyntaxKind.EnumMember;
- name: PropertyName;
- initializer?: Expression;
- }
- interface EnumDeclaration extends DeclarationStatement {
- kind: SyntaxKind.EnumDeclaration;
- name: Identifier;
- members: NodeArray;
- }
- type ModuleBody = ModuleBlock | ModuleDeclaration;
- type ModuleName = Identifier | StringLiteral;
- interface ModuleDeclaration extends DeclarationStatement {
- kind: SyntaxKind.ModuleDeclaration;
- name: Identifier | LiteralExpression;
- body?: ModuleBlock | NamespaceDeclaration;
- }
- interface NamespaceDeclaration extends ModuleDeclaration {
- name: Identifier;
- body: ModuleBlock | NamespaceDeclaration;
- }
- interface ModuleBlock extends Node, Statement {
- kind: SyntaxKind.ModuleBlock;
- statements: NodeArray;
+ interface LanguageService {
+ cleanupSemanticCache(): void;
+ getSyntacticDiagnostics(fileName: string): Diagnostic[];
+ getSemanticDiagnostics(fileName: string): Diagnostic[];
+ getCompilerOptionsDiagnostics(): Diagnostic[];
+ getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
+ getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
+ getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
+ getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
+ getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
+ getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails;
+ getCompletionEntrySymbol(fileName: string, position: number, entryName: string): Symbol;
+ getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
+ getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan;
+ getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan;
+ getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems;
+ getRenameInfo(fileName: string, position: number): RenameInfo;
+ findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
+ getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
+ getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
+ getImplementationAtPosition(fileName: string, position: number): ImplementationLocation[];
+ getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
+ findReferences(fileName: string, position: number): ReferencedSymbol[];
+ getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
+ getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
+ getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean): NavigateToItem[];
+ getNavigationBarItems(fileName: string): NavigationBarItem[];
+ getNavigationTree(fileName: string): NavigationTree;
+ getOutliningSpans(fileName: string): OutliningSpan[];
+ getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
+ getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[];
+ getIndentationAtPosition(fileName: string, position: number, options: EditorOptions | EditorSettings): number;
+ getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
+ getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
+ getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
+ getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion;
+ isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
+ getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): CodeAction[];
+ getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
+ getProgram(): Program;
+ dispose(): void;
}
- type ModuleReference = EntityName | ExternalModuleReference;
- interface ImportEqualsDeclaration extends DeclarationStatement {
- kind: SyntaxKind.ImportEqualsDeclaration;
- name: Identifier;
- moduleReference: ModuleReference;
+ interface Classifications {
+ spans: number[];
+ endOfLineState: EndOfLineState;
}
- interface ExternalModuleReference extends Node {
- kind: SyntaxKind.ExternalModuleReference;
- expression?: Expression;
+ interface ClassifiedSpan {
+ textSpan: TextSpan;
+ classificationType: string;
}
- interface ImportDeclaration extends Statement {
- kind: SyntaxKind.ImportDeclaration;
- importClause?: ImportClause;
- moduleSpecifier: Expression;
+ interface NavigationBarItem {
+ text: string;
+ kind: string;
+ kindModifiers: string;
+ spans: TextSpan[];
+ childItems: NavigationBarItem[];
+ indent: number;
+ bolded: boolean;
+ grayed: boolean;
}
- type NamedImportBindings = NamespaceImport | NamedImports;
- interface ImportClause extends Declaration {
- kind: SyntaxKind.ImportClause;
- name?: Identifier;
- namedBindings?: NamedImportBindings;
+ interface NavigationTree {
+ text: string;
+ kind: string;
+ kindModifiers: string;
+ spans: TextSpan[];
+ childItems?: NavigationTree[];
}
- interface NamespaceImport extends Declaration {
- kind: SyntaxKind.NamespaceImport;
- name: Identifier;
+ interface TodoCommentDescriptor {
+ text: string;
+ priority: number;
}
- interface NamespaceExportDeclaration extends DeclarationStatement {
- kind: SyntaxKind.NamespaceExportDeclaration;
- name: Identifier;
- moduleReference: LiteralLikeNode;
+ interface TodoComment {
+ descriptor: TodoCommentDescriptor;
+ message: string;
+ position: number;
}
- interface ExportDeclaration extends DeclarationStatement {
- kind: SyntaxKind.ExportDeclaration;
- exportClause?: NamedExports;
- moduleSpecifier?: Expression;
+ class TextChange {
+ span: TextSpan;
+ newText: string;
}
- interface NamedImports extends Node {
- kind: SyntaxKind.NamedImports;
- elements: NodeArray;
+ interface FileTextChanges {
+ fileName: string;
+ textChanges: TextChange[];
}
- interface NamedExports extends Node {
- kind: SyntaxKind.NamedExports;
- elements: NodeArray;
+ interface CodeAction {
+ description: string;
+ changes: FileTextChanges[];
}
- type NamedImportsOrExports = NamedImports | NamedExports;
- interface ImportSpecifier extends Declaration {
- kind: SyntaxKind.ImportSpecifier;
- propertyName?: Identifier;
- name: Identifier;
+ interface TextInsertion {
+ newText: string;
+ caretOffset: number;
}
- interface ExportSpecifier extends Declaration {
- kind: SyntaxKind.ExportSpecifier;
- propertyName?: Identifier;
- name: Identifier;
+ interface RenameLocation {
+ textSpan: TextSpan;
+ fileName: string;
}
- type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier;
- interface ExportAssignment extends DeclarationStatement {
- kind: SyntaxKind.ExportAssignment;
- isExportEquals?: boolean;
- expression: Expression;
+ interface ReferenceEntry {
+ textSpan: TextSpan;
+ fileName: string;
+ isWriteAccess: boolean;
+ isDefinition: boolean;
}
- interface FileReference extends TextRange {
+ interface ImplementationLocation {
+ textSpan: TextSpan;
fileName: string;
}
- interface CommentRange extends TextRange {
- hasTrailingNewLine?: boolean;
- kind: SyntaxKind;
+ interface DocumentHighlights {
+ fileName: string;
+ highlightSpans: HighlightSpan[];
}
- interface JSDocTypeExpression extends Node {
- kind: SyntaxKind.JSDocTypeExpression;
- type: JSDocType;
+ namespace HighlightSpanKind {
+ const none = "none";
+ const definition = "definition";
+ const reference = "reference";
+ const writtenReference = "writtenReference";
}
- interface JSDocType extends TypeNode {
- _jsDocTypeBrand: any;
+ interface HighlightSpan {
+ fileName?: string;
+ textSpan: TextSpan;
+ kind: string;
}
- interface JSDocAllType extends JSDocType {
- kind: SyntaxKind.JSDocAllType;
+ interface NavigateToItem {
+ name: string;
+ kind: string;
+ kindModifiers: string;
+ matchKind: string;
+ isCaseSensitive: boolean;
+ fileName: string;
+ textSpan: TextSpan;
+ containerName: string;
+ containerKind: string;
}
- interface JSDocUnknownType extends JSDocType {
- kind: SyntaxKind.JSDocUnknownType;
+ enum IndentStyle {
+ None = 0,
+ Block = 1,
+ Smart = 2,
}
- interface JSDocArrayType extends JSDocType {
- kind: SyntaxKind.JSDocArrayType;
- elementType: JSDocType;
+ interface EditorOptions {
+ BaseIndentSize?: number;
+ IndentSize: number;
+ TabSize: number;
+ NewLineCharacter: string;
+ ConvertTabsToSpaces: boolean;
+ IndentStyle: IndentStyle;
}
- interface JSDocUnionType extends JSDocType {
- kind: SyntaxKind.JSDocUnionType;
- types: NodeArray;
+ interface EditorSettings {
+ baseIndentSize?: number;
+ indentSize?: number;
+ tabSize?: number;
+ newLineCharacter?: string;
+ convertTabsToSpaces?: boolean;
+ indentStyle?: IndentStyle;
}
- interface JSDocTupleType extends JSDocType {
- kind: SyntaxKind.JSDocTupleType;
- types: NodeArray;
+ interface FormatCodeOptions extends EditorOptions {
+ InsertSpaceAfterCommaDelimiter: boolean;
+ InsertSpaceAfterSemicolonInForStatements: boolean;
+ InsertSpaceBeforeAndAfterBinaryOperators: boolean;
+ InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
+ InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
+ InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
+ InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
+ InsertSpaceAfterTypeAssertion?: boolean;
+ PlaceOpenBraceOnNewLineForFunctions: boolean;
+ PlaceOpenBraceOnNewLineForControlBlocks: boolean;
}
- interface JSDocNonNullableType extends JSDocType {
- kind: SyntaxKind.JSDocNonNullableType;
- type: JSDocType;
- }
- interface JSDocNullableType extends JSDocType {
- kind: SyntaxKind.JSDocNullableType;
- type: JSDocType;
- }
- interface JSDocRecordType extends JSDocType {
- kind: SyntaxKind.JSDocRecordType;
- literal: TypeLiteralNode;
- }
- interface JSDocTypeReference extends JSDocType {
- kind: SyntaxKind.JSDocTypeReference;
- name: EntityName;
- typeArguments: NodeArray;
- }
- interface JSDocOptionalType extends JSDocType {
- kind: SyntaxKind.JSDocOptionalType;
- type: JSDocType;
- }
- interface JSDocFunctionType extends JSDocType, SignatureDeclaration {
- kind: SyntaxKind.JSDocFunctionType;
- parameters: NodeArray;
- type: JSDocType;
+ interface FormatCodeSettings extends EditorSettings {
+ insertSpaceAfterCommaDelimiter?: boolean;
+ insertSpaceAfterSemicolonInForStatements?: boolean;
+ insertSpaceBeforeAndAfterBinaryOperators?: boolean;
+ insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
+ insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
+ insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
+ insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
+ insertSpaceAfterTypeAssertion?: boolean;
+ placeOpenBraceOnNewLineForFunctions?: boolean;
+ placeOpenBraceOnNewLineForControlBlocks?: boolean;
}
- interface JSDocVariadicType extends JSDocType {
- kind: SyntaxKind.JSDocVariadicType;
- type: JSDocType;
+ interface DefinitionInfo {
+ fileName: string;
+ textSpan: TextSpan;
+ kind: string;
+ name: string;
+ containerKind: string;
+ containerName: string;
}
- interface JSDocConstructorType extends JSDocType {
- kind: SyntaxKind.JSDocConstructorType;
- type: JSDocType;
+ interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
+ displayParts: SymbolDisplayPart[];
}
- interface JSDocThisType extends JSDocType {
- kind: SyntaxKind.JSDocThisType;
- type: JSDocType;
+ interface ReferencedSymbol {
+ definition: ReferencedSymbolDefinitionInfo;
+ references: ReferenceEntry[];
}
- interface JSDocLiteralType extends JSDocType {
- kind: SyntaxKind.JSDocLiteralType;
- literal: LiteralTypeNode;
+ enum SymbolDisplayPartKind {
+ aliasName = 0,
+ className = 1,
+ enumName = 2,
+ fieldName = 3,
+ interfaceName = 4,
+ keyword = 5,
+ lineBreak = 6,
+ numericLiteral = 7,
+ stringLiteral = 8,
+ localName = 9,
+ methodName = 10,
+ moduleName = 11,
+ operator = 12,
+ parameterName = 13,
+ propertyName = 14,
+ punctuation = 15,
+ space = 16,
+ text = 17,
+ typeParameterName = 18,
+ enumMemberName = 19,
+ functionName = 20,
+ regularExpressionLiteral = 21,
}
- type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
- interface JSDocRecordMember extends PropertySignature {
- kind: SyntaxKind.JSDocRecordMember;
- name: Identifier | LiteralExpression;
- type?: JSDocType;
+ interface SymbolDisplayPart {
+ text: string;
+ kind: string;
}
- interface JSDoc extends Node {
- kind: SyntaxKind.JSDocComment;
- tags: NodeArray | undefined;
- comment: string | undefined;
+ interface QuickInfo {
+ kind: string;
+ kindModifiers: string;
+ textSpan: TextSpan;
+ displayParts: SymbolDisplayPart[];
+ documentation: SymbolDisplayPart[];
}
- interface JSDocTag extends Node {
- atToken: AtToken;
- tagName: Identifier;
- comment: string | undefined;
+ interface RenameInfo {
+ canRename: boolean;
+ localizedErrorMessage: string;
+ displayName: string;
+ fullDisplayName: string;
+ kind: string;
+ kindModifiers: string;
+ triggerSpan: TextSpan;
}
- interface JSDocUnknownTag extends JSDocTag {
- kind: SyntaxKind.JSDocTag;
+ interface SignatureHelpParameter {
+ name: string;
+ documentation: SymbolDisplayPart[];
+ displayParts: SymbolDisplayPart[];
+ isOptional: boolean;
}
- interface JSDocTemplateTag extends JSDocTag {
- kind: SyntaxKind.JSDocTemplateTag;
- typeParameters: NodeArray;
+ interface SignatureHelpItem {
+ isVariadic: boolean;
+ prefixDisplayParts: SymbolDisplayPart[];
+ suffixDisplayParts: SymbolDisplayPart[];
+ separatorDisplayParts: SymbolDisplayPart[];
+ parameters: SignatureHelpParameter[];
+ documentation: SymbolDisplayPart[];
}
- interface JSDocReturnTag extends JSDocTag {
- kind: SyntaxKind.JSDocReturnTag;
- typeExpression: JSDocTypeExpression;
+ interface SignatureHelpItems {
+ items: SignatureHelpItem[];
+ applicableSpan: TextSpan;
+ selectedItemIndex: number;
+ argumentIndex: number;
+ argumentCount: number;
}
- interface JSDocTypeTag extends JSDocTag {
- kind: SyntaxKind.JSDocTypeTag;
- typeExpression: JSDocTypeExpression;
+ interface CompletionInfo {
+ isGlobalCompletion: boolean;
+ isMemberCompletion: boolean;
+ isNewIdentifierLocation: boolean;
+ entries: CompletionEntry[];
}
- interface JSDocTypedefTag extends JSDocTag, Declaration {
- kind: SyntaxKind.JSDocTypedefTag;
- name?: Identifier;
- typeExpression?: JSDocTypeExpression;
- jsDocTypeLiteral?: JSDocTypeLiteral;
+ interface CompletionEntry {
+ name: string;
+ kind: string;
+ kindModifiers: string;
+ sortText: string;
+ replacementSpan?: TextSpan;
}
- interface JSDocPropertyTag extends JSDocTag, TypeElement {
- kind: SyntaxKind.JSDocPropertyTag;
- name: Identifier;
- typeExpression: JSDocTypeExpression;
+ interface CompletionEntryDetails {
+ name: string;
+ kind: string;
+ kindModifiers: string;
+ displayParts: SymbolDisplayPart[];
+ documentation: SymbolDisplayPart[];
}
- interface JSDocTypeLiteral extends JSDocType {
- kind: SyntaxKind.JSDocTypeLiteral;
- jsDocPropertyTags?: NodeArray;
- jsDocTypeTag?: JSDocTypeTag;
+ interface OutliningSpan {
+ textSpan: TextSpan;
+ hintSpan: TextSpan;
+ bannerText: string;
+ autoCollapse: boolean;
}
- interface JSDocParameterTag extends JSDocTag {
- kind: SyntaxKind.JSDocParameterTag;
- preParameterName?: Identifier;
- typeExpression?: JSDocTypeExpression;
- postParameterName?: Identifier;
- parameterName: Identifier;
- isBracketed: boolean;
+ interface EmitOutput {
+ outputFiles: OutputFile[];
+ emitSkipped: boolean;
}
- const enum FlowFlags {
- Unreachable = 1,
- Start = 2,
- BranchLabel = 4,
- LoopLabel = 8,
- Assignment = 16,
- TrueCondition = 32,
- FalseCondition = 64,
- SwitchClause = 128,
- Referenced = 256,
- Shared = 512,
- Label = 12,
- Condition = 96,
+ const enum OutputFileType {
+ JavaScript = 0,
+ SourceMap = 1,
+ Declaration = 2,
}
- interface FlowNode {
- flags: FlowFlags;
- id?: number;
+ interface OutputFile {
+ name: string;
+ writeByteOrderMark: boolean;
+ text: string;
}
- interface FlowStart extends FlowNode {
- container?: FunctionExpression | ArrowFunction | MethodDeclaration;
+ const enum EndOfLineState {
+ None = 0,
+ InMultiLineCommentTrivia = 1,
+ InSingleQuoteStringLiteral = 2,
+ InDoubleQuoteStringLiteral = 3,
+ InTemplateHeadOrNoSubstitutionTemplate = 4,
+ InTemplateMiddleOrTail = 5,
+ InTemplateSubstitutionPosition = 6,
}
- interface FlowLabel extends FlowNode {
- antecedents: FlowNode[];
+ enum TokenClass {
+ Punctuation = 0,
+ Keyword = 1,
+ Operator = 2,
+ Comment = 3,
+ Whitespace = 4,
+ Identifier = 5,
+ NumberLiteral = 6,
+ StringLiteral = 7,
+ RegExpLiteral = 8,
}
- interface FlowAssignment extends FlowNode {
- node: Expression | VariableDeclaration | BindingElement;
- antecedent: FlowNode;
+ interface ClassificationResult {
+ finalLexState: EndOfLineState;
+ entries: ClassificationInfo[];
}
- interface FlowCondition extends FlowNode {
- expression: Expression;
- antecedent: FlowNode;
+ interface ClassificationInfo {
+ length: number;
+ classification: TokenClass;
}
- interface FlowSwitchClause extends FlowNode {
- switchStatement: SwitchStatement;
- clauseStart: number;
- clauseEnd: number;
- antecedent: FlowNode;
+ interface Classifier {
+ getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
+ getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
}
- type FlowType = Type | IncompleteType;
- interface IncompleteType {
- flags: TypeFlags;
- type: Type;
- }
- interface AmdDependency {
- path: string;
- name: string;
- }
- interface SourceFile extends Declaration {
- kind: SyntaxKind.SourceFile;
- statements: NodeArray;
- endOfFileToken: Token;
- fileName: string;
- path: Path;
- text: string;
- amdDependencies: AmdDependency[];
- moduleName: string;
- referencedFiles: FileReference[];
- typeReferenceDirectives: FileReference[];
- languageVariant: LanguageVariant;
- isDeclarationFile: boolean;
- renamedDependencies?: Map;
- hasNoDefaultLib: boolean;
- languageVersion: ScriptTarget;
- scriptKind: ScriptKind;
- externalModuleIndicator: Node;
- commonJsModuleIndicator: Node;
- identifiers: Map;
- nodeCount: number;
- identifierCount: number;
- symbolCount: number;
- parseDiagnostics: Diagnostic[];
- bindDiagnostics: Diagnostic[];
- lineMap: number[];
- classifiableNames?: Map;
- resolvedModules: Map;
- resolvedTypeReferenceDirectiveNames: Map;
- imports: LiteralExpression[];
- moduleAugmentations: LiteralExpression[];
- patternAmbientModules?: PatternAmbientModule[];
- externalHelpersModuleName?: Identifier;
+ namespace ScriptElementKind {
+ const unknown = "";
+ const warning = "warning";
+ const keyword = "keyword";
+ const scriptElement = "script";
+ const moduleElement = "module";
+ const classElement = "class";
+ const localClassElement = "local class";
+ const interfaceElement = "interface";
+ const typeElement = "type";
+ const enumElement = "enum";
+ const enumMemberElement = "const";
+ const variableElement = "var";
+ const localVariableElement = "local var";
+ const functionElement = "function";
+ const localFunctionElement = "local function";
+ const memberFunctionElement = "method";
+ const memberGetAccessorElement = "getter";
+ const memberSetAccessorElement = "setter";
+ const memberVariableElement = "property";
+ const constructorImplementationElement = "constructor";
+ const callSignatureElement = "call";
+ const indexSignatureElement = "index";
+ const constructSignatureElement = "construct";
+ const parameterElement = "parameter";
+ const typeParameterElement = "type parameter";
+ const primitiveType = "primitive type";
+ const label = "label";
+ const alias = "alias";
+ const constElement = "const";
+ const letElement = "let";
+ const directory = "directory";
+ const externalModuleName = "external module name";
}
- interface ScriptReferenceHost {
- getCompilerOptions(): CompilerOptions;
- getSourceFile(fileName: string): SourceFile;
- getSourceFileByPath(path: Path): SourceFile;
- getCurrentDirectory(): string;
+ namespace ScriptElementKindModifier {
+ const none = "";
+ const publicMemberModifier = "public";
+ const privateMemberModifier = "private";
+ const protectedMemberModifier = "protected";
+ const exportedModifier = "export";
+ const ambientModifier = "declare";
+ const staticModifier = "static";
+ const abstractModifier = "abstract";
}
- interface ParseConfigHost {
- useCaseSensitiveFileNames: boolean;
- readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[];
- fileExists(path: string): boolean;
- readFile(path: string): string;
+ class ClassificationTypeNames {
+ static comment: string;
+ static identifier: string;
+ static keyword: string;
+ static numericLiteral: string;
+ static operator: string;
+ static stringLiteral: string;
+ static whiteSpace: string;
+ static text: string;
+ static punctuation: string;
+ static className: string;
+ static enumName: string;
+ static interfaceName: string;
+ static moduleName: string;
+ static typeParameterName: string;
+ static typeAliasName: string;
+ static parameterName: string;
+ static docCommentTagName: string;
+ static jsxOpenTagName: string;
+ static jsxCloseTagName: string;
+ static jsxSelfClosingTagName: string;
+ static jsxAttribute: string;
+ static jsxText: string;
+ static jsxAttributeStringLiteralValue: string;
}
- interface WriteFileCallback {
- (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void;
+ const enum ClassificationType {
+ comment = 1,
+ identifier = 2,
+ keyword = 3,
+ numericLiteral = 4,
+ operator = 5,
+ stringLiteral = 6,
+ regularExpressionLiteral = 7,
+ whiteSpace = 8,
+ text = 9,
+ punctuation = 10,
+ className = 11,
+ enumName = 12,
+ interfaceName = 13,
+ moduleName = 14,
+ typeParameterName = 15,
+ typeAliasName = 16,
+ parameterName = 17,
+ docCommentTagName = 18,
+ jsxOpenTagName = 19,
+ jsxCloseTagName = 20,
+ jsxSelfClosingTagName = 21,
+ jsxAttribute = 22,
+ jsxText = 23,
+ jsxAttributeStringLiteralValue = 24,
}
- class OperationCanceledException {
+}
+declare namespace ts {
+ function createClassifier(): Classifier;
+}
+declare namespace ts {
+ interface DocumentRegistry {
+ acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
+ acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
+ updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
+ updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
+ getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey;
+ releaseDocument(fileName: string, compilationSettings: CompilerOptions): void;
+ releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void;
+ reportStats(): string;
}
- interface CancellationToken {
- isCancellationRequested(): boolean;
- throwIfCancellationRequested(): void;
+ type DocumentRegistryBucketKey = string & {
+ __bucketKey: any;
+ };
+ function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
+}
+declare namespace ts {
+ function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
+}
+declare namespace ts {
+ interface TranspileOptions {
+ compilerOptions?: CompilerOptions;
+ fileName?: string;
+ reportDiagnostics?: boolean;
+ moduleName?: string;
+ renamedDependencies?: MapLike;
}
- interface Program extends ScriptReferenceHost {
- getRootFileNames(): string[];
- getSourceFiles(): SourceFile[];
- emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean): EmitResult;
- getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[];
- getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[];
- getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
- getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
- getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
- getTypeChecker(): TypeChecker;
- getCommonSourceDirectory(): string;
- getDiagnosticsProducingTypeChecker(): TypeChecker;
- dropDiagnosticsProducingTypeChecker(): void;
- getClassifiableNames(): Map;
- getNodeCount(): number;
- getIdentifierCount(): number;
- getSymbolCount(): number;
- getTypeCount(): number;
- getFileProcessingDiagnostics(): DiagnosticCollection;
- getResolvedTypeReferenceDirectives(): Map;
- structureIsReused?: boolean;
+ interface TranspileOutput {
+ outputText: string;
+ diagnostics?: Diagnostic[];
+ sourceMapText?: string;
}
- interface SourceMapSpan {
- emittedLine: number;
- emittedColumn: number;
- sourceLine: number;
- sourceColumn: number;
- nameIndex?: number;
- sourceIndex: number;
+ function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
+ function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
+}
+declare namespace ts {
+ const servicesVersion = "0.5";
+ interface DisplayPartsSymbolWriter extends SymbolWriter {
+ displayParts(): SymbolDisplayPart[];
}
- interface SourceMapData {
- sourceMapFilePath: string;
- jsSourceMappingURL: string;
- sourceMapFile: string;
- sourceMapSourceRoot: string;
- sourceMapSources: string[];
- sourceMapSourcesContent?: string[];
- inputSourceFileNames: string[];
- sourceMapNames?: string[];
- sourceMapMappings: string;
- sourceMapDecodedMappings: SourceMapSpan[];
+ function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;
+ function displayPartsToString(displayParts: SymbolDisplayPart[]): string;
+ function getDefaultCompilerOptions(): CompilerOptions;
+ function getSupportedCodeFixes(): string[];
+ function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile;
+ let disableIncrementalParsing: boolean;
+ function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
+ function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
+ function getDefaultLibFilePath(options: CompilerOptions): string;
+}
+declare namespace ts.server {
+ enum LogLevel {
+ terse = 0,
+ normal = 1,
+ requestTime = 2,
+ verbose = 3,
}
- enum ExitStatus {
- Success = 0,
- DiagnosticsPresent_OutputsSkipped = 1,
- DiagnosticsPresent_OutputsGenerated = 2,
+ const emptyArray: ReadonlyArray;
+ interface Logger {
+ close(): void;
+ hasLevel(level: LogLevel): boolean;
+ loggingEnabled(): boolean;
+ perftrc(s: string): void;
+ info(s: string): void;
+ startGroup(): void;
+ endGroup(): void;
+ msg(s: string, type?: Msg.Types): void;
+ getLogFileName(): string;
}
- interface EmitResult {
- emitSkipped: boolean;
- diagnostics: Diagnostic[];
- emittedFiles: string[];
- sourceMaps: SourceMapData[];
+ namespace Msg {
+ type Err = "Err";
+ const Err: Err;
+ type Info = "Info";
+ const Info: Info;
+ type Perf = "Perf";
+ const Perf: Perf;
+ type Types = Err | Info | Perf;
}
- interface TypeCheckerHost {
- getCompilerOptions(): CompilerOptions;
- getSourceFiles(): SourceFile[];
- getSourceFile(fileName: string): SourceFile;
- getResolvedTypeReferenceDirectives(): Map;
+ function createInstallTypingsRequest(project: Project, typingOptions: TypingOptions, cachePath?: string): DiscoverTypings;
+ namespace Errors {
+ function ThrowNoProject(): never;
+ function ThrowProjectLanguageServiceDisabled(): never;
+ function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never;
}
- interface TypeChecker {
- getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
- getDeclaredTypeOfSymbol(symbol: Symbol): Type;
- getPropertiesOfType(type: Type): Symbol[];
- getPropertyOfType(type: Type, propertyName: string): Symbol;
- getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
- getIndexTypeOfType(type: Type, kind: IndexKind): Type;
- getBaseTypes(type: InterfaceType): ObjectType[];
- getReturnTypeOfSignature(signature: Signature): Type;
- getNonNullableType(type: Type): Type;
- getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
- getSymbolAtLocation(node: Node): Symbol;
- getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
- getShorthandAssignmentValueSymbol(location: Node): Symbol;
- getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
- getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol;
- getTypeAtLocation(node: Node): Type;
- typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
- symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
- getSymbolDisplayBuilder(): SymbolDisplayBuilder;
- getFullyQualifiedName(symbol: Symbol): string;
- getAugmentedPropertiesOfType(type: Type): Symbol[];
- getRootSymbols(symbol: Symbol): Symbol[];
- getContextualType(node: Expression): Type;
- getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature;
- getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature;
- isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
- isUndefinedSymbol(symbol: Symbol): boolean;
- isArgumentsSymbol(symbol: Symbol): boolean;
- isUnknownSymbol(symbol: Symbol): boolean;
- getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
- isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
- getAliasedSymbol(symbol: Symbol): Symbol;
- getExportsOfModule(moduleSymbol: Symbol): Symbol[];
- getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type;
- getJsxIntrinsicTagNames(): Symbol[];
- isOptionalParameter(node: ParameterDeclaration): boolean;
- getAmbientModules(): Symbol[];
- getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
- getGlobalDiagnostics(): Diagnostic[];
- getEmitResolver(sourceFile?: SourceFile, cancellationToken?: CancellationToken): EmitResolver;
- getNodeCount(): number;
- getIdentifierCount(): number;
- getSymbolCount(): number;
- getTypeCount(): number;
+ function getDefaultFormatCodeSettings(host: ServerHost): FormatCodeSettings;
+ function mergeMaps(target: MapLike, source: MapLike): void;
+ function removeItemFromSet(items: T[], itemToRemove: T): void;
+ type NormalizedPath = string & {
+ __normalizedPathTag: any;
+ };
+ function toNormalizedPath(fileName: string): NormalizedPath;
+ function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path;
+ function asNormalizedPath(fileName: string): NormalizedPath;
+ interface NormalizedPathMap {
+ get(path: NormalizedPath): T;
+ set(path: NormalizedPath, value: T): void;
+ contains(path: NormalizedPath): boolean;
+ remove(path: NormalizedPath): void;
}
- interface SymbolDisplayBuilder {
- buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
- buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
- buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void;
- buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
- buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
- buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
- buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
- buildDisplayForParametersAndDelimiters(thisParameter: Symbol, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
- buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
- buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
+ function createNormalizedPathMap(): NormalizedPathMap;
+ const nullLanguageService: LanguageService;
+ interface ServerLanguageServiceHost {
+ setCompilationSettings(options: CompilerOptions): void;
+ notifyFileRemoved(info: ScriptInfo): void;
}
- interface SymbolWriter {
- writeKeyword(text: string): void;
- writeOperator(text: string): void;
- writePunctuation(text: string): void;
- writeSpace(text: string): void;
- writeStringLiteral(text: string): void;
- writeParameter(text: string): void;
- writeSymbol(text: string, symbol: Symbol): void;
- writeLine(): void;
- increaseIndent(): void;
- decreaseIndent(): void;
- clear(): void;
- trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
- reportInaccessibleThisError(): void;
+ const nullLanguageServiceHost: ServerLanguageServiceHost;
+ interface ProjectOptions {
+ configHasFilesProperty?: boolean;
+ files?: string[];
+ wildcardDirectories?: Map;
+ compilerOptions?: CompilerOptions;
+ typingOptions?: TypingOptions;
+ compileOnSave?: boolean;
}
- const enum TypeFormatFlags {
- None = 0,
- WriteArrayAsGenericType = 1,
- UseTypeOfFunction = 2,
- NoTruncation = 4,
- WriteArrowStyleSignature = 8,
- WriteOwnNameForAnyLike = 16,
- WriteTypeArgumentsOfSignature = 32,
- InElementType = 64,
- UseFullyQualifiedType = 128,
- InFirstTypeArgument = 256,
- InTypeAlias = 512,
- UseTypeAliasValue = 1024,
+ function isInferredProjectName(name: string): boolean;
+ function makeInferredProjectName(counter: number): string;
+ class ThrottledOperations {
+ private readonly host;
+ private pendingTimeouts;
+ constructor(host: ServerHost);
+ schedule(operationId: string, delay: number, cb: () => void): void;
+ private static run(self, operationId, cb);
}
- const enum SymbolFormatFlags {
- None = 0,
- WriteTypeParametersOrArguments = 1,
- UseOnlyExternalAliasing = 2,
+ class GcTimer {
+ private readonly host;
+ private readonly delay;
+ private readonly logger;
+ private timerId;
+ constructor(host: ServerHost, delay: number, logger: Logger);
+ scheduleCollect(): void;
+ private static run(self);
}
- const enum SymbolAccessibility {
- Accessible = 0,
- NotAccessible = 1,
- CannotBeNamed = 2,
+}
+declare namespace ts.server.protocol {
+ namespace CommandTypes {
+ type Brace = "brace";
+ type BraceCompletion = "braceCompletion";
+ type Change = "change";
+ type Close = "close";
+ type Completions = "completions";
+ type CompletionDetails = "completionEntryDetails";
+ type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
+ type CompileOnSaveEmitFile = "compileOnSaveEmitFile";
+ type Configure = "configure";
+ type Definition = "definition";
+ type Implementation = "implementation";
+ type Exit = "exit";
+ type Format = "format";
+ type Formatonkey = "formatonkey";
+ type Geterr = "geterr";
+ type GeterrForProject = "geterrForProject";
+ type SemanticDiagnosticsSync = "semanticDiagnosticsSync";
+ type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
+ type NavBar = "navbar";
+ type Navto = "navto";
+ type NavTree = "navtree";
+ type NavTreeFull = "navtree-full";
+ type Occurrences = "occurrences";
+ type DocumentHighlights = "documentHighlights";
+ type Open = "open";
+ type Quickinfo = "quickinfo";
+ type References = "references";
+ type Reload = "reload";
+ type Rename = "rename";
+ type Saveto = "saveto";
+ type SignatureHelp = "signatureHelp";
+ type TypeDefinition = "typeDefinition";
+ type ProjectInfo = "projectInfo";
+ type ReloadProjects = "reloadProjects";
+ type Unknown = "unknown";
+ type OpenExternalProject = "openExternalProject";
+ type OpenExternalProjects = "openExternalProjects";
+ type CloseExternalProject = "closeExternalProject";
+ type TodoComments = "todoComments";
+ type Indentation = "indentation";
+ type DocCommentTemplate = "docCommentTemplate";
+ type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
+ type GetCodeFixes = "getCodeFixes";
+ type GetSupportedCodeFixes = "getSupportedCodeFixes";
}
- const enum TypePredicateKind {
- This = 0,
- Identifier = 1,
+ interface Message {
+ seq: number;
+ type: "request" | "response" | "event";
}
- interface TypePredicateBase {
- kind: TypePredicateKind;
- type: Type;
+ interface Request extends Message {
+ command: string;
+ arguments?: any;
}
- interface ThisTypePredicate extends TypePredicateBase {
- kind: TypePredicateKind.This;
+ interface ReloadProjectsRequest extends Message {
+ command: CommandTypes.ReloadProjects;
}
- interface IdentifierTypePredicate extends TypePredicateBase {
- kind: TypePredicateKind.Identifier;
- parameterName: string;
- parameterIndex: number;
+ interface Event extends Message {
+ event: string;
+ body?: any;
}
- type TypePredicate = IdentifierTypePredicate | ThisTypePredicate;
- type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
- interface SymbolVisibilityResult {
- accessibility: SymbolAccessibility;
- aliasesToMakeVisible?: AnyImportSyntax[];
- errorSymbolName?: string;
- errorNode?: Node;
+ interface Response extends Message {
+ request_seq: number;
+ success: boolean;
+ command: string;
+ message?: string;
+ body?: any;
}
- interface SymbolAccessibilityResult extends SymbolVisibilityResult {
- errorModuleName?: string;
+ interface FileRequestArgs {
+ file: string;
+ projectFileName?: string;
}
- enum TypeReferenceSerializationKind {
- Unknown = 0,
- TypeWithConstructSignatureAndValue = 1,
- VoidNullableOrNeverType = 2,
- NumberLikeType = 3,
- StringLikeType = 4,
- BooleanType = 5,
- ArrayLikeType = 6,
- ESSymbolType = 7,
- Promise = 8,
- TypeWithCallSignature = 9,
- ObjectType = 10,
- }
- interface EmitResolver {
- hasGlobalName(name: string): boolean;
- getReferencedExportContainer(node: Identifier, prefixLocals?: boolean): SourceFile | ModuleDeclaration | EnumDeclaration;
- getReferencedImportDeclaration(node: Identifier): Declaration;
- getReferencedDeclarationWithCollidingName(node: Identifier): Declaration;
- isDeclarationWithCollidingName(node: Declaration): boolean;
- isValueAliasDeclaration(node: Node): boolean;
- isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
- isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
- getNodeCheckFlags(node: Node): NodeCheckFlags;
- isDeclarationVisible(node: Declaration): boolean;
- collectLinkedAliases(node: Identifier): Node[];
- isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
- writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
- writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
- writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
- writeBaseConstructorTypeOfClass(node: ClassLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
- isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, shouldComputeAliasToMarkVisible: boolean): SymbolAccessibilityResult;
- isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult;
- getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
- getReferencedValueDeclaration(reference: Identifier): Declaration;
- getTypeReferenceSerializationKind(typeName: EntityName, location?: Node): TypeReferenceSerializationKind;
- isOptionalParameter(node: ParameterDeclaration): boolean;
- moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean;
- isArgumentsLocalBinding(node: Identifier): boolean;
- getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile;
- getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): string[];
- getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[];
- isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean;
- writeLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration, writer: SymbolWriter): void;
+ interface DocCommentTemplateRequest extends FileLocationRequest {
+ command: CommandTypes.DocCommentTemplate;
}
- const enum SymbolFlags {
- None = 0,
- FunctionScopedVariable = 1,
- BlockScopedVariable = 2,
- Property = 4,
- EnumMember = 8,
- Function = 16,
- Class = 32,
- Interface = 64,
- ConstEnum = 128,
- RegularEnum = 256,
- ValueModule = 512,
- NamespaceModule = 1024,
- TypeLiteral = 2048,
- ObjectLiteral = 4096,
- Method = 8192,
- Constructor = 16384,
- GetAccessor = 32768,
- SetAccessor = 65536,
- Signature = 131072,
- TypeParameter = 262144,
- TypeAlias = 524288,
- ExportValue = 1048576,
- ExportType = 2097152,
- ExportNamespace = 4194304,
- Alias = 8388608,
- Instantiated = 16777216,
- Merged = 33554432,
- Transient = 67108864,
- Prototype = 134217728,
- SyntheticProperty = 268435456,
- Optional = 536870912,
- ExportStar = 1073741824,
- Enum = 384,
- Variable = 3,
- Value = 107455,
- Type = 793064,
- Namespace = 1920,
- Module = 1536,
- Accessor = 98304,
- FunctionScopedVariableExcludes = 107454,
- BlockScopedVariableExcludes = 107455,
- ParameterExcludes = 107455,
- PropertyExcludes = 0,
- EnumMemberExcludes = 900095,
- FunctionExcludes = 106927,
- ClassExcludes = 899519,
- InterfaceExcludes = 792968,
- RegularEnumExcludes = 899327,
- ConstEnumExcludes = 899967,
- ValueModuleExcludes = 106639,
- NamespaceModuleExcludes = 0,
- MethodExcludes = 99263,
- GetAccessorExcludes = 41919,
- SetAccessorExcludes = 74687,
- TypeParameterExcludes = 530920,
- TypeAliasExcludes = 793064,
- AliasExcludes = 8388608,
- ModuleMember = 8914931,
- ExportHasLocal = 944,
- HasExports = 1952,
- HasMembers = 6240,
- BlockScoped = 418,
- PropertyOrAccessor = 98308,
- Export = 7340032,
- ClassMember = 106500,
- Classifiable = 788448,
- }
- interface Symbol {
- flags: SymbolFlags;
- name: string;
- declarations?: Declaration[];
- valueDeclaration?: Declaration;
- members?: SymbolTable;
- exports?: SymbolTable;
- globalExports?: SymbolTable;
- isReadonly?: boolean;
- id?: number;
- mergeId?: number;
- parent?: Symbol;
- exportSymbol?: Symbol;
- constEnumOnlyModule?: boolean;
- isReferenced?: boolean;
- isReplaceableByMethod?: boolean;
- isAssigned?: boolean;
- }
- interface SymbolLinks {
- target?: Symbol;
- type?: Type;
- declaredType?: Type;
- typeParameters?: TypeParameter[];
- inferredClassType?: Type;
- instantiations?: Map;
- mapper?: TypeMapper;
- referenced?: boolean;
- containingType?: UnionOrIntersectionType;
- hasNonUniformType?: boolean;
- isPartial?: boolean;
- isDiscriminantProperty?: boolean;
- resolvedExports?: SymbolTable;
- exportsChecked?: boolean;
- isDeclarationWithCollidingName?: boolean;
- bindingElement?: BindingElement;
- exportsSomeValue?: boolean;
- }
- interface TransientSymbol extends Symbol, SymbolLinks {
- }
- type SymbolTable = Map;
- interface Pattern {
- prefix: string;
- suffix: string;
- }
- interface PatternAmbientModule {
- pattern: Pattern;
- symbol: Symbol;
- }
- const enum NodeCheckFlags {
- TypeChecked = 1,
- LexicalThis = 2,
- CaptureThis = 4,
- SuperInstance = 256,
- SuperStatic = 512,
- ContextChecked = 1024,
- AsyncMethodWithSuper = 2048,
- AsyncMethodWithSuperBinding = 4096,
- CaptureArguments = 8192,
- EnumValuesComputed = 16384,
- LexicalModuleMergesWithClass = 32768,
- LoopWithCapturedBlockScopedBinding = 65536,
- CapturedBlockScopedBinding = 131072,
- BlockScopedBindingInLoop = 262144,
- ClassWithBodyScopedClassBinding = 524288,
- BodyScopedClassBinding = 1048576,
- NeedsLoopOutParameter = 2097152,
- AssignmentsMarked = 4194304,
- ClassWithConstructorReference = 8388608,
- ConstructorReferenceInClass = 16777216,
- }
- interface NodeLinks {
- flags?: NodeCheckFlags;
- resolvedType?: Type;
- resolvedSignature?: Signature;
- resolvedSymbol?: Symbol;
- resolvedIndexInfo?: IndexInfo;
- enumMemberValue?: number;
- isVisible?: boolean;
- hasReportedStatementInAmbientContext?: boolean;
- jsxFlags?: JsxFlags;
- resolvedJsxType?: Type;
- hasSuperCall?: boolean;
- superCall?: ExpressionStatement;
- switchTypes?: Type[];
- }
- const enum TypeFlags {
- Any = 1,
- String = 2,
- Number = 4,
- Boolean = 8,
- Enum = 16,
- StringLiteral = 32,
- NumberLiteral = 64,
- BooleanLiteral = 128,
- EnumLiteral = 256,
- ESSymbol = 512,
- Void = 1024,
- Undefined = 2048,
- Null = 4096,
- Never = 8192,
- TypeParameter = 16384,
- Class = 32768,
- Interface = 65536,
- Reference = 131072,
- Tuple = 262144,
- Union = 524288,
- Intersection = 1048576,
- Anonymous = 2097152,
- Instantiated = 4194304,
- ObjectLiteral = 8388608,
- FreshLiteral = 16777216,
- ContainsWideningType = 33554432,
- ContainsObjectLiteral = 67108864,
- ContainsAnyFunctionType = 134217728,
- Nullable = 6144,
- Literal = 480,
- StringOrNumberLiteral = 96,
- DefinitelyFalsy = 7392,
- PossiblyFalsy = 7406,
- Intrinsic = 16015,
- Primitive = 8190,
- StringLike = 34,
- NumberLike = 340,
- BooleanLike = 136,
- EnumLike = 272,
- ObjectType = 2588672,
- UnionOrIntersection = 1572864,
- StructuredType = 4161536,
- StructuredOrTypeParameter = 4177920,
- Narrowable = 4178943,
- NotUnionOrUnit = 2589185,
- RequiresWidening = 100663296,
- PropagatingFlags = 234881024,
- }
- type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
- interface Type {
- flags: TypeFlags;
- id: number;
- symbol?: Symbol;
- pattern?: DestructuringPattern;
- aliasSymbol?: Symbol;
- aliasTypeArguments?: Type[];
- }
- interface IntrinsicType extends Type {
- intrinsicName: string;
- }
- interface LiteralType extends Type {
- text: string;
- freshType?: LiteralType;
- regularType?: LiteralType;
- }
- interface EnumType extends Type {
- memberTypes: Map;
- }
- interface EnumLiteralType extends LiteralType {
- baseType: EnumType & UnionType;
- }
- interface ObjectType extends Type {
- isObjectLiteralPatternWithComputedProperties?: boolean;
- }
- interface InterfaceType extends ObjectType {
- typeParameters: TypeParameter[];
- outerTypeParameters: TypeParameter[];
- localTypeParameters: TypeParameter[];
- thisType: TypeParameter;
- resolvedBaseConstructorType?: Type;
- resolvedBaseTypes: ObjectType[];
- }
- interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
- declaredProperties: Symbol[];
- declaredCallSignatures: Signature[];
- declaredConstructSignatures: Signature[];
- declaredStringIndexInfo: IndexInfo;
- declaredNumberIndexInfo: IndexInfo;
- }
- interface TypeReference extends ObjectType {
- target: GenericType;
- typeArguments: Type[];
- }
- interface GenericType extends InterfaceType, TypeReference {
- instantiations: Map;
- }
- interface UnionOrIntersectionType extends Type {
- types: Type[];
- resolvedProperties: SymbolTable;
- couldContainTypeParameters: boolean;
- }
- interface UnionType extends UnionOrIntersectionType {
- }
- interface IntersectionType extends UnionOrIntersectionType {
- }
- interface AnonymousType extends ObjectType {
- target?: AnonymousType;
- mapper?: TypeMapper;
- }
- interface ResolvedType extends ObjectType, UnionOrIntersectionType {
- members: SymbolTable;
- properties: Symbol[];
- callSignatures: Signature[];
- constructSignatures: Signature[];
- stringIndexInfo?: IndexInfo;
- numberIndexInfo?: IndexInfo;
- }
- interface FreshObjectLiteralType extends ResolvedType {
- regularType: ResolvedType;
- }
- interface IterableOrIteratorType extends ObjectType, UnionType {
- iterableElementType?: Type;
- iteratorElementType?: Type;
- }
- interface TypeParameter extends Type {
- constraint: Type;
- target?: TypeParameter;
- mapper?: TypeMapper;
- resolvedApparentType: Type;
- isThisType?: boolean;
- }
- const enum SignatureKind {
- Call = 0,
- Construct = 1,
+ interface DocCommandTemplateResponse extends Response {
+ body?: TextInsertion;
}
- interface Signature {
- declaration: SignatureDeclaration;
- typeParameters: TypeParameter[];
- parameters: Symbol[];
- thisParameter?: Symbol;
- resolvedReturnType: Type;
- minArgumentCount: number;
- hasRestParameter: boolean;
- hasLiteralTypes: boolean;
- target?: Signature;
- mapper?: TypeMapper;
- unionSignatures?: Signature[];
- erasedSignatureCache?: Signature;
- isolatedSignatureType?: ObjectType;
- typePredicate?: TypePredicate;
+ interface TodoCommentRequest extends FileRequest {
+ command: CommandTypes.TodoComments;
+ arguments: TodoCommentRequestArgs;
}
- const enum IndexKind {
- String = 0,
- Number = 1,
+ interface TodoCommentRequestArgs extends FileRequestArgs {
+ descriptors: TodoCommentDescriptor[];
}
- interface IndexInfo {
- type: Type;
- isReadonly: boolean;
- declaration?: SignatureDeclaration;
+ interface TodoCommentsResponse extends Response {
+ body?: TodoComment[];
}
- interface TypeMapper {
- (t: TypeParameter): Type;
- mappedTypes?: Type[];
- targetTypes?: Type[];
- instantiations?: Type[];
- context?: InferenceContext;
- }
- interface TypeInferences {
- primary: Type[];
- secondary: Type[];
- topLevel: boolean;
- isFixed: boolean;
- }
- interface InferenceContext {
- signature: Signature;
- inferUnionTypes: boolean;
- inferences: TypeInferences[];
- inferredTypes: Type[];
- mapper?: TypeMapper;
- failedTypeParameterIndex?: number;
- }
- const enum SpecialPropertyAssignmentKind {
- None = 0,
- ExportsProperty = 1,
- ModuleExports = 2,
- PrototypeProperty = 3,
- ThisProperty = 4,
+ interface IndentationRequest extends FileLocationRequest {
+ command: CommandTypes.Indentation;
+ arguments: IndentationRequestArgs;
}
- interface DiagnosticMessage {
- key: string;
- category: DiagnosticCategory;
- code: number;
- message: string;
+ interface IndentationResponse extends Response {
+ body?: IndentationResult;
}
- interface DiagnosticMessageChain {
- messageText: string;
- category: DiagnosticCategory;
- code: number;
- next?: DiagnosticMessageChain;
+ interface IndentationResult {
+ position: number;
+ indentation: number;
}
- interface Diagnostic {
- file: SourceFile;
- start: number;
- length: number;
- messageText: string | DiagnosticMessageChain;
- category: DiagnosticCategory;
- code: number;
+ interface IndentationRequestArgs extends FileLocationRequestArgs {
+ options?: EditorSettings;
}
- enum DiagnosticCategory {
- Warning = 0,
- Error = 1,
- Message = 2,
+ interface ProjectInfoRequestArgs extends FileRequestArgs {
+ needFileNameList: boolean;
}
- enum ModuleResolutionKind {
- Classic = 1,
- NodeJs = 2,
+ interface ProjectInfoRequest extends Request {
+ command: CommandTypes.ProjectInfo;
+ arguments: ProjectInfoRequestArgs;
}
- type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike;
- interface CompilerOptions {
- allowJs?: boolean;
- allowNonTsExtensions?: boolean;
- allowSyntheticDefaultImports?: boolean;
- allowUnreachableCode?: boolean;
- allowUnusedLabels?: boolean;
- alwaysStrict?: boolean;
- baseUrl?: string;
- charset?: string;
- configFilePath?: string;
- declaration?: boolean;
- declarationDir?: string;
- diagnostics?: boolean;
- extendedDiagnostics?: boolean;
- disableSizeLimit?: boolean;
- emitBOM?: boolean;
- emitDecoratorMetadata?: boolean;
- experimentalDecorators?: boolean;
- forceConsistentCasingInFileNames?: boolean;
- help?: boolean;
- importHelpers?: boolean;
- init?: boolean;
- inlineSourceMap?: boolean;
- inlineSources?: boolean;
- isolatedModules?: boolean;
- jsx?: JsxEmit;
- lib?: string[];
- listEmittedFiles?: boolean;
- listFiles?: boolean;
- locale?: string;
- mapRoot?: string;
- maxNodeModuleJsDepth?: number;
- module?: ModuleKind;
- moduleResolution?: ModuleResolutionKind;
- newLine?: NewLineKind;
- noEmit?: boolean;
- noEmitHelpers?: boolean;
- noEmitOnError?: boolean;
- noErrorTruncation?: boolean;
- noFallthroughCasesInSwitch?: boolean;
- noImplicitAny?: boolean;
- noImplicitReturns?: boolean;
- noImplicitThis?: boolean;
- noUnusedLocals?: boolean;
- noUnusedParameters?: boolean;
- noImplicitUseStrict?: boolean;
- noLib?: boolean;
- noResolve?: boolean;
- out?: string;
- outDir?: string;
- outFile?: string;
- paths?: MapLike;
- preserveConstEnums?: boolean;
- project?: string;
- pretty?: DiagnosticStyle;
- reactNamespace?: string;
- removeComments?: boolean;
- rootDir?: string;
- rootDirs?: string[];
- skipLibCheck?: boolean;
- skipDefaultLibCheck?: boolean;
- sourceMap?: boolean;
- sourceRoot?: string;
- strictNullChecks?: boolean;
- stripInternal?: boolean;
- suppressExcessPropertyErrors?: boolean;
- suppressImplicitAnyIndexErrors?: boolean;
- suppressOutputPathCheck?: boolean;
- target?: ScriptTarget;
- traceResolution?: boolean;
- types?: string[];
- typeRoots?: string[];
- version?: boolean;
- watch?: boolean;
- [option: string]: CompilerOptionsValue | undefined;
+ interface CompilerOptionsDiagnosticsRequest extends Request {
+ arguments: CompilerOptionsDiagnosticsRequestArgs;
}
- interface TypingOptions {
- enableAutoDiscovery?: boolean;
- include?: string[];
- exclude?: string[];
- [option: string]: string[] | boolean | undefined;
+ interface CompilerOptionsDiagnosticsRequestArgs {
+ projectFileName: string;
}
- interface DiscoverTypingsInfo {
- fileNames: string[];
- projectRootPath: string;
- safeListPath: string;
- packageNameToTypingLocation: Map;
- typingOptions: TypingOptions;
- compilerOptions: CompilerOptions;
- }
- enum ModuleKind {
- None = 0,
- CommonJS = 1,
- AMD = 2,
- UMD = 3,
- System = 4,
- ES6 = 5,
- ES2015 = 5,
- }
- const enum JsxEmit {
- None = 0,
- Preserve = 1,
- React = 2,
- }
- const enum NewLineKind {
- CarriageReturnLineFeed = 0,
- LineFeed = 1,
- }
- interface LineAndCharacter {
- line: number;
- character: number;
- }
- const enum ScriptKind {
- Unknown = 0,
- JS = 1,
- JSX = 2,
- TS = 3,
- TSX = 4,
- }
- const enum ScriptTarget {
- ES3 = 0,
- ES5 = 1,
- ES6 = 2,
- ES2015 = 2,
- Latest = 2,
- }
- const enum LanguageVariant {
- Standard = 0,
- JSX = 1,
- }
- const enum DiagnosticStyle {
- Simple = 0,
- Pretty = 1,
- }
- interface ParsedCommandLine {
- options: CompilerOptions;
- typingOptions?: TypingOptions;
- fileNames: string[];
- raw?: any;
- errors: Diagnostic[];
- wildcardDirectories?: MapLike;
- compileOnSave?: boolean;
- }
- const enum WatchDirectoryFlags {
- None = 0,
- Recursive = 1,
- }
- interface ExpandResult {
- fileNames: string[];
- wildcardDirectories: MapLike;
- }
- interface CommandLineOptionBase {
- name: string;
- type: "string" | "number" | "boolean" | "object" | "list" | Map;
- isFilePath?: boolean;
- shortName?: string;
- description?: DiagnosticMessage;
- paramType?: DiagnosticMessage;
- experimental?: boolean;
- isTSConfigOnly?: boolean;
- }
- interface CommandLineOptionOfPrimitiveType extends CommandLineOptionBase {
- type: "string" | "number" | "boolean";
- }
- interface CommandLineOptionOfCustomType extends CommandLineOptionBase {
- type: Map;
- }
- interface TsConfigOnlyOption extends CommandLineOptionBase {
- type: "object";
- }
- interface CommandLineOptionOfListType extends CommandLineOptionBase {
- type: "list";
- element: CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType;
- }
- type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType | TsConfigOnlyOption | CommandLineOptionOfListType;
- const enum CharacterCodes {
- nullCharacter = 0,
- maxAsciiCharacter = 127,
- lineFeed = 10,
- carriageReturn = 13,
- lineSeparator = 8232,
- paragraphSeparator = 8233,
- nextLine = 133,
- space = 32,
- nonBreakingSpace = 160,
- enQuad = 8192,
- emQuad = 8193,
- enSpace = 8194,
- emSpace = 8195,
- threePerEmSpace = 8196,
- fourPerEmSpace = 8197,
- sixPerEmSpace = 8198,
- figureSpace = 8199,
- punctuationSpace = 8200,
- thinSpace = 8201,
- hairSpace = 8202,
- zeroWidthSpace = 8203,
- narrowNoBreakSpace = 8239,
- ideographicSpace = 12288,
- mathematicalSpace = 8287,
- ogham = 5760,
- _ = 95,
- $ = 36,
- _0 = 48,
- _1 = 49,
- _2 = 50,
- _3 = 51,
- _4 = 52,
- _5 = 53,
- _6 = 54,
- _7 = 55,
- _8 = 56,
- _9 = 57,
- a = 97,
- b = 98,
- c = 99,
- d = 100,
- e = 101,
- f = 102,
- g = 103,
- h = 104,
- i = 105,
- j = 106,
- k = 107,
- l = 108,
- m = 109,
- n = 110,
- o = 111,
- p = 112,
- q = 113,
- r = 114,
- s = 115,
- t = 116,
- u = 117,
- v = 118,
- w = 119,
- x = 120,
- y = 121,
- z = 122,
- A = 65,
- B = 66,
- C = 67,
- D = 68,
- E = 69,
- F = 70,
- G = 71,
- H = 72,
- I = 73,
- J = 74,
- K = 75,
- L = 76,
- M = 77,
- N = 78,
- O = 79,
- P = 80,
- Q = 81,
- R = 82,
- S = 83,
- T = 84,
- U = 85,
- V = 86,
- W = 87,
- X = 88,
- Y = 89,
- Z = 90,
- ampersand = 38,
- asterisk = 42,
- at = 64,
- backslash = 92,
- backtick = 96,
- bar = 124,
- caret = 94,
- closeBrace = 125,
- closeBracket = 93,
- closeParen = 41,
- colon = 58,
- comma = 44,
- dot = 46,
- doubleQuote = 34,
- equals = 61,
- exclamation = 33,
- greaterThan = 62,
- hash = 35,
- lessThan = 60,
- minus = 45,
- openBrace = 123,
- openBracket = 91,
- openParen = 40,
- percent = 37,
- plus = 43,
- question = 63,
- semicolon = 59,
- singleQuote = 39,
- slash = 47,
- tilde = 126,
- backspace = 8,
- formFeed = 12,
- byteOrderMark = 65279,
- tab = 9,
- verticalTab = 11,
- }
- interface ModuleResolutionHost {
- fileExists(fileName: string): boolean;
- readFile(fileName: string): string;
- trace?(s: string): void;
- directoryExists?(directoryName: string): boolean;
- realpath?(path: string): string;
- getCurrentDirectory?(): string;
- getDirectories?(path: string): string[];
- }
- interface ResolvedModule {
- resolvedFileName: string;
- isExternalLibraryImport?: boolean;
- }
- interface ResolvedModuleWithFailedLookupLocations {
- resolvedModule: ResolvedModule;
- failedLookupLocations: string[];
- }
- interface ResolvedTypeReferenceDirective {
- primary: boolean;
- resolvedFileName?: string;
- }
- interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations {
- resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective;
- failedLookupLocations: string[];
- }
- interface CompilerHost extends ModuleResolutionHost {
- getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
- getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
- getCancellationToken?(): CancellationToken;
- getDefaultLibFileName(options: CompilerOptions): string;
- getDefaultLibLocation?(): string;
- writeFile: WriteFileCallback;
- getCurrentDirectory(): string;
- getDirectories(path: string): string[];
- getCanonicalFileName(fileName: string): string;
- useCaseSensitiveFileNames(): boolean;
- getNewLine(): string;
- resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[];
- getEnvironmentVariable?(name: string): string;
- }
- const enum TransformFlags {
- None = 0,
- TypeScript = 1,
- ContainsTypeScript = 2,
- Jsx = 4,
- ContainsJsx = 8,
- ES7 = 16,
- ContainsES7 = 32,
- ES6 = 64,
- ContainsES6 = 128,
- DestructuringAssignment = 256,
- Generator = 512,
- ContainsGenerator = 1024,
- ContainsDecorators = 2048,
- ContainsPropertyInitializer = 4096,
- ContainsLexicalThis = 8192,
- ContainsCapturedLexicalThis = 16384,
- ContainsLexicalThisInComputedPropertyName = 32768,
- ContainsDefaultValueAssignments = 65536,
- ContainsParameterPropertyAssignments = 131072,
- ContainsSpreadElementExpression = 262144,
- ContainsComputedPropertyName = 524288,
- ContainsBlockScopedBinding = 1048576,
- ContainsBindingPattern = 2097152,
- ContainsYield = 4194304,
- ContainsHoistedDeclarationOrCompletion = 8388608,
- HasComputedFlags = 536870912,
- AssertTypeScript = 3,
- AssertJsx = 12,
- AssertES7 = 48,
- AssertES6 = 192,
- AssertGenerator = 1536,
- NodeExcludes = 536871765,
- ArrowFunctionExcludes = 550710101,
- FunctionExcludes = 550726485,
- ConstructorExcludes = 550593365,
- MethodOrAccessorExcludes = 550593365,
- ClassExcludes = 537590613,
- ModuleExcludes = 546335573,
- TypeExcludes = -3,
- ObjectLiteralExcludes = 537430869,
- ArrayLiteralOrCallOrNewExcludes = 537133909,
- VariableDeclarationListExcludes = 538968917,
- ParameterExcludes = 538968917,
- TypeScriptClassSyntaxMask = 137216,
- ES6FunctionSyntaxMask = 81920,
- }
- interface EmitNode {
- flags?: EmitFlags;
- commentRange?: TextRange;
- sourceMapRange?: TextRange;
- tokenSourceMapRanges?: Map;
- annotatedNodes?: Node[];
- constantValue?: number;
- }
- const enum EmitFlags {
- EmitEmitHelpers = 1,
- EmitExportStar = 2,
- EmitSuperHelper = 4,
- EmitAdvancedSuperHelper = 8,
- UMDDefine = 16,
- SingleLine = 32,
- AdviseOnEmitNode = 64,
- NoSubstitution = 128,
- CapturesThis = 256,
- NoLeadingSourceMap = 512,
- NoTrailingSourceMap = 1024,
- NoSourceMap = 1536,
- NoNestedSourceMaps = 2048,
- NoTokenLeadingSourceMaps = 4096,
- NoTokenTrailingSourceMaps = 8192,
- NoTokenSourceMaps = 12288,
- NoLeadingComments = 16384,
- NoTrailingComments = 32768,
- NoComments = 49152,
- NoNestedComments = 65536,
- ExportName = 131072,
- LocalName = 262144,
- Indented = 524288,
- NoIndentation = 1048576,
- AsyncFunctionBody = 2097152,
- ReuseTempVariableScope = 4194304,
- CustomPrologue = 8388608,
- }
- const enum EmitContext {
- SourceFile = 0,
- Expression = 1,
- IdentifierName = 2,
- Unspecified = 3,
- }
- interface LexicalEnvironment {
- startLexicalEnvironment(): void;
- endLexicalEnvironment(): Statement[];
- }
- interface TextSpan {
- start: number;
- length: number;
- }
- interface TextChangeRange {
- span: TextSpan;
- newLength: number;
- }
- interface DiagnosticCollection {
- add(diagnostic: Diagnostic): void;
- getGlobalDiagnostics(): Diagnostic[];
- getDiagnostics(fileName?: string): Diagnostic[];
- getModificationCount(): number;
- reattachFileDiagnostics(newFile: SourceFile): void;
- }
- interface SyntaxList extends Node {
- _children: Node[];
- }
-}
-declare namespace ts {
- const timestamp: () => number;
-}
-declare namespace ts.performance {
- function mark(markName: string): void;
- function measure(measureName: string, startMarkName?: string, endMarkName?: string): void;
- function getCount(markName: string): number;
- function getDuration(measureName: string): number;
- function forEachMeasure(cb: (measureName: string, duration: number) => void): void;
- function enable(): void;
- function disable(): void;
-}
-declare namespace ts {
- const enum Ternary {
- False = 0,
- Maybe = 1,
- True = -1,
- }
- function createMap(template?: MapLike): Map;
- function createFileMap(keyMapper?: (key: string) => string): FileMap;
- function toPath(fileName: string, basePath: string, getCanonicalFileName: (path: string) => string): Path;
- const enum Comparison {
- LessThan = -1,
- EqualTo = 0,
- GreaterThan = 1,
- }
- function forEach(array: T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined;
- function every(array: T[], callback: (element: T, index: number) => boolean): boolean;
- function find(array: T[], predicate: (element: T, index: number) => boolean): T | undefined;
- function findMap(array: T[], callback: (element: T, index: number) => U | undefined): U;
- function contains(array: T[], value: T): boolean;
- function indexOf(array: T[], value: T): number;
- function indexOfAnyCharCode(text: string, charCodes: number[], start?: number): number;
- function countWhere(array: T[], predicate: (x: T, i: number) => boolean): number;
- function filter(array: T[], f: (x: T) => x is U): U[];
- function filter(array: T[], f: (x: T) => boolean): T[];
- function removeWhere(array: T[], f: (x: T) => boolean): boolean;
- function filterMutate(array: T[], f: (x: T) => boolean): void;
- function map(array: T[], f: (x: T, i: number) => U): U[];
- function flatten(array: (T | T[])[]): T[];
- function flatMap(array: T[], mapfn: (x: T, i: number) => U | U[]): U[];
- function span(array: T[], f: (x: T, i: number) => boolean): [T[], T[]];
- function spanMap