From 4a346045ce89137c76cda3436abba5603abdb686 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 17 Mar 2015 15:38:26 -0700 Subject: [PATCH 01/61] Add specialized semantic diagnostics for JavaScript files. --- .../diagnosticInformationMap.generated.ts | 15 ++ src/compiler/diagnosticMessages.json | 61 +++++++ src/services/services.ts | 154 +++++++++++++++++- 3 files changed, 229 insertions(+), 1 deletion(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 622b28d5f18..739c2ea460f 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -486,6 +486,21 @@ module ts { Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." }, + import_can_only_be_used_in_TypeScript: { code: 8002, category: DiagnosticCategory.Error, key: "'import ... =' can only be used in TypeScript." }, + export_can_only_be_used_in_TypeScript: { code: 8003, category: DiagnosticCategory.Error, key: "'export=' can only be used in TypeScript." }, + type_parameter_declarations_can_only_be_used_in_TypeScript: { code: 8004, category: DiagnosticCategory.Error, key: "'type parameter declarations' can only be used in TypeScript." }, + implements_clauses_can_only_be_used_in_TypeScript: { code: 8005, category: DiagnosticCategory.Error, key: "'implements clauses' can only be used in TypeScript." }, + interface_declarations_can_only_be_used_in_TypeScript: { code: 8006, category: DiagnosticCategory.Error, key: "'interface declarations' can only be used in TypeScript." }, + module_declarations_can_only_be_used_in_TypeScript: { code: 8007, category: DiagnosticCategory.Error, key: "'module declarations' can only be used in TypeScript." }, + type_aliases_can_only_be_used_in_TypeScript: { code: 8007, category: DiagnosticCategory.Error, key: "'type aliases' can only be used in TypeScript." }, + _0_can_only_be_used_in_TypeScript: { code: 8008, category: DiagnosticCategory.Error, key: "'{0}' can only be used in TypeScript." }, + types_can_only_be_used_in_TypeScript: { code: 8009, category: DiagnosticCategory.Error, key: "'types' can only be used in TypeScript." }, + type_arguments_can_only_be_used_in_TypeScript: { code: 8010, category: DiagnosticCategory.Error, key: "'type arguments' can only be used in TypeScript." }, + parameter_modifiers_can_only_be_used_in_TypeScript: { code: 8011, category: DiagnosticCategory.Error, key: "'parameter modifiers' can only be used in TypeScript." }, + can_only_be_used_in_TypeScript: { code: 8012, category: DiagnosticCategory.Error, key: "'?' can only be used in TypeScript." }, + property_declarations_can_only_be_used_in_TypeScript: { code: 8013, category: DiagnosticCategory.Error, key: "'property declarations' can only be used in TypeScript." }, + enum_declarations_can_only_be_used_in_TypeScript: { code: 8014, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in TypeScript." }, + type_assertion_expressions_can_only_be_used_in_TypeScript: { code: 8014, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in TypeScript." }, yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 410cce54d17..552f1b04606 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1938,6 +1938,67 @@ "category": "Error", "code": 8001 }, + "'import ... =' can only be used in TypeScript.": { + "category": "Error", + "code": 8002 + }, + "'export=' can only be used in TypeScript.": { + "category": "Error", + "code": 8003 + }, + "'type parameter declarations' can only be used in TypeScript.": { + "category": "Error", + "code": 8004 + }, + "'implements clauses' can only be used in TypeScript.": { + "category": "Error", + "code": 8005 + }, + "'interface declarations' can only be used in TypeScript.": { + "category": "Error", + "code": 8006 + }, + "'module declarations' can only be used in TypeScript.": { + "category": "Error", + "code": 8007 + }, + "'type aliases' can only be used in TypeScript.": { + "category": "Error", + "code": 8007 + }, + "'{0}' can only be used in TypeScript.": { + "category": "Error", + "code": 8008 + }, + "'types' can only be used in TypeScript.": { + "category": "Error", + "code": 8009 + }, + "'type arguments' can only be used in TypeScript.": { + "category": "Error", + "code": 8010 + }, + "'parameter modifiers' can only be used in TypeScript.": { + "category": "Error", + "code": 8011 + }, + "'?' can only be used in TypeScript.": { + "category": "Error", + "code": 8012 + }, + "'property declarations' can only be used in TypeScript.": { + "category": "Error", + "code": 8013 + }, + "'enum declarations' can only be used in TypeScript.": { + "category": "Error", + "code": 8014 + }, + "'type assertion expressions' can only be used in TypeScript.": { + "category": "Error", + "code": 8014 + }, + "'yield' expressions are not currently supported.": { "category": "Error", "code": 9000 diff --git a/src/services/services.ts b/src/services/services.ts index 1bf5f6336d4..88a56a850cb 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2370,15 +2370,25 @@ module ts { return program.getSyntacticDiagnostics(getValidSourceFile(fileName)); } + function isJavaScript(fileName: string) { + return fileExtensionIs(fileName, ".tsjs"); + } + /** * getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors * If '-d' enabled, report both semantic and emitter errors */ - function getSemanticDiagnostics(fileName: string) { + function getSemanticDiagnostics(fileName: string): Diagnostic[] { synchronizeHostData(); let targetSourceFile = getValidSourceFile(fileName); + // For JavaScript files, we don't want to report the normal typescript semantic errors. + // Instead, we just report errors for using TypeScript + if (isJavaScript(fileName)) { + return getJavaScriptSemanticDiagnostics(targetSourceFile); + } + // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. // Therefore only get diagnostics for given file. @@ -2392,6 +2402,148 @@ module ts { return semanticDiagnostics.concat(declarationDiagnostics); } + function getJavaScriptSemanticDiagnostics(sourceFile: SourceFile): Diagnostic[] { + let diagnostics: Diagnostic[] = []; + walk(sourceFile); + + return diagnostics; + + function walk(node: Node) { + if (!node) { + return; + } + + switch (node.kind) { + case SyntaxKind.ImportEqualsDeclaration: + diagnostics.push(createDiagnosticForNode(node, Diagnostics.import_can_only_be_used_in_TypeScript)); + return; + case SyntaxKind.ExportAssignment: + diagnostics.push(createDiagnosticForNode(node, Diagnostics.export_can_only_be_used_in_TypeScript)); + return; + case SyntaxKind.TypeParameter: + diagnostics.push(createDiagnosticForNode(node, Diagnostics.type_parameter_declarations_can_only_be_used_in_TypeScript)); + return; + case SyntaxKind.ClassDeclaration: + let classDeclaration = node; + if (checkModifiers(classDeclaration.modifiers)) { + return; + } + break; + case SyntaxKind.HeritageClause: + let heritageClause = node; + if (heritageClause.token === SyntaxKind.ImplementsKeyword) { + diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_TypeScript)); + return; + } + break; + case SyntaxKind.InterfaceDeclaration: + diagnostics.push(createDiagnosticForNode(node, Diagnostics.interface_declarations_can_only_be_used_in_TypeScript)); + return; + case SyntaxKind.ModuleDeclaration: + diagnostics.push(createDiagnosticForNode(node, Diagnostics.module_declarations_can_only_be_used_in_TypeScript)); + return; + case SyntaxKind.TypeAliasDeclaration: + diagnostics.push(createDiagnosticForNode(node, Diagnostics.type_aliases_can_only_be_used_in_TypeScript)); + return; + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + case SyntaxKind.Constructor: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.FunctionExpression: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ArrowFunction: + case SyntaxKind.FunctionDeclaration: + let functionDeclaration = node; + if (checkModifiers(functionDeclaration.modifiers) || + checkTypeAnnotation(functionDeclaration.type)) { + return; + } + break; + case SyntaxKind.VariableStatement: + let variableStatement = node; + if (checkModifiers(variableStatement.modifiers)) { + return; + } + break; + case SyntaxKind.VariableDeclaration: + let variableDeclaration = node; + if (checkTypeAnnotation(variableDeclaration.type)) { + return; + } + break; + case SyntaxKind.CallExpression: + case SyntaxKind.NewExpression: + let expression = node; + if (expression.typeArguments && expression.typeArguments.length > 0) { + diagnostics.push(createFileDiagnostic(sourceFile, expression.typeArguments.pos, expression.typeArguments.end, + Diagnostics.type_arguments_can_only_be_used_in_TypeScript)); + return; + } + break; + case SyntaxKind.Parameter: + let parameter = node; + if (parameter.modifiers) { + diagnostics.push(createFileDiagnostic(sourceFile, parameter.modifiers.pos, parameter.modifiers.end, + Diagnostics.parameter_modifiers_can_only_be_used_in_TypeScript)); + return; + } + if (parameter.questionToken) { + diagnostics.push(createDiagnosticForNode(parameter.questionToken, Diagnostics.can_only_be_used_in_TypeScript)); + return; + } + if (parameter.type) { + diagnostics.push(createDiagnosticForNode(parameter.type, Diagnostics.types_can_only_be_used_in_TypeScript)); + return; + } + break; + case SyntaxKind.PropertyDeclaration: + diagnostics.push(createDiagnosticForNode(node, Diagnostics.property_declarations_can_only_be_used_in_TypeScript)); + return + case SyntaxKind.EnumDeclaration: + diagnostics.push(createDiagnosticForNode(node, Diagnostics.enum_declarations_can_only_be_used_in_TypeScript)); + return; + case SyntaxKind.TypeAssertionExpression: + diagnostics.push(createDiagnosticForNode(node, Diagnostics.type_assertion_expressions_can_only_be_used_in_TypeScript)); + return; + } + + forEachChild(node, walk); + } + + function checkTypeAnnotation(type: TypeNode): boolean { + if (type) { + diagnostics.push(createDiagnosticForNode(type, Diagnostics.types_can_only_be_used_in_TypeScript)); + return true; + } + + return false; + } + + function checkModifiers(modifiers: ModifiersArray): boolean { + if (modifiers) { + for (let modifier of modifiers) { + switch (modifier.kind) { + case SyntaxKind.PublicKeyword: + case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: + case SyntaxKind.DeclareKeyword: + diagnostics.push(createDiagnosticForNode(modifier, Diagnostics._0_can_only_be_used_in_TypeScript, tokenToString(modifier.kind))); + return true; + + // These are all legal modifiers. + case SyntaxKind.StaticKeyword: + case SyntaxKind.ExportKeyword: + case SyntaxKind.ConstKeyword: + case SyntaxKind.DefaultKeyword: + } + } + } + + return false; + } + } + function getCompilerOptionsDiagnostics() { synchronizeHostData(); return program.getGlobalDiagnostics(); From e650e8a6d408b0d9ad3e6ec98dbd78831c8ba4b6 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 17 Mar 2015 16:27:56 -0700 Subject: [PATCH 02/61] Add tests for javascript semantic dianostics. --- src/harness/fourslash.ts | 17 ++++++++++- src/services/services.ts | 22 ++++++++++---- src/services/shims.ts | 29 +++++++++++-------- tests/cases/fourslash/fourslash.ts | 4 +++ .../getJavaScriptSemanticDiagnostics1.ts | 15 ++++++++++ .../getJavaScriptSemanticDiagnostics2.ts | 15 ++++++++++ .../getJavaScriptSemanticDiagnostics3.ts | 15 ++++++++++ 7 files changed, 98 insertions(+), 19 deletions(-) create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 95a320ac052..44927a7a49a 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -14,6 +14,7 @@ // /// +/// /// /// /// @@ -126,12 +127,13 @@ module FourSlash { outDir: 'outDir', sourceMap: 'sourceMap', sourceRoot: 'sourceRoot', + allowNonTsExtensions: 'allowNonTsExtensions', resolveReference: 'ResolveReference', // This flag is used to specify entry file for resolve file references. The flag is only allow once per test file }; // List of allowed metadata names var fileMetadataNames = [testOptMetadataNames.fileName, testOptMetadataNames.emitThisFile, testOptMetadataNames.resolveReference]; - var globalMetadataNames = [testOptMetadataNames.baselineFile, testOptMetadataNames.declaration, + var globalMetadataNames = [testOptMetadataNames.allowNonTsExtensions, testOptMetadataNames.baselineFile, testOptMetadataNames.declaration, testOptMetadataNames.mapRoot, testOptMetadataNames.module, testOptMetadataNames.out, testOptMetadataNames.outDir, testOptMetadataNames.sourceMap, testOptMetadataNames.sourceRoot] @@ -141,6 +143,9 @@ module FourSlash { for (var prop in globalOptions) { if (globalOptions.hasOwnProperty(prop)) { switch (prop) { + case testOptMetadataNames.allowNonTsExtensions: + settings.allowNonTsExtensions = true; + break; case testOptMetadataNames.declaration: settings.declaration = true; break; @@ -788,6 +793,16 @@ module FourSlash { return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue; } + public getSemanticDiagnostics(expected: string) { + var diagnostics = this.languageService.getSemanticDiagnostics(this.activeFile.fileName); + var realized = ts.realizeDiagnostics(diagnostics, "\r\n"); + var actual = JSON.stringify(realized, null, " "); + if (actual !== expected) { + ts.sys.writeFile("c:\\temp\\out.txt", actual); + } + assert.equal(actual, expected); + } + public verifyQuickInfoString(negative: boolean, expectedText?: string, expectedDocumentation?: string) { [expectedText, expectedDocumentation].forEach(str => { if (str) { diff --git a/src/services/services.ts b/src/services/services.ts index 88a56a850cb..8715a171c8b 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2420,12 +2420,10 @@ module ts { case SyntaxKind.ExportAssignment: diagnostics.push(createDiagnosticForNode(node, Diagnostics.export_can_only_be_used_in_TypeScript)); return; - case SyntaxKind.TypeParameter: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.type_parameter_declarations_can_only_be_used_in_TypeScript)); - return; case SyntaxKind.ClassDeclaration: let classDeclaration = node; - if (checkModifiers(classDeclaration.modifiers)) { + if (checkModifiers(classDeclaration.modifiers) || + checkTypeParameters(classDeclaration.typeParameters)) { return; } break; @@ -2456,6 +2454,7 @@ module ts { case SyntaxKind.FunctionDeclaration: let functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || + checkTypeParameters(functionDeclaration.typeParameters) || checkTypeAnnotation(functionDeclaration.type)) { return; } @@ -2476,7 +2475,8 @@ module ts { case SyntaxKind.NewExpression: let expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { - diagnostics.push(createFileDiagnostic(sourceFile, expression.typeArguments.pos, expression.typeArguments.end, + let start = expression.typeArguments.pos; + diagnostics.push(createFileDiagnostic(sourceFile, start, expression.typeArguments.end - start, Diagnostics.type_arguments_can_only_be_used_in_TypeScript)); return; } @@ -2484,7 +2484,8 @@ module ts { case SyntaxKind.Parameter: let parameter = node; if (parameter.modifiers) { - diagnostics.push(createFileDiagnostic(sourceFile, parameter.modifiers.pos, parameter.modifiers.end, + let start = parameter.modifiers.pos; + diagnostics.push(createFileDiagnostic(sourceFile, start, parameter.modifiers.end - start, Diagnostics.parameter_modifiers_can_only_be_used_in_TypeScript)); return; } @@ -2511,6 +2512,15 @@ module ts { forEachChild(node, walk); } + function checkTypeParameters(typeParameters: NodeArray): boolean { + if (typeParameters) { + let start = typeParameters.pos; + diagnostics.push(createFileDiagnostic(sourceFile, start, typeParameters.end - start, Diagnostics.type_parameter_declarations_can_only_be_used_in_TypeScript)); + return true; + } + return false; + } + function checkTypeAnnotation(type: TypeNode): boolean { if (type) { diagnostics.push(createDiagnosticForNode(type, Diagnostics.types_can_only_be_used_in_TypeScript)); diff --git a/src/services/shims.ts b/src/services/shims.ts index fc47ff95280..f2082ee39cb 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -325,6 +325,22 @@ module ts { } } + /* @internal */ + export function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { message: string; start: number; length: number; category: string; } []{ + return diagnostics.map(d => realizeDiagnostic(d, newLine)); + } + + function realizeDiagnostic(diagnostic: Diagnostic, newLine: string): { message: string; start: number; length: number; category: string; } { + return { + message: flattenDiagnosticMessageText(diagnostic.messageText, newLine), + start: diagnostic.start, + length: diagnostic.length, + /// TODO: no need for the tolowerCase call + category: DiagnosticCategory[diagnostic.category].toLowerCase(), + code: diagnostic.code + }; + } + class LanguageServiceShimObject extends ShimBase implements LanguageServiceShim { private logger: Logger; @@ -385,18 +401,7 @@ module ts { private realizeDiagnostics(diagnostics: Diagnostic[]): { message: string; start: number; length: number; category: string; }[]{ var newLine = this.getNewLine(); - return diagnostics.map(d => this.realizeDiagnostic(d, newLine)); - } - - private realizeDiagnostic(diagnostic: Diagnostic, newLine: string): { message: string; start: number; length: number; category: string; } { - return { - message: flattenDiagnosticMessageText(diagnostic.messageText, newLine), - start: diagnostic.start, - length: diagnostic.length, - /// TODO: no need for the tolowerCase call - category: DiagnosticCategory[diagnostic.category].toLowerCase(), - code: diagnostic.code - }; + return ts.realizeDiagnostics(diagnostics, newLine); } public getSyntacticClassifications(fileName: string, start: number, length: number): string { diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 087c43786f0..8ade18fc200 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -439,6 +439,10 @@ module FourSlashInterface { displayParts: ts.SymbolDisplayPart[], documentation: ts.SymbolDisplayPart[]) { FourSlash.currentTestState.verifyQuickInfoDisplayParts(kind, kindModifiers, textSpan, displayParts, documentation); } + + public getSemanticDiagnostics(expected: string) { + FourSlash.currentTestState.getSemanticDiagnostics(expected); + } } export class edit { diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts new file mode 100644 index 00000000000..e73b487347a --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// import a = b; + +verify.getSemanticDiagnostics(`[ + { + "message": "'import ... =' can only be used in TypeScript.", + "start": 0, + "length": 13, + "category": "error", + "code": 8002 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts new file mode 100644 index 00000000000..e239577e5e4 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// export = b; + +verify.getSemanticDiagnostics(`[ + { + "message": "'export=' can only be used in TypeScript.", + "start": 0, + "length": 11, + "category": "error", + "code": 8003 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts new file mode 100644 index 00000000000..d74e97b36cc --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// class C; + +verify.getSemanticDiagnostics(`[ + { + "message": "'type parameter declarations' can only be used in TypeScript.", + "start": 8, + "length": 1, + "category": "error", + "code": 8004 + } +]`); \ No newline at end of file From 1eca182cebf7d54635ee1318358352970928cd21 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 17 Mar 2015 16:32:19 -0700 Subject: [PATCH 03/61] Add additional tests. --- .../getJavaScriptSemanticDiagnostics3.ts | 2 +- .../getJavaScriptSemanticDiagnostics4.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics5.ts | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts index d74e97b36cc..c27308cd27c 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts @@ -2,7 +2,7 @@ // @allowNonTsExtensions: true // @Filename: a.tsjs -//// class C; +//// class C { } verify.getSemanticDiagnostics(`[ { diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts new file mode 100644 index 00000000000..27635cb34b7 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// public class C { } + +verify.getSemanticDiagnostics(`[ + { + "message": "'public' can only be used in TypeScript.", + "start": 0, + "length": 6, + "category": "error", + "code": 8008 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts new file mode 100644 index 00000000000..9fd183b9e69 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// class C implements D { } + +verify.getSemanticDiagnostics(`[ + { + "message": "'implements clauses' can only be used in TypeScript.", + "start": 8, + "length": 12, + "category": "error", + "code": 8005 + } +]`); \ No newline at end of file From c69846555c1cc9f5fda5cfc1bbc8af10da51f888 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 17 Mar 2015 16:56:19 -0700 Subject: [PATCH 04/61] Add additional tests. --- .../diagnosticInformationMap.generated.ts | 18 +++++++++--------- src/compiler/diagnosticMessages.json | 18 +++++++++--------- src/harness/fourslash.ts | 3 --- src/services/services.ts | 6 ++++-- .../getJavaScriptSemanticDiagnostics10.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics11.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics12.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics13.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics14.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics15.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics16.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics17.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics18.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics19.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics20.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics4.ts | 2 +- .../getJavaScriptSemanticDiagnostics6.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics7.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics8.ts | 15 +++++++++++++++ .../getJavaScriptSemanticDiagnostics9.ts | 15 +++++++++++++++ 20 files changed, 248 insertions(+), 24 deletions(-) create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 739c2ea460f..9fc4248c519 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -492,15 +492,15 @@ module ts { implements_clauses_can_only_be_used_in_TypeScript: { code: 8005, category: DiagnosticCategory.Error, key: "'implements clauses' can only be used in TypeScript." }, interface_declarations_can_only_be_used_in_TypeScript: { code: 8006, category: DiagnosticCategory.Error, key: "'interface declarations' can only be used in TypeScript." }, module_declarations_can_only_be_used_in_TypeScript: { code: 8007, category: DiagnosticCategory.Error, key: "'module declarations' can only be used in TypeScript." }, - type_aliases_can_only_be_used_in_TypeScript: { code: 8007, category: DiagnosticCategory.Error, key: "'type aliases' can only be used in TypeScript." }, - _0_can_only_be_used_in_TypeScript: { code: 8008, category: DiagnosticCategory.Error, key: "'{0}' can only be used in TypeScript." }, - types_can_only_be_used_in_TypeScript: { code: 8009, category: DiagnosticCategory.Error, key: "'types' can only be used in TypeScript." }, - type_arguments_can_only_be_used_in_TypeScript: { code: 8010, category: DiagnosticCategory.Error, key: "'type arguments' can only be used in TypeScript." }, - parameter_modifiers_can_only_be_used_in_TypeScript: { code: 8011, category: DiagnosticCategory.Error, key: "'parameter modifiers' can only be used in TypeScript." }, - can_only_be_used_in_TypeScript: { code: 8012, category: DiagnosticCategory.Error, key: "'?' can only be used in TypeScript." }, - property_declarations_can_only_be_used_in_TypeScript: { code: 8013, category: DiagnosticCategory.Error, key: "'property declarations' can only be used in TypeScript." }, - enum_declarations_can_only_be_used_in_TypeScript: { code: 8014, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in TypeScript." }, - type_assertion_expressions_can_only_be_used_in_TypeScript: { code: 8014, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in TypeScript." }, + type_aliases_can_only_be_used_in_TypeScript: { code: 8008, category: DiagnosticCategory.Error, key: "'type aliases' can only be used in TypeScript." }, + _0_can_only_be_used_in_TypeScript: { code: 8009, category: DiagnosticCategory.Error, key: "'{0}' can only be used in TypeScript." }, + types_can_only_be_used_in_TypeScript: { code: 8010, category: DiagnosticCategory.Error, key: "'types' can only be used in TypeScript." }, + type_arguments_can_only_be_used_in_TypeScript: { code: 8011, category: DiagnosticCategory.Error, key: "'type arguments' can only be used in TypeScript." }, + parameter_modifiers_can_only_be_used_in_TypeScript: { code: 8012, category: DiagnosticCategory.Error, key: "'parameter modifiers' can only be used in TypeScript." }, + can_only_be_used_in_TypeScript: { code: 8013, category: DiagnosticCategory.Error, key: "'?' can only be used in TypeScript." }, + property_declarations_can_only_be_used_in_TypeScript: { code: 8014, category: DiagnosticCategory.Error, key: "'property declarations' can only be used in TypeScript." }, + enum_declarations_can_only_be_used_in_TypeScript: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in TypeScript." }, + type_assertion_expressions_can_only_be_used_in_TypeScript: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in TypeScript." }, yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 552f1b04606..379a95bc405 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1964,39 +1964,39 @@ }, "'type aliases' can only be used in TypeScript.": { "category": "Error", - "code": 8007 + "code": 8008 }, "'{0}' can only be used in TypeScript.": { "category": "Error", - "code": 8008 + "code": 8009 }, "'types' can only be used in TypeScript.": { "category": "Error", - "code": 8009 + "code": 8010 }, "'type arguments' can only be used in TypeScript.": { "category": "Error", - "code": 8010 + "code": 8011 }, "'parameter modifiers' can only be used in TypeScript.": { "category": "Error", - "code": 8011 + "code": 8012 }, "'?' can only be used in TypeScript.": { "category": "Error", - "code": 8012 + "code": 8013 }, "'property declarations' can only be used in TypeScript.": { "category": "Error", - "code": 8013 + "code": 8014 }, "'enum declarations' can only be used in TypeScript.": { "category": "Error", - "code": 8014 + "code": 8015 }, "'type assertion expressions' can only be used in TypeScript.": { "category": "Error", - "code": 8014 + "code": 8016 }, "'yield' expressions are not currently supported.": { diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 44927a7a49a..9d55fcc58b9 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -797,9 +797,6 @@ module FourSlash { var diagnostics = this.languageService.getSemanticDiagnostics(this.activeFile.fileName); var realized = ts.realizeDiagnostics(diagnostics, "\r\n"); var actual = JSON.stringify(realized, null, " "); - if (actual !== expected) { - ts.sys.writeFile("c:\\temp\\out.txt", actual); - } assert.equal(actual, expected); } diff --git a/src/services/services.ts b/src/services/services.ts index 8715a171c8b..a64358dd9fc 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2384,7 +2384,8 @@ module ts { let targetSourceFile = getValidSourceFile(fileName); // For JavaScript files, we don't want to report the normal typescript semantic errors. - // Instead, we just report errors for using TypeScript + // Instead, we just report errors for using TypeScript-only constructs from within a + // JavaScript file. if (isJavaScript(fileName)) { return getJavaScriptSemanticDiagnostics(targetSourceFile); } @@ -2505,7 +2506,8 @@ module ts { diagnostics.push(createDiagnosticForNode(node, Diagnostics.enum_declarations_can_only_be_used_in_TypeScript)); return; case SyntaxKind.TypeAssertionExpression: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.type_assertion_expressions_can_only_be_used_in_TypeScript)); + let typeAssertionExpression = node; + diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, Diagnostics.type_assertion_expressions_can_only_be_used_in_TypeScript)); return; } diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts new file mode 100644 index 00000000000..d5bf9e142d7 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// function F() { } + +verify.getSemanticDiagnostics(`[ + { + "message": "'type parameter declarations' can only be used in TypeScript.", + "start": 11, + "length": 1, + "category": "error", + "code": 8004 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts new file mode 100644 index 00000000000..060dfa4c01a --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// function F(): number { } + +verify.getSemanticDiagnostics(`[ + { + "message": "'types' can only be used in TypeScript.", + "start": 14, + "length": 6, + "category": "error", + "code": 8010 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts new file mode 100644 index 00000000000..4a73b44725d --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// declare var v; + +verify.getSemanticDiagnostics(`[ + { + "message": "'declare' can only be used in TypeScript.", + "start": 0, + "length": 7, + "category": "error", + "code": 8009 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts new file mode 100644 index 00000000000..2717e23aba9 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// var v: () => number; + +verify.getSemanticDiagnostics(`[ + { + "message": "'types' can only be used in TypeScript.", + "start": 7, + "length": 12, + "category": "error", + "code": 8010 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts new file mode 100644 index 00000000000..c67659379fc --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// Foo(); + +verify.getSemanticDiagnostics(`[ + { + "message": "'type arguments' can only be used in TypeScript.", + "start": 4, + "length": 6, + "category": "error", + "code": 8011 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts new file mode 100644 index 00000000000..756e17d9a34 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// function F(public p) { } + +verify.getSemanticDiagnostics(`[ + { + "message": "'parameter modifiers' can only be used in TypeScript.", + "start": 11, + "length": 6, + "category": "error", + "code": 8012 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts new file mode 100644 index 00000000000..1ce8f3a767d --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// function F(p?) { } + +verify.getSemanticDiagnostics(`[ + { + "message": "'?' can only be used in TypeScript.", + "start": 12, + "length": 1, + "category": "error", + "code": 8013 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts new file mode 100644 index 00000000000..fad657f9b50 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// function F(a: number) { } + +verify.getSemanticDiagnostics(`[ + { + "message": "'types' can only be used in TypeScript.", + "start": 14, + "length": 6, + "category": "error", + "code": 8010 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts new file mode 100644 index 00000000000..6c2578d6e85 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// class C { v } + +verify.getSemanticDiagnostics(`[ + { + "message": "'property declarations' can only be used in TypeScript.", + "start": 10, + "length": 1, + "category": "error", + "code": 8014 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts new file mode 100644 index 00000000000..6dc83c38327 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// enum E { } + +verify.getSemanticDiagnostics(`[ + { + "message": "'enum declarations' can only be used in TypeScript.", + "start": 5, + "length": 1, + "category": "error", + "code": 8015 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts new file mode 100644 index 00000000000..cf5f16b827a --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// var v = undefined; + +verify.getSemanticDiagnostics(`[ + { + "message": "'type assertion expressions' can only be used in TypeScript.", + "start": 9, + "length": 6, + "category": "error", + "code": 8016 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts index 27635cb34b7..8505798e230 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts @@ -10,6 +10,6 @@ verify.getSemanticDiagnostics(`[ "start": 0, "length": 6, "category": "error", - "code": 8008 + "code": 8009 } ]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts new file mode 100644 index 00000000000..09cd23ffbf6 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// interface I { } + +verify.getSemanticDiagnostics(`[ + { + "message": "'interface declarations' can only be used in TypeScript.", + "start": 10, + "length": 1, + "category": "error", + "code": 8006 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts new file mode 100644 index 00000000000..77c0b1f4e0d --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// module M { } + +verify.getSemanticDiagnostics(`[ + { + "message": "'module declarations' can only be used in TypeScript.", + "start": 7, + "length": 1, + "category": "error", + "code": 8007 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts new file mode 100644 index 00000000000..c0a27621539 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// type a = b; + +verify.getSemanticDiagnostics(`[ + { + "message": "'type aliases' can only be used in TypeScript.", + "start": 0, + "length": 11, + "category": "error", + "code": 8008 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts new file mode 100644 index 00000000000..6b7eed188fe --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.tsjs +//// public function F() { } + +verify.getSemanticDiagnostics(`[ + { + "message": "'public' can only be used in TypeScript.", + "start": 0, + "length": 6, + "category": "error", + "code": 8009 + } +]`); \ No newline at end of file From e14b745df8ba58764067e3d9822c6452e6d63588 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 18 Mar 2015 17:56:04 -0700 Subject: [PATCH 05/61] Clean up getCompletions code. --- src/services/services.ts | 44 ++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index a64358dd9fc..3fea33a40dd 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2614,7 +2614,7 @@ module ts { }; } - function getCompletionsAtPosition(fileName: string, position: number) { + function getCompletionsAtPosition(fileName: string, position: number): CompletionInfo { synchronizeHostData(); let syntacticStart = new Date().getTime(); @@ -2688,6 +2688,29 @@ module ts { let isNewIdentifierLocation: boolean; if (isRightOfDot) { + if (!tryGetMemberCompletionEntries()) { + return undefined; + } + } + else { + if (!tryGetGlobalCompletionEntries()) { + return undefined; + } + } + + // Add keywords if this is not a member completion list + if (!isMemberCompletion) { + addRange(activeCompletionSession.entries, keywordCompletions); + } + log("getCompletionsAtPosition: Semantic work: " + (new Date().getTime() - semanticStart)); + + return { + isMemberCompletion, + isNewIdentifierLocation, + entries: activeCompletionSession.entries + }; + + function tryGetMemberCompletionEntries(): boolean { // Right of dot member completion list let symbols: Symbol[] = []; isMemberCompletion = true; @@ -2722,8 +2745,10 @@ module ts { } getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + return true; } - else { + + function tryGetGlobalCompletionEntries(): boolean { let containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(previousToken); if (containingObjectLiteral) { // Object literal expression, look up possible property names from contextual type @@ -2732,7 +2757,7 @@ module ts { let contextualType = typeInfoResolver.getContextualType(containingObjectLiteral); if (!contextualType) { - return undefined; + return false; } let contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType); @@ -2766,20 +2791,9 @@ module ts { getCompletionEntriesFromSymbols(symbols, activeCompletionSession); } - } - // Add keywords if this is not a member completion list - if (!isMemberCompletion) { - Array.prototype.push.apply(activeCompletionSession.entries, keywordCompletions); + return true; } - log("getCompletionsAtPosition: Semantic work: " + (new Date().getTime() - semanticStart)); - - return { - isMemberCompletion, - isNewIdentifierLocation, - isBuilder : isNewIdentifierDefinitionLocation, // temporary property used to match VS implementation - entries: activeCompletionSession.entries - }; function getCompletionEntriesFromSymbols(symbols: Symbol[], session: CompletionSession): void { let start = new Date().getTime(); From c030b83c5dd6cfd0273817ed32349970d9fa4bbe Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 18 Mar 2015 17:59:24 -0700 Subject: [PATCH 06/61] Further simplification --- src/services/services.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 3fea33a40dd..4c5fb5ce679 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2654,10 +2654,11 @@ module ts { return undefined; } - // Find the node where completion is requested on, in the case of a completion after a dot, it is the member access expression - // other wise, it is a request for all visible symbols in the scope, and the node is the current location - let node: Node; - let isRightOfDot: boolean; + // Find the node where completion is requested on, in the case of a completion after + // a dot, it is the member access expression other wise, it is a request for all + // visible symbols in the scope, and the node is the current location. + let node = currentToken; + let isRightOfDot = false; if (previousToken && previousToken.kind === SyntaxKind.DotToken && previousToken.parent.kind === SyntaxKind.PropertyAccessExpression) { node = (previousToken.parent).expression; isRightOfDot = true; @@ -2666,10 +2667,6 @@ module ts { node = (previousToken.parent).left; isRightOfDot = true; } - else { - node = currentToken; - isRightOfDot = false; - } // Clear the current activeCompletionSession for this session activeCompletionSession = { From 1b06677decb599fc254a037c45714a7a13cf58bf Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 23 Mar 2015 14:14:19 -0700 Subject: [PATCH 07/61] Treat .js files as javascript in the LS. --- src/compiler/types.ts | 10 +-- src/services/services.ts | 87 ++++++++++++++++--- .../baselines/reference/APISample_compile.js | 10 +-- .../reference/APISample_compile.types | 10 +-- tests/baselines/reference/APISample_linter.js | 10 +-- .../reference/APISample_linter.types | 10 +-- .../reference/APISample_transform.js | 10 +-- .../reference/APISample_transform.types | 10 +-- .../baselines/reference/APISample_watcher.js | 10 +-- .../reference/APISample_watcher.types | 10 +-- .../getJavaScriptSemanticDiagnostics1.ts | 2 +- .../getJavaScriptSemanticDiagnostics10.ts | 2 +- .../getJavaScriptSemanticDiagnostics11.ts | 2 +- .../getJavaScriptSemanticDiagnostics12.ts | 2 +- .../getJavaScriptSemanticDiagnostics13.ts | 2 +- .../getJavaScriptSemanticDiagnostics14.ts | 2 +- .../getJavaScriptSemanticDiagnostics15.ts | 2 +- .../getJavaScriptSemanticDiagnostics16.ts | 2 +- .../getJavaScriptSemanticDiagnostics17.ts | 2 +- .../getJavaScriptSemanticDiagnostics18.ts | 2 +- .../getJavaScriptSemanticDiagnostics19.ts | 2 +- .../getJavaScriptSemanticDiagnostics2.ts | 2 +- .../getJavaScriptSemanticDiagnostics20.ts | 2 +- .../getJavaScriptSemanticDiagnostics3.ts | 2 +- .../getJavaScriptSemanticDiagnostics4.ts | 2 +- .../getJavaScriptSemanticDiagnostics5.ts | 2 +- .../getJavaScriptSemanticDiagnostics6.ts | 2 +- .../getJavaScriptSemanticDiagnostics7.ts | 2 +- .../getJavaScriptSemanticDiagnostics8.ts | 2 +- .../getJavaScriptSemanticDiagnostics9.ts | 2 +- 30 files changed, 138 insertions(+), 79 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 87d219c2e84..a60c0666419 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1005,14 +1005,14 @@ module ts { getSourceFiles(): SourceFile[]; /** - * Emits the javascript and declaration files. If targetSourceFile is not specified, then - * the javascript and declaration files will be produced for all the files in this program. - * If targetSourceFile is specified, then only the javascript and declaration for that + * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then + * the JavaScript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the JavaScript and declaration for that * specific file will be generated. * * If writeFile is not specified then the writeFile callback from the compiler host will be - * used for writing the javascript and declaration files. Otherwise, the writeFile parameter - * will be invoked when writing the javascript and declaration files. + * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the JavaScript and declaration files. */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; diff --git a/src/services/services.ts b/src/services/services.ts index 4c5fb5ce679..188a1bfcb03 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2371,7 +2371,7 @@ module ts { } function isJavaScript(fileName: string) { - return fileExtensionIs(fileName, ".tsjs"); + return fileExtensionIs(fileName, ".js"); } /** @@ -2562,7 +2562,7 @@ module ts { } /// Completion - function getValidCompletionEntryDisplayName(symbol: Symbol, target: ScriptTarget): string { + function getValidCompletionEntryDisplayNameForSymbol(symbol: Symbol, target: ScriptTarget): string { let displayName = symbol.getName(); if (displayName && displayName.length > 0) { let firstCharCode = displayName.charCodeAt(0); @@ -2573,7 +2573,8 @@ module ts { return undefined; } - if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && + if (displayName && displayName.length >= 2 && + firstCharCode === displayName.charCodeAt(displayName.length - 1) && (firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) { // If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an // invalid identifier name. We need to check if whatever was inside the quotes is actually a valid identifier name. @@ -2585,7 +2586,6 @@ module ts { isValid = isIdentifierPart(displayName.charCodeAt(i), target); } - if (isValid) { return unescapeIdentifier(displayName); } @@ -2594,11 +2594,29 @@ module ts { return undefined; } + function getValidCompletionEntryDisplayName(displayName: string, target: ScriptTarget): string { + let firstCharCode = displayName.charCodeAt(0); + if (displayName && displayName.length >= 2 && + firstCharCode === displayName.charCodeAt(displayName.length - 1) && + (firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) { + // If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an + // invalid identifier name. We need to check if whatever was inside the quotes is actually a valid identifier name. + displayName = displayName.substring(1, displayName.length - 1); + } + + let isValid = isIdentifierStart(displayName.charCodeAt(0), target); + for (let i = 1, n = displayName.length; isValid && i < n; i++) { + isValid = isIdentifierPart(displayName.charCodeAt(i), target); + } + + return isValid ? unescapeIdentifier(displayName) : undefined; + } + function createCompletionEntry(symbol: Symbol, typeChecker: TypeChecker, location: Node): CompletionEntry { // Try to get a valid display name for this symbol, if we could not find one, then ignore it. // We would like to only show things that can be added after a dot, so for instance numeric properties can // not be accessed with a dot (a.1 <- invalid) - let displayName = getValidCompletionEntryDisplayName(symbol, program.getCompilerOptions().target); + let displayName = getValidCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target); if (!displayName) { return undefined; } @@ -2685,11 +2703,22 @@ module ts { let isNewIdentifierLocation: boolean; if (isRightOfDot) { - if (!tryGetMemberCompletionEntries()) { - return undefined; + if (isJavaScript(fileName)) { + // If this is JavaScript, then just present a simple identifier list. + if (!tryGetJavaScriptMemberCompletionEntries()) { + return undefined; + } + } + else { + if (!tryGetTypeScriptMemberCompletionEntries()) { + return undefined; + } } } else { + // For JavaScript or TypeScript, if we're not after a dot, then just try to get the + // global symbols in scope. These results should be valid for either language as + // the set of symbols that can be referenced from this location. if (!tryGetGlobalCompletionEntries()) { return undefined; } @@ -2707,7 +2736,31 @@ module ts { entries: activeCompletionSession.entries }; - function tryGetMemberCompletionEntries(): boolean { + function tryGetJavaScriptMemberCompletionEntries(): boolean { + let allIdentifiers: Map = {}; + for (let sourceFile of program.getSourceFiles()) { + let nameTable = getNameTable(sourceFile); + for (let name in nameTable) { + allIdentifiers[name] = name; + } + } + + var target = program.getCompilerOptions().target; + for (let name in allIdentifiers) { + let displayName = getValidCompletionEntryDisplayName(name, target); + if (displayName) { + activeCompletionSession.entries.push({ + name: displayName, + kind: ScriptElementKind.unknown, + kindModifiers: "" + }); + } + } + + return true; + } + + function tryGetTypeScriptMemberCompletionEntries(): boolean { // Right of dot member completion list let symbols: Symbol[] = []; isMemberCompletion = true; @@ -2741,7 +2794,7 @@ module ts { }); } - getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + getCompletionEntriesFromSymbols(symbols); return true; } @@ -2761,7 +2814,7 @@ module ts { if (contextualTypeMembers && contextualTypeMembers.length > 0) { // Add filtered items to the completion list let filteredMembers = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); - getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession); + getCompletionEntriesFromSymbols(filteredMembers); } } else if (getAncestor(previousToken, SyntaxKind.ImportClause)) { @@ -2774,7 +2827,7 @@ module ts { Debug.assert(importDeclaration !== undefined); let exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); let filteredExports = filterModuleExports(exports, importDeclaration); - getCompletionEntriesFromSymbols(filteredExports, activeCompletionSession); + getCompletionEntriesFromSymbols(filteredExports); } } else { @@ -2786,13 +2839,14 @@ module ts { let symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias; let symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); - getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + getCompletionEntriesFromSymbols(symbols); } return true; } - function getCompletionEntriesFromSymbols(symbols: Symbol[], session: CompletionSession): void { + function getCompletionEntriesFromSymbols(symbols: Symbol[]): void { + let session = activeCompletionSession; let start = new Date().getTime(); forEach(symbols, symbol => { let entry = createCompletionEntry(symbol, session.typeChecker, location); @@ -5073,8 +5127,13 @@ module ts { function getEmitOutput(fileName: string): EmitOutput { synchronizeHostData(); - let sourceFile = getValidSourceFile(fileName); + // If the option is set to not emit on errors, and there are any errors, then we don't + // want to proceed. + if (program.getCompilerOptions().noEmitOnError && getPreEmitDiagnostics(program).length > 0) { + return { outputFiles: [], emitSkipped: true }; + } + let sourceFile = getValidSourceFile(fileName); let outputFiles: OutputFile[] = []; function writeFile(fileName: string, data: string, writeByteOrderMark: boolean) { diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 575c2bdaf36..4ea2a7a7bed 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -801,14 +801,14 @@ declare module "typescript" { interface Program extends ScriptReferenceHost { getSourceFiles(): SourceFile[]; /** - * Emits the javascript and declaration files. If targetSourceFile is not specified, then - * the javascript and declaration files will be produced for all the files in this program. - * If targetSourceFile is specified, then only the javascript and declaration for that + * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then + * the JavaScript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the JavaScript and declaration for that * specific file will be generated. * * If writeFile is not specified then the writeFile callback from the compiler host will be - * used for writing the javascript and declaration files. Otherwise, the writeFile parameter - * will be invoked when writing the javascript and declaration files. + * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the JavaScript and declaration files. */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 336d70aa1a1..d0ba1e8457b 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -2440,14 +2440,14 @@ declare module "typescript" { >SourceFile : SourceFile /** - * Emits the javascript and declaration files. If targetSourceFile is not specified, then - * the javascript and declaration files will be produced for all the files in this program. - * If targetSourceFile is specified, then only the javascript and declaration for that + * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then + * the JavaScript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the JavaScript and declaration for that * specific file will be generated. * * If writeFile is not specified then the writeFile callback from the compiler host will be - * used for writing the javascript and declaration files. Otherwise, the writeFile parameter - * will be invoked when writing the javascript and declaration files. + * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the JavaScript and declaration files. */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; >emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index e7145e24070..6e6665e3d40 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -832,14 +832,14 @@ declare module "typescript" { interface Program extends ScriptReferenceHost { getSourceFiles(): SourceFile[]; /** - * Emits the javascript and declaration files. If targetSourceFile is not specified, then - * the javascript and declaration files will be produced for all the files in this program. - * If targetSourceFile is specified, then only the javascript and declaration for that + * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then + * the JavaScript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the JavaScript and declaration for that * specific file will be generated. * * If writeFile is not specified then the writeFile callback from the compiler host will be - * used for writing the javascript and declaration files. Otherwise, the writeFile parameter - * will be invoked when writing the javascript and declaration files. + * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the JavaScript and declaration files. */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index a40848b9e4c..839e41a62f4 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -2586,14 +2586,14 @@ declare module "typescript" { >SourceFile : SourceFile /** - * Emits the javascript and declaration files. If targetSourceFile is not specified, then - * the javascript and declaration files will be produced for all the files in this program. - * If targetSourceFile is specified, then only the javascript and declaration for that + * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then + * the JavaScript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the JavaScript and declaration for that * specific file will be generated. * * If writeFile is not specified then the writeFile callback from the compiler host will be - * used for writing the javascript and declaration files. Otherwise, the writeFile parameter - * will be invoked when writing the javascript and declaration files. + * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the JavaScript and declaration files. */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; >emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index da8fe979d17..ed852980b0c 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -833,14 +833,14 @@ declare module "typescript" { interface Program extends ScriptReferenceHost { getSourceFiles(): SourceFile[]; /** - * Emits the javascript and declaration files. If targetSourceFile is not specified, then - * the javascript and declaration files will be produced for all the files in this program. - * If targetSourceFile is specified, then only the javascript and declaration for that + * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then + * the JavaScript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the JavaScript and declaration for that * specific file will be generated. * * If writeFile is not specified then the writeFile callback from the compiler host will be - * used for writing the javascript and declaration files. Otherwise, the writeFile parameter - * will be invoked when writing the javascript and declaration files. + * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the JavaScript and declaration files. */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index b694678d4cb..589af2369f7 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -2536,14 +2536,14 @@ declare module "typescript" { >SourceFile : SourceFile /** - * Emits the javascript and declaration files. If targetSourceFile is not specified, then - * the javascript and declaration files will be produced for all the files in this program. - * If targetSourceFile is specified, then only the javascript and declaration for that + * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then + * the JavaScript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the JavaScript and declaration for that * specific file will be generated. * * If writeFile is not specified then the writeFile callback from the compiler host will be - * used for writing the javascript and declaration files. Otherwise, the writeFile parameter - * will be invoked when writing the javascript and declaration files. + * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the JavaScript and declaration files. */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; >emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index f380994eba8..c0f6f52e774 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -870,14 +870,14 @@ declare module "typescript" { interface Program extends ScriptReferenceHost { getSourceFiles(): SourceFile[]; /** - * Emits the javascript and declaration files. If targetSourceFile is not specified, then - * the javascript and declaration files will be produced for all the files in this program. - * If targetSourceFile is specified, then only the javascript and declaration for that + * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then + * the JavaScript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the JavaScript and declaration for that * specific file will be generated. * * If writeFile is not specified then the writeFile callback from the compiler host will be - * used for writing the javascript and declaration files. Otherwise, the writeFile parameter - * will be invoked when writing the javascript and declaration files. + * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the JavaScript and declaration files. */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 06329de5c96..78261fffa91 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -2709,14 +2709,14 @@ declare module "typescript" { >SourceFile : SourceFile /** - * Emits the javascript and declaration files. If targetSourceFile is not specified, then - * the javascript and declaration files will be produced for all the files in this program. - * If targetSourceFile is specified, then only the javascript and declaration for that + * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then + * the JavaScript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the JavaScript and declaration for that * specific file will be generated. * * If writeFile is not specified then the writeFile callback from the compiler host will be - * used for writing the javascript and declaration files. Otherwise, the writeFile parameter - * will be invoked when writing the javascript and declaration files. + * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the JavaScript and declaration files. */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; >emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts index e73b487347a..5fbe669de30 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// import a = b; verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts index d5bf9e142d7..ecefb25d218 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// function F() { } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts index 060dfa4c01a..da468d59f3b 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// function F(): number { } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts index 4a73b44725d..89e459d2a5b 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// declare var v; verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts index 2717e23aba9..c3c0fc9ef7b 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// var v: () => number; verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts index c67659379fc..5e7c2010480 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// Foo(); verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts index 756e17d9a34..2c7d87a74e2 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// function F(public p) { } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts index 1ce8f3a767d..3bc3030e2b1 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// function F(p?) { } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts index fad657f9b50..39b67b13ea8 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// function F(a: number) { } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts index 6c2578d6e85..96dc2bce892 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// class C { v } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts index 6dc83c38327..efbe1694419 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// enum E { } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts index e239577e5e4..abf9f693b0c 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// export = b; verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts index cf5f16b827a..d0f6cef468e 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// var v = undefined; verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts index c27308cd27c..4e424281dfd 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// class C { } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts index 8505798e230..80e8873b01a 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// public class C { } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts index 9fd183b9e69..411bef8a82f 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// class C implements D { } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts index 09cd23ffbf6..f86d26ba723 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// interface I { } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts index 77c0b1f4e0d..ccd9450f49b 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// module M { } verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts index c0a27621539..11105a44197 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// type a = b; verify.getSemanticDiagnostics(`[ diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts index 6b7eed188fe..81016fd8ba7 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts @@ -1,7 +1,7 @@ /// // @allowNonTsExtensions: true -// @Filename: a.tsjs +// @Filename: a.js //// public function F() { } verify.getSemanticDiagnostics(`[ From d3e9ed1de8e56cbf8757d4b16fd3880201246075 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 24 Mar 2015 14:11:03 -0700 Subject: [PATCH 08/61] back to tsjs --- src/services/services.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/services.ts b/src/services/services.ts index cc1e5391444..0844e4b40d8 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2368,7 +2368,7 @@ module ts { } function isJavaScript(fileName: string) { - return fileExtensionIs(fileName, ".js"); + return fileExtensionIs(fileName, ".tsjs"); } /** From 273c3a92d008afbc467aa207400ee79129b4a769 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 24 Mar 2015 14:54:27 -0700 Subject: [PATCH 09/61] Back to .js --- src/services/services.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/services.ts b/src/services/services.ts index 5eb3c21e67f..6372fa3440b 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2374,7 +2374,7 @@ module ts { } function isJavaScript(fileName: string) { - return fileExtensionIs(fileName, ".tsjs"); + return fileExtensionIs(fileName, ".js"); } /** From 2de0a974bb2cc25becc4b98ce29fad6272d24be7 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 24 Mar 2015 18:24:42 -0700 Subject: [PATCH 10/61] Added tests. --- ...ionListForTransitivelyExportedMembers01.ts | 39 ++++++++++++++++++ ...ionListForTransitivelyExportedMembers02.ts | 39 ++++++++++++++++++ ...ionListForTransitivelyExportedMembers03.ts | 40 +++++++++++++++++++ ...ionListForTransitivelyExportedMembers04.ts | 37 +++++++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 tests/cases/fourslash/completionListForTransitivelyExportedMembers01.ts create mode 100644 tests/cases/fourslash/completionListForTransitivelyExportedMembers02.ts create mode 100644 tests/cases/fourslash/completionListForTransitivelyExportedMembers03.ts create mode 100644 tests/cases/fourslash/completionListForTransitivelyExportedMembers04.ts diff --git a/tests/cases/fourslash/completionListForTransitivelyExportedMembers01.ts b/tests/cases/fourslash/completionListForTransitivelyExportedMembers01.ts new file mode 100644 index 00000000000..017b04592c1 --- /dev/null +++ b/tests/cases/fourslash/completionListForTransitivelyExportedMembers01.ts @@ -0,0 +1,39 @@ +/// + +// @Filename: A.ts +////export interface I1 { one: number } +////export interface I2 { two: string } +////export type I1_OR_I2 = I1 | I2; +//// +////export class C1 { +//// one: string; +////} +//// +////export module Inner { +//// export interface I3 { +//// three: boolean +//// } +//// +//// export var varVar = 100; +//// export let letVar = 200; +//// export const constVar = 300; +////} + +// @Filename: B.ts +////export var bVar = "bee!"; + +// @Filename: C.ts +////export var cVar = "see!"; +////export * from "A"; +////export * from "B" + +// @Filename: D.ts +////import * as c from "C"; +////var x = c./**/ + +goTo.marker(); +verify.completionListContains("C1"); +verify.completionListContains("Inner"); +verify.completionListContains("bVar"); +verify.completionListContains("cVar"); +verify.not.completionListContains("__export"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListForTransitivelyExportedMembers02.ts b/tests/cases/fourslash/completionListForTransitivelyExportedMembers02.ts new file mode 100644 index 00000000000..868859746b4 --- /dev/null +++ b/tests/cases/fourslash/completionListForTransitivelyExportedMembers02.ts @@ -0,0 +1,39 @@ +/// + + +// @Filename: A.ts +////export interface I1 { one: number } +////export interface I2 { two: string } +////export type I1_OR_I2 = I1 | I2; +//// +////export class C1 { +//// one: string; +////} +//// +////export module Inner { +//// export interface I3 { +//// three: boolean +//// } +//// +//// export var varVar = 100; +//// export let letVar = 200; +//// export const constVar = 300; +////} + +// @Filename: B.ts +////export var bVar = "bee!"; + +// @Filename: C.ts +////export var cVar = "see!"; +////export * from "A"; +////export * from "B" + +// @Filename: D.ts +////import * as c from "C"; +////var x = c.Inner./**/ + +goTo.marker(); +verify.completionListContains("varVar"); +verify.completionListContains("letVar"); +verify.completionListContains("constVar"); +verify.not.completionListContains("__export"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListForTransitivelyExportedMembers03.ts b/tests/cases/fourslash/completionListForTransitivelyExportedMembers03.ts new file mode 100644 index 00000000000..78ef3ec7c72 --- /dev/null +++ b/tests/cases/fourslash/completionListForTransitivelyExportedMembers03.ts @@ -0,0 +1,40 @@ +/// + + +// @Filename: A.ts +////export interface I1 { one: number } +////export interface I2 { two: string } +////export type I1_OR_I2 = I1 | I2; +//// +////export class C1 { +//// one: string; +////} +//// +////export module Inner { +//// export interface I3 { +//// three: boolean +//// } +//// +//// export var varVar = 100; +//// export let letVar = 200; +//// export const constVar = 300; +////} + +// @Filename: B.ts +////export var bVar = "bee!"; + +// @Filename: C.ts +////export var cVar = "see!"; +////export * from "A"; +////export * from "B" + +// @Filename: D.ts +////import * as c from "C"; +////var x: c./**/ + +goTo.marker(); +verify.completionListContains("I1"); +verify.completionListContains("I2"); +verify.completionListContains("I1_OR_I2"); +verify.completionListContains("C1"); +verify.not.completionListContains("__export"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListForTransitivelyExportedMembers04.ts b/tests/cases/fourslash/completionListForTransitivelyExportedMembers04.ts new file mode 100644 index 00000000000..114e370d31d --- /dev/null +++ b/tests/cases/fourslash/completionListForTransitivelyExportedMembers04.ts @@ -0,0 +1,37 @@ +/// + + +// @Filename: A.ts +////export interface I1 { one: number } +////export interface I2 { two: string } +////export type I1_OR_I2 = I1 | I2; +//// +////export class C1 { +//// one: string; +////} +//// +////export module Inner { +//// export interface I3 { +//// three: boolean +//// } +//// +//// export var varVar = 100; +//// export let letVar = 200; +//// export const constVar = 300; +////} + +// @Filename: B.ts +////export var bVar = "bee!"; + +// @Filename: C.ts +////export var cVar = "see!"; +////export * from "A"; +////export * from "B" + +// @Filename: D.ts +////import * as c from "C"; +////var x: c.Inner./**/ + +goTo.marker(); +verify.completionListContains("I3"); +verify.not.completionListContains("__export"); \ No newline at end of file From fd3b4ca9cd8a24a1efcfc1f9bc0c4c168942433a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 24 Mar 2015 18:45:22 -0700 Subject: [PATCH 11/61] Fixed transitive export completion list issue. --- src/compiler/checker.ts | 8 ++++++-- src/compiler/types.ts | 5 +++-- src/services/services.ts | 9 ++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cc614a34692..73bf603c682 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -74,7 +74,10 @@ module ts { isImplementationOfOverload, getAliasedSymbol: resolveAlias, getEmitResolver, - getExportsOfExternalModule, + getExportsOfImportDeclaration, + getExportsOfModule(moduleSymbol: Symbol): Symbol[] { + return mapToArray(getExportsOfModule(moduleSymbol)); + } }; let unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown"); @@ -794,6 +797,7 @@ module ts { } function getExportsOfSymbol(symbol: Symbol): SymbolTable { + // TODO (drosen): Why do we not use getExportsOfModule for exteral modules as weel? return symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : symbol.exports; } @@ -2921,7 +2925,7 @@ module ts { return result; } - function getExportsOfExternalModule(node: ImportDeclaration): Symbol[]{ + function getExportsOfImportDeclaration(node: ImportDeclaration): Symbol[] { if (!node.moduleSpecifier) { return emptyArray; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e615a9d0bbd..d6edc5300d4 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -902,7 +902,7 @@ module ts { // import "mod" => importClause = undefined, moduleSpecifier = "mod" // In rest of the cases, module specifier is string literal corresponding to module // ImportClause information is shown at its declaration below. - export interface ImportDeclaration extends Statement, ModuleElement { + export interface ImportDeclaration extends ModuleElement { importClause?: ImportClause; moduleSpecifier: Expression; } @@ -1115,7 +1115,8 @@ module ts { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; - getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; + getExportsOfImportDeclaration(node: ImportDeclaration): Symbol[]; + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; // Should not be called directly. Should only be accessed through the Program instance. /* @internal */ getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; diff --git a/src/services/services.ts b/src/services/services.ts index 58fba22a71f..980c79c231f 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2533,8 +2533,10 @@ module ts { if (symbol && symbol.flags & SymbolFlags.HasExports) { // Extract module or enum members - forEachValue(symbol.exports, symbol => { - if (typeInfoResolver.isValidPropertyAccess((node.parent), symbol.name)) { + let exportedMembers = typeInfoResolver.getExportsOfModule(symbol); + forEach(exportedMembers, symbol => { + if (!(symbol.flags & SymbolFlags.ExportStar) + && typeInfoResolver.isValidPropertyAccess((node.parent), symbol.name)) { symbols.push(symbol); } }); @@ -2577,7 +2579,8 @@ module ts { if (showCompletionsInImportsClause(previousToken)) { let importDeclaration = getAncestor(previousToken, SyntaxKind.ImportDeclaration); Debug.assert(importDeclaration !== undefined); - let exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); + + let exports = typeInfoResolver.getExportsOfImportDeclaration(importDeclaration); symbols = filterModuleExports(exports, importDeclaration); } } From d1fa506db6e7454619af4266bbb401e41d7e99a1 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 25 Mar 2015 17:36:51 -0700 Subject: [PATCH 12/61] Use 'symbolsToArray' to avoid filtering. --- src/compiler/checker.ts | 4 +--- src/services/services.ts | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e2d668b8055..c1ce6869380 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -75,9 +75,7 @@ module ts { getAliasedSymbol: resolveAlias, getEmitResolver, getExportsOfImportDeclaration, - getExportsOfModule(moduleSymbol: Symbol): Symbol[] { - return mapToArray(getExportsOfModule(moduleSymbol)); - } + getExportsOfModule: moduleSymbol => symbolsToArray(getExportsOfModule(moduleSymbol)), }; let unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown"); diff --git a/src/services/services.ts b/src/services/services.ts index cd62d7fce88..6a0925460a1 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2535,10 +2535,9 @@ module ts { if (symbol && symbol.flags & SymbolFlags.HasExports) { // Extract module or enum members - let exportedMembers = typeInfoResolver.getExportsOfModule(symbol); - forEach(exportedMembers, symbol => { - if (!(symbol.flags & SymbolFlags.ExportStar) - && typeInfoResolver.isValidPropertyAccess((node.parent), symbol.name)) { + let exportedSymbols = typeInfoResolver.getExportsOfModule(symbol); + forEach(exportedSymbols, symbol => { + if (typeInfoResolver.isValidPropertyAccess((node.parent), symbol.name)) { symbols.push(symbol); } }); From 82222472b5ae75ae59574d28300970c1c32a032f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 25 Mar 2015 18:01:57 -0700 Subject: [PATCH 13/61] Subsume 'getExportsOfImportDeclaration' with 'getExportsOfModule'. --- src/compiler/checker.ts | 1 - src/compiler/types.ts | 1 - src/services/services.ts | 12 ++++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c1ce6869380..7435fd095b6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -74,7 +74,6 @@ module ts { isImplementationOfOverload, getAliasedSymbol: resolveAlias, getEmitResolver, - getExportsOfImportDeclaration, getExportsOfModule: moduleSymbol => symbolsToArray(getExportsOfModule(moduleSymbol)), }; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 609baef833e..6a2677fe720 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1127,7 +1127,6 @@ module ts { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; - getExportsOfImportDeclaration(node: ImportDeclaration): Symbol[]; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; // Should not be called directly. Should only be accessed through the Program instance. diff --git a/src/services/services.ts b/src/services/services.ts index 6a0925460a1..44c0d2d8206 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2581,8 +2581,16 @@ module ts { let importDeclaration = getAncestor(contextToken, SyntaxKind.ImportDeclaration); Debug.assert(importDeclaration !== undefined); - let exports = typeInfoResolver.getExportsOfImportDeclaration(importDeclaration); - symbols = filterModuleExports(exports, importDeclaration); + let exports: Symbol[]; + if (importDeclaration.moduleSpecifier) { + let moduleSpecifierSymbol = typeInfoResolver.getSymbolAtLocation(importDeclaration.moduleSpecifier); + if (moduleSpecifierSymbol) { + exports = typeInfoResolver.getExportsOfModule(moduleSpecifierSymbol); + } + } + + //let exports = typeInfoResolver.getExportsOfImportDeclaration(importDeclaration); + symbols = exports ? filterModuleExports(exports, importDeclaration) : emptyArray; } } else { From 77492382ea43bf7c5d53ddc85936509cbbee4d34 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 25 Mar 2015 18:08:46 -0700 Subject: [PATCH 14/61] Updated API baselines. --- tests/baselines/reference/APISample_compile.js | 4 ++-- tests/baselines/reference/APISample_compile.types | 11 +++++------ tests/baselines/reference/APISample_linter.js | 4 ++-- tests/baselines/reference/APISample_linter.types | 11 +++++------ tests/baselines/reference/APISample_transform.js | 4 ++-- tests/baselines/reference/APISample_transform.types | 11 +++++------ tests/baselines/reference/APISample_watcher.js | 4 ++-- tests/baselines/reference/APISample_watcher.types | 11 +++++------ 8 files changed, 28 insertions(+), 32 deletions(-) diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 07d5e4337a6..49159b322e8 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -746,7 +746,7 @@ declare module "typescript" { interface ExternalModuleReference extends Node { expression?: Expression; } - interface ImportDeclaration extends Statement, ModuleElement { + interface ImportDeclaration extends ModuleElement { importClause?: ImportClause; moduleSpecifier: Expression; } @@ -888,7 +888,7 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; - getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index eff47a4cb7b..86003fc494e 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -2269,9 +2269,8 @@ declare module "typescript" { >expression : Expression >Expression : Expression } - interface ImportDeclaration extends Statement, ModuleElement { + interface ImportDeclaration extends ModuleElement { >ImportDeclaration : ImportDeclaration ->Statement : Statement >ModuleElement : ModuleElement importClause?: ImportClause; @@ -2780,10 +2779,10 @@ declare module "typescript" { >Symbol : Symbol >Symbol : Symbol - getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; ->getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; +>getExportsOfModule : (moduleSymbol: Symbol) => Symbol[] +>moduleSymbol : Symbol +>Symbol : Symbol >Symbol : Symbol } interface SymbolDisplayBuilder { diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index b57acaf0e9c..f7902f85998 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -777,7 +777,7 @@ declare module "typescript" { interface ExternalModuleReference extends Node { expression?: Expression; } - interface ImportDeclaration extends Statement, ModuleElement { + interface ImportDeclaration extends ModuleElement { importClause?: ImportClause; moduleSpecifier: Expression; } @@ -919,7 +919,7 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; - getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 600bf5c6adc..41cf18cc3f1 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -2415,9 +2415,8 @@ declare module "typescript" { >expression : Expression >Expression : Expression } - interface ImportDeclaration extends Statement, ModuleElement { + interface ImportDeclaration extends ModuleElement { >ImportDeclaration : ImportDeclaration ->Statement : Statement >ModuleElement : ModuleElement importClause?: ImportClause; @@ -2926,10 +2925,10 @@ declare module "typescript" { >Symbol : Symbol >Symbol : Symbol - getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; ->getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; +>getExportsOfModule : (moduleSymbol: Symbol) => Symbol[] +>moduleSymbol : Symbol +>Symbol : Symbol >Symbol : Symbol } interface SymbolDisplayBuilder { diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 4004007508a..68c51a8f652 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -778,7 +778,7 @@ declare module "typescript" { interface ExternalModuleReference extends Node { expression?: Expression; } - interface ImportDeclaration extends Statement, ModuleElement { + interface ImportDeclaration extends ModuleElement { importClause?: ImportClause; moduleSpecifier: Expression; } @@ -920,7 +920,7 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; - getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 4ea9c49d758..de371435b42 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -2365,9 +2365,8 @@ declare module "typescript" { >expression : Expression >Expression : Expression } - interface ImportDeclaration extends Statement, ModuleElement { + interface ImportDeclaration extends ModuleElement { >ImportDeclaration : ImportDeclaration ->Statement : Statement >ModuleElement : ModuleElement importClause?: ImportClause; @@ -2876,10 +2875,10 @@ declare module "typescript" { >Symbol : Symbol >Symbol : Symbol - getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; ->getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; +>getExportsOfModule : (moduleSymbol: Symbol) => Symbol[] +>moduleSymbol : Symbol +>Symbol : Symbol >Symbol : Symbol } interface SymbolDisplayBuilder { diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 34503a0d81a..02c8bdb6889 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -815,7 +815,7 @@ declare module "typescript" { interface ExternalModuleReference extends Node { expression?: Expression; } - interface ImportDeclaration extends Statement, ModuleElement { + interface ImportDeclaration extends ModuleElement { importClause?: ImportClause; moduleSpecifier: Expression; } @@ -957,7 +957,7 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; - getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 3903e169b4e..1114e9680f9 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -2538,9 +2538,8 @@ declare module "typescript" { >expression : Expression >Expression : Expression } - interface ImportDeclaration extends Statement, ModuleElement { + interface ImportDeclaration extends ModuleElement { >ImportDeclaration : ImportDeclaration ->Statement : Statement >ModuleElement : ModuleElement importClause?: ImportClause; @@ -3049,10 +3048,10 @@ declare module "typescript" { >Symbol : Symbol >Symbol : Symbol - getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; ->getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; +>getExportsOfModule : (moduleSymbol: Symbol) => Symbol[] +>moduleSymbol : Symbol +>Symbol : Symbol >Symbol : Symbol } interface SymbolDisplayBuilder { From 19211b12928fc489b62176ff1db3081cb6f1552b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 25 Mar 2015 18:40:06 -0700 Subject: [PATCH 15/61] Got rid of 'getExportsOfImportDeclaration'. --- src/compiler/checker.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7435fd095b6..6bd75c5d283 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3001,17 +3001,6 @@ module ts { return result; } - function getExportsOfImportDeclaration(node: ImportDeclaration): Symbol[] { - if (!node.moduleSpecifier) { - return emptyArray; - } - let module = resolveExternalModuleName(node, node.moduleSpecifier); - if (!module) { - return emptyArray; - } - return symbolsToArray(getExportsOfModule(module)); - } - function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature { let links = getNodeLinks(declaration); if (!links.resolvedSignature) { From eb5e1bcbad55656c773b75038a3af41729fd89ab Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 26 Mar 2015 23:55:10 -0700 Subject: [PATCH 16/61] Use a function declaration vs a function expression to help deal with a reported Atom+IO.js issue. --- src/services/services.ts | 239 ++++++++++++++++++++------------------- 1 file changed, 122 insertions(+), 117 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 41ffc04e5ae..80e28827b24 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -730,7 +730,7 @@ module ts { public statements: NodeArray; public endOfFileToken: Node; - public amdDependencies: {name: string; path: string}[]; + public amdDependencies: { name: string; path: string }[]; public amdModuleName: string; public referencedFiles: FileReference[]; @@ -769,126 +769,131 @@ module ts { public getNamedDeclarations() { if (!this.namedDeclarations) { - let sourceFile = this; - let namedDeclarations: Declaration[] = []; - - forEachChild(sourceFile, function visit(node: Node): void { - switch (node.kind) { - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - let functionDeclaration = node; - - if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { - let lastDeclaration = namedDeclarations.length > 0 ? - namedDeclarations[namedDeclarations.length - 1] : - undefined; - - // Check whether this declaration belongs to an "overload group". - if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { - // Overwrite the last declaration if it was an overload - // and this one is an implementation. - if (functionDeclaration.body && !(lastDeclaration).body) { - namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; - } - } - else { - namedDeclarations.push(functionDeclaration); - } - - forEachChild(node, visit); - } - break; - - case SyntaxKind.ClassDeclaration: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.TypeAliasDeclaration: - case SyntaxKind.EnumDeclaration: - case SyntaxKind.ModuleDeclaration: - case SyntaxKind.ImportEqualsDeclaration: - case SyntaxKind.ExportSpecifier: - case SyntaxKind.ImportSpecifier: - case SyntaxKind.ImportEqualsDeclaration: - case SyntaxKind.ImportClause: - case SyntaxKind.NamespaceImport: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.TypeLiteral: - if ((node).name) { - namedDeclarations.push(node); - } - // fall through - case SyntaxKind.Constructor: - case SyntaxKind.VariableStatement: - case SyntaxKind.VariableDeclarationList: - case SyntaxKind.ObjectBindingPattern: - case SyntaxKind.ArrayBindingPattern: - case SyntaxKind.ModuleBlock: - forEachChild(node, visit); - break; - - case SyntaxKind.Block: - if (isFunctionBlock(node)) { - forEachChild(node, visit); - } - break; - - case SyntaxKind.Parameter: - // Only consider properties defined as constructor parameters - if (!(node.flags & NodeFlags.AccessibilityModifier)) { - break; - } - // fall through - case SyntaxKind.VariableDeclaration: - case SyntaxKind.BindingElement: - if (isBindingPattern((node).name)) { - forEachChild((node).name, visit); - break; - } - case SyntaxKind.EnumMember: - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - namedDeclarations.push(node); - break; - - case SyntaxKind.ExportDeclaration: - // Handle named exports case e.g.: - // export {a, b as B} from "mod"; - if ((node).exportClause) { - forEach((node).exportClause.elements, visit); - } - break; - - case SyntaxKind.ImportDeclaration: - let importClause = (node).importClause; - if (importClause) { - // Handle default import case e.g.: - // import d from "mod"; - if (importClause.name) { - namedDeclarations.push(importClause); - } - - // Handle named bindings in imports e.g.: - // import * as NS from "mod"; - // import {a, b as B} from "mod"; - if (importClause.namedBindings) { - if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { - namedDeclarations.push(importClause.namedBindings); - } - else { - forEach((importClause.namedBindings).elements, visit); - } - } - } - break; - } - }); - - this.namedDeclarations = namedDeclarations; + this.namedDeclarations = this.computeNamedDeclarations(); } return this.namedDeclarations; } + + private computeNamedDeclarations() { + let namedDeclarations: Declaration[] = []; + + forEachChild(this, visit); + + return namedDeclarations; + + function visit(node: Node): void { + switch (node.kind) { + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + let functionDeclaration = node; + + if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { + let lastDeclaration = namedDeclarations.length > 0 ? + namedDeclarations[namedDeclarations.length - 1] : + undefined; + + // Check whether this declaration belongs to an "overload group". + if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { + // Overwrite the last declaration if it was an overload + // and this one is an implementation. + if (functionDeclaration.body && !(lastDeclaration).body) { + namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; + } + } + else { + namedDeclarations.push(functionDeclaration); + } + + forEachChild(node, visit); + } + break; + + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ExportSpecifier: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportClause: + case SyntaxKind.NamespaceImport: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.TypeLiteral: + if ((node).name) { + namedDeclarations.push(node); + } + // fall through + case SyntaxKind.Constructor: + case SyntaxKind.VariableStatement: + case SyntaxKind.VariableDeclarationList: + case SyntaxKind.ObjectBindingPattern: + case SyntaxKind.ArrayBindingPattern: + case SyntaxKind.ModuleBlock: + forEachChild(node, visit); + break; + + case SyntaxKind.Block: + if (isFunctionBlock(node)) { + forEachChild(node, visit); + } + break; + + case SyntaxKind.Parameter: + // Only consider properties defined as constructor parameters + if (!(node.flags & NodeFlags.AccessibilityModifier)) { + break; + } + // fall through + case SyntaxKind.VariableDeclaration: + case SyntaxKind.BindingElement: + if (isBindingPattern((node).name)) { + forEachChild((node).name, visit); + break; + } + case SyntaxKind.EnumMember: + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + namedDeclarations.push(node); + break; + + case SyntaxKind.ExportDeclaration: + // Handle named exports case e.g.: + // export {a, b as B} from "mod"; + if ((node).exportClause) { + forEach((node).exportClause.elements, visit); + } + break; + + case SyntaxKind.ImportDeclaration: + let importClause = (node).importClause; + if (importClause) { + // Handle default import case e.g.: + // import d from "mod"; + if (importClause.name) { + namedDeclarations.push(importClause); + } + + // Handle named bindings in imports e.g.: + // import * as NS from "mod"; + // import {a, b as B} from "mod"; + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { + namedDeclarations.push(importClause.namedBindings); + } + else { + forEach((importClause.namedBindings).elements, visit); + } + } + } + break; + } + } + } } // From bea7221174de736d7f01ea9de3624d971a76f2c6 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 30 Mar 2015 16:59:34 -0700 Subject: [PATCH 17/61] Ensure we find export default declaration targets if we search for them by name --- src/compiler/checker.ts | 7 ++++ .../es5ExportDefaultClassDeclaration3.js | 35 +++++++++++++++++++ .../es5ExportDefaultClassDeclaration3.types | 33 +++++++++++++++++ .../es5ExportDefaultFunctionDeclaration3.js | 21 +++++++++++ ...es5ExportDefaultFunctionDeclaration3.types | 22 ++++++++++++ .../es5ExportDefaultClassDeclaration3.ts | 16 +++++++++ .../es5ExportDefaultFunctionDeclaration3.ts | 11 ++++++ 7 files changed, 145 insertions(+) create mode 100644 tests/baselines/reference/es5ExportDefaultClassDeclaration3.js create mode 100644 tests/baselines/reference/es5ExportDefaultClassDeclaration3.types create mode 100644 tests/baselines/reference/es5ExportDefaultFunctionDeclaration3.js create mode 100644 tests/baselines/reference/es5ExportDefaultFunctionDeclaration3.types create mode 100644 tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts create mode 100644 tests/cases/compiler/es5ExportDefaultFunctionDeclaration3.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3c0bf39f1fa..cf4049294bb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -349,6 +349,13 @@ module ts { } result = undefined; } + else if (location.kind === SyntaxKind.SourceFile) { + result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & SymbolFlags.ModuleMember); + if (result && (result.flags & meaning) && result.valueDeclaration && (result.valueDeclaration.flags & NodeFlags.Default) && result.valueDeclaration.localSymbol.name === name) { + break loop; + } + result = undefined; + } break; case SyntaxKind.EnumDeclaration: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & SymbolFlags.EnumMember)) { diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.js b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.js new file mode 100644 index 00000000000..bff80940a02 --- /dev/null +++ b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.js @@ -0,0 +1,35 @@ +//// [es5ExportDefaultClassDeclaration3.ts] + +var before: C = new C(); + +export default class C { + method(): C { + return new C(); + } +} + +var after: C = new C(); + +var t: typeof C = C; + + + +//// [es5ExportDefaultClassDeclaration3.js] +var before = new C(); +var C = (function () { + function C() { + } + C.prototype.method = function () { + return new C(); + }; + return C; +})(); +exports.default = C; +var after = new C(); +var t = C; + + +//// [es5ExportDefaultClassDeclaration3.d.ts] +export default class C { + method(): C; +} diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.types b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.types new file mode 100644 index 00000000000..1ed302ac45e --- /dev/null +++ b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts === + +var before: C = new C(); +>before : C +>C : C +>new C() : C +>C : typeof C + +export default class C { +>C : C + + method(): C { +>method : () => C +>C : C + + return new C(); +>new C() : C +>C : typeof C + } +} + +var after: C = new C(); +>after : C +>C : C +>new C() : C +>C : typeof C + +var t: typeof C = C; +>t : typeof C +>C : typeof C +>C : typeof C + + diff --git a/tests/baselines/reference/es5ExportDefaultFunctionDeclaration3.js b/tests/baselines/reference/es5ExportDefaultFunctionDeclaration3.js new file mode 100644 index 00000000000..1fc57976439 --- /dev/null +++ b/tests/baselines/reference/es5ExportDefaultFunctionDeclaration3.js @@ -0,0 +1,21 @@ +//// [es5ExportDefaultFunctionDeclaration3.ts] + +var before: typeof func = func(); + +export default function func(): typeof func { + return func; +} + +var after: typeof func = func(); + +//// [es5ExportDefaultFunctionDeclaration3.js] +var before = func(); +function func() { + return func; +} +exports.default = func; +var after = func(); + + +//// [es5ExportDefaultFunctionDeclaration3.d.ts] +export default function func(): typeof func; diff --git a/tests/baselines/reference/es5ExportDefaultFunctionDeclaration3.types b/tests/baselines/reference/es5ExportDefaultFunctionDeclaration3.types new file mode 100644 index 00000000000..d3a8ff92b2f --- /dev/null +++ b/tests/baselines/reference/es5ExportDefaultFunctionDeclaration3.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/es5ExportDefaultFunctionDeclaration3.ts === + +var before: typeof func = func(); +>before : () => typeof func +>func : () => typeof func +>func() : () => typeof func +>func : () => typeof func + +export default function func(): typeof func { +>func : () => typeof func +>func : () => typeof func + + return func; +>func : () => typeof func +} + +var after: typeof func = func(); +>after : () => typeof func +>func : () => typeof func +>func() : () => typeof func +>func : () => typeof func + diff --git a/tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts b/tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts new file mode 100644 index 00000000000..b464e329b84 --- /dev/null +++ b/tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts @@ -0,0 +1,16 @@ +// @target: es5 +// @module: commonjs +// @declaration: true + +var before: C = new C(); + +export default class C { + method(): C { + return new C(); + } +} + +var after: C = new C(); + +var t: typeof C = C; + diff --git a/tests/cases/compiler/es5ExportDefaultFunctionDeclaration3.ts b/tests/cases/compiler/es5ExportDefaultFunctionDeclaration3.ts new file mode 100644 index 00000000000..7db21de339e --- /dev/null +++ b/tests/cases/compiler/es5ExportDefaultFunctionDeclaration3.ts @@ -0,0 +1,11 @@ +// @target: es5 +// @module: commonjs +// @declaration: true + +var before: typeof func = func(); + +export default function func(): typeof func { + return func; +} + +var after: typeof func = func(); \ No newline at end of file From 383f01dbf6c4f1f8f6d9dfcb9cc119bb8ffd39c6 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 30 Mar 2015 20:28:24 -0700 Subject: [PATCH 18/61] Handel export default declaration completions --- src/services/services.ts | 7 ++++++- tests/cases/fourslash/exportDefaultClass.ts | 12 ++++++++++++ tests/cases/fourslash/exportDefaultFunction.ts | 12 ++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/exportDefaultClass.ts create mode 100644 tests/cases/fourslash/exportDefaultFunction.ts diff --git a/src/services/services.ts b/src/services/services.ts index 41ffc04e5ae..4609c722786 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2404,6 +2404,11 @@ module ts { return undefined; } + // If this is the default export, get the name of the declaration if it exists + if (displayName === "default" && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) && symbol.valueDeclaration.localSymbol && symbol.valueDeclaration.localSymbol.name) { + displayName = symbol.valueDeclaration.localSymbol.name; + } + let firstCharCode = displayName.charCodeAt(0); // First check of the displayName is not external module; if it is an external module, it is not valid entry if ((symbol.flags & SymbolFlags.Namespace) && (firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) { @@ -2620,7 +2625,7 @@ module ts { previousToken.getStart() : position; - let scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile); + let scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; /// TODO filter meaning based on the current context let symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias; diff --git a/tests/cases/fourslash/exportDefaultClass.ts b/tests/cases/fourslash/exportDefaultClass.ts new file mode 100644 index 00000000000..04ab351ab36 --- /dev/null +++ b/tests/cases/fourslash/exportDefaultClass.ts @@ -0,0 +1,12 @@ +/// + +////export default class C { +//// method() { /*1*/ } +////} +//// /*2*/ + +goTo.marker('1'); +verify.completionListContains("C", "class C", /*documentation*/ undefined, "class"); + +goTo.marker('2'); +verify.completionListContains("C", "class C", /*documentation*/ undefined, "class"); \ No newline at end of file diff --git a/tests/cases/fourslash/exportDefaultFunction.ts b/tests/cases/fourslash/exportDefaultFunction.ts new file mode 100644 index 00000000000..859d9641acd --- /dev/null +++ b/tests/cases/fourslash/exportDefaultFunction.ts @@ -0,0 +1,12 @@ +/// + +////export default function func() { +//// /*1*/ +////} +//// /*2*/ + +goTo.marker('1'); +verify.completionListContains("func", "function func(): void", /*documentation*/ undefined, "function"); + +goTo.marker('2'); +verify.completionListContains("func", "function func(): void", /*documentation*/ undefined, "function"); \ No newline at end of file From 757257b9a12442d3e90b7b75a47f786080a3e218 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 30 Mar 2015 22:18:13 -0700 Subject: [PATCH 19/61] Ensure export= is emitted correctelly in declaration files --- src/compiler/checker.ts | 6 ++- ...FileImportModuleWithExportAssignment.types | 14 +++---- ...ernalModuleWithExportAssignedFundule.types | 2 +- .../declareFileExportAssignment.types | 14 +++---- ...signmentWithVarFromVariableStatement.types | 14 +++---- .../baselines/reference/es5ExportEqualsDts.js | 37 +++++++++++++++++++ .../reference/es5ExportEqualsDts.types | 28 ++++++++++++++ .../exportAssignClassAndModule.types | 4 +- .../reference/exportEqualNamespaces.types | 2 +- ...ssignmentOnExportedGenericInterface1.types | 4 +- tests/cases/compiler/es5ExportEqualsDts.ts | 16 ++++++++ 11 files changed, 113 insertions(+), 28 deletions(-) create mode 100644 tests/baselines/reference/es5ExportEqualsDts.js create mode 100644 tests/baselines/reference/es5ExportEqualsDts.types create mode 100644 tests/cases/compiler/es5ExportEqualsDts.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 699d2f74a64..20c4f3bb1a7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1091,7 +1091,7 @@ module ts { // Check if symbol is any of the alias return forEachValue(symbols, symbolFromSymbolTable => { - if (symbolFromSymbolTable.flags & SymbolFlags.Alias) { + if (symbolFromSymbolTable.flags & SymbolFlags.Alias && symbolFromSymbolTable.name !== "export=") { if (!useOnlyExternalAliasing || // We can use any type of alias to get the name // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) { @@ -1932,6 +1932,10 @@ module ts { case SyntaxKind.SourceFile: return true; + // Export assignements do not create name bindings outside the module + case SyntaxKind.ExportAssignment: + return false; + default: Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } diff --git a/tests/baselines/reference/declFileImportModuleWithExportAssignment.types b/tests/baselines/reference/declFileImportModuleWithExportAssignment.types index a2ae5c07687..15201baa487 100644 --- a/tests/baselines/reference/declFileImportModuleWithExportAssignment.types +++ b/tests/baselines/reference/declFileImportModuleWithExportAssignment.types @@ -42,23 +42,23 @@ module m2 { } var m2: { ->m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; } +>m2 : { (): m2.connectExport; test1: m2.connectModule; test2(): m2.connectModule; } (): m2.connectExport; >m2 : unknown ->connectExport : export=.connectExport +>connectExport : m2.connectExport test1: m2.connectModule; ->test1 : export=.connectModule +>test1 : m2.connectModule >m2 : unknown ->connectModule : export=.connectModule +>connectModule : m2.connectModule test2(): m2.connectModule; ->test2 : () => export=.connectModule +>test2 : () => m2.connectModule >m2 : unknown ->connectModule : export=.connectModule +>connectModule : m2.connectModule }; export = m2; ->m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; } +>m2 : { (): m2.connectExport; test1: m2.connectModule; test2(): m2.connectModule; } diff --git a/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.types b/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.types index e861059af75..70718471d50 100644 --- a/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.types +++ b/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.types @@ -7,7 +7,7 @@ declare module "express" { function express(): express.ExpressServer; >express : typeof express >express : unknown ->ExpressServer : export=.ExpressServer +>ExpressServer : express.ExpressServer module express { >express : typeof express diff --git a/tests/baselines/reference/declareFileExportAssignment.types b/tests/baselines/reference/declareFileExportAssignment.types index 80cfbf82387..f30586b07e3 100644 --- a/tests/baselines/reference/declareFileExportAssignment.types +++ b/tests/baselines/reference/declareFileExportAssignment.types @@ -27,24 +27,24 @@ module m2 { } var m2: { ->m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; } +>m2 : { (): m2.connectExport; test1: m2.connectModule; test2(): m2.connectModule; } (): m2.connectExport; >m2 : unknown ->connectExport : export=.connectExport +>connectExport : m2.connectExport test1: m2.connectModule; ->test1 : export=.connectModule +>test1 : m2.connectModule >m2 : unknown ->connectModule : export=.connectModule +>connectModule : m2.connectModule test2(): m2.connectModule; ->test2 : () => export=.connectModule +>test2 : () => m2.connectModule >m2 : unknown ->connectModule : export=.connectModule +>connectModule : m2.connectModule }; export = m2; ->m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; } +>m2 : { (): m2.connectExport; test1: m2.connectModule; test2(): m2.connectModule; } diff --git a/tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.types b/tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.types index 376a9d7ba6f..675dc38c869 100644 --- a/tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.types +++ b/tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.types @@ -28,24 +28,24 @@ module m2 { var x = 10, m2: { >x : number ->m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; } +>m2 : { (): m2.connectExport; test1: m2.connectModule; test2(): m2.connectModule; } (): m2.connectExport; >m2 : unknown ->connectExport : export=.connectExport +>connectExport : m2.connectExport test1: m2.connectModule; ->test1 : export=.connectModule +>test1 : m2.connectModule >m2 : unknown ->connectModule : export=.connectModule +>connectModule : m2.connectModule test2(): m2.connectModule; ->test2 : () => export=.connectModule +>test2 : () => m2.connectModule >m2 : unknown ->connectModule : export=.connectModule +>connectModule : m2.connectModule }; export = m2; ->m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; } +>m2 : { (): m2.connectExport; test1: m2.connectModule; test2(): m2.connectModule; } diff --git a/tests/baselines/reference/es5ExportEqualsDts.js b/tests/baselines/reference/es5ExportEqualsDts.js new file mode 100644 index 00000000000..922d012be0e --- /dev/null +++ b/tests/baselines/reference/es5ExportEqualsDts.js @@ -0,0 +1,37 @@ +//// [es5ExportEqualsDts.ts] + +class A { + foo() { + var aVal: A.B; + return aVal; + } +} + +module A { + export interface B { } +} + +export = A + +//// [es5ExportEqualsDts.js] +var A = (function () { + function A() { + } + A.prototype.foo = function () { + var aVal; + return aVal; + }; + return A; +})(); +module.exports = A; + + +//// [es5ExportEqualsDts.d.ts] +declare class A { + foo(): A.B; +} +declare module A { + interface B { + } +} +export = A; diff --git a/tests/baselines/reference/es5ExportEqualsDts.types b/tests/baselines/reference/es5ExportEqualsDts.types new file mode 100644 index 00000000000..58b35a0d7ce --- /dev/null +++ b/tests/baselines/reference/es5ExportEqualsDts.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/es5ExportEqualsDts.ts === + +class A { +>A : A + + foo() { +>foo : () => A.B + + var aVal: A.B; +>aVal : A.B +>A : unknown +>B : A.B + + return aVal; +>aVal : A.B + } +} + +module A { +>A : typeof A + + export interface B { } +>B : B +} + +export = A +>A : A + diff --git a/tests/baselines/reference/exportAssignClassAndModule.types b/tests/baselines/reference/exportAssignClassAndModule.types index 05a5cbf07ae..dc4a19f345c 100644 --- a/tests/baselines/reference/exportAssignClassAndModule.types +++ b/tests/baselines/reference/exportAssignClassAndModule.types @@ -22,9 +22,9 @@ class Foo { >Foo : Foo x: Foo.Bar; ->x : export=.Bar +>x : Foo.Bar >Foo : unknown ->Bar : export=.Bar +>Bar : Foo.Bar } module Foo { >Foo : typeof Foo diff --git a/tests/baselines/reference/exportEqualNamespaces.types b/tests/baselines/reference/exportEqualNamespaces.types index b94770837a4..0f3091c1b8a 100644 --- a/tests/baselines/reference/exportEqualNamespaces.types +++ b/tests/baselines/reference/exportEqualNamespaces.types @@ -12,7 +12,7 @@ interface server { (): server.Server; >server : unknown ->Server : export=.Server +>Server : server.Server startTime: Date; >startTime : Date diff --git a/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface1.types b/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface1.types index f0c8c25be29..936f04731f6 100644 --- a/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface1.types +++ b/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface1.types @@ -12,9 +12,9 @@ interface Foo { >T : T } var Foo: new () => Foo.A>; ->Foo : new () => export=.A> +>Foo : new () => Foo.A> >Foo : unknown ->A : export=.A +>A : Foo.A >Foo : Foo export = Foo; diff --git a/tests/cases/compiler/es5ExportEqualsDts.ts b/tests/cases/compiler/es5ExportEqualsDts.ts new file mode 100644 index 00000000000..1253c9ac220 --- /dev/null +++ b/tests/cases/compiler/es5ExportEqualsDts.ts @@ -0,0 +1,16 @@ +// @target: es5 +// @module: commonjs +// @declaration: true + +class A { + foo() { + var aVal: A.B; + return aVal; + } +} + +module A { + export interface B { } +} + +export = A \ No newline at end of file From 18d8fedbf52a02af0700f653f499a2e79fb479d3 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 10:52:21 -0700 Subject: [PATCH 20/61] Expose readConfigFile and parseConfigFile --- Jakefile | 1 + src/compiler/commandLineParser.ts | 14 ++++++++++++- .../baselines/reference/APISample_compile.js | 14 +++++++++++++ .../reference/APISample_compile.types | 21 +++++++++++++++++++ tests/baselines/reference/APISample_linter.js | 14 +++++++++++++ .../reference/APISample_linter.types | 21 +++++++++++++++++++ .../reference/APISample_transform.js | 14 +++++++++++++ .../reference/APISample_transform.types | 21 +++++++++++++++++++ .../baselines/reference/APISample_watcher.js | 14 +++++++++++++ .../reference/APISample_watcher.types | 21 +++++++++++++++++++ 10 files changed, 154 insertions(+), 1 deletion(-) diff --git a/Jakefile b/Jakefile index 665bb807b43..e5d1cb856fb 100644 --- a/Jakefile +++ b/Jakefile @@ -111,6 +111,7 @@ var definitionsRoots = [ "compiler/parser.d.ts", "compiler/checker.d.ts", "compiler/program.d.ts", + "compiler/commandLineParser.d.ts", "services/services.d.ts", ]; diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 96c1bc9e296..1bab9e4e2de 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -4,6 +4,7 @@ /// module ts { + /* @internal */ export var optionDeclarations: CommandLineOption[] = [ { name: "charset", @@ -153,7 +154,8 @@ module ts { description: Diagnostics.Watch_input_files, } ]; - + + /* @internal */ export function parseCommandLine(commandLine: string[]): ParsedCommandLine { var options: CompilerOptions = {}; var fileNames: string[] = []; @@ -263,6 +265,10 @@ module ts { } } + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ export function readConfigFile(fileName: string): any { try { var text = sys.readFile(fileName); @@ -272,6 +278,12 @@ module ts { } } + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ export function parseConfigFile(json: any, basePath?: string): ParsedCommandLine { var errors: Diagnostic[] = []; diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 397404ee98c..acbd769585b 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1489,6 +1489,20 @@ declare module "typescript" { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index b23ab38e0c7..eede842b517 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -4796,6 +4796,27 @@ declare module "typescript" { >CompilerHost : CompilerHost >Program : Program } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; +>readConfigFile : (fileName: string) => any +>fileName : string + + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine +>json : any +>basePath : string +>ParsedCommandLine : ParsedCommandLine +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index fc8f844ac00..fadad208c35 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1520,6 +1520,20 @@ declare module "typescript" { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 64e4910853f..ea0e2a5c998 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -4942,6 +4942,27 @@ declare module "typescript" { >CompilerHost : CompilerHost >Program : Program } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; +>readConfigFile : (fileName: string) => any +>fileName : string + + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine +>json : any +>basePath : string +>ParsedCommandLine : ParsedCommandLine +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 77c77278115..4b03ade4039 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1521,6 +1521,20 @@ declare module "typescript" { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 7a284e2026d..abf23770574 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -4892,6 +4892,27 @@ declare module "typescript" { >CompilerHost : CompilerHost >Program : Program } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; +>readConfigFile : (fileName: string) => any +>fileName : string + + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine +>json : any +>basePath : string +>ParsedCommandLine : ParsedCommandLine +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 8340a5150c9..d33b2f0750f 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1558,6 +1558,20 @@ declare module "typescript" { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index d151e8f046b..74aa5db61f6 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -5065,6 +5065,27 @@ declare module "typescript" { >CompilerHost : CompilerHost >Program : Program } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; +>readConfigFile : (fileName: string) => any +>fileName : string + + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine +>json : any +>basePath : string +>ParsedCommandLine : ParsedCommandLine +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; From d45143815b825f3335fbf204c5020089ecfc353f Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 12:20:30 -0700 Subject: [PATCH 21/61] initial checkin --- tests/cases/unittests/versionCache.ts | 1347 +++++++++++++++++++++++++ 1 file changed, 1347 insertions(+) create mode 100644 tests/cases/unittests/versionCache.ts diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts new file mode 100644 index 00000000000..a2b1d5e585a --- /dev/null +++ b/tests/cases/unittests/versionCache.ts @@ -0,0 +1,1347 @@ +/// +/// + +module ts{ + var gloError = false; + + function editFlat(s: number, dl: number, nt: string, source: string) { + return source.substring(0, s) + nt + source.substring(s + dl, source.length); + } + + var testDataDir = "../../tests/versionCacheTest/"; + + function bigTest() { + editStress("types.ts", false); + editStress("tst.ts", false); + editStress("client.ts", false); + } + + function recordError() { + gloError = true; + } + + function tstTest() { + var fname = testDataDir + 'tst.ts'; + var content = ts.sys.readFile(fname); + var lm = server.LineIndex.linesFromText(content); + var lines = lm.lines; + if (lines.length == 0) { + return; + } + var lineMap = lm.lineMap; + + var lineIndex = new server.LineIndex(); + lineIndex.load(lines); + + var editedText = lineIndex.getText(0, content.length); + + var snapshot: server.LineIndex; + var checkText: string; + var insertString: string; + + // change 9 1 0 1 {"y"} + var pos = lineColToPosition(lineIndex, 9, 1); + insertString = "y"; + checkText = editFlat(pos, 0, insertString, content); + snapshot = lineIndex.edit(pos, 0, insertString); + editedText = snapshot.getText(0, checkText.length); + if (editedText != checkText) { + recordError(); + return; + } + + // change 9 2 0 1 {"."} + var pos = lineColToPosition(snapshot, 9, 2); + insertString = "."; + checkText = editFlat(pos, 0, insertString, checkText); + snapshot = snapshot.edit(pos, 0, insertString); + editedText = snapshot.getText(0, checkText.length); + if (editedText != checkText) { + recordError(); + return; + } + + // change 9 3 0 1 {"\n"} + var pos = lineColToPosition(snapshot, 9, 3); + insertString = "\n"; + checkText = editFlat(pos, 0, insertString, checkText); + snapshot = snapshot.edit(pos, 0, insertString); + editedText = snapshot.getText(0, checkText.length); + if (editedText != checkText) { + recordError(); + return; + } + + // change 10 1 0 10 {"\n\n\n\n\n\n\n\n\n\n"} + pos = lineColToPosition(snapshot, 10, 1); + insertString = "\n\n\n\n\n\n\n\n\n\n"; + checkText = editFlat(pos, 0, insertString, checkText); + snapshot = snapshot.edit(pos, 0, insertString); + editedText = snapshot.getText(0, checkText.length); + if (editedText != checkText) { + recordError(); + return; + } + + // change 19 1 1 0 + pos = lineColToPosition(snapshot, 19, 1); + checkText = editFlat(pos, 1, "", checkText); + snapshot = snapshot.edit(pos, 1); + editedText = snapshot.getText(0, checkText.length); + if (editedText != checkText) { + recordError(); + return; + } + + // change 18 1 1 0 + pos = lineColToPosition(snapshot, 18, 1); + checkText = editFlat(pos, 1, "", checkText); + snapshot = snapshot.edit(pos, 1); + editedText = snapshot.getText(0, checkText.length); + if (editedText != checkText) { + recordError(); + return; + } + + function lineColToPosition(lineIndex: server.LineIndex, line: number, col: number) { + var lineInfo = lineIndex.lineNumberToInfo(line); + return (lineInfo.offset + col - 1); + } + } + + function editTest() { + var fname = testDataDir + 'editme'; + var content = ts.sys.readFile(fname); + var lm = server.LineIndex.linesFromText(content); + var lines = lm.lines; + if (lines.length == 0) { + return; + } + var lineMap = lm.lineMap; + + var lineIndex = new server.LineIndex(); + lineIndex.load(lines); + + var editedText = lineIndex.getText(0, content.length); + + var snapshot: server.LineIndex; + var checkText: string; + var insertString: string; + + // Case VII: insert at end of file + insertString = "hmmmm...\r\n"; + checkText = editFlat(content.length, 0, insertString, content); + snapshot = lineIndex.edit(content.length, 0, insertString); + editedText = snapshot.getText(0, checkText.length); + if (editedText != checkText) { + recordError(); + return; + } + + // Case IV: unusual line endings merge + snapshot = lineIndex.edit(lines[0].length - 1, lines[1].length, ""); + editedText = snapshot.getText(0, content.length - lines[1].length); + checkText = editFlat(lines[0].length - 1, lines[1].length, "", content); + if (editedText != checkText) { + recordError(); + return; + } + + // Case VIIa: delete whole line and nothing but line (last line) + var llpos = lm.lineMap[lm.lineMap.length - 2]; + snapshot = lineIndex.edit(llpos, lines[lines.length - 1].length, ""); + checkText = editFlat(llpos, lines[lines.length - 1].length, "", content); + editedText = snapshot.getText(0, checkText.length); + if (editedText != checkText) { + recordError(); + return; + } + + // Case VIIb: delete whole line and nothing but line (first line) + snapshot = lineIndex.edit(0, lines[0].length, ""); + editedText = snapshot.getText(0, content.length - lines[0].length); + checkText = editFlat(0, lines[0].length, "", content); + if (editedText != checkText) { + recordError(); + return; + } + + // and insert with no line breaks + insertString = "moo, moo, moo! "; + snapshot = lineIndex.edit(0, lines[0].length, insertString); + editedText = snapshot.getText(0, content.length - lines[0].length + insertString.length); + checkText = editFlat(0, lines[0].length, insertString, content); + if (editedText != checkText) { + recordError(); + return; + } + + // and insert with multiple line breaks + insertString = "moo, \r\nmoo, \r\nmoo! "; + snapshot = lineIndex.edit(0, lines[0].length, insertString); + editedText = snapshot.getText(0, content.length - lines[0].length + insertString.length); + checkText = editFlat(0, lines[0].length, insertString, content); + if (editedText != checkText) { + recordError(); + return; + } + + snapshot = lineIndex.edit(0, lines[0].length + lines[1].length, ""); + editedText = snapshot.getText(0, content.length - (lines[0].length + lines[1].length)); + checkText = editFlat(0, lines[0].length + lines[1].length, "", content); + if (editedText != checkText) { + recordError(); + return; + } + + snapshot = lineIndex.edit(lines[0].length, lines[1].length + lines[2].length, ""); + + editedText = snapshot.getText(0, content.length - (lines[1].length + lines[2].length)); + checkText = editFlat(lines[0].length, lines[1].length + lines[2].length, "", content); + if (editedText != checkText) { + recordError(); + return; + } + + // Case VI: insert multiple line breaks + + insertString = "cr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr"; + snapshot = lineIndex.edit(21, 1, insertString); + editedText = snapshot.getText(0, content.length + insertString.length - 1); + checkText = editFlat(21, 1, insertString, content); + if (editedText != checkText) { + recordError(); + return; + } + + insertString = "cr...\r\ncr...\r\ncr"; + snapshot = lineIndex.edit(21, 1, insertString); + editedText = snapshot.getText(0, content.length + insertString.length - 1); + checkText = editFlat(21, 1, insertString, content); + if (editedText != checkText) { + recordError(); + return; + } + + // leading '\n' + insertString = "\ncr...\r\ncr...\r\ncr"; + snapshot = lineIndex.edit(21, 1, insertString); + editedText = snapshot.getText(0, content.length + insertString.length - 1); + checkText = editFlat(21, 1, insertString, content); + if (editedText != checkText) { + recordError(); + return; + } + + // Case I: single line no line breaks deleted or inserted + // delete 1 char + snapshot = lineIndex.edit(21, 1); + editedText = snapshot.getText(0, content.length - 1); + checkText = editFlat(21, 1, "", content); + if (editedText != checkText) { + recordError(); + return; + } + + // insert 1 char + snapshot = lineIndex.edit(21, 0, "b"); + editedText = snapshot.getText(0, content.length + 1); + checkText = editFlat(21, 0, "b", content); + if (editedText != checkText) { + recordError(); + return; + } + + // delete 1, insert 2 + snapshot = lineIndex.edit(21, 1, "cr"); + editedText = snapshot.getText(0, content.length + 1); + checkText = editFlat(21, 1, "cr", content); + if (editedText != checkText) { + recordError(); + return; + } + + // Case II: delete across line break + snapshot = lineIndex.edit(21, 22); + editedText = snapshot.getText(0, content.length - 22); + checkText = editFlat(21, 22, "", content); + if (editedText != checkText) { + recordError(); + return; + } + + snapshot = lineIndex.edit(21, 32); + editedText = snapshot.getText(0, content.length - 32); + checkText = editFlat(21, 32, "", content); + if (editedText != checkText) { + recordError(); + return; + } + + // Case III: delete across multiple line breaks and insert no line breaks + snapshot = lineIndex.edit(21, 42); + editedText = snapshot.getText(0, content.length - 42); + checkText = editFlat(21, 42, "", content); + if (editedText != checkText) { + recordError(); + return; + } + + snapshot = lineIndex.edit(21, 42, "slithery "); + editedText = snapshot.getText(0, content.length - 33); + checkText = editFlat(21, 42, "slithery ", content); + if (editedText != checkText) { + recordError(); + return; + } + } + + function editStress(fname: string, timing: boolean) { + var content = ts.sys.readFile(testDataDir + fname); + var lm = server.LineIndex.linesFromText(content); + var lines = lm.lines; + if (lines.length == 0) { + return; + } + var lineMap = lm.lineMap; + + var lineIndex = new server.LineIndex(); + lineIndex.load(lines); + var totalChars = content.length; + var rsa: number[] = []; + var la: number[] = []; + var las: number[] = []; + var elas: number[] = []; + var ersa: number[] = []; + var ela: number[] = []; + var etotalChars = totalChars; + var j: number; + + var startTime: number; + for (j = 0; j < 100000; j++) { + rsa[j] = Math.floor(Math.random() * totalChars); + la[j] = Math.floor(Math.random() * (totalChars - rsa[j])); + if (la[j] > 4) { + las[j] = 4; + } + else { + las[j] = la[j]; + } + if (j < 4000) { + ersa[j] = Math.floor(Math.random() * etotalChars); + ela[j] = Math.floor(Math.random() * (etotalChars - ersa[j])); + if (ela[j] > 4) { + elas[j] = 4; + } + else { + elas[j] = ela[j]; + } + etotalChars += (las[j] - elas[j]); + } + } + if (timing) { + startTime = Date.now(); + } + for (j = 0; j < 2000; j++) { + var s2 = lineIndex.getText(rsa[j], la[j]); + if (!timing) { + var s1 = content.substring(rsa[j], rsa[j] + la[j]); + if (s1 != s2) { + recordError(); + return; + } + } + } + if (timing) { + console.log("range (average length 1/4 file size): " + ((Date.now() - startTime) / 2).toFixed(3) + " us"); + } + // console.log("check1"); + if (timing) { + startTime = Date.now(); + } + for (j = 0; j < 10000; j++) { + var s2 = lineIndex.getText(rsa[j], las[j]); + if (!timing) { + var s1 = content.substring(rsa[j], rsa[j] + las[j]); + if (s1 != s2) { + recordError(); + return; + } + } + } + // console.log("check2"); + if (timing) { + console.log("range (average length 4 chars): " + ((Date.now() - startTime) / 10).toFixed(3) + " us"); + } + + if (timing) { + startTime = Date.now(); + } + var snapshot: server.LineIndex; + for (j = 0; j < 2000; j++) { + var insertString = content.substring(rsa[100000 - j], rsa[100000 - j] + las[100000 - j]); + snapshot = lineIndex.edit(rsa[j], las[j], insertString); + if (!timing) { + var checkText = editFlat(rsa[j], las[j], insertString, content); + var snapText = snapshot.getText(0, checkText.length); + if (checkText != snapText) { + if (s1 != s2) { + recordError(); + return; + } + } + } + } + // console.log("check3"); + if (timing) { + console.log("edit (average length 4): " + ((Date.now() - startTime) / 2).toFixed(3) + " us"); + } + + var svc = server.ScriptVersionCache.fromString(content); + checkText = content; + if (timing) { + startTime = Date.now(); + } + for (j = 0; j < 2000; j++) { + insertString = content.substring(rsa[j], rsa[j] + las[j]); + svc.edit(ersa[j], elas[j], insertString); + if (!timing) { + checkText = editFlat(ersa[j], elas[j], insertString, checkText); + } + if (0 == (j % 4)) { + var snap = svc.getSnapshot(); + if (!timing) { + snapText = snap.getText(0, checkText.length); + if (checkText != snapText) { + if (s1 != s2) { + recordError(); + return; + } + } + } + } + } + if (timing) { + console.log("edit ScriptVersionCache: " + ((Date.now() - startTime) / 2).toFixed(3) + " us"); + } + + // console.log("check4"); + if (timing) { + startTime = Date.now(); + } + for (j = 0; j < 5000; j++) { + insertString = content.substring(rsa[100000 - j], rsa[100000 - j] + la[100000 - j]); + snapshot = lineIndex.edit(rsa[j], la[j], insertString); + if (!timing) { + checkText = editFlat(rsa[j], la[j], insertString, content); + snapText = snapshot.getText(0, checkText.length); + if (checkText != snapText) { + if (s1 != s2) { + recordError(); + return; + } + } + } + } + if (timing) { + console.log("edit (average length 1/4th file size): " + ((Date.now() - startTime) / 5).toFixed(3) + " us"); + } + + var t: ts.LineAndCharacter; + var errorCount = 0; + if (timing) { + startTime = Date.now(); + } + // console.log("check5"); + for (j = 0; j < 100000; j++) { + var lp = lineIndex.charOffsetToLineNumberAndPos(rsa[j]); + if (!timing) { + var lac = ts.getLineAndCharacterOfPosition(lineMap, rsa[j]); + + if (lac.line != lp.line) { + recordError(); + console.log("arrgh " + lac.line + " " + lp.line + " " + j); + return; + } + if (lac.character != (lp.offset + 1)) { + recordError(); + console.log("arrgh ch... " + lac.character + " " + (lp.offset + 1) + " " + j); + return; + } + } + } + // console.log("check6"); + if (timing) { + console.log("line/offset from pos: " + ((Date.now() - startTime) / 100).toFixed(3) + " us"); + } + + if (timing) { + startTime = Date.now(); + } + + var outer = 1; + if (timing) { + outer = 100; + } + for (var ko = 0; ko < outer; ko++) { + for (var k = 0, llen = lines.length; k < llen; k++) { + var lineInfo = lineIndex.lineNumberToInfo(k + 1); + var lineIndexOffset = lineInfo.offset; + if (!timing) { + var lineMapOffset = lineMap[k]; + if (lineIndexOffset != lineMapOffset) { + recordError(); + return; + } + } + } + } + if (timing) { + console.log("start pos from line: " + (((Date.now() - startTime) / lines.length) * 10).toFixed(3) + " us"); + } + } + + function edTest() { + editTest(); + tstTest(); + if (!gloError) { + bigTest(); + } + if (gloError) { + console.log(" ! Fail: versionCache"); + } + else { + console.log("Pass"); + } + } + + edTest(); +} + + +//module ts { +// ts.disableIncrementalParsing = false; + +// function withChange(text: IScriptSnapshot, start: number, length: number, newText: string): { text: IScriptSnapshot; textChangeRange: TextChangeRange; } { +// var contents = text.getText(0, text.getLength()); +// var newContents = contents.substr(0, start) + newText + contents.substring(start + length); + +// return { text: ScriptSnapshot.fromString(newContents), textChangeRange: createTextChangeRange(createTextSpan(start, length), newText.length) } +// } + +// function withInsert(text: IScriptSnapshot, start: number, newText: string): { text: IScriptSnapshot; textChangeRange: TextChangeRange; } { +// return withChange(text, start, 0, newText); +// } + +// function withDelete(text: IScriptSnapshot, start: number, length: number): { text: IScriptSnapshot; textChangeRange: TextChangeRange; } { +// return withChange(text, start, length, ""); +// } + +// function createTree(text: IScriptSnapshot, version: string) { +// return createLanguageServiceSourceFile(/*fileName:*/ "", text, ScriptTarget.Latest, version, /*setNodeParents:*/ true) +// } + +// function assertSameDiagnostics(file1: SourceFile, file2: SourceFile) { +// var diagnostics1 = file1.parseDiagnostics; +// var diagnostics2 = file2.parseDiagnostics; + +// assert.equal(diagnostics1.length, diagnostics2.length, "diagnostics1.length !== diagnostics2.length"); +// for (var i = 0, n = diagnostics1.length; i < n; i++) { +// var d1 = diagnostics1[i]; +// var d2 = diagnostics2[i]; + +// assert.equal(d1.file, file1, "d1.file !== file1"); +// assert.equal(d2.file, file2, "d2.file !== file2"); +// assert.equal(d1.start, d2.start, "d1.start !== d2.start"); +// assert.equal(d1.length, d2.length, "d1.length !== d2.length"); +// assert.equal(d1.messageText, d2.messageText, "d1.messageText !== d2.messageText"); +// assert.equal(d1.category, d2.category, "d1.category !== d2.category"); +// assert.equal(d1.code, d2.code, "d1.code !== d2.code"); +// } +// } + +// // NOTE: 'reusedElements' is the expected count of elements reused from the old tree to the new +// // tree. It may change as we tweak the parser. If the count increases then that should always +// // be a good thing. If it decreases, that's not great (less reusability), but that may be +// // unavoidable. If it does decrease an investigation should be done to make sure that things +// // are still ok and we're still appropriately reusing most of the tree. +// function compareTrees(oldText: IScriptSnapshot, newText: IScriptSnapshot, textChangeRange: TextChangeRange, expectedReusedElements: number, oldTree?: SourceFile): SourceFile { +// oldTree = oldTree || createTree(oldText, /*version:*/ "."); +// Utils.assertInvariants(oldTree, /*parent:*/ undefined); + +// // Create a tree for the new text, in a non-incremental fashion. +// var newTree = createTree(newText, oldTree.version + "."); +// Utils.assertInvariants(newTree, /*parent:*/ undefined); + +// // Create a tree for the new text, in an incremental fashion. +// var incrementalNewTree = updateLanguageServiceSourceFile(oldTree, newText, oldTree.version + ".", textChangeRange); +// Utils.assertInvariants(incrementalNewTree, /*parent:*/ undefined); + +// // We should get the same tree when doign a full or incremental parse. +// Utils.assertStructuralEquals(newTree, incrementalNewTree); + +// // We should also get the exact same set of diagnostics. +// assertSameDiagnostics(newTree, incrementalNewTree); + +// // There should be no reused nodes between two trees that are fully parsed. +// assert.isTrue(reusedElements(oldTree, newTree) === 0); + +// assert.equal(newTree.fileName, incrementalNewTree.fileName, "newTree.fileName !== incrementalNewTree.fileName"); +// assert.equal(newTree.text, incrementalNewTree.text, "newTree.text !== incrementalNewTree.text"); + +// if (expectedReusedElements !== -1) { +// var actualReusedCount = reusedElements(oldTree, incrementalNewTree); +// assert.equal(actualReusedCount, expectedReusedElements, actualReusedCount + " !== " + expectedReusedElements); +// } + +// return incrementalNewTree; +// } + +// function reusedElements(oldNode: SourceFile, newNode: SourceFile): number { +// var allOldElements = collectElements(oldNode); +// var allNewElements = collectElements(newNode); + +// return filter(allOldElements, v => contains(allNewElements, v)).length; +// } + +// function collectElements(node: Node) { +// var result: Node[] = []; +// visit(node); +// return result; + +// function visit(node: Node) { +// result.push(node); +// forEachChild(node, visit); +// } +// } + +// function deleteCode(source: string, index: number, toDelete: string) { +// var repeat = toDelete.length; +// var oldTree = createTree(ScriptSnapshot.fromString(source), /*version:*/ "."); +// for (var i = 0; i < repeat; i++) { +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, index, 1); +// var newTree = compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1, oldTree); + +// source = newTextAndChange.text.getText(0, newTextAndChange.text.getLength()); +// oldTree = newTree; +// } +// } + +// function insertCode(source: string, index: number, toInsert: string) { +// var repeat = toInsert.length; +// var oldTree = createTree(ScriptSnapshot.fromString(source), /*version:*/ "."); +// for (var i = 0; i < repeat; i++) { +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index + i, toInsert.charAt(i)); +// var newTree = compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1, oldTree); + +// source = newTextAndChange.text.getText(0, newTextAndChange.text.getLength()); +// oldTree = newTree; +// } +// } + +// describe('Incremental',() => { +// it('Inserting into method',() => { +// var source = "class C {\r\n" + +// " public foo1() { }\r\n" + +// " public foo2() {\r\n" + +// " return 1;\r\n" + +// " }\r\n" + +// " public foo3() { }\r\n" + +// "}"; + +// var oldText = ScriptSnapshot.fromString(source); +// var semicolonIndex = source.indexOf(";"); +// var newTextAndChange = withInsert(oldText, semicolonIndex, " + 1"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 8); +// }); + +// it('Deleting from method',() => { +// var source = "class C {\r\n" + +// " public foo1() { }\r\n" + +// " public foo2() {\r\n" + +// " return 1 + 1;\r\n" + +// " }\r\n" + +// " public foo3() { }\r\n" + +// "}"; + +// var index = source.indexOf("+ 1"); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, index, "+ 1".length); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 8); +// }); + +// it('Regular expression 1',() => { +// var source = "class C { public foo1() { /; } public foo2() { return 1;} public foo3() { } }"; + +// var semicolonIndex = source.indexOf(";}"); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, semicolonIndex, "/"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Regular expression 2',() => { +// var source = "class C { public foo1() { ; } public foo2() { return 1/;} public foo3() { } }"; + +// var semicolonIndex = source.indexOf(";"); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, semicolonIndex, "/"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4); +// }); + +// it('Comment 1',() => { +// var source = "class C { public foo1() { /; } public foo2() { return 1; } public foo3() { } }"; + +// var semicolonIndex = source.indexOf(";"); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, semicolonIndex, "/"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Comment 2',() => { +// var source = "class C { public foo1() { /; } public foo2() { return 1; } public foo3() { } }"; + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, 0, "//"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Comment 3',() => { +// var source = "//class C { public foo1() { /; } public foo2() { return 1; } public foo3() { } }"; + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, 0, 2); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Comment 4',() => { +// var source = "class C { public foo1() { /; } public foo2() { */ return 1; } public foo3() { } }"; + +// var index = source.indexOf(";"); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index, "*"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4); +// }); + +// it('Parameter 1',() => { +// // Should be able to reuse all the parameters. +// var source = "class C {\r\n" + +// " public foo2(a, b, c, d) {\r\n" + +// " return 1;\r\n" + +// " }\r\n" + +// "}"; + +// var semicolonIndex = source.indexOf(";"); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, semicolonIndex, " + 1"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 8); +// }); + +// it('Type member 1',() => { +// // Should be able to reuse most of the type members. +// var source = "interface I { a: number; b: string; (c): d; new (e): f; g(): h }"; + +// var index = source.indexOf(": string"); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index, "?"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 14); +// }); + +// it('Enum element 1',() => { +// // Should be able to reuse most of the enum elements. +// var source = "enum E { a = 1, b = 1 << 1, c = 3, e = 4, f = 5, g = 7, h = 8, i = 9, j = 10 }"; + +// var index = source.indexOf("<<"); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, index, 2, "+"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 24); +// }); + +// it('Strict mode 1',() => { +// // In non-strict mode 'package' means nothing and can be reused. In strict mode though +// // we'll have to reparse the nodes (and generate an error for 'package();' +// // +// // Note: in this test we don't actually add 'use strict'. This is so we can compare +// // reuse with/without a strict mode change. +// var source = "foo1();\r\nfoo1();\r\nfoo1();\r\package();"; + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, 0, "'strict';\r\n"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Strict mode 2',() => { +// // In non-strict mode 'package' means nothing and can be reused. In strict mode though +// // we'll have to reparse the nodes (and generate an error for 'package();' +// var source = "foo1();\r\nfoo1();\r\nfoo1();\r\package();"; + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, 0, "'use strict';\r\n"); + +// // Note the decreased reuse of nodes compared to 'Strict mode 1' +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Strict mode 3',() => { +// // In non-strict mode 'package' means nothing and can be reused. In strict mode though +// // we'll have to reparse the nodes (and generate an error for 'package();' +// // +// // Note: in this test we don't actually remove 'use strict'. This is so we can compare +// // reuse with/without a strict mode change. +// var source = "'strict';\r\nfoo1();\r\nfoo1();\r\nfoo1();\r\npackage();"; + +// var index = source.indexOf('f'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, 0, index); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Strict mode 4',() => { +// // In non-strict mode 'package' means nothing and can be reused. In strict mode though +// // we'll have to reparse the nodes (and generate an error for 'package();' +// var source = "'use strict';\r\nfoo1();\r\nfoo1();\r\nfoo1();\r\npackage();"; + +// var index = source.indexOf('f'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, 0, index); + +// // Note the decreased reuse of nodes compared to testStrictMode3 +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Strict mode 5',() => { +// var source = "'use blahhh';\r\nfoo1();\r\nfoo2();\r\nfoo3();\r\nfoo4();\r\nfoo4();\r\nfoo6();\r\nfoo7();\r\nfoo8();\r\nfoo9();\r\n"; + +// var index = source.indexOf('b'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, index, 6, "strict"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Strict mode 6',() => { +// var source = "'use strict';\r\nfoo1();\r\nfoo2();\r\nfoo3();\r\nfoo4();\r\nfoo4();\r\nfoo6();\r\nfoo7();\r\nfoo8();\r\nfoo9();\r\n"; + +// var index = source.indexOf('s'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, index, 6, "blahhh"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Strict mode 7',() => { +// var source = "'use blahhh';\r\nfoo1();\r\nfoo2();\r\nfoo3();\r\nfoo4();\r\nfoo4();\r\nfoo6();\r\nfoo7();\r\nfoo8();\r\nfoo9();\r\n"; + +// var index = source.indexOf('f'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, 0, index); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Parenthesized expression to arrow function 1',() => { +// var source = "var v = (a, b, c, d, e)"; + +// var index = source.indexOf('a'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index + 1, ":"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Parenthesized expression to arrow function 2',() => { +// var source = "var v = (a, b) = c"; + +// var index = source.indexOf("= c") + 1; +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index, ">"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Arrow function to parenthesized expression 1',() => { +// var source = "var v = (a:, b, c, d, e)"; + +// var index = source.indexOf(':'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, index, 1); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Arrow function to parenthesized expression 2',() => { +// var source = "var v = (a, b) => c"; + +// var index = source.indexOf(">"); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, index, 1); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Speculative generic lookahead 1',() => { +// var source = "var v = Fe"; + +// var index = source.indexOf('b'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index + 1, ",x"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1); +// }); + +// it('Speculative generic lookahead 2',() => { +// var source = "var v = Fe"; + +// var index = source.indexOf('b'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index + 1, ",x"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1); +// }); + +// it('Speculative generic lookahead 3',() => { +// var source = "var v = Fe"; + +// var index = source.indexOf('b'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index + 1, ",x"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1); +// }); + +// it('Speculative generic lookahead 4',() => { +// var source = "var v = Fe"; + +// var index = source.indexOf('b'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index + 1, ",x"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1); +// }); + +// it('Assertion to arrow function',() => { +// var source = "var v = (a);"; + +// var index = source.indexOf(';'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index, " => 1"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Arrow function to assertion',() => { +// var source = "var v = (a) => 1;"; + +// var index = source.indexOf(' =>'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, index, " => 1".length); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Contextual shift to shift-equals',() => { +// var source = "var v = 1 >> = 2"; + +// var index = source.indexOf('>> ='); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, index + 2, 1); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Contextual shift-equals to shift',() => { +// var source = "var v = 1 >>= 2"; + +// var index = source.indexOf('>>='); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index + 2, " "); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Contextual shift to generic invocation',() => { +// var source = "var v = T>>(2)"; + +// var index = source.indexOf('T'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, index, "Foo { +// var source = "var v = Foo>(2)"; + +// var index = source.indexOf('Foo { +// var source = "var v = T>>=2;"; + +// var index = source.indexOf('='); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, index, "= ".length, ": Foo { +// var source = "var v : Foo>=2;"; + +// var index = source.indexOf(':'); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, index, ": Foo0"; + +// var index = source.indexOf("0"); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, index, 1, "()"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Type argument list to arithmetic operator',() => { +// var source = "var v = new Dictionary()"; + +// var index = source.indexOf("()"); +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, index, 2); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Yield context 1',() => { +// // We're changing from a non-generator to a genarator. We can't reuse statement nodes. +// var source = "function foo() {\r\nyield(foo1);\r\n}"; + +// var oldText = ScriptSnapshot.fromString(source); +// var index = source.indexOf("foo"); +// var newTextAndChange = withInsert(oldText, index, "*"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Yield context 2',() => { +// // We're changing from a generator to a non-genarator. We can't reuse statement nodes. +// var source = "function *foo() {\r\nyield(foo1);\r\n}"; + +// var oldText = ScriptSnapshot.fromString(source); +// var index = source.indexOf("*"); +// var newTextAndChange = withDelete(oldText, index, "*".length); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Delete semicolon',() => { +// var source = "export class Foo {\r\n}\r\n\r\nexport var foo = new Foo();\r\n\r\n export function test(foo: Foo) {\r\n return true;\r\n }\r\n"; + +// var oldText = ScriptSnapshot.fromString(source); +// var index = source.lastIndexOf(";"); +// var newTextAndChange = withDelete(oldText, index, 1); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4); +// }); + +// it('Edit after empty type parameter list',() => { +// var source = "class Dictionary<> { }\r\nvar y;\r\n"; + +// var oldText = ScriptSnapshot.fromString(source); +// var index = source.length; +// var newTextAndChange = withInsert(oldText, index, "var x;"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Delete parameter after comment',() => { +// var source = "function fn(/* comment! */ a: number, c) { }"; + +// var oldText = ScriptSnapshot.fromString(source); +// var index = source.indexOf("a:"); +// var newTextAndChange = withDelete(oldText, index, "a: number,".length); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Modifier added to accessor',() => { +// var source = +// "class C {\ +// set Bar(bar:string) {}\ +//}\ +//var o2 = { set Foo(val:number) { } };"; + +// var oldText = ScriptSnapshot.fromString(source); +// var index = source.indexOf("set"); +// var newTextAndChange = withInsert(oldText, index, "public "); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 6); +// }); + +// it('Insert parameter ahead of parameter',() => { +// var source = +// "alert(100);\ +//\ +//class OverloadedMonster {\ +//constructor();\ +//constructor(name) { }\ +//}"; + +// var oldText = ScriptSnapshot.fromString(source); +// var index = source.indexOf("100"); +// var newTextAndChange = withInsert(oldText, index, "'1', "); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 5); +// }); + +// it('Insert declare modifier before module',() => { +// var source = +// "module mAmbient {\ +//module m3 { }\ +//}"; + +// var oldText = ScriptSnapshot.fromString(source); +// var index = 0; +// var newTextAndChange = withInsert(oldText, index, "declare "); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 3); +// }); + +// it('Insert function above arrow function with comment',() => { +// var source = +// "\ +//() =>\ +// // do something\ +//0;"; + +// var oldText = ScriptSnapshot.fromString(source); +// var index = 0; +// var newTextAndChange = withInsert(oldText, index, "function Foo() { }"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Finish incomplete regular expression',() => { +// var source = "while (true) /3; return;" + +// var oldText = ScriptSnapshot.fromString(source); +// var index = source.length - 1; +// var newTextAndChange = withInsert(oldText, index, "/"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Regular expression to divide operation',() => { +// var source = "return;\r\nwhile (true) /3/g;" + +// var oldText = ScriptSnapshot.fromString(source); +// var index = source.indexOf("while"); +// var newTextAndChange = withDelete(oldText, index, "while ".length); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Divide operation to regular expression',() => { +// var source = "return;\r\n(true) /3/g;" + +// var oldText = ScriptSnapshot.fromString(source); +// var index = source.indexOf("("); +// var newTextAndChange = withInsert(oldText, index, "while "); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Unterminated comment after keyword converted to identifier',() => { +// // 'public' as a keyword should be incrementally unusable (because it has an +// // unterminated comment). When we convert it to an identifier, that shouldn't +// // change anything, and we should still get the same errors. +// var source = "return; a.public /*" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, 0, ""); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 8); +// }); + +// it('Class to interface',() => { +// var source = "class A { public M1() { } public M2() { } public M3() { } p1 = 0; p2 = 0; p3 = 0 }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 0, "class".length, "interface"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Interface to class',() => { +// var source = "interface A { M1?(); M2?(); M3?(); p1?; p2?; p3? }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 0, "interface".length, "class"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Surrounding function declarations with block',() => { +// var source = "declare function F1() { } export function F2() { } declare export function F3() { }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withInsert(oldText, 0, "{"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 9); +// }); + +// it('Removing block around function declarations',() => { +// var source = "{ declare function F1() { } export function F2() { } declare export function F3() { }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withDelete(oldText, 0, "{".length); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Moving methods from class to object literal',() => { +// var source = "class C { public A() { } public B() { } public C() { } }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 0, "class C".length, "var v ="); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Moving methods from object literal to class',() => { +// var source = "var v = { public A() { } public B() { } public C() { } }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 0, "var v =".length, "class C"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); // As specified in ES6 specification, all parts of a ClassDeclaration or a ClassExpression are strict mode code. +// }); + +// it('Moving methods from object literal to class in strict mode', () => { +// var source = "\"use strict\"; var v = { public A() { } public B() { } public C() { } }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 14, "var v =".length, "class C"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4); +// }); + +// it('Moving index signatures from class to interface',() => { +// var source = "class C { public [a: number]: string; public [a: number]: string; public [a: number]: string }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 0, "class".length, "interface"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); // As specified in ES6 specification, all parts of a ClassDeclaration or a ClassExpression are strict mode code. +// }); + +// it('Moving index signatures from class to interface in strict mode', () => { +// var source = "\"use strict\"; class C { public [a: number]: string; public [a: number]: string; public [a: number]: string }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 14, "class".length, "interface"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 18); +// }); + +// it('Moving index signatures from interface to class',() => { +// var source = "interface C { public [a: number]: string; public [a: number]: string; public [a: number]: string }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 0, "interface".length, "class"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); // As specified in ES6 specification, all parts of a ClassDeclaration or a ClassExpression are strict mode code. +// }); + + +// it('Moving index signatures from interface to class in strict mode', () => { +// var source = "\"use strict\"; interface C { public [a: number]: string; public [a: number]: string; public [a: number]: string }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 14, "interface".length, "class"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 18); +// }); + +// it('Moving accessors from class to object literal',() => { +// var source = "class C { public get A() { } public get B() { } public get C() { } }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 0, "class C".length, "var v ="); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); +// }); + +// it('Moving accessors from object literal to class',() => { +// var source = "var v = { public get A() { } public get B() { } public get C() { } }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 0, "var v =".length, "class C"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); // As specified in ES6 specification, all parts of a ClassDeclaration or a ClassExpression are strict mode code. +// }); + + +// it('Moving accessors from object literal to class in strict mode', () => { +// var source = "\"use strict\"; var v = { public get A() { } public get B() { } public get C() { } }" + +// var oldText = ScriptSnapshot.fromString(source); +// var newTextAndChange = withChange(oldText, 14, "var v =".length, "class C"); + +// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4); +// }); + +// // Simulated typing tests. + +// it('Type extends clause 1',() => { +// var source = "interface IFoo { }\r\ninterface Array extends IFoo { }"; + +// var index = source.indexOf('extends'); +// deleteCode(source, index, "extends IFoo"); +// }); + +// it('Type after incomplete enum 1',() => { +// var source = "function foo() {\r\n" + +// " function getOccurrencesAtPosition() {\r\n" + +// " switch (node) {\r\n" + +// " enum \r\n" + +// " }\r\n" + +// " \r\n" + +// " return undefined;\r\n" + +// " \r\n" + +// " function keywordToReferenceEntry() {\r\n" + +// " }\r\n" + +// " }\r\n" + +// " \r\n" + +// " return {\r\n" + +// " getEmitOutput: (fileName): Bar => null,\r\n" + +// " };\r\n" + +// " }"; + +// var index = source.indexOf("enum ") + "enum ".length; +// insertCode(source, index, "Fo"); +// }); +// }); +//} \ No newline at end of file From bf565c70a404a3f40740cd756deba1f7b37a4358 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 12:21:11 -0700 Subject: [PATCH 22/61] Use assert --- tests/cases/unittests/versionCache.ts | 215 ++++++++------------------ 1 file changed, 63 insertions(+), 152 deletions(-) diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts index a2b1d5e585a..2dcf11a6278 100644 --- a/tests/cases/unittests/versionCache.ts +++ b/tests/cases/unittests/versionCache.ts @@ -1,23 +1,17 @@ -/// +/// /// module ts{ - var gloError = false; - function editFlat(s: number, dl: number, nt: string, source: string) { return source.substring(0, s) + nt + source.substring(s + dl, source.length); } - var testDataDir = "../../tests/versionCacheTest/"; + var testDataDir = "..\..\..\src\compiler"; function bigTest() { - editStress("types.ts", false); - editStress("tst.ts", false); - editStress("client.ts", false); - } - - function recordError() { - gloError = true; + editStress("scanner.ts", false); + editStress("sys.ts", false); + editStress("binder.ts", false); } function tstTest() { @@ -45,10 +39,8 @@ module ts{ checkText = editFlat(pos, 0, insertString, content); snapshot = lineIndex.edit(pos, 0, insertString); editedText = snapshot.getText(0, checkText.length); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // change 9 2 0 1 {"."} var pos = lineColToPosition(snapshot, 9, 2); @@ -56,10 +48,8 @@ module ts{ checkText = editFlat(pos, 0, insertString, checkText); snapshot = snapshot.edit(pos, 0, insertString); editedText = snapshot.getText(0, checkText.length); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // change 9 3 0 1 {"\n"} var pos = lineColToPosition(snapshot, 9, 3); @@ -67,10 +57,8 @@ module ts{ checkText = editFlat(pos, 0, insertString, checkText); snapshot = snapshot.edit(pos, 0, insertString); editedText = snapshot.getText(0, checkText.length); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // change 10 1 0 10 {"\n\n\n\n\n\n\n\n\n\n"} pos = lineColToPosition(snapshot, 10, 1); @@ -78,30 +66,24 @@ module ts{ checkText = editFlat(pos, 0, insertString, checkText); snapshot = snapshot.edit(pos, 0, insertString); editedText = snapshot.getText(0, checkText.length); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // change 19 1 1 0 pos = lineColToPosition(snapshot, 19, 1); checkText = editFlat(pos, 1, "", checkText); snapshot = snapshot.edit(pos, 1); editedText = snapshot.getText(0, checkText.length); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // change 18 1 1 0 pos = lineColToPosition(snapshot, 18, 1); checkText = editFlat(pos, 1, "", checkText); snapshot = snapshot.edit(pos, 1); editedText = snapshot.getText(0, checkText.length); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); function lineColToPosition(lineIndex: server.LineIndex, line: number, col: number) { var lineInfo = lineIndex.lineNumberToInfo(line); @@ -133,75 +115,59 @@ module ts{ checkText = editFlat(content.length, 0, insertString, content); snapshot = lineIndex.edit(content.length, 0, insertString); editedText = snapshot.getText(0, checkText.length); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // Case IV: unusual line endings merge snapshot = lineIndex.edit(lines[0].length - 1, lines[1].length, ""); editedText = snapshot.getText(0, content.length - lines[1].length); checkText = editFlat(lines[0].length - 1, lines[1].length, "", content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // Case VIIa: delete whole line and nothing but line (last line) var llpos = lm.lineMap[lm.lineMap.length - 2]; snapshot = lineIndex.edit(llpos, lines[lines.length - 1].length, ""); checkText = editFlat(llpos, lines[lines.length - 1].length, "", content); editedText = snapshot.getText(0, checkText.length); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // Case VIIb: delete whole line and nothing but line (first line) snapshot = lineIndex.edit(0, lines[0].length, ""); editedText = snapshot.getText(0, content.length - lines[0].length); checkText = editFlat(0, lines[0].length, "", content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // and insert with no line breaks insertString = "moo, moo, moo! "; snapshot = lineIndex.edit(0, lines[0].length, insertString); editedText = snapshot.getText(0, content.length - lines[0].length + insertString.length); checkText = editFlat(0, lines[0].length, insertString, content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // and insert with multiple line breaks insertString = "moo, \r\nmoo, \r\nmoo! "; snapshot = lineIndex.edit(0, lines[0].length, insertString); editedText = snapshot.getText(0, content.length - lines[0].length + insertString.length); checkText = editFlat(0, lines[0].length, insertString, content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); snapshot = lineIndex.edit(0, lines[0].length + lines[1].length, ""); editedText = snapshot.getText(0, content.length - (lines[0].length + lines[1].length)); checkText = editFlat(0, lines[0].length + lines[1].length, "", content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); snapshot = lineIndex.edit(lines[0].length, lines[1].length + lines[2].length, ""); editedText = snapshot.getText(0, content.length - (lines[1].length + lines[2].length)); checkText = editFlat(lines[0].length, lines[1].length + lines[2].length, "", content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // Case VI: insert multiple line breaks @@ -209,91 +175,71 @@ module ts{ snapshot = lineIndex.edit(21, 1, insertString); editedText = snapshot.getText(0, content.length + insertString.length - 1); checkText = editFlat(21, 1, insertString, content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); insertString = "cr...\r\ncr...\r\ncr"; snapshot = lineIndex.edit(21, 1, insertString); editedText = snapshot.getText(0, content.length + insertString.length - 1); checkText = editFlat(21, 1, insertString, content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // leading '\n' insertString = "\ncr...\r\ncr...\r\ncr"; snapshot = lineIndex.edit(21, 1, insertString); editedText = snapshot.getText(0, content.length + insertString.length - 1); checkText = editFlat(21, 1, insertString, content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // Case I: single line no line breaks deleted or inserted // delete 1 char snapshot = lineIndex.edit(21, 1); editedText = snapshot.getText(0, content.length - 1); checkText = editFlat(21, 1, "", content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // insert 1 char snapshot = lineIndex.edit(21, 0, "b"); editedText = snapshot.getText(0, content.length + 1); checkText = editFlat(21, 0, "b", content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // delete 1, insert 2 snapshot = lineIndex.edit(21, 1, "cr"); editedText = snapshot.getText(0, content.length + 1); checkText = editFlat(21, 1, "cr", content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // Case II: delete across line break snapshot = lineIndex.edit(21, 22); editedText = snapshot.getText(0, content.length - 22); checkText = editFlat(21, 22, "", content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); snapshot = lineIndex.edit(21, 32); editedText = snapshot.getText(0, content.length - 32); checkText = editFlat(21, 32, "", content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); // Case III: delete across multiple line breaks and insert no line breaks snapshot = lineIndex.edit(21, 42); editedText = snapshot.getText(0, content.length - 42); checkText = editFlat(21, 42, "", content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); snapshot = lineIndex.edit(21, 42, "slithery "); editedText = snapshot.getText(0, content.length - 33); checkText = editFlat(21, 42, "slithery ", content); - if (editedText != checkText) { - recordError(); - return; - } + + assert.equal(editedText, checkText); } function editStress(fname: string, timing: boolean) { @@ -346,10 +292,7 @@ module ts{ var s2 = lineIndex.getText(rsa[j], la[j]); if (!timing) { var s1 = content.substring(rsa[j], rsa[j] + la[j]); - if (s1 != s2) { - recordError(); - return; - } + assert.equal(s1, s2); } } if (timing) { @@ -363,10 +306,7 @@ module ts{ var s2 = lineIndex.getText(rsa[j], las[j]); if (!timing) { var s1 = content.substring(rsa[j], rsa[j] + las[j]); - if (s1 != s2) { - recordError(); - return; - } + assert.equal(s1, s2); } } // console.log("check2"); @@ -385,10 +325,7 @@ module ts{ var checkText = editFlat(rsa[j], las[j], insertString, content); var snapText = snapshot.getText(0, checkText.length); if (checkText != snapText) { - if (s1 != s2) { - recordError(); - return; - } + assert.equal(s1, s2); } } } @@ -413,10 +350,7 @@ module ts{ if (!timing) { snapText = snap.getText(0, checkText.length); if (checkText != snapText) { - if (s1 != s2) { - recordError(); - return; - } + assert.equal(s1, s2); } } } @@ -436,10 +370,7 @@ module ts{ checkText = editFlat(rsa[j], la[j], insertString, content); snapText = snapshot.getText(0, checkText.length); if (checkText != snapText) { - if (s1 != s2) { - recordError(); - return; - } + assert.equal(s1, s2); } } } @@ -456,18 +387,9 @@ module ts{ for (j = 0; j < 100000; j++) { var lp = lineIndex.charOffsetToLineNumberAndPos(rsa[j]); if (!timing) { - var lac = ts.getLineAndCharacterOfPosition(lineMap, rsa[j]); - - if (lac.line != lp.line) { - recordError(); - console.log("arrgh " + lac.line + " " + lp.line + " " + j); - return; - } - if (lac.character != (lp.offset + 1)) { - recordError(); - console.log("arrgh ch... " + lac.character + " " + (lp.offset + 1) + " " + j); - return; - } + var lac = ts.computeLineAndCharacterOfPosition(lineMap, rsa[j]); + assert.equal(lac.line, lp.line, "Line number mismatch " + lac.line + " " + lp.line + " " + j); + assert.equal(lac.character, (lp.offset + 1), "Charachter offset mismatch " + lac.character + " " + (lp.offset + 1) + " " + j); } } // console.log("check6"); @@ -489,10 +411,7 @@ module ts{ var lineIndexOffset = lineInfo.offset; if (!timing) { var lineMapOffset = lineMap[k]; - if (lineIndexOffset != lineMapOffset) { - recordError(); - return; - } + assert.equal(lineIndexOffset, lineMapOffset); } } } @@ -504,15 +423,7 @@ module ts{ function edTest() { editTest(); tstTest(); - if (!gloError) { - bigTest(); - } - if (gloError) { - console.log(" ! Fail: versionCache"); - } - else { - console.log("Pass"); - } + bigTest(); } edTest(); From b6d5781c117cfc738dd4eb79fb51f44050aeb18d Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 12:25:44 -0700 Subject: [PATCH 23/61] Remove commented code --- tests/cases/unittests/versionCache.ts | 828 -------------------------- 1 file changed, 828 deletions(-) diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts index 2dcf11a6278..8a4d1b1af0d 100644 --- a/tests/cases/unittests/versionCache.ts +++ b/tests/cases/unittests/versionCache.ts @@ -428,831 +428,3 @@ module ts{ edTest(); } - - -//module ts { -// ts.disableIncrementalParsing = false; - -// function withChange(text: IScriptSnapshot, start: number, length: number, newText: string): { text: IScriptSnapshot; textChangeRange: TextChangeRange; } { -// var contents = text.getText(0, text.getLength()); -// var newContents = contents.substr(0, start) + newText + contents.substring(start + length); - -// return { text: ScriptSnapshot.fromString(newContents), textChangeRange: createTextChangeRange(createTextSpan(start, length), newText.length) } -// } - -// function withInsert(text: IScriptSnapshot, start: number, newText: string): { text: IScriptSnapshot; textChangeRange: TextChangeRange; } { -// return withChange(text, start, 0, newText); -// } - -// function withDelete(text: IScriptSnapshot, start: number, length: number): { text: IScriptSnapshot; textChangeRange: TextChangeRange; } { -// return withChange(text, start, length, ""); -// } - -// function createTree(text: IScriptSnapshot, version: string) { -// return createLanguageServiceSourceFile(/*fileName:*/ "", text, ScriptTarget.Latest, version, /*setNodeParents:*/ true) -// } - -// function assertSameDiagnostics(file1: SourceFile, file2: SourceFile) { -// var diagnostics1 = file1.parseDiagnostics; -// var diagnostics2 = file2.parseDiagnostics; - -// assert.equal(diagnostics1.length, diagnostics2.length, "diagnostics1.length !== diagnostics2.length"); -// for (var i = 0, n = diagnostics1.length; i < n; i++) { -// var d1 = diagnostics1[i]; -// var d2 = diagnostics2[i]; - -// assert.equal(d1.file, file1, "d1.file !== file1"); -// assert.equal(d2.file, file2, "d2.file !== file2"); -// assert.equal(d1.start, d2.start, "d1.start !== d2.start"); -// assert.equal(d1.length, d2.length, "d1.length !== d2.length"); -// assert.equal(d1.messageText, d2.messageText, "d1.messageText !== d2.messageText"); -// assert.equal(d1.category, d2.category, "d1.category !== d2.category"); -// assert.equal(d1.code, d2.code, "d1.code !== d2.code"); -// } -// } - -// // NOTE: 'reusedElements' is the expected count of elements reused from the old tree to the new -// // tree. It may change as we tweak the parser. If the count increases then that should always -// // be a good thing. If it decreases, that's not great (less reusability), but that may be -// // unavoidable. If it does decrease an investigation should be done to make sure that things -// // are still ok and we're still appropriately reusing most of the tree. -// function compareTrees(oldText: IScriptSnapshot, newText: IScriptSnapshot, textChangeRange: TextChangeRange, expectedReusedElements: number, oldTree?: SourceFile): SourceFile { -// oldTree = oldTree || createTree(oldText, /*version:*/ "."); -// Utils.assertInvariants(oldTree, /*parent:*/ undefined); - -// // Create a tree for the new text, in a non-incremental fashion. -// var newTree = createTree(newText, oldTree.version + "."); -// Utils.assertInvariants(newTree, /*parent:*/ undefined); - -// // Create a tree for the new text, in an incremental fashion. -// var incrementalNewTree = updateLanguageServiceSourceFile(oldTree, newText, oldTree.version + ".", textChangeRange); -// Utils.assertInvariants(incrementalNewTree, /*parent:*/ undefined); - -// // We should get the same tree when doign a full or incremental parse. -// Utils.assertStructuralEquals(newTree, incrementalNewTree); - -// // We should also get the exact same set of diagnostics. -// assertSameDiagnostics(newTree, incrementalNewTree); - -// // There should be no reused nodes between two trees that are fully parsed. -// assert.isTrue(reusedElements(oldTree, newTree) === 0); - -// assert.equal(newTree.fileName, incrementalNewTree.fileName, "newTree.fileName !== incrementalNewTree.fileName"); -// assert.equal(newTree.text, incrementalNewTree.text, "newTree.text !== incrementalNewTree.text"); - -// if (expectedReusedElements !== -1) { -// var actualReusedCount = reusedElements(oldTree, incrementalNewTree); -// assert.equal(actualReusedCount, expectedReusedElements, actualReusedCount + " !== " + expectedReusedElements); -// } - -// return incrementalNewTree; -// } - -// function reusedElements(oldNode: SourceFile, newNode: SourceFile): number { -// var allOldElements = collectElements(oldNode); -// var allNewElements = collectElements(newNode); - -// return filter(allOldElements, v => contains(allNewElements, v)).length; -// } - -// function collectElements(node: Node) { -// var result: Node[] = []; -// visit(node); -// return result; - -// function visit(node: Node) { -// result.push(node); -// forEachChild(node, visit); -// } -// } - -// function deleteCode(source: string, index: number, toDelete: string) { -// var repeat = toDelete.length; -// var oldTree = createTree(ScriptSnapshot.fromString(source), /*version:*/ "."); -// for (var i = 0; i < repeat; i++) { -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, index, 1); -// var newTree = compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1, oldTree); - -// source = newTextAndChange.text.getText(0, newTextAndChange.text.getLength()); -// oldTree = newTree; -// } -// } - -// function insertCode(source: string, index: number, toInsert: string) { -// var repeat = toInsert.length; -// var oldTree = createTree(ScriptSnapshot.fromString(source), /*version:*/ "."); -// for (var i = 0; i < repeat; i++) { -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index + i, toInsert.charAt(i)); -// var newTree = compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1, oldTree); - -// source = newTextAndChange.text.getText(0, newTextAndChange.text.getLength()); -// oldTree = newTree; -// } -// } - -// describe('Incremental',() => { -// it('Inserting into method',() => { -// var source = "class C {\r\n" + -// " public foo1() { }\r\n" + -// " public foo2() {\r\n" + -// " return 1;\r\n" + -// " }\r\n" + -// " public foo3() { }\r\n" + -// "}"; - -// var oldText = ScriptSnapshot.fromString(source); -// var semicolonIndex = source.indexOf(";"); -// var newTextAndChange = withInsert(oldText, semicolonIndex, " + 1"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 8); -// }); - -// it('Deleting from method',() => { -// var source = "class C {\r\n" + -// " public foo1() { }\r\n" + -// " public foo2() {\r\n" + -// " return 1 + 1;\r\n" + -// " }\r\n" + -// " public foo3() { }\r\n" + -// "}"; - -// var index = source.indexOf("+ 1"); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, index, "+ 1".length); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 8); -// }); - -// it('Regular expression 1',() => { -// var source = "class C { public foo1() { /; } public foo2() { return 1;} public foo3() { } }"; - -// var semicolonIndex = source.indexOf(";}"); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, semicolonIndex, "/"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Regular expression 2',() => { -// var source = "class C { public foo1() { ; } public foo2() { return 1/;} public foo3() { } }"; - -// var semicolonIndex = source.indexOf(";"); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, semicolonIndex, "/"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4); -// }); - -// it('Comment 1',() => { -// var source = "class C { public foo1() { /; } public foo2() { return 1; } public foo3() { } }"; - -// var semicolonIndex = source.indexOf(";"); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, semicolonIndex, "/"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Comment 2',() => { -// var source = "class C { public foo1() { /; } public foo2() { return 1; } public foo3() { } }"; - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, 0, "//"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Comment 3',() => { -// var source = "//class C { public foo1() { /; } public foo2() { return 1; } public foo3() { } }"; - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, 0, 2); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Comment 4',() => { -// var source = "class C { public foo1() { /; } public foo2() { */ return 1; } public foo3() { } }"; - -// var index = source.indexOf(";"); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index, "*"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4); -// }); - -// it('Parameter 1',() => { -// // Should be able to reuse all the parameters. -// var source = "class C {\r\n" + -// " public foo2(a, b, c, d) {\r\n" + -// " return 1;\r\n" + -// " }\r\n" + -// "}"; - -// var semicolonIndex = source.indexOf(";"); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, semicolonIndex, " + 1"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 8); -// }); - -// it('Type member 1',() => { -// // Should be able to reuse most of the type members. -// var source = "interface I { a: number; b: string; (c): d; new (e): f; g(): h }"; - -// var index = source.indexOf(": string"); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index, "?"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 14); -// }); - -// it('Enum element 1',() => { -// // Should be able to reuse most of the enum elements. -// var source = "enum E { a = 1, b = 1 << 1, c = 3, e = 4, f = 5, g = 7, h = 8, i = 9, j = 10 }"; - -// var index = source.indexOf("<<"); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, index, 2, "+"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 24); -// }); - -// it('Strict mode 1',() => { -// // In non-strict mode 'package' means nothing and can be reused. In strict mode though -// // we'll have to reparse the nodes (and generate an error for 'package();' -// // -// // Note: in this test we don't actually add 'use strict'. This is so we can compare -// // reuse with/without a strict mode change. -// var source = "foo1();\r\nfoo1();\r\nfoo1();\r\package();"; - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, 0, "'strict';\r\n"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Strict mode 2',() => { -// // In non-strict mode 'package' means nothing and can be reused. In strict mode though -// // we'll have to reparse the nodes (and generate an error for 'package();' -// var source = "foo1();\r\nfoo1();\r\nfoo1();\r\package();"; - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, 0, "'use strict';\r\n"); - -// // Note the decreased reuse of nodes compared to 'Strict mode 1' -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Strict mode 3',() => { -// // In non-strict mode 'package' means nothing and can be reused. In strict mode though -// // we'll have to reparse the nodes (and generate an error for 'package();' -// // -// // Note: in this test we don't actually remove 'use strict'. This is so we can compare -// // reuse with/without a strict mode change. -// var source = "'strict';\r\nfoo1();\r\nfoo1();\r\nfoo1();\r\npackage();"; - -// var index = source.indexOf('f'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, 0, index); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Strict mode 4',() => { -// // In non-strict mode 'package' means nothing and can be reused. In strict mode though -// // we'll have to reparse the nodes (and generate an error for 'package();' -// var source = "'use strict';\r\nfoo1();\r\nfoo1();\r\nfoo1();\r\npackage();"; - -// var index = source.indexOf('f'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, 0, index); - -// // Note the decreased reuse of nodes compared to testStrictMode3 -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Strict mode 5',() => { -// var source = "'use blahhh';\r\nfoo1();\r\nfoo2();\r\nfoo3();\r\nfoo4();\r\nfoo4();\r\nfoo6();\r\nfoo7();\r\nfoo8();\r\nfoo9();\r\n"; - -// var index = source.indexOf('b'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, index, 6, "strict"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Strict mode 6',() => { -// var source = "'use strict';\r\nfoo1();\r\nfoo2();\r\nfoo3();\r\nfoo4();\r\nfoo4();\r\nfoo6();\r\nfoo7();\r\nfoo8();\r\nfoo9();\r\n"; - -// var index = source.indexOf('s'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, index, 6, "blahhh"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Strict mode 7',() => { -// var source = "'use blahhh';\r\nfoo1();\r\nfoo2();\r\nfoo3();\r\nfoo4();\r\nfoo4();\r\nfoo6();\r\nfoo7();\r\nfoo8();\r\nfoo9();\r\n"; - -// var index = source.indexOf('f'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, 0, index); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Parenthesized expression to arrow function 1',() => { -// var source = "var v = (a, b, c, d, e)"; - -// var index = source.indexOf('a'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index + 1, ":"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Parenthesized expression to arrow function 2',() => { -// var source = "var v = (a, b) = c"; - -// var index = source.indexOf("= c") + 1; -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index, ">"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Arrow function to parenthesized expression 1',() => { -// var source = "var v = (a:, b, c, d, e)"; - -// var index = source.indexOf(':'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, index, 1); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Arrow function to parenthesized expression 2',() => { -// var source = "var v = (a, b) => c"; - -// var index = source.indexOf(">"); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, index, 1); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Speculative generic lookahead 1',() => { -// var source = "var v = Fe"; - -// var index = source.indexOf('b'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index + 1, ",x"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1); -// }); - -// it('Speculative generic lookahead 2',() => { -// var source = "var v = Fe"; - -// var index = source.indexOf('b'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index + 1, ",x"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1); -// }); - -// it('Speculative generic lookahead 3',() => { -// var source = "var v = Fe"; - -// var index = source.indexOf('b'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index + 1, ",x"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1); -// }); - -// it('Speculative generic lookahead 4',() => { -// var source = "var v = Fe"; - -// var index = source.indexOf('b'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index + 1, ",x"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1); -// }); - -// it('Assertion to arrow function',() => { -// var source = "var v = (a);"; - -// var index = source.indexOf(';'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index, " => 1"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Arrow function to assertion',() => { -// var source = "var v = (a) => 1;"; - -// var index = source.indexOf(' =>'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, index, " => 1".length); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Contextual shift to shift-equals',() => { -// var source = "var v = 1 >> = 2"; - -// var index = source.indexOf('>> ='); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, index + 2, 1); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Contextual shift-equals to shift',() => { -// var source = "var v = 1 >>= 2"; - -// var index = source.indexOf('>>='); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index + 2, " "); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Contextual shift to generic invocation',() => { -// var source = "var v = T>>(2)"; - -// var index = source.indexOf('T'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, index, "Foo { -// var source = "var v = Foo>(2)"; - -// var index = source.indexOf('Foo { -// var source = "var v = T>>=2;"; - -// var index = source.indexOf('='); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, index, "= ".length, ": Foo { -// var source = "var v : Foo>=2;"; - -// var index = source.indexOf(':'); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, index, ": Foo0"; - -// var index = source.indexOf("0"); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, index, 1, "()"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Type argument list to arithmetic operator',() => { -// var source = "var v = new Dictionary()"; - -// var index = source.indexOf("()"); -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, index, 2); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Yield context 1',() => { -// // We're changing from a non-generator to a genarator. We can't reuse statement nodes. -// var source = "function foo() {\r\nyield(foo1);\r\n}"; - -// var oldText = ScriptSnapshot.fromString(source); -// var index = source.indexOf("foo"); -// var newTextAndChange = withInsert(oldText, index, "*"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Yield context 2',() => { -// // We're changing from a generator to a non-genarator. We can't reuse statement nodes. -// var source = "function *foo() {\r\nyield(foo1);\r\n}"; - -// var oldText = ScriptSnapshot.fromString(source); -// var index = source.indexOf("*"); -// var newTextAndChange = withDelete(oldText, index, "*".length); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Delete semicolon',() => { -// var source = "export class Foo {\r\n}\r\n\r\nexport var foo = new Foo();\r\n\r\n export function test(foo: Foo) {\r\n return true;\r\n }\r\n"; - -// var oldText = ScriptSnapshot.fromString(source); -// var index = source.lastIndexOf(";"); -// var newTextAndChange = withDelete(oldText, index, 1); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4); -// }); - -// it('Edit after empty type parameter list',() => { -// var source = "class Dictionary<> { }\r\nvar y;\r\n"; - -// var oldText = ScriptSnapshot.fromString(source); -// var index = source.length; -// var newTextAndChange = withInsert(oldText, index, "var x;"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Delete parameter after comment',() => { -// var source = "function fn(/* comment! */ a: number, c) { }"; - -// var oldText = ScriptSnapshot.fromString(source); -// var index = source.indexOf("a:"); -// var newTextAndChange = withDelete(oldText, index, "a: number,".length); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Modifier added to accessor',() => { -// var source = -// "class C {\ -// set Bar(bar:string) {}\ -//}\ -//var o2 = { set Foo(val:number) { } };"; - -// var oldText = ScriptSnapshot.fromString(source); -// var index = source.indexOf("set"); -// var newTextAndChange = withInsert(oldText, index, "public "); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 6); -// }); - -// it('Insert parameter ahead of parameter',() => { -// var source = -// "alert(100);\ -//\ -//class OverloadedMonster {\ -//constructor();\ -//constructor(name) { }\ -//}"; - -// var oldText = ScriptSnapshot.fromString(source); -// var index = source.indexOf("100"); -// var newTextAndChange = withInsert(oldText, index, "'1', "); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 5); -// }); - -// it('Insert declare modifier before module',() => { -// var source = -// "module mAmbient {\ -//module m3 { }\ -//}"; - -// var oldText = ScriptSnapshot.fromString(source); -// var index = 0; -// var newTextAndChange = withInsert(oldText, index, "declare "); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 3); -// }); - -// it('Insert function above arrow function with comment',() => { -// var source = -// "\ -//() =>\ -// // do something\ -//0;"; - -// var oldText = ScriptSnapshot.fromString(source); -// var index = 0; -// var newTextAndChange = withInsert(oldText, index, "function Foo() { }"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Finish incomplete regular expression',() => { -// var source = "while (true) /3; return;" - -// var oldText = ScriptSnapshot.fromString(source); -// var index = source.length - 1; -// var newTextAndChange = withInsert(oldText, index, "/"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Regular expression to divide operation',() => { -// var source = "return;\r\nwhile (true) /3/g;" - -// var oldText = ScriptSnapshot.fromString(source); -// var index = source.indexOf("while"); -// var newTextAndChange = withDelete(oldText, index, "while ".length); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Divide operation to regular expression',() => { -// var source = "return;\r\n(true) /3/g;" - -// var oldText = ScriptSnapshot.fromString(source); -// var index = source.indexOf("("); -// var newTextAndChange = withInsert(oldText, index, "while "); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Unterminated comment after keyword converted to identifier',() => { -// // 'public' as a keyword should be incrementally unusable (because it has an -// // unterminated comment). When we convert it to an identifier, that shouldn't -// // change anything, and we should still get the same errors. -// var source = "return; a.public /*" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, 0, ""); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 8); -// }); - -// it('Class to interface',() => { -// var source = "class A { public M1() { } public M2() { } public M3() { } p1 = 0; p2 = 0; p3 = 0 }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 0, "class".length, "interface"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Interface to class',() => { -// var source = "interface A { M1?(); M2?(); M3?(); p1?; p2?; p3? }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 0, "interface".length, "class"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Surrounding function declarations with block',() => { -// var source = "declare function F1() { } export function F2() { } declare export function F3() { }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withInsert(oldText, 0, "{"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 9); -// }); - -// it('Removing block around function declarations',() => { -// var source = "{ declare function F1() { } export function F2() { } declare export function F3() { }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withDelete(oldText, 0, "{".length); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Moving methods from class to object literal',() => { -// var source = "class C { public A() { } public B() { } public C() { } }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 0, "class C".length, "var v ="); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Moving methods from object literal to class',() => { -// var source = "var v = { public A() { } public B() { } public C() { } }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 0, "var v =".length, "class C"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); // As specified in ES6 specification, all parts of a ClassDeclaration or a ClassExpression are strict mode code. -// }); - -// it('Moving methods from object literal to class in strict mode', () => { -// var source = "\"use strict\"; var v = { public A() { } public B() { } public C() { } }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 14, "var v =".length, "class C"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4); -// }); - -// it('Moving index signatures from class to interface',() => { -// var source = "class C { public [a: number]: string; public [a: number]: string; public [a: number]: string }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 0, "class".length, "interface"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); // As specified in ES6 specification, all parts of a ClassDeclaration or a ClassExpression are strict mode code. -// }); - -// it('Moving index signatures from class to interface in strict mode', () => { -// var source = "\"use strict\"; class C { public [a: number]: string; public [a: number]: string; public [a: number]: string }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 14, "class".length, "interface"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 18); -// }); - -// it('Moving index signatures from interface to class',() => { -// var source = "interface C { public [a: number]: string; public [a: number]: string; public [a: number]: string }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 0, "interface".length, "class"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); // As specified in ES6 specification, all parts of a ClassDeclaration or a ClassExpression are strict mode code. -// }); - - -// it('Moving index signatures from interface to class in strict mode', () => { -// var source = "\"use strict\"; interface C { public [a: number]: string; public [a: number]: string; public [a: number]: string }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 14, "interface".length, "class"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 18); -// }); - -// it('Moving accessors from class to object literal',() => { -// var source = "class C { public get A() { } public get B() { } public get C() { } }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 0, "class C".length, "var v ="); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); -// }); - -// it('Moving accessors from object literal to class',() => { -// var source = "var v = { public get A() { } public get B() { } public get C() { } }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 0, "var v =".length, "class C"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0); // As specified in ES6 specification, all parts of a ClassDeclaration or a ClassExpression are strict mode code. -// }); - - -// it('Moving accessors from object literal to class in strict mode', () => { -// var source = "\"use strict\"; var v = { public get A() { } public get B() { } public get C() { } }" - -// var oldText = ScriptSnapshot.fromString(source); -// var newTextAndChange = withChange(oldText, 14, "var v =".length, "class C"); - -// compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4); -// }); - -// // Simulated typing tests. - -// it('Type extends clause 1',() => { -// var source = "interface IFoo { }\r\ninterface Array extends IFoo { }"; - -// var index = source.indexOf('extends'); -// deleteCode(source, index, "extends IFoo"); -// }); - -// it('Type after incomplete enum 1',() => { -// var source = "function foo() {\r\n" + -// " function getOccurrencesAtPosition() {\r\n" + -// " switch (node) {\r\n" + -// " enum \r\n" + -// " }\r\n" + -// " \r\n" + -// " return undefined;\r\n" + -// " \r\n" + -// " function keywordToReferenceEntry() {\r\n" + -// " }\r\n" + -// " }\r\n" + -// " \r\n" + -// " return {\r\n" + -// " getEmitOutput: (fileName): Bar => null,\r\n" + -// " };\r\n" + -// " }"; - -// var index = source.indexOf("enum ") + "enum ".length; -// insertCode(source, index, "Fo"); -// }); -// }); -//} \ No newline at end of file From a1e18fc22b650f07088fec86efbc6a0f0685bb83 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 12:29:02 -0700 Subject: [PATCH 24/61] Introduce a new HeritageClauseElment type. This type represents the expression+type arguments you can get in a class or interface heritage clause section. For class-implements clauses, or interface-extends clauses, these expressions can only be identifiers or dotted names. For class extends clauses, these could be any expressions in the future. However, for now, we only support identifiers and dotted names. --- src/compiler/checker.ts | 228 +- src/compiler/declarationEmitter.ts | 39 +- .../diagnosticInformationMap.generated.ts | 3 + src/compiler/diagnosticMessages.json | 12 + src/compiler/emitter.ts | 16 +- src/compiler/parser.ts | 104 +- src/compiler/types.ts | 10 +- src/compiler/utilities.ts | 22 + src/harness/typeWriter.ts | 9 +- src/services/services.ts | 35 +- .../baselines/reference/APISample_compile.js | 111 +- .../reference/APISample_compile.types | 131 +- tests/baselines/reference/APISample_linter.js | 127 +- .../reference/APISample_linter.types | 131 +- .../reference/APISample_linter.types.pull | 6384 +++++++++++++++++ .../reference/APISample_transform.js | 111 +- .../reference/APISample_transform.types | 131 +- .../baselines/reference/APISample_watcher.js | 111 +- .../reference/APISample_watcher.types | 131 +- .../aliasUsageInAccessorsOfClass.types | 2 +- .../reference/aliasUsageInArray.types | 2 +- .../aliasUsageInFunctionExpression.types | 2 +- .../aliasUsageInGenericFunction.types | 2 +- .../aliasUsageInIndexerOfClass.types | 2 +- .../reference/aliasUsageInObjectLiteral.types | 2 +- .../reference/aliasUsageInOrExpression.types | 2 +- .../aliasUsageInOrExpression.types.pull | 2 +- ...asUsageInTypeArgumentOfExtendsClause.types | 2 +- .../reference/aliasUsageInVarAssignment.types | 2 +- .../reference/circularImportAlias.types | 2 +- ...rationMergedInModuleWithContinuation.types | 2 +- .../classExtendingPrimitive.errors.txt | 13 +- .../reference/classExtendingPrimitive.js | 8 +- .../classExtendingPrimitive2.errors.txt | 13 +- .../reference/classExtendingPrimitive2.js | 14 +- .../classExtendingQualifiedName2.types | 2 +- .../classExtendsEveryObjectType.errors.txt | 17 +- .../reference/classExtendsEveryObjectType.js | 15 +- .../classExtendsEveryObjectType2.errors.txt | 17 +- .../reference/classExtendsEveryObjectType2.js | 21 +- .../reference/commentOnAmbientModule.types | 2 +- .../reference/declFileGenericType.types | 4 +- .../reference/declFileGenericType2.types | 18 +- .../declFileModuleContinuation.types | 2 +- ...tingWithClassReferredByExtendsClause.types | 12 +- ...lModuleNameConflictsInExtendsClause1.types | 4 +- ...lModuleNameConflictsInExtendsClause2.types | 2 +- ...lModuleNameConflictsInExtendsClause3.types | 4 +- .../declarationEmit_nameConflicts.types | 10 +- .../reference/declareDottedExtend.types | 6 +- tests/baselines/reference/es6ClassTest7.types | 2 +- tests/baselines/reference/extBaseClass1.types | 2 +- ...ndingClassFromAliasAndUsageInIndexer.types | 4 +- ...assPropertyInheritanceSpecialization.types | 6 +- ...ericConstraintOnExtendedBuiltinTypes.types | 2 +- ...ricConstraintOnExtendedBuiltinTypes2.types | 2 +- .../reference/importUsedInExtendsList1.types | 2 +- ...heritanceOfGenericConstructorMethod2.types | 4 +- ...terfaceMayNotBeExtendedWitACall.errors.txt | 11 +- .../interfaceMayNotBeExtendedWitACall.js | 2 - ...sDeclarationWhenInBaseTypeResolution.types | 94 +- .../thisInInvalidContexts.errors.txt | 9 +- .../reference/thisInInvalidContexts.js | 9 +- ...InInvalidContextsExternalModule.errors.txt | 9 +- .../thisInInvalidContextsExternalModule.js | 9 +- .../completionListInExtendsClause.ts | 6 +- ...etOccurrencesPropertyInAliasedInterface.ts | 2 +- .../fourslash/semanticClassification1.ts | 1 + 68 files changed, 7460 insertions(+), 770 deletions(-) create mode 100644 tests/baselines/reference/APISample_linter.types.pull diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3c0bf39f1fa..e6594ee271c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -582,7 +582,7 @@ module ts { if (moduleSymbol.flags & SymbolFlags.Variable) { let typeAnnotation = (moduleSymbol.valueDeclaration).type; if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); + return getPropertyOfType(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(typeAnnotation), name); } } } @@ -631,7 +631,7 @@ module ts { if (symbol.flags & SymbolFlags.Variable) { var typeAnnotation = (symbol.valueDeclaration).type; if (typeAnnotation) { - return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); + return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(typeAnnotation), name)); } } } @@ -773,7 +773,7 @@ module ts { } // Resolves a qualified name and any involved aliases - function resolveEntityName(name: EntityName, meaning: SymbolFlags): Symbol { + function resolveEntityName(name: EntityName | Expression, meaning: SymbolFlags): Symbol { if (getFullWidth(name) === 0) { return undefined; } @@ -785,18 +785,23 @@ module ts { return undefined; } } - else if (name.kind === SyntaxKind.QualifiedName) { - let namespace = resolveEntityName((name).left, SymbolFlags.Namespace); - if (!namespace || namespace === unknownSymbol || getFullWidth((name).right) === 0) { + else if (name.kind === SyntaxKind.QualifiedName || name.kind === SyntaxKind.PropertyAccessExpression) { + let left = name.kind === SyntaxKind.QualifiedName ? (name).left : (name).expression; + let right = name.kind === SyntaxKind.QualifiedName ? (name).right : (name).name; + + let namespace = resolveEntityName(left, SymbolFlags.Namespace); + if (!namespace || namespace === unknownSymbol || getFullWidth(right) === 0) { return undefined; } - let right = (name).right; symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), declarationNameToString(right)); return undefined; } } + else { + Debug.fail("Unknown entity name kind."); + } Debug.assert((symbol.flags & SymbolFlags.Instantiated) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } @@ -1255,14 +1260,15 @@ module ts { } } - function isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult { + function isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult { + // get symbol of the first identifier of the entityName let meaning: SymbolFlags; if (entityName.parent.kind === SyntaxKind.TypeQuery) { // Typeof value meaning = SymbolFlags.Value | SymbolFlags.ExportValue; } - else if (entityName.kind === SyntaxKind.QualifiedName || + else if (entityName.kind === SyntaxKind.QualifiedName || entityName.kind === SyntaxKind.PropertyAccessExpression || entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration @@ -2088,7 +2094,7 @@ module ts { } // Use type from type annotation if one is present if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type); } if (declaration.kind === SyntaxKind.Parameter) { let func = declaration.parent; @@ -2225,7 +2231,7 @@ module ts { return links.type = checkExpression(exportAssignment.expression); } else if (exportAssignment.type) { - return links.type = getTypeFromTypeNode(exportAssignment.type); + return links.type = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(exportAssignment.type); } else { return links.type = anyType; @@ -2257,11 +2263,11 @@ module ts { function getAnnotatedAccessorType(accessor: AccessorDeclaration): Type { if (accessor) { if (accessor.kind === SyntaxKind.GetAccessor) { - return accessor.type && getTypeFromTypeNode(accessor.type); + return accessor.type && getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(accessor.type); } else { let setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation && getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(setterTypeAnnotation); } } return undefined; @@ -2429,7 +2435,7 @@ module ts { let declaration = getDeclarationOfKind(symbol, SyntaxKind.ClassDeclaration); let baseTypeNode = getClassBaseTypeNode(declaration); if (baseTypeNode) { - let baseType = getTypeFromTypeReferenceNode(baseTypeNode); + let baseType = getTypeFromTypeReferenceOrHeritageClauseElement(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & TypeFlags.Class) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -2470,7 +2476,8 @@ module ts { forEach(symbol.declarations, declaration => { if (declaration.kind === SyntaxKind.InterfaceDeclaration && getInterfaceBaseTypeNodes(declaration)) { forEach(getInterfaceBaseTypeNodes(declaration), node => { - let baseType = getTypeFromTypeReferenceNode(node); + let baseType = getTypeFromTypeReferenceOrHeritageClauseElement(node); + if (baseType !== unknownType) { if (getTargetType(baseType).flags & (TypeFlags.Class | TypeFlags.Interface)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -2501,7 +2508,7 @@ module ts { if (!links.declaredType) { links.declaredType = resolvingType; let declaration = getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration); - let type = getTypeFromTypeNode(declaration.type); + let type = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } @@ -3043,7 +3050,7 @@ module ts { returnType = classType; } else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); + returnType = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type); } else { // TypeScript 1.0 spec (April 2014): @@ -3201,7 +3208,7 @@ module ts { function getIndexTypeOfSymbol(symbol: Symbol, kind: IndexKind): Type { let declaration = getIndexDeclarationOfSymbol(symbol, kind); return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType + ? declaration.type ? getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type) : anyType : undefined; } @@ -3212,7 +3219,7 @@ module ts { type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode((getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint); + type.constraint = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement((getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -3260,7 +3267,7 @@ module ts { return type; } - function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode: TypeReferenceNode, typeParameterSymbol: Symbol): boolean { + function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode: TypeReferenceNode | HeritageClauseElement, typeParameterSymbol: Symbol): boolean { let links = getNodeLinks(typeReferenceNode); if (links.isIllegalTypeReferenceInConstraint !== undefined) { return links.isIllegalTypeReferenceInConstraint; @@ -3309,39 +3316,47 @@ module ts { } } - function getTypeFromTypeReferenceNode(node: TypeReferenceNode): Type { + function getTypeFromTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - let symbol = resolveEntityName(node.typeName, SymbolFlags.Type); let type: Type; - if (symbol) { - if ((symbol.flags & SymbolFlags.TypeParameter) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - // TypeScript 1.0 spec (April 2014): 3.4.1 - // Type parameters declared in a particular type parameter list - // may not be referenced in constraints in that type parameter list - // Implementation: such type references are resolved to 'unknown' type that usually denotes error - type = unknownType; - } - else { - type = getDeclaredTypeOfSymbol(symbol); - if (type.flags & (TypeFlags.Class | TypeFlags.Interface) && type.flags & TypeFlags.Reference) { - let typeParameters = (type).typeParameters; - if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, map(node.typeArguments, getTypeFromTypeNode)); - } - else { - error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), typeParameters.length); - type = undefined; - } + + if (node.kind !== SyntaxKind.HeritageClauseElement || isSupportedHeritageClauseElement(node)) { + let typeNameOrExpression = node.kind === SyntaxKind.TypeReference + ? (node).typeName + : (node).expression; + + let symbol = resolveEntityName(typeNameOrExpression, SymbolFlags.Type); + if (symbol) { + if ((symbol.flags & SymbolFlags.TypeParameter) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + // TypeScript 1.0 spec (April 2014): 3.4.1 + // Type parameters declared in a particular type parameter list + // may not be referenced in constraints in that type parameter list + // Implementation: such type references are resolved to 'unknown' type that usually denotes error + type = unknownType; } else { - if (node.typeArguments) { - error(node, Diagnostics.Type_0_is_not_generic, typeToString(type)); - type = undefined; + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (TypeFlags.Class | TypeFlags.Interface) && type.flags & TypeFlags.Reference) { + let typeParameters = (type).typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, map(node.typeArguments, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement)); + } + else { + error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } } } } } + links.resolvedType = type || unknownType; } return links.resolvedType; @@ -3419,7 +3434,7 @@ module ts { function getTypeFromArrayTypeNode(node: ArrayTypeNode): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + links.resolvedType = createArrayType(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.elementType)); } return links.resolvedType; } @@ -3437,7 +3452,7 @@ module ts { function getTypeFromTupleTypeNode(node: TupleTypeNode): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromTypeNode)); + links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement)); } return links.resolvedType; } @@ -3533,7 +3548,7 @@ module ts { function getTypeFromUnionTypeNode(node: UnionTypeNode): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), /*noSubtypeReduction*/ true); + links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement), /*noSubtypeReduction*/ true); } return links.resolvedType; } @@ -3565,7 +3580,7 @@ module ts { return links.resolvedType; } - function getTypeFromTypeNode(node: TypeNode | LiteralExpression): Type { + function getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node: TypeNode | LiteralExpression | HeritageClauseElement): Type { switch (node.kind) { case SyntaxKind.AnyKeyword: return anyType; @@ -3582,7 +3597,9 @@ module ts { case SyntaxKind.StringLiteral: return getTypeFromStringLiteral(node); case SyntaxKind.TypeReference: - return getTypeFromTypeReferenceNode(node); + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + case SyntaxKind.HeritageClauseElement: + return getTypeFromTypeReferenceOrHeritageClauseElement(node); case SyntaxKind.TypeQuery: return getTypeFromTypeQueryNode(node); case SyntaxKind.ArrayType: @@ -3592,7 +3609,7 @@ module ts { case SyntaxKind.UnionType: return getTypeFromUnionTypeNode(node); case SyntaxKind.ParenthesizedType: - return getTypeFromTypeNode((node).type); + return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement((node).type); case SyntaxKind.FunctionType: case SyntaxKind.ConstructorType: case SyntaxKind.TypeLiteral: @@ -5593,7 +5610,7 @@ module ts { let declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type); } if (declaration.kind === SyntaxKind.Parameter) { let type = getContextuallyTypedParameterType(declaration); @@ -5796,7 +5813,7 @@ module ts { case SyntaxKind.NewExpression: return getContextualTypeForArgument(parent, node); case SyntaxKind.TypeAssertionExpression: - return getTypeFromTypeNode((parent).type); + return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement((parent).type); case SyntaxKind.BinaryExpression: return getContextualTypeForBinaryOperand(node); case SyntaxKind.PropertyAssignment: @@ -6597,7 +6614,7 @@ module ts { let typeArgumentsAreAssignable = true; for (let i = 0; i < typeParameters.length; i++) { let typeArgNode = typeArguments[i]; - let typeArgument = getTypeFromTypeNode(typeArgNode); + let typeArgument = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(typeArgNode); // Do not push on this array! It has a preallocated length typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable /* so far */) { @@ -7079,7 +7096,7 @@ module ts { function checkTypeAssertion(node: TypeAssertion): Type { let exprType = checkExpression(node.expression); - let targetType = getTypeFromTypeNode(node.type); + let targetType = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type); if (produceDiagnostics && targetType !== unknownType) { let widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { @@ -7258,7 +7275,7 @@ module ts { function checkFunctionExpressionOrObjectLiteralMethodBody(node: FunctionExpression | MethodDeclaration) { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); if (node.type) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type)); } if (node.body) { @@ -7268,7 +7285,7 @@ module ts { else { let exprType = checkExpression(node.body); if (node.type) { - checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, /*headMessage*/ undefined); + checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type), node.body, /*headMessage*/ undefined); } checkFunctionExpressionBodies(node.body); } @@ -8272,11 +8289,11 @@ module ts { checkDecorators(node); } - function checkTypeReference(node: TypeReferenceNode) { + function checkTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement) { // Grammar checking checkGrammarTypeArguments(node, node.typeArguments); - let type = getTypeFromTypeReferenceNode(node); + let type = getTypeFromTypeReferenceOrHeritageClauseElement(node); if (type !== unknownType && node.typeArguments) { // Do type argument local checks only if referenced type is successfully resolved let len = node.typeArguments.length; @@ -8767,7 +8784,7 @@ module ts { checkSourceElement(node.body); if (node.type && !isAccessor(node.kind)) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type)); } // Report an implicit any error if there is no body, no explicit return type, and node is not a private method @@ -9731,8 +9748,12 @@ module ts { let staticType = getTypeOfSymbol(symbol); let baseTypeNode = getClassBaseTypeNode(node); if (baseTypeNode) { + if (!isSupportedHeritageClauseElement(baseTypeNode)) { + error(baseTypeNode.expression, Diagnostics.Only_type_references_are_currently_supported_in_a_class_extends_clauses); + } + emitExtends = emitExtends || !isInAmbientContext(node); - checkTypeReference(baseTypeNode); + checkTypeReferenceOrHeritageClauseElement(baseTypeNode); } if (type.baseTypes.length) { if (produceDiagnostics) { @@ -9741,7 +9762,8 @@ module ts { let staticBaseType = getTypeOfSymbol(baseType.symbol); checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name || node, Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType.symbol !== resolveEntityName(baseTypeNode.typeName, SymbolFlags.Value)) { + + if (baseType.symbol !== resolveEntityName(baseTypeNode.expression, SymbolFlags.Value)) { error(baseTypeNode, Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); } @@ -9749,15 +9771,19 @@ module ts { } // Check that base type can be evaluated as expression - checkExpressionOrQualifiedName(baseTypeNode.typeName); + checkExpressionOrQualifiedName(baseTypeNode.expression); } let implementedTypeNodes = getClassImplementedTypeNodes(node); if (implementedTypeNodes) { forEach(implementedTypeNodes, typeRefNode => { - checkTypeReference(typeRefNode); + if (!isSupportedHeritageClauseElement(typeRefNode)) { + error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_type_references); + } + + checkTypeReferenceOrHeritageClauseElement(typeRefNode); if (produceDiagnostics) { - let t = getTypeFromTypeReferenceNode(typeRefNode); + let t = getTypeFromTypeReferenceOrHeritageClauseElement(typeRefNode); if (t !== unknownType) { let declaredType = (t.flags & TypeFlags.Reference) ? (t).target : t; if (declaredType.flags & (TypeFlags.Class | TypeFlags.Interface)) { @@ -9879,7 +9905,7 @@ module ts { if (!tp1.constraint || !tp2.constraint) { return false; } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + if (!isTypeIdenticalTo(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(tp2.constraint))) { return false; } } @@ -9950,7 +9976,13 @@ module ts { } } } - forEach(getInterfaceBaseTypeNodes(node), checkTypeReference); + forEach(getInterfaceBaseTypeNodes(node), heritageElement => { + if (!isSupportedHeritageClauseElement(heritageElement)) { + error(heritageElement.expression, Diagnostics.An_interface_can_only_extend_a_type_reference); + } + + checkTypeReferenceOrHeritageClauseElement(heritageElement); + }); forEach(node.members, checkSourceElement); if (produceDiagnostics) { @@ -10248,10 +10280,19 @@ module ts { checkSourceElement(node.body); } - function getFirstIdentifier(node: EntityName): Identifier { - while (node.kind === SyntaxKind.QualifiedName) { - node = (node).left; + function getFirstIdentifier(node: EntityName | Expression): Identifier { + while (true) { + if (node.kind === SyntaxKind.QualifiedName) { + node = (node).left; + } + else if (node.kind === SyntaxKind.PropertyAccessExpression) { + node = (node).expression; + } + else { + break; + } } + Debug.assert(node.kind === SyntaxKind.Identifier); return node; } @@ -10478,7 +10519,7 @@ module ts { case SyntaxKind.SetAccessor: return checkAccessorDeclaration(node); case SyntaxKind.TypeReference: - return checkTypeReference(node); + return checkTypeReferenceOrHeritageClauseElement(node); case SyntaxKind.TypeQuery: return checkTypeQuery(node); case SyntaxKind.TypeLiteral: @@ -10854,11 +10895,23 @@ module ts { // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName: EntityName): boolean { let node: Node = entityName; - while (node.parent && node.parent.kind === SyntaxKind.QualifiedName) node = node.parent; + while (node.parent && node.parent.kind === SyntaxKind.QualifiedName) { + node = node.parent; + } + return node.parent && node.parent.kind === SyntaxKind.TypeReference; } - function isTypeNode(node: Node): boolean { + function isHeritageClauseElementIdentifier(entityName: Node): boolean { + let node = entityName; + while (node.parent && node.parent.kind === SyntaxKind.PropertyAccessExpression) { + node = node.parent; + } + + return node.parent && node.parent.kind === SyntaxKind.HeritageClauseElement; + } + + function isTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node: Node): boolean { if (SyntaxKind.FirstTypeNode <= node.kind && node.kind <= SyntaxKind.LastTypeNode) { return true; } @@ -10875,6 +10928,8 @@ module ts { case SyntaxKind.StringLiteral: // Specialized signatures can have string literals as their parameters' type names return node.parent.kind === SyntaxKind.Parameter; + case SyntaxKind.HeritageClauseElement: + return true; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container @@ -10883,10 +10938,15 @@ module ts { if (node.parent.kind === SyntaxKind.QualifiedName && (node.parent).right === node) { node = node.parent; } + else if (node.parent.kind === SyntaxKind.PropertyAccessExpression && (node.parent).name === node) { + node = node.parent; + } // fall through case SyntaxKind.QualifiedName: + case SyntaxKind.PropertyAccessExpression: // At this point, node is either a qualified name or an identifier - Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression, + "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); let parent = node.parent; if (parent.kind === SyntaxKind.TypeQuery) { @@ -10902,6 +10962,8 @@ module ts { return true; } switch (parent.kind) { + case SyntaxKind.HeritageClauseElement: + return true; case SyntaxKind.TypeParameter: return node === (parent).constraint; case SyntaxKind.PropertyDeclaration: @@ -10956,11 +11018,6 @@ module ts { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } - function isRightSideOfQualifiedNameOrPropertyAccess(node: Node) { - return (node.parent.kind === SyntaxKind.QualifiedName && (node.parent).right === node) || - (node.parent.kind === SyntaxKind.PropertyAccessExpression && (node.parent).name === node); - } - function getSymbolOfEntityNameOrPropertyAccessExpression(entityName: EntityName | PropertyAccessExpression): Symbol { if (isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); @@ -10982,7 +11039,12 @@ module ts { entityName = entityName.parent; } - if (isExpression(entityName)) { + if (isHeritageClauseElementIdentifier(entityName)) { + let meaning = entityName.parent.kind === SyntaxKind.HeritageClauseElement ? SymbolFlags.Type : SymbolFlags.Namespace; + meaning |= SymbolFlags.Alias; + return resolveEntityName(entityName, meaning); + } + else if (isExpression(entityName)) { if (getFullWidth(entityName) === 0) { // Missing entity name. return undefined; @@ -11098,12 +11160,12 @@ module ts { return unknownType; } - if (isExpression(node)) { - return getTypeOfExpression(node); + if (isTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node)) { + return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node); } - if (isTypeNode(node)) { - return getTypeFromTypeNode(node); + if (isExpression(node)) { + return getTypeOfExpression(node); } if (isTypeDeclaration(node)) { diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index cf75467e1c5..7fd46d53421 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -314,12 +314,12 @@ module ts { } } - function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type: TypeNode | EntityName, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) { + function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type: TypeNode | EntityName | HeritageClauseElement, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) { writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; emitType(type); } - function emitType(type: TypeNode | StringLiteralExpression | Identifier | QualifiedName) { + function emitType(type: TypeNode | StringLiteralExpression | Identifier | QualifiedName | HeritageClauseElement) { switch (type.kind) { case SyntaxKind.AnyKeyword: case SyntaxKind.StringKeyword: @@ -329,6 +329,8 @@ module ts { case SyntaxKind.VoidKeyword: case SyntaxKind.StringLiteral: return writeTextOfNode(currentSourceFile, type); + case SyntaxKind.HeritageClauseElement: + return emitHeritageClauseElement(type); case SyntaxKind.TypeReference: return emitTypeReference(type); case SyntaxKind.TypeQuery: @@ -350,11 +352,9 @@ module ts { return emitEntityName(type); case SyntaxKind.QualifiedName: return emitEntityName(type); - default: - Debug.fail("Unknown type annotation: " + type.kind); } - function emitEntityName(entityName: EntityName) { + function emitEntityName(entityName: EntityName | PropertyAccessExpression) { let visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration ? entityName.parent : enclosingDeclaration); @@ -362,15 +362,28 @@ module ts { handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); - function writeEntityName(entityName: EntityName) { + function writeEntityName(entityName: EntityName | Expression) { if (entityName.kind === SyntaxKind.Identifier) { writeTextOfNode(currentSourceFile, entityName); } else { - let qualifiedName = entityName; - writeEntityName(qualifiedName.left); + let left = entityName.kind === SyntaxKind.QualifiedName ? (entityName).left : (entityName).expression; + let right = entityName.kind === SyntaxKind.QualifiedName ? (entityName).right : (entityName).name; + writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, qualifiedName.right); + writeTextOfNode(currentSourceFile, right); + } + } + } + + function emitHeritageClauseElement(node: HeritageClauseElement) { + if (isSupportedHeritageClauseElement(node)) { + Debug.assert(node.expression.kind === SyntaxKind.Identifier || node.expression.kind === SyntaxKind.PropertyAccessExpression); + emitEntityName(node.expression); + if (node.typeArguments) { + write("<"); + emitCommaList(node.typeArguments, emitType); + write(">"); } } } @@ -827,14 +840,16 @@ module ts { } } - function emitHeritageClause(typeReferences: TypeReferenceNode[], isImplementsList: boolean) { + function emitHeritageClause(typeReferences: HeritageClauseElement[], isImplementsList: boolean) { if (typeReferences) { write(isImplementsList ? " implements " : " extends "); emitCommaList(typeReferences, emitTypeOfTypeReference); } - function emitTypeOfTypeReference(node: TypeReferenceNode) { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + function emitTypeOfTypeReference(node: HeritageClauseElement) { + if (isSupportedHeritageClauseElement(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + } function getHeritageClauseVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { let diagnosticMessage: DiagnosticMessage; diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 967afd171ba..22e3a81ff38 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -351,6 +351,8 @@ module ts { The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, + An_interface_can_only_extend_a_type_reference: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend a type reference." }, + A_class_can_only_implement_type_references: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement type references." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -498,5 +500,6 @@ module ts { You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." }, yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, + Only_type_references_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only type references are currently supported in a class 'extends' clauses." }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6e24afad80c..347ae084607 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1396,6 +1396,14 @@ "category": "Error", "code": 2498 }, + "An interface can only extend a type reference.": { + "category": "Error", + "code": 2499 + }, + "A class can only implement type references.": { + "category": "Error", + "code": 2500 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", @@ -1985,5 +1993,9 @@ "Generators are not currently supported.": { "category": "Error", "code": 9001 + }, + "Only type references are currently supported in a class 'extends' clauses.": { + "category": "Error", + "code": 9002 } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index ac5fa31319f..09e721c9cfb 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3314,7 +3314,7 @@ module ts { } } - function emitConstructor(node: ClassDeclaration, baseTypeNode: TypeReferenceNode) { + function emitConstructor(node: ClassDeclaration, baseTypeElement: HeritageClauseElement) { let saveTempFlags = tempFlags; let saveTempVariables = tempVariables; let saveTempParameters = tempParameters; @@ -3368,7 +3368,7 @@ module ts { // Let constructor be the result of parsing the String "constructor(... args){ super (...args);}" using the syntactic grammar with the goal symbol MethodDefinition. // Else, // Let constructor be the result of parsing the String "constructor( ){ }" using the syntactic grammar with the goal symbol MethodDefinition - if (baseTypeNode) { + if (baseTypeElement) { write("(...args)"); } else { @@ -3387,7 +3387,7 @@ module ts { if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); - if (baseTypeNode) { + if (baseTypeElement) { var superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); @@ -3397,16 +3397,16 @@ module ts { emitParameterPropertyAssignments(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { writeLine(); - emitStart(baseTypeNode); + emitStart(baseTypeElement); if (languageVersion < ScriptTarget.ES6) { write("_super.apply(this, arguments);"); } else { write("super(...args);"); } - emitEnd(baseTypeNode); + emitEnd(baseTypeElement); } } emitMemberAssignments(node, /*staticFlag*/0); @@ -3525,7 +3525,7 @@ module ts { var baseTypeNode = getClassBaseTypeNode(node); if (baseTypeNode) { write(" extends "); - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); } write(" {"); @@ -3639,7 +3639,7 @@ module ts { emitStart(node); write(")("); if (baseTypeNode) { - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); } write(");"); emitEnd(node); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 14311ccbc52..49bd301dc7e 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -308,6 +308,9 @@ module ts { return visitNode(cbNode, (node).expression); case SyntaxKind.HeritageClause: return visitNodes(cbNodes, (node).types); + case SyntaxKind.HeritageClauseElement: + return visitNode(cbNode, (node).expression) || + visitNodes(cbNodes, (node).typeArguments); case SyntaxKind.ExternalModuleReference: return visitNode(cbNode, (node).expression); case SyntaxKind.MissingDeclaration: @@ -324,7 +327,7 @@ module ts { TypeMembers, // Members in interface or type literal ClassMembers, // Members in class declaration EnumMembers, // Members in enum declaration - TypeReferences, // Type references in extends or implements clause + HeritageClauseElement, // Elements in a heritage clause VariableDeclarations, // Variable declarations in variable statement ObjectBindingElements, // Binding elements in object binding list ArrayBindingElements, // Binding elements in array binding list @@ -356,7 +359,7 @@ module ts { case ParsingContext.TypeMembers: return Diagnostics.Property_or_signature_expected; case ParsingContext.ClassMembers: return Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; case ParsingContext.EnumMembers: return Diagnostics.Enum_member_expected; - case ParsingContext.TypeReferences: return Diagnostics.Type_reference_expected; + case ParsingContext.HeritageClauseElement: return Diagnostics.Expression_expected; case ParsingContext.VariableDeclarations: return Diagnostics.Variable_declaration_expected; case ParsingContext.ObjectBindingElements: return Diagnostics.Property_destructuring_pattern_expected; case ParsingContext.ArrayBindingElements: return Diagnostics.Array_element_destructuring_pattern_expected; @@ -1614,10 +1617,22 @@ module ts { return token === SyntaxKind.OpenBracketToken || token === SyntaxKind.AsteriskToken || isLiteralPropertyName(); case ParsingContext.ObjectBindingElements: return isLiteralPropertyName(); - case ParsingContext.TypeReferences: - // We want to make sure that the "extends" in "extends foo" or the "implements" in - // "implements foo" is not considered a type name. - return isIdentifier() && !isNotHeritageClauseTypeName(); + case ParsingContext.HeritageClauseElement: + // If we see { } then only consume it as an expression if it is followed by , or { + // That way we won't consume the body of a class in its heritage clause. + if (token === SyntaxKind.OpenBraceToken) { + return lookAhead(isValidHeritageClauseObjectLiteral); + } + + if (!inErrorRecovery) { + return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + else { + // If we're in error recovery we tighten up what we're willing to match. + // That way we don't treat something like "this" as a valid heritage clause + // element during recovery. + return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); + } case ParsingContext.VariableDeclarations: return isIdentifierOrPattern(); case ParsingContext.ArrayBindingElements: @@ -1641,21 +1656,44 @@ module ts { Debug.fail("Non-exhaustive case in 'isListElement'."); } + function isValidHeritageClauseObjectLiteral() { + Debug.assert(token === SyntaxKind.OpenBraceToken); + if (nextToken() === SyntaxKind.CloseBraceToken) { + // if we see "extends {}" then only treat the {} as what we're extending (and not + // the class body) if we have: + // + // extends {} { + // extends {}, + // extends {} extends + // extends {} implements + + let next = nextToken(); + return next === SyntaxKind.CommaToken || next === SyntaxKind.OpenBraceToken || next === SyntaxKind.ExtendsKeyword || next === SyntaxKind.ImplementsKeyword; + } + + return true; + } + function nextTokenIsIdentifier() { nextToken(); return isIdentifier(); } - function isNotHeritageClauseTypeName(): boolean { + function isHeritageClauseExtendsOrImplementsKeyword(): boolean { if (token === SyntaxKind.ImplementsKeyword || token === SyntaxKind.ExtendsKeyword) { - return lookAhead(nextTokenIsIdentifier); + return lookAhead(nextTokenIsStartOfExpression); } return false; } + function nextTokenIsStartOfExpression() { + nextToken(); + return isStartOfExpression(); + } + // True if positioned at a list terminator function isListTerminator(kind: ParsingContext): boolean { if (token === SyntaxKind.EndOfFileToken) { @@ -1676,7 +1714,7 @@ module ts { return token === SyntaxKind.CloseBraceToken; case ParsingContext.SwitchClauseStatements: return token === SyntaxKind.CloseBraceToken || token === SyntaxKind.CaseKeyword || token === SyntaxKind.DefaultKeyword; - case ParsingContext.TypeReferences: + case ParsingContext.HeritageClauseElement: return token === SyntaxKind.OpenBraceToken || token === SyntaxKind.ExtendsKeyword || token === SyntaxKind.ImplementsKeyword; case ParsingContext.VariableDeclarations: return isVariableDeclaratorListTerminator(); @@ -1891,12 +1929,6 @@ module ts { // This would probably be safe to reuse. There is no speculative parsing with // heritage clauses. - case ParsingContext.TypeReferences: - // This would probably be safe to reuse. There is no speculative parsing with - // type names in a heritage clause. There can be generic names in the type - // name list. But because it is a type context, we never use speculative - // parsing on the type argument list. - case ParsingContext.TypeParameters: // This would probably be safe to reuse. There is no speculative parsing with // type parameters. Note that that's because type *parameters* only occur in @@ -1923,6 +1955,12 @@ module ts { // cases. i.e. a property assignment may end with an expression, and thus might // have lookahead far beyond it's old node. case ParsingContext.ObjectLiteralMembers: + + // This is probably not safe to reuse. There can be speculative parsing with + // type names in a heritage clause. There can be generic names in the type + // name list, and there can be left hand side expressions (which can have type + // arguments.) + case ParsingContext.HeritageClauseElement: } return false; @@ -2846,8 +2884,7 @@ module ts { } // EXPRESSIONS - - function isStartOfExpression(): boolean { + function isStartOfLeftHandSideExpression(): boolean { switch (token) { case SyntaxKind.ThisKeyword: case SyntaxKind.SuperKeyword: @@ -2865,6 +2902,19 @@ module ts { case SyntaxKind.NewKeyword: case SyntaxKind.SlashToken: case SyntaxKind.SlashEqualsToken: + case SyntaxKind.Identifier: + return true; + default: + return isIdentifier(); + } + } + + function isStartOfExpression(): boolean { + if (isStartOfLeftHandSideExpression()) { + return true; + } + + switch (token) { case SyntaxKind.PlusToken: case SyntaxKind.MinusToken: case SyntaxKind.TildeToken: @@ -2875,7 +2925,6 @@ module ts { case SyntaxKind.PlusPlusToken: case SyntaxKind.MinusMinusToken: case SyntaxKind.LessThanToken: - case SyntaxKind.Identifier: case SyntaxKind.YieldKeyword: // Yield always starts an expression. Either it is an identifier (in which case // it is definitely an expression). Or it's a keyword (either because we're in @@ -3667,7 +3716,6 @@ module ts { case SyntaxKind.CloseBracketToken: // foo] case SyntaxKind.ColonToken: // foo: case SyntaxKind.SemicolonToken: // foo; - case SyntaxKind.CommaToken: // foo, case SyntaxKind.QuestionToken: // foo? case SyntaxKind.EqualsEqualsToken: // foo == case SyntaxKind.EqualsEqualsEqualsToken: // foo === @@ -3685,6 +3733,12 @@ module ts { // treat it as such. return true; + case SyntaxKind.CommaToken: // foo, + case SyntaxKind.OpenBraceToken: // foo { + // We don't want to treat these as type arguments. Otherwise we'll parse this + // as an invocation expression. Instead, we want to parse out the expression + // in isolation from the type arguments. + default: // Anything else treat as an expression. return false; @@ -4714,13 +4768,23 @@ module ts { let node = createNode(SyntaxKind.HeritageClause); node.token = token; nextToken(); - node.types = parseDelimitedList(ParsingContext.TypeReferences, parseTypeReference); + node.types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseHeritageClauseElement); return finishNode(node); } return undefined; } + function parseHeritageClauseElement(): HeritageClauseElement { + let node = createNode(SyntaxKind.HeritageClauseElement); + node.expression = parseLeftHandSideExpressionOrHigher(); + if (token === SyntaxKind.LessThanToken) { + node.typeArguments = parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken); + } + + return finishNode(node); + } + function isHeritageClause(): boolean { return token === SyntaxKind.ExtendsKeyword || token === SyntaxKind.ImplementsKeyword; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index d24ee45e21e..a9a04c3bd3a 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -206,6 +206,7 @@ module ts { OmittedExpression, // Misc TemplateSpan, + HeritageClauseElement, // Element Block, VariableStatement, @@ -728,6 +729,11 @@ module ts { arguments: NodeArray; } + export interface HeritageClauseElement extends Node { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + } + export interface NewExpression extends CallExpression, PrimaryExpression { } export interface TaggedTemplateExpression extends MemberExpression { @@ -869,7 +875,7 @@ module ts { export interface HeritageClause extends Node { token: SyntaxKind; - types?: NodeArray; + types?: NodeArray; } export interface TypeAliasDeclaration extends Declaration, ModuleElement { @@ -1231,7 +1237,7 @@ module ts { writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; // Returns the constant value this property access resolves to, or 'undefined' for a non-constant getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9fa0674c25c..761e1cdb4de 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1768,4 +1768,26 @@ module ts { } } + // Returns true if this heritage clause element's expression contains something unsupported + // (i.e. not a name or dotted name). + export function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean { + return isSupportedHeritageClauseElementExpression(node.expression); + } + + function isSupportedHeritageClauseElementExpression(node: Expression): boolean { + if (node.kind === SyntaxKind.Identifier) { + return true; + } + else if (node.kind === SyntaxKind.PropertyAccessExpression) { + return isSupportedHeritageClauseElementExpression((node).expression); + } + else { + return false; + } + } + + export function isRightSideOfQualifiedNameOrPropertyAccess(node: Node) { + return (node.parent.kind === SyntaxKind.QualifiedName && (node.parent).right === node) || + (node.parent.kind === SyntaxKind.PropertyAccessExpression && (node.parent).name === node); + } } diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 54cdc27e3b3..a83c04e6e86 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -38,7 +38,6 @@ class TypeWriterWalker { case ts.SyntaxKind.SuperKeyword: case ts.SyntaxKind.ArrayLiteralExpression: case ts.SyntaxKind.ObjectLiteralExpression: - case ts.SyntaxKind.PropertyAccessExpression: case ts.SyntaxKind.ElementAccessExpression: case ts.SyntaxKind.CallExpression: case ts.SyntaxKind.NewExpression: @@ -56,6 +55,14 @@ class TypeWriterWalker { this.log(node, this.getTypeOfNode(node)); break; + case ts.SyntaxKind.PropertyAccessExpression: + for (var current = node; current.kind === ts.SyntaxKind.PropertyAccessExpression; current = current.parent) { + } + if (current.kind !== ts.SyntaxKind.HeritageClauseElement) { + this.log(node, this.getTypeOfNode(node)); + } + break; + // Should not change expression status (maybe expressions) // TODO: Again, ideally should log number and string literals too, // but to be consistent with the old typeWriter, just log identifiers diff --git a/src/services/services.ts b/src/services/services.ts index 41ffc04e5ae..cf184ba775e 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2932,7 +2932,7 @@ module ts { function getCompletionsAtPosition(fileName: string, position: number): CompletionInfo { synchronizeHostData(); - + let completionData = getCompletionData(fileName, position); if (!completionData) { return undefined; @@ -4887,7 +4887,7 @@ module ts { } return; - function getPropertySymbolFromTypeReference(typeReference: TypeReferenceNode) { + function getPropertySymbolFromTypeReference(typeReference: HeritageClauseElement) { if (typeReference) { let type = typeInfoResolver.getTypeAtLocation(typeReference); if (type) { @@ -5144,19 +5144,44 @@ module ts { } function isTypeReference(node: Node): boolean { - if (isRightSideOfQualifiedName(node)) { + if (isRightSideOfQualifiedNameOrPropertyAccess(node) ) { node = node.parent; } - return node.parent.kind === SyntaxKind.TypeReference; + return node.parent.kind === SyntaxKind.TypeReference || node.parent.kind === SyntaxKind.HeritageClauseElement; } function isNamespaceReference(node: Node): boolean { + return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); + } + + function isPropertyAccessNamespaceReference(node: Node): boolean { + let root = node; + let isLastClause = true; + if (root.parent.kind === SyntaxKind.PropertyAccessExpression) { + while (root.parent && root.parent.kind === SyntaxKind.PropertyAccessExpression) { + root = root.parent; + } + + isLastClause = (root).name === node; + } + + if (!isLastClause && root.parent.kind === SyntaxKind.HeritageClauseElement && root.parent.parent.kind === SyntaxKind.HeritageClause) { + let decl = root.parent.parent.parent; + return (decl.kind === SyntaxKind.ClassDeclaration && (root.parent.parent).token === SyntaxKind.ImplementsKeyword) || + (decl.kind === SyntaxKind.InterfaceDeclaration && (root.parent.parent).token === SyntaxKind.ExtendsKeyword); + } + + return false; + } + + function isQualifiedNameNamespaceReference(node: Node): boolean { let root = node; let isLastClause = true; if (root.parent.kind === SyntaxKind.QualifiedName) { - while (root.parent && root.parent.kind === SyntaxKind.QualifiedName) + while (root.parent && root.parent.kind === SyntaxKind.QualifiedName) { root = root.parent; + } isLastClause = (root).right === node; } diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 3f0ba5f18cd..92711f4b753 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -235,57 +235,58 @@ declare module "typescript" { SpreadElementExpression = 173, OmittedExpression = 174, TemplateSpan = 175, - Block = 176, - VariableStatement = 177, - EmptyStatement = 178, - ExpressionStatement = 179, - IfStatement = 180, - DoStatement = 181, - WhileStatement = 182, - ForStatement = 183, - ForInStatement = 184, - ForOfStatement = 185, - ContinueStatement = 186, - BreakStatement = 187, - ReturnStatement = 188, - WithStatement = 189, - SwitchStatement = 190, - LabeledStatement = 191, - ThrowStatement = 192, - TryStatement = 193, - DebuggerStatement = 194, - VariableDeclaration = 195, - VariableDeclarationList = 196, - FunctionDeclaration = 197, - ClassDeclaration = 198, - InterfaceDeclaration = 199, - TypeAliasDeclaration = 200, - EnumDeclaration = 201, - ModuleDeclaration = 202, - ModuleBlock = 203, - CaseBlock = 204, - ImportEqualsDeclaration = 205, - ImportDeclaration = 206, - ImportClause = 207, - NamespaceImport = 208, - NamedImports = 209, - ImportSpecifier = 210, - ExportAssignment = 211, - ExportDeclaration = 212, - NamedExports = 213, - ExportSpecifier = 214, - MissingDeclaration = 215, - ExternalModuleReference = 216, - CaseClause = 217, - DefaultClause = 218, - HeritageClause = 219, - CatchClause = 220, - PropertyAssignment = 221, - ShorthandPropertyAssignment = 222, - EnumMember = 223, - SourceFile = 224, - SyntaxList = 225, - Count = 226, + HeritageClauseElement = 176, + Block = 177, + VariableStatement = 178, + EmptyStatement = 179, + ExpressionStatement = 180, + IfStatement = 181, + DoStatement = 182, + WhileStatement = 183, + ForStatement = 184, + ForInStatement = 185, + ForOfStatement = 186, + ContinueStatement = 187, + BreakStatement = 188, + ReturnStatement = 189, + WithStatement = 190, + SwitchStatement = 191, + LabeledStatement = 192, + ThrowStatement = 193, + TryStatement = 194, + DebuggerStatement = 195, + VariableDeclaration = 196, + VariableDeclarationList = 197, + FunctionDeclaration = 198, + ClassDeclaration = 199, + InterfaceDeclaration = 200, + TypeAliasDeclaration = 201, + EnumDeclaration = 202, + ModuleDeclaration = 203, + ModuleBlock = 204, + CaseBlock = 205, + ImportEqualsDeclaration = 206, + ImportDeclaration = 207, + ImportClause = 208, + NamespaceImport = 209, + NamedImports = 210, + ImportSpecifier = 211, + ExportAssignment = 212, + ExportDeclaration = 213, + NamedExports = 214, + ExportSpecifier = 215, + MissingDeclaration = 216, + ExternalModuleReference = 217, + CaseClause = 218, + DefaultClause = 219, + HeritageClause = 220, + CatchClause = 221, + PropertyAssignment = 222, + ShorthandPropertyAssignment = 223, + EnumMember = 224, + SourceFile = 225, + SyntaxList = 226, + Count = 227, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -607,6 +608,10 @@ declare module "typescript" { typeArguments?: NodeArray; arguments: NodeArray; } + interface HeritageClauseElement extends Node { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + } interface NewExpression extends CallExpression, PrimaryExpression { } interface TaggedTemplateExpression extends MemberExpression { @@ -718,7 +723,7 @@ declare module "typescript" { } interface HeritageClause extends Node { token: SyntaxKind; - types?: NodeArray; + types?: NodeArray; } interface TypeAliasDeclaration extends Declaration, ModuleElement { name: Identifier; @@ -960,7 +965,7 @@ declare module "typescript" { writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index eff47a4cb7b..31322f07ea1 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -723,157 +723,160 @@ declare module "typescript" { TemplateSpan = 175, >TemplateSpan : SyntaxKind - Block = 176, + HeritageClauseElement = 176, +>HeritageClauseElement : SyntaxKind + + Block = 177, >Block : SyntaxKind - VariableStatement = 177, + VariableStatement = 178, >VariableStatement : SyntaxKind - EmptyStatement = 178, + EmptyStatement = 179, >EmptyStatement : SyntaxKind - ExpressionStatement = 179, + ExpressionStatement = 180, >ExpressionStatement : SyntaxKind - IfStatement = 180, + IfStatement = 181, >IfStatement : SyntaxKind - DoStatement = 181, + DoStatement = 182, >DoStatement : SyntaxKind - WhileStatement = 182, + WhileStatement = 183, >WhileStatement : SyntaxKind - ForStatement = 183, + ForStatement = 184, >ForStatement : SyntaxKind - ForInStatement = 184, + ForInStatement = 185, >ForInStatement : SyntaxKind - ForOfStatement = 185, + ForOfStatement = 186, >ForOfStatement : SyntaxKind - ContinueStatement = 186, + ContinueStatement = 187, >ContinueStatement : SyntaxKind - BreakStatement = 187, + BreakStatement = 188, >BreakStatement : SyntaxKind - ReturnStatement = 188, + ReturnStatement = 189, >ReturnStatement : SyntaxKind - WithStatement = 189, + WithStatement = 190, >WithStatement : SyntaxKind - SwitchStatement = 190, + SwitchStatement = 191, >SwitchStatement : SyntaxKind - LabeledStatement = 191, + LabeledStatement = 192, >LabeledStatement : SyntaxKind - ThrowStatement = 192, + ThrowStatement = 193, >ThrowStatement : SyntaxKind - TryStatement = 193, + TryStatement = 194, >TryStatement : SyntaxKind - DebuggerStatement = 194, + DebuggerStatement = 195, >DebuggerStatement : SyntaxKind - VariableDeclaration = 195, + VariableDeclaration = 196, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 196, + VariableDeclarationList = 197, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 197, + FunctionDeclaration = 198, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 198, + ClassDeclaration = 199, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 199, + InterfaceDeclaration = 200, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 200, + TypeAliasDeclaration = 201, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 201, + EnumDeclaration = 202, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 202, + ModuleDeclaration = 203, >ModuleDeclaration : SyntaxKind - ModuleBlock = 203, + ModuleBlock = 204, >ModuleBlock : SyntaxKind - CaseBlock = 204, + CaseBlock = 205, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 205, + ImportEqualsDeclaration = 206, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 206, + ImportDeclaration = 207, >ImportDeclaration : SyntaxKind - ImportClause = 207, + ImportClause = 208, >ImportClause : SyntaxKind - NamespaceImport = 208, + NamespaceImport = 209, >NamespaceImport : SyntaxKind - NamedImports = 209, + NamedImports = 210, >NamedImports : SyntaxKind - ImportSpecifier = 210, + ImportSpecifier = 211, >ImportSpecifier : SyntaxKind - ExportAssignment = 211, + ExportAssignment = 212, >ExportAssignment : SyntaxKind - ExportDeclaration = 212, + ExportDeclaration = 213, >ExportDeclaration : SyntaxKind - NamedExports = 213, + NamedExports = 214, >NamedExports : SyntaxKind - ExportSpecifier = 214, + ExportSpecifier = 215, >ExportSpecifier : SyntaxKind - MissingDeclaration = 215, + MissingDeclaration = 216, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 216, + ExternalModuleReference = 217, >ExternalModuleReference : SyntaxKind - CaseClause = 217, + CaseClause = 218, >CaseClause : SyntaxKind - DefaultClause = 218, + DefaultClause = 219, >DefaultClause : SyntaxKind - HeritageClause = 219, + HeritageClause = 220, >HeritageClause : SyntaxKind - CatchClause = 220, + CatchClause = 221, >CatchClause : SyntaxKind - PropertyAssignment = 221, + PropertyAssignment = 222, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 222, + ShorthandPropertyAssignment = 223, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 223, + EnumMember = 224, >EnumMember : SyntaxKind - SourceFile = 224, + SourceFile = 225, >SourceFile : SyntaxKind - SyntaxList = 225, + SyntaxList = 226, >SyntaxList : SyntaxKind - Count = 226, + Count = 227, >Count : SyntaxKind FirstAssignment = 53, @@ -1831,6 +1834,19 @@ declare module "typescript" { >arguments : NodeArray >NodeArray : NodeArray >Expression : Expression + } + interface HeritageClauseElement extends Node { +>HeritageClauseElement : HeritageClauseElement +>Node : Node + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode } interface NewExpression extends CallExpression, PrimaryExpression { >NewExpression : NewExpression @@ -2178,10 +2194,10 @@ declare module "typescript" { >token : SyntaxKind >SyntaxKind : SyntaxKind - types?: NodeArray; ->types : NodeArray + types?: NodeArray; +>types : NodeArray >NodeArray : NodeArray ->TypeReferenceNode : TypeReferenceNode +>HeritageClauseElement : HeritageClauseElement } interface TypeAliasDeclaration extends Declaration, ModuleElement { >TypeAliasDeclaration : TypeAliasDeclaration @@ -3125,10 +3141,11 @@ declare module "typescript" { >SymbolFlags : SymbolFlags >SymbolAccessiblityResult : SymbolAccessiblityResult - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; ->isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult ->entityName : Identifier | QualifiedName + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; +>isEntityNameVisible : (entityName: Identifier | Expression | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult +>entityName : Identifier | Expression | QualifiedName >EntityName : Identifier | QualifiedName +>Expression : Expression >enclosingDeclaration : Node >Node : Node >SymbolVisibilityResult : SymbolVisibilityResult diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index ab48f78affc..dc96584dc55 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -266,57 +266,58 @@ declare module "typescript" { SpreadElementExpression = 173, OmittedExpression = 174, TemplateSpan = 175, - Block = 176, - VariableStatement = 177, - EmptyStatement = 178, - ExpressionStatement = 179, - IfStatement = 180, - DoStatement = 181, - WhileStatement = 182, - ForStatement = 183, - ForInStatement = 184, - ForOfStatement = 185, - ContinueStatement = 186, - BreakStatement = 187, - ReturnStatement = 188, - WithStatement = 189, - SwitchStatement = 190, - LabeledStatement = 191, - ThrowStatement = 192, - TryStatement = 193, - DebuggerStatement = 194, - VariableDeclaration = 195, - VariableDeclarationList = 196, - FunctionDeclaration = 197, - ClassDeclaration = 198, - InterfaceDeclaration = 199, - TypeAliasDeclaration = 200, - EnumDeclaration = 201, - ModuleDeclaration = 202, - ModuleBlock = 203, - CaseBlock = 204, - ImportEqualsDeclaration = 205, - ImportDeclaration = 206, - ImportClause = 207, - NamespaceImport = 208, - NamedImports = 209, - ImportSpecifier = 210, - ExportAssignment = 211, - ExportDeclaration = 212, - NamedExports = 213, - ExportSpecifier = 214, - MissingDeclaration = 215, - ExternalModuleReference = 216, - CaseClause = 217, - DefaultClause = 218, - HeritageClause = 219, - CatchClause = 220, - PropertyAssignment = 221, - ShorthandPropertyAssignment = 222, - EnumMember = 223, - SourceFile = 224, - SyntaxList = 225, - Count = 226, + HeritageClauseElement = 176, + Block = 177, + VariableStatement = 178, + EmptyStatement = 179, + ExpressionStatement = 180, + IfStatement = 181, + DoStatement = 182, + WhileStatement = 183, + ForStatement = 184, + ForInStatement = 185, + ForOfStatement = 186, + ContinueStatement = 187, + BreakStatement = 188, + ReturnStatement = 189, + WithStatement = 190, + SwitchStatement = 191, + LabeledStatement = 192, + ThrowStatement = 193, + TryStatement = 194, + DebuggerStatement = 195, + VariableDeclaration = 196, + VariableDeclarationList = 197, + FunctionDeclaration = 198, + ClassDeclaration = 199, + InterfaceDeclaration = 200, + TypeAliasDeclaration = 201, + EnumDeclaration = 202, + ModuleDeclaration = 203, + ModuleBlock = 204, + CaseBlock = 205, + ImportEqualsDeclaration = 206, + ImportDeclaration = 207, + ImportClause = 208, + NamespaceImport = 209, + NamedImports = 210, + ImportSpecifier = 211, + ExportAssignment = 212, + ExportDeclaration = 213, + NamedExports = 214, + ExportSpecifier = 215, + MissingDeclaration = 216, + ExternalModuleReference = 217, + CaseClause = 218, + DefaultClause = 219, + HeritageClause = 220, + CatchClause = 221, + PropertyAssignment = 222, + ShorthandPropertyAssignment = 223, + EnumMember = 224, + SourceFile = 225, + SyntaxList = 226, + Count = 227, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -638,6 +639,10 @@ declare module "typescript" { typeArguments?: NodeArray; arguments: NodeArray; } + interface HeritageClauseElement extends Node { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + } interface NewExpression extends CallExpression, PrimaryExpression { } interface TaggedTemplateExpression extends MemberExpression { @@ -749,7 +754,7 @@ declare module "typescript" { } interface HeritageClause extends Node { token: SyntaxKind; - types?: NodeArray; + types?: NodeArray; } interface TypeAliasDeclaration extends Declaration, ModuleElement { name: Identifier; @@ -991,7 +996,7 @@ declare module "typescript" { writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; @@ -2042,21 +2047,21 @@ function delint(sourceFile) { delintNode(sourceFile); function delintNode(node) { switch (node.kind) { - case 183 /* ForStatement */: - case 184 /* ForInStatement */: - case 182 /* WhileStatement */: - case 181 /* DoStatement */: - if (node.statement.kind !== 176 /* Block */) { + case 184 /* ForStatement */: + case 185 /* ForInStatement */: + case 183 /* WhileStatement */: + case 182 /* DoStatement */: + if (node.statement.kind !== 177 /* Block */) { report(node, "A looping statement's contents should be wrapped in a block body."); } break; - case 180 /* IfStatement */: + case 181 /* IfStatement */: var ifStatement = node; - if (ifStatement.thenStatement.kind !== 176 /* Block */) { + if (ifStatement.thenStatement.kind !== 177 /* Block */) { report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); } if (ifStatement.elseStatement && - ifStatement.elseStatement.kind !== 176 /* Block */ && ifStatement.elseStatement.kind !== 180 /* IfStatement */) { + ifStatement.elseStatement.kind !== 177 /* Block */ && ifStatement.elseStatement.kind !== 181 /* IfStatement */) { report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); } break; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 600bf5c6adc..57473b8981d 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -869,157 +869,160 @@ declare module "typescript" { TemplateSpan = 175, >TemplateSpan : SyntaxKind - Block = 176, + HeritageClauseElement = 176, +>HeritageClauseElement : SyntaxKind + + Block = 177, >Block : SyntaxKind - VariableStatement = 177, + VariableStatement = 178, >VariableStatement : SyntaxKind - EmptyStatement = 178, + EmptyStatement = 179, >EmptyStatement : SyntaxKind - ExpressionStatement = 179, + ExpressionStatement = 180, >ExpressionStatement : SyntaxKind - IfStatement = 180, + IfStatement = 181, >IfStatement : SyntaxKind - DoStatement = 181, + DoStatement = 182, >DoStatement : SyntaxKind - WhileStatement = 182, + WhileStatement = 183, >WhileStatement : SyntaxKind - ForStatement = 183, + ForStatement = 184, >ForStatement : SyntaxKind - ForInStatement = 184, + ForInStatement = 185, >ForInStatement : SyntaxKind - ForOfStatement = 185, + ForOfStatement = 186, >ForOfStatement : SyntaxKind - ContinueStatement = 186, + ContinueStatement = 187, >ContinueStatement : SyntaxKind - BreakStatement = 187, + BreakStatement = 188, >BreakStatement : SyntaxKind - ReturnStatement = 188, + ReturnStatement = 189, >ReturnStatement : SyntaxKind - WithStatement = 189, + WithStatement = 190, >WithStatement : SyntaxKind - SwitchStatement = 190, + SwitchStatement = 191, >SwitchStatement : SyntaxKind - LabeledStatement = 191, + LabeledStatement = 192, >LabeledStatement : SyntaxKind - ThrowStatement = 192, + ThrowStatement = 193, >ThrowStatement : SyntaxKind - TryStatement = 193, + TryStatement = 194, >TryStatement : SyntaxKind - DebuggerStatement = 194, + DebuggerStatement = 195, >DebuggerStatement : SyntaxKind - VariableDeclaration = 195, + VariableDeclaration = 196, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 196, + VariableDeclarationList = 197, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 197, + FunctionDeclaration = 198, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 198, + ClassDeclaration = 199, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 199, + InterfaceDeclaration = 200, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 200, + TypeAliasDeclaration = 201, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 201, + EnumDeclaration = 202, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 202, + ModuleDeclaration = 203, >ModuleDeclaration : SyntaxKind - ModuleBlock = 203, + ModuleBlock = 204, >ModuleBlock : SyntaxKind - CaseBlock = 204, + CaseBlock = 205, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 205, + ImportEqualsDeclaration = 206, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 206, + ImportDeclaration = 207, >ImportDeclaration : SyntaxKind - ImportClause = 207, + ImportClause = 208, >ImportClause : SyntaxKind - NamespaceImport = 208, + NamespaceImport = 209, >NamespaceImport : SyntaxKind - NamedImports = 209, + NamedImports = 210, >NamedImports : SyntaxKind - ImportSpecifier = 210, + ImportSpecifier = 211, >ImportSpecifier : SyntaxKind - ExportAssignment = 211, + ExportAssignment = 212, >ExportAssignment : SyntaxKind - ExportDeclaration = 212, + ExportDeclaration = 213, >ExportDeclaration : SyntaxKind - NamedExports = 213, + NamedExports = 214, >NamedExports : SyntaxKind - ExportSpecifier = 214, + ExportSpecifier = 215, >ExportSpecifier : SyntaxKind - MissingDeclaration = 215, + MissingDeclaration = 216, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 216, + ExternalModuleReference = 217, >ExternalModuleReference : SyntaxKind - CaseClause = 217, + CaseClause = 218, >CaseClause : SyntaxKind - DefaultClause = 218, + DefaultClause = 219, >DefaultClause : SyntaxKind - HeritageClause = 219, + HeritageClause = 220, >HeritageClause : SyntaxKind - CatchClause = 220, + CatchClause = 221, >CatchClause : SyntaxKind - PropertyAssignment = 221, + PropertyAssignment = 222, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 222, + ShorthandPropertyAssignment = 223, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 223, + EnumMember = 224, >EnumMember : SyntaxKind - SourceFile = 224, + SourceFile = 225, >SourceFile : SyntaxKind - SyntaxList = 225, + SyntaxList = 226, >SyntaxList : SyntaxKind - Count = 226, + Count = 227, >Count : SyntaxKind FirstAssignment = 53, @@ -1977,6 +1980,19 @@ declare module "typescript" { >arguments : NodeArray >NodeArray : NodeArray >Expression : Expression + } + interface HeritageClauseElement extends Node { +>HeritageClauseElement : HeritageClauseElement +>Node : Node + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode } interface NewExpression extends CallExpression, PrimaryExpression { >NewExpression : NewExpression @@ -2324,10 +2340,10 @@ declare module "typescript" { >token : SyntaxKind >SyntaxKind : SyntaxKind - types?: NodeArray; ->types : NodeArray + types?: NodeArray; +>types : NodeArray >NodeArray : NodeArray ->TypeReferenceNode : TypeReferenceNode +>HeritageClauseElement : HeritageClauseElement } interface TypeAliasDeclaration extends Declaration, ModuleElement { >TypeAliasDeclaration : TypeAliasDeclaration @@ -3271,10 +3287,11 @@ declare module "typescript" { >SymbolFlags : SymbolFlags >SymbolAccessiblityResult : SymbolAccessiblityResult - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; ->isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult ->entityName : Identifier | QualifiedName + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; +>isEntityNameVisible : (entityName: Identifier | Expression | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult +>entityName : Identifier | Expression | QualifiedName >EntityName : Identifier | QualifiedName +>Expression : Expression >enclosingDeclaration : Node >Node : Node >SymbolVisibilityResult : SymbolVisibilityResult diff --git a/tests/baselines/reference/APISample_linter.types.pull b/tests/baselines/reference/APISample_linter.types.pull new file mode 100644 index 00000000000..74632737ca9 --- /dev/null +++ b/tests/baselines/reference/APISample_linter.types.pull @@ -0,0 +1,6384 @@ +=== tests/cases/compiler/APISample_linter.ts === + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +>process : any + +declare var console: any; +>console : any + +declare var fs: any; +>fs : any + +import ts = require("typescript"); +>ts : typeof ts + +export function delint(sourceFile: ts.SourceFile) { +>delint : (sourceFile: ts.SourceFile) => void +>sourceFile : ts.SourceFile +>ts : unknown +>SourceFile : ts.SourceFile + + delintNode(sourceFile); +>delintNode(sourceFile) : void +>delintNode : (node: ts.Node) => void +>sourceFile : ts.SourceFile + + function delintNode(node: ts.Node) { +>delintNode : (node: ts.Node) => void +>node : ts.Node +>ts : unknown +>Node : ts.Node + + switch (node.kind) { +>node.kind : ts.SyntaxKind +>node : ts.Node +>kind : ts.SyntaxKind + + case ts.SyntaxKind.ForStatement: +>ts.SyntaxKind.ForStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>ForStatement : ts.SyntaxKind + + case ts.SyntaxKind.ForInStatement: +>ts.SyntaxKind.ForInStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>ForInStatement : ts.SyntaxKind + + case ts.SyntaxKind.WhileStatement: +>ts.SyntaxKind.WhileStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>WhileStatement : ts.SyntaxKind + + case ts.SyntaxKind.DoStatement: +>ts.SyntaxKind.DoStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>DoStatement : ts.SyntaxKind + + if ((node).statement.kind !== ts.SyntaxKind.Block) { +>(node).statement.kind !== ts.SyntaxKind.Block : boolean +>(node).statement.kind : ts.SyntaxKind +>(node).statement : ts.Statement +>(node) : ts.IterationStatement +>node : ts.IterationStatement +>ts : unknown +>IterationStatement : ts.IterationStatement +>node : ts.Node +>statement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.Block : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>Block : ts.SyntaxKind + + report(node, "A looping statement's contents should be wrapped in a block body."); +>report(node, "A looping statement's contents should be wrapped in a block body.") : void +>report : (node: ts.Node, message: string) => void +>node : ts.Node + } + break; + case ts.SyntaxKind.IfStatement: +>ts.SyntaxKind.IfStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>IfStatement : ts.SyntaxKind + + var ifStatement = (node); +>ifStatement : ts.IfStatement +>(node) : ts.IfStatement +>node : ts.IfStatement +>ts : unknown +>IfStatement : ts.IfStatement +>node : ts.Node + + if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) { +>ifStatement.thenStatement.kind !== ts.SyntaxKind.Block : boolean +>ifStatement.thenStatement.kind : ts.SyntaxKind +>ifStatement.thenStatement : ts.Statement +>ifStatement : ts.IfStatement +>thenStatement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.Block : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>Block : ts.SyntaxKind + + report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); +>report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.") : void +>report : (node: ts.Node, message: string) => void +>ifStatement.thenStatement : ts.Statement +>ifStatement : ts.IfStatement +>thenStatement : ts.Statement + } + if (ifStatement.elseStatement && +>ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean +>ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement + + ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) { +>ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean +>ifStatement.elseStatement.kind : ts.SyntaxKind +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.Block : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>Block : ts.SyntaxKind +>ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean +>ifStatement.elseStatement.kind : ts.SyntaxKind +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.IfStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>IfStatement : ts.SyntaxKind + + report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); +>report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.") : void +>report : (node: ts.Node, message: string) => void +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement + } + break; + + case ts.SyntaxKind.BinaryExpression: +>ts.SyntaxKind.BinaryExpression : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>BinaryExpression : ts.SyntaxKind + + var op = (node).operatorToken.kind; +>op : ts.SyntaxKind +>(node).operatorToken.kind : ts.SyntaxKind +>(node).operatorToken : ts.Node +>(node) : ts.BinaryExpression +>node : ts.BinaryExpression +>ts : unknown +>BinaryExpression : ts.BinaryExpression +>node : ts.Node +>operatorToken : ts.Node +>kind : ts.SyntaxKind + + if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { +>op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken : boolean +>op === ts.SyntaxKind.EqualsEqualsToken : boolean +>op : ts.SyntaxKind +>ts.SyntaxKind.EqualsEqualsToken : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>EqualsEqualsToken : ts.SyntaxKind +>op === ts.SyntaxKind.ExclamationEqualsToken : boolean +>op : ts.SyntaxKind +>ts.SyntaxKind.ExclamationEqualsToken : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>ExclamationEqualsToken : ts.SyntaxKind + + report(node, "Use '===' and '!=='.") +>report(node, "Use '===' and '!=='.") : void +>report : (node: ts.Node, message: string) => void +>node : ts.Node + } + break; + } + + ts.forEachChild(node, delintNode); +>ts.forEachChild(node, delintNode) : void +>ts.forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T +>ts : typeof ts +>forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T +>node : ts.Node +>delintNode : (node: ts.Node) => void + } + + function report(node: ts.Node, message: string) { +>report : (node: ts.Node, message: string) => void +>node : ts.Node +>ts : unknown +>Node : ts.Node +>message : string + + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); +>lineChar : ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter +>sourceFile : ts.SourceFile +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter +>node.getStart() : number +>node.getStart : (sourceFile?: ts.SourceFile) => number +>node : ts.Node +>getStart : (sourceFile?: ts.SourceFile) => number + + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) +>console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) : any +>console.log : any +>console : any +>log : any +>sourceFile.fileName : string +>sourceFile : ts.SourceFile +>fileName : string +>lineChar.line + 1 : number +>lineChar.line : number +>lineChar : ts.LineAndCharacter +>line : number +>lineChar.character + 1 : number +>lineChar.character : number +>lineChar : ts.LineAndCharacter +>character : number +>message : string + } +} + +var fileNames = process.argv.slice(2); +>fileNames : any +>process.argv.slice(2) : any +>process.argv.slice : any +>process.argv : any +>process : any +>argv : any +>slice : any + +fileNames.forEach(fileName => { +>fileNames.forEach(fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);}) : any +>fileNames.forEach : any +>fileNames : any +>forEach : any +>fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);} : (fileName: any) => void +>fileName : any + + // Parse a file + var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); +>sourceFile : ts.SourceFile +>ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true) : ts.SourceFile +>ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile +>ts : typeof ts +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile +>fileName : any +>fs.readFileSync(fileName).toString() : any +>fs.readFileSync(fileName).toString : any +>fs.readFileSync(fileName) : any +>fs.readFileSync : any +>fs : any +>readFileSync : any +>fileName : any +>toString : any +>ts.ScriptTarget.ES6 : ts.ScriptTarget +>ts.ScriptTarget : typeof ts.ScriptTarget +>ts : typeof ts +>ScriptTarget : typeof ts.ScriptTarget +>ES6 : ts.ScriptTarget + + // delint it + delint(sourceFile); +>delint(sourceFile) : void +>delint : (sourceFile: ts.SourceFile) => void +>sourceFile : ts.SourceFile + +}); + +=== typescript.d.ts === +/*! ***************************************************************************** +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 module "typescript" { + interface Map { +>Map : Map +>T : T + + [index: string]: T; +>index : string +>T : T + } + interface TextRange { +>TextRange : TextRange + + pos: number; +>pos : number + + end: number; +>end : number + } + const enum SyntaxKind { +>SyntaxKind : SyntaxKind + + Unknown = 0, +>Unknown : SyntaxKind + + EndOfFileToken = 1, +>EndOfFileToken : SyntaxKind + + SingleLineCommentTrivia = 2, +>SingleLineCommentTrivia : SyntaxKind + + MultiLineCommentTrivia = 3, +>MultiLineCommentTrivia : SyntaxKind + + NewLineTrivia = 4, +>NewLineTrivia : SyntaxKind + + WhitespaceTrivia = 5, +>WhitespaceTrivia : SyntaxKind + + ConflictMarkerTrivia = 6, +>ConflictMarkerTrivia : SyntaxKind + + NumericLiteral = 7, +>NumericLiteral : SyntaxKind + + StringLiteral = 8, +>StringLiteral : SyntaxKind + + RegularExpressionLiteral = 9, +>RegularExpressionLiteral : SyntaxKind + + NoSubstitutionTemplateLiteral = 10, +>NoSubstitutionTemplateLiteral : SyntaxKind + + TemplateHead = 11, +>TemplateHead : SyntaxKind + + TemplateMiddle = 12, +>TemplateMiddle : SyntaxKind + + TemplateTail = 13, +>TemplateTail : SyntaxKind + + OpenBraceToken = 14, +>OpenBraceToken : SyntaxKind + + CloseBraceToken = 15, +>CloseBraceToken : SyntaxKind + + OpenParenToken = 16, +>OpenParenToken : SyntaxKind + + CloseParenToken = 17, +>CloseParenToken : SyntaxKind + + OpenBracketToken = 18, +>OpenBracketToken : SyntaxKind + + CloseBracketToken = 19, +>CloseBracketToken : SyntaxKind + + DotToken = 20, +>DotToken : SyntaxKind + + DotDotDotToken = 21, +>DotDotDotToken : SyntaxKind + + SemicolonToken = 22, +>SemicolonToken : SyntaxKind + + CommaToken = 23, +>CommaToken : SyntaxKind + + LessThanToken = 24, +>LessThanToken : SyntaxKind + + GreaterThanToken = 25, +>GreaterThanToken : SyntaxKind + + LessThanEqualsToken = 26, +>LessThanEqualsToken : SyntaxKind + + GreaterThanEqualsToken = 27, +>GreaterThanEqualsToken : SyntaxKind + + EqualsEqualsToken = 28, +>EqualsEqualsToken : SyntaxKind + + ExclamationEqualsToken = 29, +>ExclamationEqualsToken : SyntaxKind + + EqualsEqualsEqualsToken = 30, +>EqualsEqualsEqualsToken : SyntaxKind + + ExclamationEqualsEqualsToken = 31, +>ExclamationEqualsEqualsToken : SyntaxKind + + EqualsGreaterThanToken = 32, +>EqualsGreaterThanToken : SyntaxKind + + PlusToken = 33, +>PlusToken : SyntaxKind + + MinusToken = 34, +>MinusToken : SyntaxKind + + AsteriskToken = 35, +>AsteriskToken : SyntaxKind + + SlashToken = 36, +>SlashToken : SyntaxKind + + PercentToken = 37, +>PercentToken : SyntaxKind + + PlusPlusToken = 38, +>PlusPlusToken : SyntaxKind + + MinusMinusToken = 39, +>MinusMinusToken : SyntaxKind + + LessThanLessThanToken = 40, +>LessThanLessThanToken : SyntaxKind + + GreaterThanGreaterThanToken = 41, +>GreaterThanGreaterThanToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanToken = 42, +>GreaterThanGreaterThanGreaterThanToken : SyntaxKind + + AmpersandToken = 43, +>AmpersandToken : SyntaxKind + + BarToken = 44, +>BarToken : SyntaxKind + + CaretToken = 45, +>CaretToken : SyntaxKind + + ExclamationToken = 46, +>ExclamationToken : SyntaxKind + + TildeToken = 47, +>TildeToken : SyntaxKind + + AmpersandAmpersandToken = 48, +>AmpersandAmpersandToken : SyntaxKind + + BarBarToken = 49, +>BarBarToken : SyntaxKind + + QuestionToken = 50, +>QuestionToken : SyntaxKind + + ColonToken = 51, +>ColonToken : SyntaxKind + + AtToken = 52, +>AtToken : SyntaxKind + + EqualsToken = 53, +>EqualsToken : SyntaxKind + + PlusEqualsToken = 54, +>PlusEqualsToken : SyntaxKind + + MinusEqualsToken = 55, +>MinusEqualsToken : SyntaxKind + + AsteriskEqualsToken = 56, +>AsteriskEqualsToken : SyntaxKind + + SlashEqualsToken = 57, +>SlashEqualsToken : SyntaxKind + + PercentEqualsToken = 58, +>PercentEqualsToken : SyntaxKind + + LessThanLessThanEqualsToken = 59, +>LessThanLessThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanEqualsToken = 60, +>GreaterThanGreaterThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanEqualsToken = 61, +>GreaterThanGreaterThanGreaterThanEqualsToken : SyntaxKind + + AmpersandEqualsToken = 62, +>AmpersandEqualsToken : SyntaxKind + + BarEqualsToken = 63, +>BarEqualsToken : SyntaxKind + + CaretEqualsToken = 64, +>CaretEqualsToken : SyntaxKind + + Identifier = 65, +>Identifier : SyntaxKind + + BreakKeyword = 66, +>BreakKeyword : SyntaxKind + + CaseKeyword = 67, +>CaseKeyword : SyntaxKind + + CatchKeyword = 68, +>CatchKeyword : SyntaxKind + + ClassKeyword = 69, +>ClassKeyword : SyntaxKind + + ConstKeyword = 70, +>ConstKeyword : SyntaxKind + + ContinueKeyword = 71, +>ContinueKeyword : SyntaxKind + + DebuggerKeyword = 72, +>DebuggerKeyword : SyntaxKind + + DefaultKeyword = 73, +>DefaultKeyword : SyntaxKind + + DeleteKeyword = 74, +>DeleteKeyword : SyntaxKind + + DoKeyword = 75, +>DoKeyword : SyntaxKind + + ElseKeyword = 76, +>ElseKeyword : SyntaxKind + + EnumKeyword = 77, +>EnumKeyword : SyntaxKind + + ExportKeyword = 78, +>ExportKeyword : SyntaxKind + + ExtendsKeyword = 79, +>ExtendsKeyword : SyntaxKind + + FalseKeyword = 80, +>FalseKeyword : SyntaxKind + + FinallyKeyword = 81, +>FinallyKeyword : SyntaxKind + + ForKeyword = 82, +>ForKeyword : SyntaxKind + + FunctionKeyword = 83, +>FunctionKeyword : SyntaxKind + + IfKeyword = 84, +>IfKeyword : SyntaxKind + + ImportKeyword = 85, +>ImportKeyword : SyntaxKind + + InKeyword = 86, +>InKeyword : SyntaxKind + + InstanceOfKeyword = 87, +>InstanceOfKeyword : SyntaxKind + + NewKeyword = 88, +>NewKeyword : SyntaxKind + + NullKeyword = 89, +>NullKeyword : SyntaxKind + + ReturnKeyword = 90, +>ReturnKeyword : SyntaxKind + + SuperKeyword = 91, +>SuperKeyword : SyntaxKind + + SwitchKeyword = 92, +>SwitchKeyword : SyntaxKind + + ThisKeyword = 93, +>ThisKeyword : SyntaxKind + + ThrowKeyword = 94, +>ThrowKeyword : SyntaxKind + + TrueKeyword = 95, +>TrueKeyword : SyntaxKind + + TryKeyword = 96, +>TryKeyword : SyntaxKind + + TypeOfKeyword = 97, +>TypeOfKeyword : SyntaxKind + + VarKeyword = 98, +>VarKeyword : SyntaxKind + + VoidKeyword = 99, +>VoidKeyword : SyntaxKind + + WhileKeyword = 100, +>WhileKeyword : SyntaxKind + + WithKeyword = 101, +>WithKeyword : SyntaxKind + + AsKeyword = 102, +>AsKeyword : SyntaxKind + + ImplementsKeyword = 103, +>ImplementsKeyword : SyntaxKind + + InterfaceKeyword = 104, +>InterfaceKeyword : SyntaxKind + + LetKeyword = 105, +>LetKeyword : SyntaxKind + + PackageKeyword = 106, +>PackageKeyword : SyntaxKind + + PrivateKeyword = 107, +>PrivateKeyword : SyntaxKind + + ProtectedKeyword = 108, +>ProtectedKeyword : SyntaxKind + + PublicKeyword = 109, +>PublicKeyword : SyntaxKind + + StaticKeyword = 110, +>StaticKeyword : SyntaxKind + + YieldKeyword = 111, +>YieldKeyword : SyntaxKind + + AnyKeyword = 112, +>AnyKeyword : SyntaxKind + + BooleanKeyword = 113, +>BooleanKeyword : SyntaxKind + + ConstructorKeyword = 114, +>ConstructorKeyword : SyntaxKind + + DeclareKeyword = 115, +>DeclareKeyword : SyntaxKind + + GetKeyword = 116, +>GetKeyword : SyntaxKind + + ModuleKeyword = 117, +>ModuleKeyword : SyntaxKind + + RequireKeyword = 118, +>RequireKeyword : SyntaxKind + + NumberKeyword = 119, +>NumberKeyword : SyntaxKind + + SetKeyword = 120, +>SetKeyword : SyntaxKind + + StringKeyword = 121, +>StringKeyword : SyntaxKind + + SymbolKeyword = 122, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 123, +>TypeKeyword : SyntaxKind + + FromKeyword = 124, +>FromKeyword : SyntaxKind + + OfKeyword = 125, +>OfKeyword : SyntaxKind + + QualifiedName = 126, +>QualifiedName : SyntaxKind + + ComputedPropertyName = 127, +>ComputedPropertyName : SyntaxKind + + TypeParameter = 128, +>TypeParameter : SyntaxKind + + Parameter = 129, +>Parameter : SyntaxKind + + Decorator = 130, +>Decorator : SyntaxKind + + PropertySignature = 131, +>PropertySignature : SyntaxKind + + PropertyDeclaration = 132, +>PropertyDeclaration : SyntaxKind + + MethodSignature = 133, +>MethodSignature : SyntaxKind + + MethodDeclaration = 134, +>MethodDeclaration : SyntaxKind + + Constructor = 135, +>Constructor : SyntaxKind + + GetAccessor = 136, +>GetAccessor : SyntaxKind + + SetAccessor = 137, +>SetAccessor : SyntaxKind + + CallSignature = 138, +>CallSignature : SyntaxKind + + ConstructSignature = 139, +>ConstructSignature : SyntaxKind + + IndexSignature = 140, +>IndexSignature : SyntaxKind + + TypeReference = 141, +>TypeReference : SyntaxKind + + FunctionType = 142, +>FunctionType : SyntaxKind + + ConstructorType = 143, +>ConstructorType : SyntaxKind + + TypeQuery = 144, +>TypeQuery : SyntaxKind + + TypeLiteral = 145, +>TypeLiteral : SyntaxKind + + ArrayType = 146, +>ArrayType : SyntaxKind + + TupleType = 147, +>TupleType : SyntaxKind + + UnionType = 148, +>UnionType : SyntaxKind + + ParenthesizedType = 149, +>ParenthesizedType : SyntaxKind + + ObjectBindingPattern = 150, +>ObjectBindingPattern : SyntaxKind + + ArrayBindingPattern = 151, +>ArrayBindingPattern : SyntaxKind + + BindingElement = 152, +>BindingElement : SyntaxKind + + ArrayLiteralExpression = 153, +>ArrayLiteralExpression : SyntaxKind + + ObjectLiteralExpression = 154, +>ObjectLiteralExpression : SyntaxKind + + PropertyAccessExpression = 155, +>PropertyAccessExpression : SyntaxKind + + ElementAccessExpression = 156, +>ElementAccessExpression : SyntaxKind + + CallExpression = 157, +>CallExpression : SyntaxKind + + NewExpression = 158, +>NewExpression : SyntaxKind + + TaggedTemplateExpression = 159, +>TaggedTemplateExpression : SyntaxKind + + TypeAssertionExpression = 160, +>TypeAssertionExpression : SyntaxKind + + ParenthesizedExpression = 161, +>ParenthesizedExpression : SyntaxKind + + FunctionExpression = 162, +>FunctionExpression : SyntaxKind + + ArrowFunction = 163, +>ArrowFunction : SyntaxKind + + DeleteExpression = 164, +>DeleteExpression : SyntaxKind + + TypeOfExpression = 165, +>TypeOfExpression : SyntaxKind + + VoidExpression = 166, +>VoidExpression : SyntaxKind + + PrefixUnaryExpression = 167, +>PrefixUnaryExpression : SyntaxKind + + PostfixUnaryExpression = 168, +>PostfixUnaryExpression : SyntaxKind + + BinaryExpression = 169, +>BinaryExpression : SyntaxKind + + ConditionalExpression = 170, +>ConditionalExpression : SyntaxKind + + TemplateExpression = 171, +>TemplateExpression : SyntaxKind + + YieldExpression = 172, +>YieldExpression : SyntaxKind + + SpreadElementExpression = 173, +>SpreadElementExpression : SyntaxKind + + OmittedExpression = 174, +>OmittedExpression : SyntaxKind + + TemplateSpan = 175, +>TemplateSpan : SyntaxKind + + HeritageClauseElement = 176, +>HeritageClauseElement : SyntaxKind + + Block = 177, +>Block : SyntaxKind + + VariableStatement = 178, +>VariableStatement : SyntaxKind + + EmptyStatement = 179, +>EmptyStatement : SyntaxKind + + ExpressionStatement = 180, +>ExpressionStatement : SyntaxKind + + IfStatement = 181, +>IfStatement : SyntaxKind + + DoStatement = 182, +>DoStatement : SyntaxKind + + WhileStatement = 183, +>WhileStatement : SyntaxKind + + ForStatement = 184, +>ForStatement : SyntaxKind + + ForInStatement = 185, +>ForInStatement : SyntaxKind + + ForOfStatement = 186, +>ForOfStatement : SyntaxKind + + ContinueStatement = 187, +>ContinueStatement : SyntaxKind + + BreakStatement = 188, +>BreakStatement : SyntaxKind + + ReturnStatement = 189, +>ReturnStatement : SyntaxKind + + WithStatement = 190, +>WithStatement : SyntaxKind + + SwitchStatement = 191, +>SwitchStatement : SyntaxKind + + LabeledStatement = 192, +>LabeledStatement : SyntaxKind + + ThrowStatement = 193, +>ThrowStatement : SyntaxKind + + TryStatement = 194, +>TryStatement : SyntaxKind + + DebuggerStatement = 195, +>DebuggerStatement : SyntaxKind + + VariableDeclaration = 196, +>VariableDeclaration : SyntaxKind + + VariableDeclarationList = 197, +>VariableDeclarationList : SyntaxKind + + FunctionDeclaration = 198, +>FunctionDeclaration : SyntaxKind + + ClassDeclaration = 199, +>ClassDeclaration : SyntaxKind + + InterfaceDeclaration = 200, +>InterfaceDeclaration : SyntaxKind + + TypeAliasDeclaration = 201, +>TypeAliasDeclaration : SyntaxKind + + EnumDeclaration = 202, +>EnumDeclaration : SyntaxKind + + ModuleDeclaration = 203, +>ModuleDeclaration : SyntaxKind + + ModuleBlock = 204, +>ModuleBlock : SyntaxKind + + CaseBlock = 205, +>CaseBlock : SyntaxKind + + ImportEqualsDeclaration = 206, +>ImportEqualsDeclaration : SyntaxKind + + ImportDeclaration = 207, +>ImportDeclaration : SyntaxKind + + ImportClause = 208, +>ImportClause : SyntaxKind + + NamespaceImport = 209, +>NamespaceImport : SyntaxKind + + NamedImports = 210, +>NamedImports : SyntaxKind + + ImportSpecifier = 211, +>ImportSpecifier : SyntaxKind + + ExportAssignment = 212, +>ExportAssignment : SyntaxKind + + ExportDeclaration = 213, +>ExportDeclaration : SyntaxKind + + NamedExports = 214, +>NamedExports : SyntaxKind + + ExportSpecifier = 215, +>ExportSpecifier : SyntaxKind + + MissingDeclaration = 216, +>MissingDeclaration : SyntaxKind + + ExternalModuleReference = 217, +>ExternalModuleReference : SyntaxKind + + CaseClause = 218, +>CaseClause : SyntaxKind + + DefaultClause = 219, +>DefaultClause : SyntaxKind + + HeritageClause = 220, +>HeritageClause : SyntaxKind + + CatchClause = 221, +>CatchClause : SyntaxKind + + PropertyAssignment = 222, +>PropertyAssignment : SyntaxKind + + ShorthandPropertyAssignment = 223, +>ShorthandPropertyAssignment : SyntaxKind + + EnumMember = 224, +>EnumMember : SyntaxKind + + SourceFile = 225, +>SourceFile : SyntaxKind + + SyntaxList = 226, +>SyntaxList : SyntaxKind + + Count = 227, +>Count : SyntaxKind + + FirstAssignment = 53, +>FirstAssignment : SyntaxKind + + LastAssignment = 64, +>LastAssignment : SyntaxKind + + FirstReservedWord = 66, +>FirstReservedWord : SyntaxKind + + LastReservedWord = 101, +>LastReservedWord : SyntaxKind + + FirstKeyword = 66, +>FirstKeyword : SyntaxKind + + LastKeyword = 125, +>LastKeyword : SyntaxKind + + FirstFutureReservedWord = 103, +>FirstFutureReservedWord : SyntaxKind + + LastFutureReservedWord = 111, +>LastFutureReservedWord : SyntaxKind + + FirstTypeNode = 141, +>FirstTypeNode : SyntaxKind + + LastTypeNode = 149, +>LastTypeNode : SyntaxKind + + FirstPunctuation = 14, +>FirstPunctuation : SyntaxKind + + LastPunctuation = 64, +>LastPunctuation : SyntaxKind + + FirstToken = 0, +>FirstToken : SyntaxKind + + LastToken = 125, +>LastToken : SyntaxKind + + FirstTriviaToken = 2, +>FirstTriviaToken : SyntaxKind + + LastTriviaToken = 6, +>LastTriviaToken : SyntaxKind + + FirstLiteralToken = 7, +>FirstLiteralToken : SyntaxKind + + LastLiteralToken = 10, +>LastLiteralToken : SyntaxKind + + FirstTemplateToken = 10, +>FirstTemplateToken : SyntaxKind + + LastTemplateToken = 13, +>LastTemplateToken : SyntaxKind + + FirstBinaryOperator = 24, +>FirstBinaryOperator : SyntaxKind + + LastBinaryOperator = 64, +>LastBinaryOperator : SyntaxKind + + FirstNode = 126, +>FirstNode : SyntaxKind + } + const enum NodeFlags { +>NodeFlags : NodeFlags + + Export = 1, +>Export : NodeFlags + + Ambient = 2, +>Ambient : NodeFlags + + Public = 16, +>Public : NodeFlags + + Private = 32, +>Private : NodeFlags + + Protected = 64, +>Protected : NodeFlags + + Static = 128, +>Static : NodeFlags + + Default = 256, +>Default : NodeFlags + + MultiLine = 512, +>MultiLine : NodeFlags + + Synthetic = 1024, +>Synthetic : NodeFlags + + DeclarationFile = 2048, +>DeclarationFile : NodeFlags + + Let = 4096, +>Let : NodeFlags + + Const = 8192, +>Const : NodeFlags + + OctalLiteral = 16384, +>OctalLiteral : NodeFlags + + ExportContext = 32768, +>ExportContext : NodeFlags + + Modifier = 499, +>Modifier : NodeFlags + + AccessibilityModifier = 112, +>AccessibilityModifier : NodeFlags + + BlockScoped = 12288, +>BlockScoped : NodeFlags + } + const enum ParserContextFlags { +>ParserContextFlags : ParserContextFlags + + StrictMode = 1, +>StrictMode : ParserContextFlags + + DisallowIn = 2, +>DisallowIn : ParserContextFlags + + Yield = 4, +>Yield : ParserContextFlags + + GeneratorParameter = 8, +>GeneratorParameter : ParserContextFlags + + Decorator = 16, +>Decorator : ParserContextFlags + + ThisNodeHasError = 32, +>ThisNodeHasError : ParserContextFlags + + ParserGeneratedFlags = 63, +>ParserGeneratedFlags : ParserContextFlags + + ThisNodeOrAnySubNodesHasError = 64, +>ThisNodeOrAnySubNodesHasError : ParserContextFlags + + HasAggregatedChildData = 128, +>HasAggregatedChildData : ParserContextFlags + } + const enum RelationComparisonResult { +>RelationComparisonResult : RelationComparisonResult + + Succeeded = 1, +>Succeeded : RelationComparisonResult + + Failed = 2, +>Failed : RelationComparisonResult + + FailedAndReported = 3, +>FailedAndReported : RelationComparisonResult + } + interface Node extends TextRange { +>Node : Node +>TextRange : TextRange + + kind: SyntaxKind; +>kind : SyntaxKind +>SyntaxKind : SyntaxKind + + flags: NodeFlags; +>flags : NodeFlags +>NodeFlags : NodeFlags + + parserContextFlags?: ParserContextFlags; +>parserContextFlags : ParserContextFlags +>ParserContextFlags : ParserContextFlags + + decorators?: NodeArray; +>decorators : NodeArray +>NodeArray : NodeArray +>Decorator : Decorator + + modifiers?: ModifiersArray; +>modifiers : ModifiersArray +>ModifiersArray : ModifiersArray + + id?: number; +>id : number + + parent?: Node; +>parent : Node +>Node : Node + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + + locals?: SymbolTable; +>locals : SymbolTable +>SymbolTable : SymbolTable + + nextContainer?: Node; +>nextContainer : Node +>Node : Node + + localSymbol?: Symbol; +>localSymbol : Symbol +>Symbol : Symbol + } + interface NodeArray extends Array, TextRange { +>NodeArray : NodeArray +>T : T +>Array : T[] +>T : T +>TextRange : TextRange + + hasTrailingComma?: boolean; +>hasTrailingComma : boolean + } + interface ModifiersArray extends NodeArray { +>ModifiersArray : ModifiersArray +>NodeArray : NodeArray +>Node : Node + + flags: number; +>flags : number + } + interface Identifier extends PrimaryExpression { +>Identifier : Identifier +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + } + interface QualifiedName extends Node { +>QualifiedName : QualifiedName +>Node : Node + + left: EntityName; +>left : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + right: Identifier; +>right : Identifier +>Identifier : Identifier + } + type EntityName = Identifier | QualifiedName; +>EntityName : Identifier | QualifiedName +>Identifier : Identifier +>QualifiedName : QualifiedName + + type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>Identifier : Identifier +>LiteralExpression : LiteralExpression +>ComputedPropertyName : ComputedPropertyName +>BindingPattern : BindingPattern + + interface Declaration extends Node { +>Declaration : Declaration +>Node : Node + + _declarationBrand: any; +>_declarationBrand : any + + name?: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + } + interface ComputedPropertyName extends Node { +>ComputedPropertyName : ComputedPropertyName +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface Decorator extends Node { +>Decorator : Decorator +>Node : Node + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + } + interface TypeParameterDeclaration extends Declaration { +>TypeParameterDeclaration : TypeParameterDeclaration +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + constraint?: TypeNode; +>constraint : TypeNode +>TypeNode : TypeNode + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface SignatureDeclaration extends Declaration { +>SignatureDeclaration : SignatureDeclaration +>Declaration : Declaration + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + parameters: NodeArray; +>parameters : NodeArray +>NodeArray : NodeArray +>ParameterDeclaration : ParameterDeclaration + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface VariableDeclaration extends Declaration { +>VariableDeclaration : VariableDeclaration +>Declaration : Declaration + + parent?: VariableDeclarationList; +>parent : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface VariableDeclarationList extends Node { +>VariableDeclarationList : VariableDeclarationList +>Node : Node + + declarations: NodeArray; +>declarations : NodeArray +>NodeArray : NodeArray +>VariableDeclaration : VariableDeclaration + } + interface ParameterDeclaration extends Declaration { +>ParameterDeclaration : ParameterDeclaration +>Declaration : Declaration + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingElement extends Declaration { +>BindingElement : BindingElement +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface PropertyDeclaration extends Declaration, ClassElement { +>PropertyDeclaration : PropertyDeclaration +>Declaration : Declaration +>ClassElement : ClassElement + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface ObjectLiteralElement extends Declaration { +>ObjectLiteralElement : ObjectLiteralElement +>Declaration : Declaration + + _objectLiteralBrandBrand: any; +>_objectLiteralBrandBrand : any + } + interface PropertyAssignment extends ObjectLiteralElement { +>PropertyAssignment : PropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + _propertyAssignmentBrand: any; +>_propertyAssignmentBrand : any + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + initializer: Expression; +>initializer : Expression +>Expression : Expression + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { +>ShorthandPropertyAssignment : ShorthandPropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + questionToken?: Node; +>questionToken : Node +>Node : Node + } + interface VariableLikeDeclaration extends Declaration { +>VariableLikeDeclaration : VariableLikeDeclaration +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingPattern extends Node { +>BindingPattern : BindingPattern +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>BindingElement : BindingElement + } + /** + * Several node kinds share function-like features such as a signature, + * a name, and a body. These nodes should extend FunctionLikeDeclaration. + * Examples: + * FunctionDeclaration + * MethodDeclaration + * AccessorDeclaration + */ + interface FunctionLikeDeclaration extends SignatureDeclaration { +>FunctionLikeDeclaration : FunctionLikeDeclaration +>SignatureDeclaration : SignatureDeclaration + + _functionLikeDeclarationBrand: any; +>_functionLikeDeclarationBrand : any + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + questionToken?: Node; +>questionToken : Node +>Node : Node + + body?: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { +>FunctionDeclaration : FunctionDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>Statement : Statement + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + body?: Block; +>body : Block +>Block : Block + } + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>MethodDeclaration : MethodDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + body?: Block; +>body : Block +>Block : Block + } + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { +>ConstructorDeclaration : ConstructorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement + + body?: Block; +>body : Block +>Block : Block + } + interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>AccessorDeclaration : AccessorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + _accessorDeclarationBrand: any; +>_accessorDeclarationBrand : any + + body: Block; +>body : Block +>Block : Block + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { +>IndexSignatureDeclaration : IndexSignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>ClassElement : ClassElement + + _indexSignatureDeclarationBrand: any; +>_indexSignatureDeclarationBrand : any + } + interface TypeNode extends Node { +>TypeNode : TypeNode +>Node : Node + + _typeNodeBrand: any; +>_typeNodeBrand : any + } + interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { +>FunctionOrConstructorTypeNode : FunctionOrConstructorTypeNode +>TypeNode : TypeNode +>SignatureDeclaration : SignatureDeclaration + + _functionOrConstructorTypeNodeBrand: any; +>_functionOrConstructorTypeNodeBrand : any + } + interface TypeReferenceNode extends TypeNode { +>TypeReferenceNode : TypeReferenceNode +>TypeNode : TypeNode + + typeName: EntityName; +>typeName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface TypeQueryNode extends TypeNode { +>TypeQueryNode : TypeQueryNode +>TypeNode : TypeNode + + exprName: EntityName; +>exprName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + } + interface TypeLiteralNode extends TypeNode, Declaration { +>TypeLiteralNode : TypeLiteralNode +>TypeNode : TypeNode +>Declaration : Declaration + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Node : Node + } + interface ArrayTypeNode extends TypeNode { +>ArrayTypeNode : ArrayTypeNode +>TypeNode : TypeNode + + elementType: TypeNode; +>elementType : TypeNode +>TypeNode : TypeNode + } + interface TupleTypeNode extends TypeNode { +>TupleTypeNode : TupleTypeNode +>TypeNode : TypeNode + + elementTypes: NodeArray; +>elementTypes : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface UnionTypeNode extends TypeNode { +>UnionTypeNode : UnionTypeNode +>TypeNode : TypeNode + + types: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface ParenthesizedTypeNode extends TypeNode { +>ParenthesizedTypeNode : ParenthesizedTypeNode +>TypeNode : TypeNode + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface StringLiteralTypeNode extends LiteralExpression, TypeNode { +>StringLiteralTypeNode : StringLiteralTypeNode +>LiteralExpression : LiteralExpression +>TypeNode : TypeNode + } + interface Expression extends Node { +>Expression : Expression +>Node : Node + + _expressionBrand: any; +>_expressionBrand : any + + contextualType?: Type; +>contextualType : Type +>Type : Type + } + interface UnaryExpression extends Expression { +>UnaryExpression : UnaryExpression +>Expression : Expression + + _unaryExpressionBrand: any; +>_unaryExpressionBrand : any + } + interface PrefixUnaryExpression extends UnaryExpression { +>PrefixUnaryExpression : PrefixUnaryExpression +>UnaryExpression : UnaryExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + + operand: UnaryExpression; +>operand : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface PostfixUnaryExpression extends PostfixExpression { +>PostfixUnaryExpression : PostfixUnaryExpression +>PostfixExpression : PostfixExpression + + operand: LeftHandSideExpression; +>operand : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + } + interface PostfixExpression extends UnaryExpression { +>PostfixExpression : PostfixExpression +>UnaryExpression : UnaryExpression + + _postfixExpressionBrand: any; +>_postfixExpressionBrand : any + } + interface LeftHandSideExpression extends PostfixExpression { +>LeftHandSideExpression : LeftHandSideExpression +>PostfixExpression : PostfixExpression + + _leftHandSideExpressionBrand: any; +>_leftHandSideExpressionBrand : any + } + interface MemberExpression extends LeftHandSideExpression { +>MemberExpression : MemberExpression +>LeftHandSideExpression : LeftHandSideExpression + + _memberExpressionBrand: any; +>_memberExpressionBrand : any + } + interface PrimaryExpression extends MemberExpression { +>PrimaryExpression : PrimaryExpression +>MemberExpression : MemberExpression + + _primaryExpressionBrand: any; +>_primaryExpressionBrand : any + } + interface DeleteExpression extends UnaryExpression { +>DeleteExpression : DeleteExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface TypeOfExpression extends UnaryExpression { +>TypeOfExpression : TypeOfExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface VoidExpression extends UnaryExpression { +>VoidExpression : VoidExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface YieldExpression extends Expression { +>YieldExpression : YieldExpression +>Expression : Expression + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BinaryExpression extends Expression { +>BinaryExpression : BinaryExpression +>Expression : Expression + + left: Expression; +>left : Expression +>Expression : Expression + + operatorToken: Node; +>operatorToken : Node +>Node : Node + + right: Expression; +>right : Expression +>Expression : Expression + } + interface ConditionalExpression extends Expression { +>ConditionalExpression : ConditionalExpression +>Expression : Expression + + condition: Expression; +>condition : Expression +>Expression : Expression + + questionToken: Node; +>questionToken : Node +>Node : Node + + whenTrue: Expression; +>whenTrue : Expression +>Expression : Expression + + colonToken: Node; +>colonToken : Node +>Node : Node + + whenFalse: Expression; +>whenFalse : Expression +>Expression : Expression + } + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { +>FunctionExpression : FunctionExpression +>PrimaryExpression : PrimaryExpression +>FunctionLikeDeclaration : FunctionLikeDeclaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + body: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface ArrowFunction extends Expression, FunctionLikeDeclaration { +>ArrowFunction : ArrowFunction +>Expression : Expression +>FunctionLikeDeclaration : FunctionLikeDeclaration + + equalsGreaterThanToken: Node; +>equalsGreaterThanToken : Node +>Node : Node + } + interface LiteralExpression extends PrimaryExpression { +>LiteralExpression : LiteralExpression +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + + isUnterminated?: boolean; +>isUnterminated : boolean + + hasExtendedUnicodeEscape?: boolean; +>hasExtendedUnicodeEscape : boolean + } + interface StringLiteralExpression extends LiteralExpression { +>StringLiteralExpression : StringLiteralExpression +>LiteralExpression : LiteralExpression + + _stringLiteralExpressionBrand: any; +>_stringLiteralExpressionBrand : any + } + interface TemplateExpression extends PrimaryExpression { +>TemplateExpression : TemplateExpression +>PrimaryExpression : PrimaryExpression + + head: LiteralExpression; +>head : LiteralExpression +>LiteralExpression : LiteralExpression + + templateSpans: NodeArray; +>templateSpans : NodeArray +>NodeArray : NodeArray +>TemplateSpan : TemplateSpan + } + interface TemplateSpan extends Node { +>TemplateSpan : TemplateSpan +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + + literal: LiteralExpression; +>literal : LiteralExpression +>LiteralExpression : LiteralExpression + } + interface ParenthesizedExpression extends PrimaryExpression { +>ParenthesizedExpression : ParenthesizedExpression +>PrimaryExpression : PrimaryExpression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ArrayLiteralExpression extends PrimaryExpression { +>ArrayLiteralExpression : ArrayLiteralExpression +>PrimaryExpression : PrimaryExpression + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface SpreadElementExpression extends Expression { +>SpreadElementExpression : SpreadElementExpression +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ObjectLiteralExpression extends PrimaryExpression, Declaration { +>ObjectLiteralExpression : ObjectLiteralExpression +>PrimaryExpression : PrimaryExpression +>Declaration : Declaration + + properties: NodeArray; +>properties : NodeArray +>NodeArray : NodeArray +>ObjectLiteralElement : ObjectLiteralElement + } + interface PropertyAccessExpression extends MemberExpression { +>PropertyAccessExpression : PropertyAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + dotToken: Node; +>dotToken : Node +>Node : Node + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ElementAccessExpression extends MemberExpression { +>ElementAccessExpression : ElementAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + argumentExpression?: Expression; +>argumentExpression : Expression +>Expression : Expression + } + interface CallExpression extends LeftHandSideExpression { +>CallExpression : CallExpression +>LeftHandSideExpression : LeftHandSideExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + + arguments: NodeArray; +>arguments : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface HeritageClauseElement extends Node { +>HeritageClauseElement : HeritageClauseElement +>Node : Node + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface NewExpression extends CallExpression, PrimaryExpression { +>NewExpression : NewExpression +>CallExpression : CallExpression +>PrimaryExpression : PrimaryExpression + } + interface TaggedTemplateExpression extends MemberExpression { +>TaggedTemplateExpression : TaggedTemplateExpression +>MemberExpression : MemberExpression + + tag: LeftHandSideExpression; +>tag : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + template: LiteralExpression | TemplateExpression; +>template : LiteralExpression | TemplateExpression +>LiteralExpression : LiteralExpression +>TemplateExpression : TemplateExpression + } + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression; +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>CallExpression : CallExpression +>NewExpression : NewExpression +>TaggedTemplateExpression : TaggedTemplateExpression + + interface TypeAssertion extends UnaryExpression { +>TypeAssertion : TypeAssertion +>UnaryExpression : UnaryExpression + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface Statement extends Node, ModuleElement { +>Statement : Statement +>Node : Node +>ModuleElement : ModuleElement + + _statementBrand: any; +>_statementBrand : any + } + interface Block extends Statement { +>Block : Block +>Statement : Statement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface VariableStatement extends Statement { +>VariableStatement : VariableStatement +>Statement : Statement + + declarationList: VariableDeclarationList; +>declarationList : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + } + interface ExpressionStatement extends Statement { +>ExpressionStatement : ExpressionStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface IfStatement extends Statement { +>IfStatement : IfStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + thenStatement: Statement; +>thenStatement : Statement +>Statement : Statement + + elseStatement?: Statement; +>elseStatement : Statement +>Statement : Statement + } + interface IterationStatement extends Statement { +>IterationStatement : IterationStatement +>Statement : Statement + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface DoStatement extends IterationStatement { +>DoStatement : DoStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface WhileStatement extends IterationStatement { +>WhileStatement : WhileStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ForStatement extends IterationStatement { +>ForStatement : ForStatement +>IterationStatement : IterationStatement + + initializer?: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + condition?: Expression; +>condition : Expression +>Expression : Expression + + iterator?: Expression; +>iterator : Expression +>Expression : Expression + } + interface ForInStatement extends IterationStatement { +>ForInStatement : ForInStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BreakOrContinueStatement extends Statement { +>BreakOrContinueStatement : BreakOrContinueStatement +>Statement : Statement + + label?: Identifier; +>label : Identifier +>Identifier : Identifier + } + interface ReturnStatement extends Statement { +>ReturnStatement : ReturnStatement +>Statement : Statement + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface WithStatement extends Statement { +>WithStatement : WithStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface SwitchStatement extends Statement { +>SwitchStatement : SwitchStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + caseBlock: CaseBlock; +>caseBlock : CaseBlock +>CaseBlock : CaseBlock + } + interface CaseBlock extends Node { +>CaseBlock : CaseBlock +>Node : Node + + clauses: NodeArray; +>clauses : NodeArray +>NodeArray : NodeArray +>CaseOrDefaultClause : CaseClause | DefaultClause + } + interface CaseClause extends Node { +>CaseClause : CaseClause +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface DefaultClause extends Node { +>DefaultClause : DefaultClause +>Node : Node + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + type CaseOrDefaultClause = CaseClause | DefaultClause; +>CaseOrDefaultClause : CaseClause | DefaultClause +>CaseClause : CaseClause +>DefaultClause : DefaultClause + + interface LabeledStatement extends Statement { +>LabeledStatement : LabeledStatement +>Statement : Statement + + label: Identifier; +>label : Identifier +>Identifier : Identifier + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface ThrowStatement extends Statement { +>ThrowStatement : ThrowStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface TryStatement extends Statement { +>TryStatement : TryStatement +>Statement : Statement + + tryBlock: Block; +>tryBlock : Block +>Block : Block + + catchClause?: CatchClause; +>catchClause : CatchClause +>CatchClause : CatchClause + + finallyBlock?: Block; +>finallyBlock : Block +>Block : Block + } + interface CatchClause extends Node { +>CatchClause : CatchClause +>Node : Node + + variableDeclaration: VariableDeclaration; +>variableDeclaration : VariableDeclaration +>VariableDeclaration : VariableDeclaration + + block: Block; +>block : Block +>Block : Block + } + interface ModuleElement extends Node { +>ModuleElement : ModuleElement +>Node : Node + + _moduleElementBrand: any; +>_moduleElementBrand : any + } + interface ClassDeclaration extends Declaration, ModuleElement { +>ClassDeclaration : ClassDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>ClassElement : ClassElement + } + interface ClassElement extends Declaration { +>ClassElement : ClassElement +>Declaration : Declaration + + _classElementBrand: any; +>_classElementBrand : any + } + interface InterfaceDeclaration extends Declaration, ModuleElement { +>InterfaceDeclaration : InterfaceDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Declaration : Declaration + } + interface HeritageClause extends Node { +>HeritageClause : HeritageClause +>Node : Node + + token: SyntaxKind; +>token : SyntaxKind +>SyntaxKind : SyntaxKind + + types?: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>HeritageClauseElement : HeritageClauseElement + } + interface TypeAliasDeclaration extends Declaration, ModuleElement { +>TypeAliasDeclaration : TypeAliasDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface EnumMember extends Declaration { +>EnumMember : EnumMember +>Declaration : Declaration + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface EnumDeclaration extends Declaration, ModuleElement { +>EnumDeclaration : EnumDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>EnumMember : EnumMember + } + interface ModuleDeclaration extends Declaration, ModuleElement { +>ModuleDeclaration : ModuleDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier | LiteralExpression; +>name : Identifier | LiteralExpression +>Identifier : Identifier +>LiteralExpression : LiteralExpression + + body: ModuleBlock | ModuleDeclaration; +>body : ModuleDeclaration | ModuleBlock +>ModuleBlock : ModuleBlock +>ModuleDeclaration : ModuleDeclaration + } + interface ModuleBlock extends Node, ModuleElement { +>ModuleBlock : ModuleBlock +>Node : Node +>ModuleElement : ModuleElement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + } + interface ImportEqualsDeclaration extends Declaration, ModuleElement { +>ImportEqualsDeclaration : ImportEqualsDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + moduleReference: EntityName | ExternalModuleReference; +>moduleReference : Identifier | QualifiedName | ExternalModuleReference +>EntityName : Identifier | QualifiedName +>ExternalModuleReference : ExternalModuleReference + } + interface ExternalModuleReference extends Node { +>ExternalModuleReference : ExternalModuleReference +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface ImportDeclaration extends Statement, ModuleElement { +>ImportDeclaration : ImportDeclaration +>Statement : Statement +>ModuleElement : ModuleElement + + importClause?: ImportClause; +>importClause : ImportClause +>ImportClause : ImportClause + + moduleSpecifier: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface ImportClause extends Declaration { +>ImportClause : ImportClause +>Declaration : Declaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + namedBindings?: NamespaceImport | NamedImports; +>namedBindings : NamespaceImport | NamedImportsOrExports +>NamespaceImport : NamespaceImport +>NamedImports : NamedImportsOrExports + } + interface NamespaceImport extends Declaration { +>NamespaceImport : NamespaceImport +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ExportDeclaration extends Declaration, ModuleElement { +>ExportDeclaration : ExportDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + exportClause?: NamedExports; +>exportClause : NamedImportsOrExports +>NamedExports : NamedImportsOrExports + + moduleSpecifier?: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface NamedImportsOrExports extends Node { +>NamedImportsOrExports : NamedImportsOrExports +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>ImportOrExportSpecifier : ImportOrExportSpecifier + } + type NamedImports = NamedImportsOrExports; +>NamedImports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + type NamedExports = NamedImportsOrExports; +>NamedExports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + interface ImportOrExportSpecifier extends Declaration { +>ImportOrExportSpecifier : ImportOrExportSpecifier +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + type ImportSpecifier = ImportOrExportSpecifier; +>ImportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + + type ExportSpecifier = ImportOrExportSpecifier; +>ExportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + + interface ExportAssignment extends Declaration, ModuleElement { +>ExportAssignment : ExportAssignment +>Declaration : Declaration +>ModuleElement : ModuleElement + + isExportEquals?: boolean; +>isExportEquals : boolean + + expression?: Expression; +>expression : Expression +>Expression : Expression + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface FileReference extends TextRange { +>FileReference : FileReference +>TextRange : TextRange + + fileName: string; +>fileName : string + } + interface CommentRange extends TextRange { +>CommentRange : CommentRange +>TextRange : TextRange + + hasTrailingNewLine?: boolean; +>hasTrailingNewLine : boolean + } + interface SourceFile extends Declaration { +>SourceFile : SourceFile +>Declaration : Declaration + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + + endOfFileToken: Node; +>endOfFileToken : Node +>Node : Node + + fileName: string; +>fileName : string + + text: string; +>text : string + + amdDependencies: { +>amdDependencies : { path: string; name: string; }[] + + path: string; +>path : string + + name: string; +>name : string + + }[]; + amdModuleName: string; +>amdModuleName : string + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + hasNoDefaultLib: boolean; +>hasNoDefaultLib : boolean + + externalModuleIndicator: Node; +>externalModuleIndicator : Node +>Node : Node + + languageVersion: ScriptTarget; +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + identifiers: Map; +>identifiers : Map +>Map : Map + } + interface ScriptReferenceHost { +>ScriptReferenceHost : ScriptReferenceHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + } + interface WriteFileCallback { +>WriteFileCallback : WriteFileCallback + + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; +>fileName : string +>data : string +>writeByteOrderMark : boolean +>onError : (message: string) => void +>message : string + } + interface Program extends ScriptReferenceHost { +>Program : Program +>ScriptReferenceHost : ScriptReferenceHost + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + /** + * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then + * the JavaScript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the JavaScript and declaration for that + * specific file will be generated. + * + * If writeFile is not specified then the writeFile callback from the compiler host will be + * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the JavaScript and declaration files. + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; +>emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult +>targetSourceFile : SourceFile +>SourceFile : SourceFile +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback +>EmitResult : EmitResult + + getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSyntacticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getGlobalDiagnostics(): Diagnostic[]; +>getGlobalDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSemanticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getDeclarationDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getTypeChecker(): TypeChecker; +>getTypeChecker : () => TypeChecker +>TypeChecker : TypeChecker + + getCommonSourceDirectory(): string; +>getCommonSourceDirectory : () => string + } + interface SourceMapSpan { +>SourceMapSpan : SourceMapSpan + + emittedLine: number; +>emittedLine : number + + emittedColumn: number; +>emittedColumn : number + + sourceLine: number; +>sourceLine : number + + sourceColumn: number; +>sourceColumn : number + + nameIndex?: number; +>nameIndex : number + + sourceIndex: number; +>sourceIndex : number + } + interface SourceMapData { +>SourceMapData : SourceMapData + + sourceMapFilePath: string; +>sourceMapFilePath : string + + jsSourceMappingURL: string; +>jsSourceMappingURL : string + + sourceMapFile: string; +>sourceMapFile : string + + sourceMapSourceRoot: string; +>sourceMapSourceRoot : string + + sourceMapSources: string[]; +>sourceMapSources : string[] + + inputSourceFileNames: string[]; +>inputSourceFileNames : string[] + + sourceMapNames?: string[]; +>sourceMapNames : string[] + + sourceMapMappings: string; +>sourceMapMappings : string + + sourceMapDecodedMappings: SourceMapSpan[]; +>sourceMapDecodedMappings : SourceMapSpan[] +>SourceMapSpan : SourceMapSpan + } + enum ExitStatus { +>ExitStatus : ExitStatus + + Success = 0, +>Success : ExitStatus + + DiagnosticsPresent_OutputsSkipped = 1, +>DiagnosticsPresent_OutputsSkipped : ExitStatus + + DiagnosticsPresent_OutputsGenerated = 2, +>DiagnosticsPresent_OutputsGenerated : ExitStatus + } + interface EmitResult { +>EmitResult : EmitResult + + emitSkipped: boolean; +>emitSkipped : boolean + + diagnostics: Diagnostic[]; +>diagnostics : Diagnostic[] +>Diagnostic : Diagnostic + + sourceMaps: SourceMapData[]; +>sourceMaps : SourceMapData[] +>SourceMapData : SourceMapData + } + interface TypeCheckerHost { +>TypeCheckerHost : TypeCheckerHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + } + interface TypeChecker { +>TypeChecker : TypeChecker + + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; +>getTypeOfSymbolAtLocation : (symbol: Symbol, node: Node) => Type +>symbol : Symbol +>Symbol : Symbol +>node : Node +>Node : Node +>Type : Type + + getDeclaredTypeOfSymbol(symbol: Symbol): Type; +>getDeclaredTypeOfSymbol : (symbol: Symbol) => Type +>symbol : Symbol +>Symbol : Symbol +>Type : Type + + getPropertiesOfType(type: Type): Symbol[]; +>getPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getPropertyOfType(type: Type, propertyName: string): Symbol; +>getPropertyOfType : (type: Type, propertyName: string) => Symbol +>type : Type +>Type : Type +>propertyName : string +>Symbol : Symbol + + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; +>getSignaturesOfType : (type: Type, kind: SignatureKind) => Signature[] +>type : Type +>Type : Type +>kind : SignatureKind +>SignatureKind : SignatureKind +>Signature : Signature + + getIndexTypeOfType(type: Type, kind: IndexKind): Type; +>getIndexTypeOfType : (type: Type, kind: IndexKind) => Type +>type : Type +>Type : Type +>kind : IndexKind +>IndexKind : IndexKind +>Type : Type + + getReturnTypeOfSignature(signature: Signature): Type; +>getReturnTypeOfSignature : (signature: Signature) => Type +>signature : Signature +>Signature : Signature +>Type : Type + + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; +>getSymbolsInScope : (location: Node, meaning: SymbolFlags) => Symbol[] +>location : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>Symbol : Symbol + + getSymbolAtLocation(node: Node): Symbol; +>getSymbolAtLocation : (node: Node) => Symbol +>node : Node +>Node : Node +>Symbol : Symbol + + getShorthandAssignmentValueSymbol(location: Node): Symbol; +>getShorthandAssignmentValueSymbol : (location: Node) => Symbol +>location : Node +>Node : Node +>Symbol : Symbol + + getTypeAtLocation(node: Node): Type; +>getTypeAtLocation : (node: Node) => Type +>node : Node +>Node : Node +>Type : Type + + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; +>typeToString : (type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => string +>type : Type +>Type : Type +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; +>symbolToString : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => string +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + + getSymbolDisplayBuilder(): SymbolDisplayBuilder; +>getSymbolDisplayBuilder : () => SymbolDisplayBuilder +>SymbolDisplayBuilder : SymbolDisplayBuilder + + getFullyQualifiedName(symbol: Symbol): string; +>getFullyQualifiedName : (symbol: Symbol) => string +>symbol : Symbol +>Symbol : Symbol + + getAugmentedPropertiesOfType(type: Type): Symbol[]; +>getAugmentedPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getRootSymbols(symbol: Symbol): Symbol[]; +>getRootSymbols : (symbol: Symbol) => Symbol[] +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + + getContextualType(node: Expression): Type; +>getContextualType : (node: Expression) => Type +>node : Expression +>Expression : Expression +>Type : Type + + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; +>getResolvedSignature : (node: CallExpression | NewExpression | TaggedTemplateExpression, candidatesOutArray?: Signature[]) => Signature +>node : CallExpression | NewExpression | TaggedTemplateExpression +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>candidatesOutArray : Signature[] +>Signature : Signature +>Signature : Signature + + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; +>getSignatureFromDeclaration : (declaration: SignatureDeclaration) => Signature +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>Signature : Signature + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + isUndefinedSymbol(symbol: Symbol): boolean; +>isUndefinedSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + isArgumentsSymbol(symbol: Symbol): boolean; +>isArgumentsSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; +>isValidPropertyAccess : (node: QualifiedName | PropertyAccessExpression, propertyName: string) => boolean +>node : QualifiedName | PropertyAccessExpression +>PropertyAccessExpression : PropertyAccessExpression +>QualifiedName : QualifiedName +>propertyName : string + + getAliasedSymbol(symbol: Symbol): Symbol; +>getAliasedSymbol : (symbol: Symbol) => Symbol +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + + getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; +>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration +>Symbol : Symbol + } + interface SymbolDisplayBuilder { +>SymbolDisplayBuilder : SymbolDisplayBuilder + + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeDisplay : (type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>type : Type +>Type : Type +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; +>buildSymbolDisplay : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>flags : SymbolFormatFlags +>SymbolFormatFlags : SymbolFormatFlags + + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildSignatureDisplay : (signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signatures : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildParameterDisplay : (parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameter : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplay : (tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>tp : TypeParameter +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplayFromSymbol : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaraiton : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForParametersAndDelimiters : (parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameters : Symbol[] +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForTypeParametersAndDelimiters : (typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildReturnTypeDisplay : (signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signature : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + } + interface SymbolWriter { +>SymbolWriter : SymbolWriter + + writeKeyword(text: string): void; +>writeKeyword : (text: string) => void +>text : string + + writeOperator(text: string): void; +>writeOperator : (text: string) => void +>text : string + + writePunctuation(text: string): void; +>writePunctuation : (text: string) => void +>text : string + + writeSpace(text: string): void; +>writeSpace : (text: string) => void +>text : string + + writeStringLiteral(text: string): void; +>writeStringLiteral : (text: string) => void +>text : string + + writeParameter(text: string): void; +>writeParameter : (text: string) => void +>text : string + + writeSymbol(text: string, symbol: Symbol): void; +>writeSymbol : (text: string, symbol: Symbol) => void +>text : string +>symbol : Symbol +>Symbol : Symbol + + writeLine(): void; +>writeLine : () => void + + increaseIndent(): void; +>increaseIndent : () => void + + decreaseIndent(): void; +>decreaseIndent : () => void + + clear(): void; +>clear : () => void + + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; +>trackSymbol : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => void +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + } + const enum TypeFormatFlags { +>TypeFormatFlags : TypeFormatFlags + + None = 0, +>None : TypeFormatFlags + + WriteArrayAsGenericType = 1, +>WriteArrayAsGenericType : TypeFormatFlags + + UseTypeOfFunction = 2, +>UseTypeOfFunction : TypeFormatFlags + + NoTruncation = 4, +>NoTruncation : TypeFormatFlags + + WriteArrowStyleSignature = 8, +>WriteArrowStyleSignature : TypeFormatFlags + + WriteOwnNameForAnyLike = 16, +>WriteOwnNameForAnyLike : TypeFormatFlags + + WriteTypeArgumentsOfSignature = 32, +>WriteTypeArgumentsOfSignature : TypeFormatFlags + + InElementType = 64, +>InElementType : TypeFormatFlags + + UseFullyQualifiedType = 128, +>UseFullyQualifiedType : TypeFormatFlags + } + const enum SymbolFormatFlags { +>SymbolFormatFlags : SymbolFormatFlags + + None = 0, +>None : SymbolFormatFlags + + WriteTypeParametersOrArguments = 1, +>WriteTypeParametersOrArguments : SymbolFormatFlags + + UseOnlyExternalAliasing = 2, +>UseOnlyExternalAliasing : SymbolFormatFlags + } + const enum SymbolAccessibility { +>SymbolAccessibility : SymbolAccessibility + + Accessible = 0, +>Accessible : SymbolAccessibility + + NotAccessible = 1, +>NotAccessible : SymbolAccessibility + + CannotBeNamed = 2, +>CannotBeNamed : SymbolAccessibility + } + type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration; +>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration +>ImportDeclaration : ImportDeclaration +>ImportEqualsDeclaration : ImportEqualsDeclaration + + interface SymbolVisibilityResult { +>SymbolVisibilityResult : SymbolVisibilityResult + + accessibility: SymbolAccessibility; +>accessibility : SymbolAccessibility +>SymbolAccessibility : SymbolAccessibility + + aliasesToMakeVisible?: AnyImportSyntax[]; +>aliasesToMakeVisible : (ImportEqualsDeclaration | ImportDeclaration)[] +>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration + + errorSymbolName?: string; +>errorSymbolName : string + + errorNode?: Node; +>errorNode : Node +>Node : Node + } + interface SymbolAccessiblityResult extends SymbolVisibilityResult { +>SymbolAccessiblityResult : SymbolAccessiblityResult +>SymbolVisibilityResult : SymbolVisibilityResult + + errorModuleName?: string; +>errorModuleName : string + } + interface EmitResolver { +>EmitResolver : EmitResolver + + hasGlobalName(name: string): boolean; +>hasGlobalName : (name: string) => boolean +>name : string + + getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string; +>getExpressionNameSubstitution : (node: Identifier, getGeneratedNameForNode: (node: Node) => string) => string +>node : Identifier +>Identifier : Identifier +>getGeneratedNameForNode : (node: Node) => string +>node : Node +>Node : Node + + isValueAliasDeclaration(node: Node): boolean; +>isValueAliasDeclaration : (node: Node) => boolean +>node : Node +>Node : Node + + isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean; +>isReferencedAliasDeclaration : (node: Node, checkChildren?: boolean) => boolean +>node : Node +>Node : Node +>checkChildren : boolean + + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; +>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean +>node : ImportEqualsDeclaration +>ImportEqualsDeclaration : ImportEqualsDeclaration + + getNodeCheckFlags(node: Node): NodeCheckFlags; +>getNodeCheckFlags : (node: Node) => NodeCheckFlags +>node : Node +>Node : Node +>NodeCheckFlags : NodeCheckFlags + + isDeclarationVisible(node: Declaration): boolean; +>isDeclarationVisible : (node: Declaration) => boolean +>node : Declaration +>Declaration : Declaration + + collectLinkedAliases(node: Identifier): Node[]; +>collectLinkedAliases : (node: Identifier) => Node[] +>node : Identifier +>Identifier : Identifier +>Node : Node + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeTypeOfDeclaration : (declaration: VariableLikeDeclaration | AccessorDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>declaration : VariableLikeDeclaration | AccessorDeclaration +>AccessorDeclaration : AccessorDeclaration +>VariableLikeDeclaration : VariableLikeDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>signatureDeclaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeTypeOfExpression : (expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>expr : Expression +>Expression : Expression +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; +>isSymbolAccessible : (symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) => SymbolAccessiblityResult +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>SymbolAccessiblityResult : SymbolAccessiblityResult + + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; +>isEntityNameVisible : (entityName: Expression | Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult +>entityName : Expression | Identifier | QualifiedName +>EntityName : Identifier | QualifiedName +>Expression : Expression +>enclosingDeclaration : Node +>Node : Node +>SymbolVisibilityResult : SymbolVisibilityResult + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + resolvesToSomeValue(location: Node, name: string): boolean; +>resolvesToSomeValue : (location: Node, name: string) => boolean +>location : Node +>Node : Node +>name : string + + getBlockScopedVariableId(node: Identifier): number; +>getBlockScopedVariableId : (node: Identifier) => number +>node : Identifier +>Identifier : Identifier + } + const enum SymbolFlags { +>SymbolFlags : SymbolFlags + + FunctionScopedVariable = 1, +>FunctionScopedVariable : SymbolFlags + + BlockScopedVariable = 2, +>BlockScopedVariable : SymbolFlags + + Property = 4, +>Property : SymbolFlags + + EnumMember = 8, +>EnumMember : SymbolFlags + + Function = 16, +>Function : SymbolFlags + + Class = 32, +>Class : SymbolFlags + + Interface = 64, +>Interface : SymbolFlags + + ConstEnum = 128, +>ConstEnum : SymbolFlags + + RegularEnum = 256, +>RegularEnum : SymbolFlags + + ValueModule = 512, +>ValueModule : SymbolFlags + + NamespaceModule = 1024, +>NamespaceModule : SymbolFlags + + TypeLiteral = 2048, +>TypeLiteral : SymbolFlags + + ObjectLiteral = 4096, +>ObjectLiteral : SymbolFlags + + Method = 8192, +>Method : SymbolFlags + + Constructor = 16384, +>Constructor : SymbolFlags + + GetAccessor = 32768, +>GetAccessor : SymbolFlags + + SetAccessor = 65536, +>SetAccessor : SymbolFlags + + Signature = 131072, +>Signature : SymbolFlags + + TypeParameter = 262144, +>TypeParameter : SymbolFlags + + TypeAlias = 524288, +>TypeAlias : SymbolFlags + + ExportValue = 1048576, +>ExportValue : SymbolFlags + + ExportType = 2097152, +>ExportType : SymbolFlags + + ExportNamespace = 4194304, +>ExportNamespace : SymbolFlags + + Alias = 8388608, +>Alias : SymbolFlags + + Instantiated = 16777216, +>Instantiated : SymbolFlags + + Merged = 33554432, +>Merged : SymbolFlags + + Transient = 67108864, +>Transient : SymbolFlags + + Prototype = 134217728, +>Prototype : SymbolFlags + + UnionProperty = 268435456, +>UnionProperty : SymbolFlags + + Optional = 536870912, +>Optional : SymbolFlags + + ExportStar = 1073741824, +>ExportStar : SymbolFlags + + Enum = 384, +>Enum : SymbolFlags + + Variable = 3, +>Variable : SymbolFlags + + Value = 107455, +>Value : SymbolFlags + + Type = 793056, +>Type : SymbolFlags + + Namespace = 1536, +>Namespace : SymbolFlags + + Module = 1536, +>Module : SymbolFlags + + Accessor = 98304, +>Accessor : SymbolFlags + + FunctionScopedVariableExcludes = 107454, +>FunctionScopedVariableExcludes : SymbolFlags + + BlockScopedVariableExcludes = 107455, +>BlockScopedVariableExcludes : SymbolFlags + + ParameterExcludes = 107455, +>ParameterExcludes : SymbolFlags + + PropertyExcludes = 107455, +>PropertyExcludes : SymbolFlags + + EnumMemberExcludes = 107455, +>EnumMemberExcludes : SymbolFlags + + FunctionExcludes = 106927, +>FunctionExcludes : SymbolFlags + + ClassExcludes = 899583, +>ClassExcludes : SymbolFlags + + InterfaceExcludes = 792992, +>InterfaceExcludes : SymbolFlags + + RegularEnumExcludes = 899327, +>RegularEnumExcludes : SymbolFlags + + ConstEnumExcludes = 899967, +>ConstEnumExcludes : SymbolFlags + + ValueModuleExcludes = 106639, +>ValueModuleExcludes : SymbolFlags + + NamespaceModuleExcludes = 0, +>NamespaceModuleExcludes : SymbolFlags + + MethodExcludes = 99263, +>MethodExcludes : SymbolFlags + + GetAccessorExcludes = 41919, +>GetAccessorExcludes : SymbolFlags + + SetAccessorExcludes = 74687, +>SetAccessorExcludes : SymbolFlags + + TypeParameterExcludes = 530912, +>TypeParameterExcludes : SymbolFlags + + TypeAliasExcludes = 793056, +>TypeAliasExcludes : SymbolFlags + + AliasExcludes = 8388608, +>AliasExcludes : SymbolFlags + + ModuleMember = 8914931, +>ModuleMember : SymbolFlags + + ExportHasLocal = 944, +>ExportHasLocal : SymbolFlags + + HasLocals = 255504, +>HasLocals : SymbolFlags + + HasExports = 1952, +>HasExports : SymbolFlags + + HasMembers = 6240, +>HasMembers : SymbolFlags + + IsContainer = 262128, +>IsContainer : SymbolFlags + + PropertyOrAccessor = 98308, +>PropertyOrAccessor : SymbolFlags + + Export = 7340032, +>Export : SymbolFlags + } + interface Symbol { +>Symbol : Symbol + + flags: SymbolFlags; +>flags : SymbolFlags +>SymbolFlags : SymbolFlags + + name: string; +>name : string + + id?: number; +>id : number + + mergeId?: number; +>mergeId : number + + declarations?: Declaration[]; +>declarations : Declaration[] +>Declaration : Declaration + + parent?: Symbol; +>parent : Symbol +>Symbol : Symbol + + members?: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + exports?: SymbolTable; +>exports : SymbolTable +>SymbolTable : SymbolTable + + exportSymbol?: Symbol; +>exportSymbol : Symbol +>Symbol : Symbol + + valueDeclaration?: Declaration; +>valueDeclaration : Declaration +>Declaration : Declaration + + constEnumOnlyModule?: boolean; +>constEnumOnlyModule : boolean + } + interface SymbolLinks { +>SymbolLinks : SymbolLinks + + target?: Symbol; +>target : Symbol +>Symbol : Symbol + + type?: Type; +>type : Type +>Type : Type + + declaredType?: Type; +>declaredType : Type +>Type : Type + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + referenced?: boolean; +>referenced : boolean + + unionType?: UnionType; +>unionType : UnionType +>UnionType : UnionType + + resolvedExports?: SymbolTable; +>resolvedExports : SymbolTable +>SymbolTable : SymbolTable + + exportsChecked?: boolean; +>exportsChecked : boolean + } + interface TransientSymbol extends Symbol, SymbolLinks { +>TransientSymbol : TransientSymbol +>Symbol : Symbol +>SymbolLinks : SymbolLinks + } + interface SymbolTable { +>SymbolTable : SymbolTable + + [index: string]: Symbol; +>index : string +>Symbol : Symbol + } + const enum NodeCheckFlags { +>NodeCheckFlags : NodeCheckFlags + + TypeChecked = 1, +>TypeChecked : NodeCheckFlags + + LexicalThis = 2, +>LexicalThis : NodeCheckFlags + + CaptureThis = 4, +>CaptureThis : NodeCheckFlags + + EmitExtends = 8, +>EmitExtends : NodeCheckFlags + + SuperInstance = 16, +>SuperInstance : NodeCheckFlags + + SuperStatic = 32, +>SuperStatic : NodeCheckFlags + + ContextChecked = 64, +>ContextChecked : NodeCheckFlags + + EnumValuesComputed = 128, +>EnumValuesComputed : NodeCheckFlags + + BlockScopedBindingInLoop = 256, +>BlockScopedBindingInLoop : NodeCheckFlags + + EmitDecorate = 512, +>EmitDecorate : NodeCheckFlags + } + interface NodeLinks { +>NodeLinks : NodeLinks + + resolvedType?: Type; +>resolvedType : Type +>Type : Type + + resolvedSignature?: Signature; +>resolvedSignature : Signature +>Signature : Signature + + resolvedSymbol?: Symbol; +>resolvedSymbol : Symbol +>Symbol : Symbol + + flags?: NodeCheckFlags; +>flags : NodeCheckFlags +>NodeCheckFlags : NodeCheckFlags + + enumMemberValue?: number; +>enumMemberValue : number + + isIllegalTypeReferenceInConstraint?: boolean; +>isIllegalTypeReferenceInConstraint : boolean + + isVisible?: boolean; +>isVisible : boolean + + generatedName?: string; +>generatedName : string + + generatedNames?: Map; +>generatedNames : Map +>Map : Map + + assignmentChecks?: Map; +>assignmentChecks : Map +>Map : Map + + hasReportedStatementInAmbientContext?: boolean; +>hasReportedStatementInAmbientContext : boolean + + importOnRightSide?: Symbol; +>importOnRightSide : Symbol +>Symbol : Symbol + } + const enum TypeFlags { +>TypeFlags : TypeFlags + + Any = 1, +>Any : TypeFlags + + String = 2, +>String : TypeFlags + + Number = 4, +>Number : TypeFlags + + Boolean = 8, +>Boolean : TypeFlags + + Void = 16, +>Void : TypeFlags + + Undefined = 32, +>Undefined : TypeFlags + + Null = 64, +>Null : TypeFlags + + Enum = 128, +>Enum : TypeFlags + + StringLiteral = 256, +>StringLiteral : TypeFlags + + TypeParameter = 512, +>TypeParameter : TypeFlags + + Class = 1024, +>Class : TypeFlags + + Interface = 2048, +>Interface : TypeFlags + + Reference = 4096, +>Reference : TypeFlags + + Tuple = 8192, +>Tuple : TypeFlags + + Union = 16384, +>Union : TypeFlags + + Anonymous = 32768, +>Anonymous : TypeFlags + + FromSignature = 65536, +>FromSignature : TypeFlags + + ObjectLiteral = 131072, +>ObjectLiteral : TypeFlags + + ContainsUndefinedOrNull = 262144, +>ContainsUndefinedOrNull : TypeFlags + + ContainsObjectLiteral = 524288, +>ContainsObjectLiteral : TypeFlags + + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, +>Intrinsic : TypeFlags + + Primitive = 1049086, +>Primitive : TypeFlags + + StringLike = 258, +>StringLike : TypeFlags + + NumberLike = 132, +>NumberLike : TypeFlags + + ObjectType = 48128, +>ObjectType : TypeFlags + + RequiresWidening = 786432, +>RequiresWidening : TypeFlags + } + interface Type { +>Type : Type + + flags: TypeFlags; +>flags : TypeFlags +>TypeFlags : TypeFlags + + id: number; +>id : number + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + } + interface IntrinsicType extends Type { +>IntrinsicType : IntrinsicType +>Type : Type + + intrinsicName: string; +>intrinsicName : string + } + interface StringLiteralType extends Type { +>StringLiteralType : StringLiteralType +>Type : Type + + text: string; +>text : string + } + interface ObjectType extends Type { +>ObjectType : ObjectType +>Type : Type + } + interface InterfaceType extends ObjectType { +>InterfaceType : InterfaceType +>ObjectType : ObjectType + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + baseTypes: ObjectType[]; +>baseTypes : ObjectType[] +>ObjectType : ObjectType + + declaredProperties: Symbol[]; +>declaredProperties : Symbol[] +>Symbol : Symbol + + declaredCallSignatures: Signature[]; +>declaredCallSignatures : Signature[] +>Signature : Signature + + declaredConstructSignatures: Signature[]; +>declaredConstructSignatures : Signature[] +>Signature : Signature + + declaredStringIndexType: Type; +>declaredStringIndexType : Type +>Type : Type + + declaredNumberIndexType: Type; +>declaredNumberIndexType : Type +>Type : Type + } + interface TypeReference extends ObjectType { +>TypeReference : TypeReference +>ObjectType : ObjectType + + target: GenericType; +>target : GenericType +>GenericType : GenericType + + typeArguments: Type[]; +>typeArguments : Type[] +>Type : Type + } + interface GenericType extends InterfaceType, TypeReference { +>GenericType : GenericType +>InterfaceType : InterfaceType +>TypeReference : TypeReference + + instantiations: Map; +>instantiations : Map +>Map : Map +>TypeReference : TypeReference + } + interface TupleType extends ObjectType { +>TupleType : TupleType +>ObjectType : ObjectType + + elementTypes: Type[]; +>elementTypes : Type[] +>Type : Type + + baseArrayType: TypeReference; +>baseArrayType : TypeReference +>TypeReference : TypeReference + } + interface UnionType extends Type { +>UnionType : UnionType +>Type : Type + + types: Type[]; +>types : Type[] +>Type : Type + + resolvedProperties: SymbolTable; +>resolvedProperties : SymbolTable +>SymbolTable : SymbolTable + } + interface ResolvedType extends ObjectType, UnionType { +>ResolvedType : ResolvedType +>ObjectType : ObjectType +>UnionType : UnionType + + members: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + properties: Symbol[]; +>properties : Symbol[] +>Symbol : Symbol + + callSignatures: Signature[]; +>callSignatures : Signature[] +>Signature : Signature + + constructSignatures: Signature[]; +>constructSignatures : Signature[] +>Signature : Signature + + stringIndexType: Type; +>stringIndexType : Type +>Type : Type + + numberIndexType: Type; +>numberIndexType : Type +>Type : Type + } + interface TypeParameter extends Type { +>TypeParameter : TypeParameter +>Type : Type + + constraint: Type; +>constraint : Type +>Type : Type + + target?: TypeParameter; +>target : TypeParameter +>TypeParameter : TypeParameter + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + } + const enum SignatureKind { +>SignatureKind : SignatureKind + + Call = 0, +>Call : SignatureKind + + Construct = 1, +>Construct : SignatureKind + } + interface Signature { +>Signature : Signature + + declaration: SignatureDeclaration; +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + parameters: Symbol[]; +>parameters : Symbol[] +>Symbol : Symbol + + resolvedReturnType: Type; +>resolvedReturnType : Type +>Type : Type + + minArgumentCount: number; +>minArgumentCount : number + + hasRestParameter: boolean; +>hasRestParameter : boolean + + hasStringLiterals: boolean; +>hasStringLiterals : boolean + + target?: Signature; +>target : Signature +>Signature : Signature + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + unionSignatures?: Signature[]; +>unionSignatures : Signature[] +>Signature : Signature + + erasedSignatureCache?: Signature; +>erasedSignatureCache : Signature +>Signature : Signature + + isolatedSignatureType?: ObjectType; +>isolatedSignatureType : ObjectType +>ObjectType : ObjectType + } + const enum IndexKind { +>IndexKind : IndexKind + + String = 0, +>String : IndexKind + + Number = 1, +>Number : IndexKind + } + interface TypeMapper { +>TypeMapper : TypeMapper + + (t: Type): Type; +>t : Type +>Type : Type +>Type : Type + } + interface DiagnosticMessage { +>DiagnosticMessage : DiagnosticMessage + + key: string; +>key : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + interface DiagnosticMessageChain { +>DiagnosticMessageChain : DiagnosticMessageChain + + messageText: string; +>messageText : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + + next?: DiagnosticMessageChain; +>next : DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + } + interface Diagnostic { +>Diagnostic : Diagnostic + + file: SourceFile; +>file : SourceFile +>SourceFile : SourceFile + + start: number; +>start : number + + length: number; +>length : number + + messageText: string | DiagnosticMessageChain; +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + enum DiagnosticCategory { +>DiagnosticCategory : DiagnosticCategory + + Warning = 0, +>Warning : DiagnosticCategory + + Error = 1, +>Error : DiagnosticCategory + + Message = 2, +>Message : DiagnosticCategory + } + interface CompilerOptions { +>CompilerOptions : CompilerOptions + + allowNonTsExtensions?: boolean; +>allowNonTsExtensions : boolean + + charset?: string; +>charset : string + + codepage?: number; +>codepage : number + + declaration?: boolean; +>declaration : boolean + + diagnostics?: boolean; +>diagnostics : boolean + + emitBOM?: boolean; +>emitBOM : boolean + + help?: boolean; +>help : boolean + + listFiles?: boolean; +>listFiles : boolean + + locale?: string; +>locale : string + + mapRoot?: string; +>mapRoot : string + + module?: ModuleKind; +>module : ModuleKind +>ModuleKind : ModuleKind + + noEmit?: boolean; +>noEmit : boolean + + noEmitOnError?: boolean; +>noEmitOnError : boolean + + noErrorTruncation?: boolean; +>noErrorTruncation : boolean + + noImplicitAny?: boolean; +>noImplicitAny : boolean + + noLib?: boolean; +>noLib : boolean + + noLibCheck?: boolean; +>noLibCheck : boolean + + noResolve?: boolean; +>noResolve : boolean + + out?: string; +>out : string + + outDir?: string; +>outDir : string + + preserveConstEnums?: boolean; +>preserveConstEnums : boolean + + project?: string; +>project : string + + removeComments?: boolean; +>removeComments : boolean + + sourceMap?: boolean; +>sourceMap : boolean + + sourceRoot?: string; +>sourceRoot : string + + suppressImplicitAnyIndexErrors?: boolean; +>suppressImplicitAnyIndexErrors : boolean + + target?: ScriptTarget; +>target : ScriptTarget +>ScriptTarget : ScriptTarget + + version?: boolean; +>version : boolean + + watch?: boolean; +>watch : boolean + + [option: string]: string | number | boolean; +>option : string + } + const enum ModuleKind { +>ModuleKind : ModuleKind + + None = 0, +>None : ModuleKind + + CommonJS = 1, +>CommonJS : ModuleKind + + AMD = 2, +>AMD : ModuleKind + } + interface LineAndCharacter { +>LineAndCharacter : LineAndCharacter + + line: number; +>line : number + + character: number; +>character : number + } + const enum ScriptTarget { +>ScriptTarget : ScriptTarget + + ES3 = 0, +>ES3 : ScriptTarget + + ES5 = 1, +>ES5 : ScriptTarget + + ES6 = 2, +>ES6 : ScriptTarget + + Latest = 2, +>Latest : ScriptTarget + } + interface ParsedCommandLine { +>ParsedCommandLine : ParsedCommandLine + + options: CompilerOptions; +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + fileNames: string[]; +>fileNames : string[] + + errors: Diagnostic[]; +>errors : Diagnostic[] +>Diagnostic : Diagnostic + } + interface CommandLineOption { +>CommandLineOption : CommandLineOption + + name: string; +>name : string + + type: string | Map; +>type : string | Map +>Map : Map + + isFilePath?: boolean; +>isFilePath : boolean + + shortName?: string; +>shortName : string + + description?: DiagnosticMessage; +>description : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + paramType?: DiagnosticMessage; +>paramType : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + error?: DiagnosticMessage; +>error : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + experimental?: boolean; +>experimental : boolean + } + const enum CharacterCodes { +>CharacterCodes : CharacterCodes + + nullCharacter = 0, +>nullCharacter : CharacterCodes + + maxAsciiCharacter = 127, +>maxAsciiCharacter : CharacterCodes + + lineFeed = 10, +>lineFeed : CharacterCodes + + carriageReturn = 13, +>carriageReturn : CharacterCodes + + lineSeparator = 8232, +>lineSeparator : CharacterCodes + + paragraphSeparator = 8233, +>paragraphSeparator : CharacterCodes + + nextLine = 133, +>nextLine : CharacterCodes + + space = 32, +>space : CharacterCodes + + nonBreakingSpace = 160, +>nonBreakingSpace : CharacterCodes + + enQuad = 8192, +>enQuad : CharacterCodes + + emQuad = 8193, +>emQuad : CharacterCodes + + enSpace = 8194, +>enSpace : CharacterCodes + + emSpace = 8195, +>emSpace : CharacterCodes + + threePerEmSpace = 8196, +>threePerEmSpace : CharacterCodes + + fourPerEmSpace = 8197, +>fourPerEmSpace : CharacterCodes + + sixPerEmSpace = 8198, +>sixPerEmSpace : CharacterCodes + + figureSpace = 8199, +>figureSpace : CharacterCodes + + punctuationSpace = 8200, +>punctuationSpace : CharacterCodes + + thinSpace = 8201, +>thinSpace : CharacterCodes + + hairSpace = 8202, +>hairSpace : CharacterCodes + + zeroWidthSpace = 8203, +>zeroWidthSpace : CharacterCodes + + narrowNoBreakSpace = 8239, +>narrowNoBreakSpace : CharacterCodes + + ideographicSpace = 12288, +>ideographicSpace : CharacterCodes + + mathematicalSpace = 8287, +>mathematicalSpace : CharacterCodes + + ogham = 5760, +>ogham : CharacterCodes + + _ = 95, +>_ : CharacterCodes + + $ = 36, +>$ : CharacterCodes + + _0 = 48, +>_0 : CharacterCodes + + _1 = 49, +>_1 : CharacterCodes + + _2 = 50, +>_2 : CharacterCodes + + _3 = 51, +>_3 : CharacterCodes + + _4 = 52, +>_4 : CharacterCodes + + _5 = 53, +>_5 : CharacterCodes + + _6 = 54, +>_6 : CharacterCodes + + _7 = 55, +>_7 : CharacterCodes + + _8 = 56, +>_8 : CharacterCodes + + _9 = 57, +>_9 : CharacterCodes + + a = 97, +>a : CharacterCodes + + b = 98, +>b : CharacterCodes + + c = 99, +>c : CharacterCodes + + d = 100, +>d : CharacterCodes + + e = 101, +>e : CharacterCodes + + f = 102, +>f : CharacterCodes + + g = 103, +>g : CharacterCodes + + h = 104, +>h : CharacterCodes + + i = 105, +>i : CharacterCodes + + j = 106, +>j : CharacterCodes + + k = 107, +>k : CharacterCodes + + l = 108, +>l : CharacterCodes + + m = 109, +>m : CharacterCodes + + n = 110, +>n : CharacterCodes + + o = 111, +>o : CharacterCodes + + p = 112, +>p : CharacterCodes + + q = 113, +>q : CharacterCodes + + r = 114, +>r : CharacterCodes + + s = 115, +>s : CharacterCodes + + t = 116, +>t : CharacterCodes + + u = 117, +>u : CharacterCodes + + v = 118, +>v : CharacterCodes + + w = 119, +>w : CharacterCodes + + x = 120, +>x : CharacterCodes + + y = 121, +>y : CharacterCodes + + z = 122, +>z : CharacterCodes + + A = 65, +>A : CharacterCodes + + B = 66, +>B : CharacterCodes + + C = 67, +>C : CharacterCodes + + D = 68, +>D : CharacterCodes + + E = 69, +>E : CharacterCodes + + F = 70, +>F : CharacterCodes + + G = 71, +>G : CharacterCodes + + H = 72, +>H : CharacterCodes + + I = 73, +>I : CharacterCodes + + J = 74, +>J : CharacterCodes + + K = 75, +>K : CharacterCodes + + L = 76, +>L : CharacterCodes + + M = 77, +>M : CharacterCodes + + N = 78, +>N : CharacterCodes + + O = 79, +>O : CharacterCodes + + P = 80, +>P : CharacterCodes + + Q = 81, +>Q : CharacterCodes + + R = 82, +>R : CharacterCodes + + S = 83, +>S : CharacterCodes + + T = 84, +>T : CharacterCodes + + U = 85, +>U : CharacterCodes + + V = 86, +>V : CharacterCodes + + W = 87, +>W : CharacterCodes + + X = 88, +>X : CharacterCodes + + Y = 89, +>Y : CharacterCodes + + Z = 90, +>Z : CharacterCodes + + ampersand = 38, +>ampersand : CharacterCodes + + asterisk = 42, +>asterisk : CharacterCodes + + at = 64, +>at : CharacterCodes + + backslash = 92, +>backslash : CharacterCodes + + backtick = 96, +>backtick : CharacterCodes + + bar = 124, +>bar : CharacterCodes + + caret = 94, +>caret : CharacterCodes + + closeBrace = 125, +>closeBrace : CharacterCodes + + closeBracket = 93, +>closeBracket : CharacterCodes + + closeParen = 41, +>closeParen : CharacterCodes + + colon = 58, +>colon : CharacterCodes + + comma = 44, +>comma : CharacterCodes + + dot = 46, +>dot : CharacterCodes + + doubleQuote = 34, +>doubleQuote : CharacterCodes + + equals = 61, +>equals : CharacterCodes + + exclamation = 33, +>exclamation : CharacterCodes + + greaterThan = 62, +>greaterThan : CharacterCodes + + hash = 35, +>hash : CharacterCodes + + lessThan = 60, +>lessThan : CharacterCodes + + minus = 45, +>minus : CharacterCodes + + openBrace = 123, +>openBrace : CharacterCodes + + openBracket = 91, +>openBracket : CharacterCodes + + openParen = 40, +>openParen : CharacterCodes + + percent = 37, +>percent : CharacterCodes + + plus = 43, +>plus : CharacterCodes + + question = 63, +>question : CharacterCodes + + semicolon = 59, +>semicolon : CharacterCodes + + singleQuote = 39, +>singleQuote : CharacterCodes + + slash = 47, +>slash : CharacterCodes + + tilde = 126, +>tilde : CharacterCodes + + backspace = 8, +>backspace : CharacterCodes + + formFeed = 12, +>formFeed : CharacterCodes + + byteOrderMark = 65279, +>byteOrderMark : CharacterCodes + + tab = 9, +>tab : CharacterCodes + + verticalTab = 11, +>verticalTab : CharacterCodes + } + interface CancellationToken { +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + } + interface CompilerHost { +>CompilerHost : CompilerHost + + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; +>getSourceFile : (fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile +>fileName : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>onError : (message: string) => void +>message : string +>SourceFile : SourceFile + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + writeFile: WriteFileCallback; +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getCanonicalFileName(fileName: string): string; +>getCanonicalFileName : (fileName: string) => string +>fileName : string + + useCaseSensitiveFileNames(): boolean; +>useCaseSensitiveFileNames : () => boolean + + getNewLine(): string; +>getNewLine : () => string + } + interface TextSpan { +>TextSpan : TextSpan + + start: number; +>start : number + + length: number; +>length : number + } + interface TextChangeRange { +>TextChangeRange : TextChangeRange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newLength: number; +>newLength : number + } +} +declare module "typescript" { + interface ErrorCallback { +>ErrorCallback : ErrorCallback + + (message: DiagnosticMessage, length: number): void; +>message : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage +>length : number + } + interface Scanner { +>Scanner : Scanner + + getStartPos(): number; +>getStartPos : () => number + + getToken(): SyntaxKind; +>getToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + getTextPos(): number; +>getTextPos : () => number + + getTokenPos(): number; +>getTokenPos : () => number + + getTokenText(): string; +>getTokenText : () => string + + getTokenValue(): string; +>getTokenValue : () => string + + hasExtendedUnicodeEscape(): boolean; +>hasExtendedUnicodeEscape : () => boolean + + hasPrecedingLineBreak(): boolean; +>hasPrecedingLineBreak : () => boolean + + isIdentifier(): boolean; +>isIdentifier : () => boolean + + isReservedWord(): boolean; +>isReservedWord : () => boolean + + isUnterminated(): boolean; +>isUnterminated : () => boolean + + reScanGreaterToken(): SyntaxKind; +>reScanGreaterToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanSlashToken(): SyntaxKind; +>reScanSlashToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanTemplateToken(): SyntaxKind; +>reScanTemplateToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + scan(): SyntaxKind; +>scan : () => SyntaxKind +>SyntaxKind : SyntaxKind + + setText(text: string): void; +>setText : (text: string) => void +>text : string + + setTextPos(textPos: number): void; +>setTextPos : (textPos: number) => void +>textPos : number + + lookAhead(callback: () => T): T; +>lookAhead : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + + tryScan(callback: () => T): T; +>tryScan : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + } + function tokenToString(t: SyntaxKind): string; +>tokenToString : (t: SyntaxKind) => string +>t : SyntaxKind +>SyntaxKind : SyntaxKind + + function computeLineStarts(text: string): number[]; +>computeLineStarts : (text: string) => number[] +>text : string + + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number +>sourceFile : SourceFile +>SourceFile : SourceFile +>line : number +>character : number + + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number +>lineStarts : number[] +>line : number +>character : number + + function getLineStarts(sourceFile: SourceFile): number[]; +>getLineStarts : (sourceFile: SourceFile) => number[] +>sourceFile : SourceFile +>SourceFile : SourceFile + + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } +>lineStarts : number[] +>position : number + + line: number; +>line : number + + character: number; +>character : number + + }; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter +>sourceFile : SourceFile +>SourceFile : SourceFile +>position : number +>LineAndCharacter : LineAndCharacter + + function isWhiteSpace(ch: number): boolean; +>isWhiteSpace : (ch: number) => boolean +>ch : number + + function isLineBreak(ch: number): boolean; +>isLineBreak : (ch: number) => boolean +>ch : number + + function isOctalDigit(ch: number): boolean; +>isOctalDigit : (ch: number) => boolean +>ch : number + + function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; +>skipTrivia : (text: string, pos: number, stopAfterLineBreak?: boolean) => number +>text : string +>pos : number +>stopAfterLineBreak : boolean + + function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; +>getLeadingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; +>getTrailingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierStart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierPart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner; +>createScanner : (languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback) => Scanner +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>skipTrivia : boolean +>text : string +>onError : ErrorCallback +>ErrorCallback : ErrorCallback +>Scanner : Scanner +} +declare module "typescript" { + function getNodeConstructor(kind: SyntaxKind): new () => Node; +>getNodeConstructor : (kind: SyntaxKind) => new () => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function createNode(kind: SyntaxKind): Node; +>createNode : (kind: SyntaxKind) => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; +>forEachChild : (node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T) => T +>T : T +>node : Node +>Node : Node +>cbNode : (node: Node) => T +>node : Node +>Node : Node +>T : T +>cbNodeArray : (nodes: Node[]) => T +>nodes : Node[] +>Node : Node +>T : T +>T : T + + function modifierToFlag(token: SyntaxKind): NodeFlags; +>modifierToFlag : (token: SyntaxKind) => NodeFlags +>token : SyntaxKind +>SyntaxKind : SyntaxKind +>NodeFlags : NodeFlags + + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; +>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>aggressiveChecks : boolean +>SourceFile : SourceFile + + function isEvalOrArgumentsIdentifier(node: Node): boolean; +>isEvalOrArgumentsIdentifier : (node: Node) => boolean +>node : Node +>Node : Node + + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile +>fileName : string +>sourceText : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>setParentNodes : boolean +>SourceFile : SourceFile + + function isLeftHandSideExpression(expr: Expression): boolean; +>isLeftHandSideExpression : (expr: Expression) => boolean +>expr : Expression +>Expression : Expression + + function isAssignmentOperator(token: SyntaxKind): boolean; +>isAssignmentOperator : (token: SyntaxKind) => boolean +>token : SyntaxKind +>SyntaxKind : SyntaxKind +} +declare module "typescript" { + function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; +>createTypeChecker : (host: TypeCheckerHost, produceDiagnostics: boolean) => TypeChecker +>host : TypeCheckerHost +>TypeCheckerHost : TypeCheckerHost +>produceDiagnostics : boolean +>TypeChecker : TypeChecker +} +declare module "typescript" { + /** The version of the TypeScript compiler release */ + let version: string; +>version : string + + function findConfigFile(searchPath: string): string; +>findConfigFile : (searchPath: string) => string +>searchPath : string + + function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; +>createCompilerHost : (options: CompilerOptions, setParentNodes?: boolean) => CompilerHost +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>setParentNodes : boolean +>CompilerHost : CompilerHost + + function getPreEmitDiagnostics(program: Program): Diagnostic[]; +>getPreEmitDiagnostics : (program: Program) => Diagnostic[] +>program : Program +>Program : Program +>Diagnostic : Diagnostic + + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; +>flattenDiagnosticMessageText : (messageText: string | DiagnosticMessageChain, newLine: string) => string +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain +>newLine : string + + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; +>createProgram : (rootNames: string[], options: CompilerOptions, host?: CompilerHost) => Program +>rootNames : string[] +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>host : CompilerHost +>CompilerHost : CompilerHost +>Program : Program +} +declare module "typescript" { + /** The version of the language service API */ + let servicesVersion: string; +>servicesVersion : string + + interface Node { +>Node : Node + + getSourceFile(): SourceFile; +>getSourceFile : () => SourceFile +>SourceFile : SourceFile + + getChildCount(sourceFile?: SourceFile): number; +>getChildCount : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getChildAt(index: number, sourceFile?: SourceFile): Node; +>getChildAt : (index: number, sourceFile?: SourceFile) => Node +>index : number +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getChildren(sourceFile?: SourceFile): Node[]; +>getChildren : (sourceFile?: SourceFile) => Node[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getStart(sourceFile?: SourceFile): number; +>getStart : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullStart(): number; +>getFullStart : () => number + + getEnd(): number; +>getEnd : () => number + + getWidth(sourceFile?: SourceFile): number; +>getWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullWidth(): number; +>getFullWidth : () => number + + getLeadingTriviaWidth(sourceFile?: SourceFile): number; +>getLeadingTriviaWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullText(sourceFile?: SourceFile): string; +>getFullText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getText(sourceFile?: SourceFile): string; +>getText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFirstToken(sourceFile?: SourceFile): Node; +>getFirstToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getLastToken(sourceFile?: SourceFile): Node; +>getLastToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + } + interface Symbol { +>Symbol : Symbol + + getFlags(): SymbolFlags; +>getFlags : () => SymbolFlags +>SymbolFlags : SymbolFlags + + getName(): string; +>getName : () => string + + getDeclarations(): Declaration[]; +>getDeclarations : () => Declaration[] +>Declaration : Declaration + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface Type { +>Type : Type + + getFlags(): TypeFlags; +>getFlags : () => TypeFlags +>TypeFlags : TypeFlags + + getSymbol(): Symbol; +>getSymbol : () => Symbol +>Symbol : Symbol + + getProperties(): Symbol[]; +>getProperties : () => Symbol[] +>Symbol : Symbol + + getProperty(propertyName: string): Symbol; +>getProperty : (propertyName: string) => Symbol +>propertyName : string +>Symbol : Symbol + + getApparentProperties(): Symbol[]; +>getApparentProperties : () => Symbol[] +>Symbol : Symbol + + getCallSignatures(): Signature[]; +>getCallSignatures : () => Signature[] +>Signature : Signature + + getConstructSignatures(): Signature[]; +>getConstructSignatures : () => Signature[] +>Signature : Signature + + getStringIndexType(): Type; +>getStringIndexType : () => Type +>Type : Type + + getNumberIndexType(): Type; +>getNumberIndexType : () => Type +>Type : Type + } + interface Signature { +>Signature : Signature + + getDeclaration(): SignatureDeclaration; +>getDeclaration : () => SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + getTypeParameters(): Type[]; +>getTypeParameters : () => Type[] +>Type : Type + + getParameters(): Symbol[]; +>getParameters : () => Symbol[] +>Symbol : Symbol + + getReturnType(): Type; +>getReturnType : () => Type +>Type : Type + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface SourceFile { +>SourceFile : SourceFile + + getNamedDeclarations(): Declaration[]; +>getNamedDeclarations : () => Declaration[] +>Declaration : Declaration + + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter +>pos : number +>LineAndCharacter : LineAndCharacter + + getLineStarts(): number[]; +>getLineStarts : () => number[] + + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number +>line : number +>character : number + + update(newText: string, textChangeRange: TextChangeRange): SourceFile; +>update : (newText: string, textChangeRange: TextChangeRange) => SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { +>IScriptSnapshot : IScriptSnapshot + + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; +>getText : (start: number, end: number) => string +>start : number +>end : number + + /** Gets the length of this script snapshot. */ + getLength(): number; +>getLength : () => number + + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; +>getChangeRange : (oldSnapshot: IScriptSnapshot) => TextChangeRange +>oldSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>TextChangeRange : TextChangeRange + } + module ScriptSnapshot { +>ScriptSnapshot : typeof ScriptSnapshot + + function fromString(text: string): IScriptSnapshot; +>fromString : (text: string) => IScriptSnapshot +>text : string +>IScriptSnapshot : IScriptSnapshot + } + interface PreProcessedFileInfo { +>PreProcessedFileInfo : PreProcessedFileInfo + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + importedFiles: FileReference[]; +>importedFiles : FileReference[] +>FileReference : FileReference + + isLibFile: boolean; +>isLibFile : boolean + } + interface LanguageServiceHost { +>LanguageServiceHost : LanguageServiceHost + + getCompilationSettings(): CompilerOptions; +>getCompilationSettings : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getNewLine?(): string; +>getNewLine : () => string + + getScriptFileNames(): string[]; +>getScriptFileNames : () => string[] + + getScriptVersion(fileName: string): string; +>getScriptVersion : (fileName: string) => string +>fileName : string + + getScriptSnapshot(fileName: string): IScriptSnapshot; +>getScriptSnapshot : (fileName: string) => IScriptSnapshot +>fileName : string +>IScriptSnapshot : IScriptSnapshot + + getLocalizedDiagnosticMessages?(): any; +>getLocalizedDiagnosticMessages : () => any + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + log?(s: string): void; +>log : (s: string) => void +>s : string + + trace?(s: string): void; +>trace : (s: string) => void +>s : string + + error?(s: string): void; +>error : (s: string) => void +>s : string + } + interface LanguageService { +>LanguageService : LanguageService + + cleanupSemanticCache(): void; +>cleanupSemanticCache : () => void + + getSyntacticDiagnostics(fileName: string): Diagnostic[]; +>getSyntacticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getSemanticDiagnostics(fileName: string): Diagnostic[]; +>getSemanticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getCompilerOptionsDiagnostics(): Diagnostic[]; +>getCompilerOptionsDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSyntacticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSemanticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; +>getCompletionsAtPosition : (fileName: string, position: number) => CompletionInfo +>fileName : string +>position : number +>CompletionInfo : CompletionInfo + + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; +>getCompletionEntryDetails : (fileName: string, position: number, entryName: string) => CompletionEntryDetails +>fileName : string +>position : number +>entryName : string +>CompletionEntryDetails : CompletionEntryDetails + + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; +>getQuickInfoAtPosition : (fileName: string, position: number) => QuickInfo +>fileName : string +>position : number +>QuickInfo : QuickInfo + + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; +>getNameOrDottedNameSpan : (fileName: string, startPos: number, endPos: number) => TextSpan +>fileName : string +>startPos : number +>endPos : number +>TextSpan : TextSpan + + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; +>getBreakpointStatementAtPosition : (fileName: string, position: number) => TextSpan +>fileName : string +>position : number +>TextSpan : TextSpan + + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; +>getSignatureHelpItems : (fileName: string, position: number) => SignatureHelpItems +>fileName : string +>position : number +>SignatureHelpItems : SignatureHelpItems + + getRenameInfo(fileName: string, position: number): RenameInfo; +>getRenameInfo : (fileName: string, position: number) => RenameInfo +>fileName : string +>position : number +>RenameInfo : RenameInfo + + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; +>findRenameLocations : (fileName: string, position: number, findInStrings: boolean, findInComments: boolean) => RenameLocation[] +>fileName : string +>position : number +>findInStrings : boolean +>findInComments : boolean +>RenameLocation : RenameLocation + + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; +>getDefinitionAtPosition : (fileName: string, position: number) => DefinitionInfo[] +>fileName : string +>position : number +>DefinitionInfo : DefinitionInfo + + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getReferencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getOccurrencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + findReferences(fileName: string, position: number): ReferencedSymbol[]; +>findReferences : (fileName: string, position: number) => ReferencedSymbol[] +>fileName : string +>position : number +>ReferencedSymbol : ReferencedSymbol + + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] +>searchValue : string +>maxResultCount : number +>NavigateToItem : NavigateToItem + + getNavigationBarItems(fileName: string): NavigationBarItem[]; +>getNavigationBarItems : (fileName: string) => NavigationBarItem[] +>fileName : string +>NavigationBarItem : NavigationBarItem + + getOutliningSpans(fileName: string): OutliningSpan[]; +>getOutliningSpans : (fileName: string) => OutliningSpan[] +>fileName : string +>OutliningSpan : OutliningSpan + + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; +>getTodoComments : (fileName: string, descriptors: TodoCommentDescriptor[]) => TodoComment[] +>fileName : string +>descriptors : TodoCommentDescriptor[] +>TodoCommentDescriptor : TodoCommentDescriptor +>TodoComment : TodoComment + + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; +>getBraceMatchingAtPosition : (fileName: string, position: number) => TextSpan[] +>fileName : string +>position : number +>TextSpan : TextSpan + + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; +>getIndentationAtPosition : (fileName: string, position: number, options: EditorOptions) => number +>fileName : string +>position : number +>options : EditorOptions +>EditorOptions : EditorOptions + + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForRange : (fileName: string, start: number, end: number, options: FormatCodeOptions) => TextChange[] +>fileName : string +>start : number +>end : number +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForDocument : (fileName: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsAfterKeystroke : (fileName: string, position: number, key: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>position : number +>key : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getEmitOutput(fileName: string): EmitOutput; +>getEmitOutput : (fileName: string) => EmitOutput +>fileName : string +>EmitOutput : EmitOutput + + getProgram(): Program; +>getProgram : () => Program +>Program : Program + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + dispose(): void; +>dispose : () => void + } + interface ClassifiedSpan { +>ClassifiedSpan : ClassifiedSpan + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + classificationType: string; +>classificationType : string + } + interface NavigationBarItem { +>NavigationBarItem : NavigationBarItem + + text: string; +>text : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + spans: TextSpan[]; +>spans : TextSpan[] +>TextSpan : TextSpan + + childItems: NavigationBarItem[]; +>childItems : NavigationBarItem[] +>NavigationBarItem : NavigationBarItem + + indent: number; +>indent : number + + bolded: boolean; +>bolded : boolean + + grayed: boolean; +>grayed : boolean + } + interface TodoCommentDescriptor { +>TodoCommentDescriptor : TodoCommentDescriptor + + text: string; +>text : string + + priority: number; +>priority : number + } + interface TodoComment { +>TodoComment : TodoComment + + descriptor: TodoCommentDescriptor; +>descriptor : TodoCommentDescriptor +>TodoCommentDescriptor : TodoCommentDescriptor + + message: string; +>message : string + + position: number; +>position : number + } + class TextChange { +>TextChange : TextChange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newText: string; +>newText : string + } + interface RenameLocation { +>RenameLocation : RenameLocation + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + } + interface ReferenceEntry { +>ReferenceEntry : ReferenceEntry + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + + isWriteAccess: boolean; +>isWriteAccess : boolean + } + interface NavigateToItem { +>NavigateToItem : NavigateToItem + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + matchKind: string; +>matchKind : string + + isCaseSensitive: boolean; +>isCaseSensitive : boolean + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + containerName: string; +>containerName : string + + containerKind: string; +>containerKind : string + } + interface EditorOptions { +>EditorOptions : EditorOptions + + IndentSize: number; +>IndentSize : number + + TabSize: number; +>TabSize : number + + NewLineCharacter: string; +>NewLineCharacter : string + + ConvertTabsToSpaces: boolean; +>ConvertTabsToSpaces : boolean + } + interface FormatCodeOptions extends EditorOptions { +>FormatCodeOptions : FormatCodeOptions +>EditorOptions : EditorOptions + + InsertSpaceAfterCommaDelimiter: boolean; +>InsertSpaceAfterCommaDelimiter : boolean + + InsertSpaceAfterSemicolonInForStatements: boolean; +>InsertSpaceAfterSemicolonInForStatements : boolean + + InsertSpaceBeforeAndAfterBinaryOperators: boolean; +>InsertSpaceBeforeAndAfterBinaryOperators : boolean + + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; +>InsertSpaceAfterKeywordsInControlFlowStatements : boolean + + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; +>InsertSpaceAfterFunctionKeywordForAnonymousFunctions : boolean + + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; +>InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis : boolean + + PlaceOpenBraceOnNewLineForFunctions: boolean; +>PlaceOpenBraceOnNewLineForFunctions : boolean + + PlaceOpenBraceOnNewLineForControlBlocks: boolean; +>PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string + } + interface DefinitionInfo { +>DefinitionInfo : DefinitionInfo + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + kind: string; +>kind : string + + name: string; +>name : string + + containerKind: string; +>containerKind : string + + containerName: string; +>containerName : string + } + interface ReferencedSymbol { +>ReferencedSymbol : ReferencedSymbol + + definition: DefinitionInfo; +>definition : DefinitionInfo +>DefinitionInfo : DefinitionInfo + + references: ReferenceEntry[]; +>references : ReferenceEntry[] +>ReferenceEntry : ReferenceEntry + } + enum SymbolDisplayPartKind { +>SymbolDisplayPartKind : SymbolDisplayPartKind + + aliasName = 0, +>aliasName : SymbolDisplayPartKind + + className = 1, +>className : SymbolDisplayPartKind + + enumName = 2, +>enumName : SymbolDisplayPartKind + + fieldName = 3, +>fieldName : SymbolDisplayPartKind + + interfaceName = 4, +>interfaceName : SymbolDisplayPartKind + + keyword = 5, +>keyword : SymbolDisplayPartKind + + lineBreak = 6, +>lineBreak : SymbolDisplayPartKind + + numericLiteral = 7, +>numericLiteral : SymbolDisplayPartKind + + stringLiteral = 8, +>stringLiteral : SymbolDisplayPartKind + + localName = 9, +>localName : SymbolDisplayPartKind + + methodName = 10, +>methodName : SymbolDisplayPartKind + + moduleName = 11, +>moduleName : SymbolDisplayPartKind + + operator = 12, +>operator : SymbolDisplayPartKind + + parameterName = 13, +>parameterName : SymbolDisplayPartKind + + propertyName = 14, +>propertyName : SymbolDisplayPartKind + + punctuation = 15, +>punctuation : SymbolDisplayPartKind + + space = 16, +>space : SymbolDisplayPartKind + + text = 17, +>text : SymbolDisplayPartKind + + typeParameterName = 18, +>typeParameterName : SymbolDisplayPartKind + + enumMemberName = 19, +>enumMemberName : SymbolDisplayPartKind + + functionName = 20, +>functionName : SymbolDisplayPartKind + + regularExpressionLiteral = 21, +>regularExpressionLiteral : SymbolDisplayPartKind + } + interface SymbolDisplayPart { +>SymbolDisplayPart : SymbolDisplayPart + + text: string; +>text : string + + kind: string; +>kind : string + } + interface QuickInfo { +>QuickInfo : QuickInfo + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface RenameInfo { +>RenameInfo : RenameInfo + + canRename: boolean; +>canRename : boolean + + localizedErrorMessage: string; +>localizedErrorMessage : string + + displayName: string; +>displayName : string + + fullDisplayName: string; +>fullDisplayName : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + triggerSpan: TextSpan; +>triggerSpan : TextSpan +>TextSpan : TextSpan + } + interface SignatureHelpParameter { +>SignatureHelpParameter : SignatureHelpParameter + + name: string; +>name : string + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + isOptional: boolean; +>isOptional : boolean + } + /** + * Represents a single signature to show in signature help. + * The id is used for subsequent calls into the language service to ask questions about the + * signature help item in the context of any documents that have been updated. i.e. after + * an edit has happened, while signature help is still active, the host can ask important + * questions like 'what parameter is the user currently contained within?'. + */ + interface SignatureHelpItem { +>SignatureHelpItem : SignatureHelpItem + + isVariadic: boolean; +>isVariadic : boolean + + prefixDisplayParts: SymbolDisplayPart[]; +>prefixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + suffixDisplayParts: SymbolDisplayPart[]; +>suffixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + separatorDisplayParts: SymbolDisplayPart[]; +>separatorDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + parameters: SignatureHelpParameter[]; +>parameters : SignatureHelpParameter[] +>SignatureHelpParameter : SignatureHelpParameter + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + /** + * Represents a set of signature help items, and the preferred item that should be selected. + */ + interface SignatureHelpItems { +>SignatureHelpItems : SignatureHelpItems + + items: SignatureHelpItem[]; +>items : SignatureHelpItem[] +>SignatureHelpItem : SignatureHelpItem + + applicableSpan: TextSpan; +>applicableSpan : TextSpan +>TextSpan : TextSpan + + selectedItemIndex: number; +>selectedItemIndex : number + + argumentIndex: number; +>argumentIndex : number + + argumentCount: number; +>argumentCount : number + } + interface CompletionInfo { +>CompletionInfo : CompletionInfo + + isMemberCompletion: boolean; +>isMemberCompletion : boolean + + isNewIdentifierLocation: boolean; +>isNewIdentifierLocation : boolean + + entries: CompletionEntry[]; +>entries : CompletionEntry[] +>CompletionEntry : CompletionEntry + } + interface CompletionEntry { +>CompletionEntry : CompletionEntry + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + } + interface CompletionEntryDetails { +>CompletionEntryDetails : CompletionEntryDetails + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface OutliningSpan { +>OutliningSpan : OutliningSpan + + /** The span of the document to actually collapse. */ + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + /** The span of the document to display when the user hovers over the collapsed span. */ + hintSpan: TextSpan; +>hintSpan : TextSpan +>TextSpan : TextSpan + + /** The text to display in the editor for the collapsed region. */ + bannerText: string; +>bannerText : string + + /** + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ + autoCollapse: boolean; +>autoCollapse : boolean + } + interface EmitOutput { +>EmitOutput : EmitOutput + + outputFiles: OutputFile[]; +>outputFiles : OutputFile[] +>OutputFile : OutputFile + + emitSkipped: boolean; +>emitSkipped : boolean + } + const enum OutputFileType { +>OutputFileType : OutputFileType + + JavaScript = 0, +>JavaScript : OutputFileType + + SourceMap = 1, +>SourceMap : OutputFileType + + Declaration = 2, +>Declaration : OutputFileType + } + interface OutputFile { +>OutputFile : OutputFile + + name: string; +>name : string + + writeByteOrderMark: boolean; +>writeByteOrderMark : boolean + + text: string; +>text : string + } + const enum EndOfLineState { +>EndOfLineState : EndOfLineState + + Start = 0, +>Start : EndOfLineState + + InMultiLineCommentTrivia = 1, +>InMultiLineCommentTrivia : EndOfLineState + + InSingleQuoteStringLiteral = 2, +>InSingleQuoteStringLiteral : EndOfLineState + + InDoubleQuoteStringLiteral = 3, +>InDoubleQuoteStringLiteral : EndOfLineState + + InTemplateHeadOrNoSubstitutionTemplate = 4, +>InTemplateHeadOrNoSubstitutionTemplate : EndOfLineState + + InTemplateMiddleOrTail = 5, +>InTemplateMiddleOrTail : EndOfLineState + + InTemplateSubstitutionPosition = 6, +>InTemplateSubstitutionPosition : EndOfLineState + } + enum TokenClass { +>TokenClass : TokenClass + + Punctuation = 0, +>Punctuation : TokenClass + + Keyword = 1, +>Keyword : TokenClass + + Operator = 2, +>Operator : TokenClass + + Comment = 3, +>Comment : TokenClass + + Whitespace = 4, +>Whitespace : TokenClass + + Identifier = 5, +>Identifier : TokenClass + + NumberLiteral = 6, +>NumberLiteral : TokenClass + + StringLiteral = 7, +>StringLiteral : TokenClass + + RegExpLiteral = 8, +>RegExpLiteral : TokenClass + } + interface ClassificationResult { +>ClassificationResult : ClassificationResult + + finalLexState: EndOfLineState; +>finalLexState : EndOfLineState +>EndOfLineState : EndOfLineState + + entries: ClassificationInfo[]; +>entries : ClassificationInfo[] +>ClassificationInfo : ClassificationInfo + } + interface ClassificationInfo { +>ClassificationInfo : ClassificationInfo + + length: number; +>length : number + + classification: TokenClass; +>classification : TokenClass +>TokenClass : TokenClass + } + interface Classifier { +>Classifier : Classifier + + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; +>getClassificationsForLine : (text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean) => ClassificationResult +>text : string +>lexState : EndOfLineState +>EndOfLineState : EndOfLineState +>syntacticClassifierAbsent : boolean +>ClassificationResult : ClassificationResult + } + /** + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ + interface DocumentRegistry { +>DocumentRegistry : DocumentRegistry + + /** + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>acquireDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>SourceFile : SourceFile + + /** + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. + */ + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>updateDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>SourceFile : SourceFile + + /** + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; +>releaseDocument : (fileName: string, compilationSettings: CompilerOptions) => void +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions + } + class ScriptElementKind { +>ScriptElementKind : ScriptElementKind + + static unknown: string; +>unknown : string + + static keyword: string; +>keyword : string + + static scriptElement: string; +>scriptElement : string + + static moduleElement: string; +>moduleElement : string + + static classElement: string; +>classElement : string + + static interfaceElement: string; +>interfaceElement : string + + static typeElement: string; +>typeElement : string + + static enumElement: string; +>enumElement : string + + static variableElement: string; +>variableElement : string + + static localVariableElement: string; +>localVariableElement : string + + static functionElement: string; +>functionElement : string + + static localFunctionElement: string; +>localFunctionElement : string + + static memberFunctionElement: string; +>memberFunctionElement : string + + static memberGetAccessorElement: string; +>memberGetAccessorElement : string + + static memberSetAccessorElement: string; +>memberSetAccessorElement : string + + static memberVariableElement: string; +>memberVariableElement : string + + static constructorImplementationElement: string; +>constructorImplementationElement : string + + static callSignatureElement: string; +>callSignatureElement : string + + static indexSignatureElement: string; +>indexSignatureElement : string + + static constructSignatureElement: string; +>constructSignatureElement : string + + static parameterElement: string; +>parameterElement : string + + static typeParameterElement: string; +>typeParameterElement : string + + static primitiveType: string; +>primitiveType : string + + static label: string; +>label : string + + static alias: string; +>alias : string + + static constElement: string; +>constElement : string + + static letElement: string; +>letElement : string + } + class ScriptElementKindModifier { +>ScriptElementKindModifier : ScriptElementKindModifier + + static none: string; +>none : string + + static publicMemberModifier: string; +>publicMemberModifier : string + + static privateMemberModifier: string; +>privateMemberModifier : string + + static protectedMemberModifier: string; +>protectedMemberModifier : string + + static exportedModifier: string; +>exportedModifier : string + + static ambientModifier: string; +>ambientModifier : string + + static staticModifier: string; +>staticModifier : string + } + class ClassificationTypeNames { +>ClassificationTypeNames : ClassificationTypeNames + + static comment: string; +>comment : string + + static identifier: string; +>identifier : string + + static keyword: string; +>keyword : string + + static numericLiteral: string; +>numericLiteral : string + + static operator: string; +>operator : string + + static stringLiteral: string; +>stringLiteral : string + + static whiteSpace: string; +>whiteSpace : string + + static text: string; +>text : string + + static punctuation: string; +>punctuation : string + + static className: string; +>className : string + + static enumName: string; +>enumName : string + + static interfaceName: string; +>interfaceName : string + + static moduleName: string; +>moduleName : string + + static typeParameterName: string; +>typeParameterName : string + + static typeAlias: string; +>typeAlias : string + } + interface DisplayPartsSymbolWriter extends SymbolWriter { +>DisplayPartsSymbolWriter : DisplayPartsSymbolWriter +>SymbolWriter : SymbolWriter + + displayParts(): SymbolDisplayPart[]; +>displayParts : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; +>displayPartsToString : (displayParts: SymbolDisplayPart[]) => string +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + function getDefaultCompilerOptions(): CompilerOptions; +>getDefaultCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + class OperationCanceledException { +>OperationCanceledException : OperationCanceledException + } + class CancellationTokenObject { +>CancellationTokenObject : CancellationTokenObject + + private cancellationToken; +>cancellationToken : any + + static None: CancellationTokenObject; +>None : CancellationTokenObject +>CancellationTokenObject : CancellationTokenObject + + constructor(cancellationToken: CancellationToken); +>cancellationToken : CancellationToken +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + + throwIfCancellationRequested(): void; +>throwIfCancellationRequested : () => void + } + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; +>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile +>fileName : string +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>scriptTarget : ScriptTarget +>ScriptTarget : ScriptTarget +>version : string +>setNodeParents : boolean +>SourceFile : SourceFile + + let disableIncrementalParsing: boolean; +>disableIncrementalParsing : boolean + + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; +>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>aggressiveChecks : boolean +>SourceFile : SourceFile + + function createDocumentRegistry(): DocumentRegistry; +>createDocumentRegistry : () => DocumentRegistry +>DocumentRegistry : DocumentRegistry + + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; +>preProcessFile : (sourceText: string, readImportFiles?: boolean) => PreProcessedFileInfo +>sourceText : string +>readImportFiles : boolean +>PreProcessedFileInfo : PreProcessedFileInfo + + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; +>createLanguageService : (host: LanguageServiceHost, documentRegistry?: DocumentRegistry) => LanguageService +>host : LanguageServiceHost +>LanguageServiceHost : LanguageServiceHost +>documentRegistry : DocumentRegistry +>DocumentRegistry : DocumentRegistry +>LanguageService : LanguageService + + function createClassifier(): Classifier; +>createClassifier : () => Classifier +>Classifier : Classifier + + /** + * Get the path of the default library file (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ + function getDefaultLibFilePath(options: CompilerOptions): string; +>getDefaultLibFilePath : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions +} + diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index d40c078a150..a29467c1c4c 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -267,57 +267,58 @@ declare module "typescript" { SpreadElementExpression = 173, OmittedExpression = 174, TemplateSpan = 175, - Block = 176, - VariableStatement = 177, - EmptyStatement = 178, - ExpressionStatement = 179, - IfStatement = 180, - DoStatement = 181, - WhileStatement = 182, - ForStatement = 183, - ForInStatement = 184, - ForOfStatement = 185, - ContinueStatement = 186, - BreakStatement = 187, - ReturnStatement = 188, - WithStatement = 189, - SwitchStatement = 190, - LabeledStatement = 191, - ThrowStatement = 192, - TryStatement = 193, - DebuggerStatement = 194, - VariableDeclaration = 195, - VariableDeclarationList = 196, - FunctionDeclaration = 197, - ClassDeclaration = 198, - InterfaceDeclaration = 199, - TypeAliasDeclaration = 200, - EnumDeclaration = 201, - ModuleDeclaration = 202, - ModuleBlock = 203, - CaseBlock = 204, - ImportEqualsDeclaration = 205, - ImportDeclaration = 206, - ImportClause = 207, - NamespaceImport = 208, - NamedImports = 209, - ImportSpecifier = 210, - ExportAssignment = 211, - ExportDeclaration = 212, - NamedExports = 213, - ExportSpecifier = 214, - MissingDeclaration = 215, - ExternalModuleReference = 216, - CaseClause = 217, - DefaultClause = 218, - HeritageClause = 219, - CatchClause = 220, - PropertyAssignment = 221, - ShorthandPropertyAssignment = 222, - EnumMember = 223, - SourceFile = 224, - SyntaxList = 225, - Count = 226, + HeritageClauseElement = 176, + Block = 177, + VariableStatement = 178, + EmptyStatement = 179, + ExpressionStatement = 180, + IfStatement = 181, + DoStatement = 182, + WhileStatement = 183, + ForStatement = 184, + ForInStatement = 185, + ForOfStatement = 186, + ContinueStatement = 187, + BreakStatement = 188, + ReturnStatement = 189, + WithStatement = 190, + SwitchStatement = 191, + LabeledStatement = 192, + ThrowStatement = 193, + TryStatement = 194, + DebuggerStatement = 195, + VariableDeclaration = 196, + VariableDeclarationList = 197, + FunctionDeclaration = 198, + ClassDeclaration = 199, + InterfaceDeclaration = 200, + TypeAliasDeclaration = 201, + EnumDeclaration = 202, + ModuleDeclaration = 203, + ModuleBlock = 204, + CaseBlock = 205, + ImportEqualsDeclaration = 206, + ImportDeclaration = 207, + ImportClause = 208, + NamespaceImport = 209, + NamedImports = 210, + ImportSpecifier = 211, + ExportAssignment = 212, + ExportDeclaration = 213, + NamedExports = 214, + ExportSpecifier = 215, + MissingDeclaration = 216, + ExternalModuleReference = 217, + CaseClause = 218, + DefaultClause = 219, + HeritageClause = 220, + CatchClause = 221, + PropertyAssignment = 222, + ShorthandPropertyAssignment = 223, + EnumMember = 224, + SourceFile = 225, + SyntaxList = 226, + Count = 227, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -639,6 +640,10 @@ declare module "typescript" { typeArguments?: NodeArray; arguments: NodeArray; } + interface HeritageClauseElement extends Node { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + } interface NewExpression extends CallExpression, PrimaryExpression { } interface TaggedTemplateExpression extends MemberExpression { @@ -750,7 +755,7 @@ declare module "typescript" { } interface HeritageClause extends Node { token: SyntaxKind; - types?: NodeArray; + types?: NodeArray; } interface TypeAliasDeclaration extends Declaration, ModuleElement { name: Identifier; @@ -992,7 +997,7 @@ declare module "typescript" { writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 4ea9c49d758..68ce9de45be 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -819,157 +819,160 @@ declare module "typescript" { TemplateSpan = 175, >TemplateSpan : SyntaxKind - Block = 176, + HeritageClauseElement = 176, +>HeritageClauseElement : SyntaxKind + + Block = 177, >Block : SyntaxKind - VariableStatement = 177, + VariableStatement = 178, >VariableStatement : SyntaxKind - EmptyStatement = 178, + EmptyStatement = 179, >EmptyStatement : SyntaxKind - ExpressionStatement = 179, + ExpressionStatement = 180, >ExpressionStatement : SyntaxKind - IfStatement = 180, + IfStatement = 181, >IfStatement : SyntaxKind - DoStatement = 181, + DoStatement = 182, >DoStatement : SyntaxKind - WhileStatement = 182, + WhileStatement = 183, >WhileStatement : SyntaxKind - ForStatement = 183, + ForStatement = 184, >ForStatement : SyntaxKind - ForInStatement = 184, + ForInStatement = 185, >ForInStatement : SyntaxKind - ForOfStatement = 185, + ForOfStatement = 186, >ForOfStatement : SyntaxKind - ContinueStatement = 186, + ContinueStatement = 187, >ContinueStatement : SyntaxKind - BreakStatement = 187, + BreakStatement = 188, >BreakStatement : SyntaxKind - ReturnStatement = 188, + ReturnStatement = 189, >ReturnStatement : SyntaxKind - WithStatement = 189, + WithStatement = 190, >WithStatement : SyntaxKind - SwitchStatement = 190, + SwitchStatement = 191, >SwitchStatement : SyntaxKind - LabeledStatement = 191, + LabeledStatement = 192, >LabeledStatement : SyntaxKind - ThrowStatement = 192, + ThrowStatement = 193, >ThrowStatement : SyntaxKind - TryStatement = 193, + TryStatement = 194, >TryStatement : SyntaxKind - DebuggerStatement = 194, + DebuggerStatement = 195, >DebuggerStatement : SyntaxKind - VariableDeclaration = 195, + VariableDeclaration = 196, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 196, + VariableDeclarationList = 197, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 197, + FunctionDeclaration = 198, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 198, + ClassDeclaration = 199, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 199, + InterfaceDeclaration = 200, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 200, + TypeAliasDeclaration = 201, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 201, + EnumDeclaration = 202, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 202, + ModuleDeclaration = 203, >ModuleDeclaration : SyntaxKind - ModuleBlock = 203, + ModuleBlock = 204, >ModuleBlock : SyntaxKind - CaseBlock = 204, + CaseBlock = 205, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 205, + ImportEqualsDeclaration = 206, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 206, + ImportDeclaration = 207, >ImportDeclaration : SyntaxKind - ImportClause = 207, + ImportClause = 208, >ImportClause : SyntaxKind - NamespaceImport = 208, + NamespaceImport = 209, >NamespaceImport : SyntaxKind - NamedImports = 209, + NamedImports = 210, >NamedImports : SyntaxKind - ImportSpecifier = 210, + ImportSpecifier = 211, >ImportSpecifier : SyntaxKind - ExportAssignment = 211, + ExportAssignment = 212, >ExportAssignment : SyntaxKind - ExportDeclaration = 212, + ExportDeclaration = 213, >ExportDeclaration : SyntaxKind - NamedExports = 213, + NamedExports = 214, >NamedExports : SyntaxKind - ExportSpecifier = 214, + ExportSpecifier = 215, >ExportSpecifier : SyntaxKind - MissingDeclaration = 215, + MissingDeclaration = 216, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 216, + ExternalModuleReference = 217, >ExternalModuleReference : SyntaxKind - CaseClause = 217, + CaseClause = 218, >CaseClause : SyntaxKind - DefaultClause = 218, + DefaultClause = 219, >DefaultClause : SyntaxKind - HeritageClause = 219, + HeritageClause = 220, >HeritageClause : SyntaxKind - CatchClause = 220, + CatchClause = 221, >CatchClause : SyntaxKind - PropertyAssignment = 221, + PropertyAssignment = 222, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 222, + ShorthandPropertyAssignment = 223, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 223, + EnumMember = 224, >EnumMember : SyntaxKind - SourceFile = 224, + SourceFile = 225, >SourceFile : SyntaxKind - SyntaxList = 225, + SyntaxList = 226, >SyntaxList : SyntaxKind - Count = 226, + Count = 227, >Count : SyntaxKind FirstAssignment = 53, @@ -1927,6 +1930,19 @@ declare module "typescript" { >arguments : NodeArray >NodeArray : NodeArray >Expression : Expression + } + interface HeritageClauseElement extends Node { +>HeritageClauseElement : HeritageClauseElement +>Node : Node + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode } interface NewExpression extends CallExpression, PrimaryExpression { >NewExpression : NewExpression @@ -2274,10 +2290,10 @@ declare module "typescript" { >token : SyntaxKind >SyntaxKind : SyntaxKind - types?: NodeArray; ->types : NodeArray + types?: NodeArray; +>types : NodeArray >NodeArray : NodeArray ->TypeReferenceNode : TypeReferenceNode +>HeritageClauseElement : HeritageClauseElement } interface TypeAliasDeclaration extends Declaration, ModuleElement { >TypeAliasDeclaration : TypeAliasDeclaration @@ -3221,10 +3237,11 @@ declare module "typescript" { >SymbolFlags : SymbolFlags >SymbolAccessiblityResult : SymbolAccessiblityResult - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; ->isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult ->entityName : Identifier | QualifiedName + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; +>isEntityNameVisible : (entityName: Identifier | Expression | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult +>entityName : Identifier | Expression | QualifiedName >EntityName : Identifier | QualifiedName +>Expression : Expression >enclosingDeclaration : Node >Node : Node >SymbolVisibilityResult : SymbolVisibilityResult diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index c53034c11d7..918768222b7 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -304,57 +304,58 @@ declare module "typescript" { SpreadElementExpression = 173, OmittedExpression = 174, TemplateSpan = 175, - Block = 176, - VariableStatement = 177, - EmptyStatement = 178, - ExpressionStatement = 179, - IfStatement = 180, - DoStatement = 181, - WhileStatement = 182, - ForStatement = 183, - ForInStatement = 184, - ForOfStatement = 185, - ContinueStatement = 186, - BreakStatement = 187, - ReturnStatement = 188, - WithStatement = 189, - SwitchStatement = 190, - LabeledStatement = 191, - ThrowStatement = 192, - TryStatement = 193, - DebuggerStatement = 194, - VariableDeclaration = 195, - VariableDeclarationList = 196, - FunctionDeclaration = 197, - ClassDeclaration = 198, - InterfaceDeclaration = 199, - TypeAliasDeclaration = 200, - EnumDeclaration = 201, - ModuleDeclaration = 202, - ModuleBlock = 203, - CaseBlock = 204, - ImportEqualsDeclaration = 205, - ImportDeclaration = 206, - ImportClause = 207, - NamespaceImport = 208, - NamedImports = 209, - ImportSpecifier = 210, - ExportAssignment = 211, - ExportDeclaration = 212, - NamedExports = 213, - ExportSpecifier = 214, - MissingDeclaration = 215, - ExternalModuleReference = 216, - CaseClause = 217, - DefaultClause = 218, - HeritageClause = 219, - CatchClause = 220, - PropertyAssignment = 221, - ShorthandPropertyAssignment = 222, - EnumMember = 223, - SourceFile = 224, - SyntaxList = 225, - Count = 226, + HeritageClauseElement = 176, + Block = 177, + VariableStatement = 178, + EmptyStatement = 179, + ExpressionStatement = 180, + IfStatement = 181, + DoStatement = 182, + WhileStatement = 183, + ForStatement = 184, + ForInStatement = 185, + ForOfStatement = 186, + ContinueStatement = 187, + BreakStatement = 188, + ReturnStatement = 189, + WithStatement = 190, + SwitchStatement = 191, + LabeledStatement = 192, + ThrowStatement = 193, + TryStatement = 194, + DebuggerStatement = 195, + VariableDeclaration = 196, + VariableDeclarationList = 197, + FunctionDeclaration = 198, + ClassDeclaration = 199, + InterfaceDeclaration = 200, + TypeAliasDeclaration = 201, + EnumDeclaration = 202, + ModuleDeclaration = 203, + ModuleBlock = 204, + CaseBlock = 205, + ImportEqualsDeclaration = 206, + ImportDeclaration = 207, + ImportClause = 208, + NamespaceImport = 209, + NamedImports = 210, + ImportSpecifier = 211, + ExportAssignment = 212, + ExportDeclaration = 213, + NamedExports = 214, + ExportSpecifier = 215, + MissingDeclaration = 216, + ExternalModuleReference = 217, + CaseClause = 218, + DefaultClause = 219, + HeritageClause = 220, + CatchClause = 221, + PropertyAssignment = 222, + ShorthandPropertyAssignment = 223, + EnumMember = 224, + SourceFile = 225, + SyntaxList = 226, + Count = 227, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -676,6 +677,10 @@ declare module "typescript" { typeArguments?: NodeArray; arguments: NodeArray; } + interface HeritageClauseElement extends Node { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + } interface NewExpression extends CallExpression, PrimaryExpression { } interface TaggedTemplateExpression extends MemberExpression { @@ -787,7 +792,7 @@ declare module "typescript" { } interface HeritageClause extends Node { token: SyntaxKind; - types?: NodeArray; + types?: NodeArray; } interface TypeAliasDeclaration extends Declaration, ModuleElement { name: Identifier; @@ -1029,7 +1034,7 @@ declare module "typescript" { writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 3903e169b4e..9745c79e94d 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -992,157 +992,160 @@ declare module "typescript" { TemplateSpan = 175, >TemplateSpan : SyntaxKind - Block = 176, + HeritageClauseElement = 176, +>HeritageClauseElement : SyntaxKind + + Block = 177, >Block : SyntaxKind - VariableStatement = 177, + VariableStatement = 178, >VariableStatement : SyntaxKind - EmptyStatement = 178, + EmptyStatement = 179, >EmptyStatement : SyntaxKind - ExpressionStatement = 179, + ExpressionStatement = 180, >ExpressionStatement : SyntaxKind - IfStatement = 180, + IfStatement = 181, >IfStatement : SyntaxKind - DoStatement = 181, + DoStatement = 182, >DoStatement : SyntaxKind - WhileStatement = 182, + WhileStatement = 183, >WhileStatement : SyntaxKind - ForStatement = 183, + ForStatement = 184, >ForStatement : SyntaxKind - ForInStatement = 184, + ForInStatement = 185, >ForInStatement : SyntaxKind - ForOfStatement = 185, + ForOfStatement = 186, >ForOfStatement : SyntaxKind - ContinueStatement = 186, + ContinueStatement = 187, >ContinueStatement : SyntaxKind - BreakStatement = 187, + BreakStatement = 188, >BreakStatement : SyntaxKind - ReturnStatement = 188, + ReturnStatement = 189, >ReturnStatement : SyntaxKind - WithStatement = 189, + WithStatement = 190, >WithStatement : SyntaxKind - SwitchStatement = 190, + SwitchStatement = 191, >SwitchStatement : SyntaxKind - LabeledStatement = 191, + LabeledStatement = 192, >LabeledStatement : SyntaxKind - ThrowStatement = 192, + ThrowStatement = 193, >ThrowStatement : SyntaxKind - TryStatement = 193, + TryStatement = 194, >TryStatement : SyntaxKind - DebuggerStatement = 194, + DebuggerStatement = 195, >DebuggerStatement : SyntaxKind - VariableDeclaration = 195, + VariableDeclaration = 196, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 196, + VariableDeclarationList = 197, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 197, + FunctionDeclaration = 198, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 198, + ClassDeclaration = 199, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 199, + InterfaceDeclaration = 200, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 200, + TypeAliasDeclaration = 201, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 201, + EnumDeclaration = 202, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 202, + ModuleDeclaration = 203, >ModuleDeclaration : SyntaxKind - ModuleBlock = 203, + ModuleBlock = 204, >ModuleBlock : SyntaxKind - CaseBlock = 204, + CaseBlock = 205, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 205, + ImportEqualsDeclaration = 206, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 206, + ImportDeclaration = 207, >ImportDeclaration : SyntaxKind - ImportClause = 207, + ImportClause = 208, >ImportClause : SyntaxKind - NamespaceImport = 208, + NamespaceImport = 209, >NamespaceImport : SyntaxKind - NamedImports = 209, + NamedImports = 210, >NamedImports : SyntaxKind - ImportSpecifier = 210, + ImportSpecifier = 211, >ImportSpecifier : SyntaxKind - ExportAssignment = 211, + ExportAssignment = 212, >ExportAssignment : SyntaxKind - ExportDeclaration = 212, + ExportDeclaration = 213, >ExportDeclaration : SyntaxKind - NamedExports = 213, + NamedExports = 214, >NamedExports : SyntaxKind - ExportSpecifier = 214, + ExportSpecifier = 215, >ExportSpecifier : SyntaxKind - MissingDeclaration = 215, + MissingDeclaration = 216, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 216, + ExternalModuleReference = 217, >ExternalModuleReference : SyntaxKind - CaseClause = 217, + CaseClause = 218, >CaseClause : SyntaxKind - DefaultClause = 218, + DefaultClause = 219, >DefaultClause : SyntaxKind - HeritageClause = 219, + HeritageClause = 220, >HeritageClause : SyntaxKind - CatchClause = 220, + CatchClause = 221, >CatchClause : SyntaxKind - PropertyAssignment = 221, + PropertyAssignment = 222, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 222, + ShorthandPropertyAssignment = 223, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 223, + EnumMember = 224, >EnumMember : SyntaxKind - SourceFile = 224, + SourceFile = 225, >SourceFile : SyntaxKind - SyntaxList = 225, + SyntaxList = 226, >SyntaxList : SyntaxKind - Count = 226, + Count = 227, >Count : SyntaxKind FirstAssignment = 53, @@ -2100,6 +2103,19 @@ declare module "typescript" { >arguments : NodeArray >NodeArray : NodeArray >Expression : Expression + } + interface HeritageClauseElement extends Node { +>HeritageClauseElement : HeritageClauseElement +>Node : Node + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode } interface NewExpression extends CallExpression, PrimaryExpression { >NewExpression : NewExpression @@ -2447,10 +2463,10 @@ declare module "typescript" { >token : SyntaxKind >SyntaxKind : SyntaxKind - types?: NodeArray; ->types : NodeArray + types?: NodeArray; +>types : NodeArray >NodeArray : NodeArray ->TypeReferenceNode : TypeReferenceNode +>HeritageClauseElement : HeritageClauseElement } interface TypeAliasDeclaration extends Declaration, ModuleElement { >TypeAliasDeclaration : TypeAliasDeclaration @@ -3394,10 +3410,11 @@ declare module "typescript" { >SymbolFlags : SymbolFlags >SymbolAccessiblityResult : SymbolAccessiblityResult - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; ->isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult ->entityName : Identifier | QualifiedName + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; +>isEntityNameVisible : (entityName: Identifier | Expression | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult +>entityName : Identifier | Expression | QualifiedName >EntityName : Identifier | QualifiedName +>Expression : Expression >enclosingDeclaration : Node >Node : Node >SymbolVisibilityResult : SymbolVisibilityResult diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.types b/tests/baselines/reference/aliasUsageInAccessorsOfClass.types index c300ae861ac..a666d2cee98 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.types +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.types @@ -52,7 +52,7 @@ import Backbone = require("aliasUsage1_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // interesting stuff here diff --git a/tests/baselines/reference/aliasUsageInArray.types b/tests/baselines/reference/aliasUsageInArray.types index 2e792d39603..f7e2beb49dd 100644 --- a/tests/baselines/reference/aliasUsageInArray.types +++ b/tests/baselines/reference/aliasUsageInArray.types @@ -40,7 +40,7 @@ import Backbone = require("aliasUsageInArray_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // interesting stuff here diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.types b/tests/baselines/reference/aliasUsageInFunctionExpression.types index ba66a0f1c7c..392481d2d02 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.types +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.types @@ -41,7 +41,7 @@ import Backbone = require("aliasUsageInFunctionExpression_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // interesting stuff here diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.types b/tests/baselines/reference/aliasUsageInGenericFunction.types index cf63eba6a61..568e885f51f 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.types +++ b/tests/baselines/reference/aliasUsageInGenericFunction.types @@ -55,7 +55,7 @@ import Backbone = require("aliasUsageInGenericFunction_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // interesting stuff here diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.types b/tests/baselines/reference/aliasUsageInIndexerOfClass.types index cc4b2377099..e968abe597f 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.types +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.types @@ -49,7 +49,7 @@ import Backbone = require("aliasUsageInIndexerOfClass_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // interesting stuff here diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.types b/tests/baselines/reference/aliasUsageInObjectLiteral.types index b34a4300c52..2e631a41cdf 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.types +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.types @@ -54,7 +54,7 @@ import Backbone = require("aliasUsageInObjectLiteral_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // interesting stuff here diff --git a/tests/baselines/reference/aliasUsageInOrExpression.types b/tests/baselines/reference/aliasUsageInOrExpression.types index c937187f049..1a4dae90356 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.types +++ b/tests/baselines/reference/aliasUsageInOrExpression.types @@ -75,7 +75,7 @@ import Backbone = require("aliasUsageInOrExpression_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // interesting stuff here diff --git a/tests/baselines/reference/aliasUsageInOrExpression.types.pull b/tests/baselines/reference/aliasUsageInOrExpression.types.pull index cc45af29f86..3b138d1404a 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.types.pull +++ b/tests/baselines/reference/aliasUsageInOrExpression.types.pull @@ -75,7 +75,7 @@ import Backbone = require("aliasUsageInOrExpression_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // interesting stuff here diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types index e2e8b57b94f..72f0aaf9e20 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types @@ -45,7 +45,7 @@ import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // interesting stuff here diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.types b/tests/baselines/reference/aliasUsageInVarAssignment.types index 7ca745b3d23..6b1c097ad97 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.types +++ b/tests/baselines/reference/aliasUsageInVarAssignment.types @@ -36,7 +36,7 @@ import Backbone = require("aliasUsageInVarAssignment_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // interesting stuff here diff --git a/tests/baselines/reference/circularImportAlias.types b/tests/baselines/reference/circularImportAlias.types index ab8de414e30..b61f91d460e 100644 --- a/tests/baselines/reference/circularImportAlias.types +++ b/tests/baselines/reference/circularImportAlias.types @@ -10,7 +10,7 @@ module B { export class D extends a.C { >D : D ->a : unknown +>a : typeof a >C : a.C id: number; diff --git a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.types b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.types index b39d65c3d65..623515a7ec0 100644 --- a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.types +++ b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.types @@ -18,7 +18,7 @@ module M { export class O extends M.N { >O : O ->M : unknown +>M : typeof M >N : N } } diff --git a/tests/baselines/reference/classExtendingPrimitive.errors.txt b/tests/baselines/reference/classExtendingPrimitive.errors.txt index d46439eba1c..4324884ba86 100644 --- a/tests/baselines/reference/classExtendingPrimitive.errors.txt +++ b/tests/baselines/reference/classExtendingPrimitive.errors.txt @@ -2,16 +2,15 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(4,18): error TS2304: Cannot find name 'string'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(5,18): error TS2304: Cannot find name 'boolean'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(6,18): error TS2304: Cannot find name 'Void'. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(7,19): error TS1133: Type reference expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(7,19): error TS1109: Expression expected. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(8,18): error TS2304: Cannot find name 'Null'. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS1133: Type reference expected. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,24): error TS1005: ';' expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS9002: Only type references are currently supported in a class 'extends' clauses. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(10,18): error TS2304: Cannot find name 'undefined'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(11,18): error TS2304: Cannot find name 'Undefined'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(14,18): error TS2311: A class may only extend another class. -==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts (11 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts (10 errors) ==== // classes cannot extend primitives class C extends number { } @@ -28,15 +27,13 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla !!! error TS2304: Cannot find name 'Void'. class C4a extends void {} ~~~~ -!!! error TS1133: Type reference expected. +!!! error TS1109: Expression expected. class C5 extends Null { } ~~~~ !!! error TS2304: Cannot find name 'Null'. class C5a extends null { } ~~~~ -!!! error TS1133: Type reference expected. - ~ -!!! error TS1005: ';' expected. +!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. class C6 extends undefined { } ~~~~~~~~~ !!! error TS2304: Cannot find name 'undefined'. diff --git a/tests/baselines/reference/classExtendingPrimitive.js b/tests/baselines/reference/classExtendingPrimitive.js index 81301818918..45e92dde5f8 100644 --- a/tests/baselines/reference/classExtendingPrimitive.js +++ b/tests/baselines/reference/classExtendingPrimitive.js @@ -63,13 +63,13 @@ var C5 = (function (_super) { } return C5; })(Null); -var C5a = (function () { +var C5a = (function (_super) { + __extends(C5a, _super); function C5a() { + _super.apply(this, arguments); } return C5a; -})(); -null; -{ } +})(null); var C6 = (function (_super) { __extends(C6, _super); function C6() { diff --git a/tests/baselines/reference/classExtendingPrimitive2.errors.txt b/tests/baselines/reference/classExtendingPrimitive2.errors.txt index cc7da5de821..c63307ae72c 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.errors.txt +++ b/tests/baselines/reference/classExtendingPrimitive2.errors.txt @@ -1,16 +1,13 @@ -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(3,19): error TS1133: Type reference expected. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,19): error TS1133: Type reference expected. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,24): error TS1005: ';' expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(3,19): error TS1109: Expression expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,19): error TS9002: Only type references are currently supported in a class 'extends' clauses. -==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts (3 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts (2 errors) ==== // classes cannot extend primitives class C4a extends void {} ~~~~ -!!! error TS1133: Type reference expected. +!!! error TS1109: Expression expected. class C5a extends null { } ~~~~ -!!! error TS1133: Type reference expected. - ~ -!!! error TS1005: ';' expected. \ No newline at end of file +!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. \ No newline at end of file diff --git a/tests/baselines/reference/classExtendingPrimitive2.js b/tests/baselines/reference/classExtendingPrimitive2.js index 06b481dbbf4..4ac6b14121a 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.js +++ b/tests/baselines/reference/classExtendingPrimitive2.js @@ -6,16 +6,22 @@ class C5a extends null { } //// [classExtendingPrimitive2.js] // classes cannot extend primitives +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; var C4a = (function () { function C4a() { } return C4a; })(); void {}; -var C5a = (function () { +var C5a = (function (_super) { + __extends(C5a, _super); function C5a() { + _super.apply(this, arguments); } return C5a; -})(); -null; -{ } +})(null); diff --git a/tests/baselines/reference/classExtendingQualifiedName2.types b/tests/baselines/reference/classExtendingQualifiedName2.types index 7706f6bada9..ba96058d9b2 100644 --- a/tests/baselines/reference/classExtendingQualifiedName2.types +++ b/tests/baselines/reference/classExtendingQualifiedName2.types @@ -8,7 +8,7 @@ module M { class D extends M.C { >D : D ->M : unknown +>M : typeof M >C : C } } diff --git a/tests/baselines/reference/classExtendsEveryObjectType.errors.txt b/tests/baselines/reference/classExtendsEveryObjectType.errors.txt index f1870d71391..f8c9e003244 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.errors.txt +++ b/tests/baselines/reference/classExtendsEveryObjectType.errors.txt @@ -1,12 +1,13 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(4,17): error TS2311: A class may only extend another class. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(6,18): error TS9002: Only type references are currently supported in a class 'extends' clauses. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(6,31): error TS1005: ',' expected. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(8,18): error TS2304: Cannot find name 'x'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(11,18): error TS2304: Cannot find name 'M'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(14,18): error TS2304: Cannot find name 'foo'. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS1133: Type reference expected. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,20): error TS1005: ';' expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS9002: Only type references are currently supported in a class 'extends' clauses. -==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts (6 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts (7 errors) ==== interface I { foo: string; } @@ -15,6 +16,10 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla !!! error TS2311: A class may only extend another class. class C2 extends { foo: string; } { } // error + ~~~~~~~~~~~~~~~~ +!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. + ~ +!!! error TS1005: ',' expected. var x: { foo: string; } class C3 extends x { } // error ~ @@ -31,7 +36,5 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla !!! error TS2304: Cannot find name 'foo'. class C6 extends []{ } // error - ~ -!!! error TS1133: Type reference expected. - ~ -!!! error TS1005: ';' expected. \ No newline at end of file + ~~ +!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsEveryObjectType.js b/tests/baselines/reference/classExtendsEveryObjectType.js index 2ae7ea71cea..30966fedafc 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.js +++ b/tests/baselines/reference/classExtendsEveryObjectType.js @@ -30,12 +30,13 @@ var C = (function (_super) { } return C; })(I); // error -var C2 = (function () { +var C2 = (function (_super) { + __extends(C2, _super); function C2() { + _super.apply(this, arguments); } return C2; -})(); -{ } // error +})({ foo: string }); // error var x; var C3 = (function (_super) { __extends(C3, _super); @@ -63,10 +64,10 @@ var C5 = (function (_super) { } return C5; })(foo); // error -var C6 = (function () { +var C6 = (function (_super) { + __extends(C6, _super); function C6() { + _super.apply(this, arguments); } return C6; -})(); -[]; -{ } // error +})([]); // error diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt b/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt index ce5d8aed7a9..f191644d5d5 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt +++ b/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt @@ -1,12 +1,15 @@ -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,18): error TS1133: Type reference expected. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,20): error TS1005: ';' expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(1,18): error TS9002: Only type references are currently supported in a class 'extends' clauses. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(1,31): error TS1005: ',' expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,18): error TS9002: Only type references are currently supported in a class 'extends' clauses. -==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts (2 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts (3 errors) ==== class C2 extends { foo: string; } { } // error + ~~~~~~~~~~~~~~~~ +!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. + ~ +!!! error TS1005: ',' expected. class C6 extends []{ } // error - ~ -!!! error TS1133: Type reference expected. - ~ -!!! error TS1005: ';' expected. \ No newline at end of file + ~~ +!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.js b/tests/baselines/reference/classExtendsEveryObjectType2.js index 7be13137766..37c0861f5ec 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.js +++ b/tests/baselines/reference/classExtendsEveryObjectType2.js @@ -4,16 +4,23 @@ class C2 extends { foo: string; } { } // error class C6 extends []{ } // error //// [classExtendsEveryObjectType2.js] -var C2 = (function () { +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C2 = (function (_super) { + __extends(C2, _super); function C2() { + _super.apply(this, arguments); } return C2; -})(); -{ } // error -var C6 = (function () { +})({ foo: string }); // error +var C6 = (function (_super) { + __extends(C6, _super); function C6() { + _super.apply(this, arguments); } return C6; -})(); -[]; -{ } // error +})([]); // error diff --git a/tests/baselines/reference/commentOnAmbientModule.types b/tests/baselines/reference/commentOnAmbientModule.types index bf57d9d11bd..f0056decc29 100644 --- a/tests/baselines/reference/commentOnAmbientModule.types +++ b/tests/baselines/reference/commentOnAmbientModule.types @@ -5,7 +5,7 @@ declare module E { class foobar extends D.bar { >foobar : foobar ->D : unknown +>D : typeof D >bar : D.bar foo(); diff --git a/tests/baselines/reference/declFileGenericType.types b/tests/baselines/reference/declFileGenericType.types index 284ce8f475b..50026cc3aeb 100644 --- a/tests/baselines/reference/declFileGenericType.types +++ b/tests/baselines/reference/declFileGenericType.types @@ -147,14 +147,14 @@ export var g = C.F5>(); export class h extends C.A{ } >h : h ->C : unknown +>C : typeof C >A : C.A >C : unknown >B : C.B export interface i extends C.A { } >i : i ->C : unknown +>C : typeof C >A : C.A >C : unknown >B : C.B diff --git a/tests/baselines/reference/declFileGenericType2.types b/tests/baselines/reference/declFileGenericType2.types index f9345b5ff11..fed2caca7ac 100644 --- a/tests/baselines/reference/declFileGenericType2.types +++ b/tests/baselines/reference/declFileGenericType2.types @@ -30,7 +30,7 @@ declare module templa.mvc { >templa : unknown >mvc : unknown >IModel : IModel ->mvc : unknown +>mvc : typeof mvc >IController : IController >ModelType : ModelType } @@ -42,7 +42,7 @@ declare module templa.mvc.composite { interface ICompositeControllerModel extends mvc.IModel { >ICompositeControllerModel : ICompositeControllerModel ->mvc : unknown +>mvc : typeof mvc >IModel : IModel getControllers(): mvc.IController[]; @@ -64,8 +64,8 @@ module templa.dom.mvc { >templa : unknown >mvc : unknown >IModel : templa.mvc.IModel ->templa : unknown ->mvc : unknown +>templa : typeof templa +>mvc : typeof templa.mvc >IController : templa.mvc.IController >ModelType : ModelType } @@ -82,8 +82,8 @@ module templa.dom.mvc { >templa : unknown >mvc : unknown >IModel : templa.mvc.IModel ->templa : unknown ->mvc : unknown +>templa : typeof templa +>mvc : typeof templa.mvc >AbstractController : templa.mvc.AbstractController >ModelType : ModelType >IElementController : IElementController @@ -110,9 +110,9 @@ module templa.dom.mvc.composite { >mvc : unknown >composite : unknown >ICompositeControllerModel : templa.mvc.composite.ICompositeControllerModel ->templa : unknown ->dom : unknown ->mvc : unknown +>templa : typeof templa +>dom : typeof dom +>mvc : typeof mvc >AbstractElementController : AbstractElementController >ModelType : ModelType diff --git a/tests/baselines/reference/declFileModuleContinuation.types b/tests/baselines/reference/declFileModuleContinuation.types index 671d9e6923c..0080d7cbbf3 100644 --- a/tests/baselines/reference/declFileModuleContinuation.types +++ b/tests/baselines/reference/declFileModuleContinuation.types @@ -15,7 +15,7 @@ module A.B.C { export class W implements A.C.Z { >W : W ->A : unknown +>A : typeof A >C : unknown >Z : A.C.Z } diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.types b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.types index 34d263ef6bb..818a31b26d5 100644 --- a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.types +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.types @@ -19,9 +19,9 @@ module X.Y.base { export class W extends A.B.Base.W { >W : W ->A : unknown ->B : unknown ->Base : unknown +>A : typeof A +>B : typeof A.B +>Base : typeof A.B.Base >W : A.B.Base.W name: string; @@ -38,9 +38,9 @@ module X.Y.base.Z { export class W extends X.Y.base.W { >W : W >TValue : TValue ->X : unknown ->Y : unknown ->base : unknown +>X : typeof X +>Y : typeof Y +>base : typeof base >W : base.W value: boolean; diff --git a/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause1.types b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause1.types index 8c5c4169cb4..b2a1c154412 100644 --- a/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause1.types +++ b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause1.types @@ -20,8 +20,8 @@ module X.A.B.C { } export class W implements X.A.C.Z { // This needs to be refered as X.A.C.Z as A has conflict >W : W ->X : unknown ->A : unknown +>X : typeof X +>A : typeof A >C : unknown >Z : X.A.C.Z } diff --git a/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause2.types b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause2.types index 11afd69d94c..e43d0b78f57 100644 --- a/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause2.types +++ b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause2.types @@ -17,7 +17,7 @@ module X.A.B.C { export class W implements A.C.Z { // This can refer to it as A.C.Z >W : W ->A : unknown +>A : typeof A >C : unknown >Z : A.C.Z } diff --git a/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause3.types b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause3.types index 0b17b2ce78a..d45c2cf0523 100644 --- a/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause3.types +++ b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause3.types @@ -17,8 +17,8 @@ module X.A.B.C { export class W implements X.A.C.Z { // This needs to be refered as X.A.C.Z as A has conflict >W : W ->X : unknown ->A : unknown +>X : typeof X +>A : typeof A >C : unknown >Z : X.A.C.Z } diff --git a/tests/baselines/reference/declarationEmit_nameConflicts.types b/tests/baselines/reference/declarationEmit_nameConflicts.types index f07a7fbb2ab..e38c831493d 100644 --- a/tests/baselines/reference/declarationEmit_nameConflicts.types +++ b/tests/baselines/reference/declarationEmit_nameConflicts.types @@ -119,13 +119,13 @@ export module M.Q { } export interface b extends M.b { } // ok >b : b ->M : unknown +>M : typeof M >b : M.C export interface I extends M.c.I { } // ok >I : I ->M : unknown ->c : unknown +>M : typeof M +>c : typeof M.N >I : M.c.I export module c { @@ -133,8 +133,8 @@ export module M.Q { export interface I extends M.c.I { } // ok >I : I ->M : unknown ->c : unknown +>M : typeof M +>c : typeof M.N >I : M.c.I } } diff --git a/tests/baselines/reference/declareDottedExtend.types b/tests/baselines/reference/declareDottedExtend.types index 5efcea51b26..6b529b5e00d 100644 --- a/tests/baselines/reference/declareDottedExtend.types +++ b/tests/baselines/reference/declareDottedExtend.types @@ -14,12 +14,12 @@ import ab = A.B; class D extends ab.C{ } >D : D ->ab : unknown +>ab : typeof ab >C : ab.C class E extends A.B.C{ } >E : E ->A : unknown ->B : unknown +>A : typeof A +>B : typeof ab >C : ab.C diff --git a/tests/baselines/reference/es6ClassTest7.types b/tests/baselines/reference/es6ClassTest7.types index 9ac4a65b305..2ad5e88179c 100644 --- a/tests/baselines/reference/es6ClassTest7.types +++ b/tests/baselines/reference/es6ClassTest7.types @@ -9,7 +9,7 @@ declare module M { class Bar extends M.Foo { >Bar : Bar ->M : unknown +>M : typeof M >Foo : M.Foo } diff --git a/tests/baselines/reference/extBaseClass1.types b/tests/baselines/reference/extBaseClass1.types index 16f89ab5a20..d160db9a06e 100644 --- a/tests/baselines/reference/extBaseClass1.types +++ b/tests/baselines/reference/extBaseClass1.types @@ -29,7 +29,7 @@ module N { export class C3 extends M.B { >C3 : C3 ->M : unknown +>M : typeof M >B : M.B } } diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types index 6525f201f5b..769f6f5a602 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types @@ -60,7 +60,7 @@ import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // interesting stuff here @@ -72,7 +72,7 @@ import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); export class VisualizationModel extends Backbone.Model { >VisualizationModel : VisualizationModel ->Backbone : unknown +>Backbone : typeof Backbone >Model : Backbone.Model // different interesting stuff here diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types index 2d39c0a465b..1867d390703 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types @@ -191,9 +191,9 @@ module PortalFx.ViewModels.Controls.Validators { export class Validator extends Portal.Controls.Validators.Validator { >Validator : Validator >TValue : TValue ->Portal : unknown ->Controls : unknown ->Validators : unknown +>Portal : typeof Portal +>Controls : typeof Portal.Controls +>Validators : typeof Portal.Controls.Validators >Validator : Portal.Controls.Validators.Validator >TValue : TValue diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.types b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.types index 1e744ce25c2..eadf43d226a 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.types +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.types @@ -12,7 +12,7 @@ declare module EndGate { interface Number extends EndGate.ICloneable { } >Number : Number ->EndGate : unknown +>EndGate : typeof EndGate >ICloneable : EndGate.ICloneable module EndGate.Tweening { diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.types b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.types index ad3182f62e5..80e1a963d5f 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.types +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.types @@ -12,7 +12,7 @@ module EndGate { interface Number extends EndGate.ICloneable { } >Number : Number ->EndGate : unknown +>EndGate : typeof EndGate >ICloneable : EndGate.ICloneable module EndGate.Tweening { diff --git a/tests/baselines/reference/importUsedInExtendsList1.types b/tests/baselines/reference/importUsedInExtendsList1.types index 7261c34e75e..623b14e36aa 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.types +++ b/tests/baselines/reference/importUsedInExtendsList1.types @@ -5,7 +5,7 @@ import foo = require('importUsedInExtendsList1_require'); class Sub extends foo.Super { } >Sub : Sub ->foo : unknown +>foo : typeof foo >Super : foo.Super var s: Sub; diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types index 2a71136613f..69b2ebb608d 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types @@ -14,13 +14,13 @@ module N { export class D1 extends M.C1 { } >D1 : D1 ->M : unknown +>M : typeof M >C1 : M.C1 export class D2 extends M.C2 { } >D2 : D2 >T : T ->M : unknown +>M : typeof M >C2 : M.C2 >T : T } diff --git a/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt b/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt index 06abf0987d6..f00c6923e89 100644 --- a/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt +++ b/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt @@ -1,15 +1,12 @@ -tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts(3,29): error TS1005: ',' expected. -tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts(3,32): error TS1005: '=>' expected. +tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts(3,24): error TS2499: An interface can only extend a type reference. -==== tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts (2 errors) ==== +==== tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts (1 errors) ==== interface color {} interface blue extends color() { // error - ~ -!!! error TS1005: ',' expected. - ~ -!!! error TS1005: '=>' expected. + ~~~~~~~ +!!! error TS2499: An interface can only extend a type reference. } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.js b/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.js index a283722d6ad..f2660dd64f3 100644 --- a/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.js +++ b/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.js @@ -7,5 +7,3 @@ interface blue extends color() { // error //// [interfaceMayNotBeExtendedWitACall.js] -(function () { -}); diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.types b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.types index 7f0163cf1e3..c4aec3ea8c2 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.types +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.types @@ -4,7 +4,7 @@ module rionegrensis { export class caniventer extends Lanthanum.nitidus { >caniventer : caniventer ->Lanthanum : unknown +>Lanthanum : typeof Lanthanum >nitidus : Lanthanum.nitidus >petrophilus : unknown >minutilla : petrophilus.minutilla @@ -89,7 +89,7 @@ module rionegrensis { >veraecrucis : veraecrucis >T0 : T0 >T1 : T1 ->trivirgatus : unknown +>trivirgatus : typeof trivirgatus >mixtus : trivirgatus.mixtus >gabriellae : unknown >amicus : gabriellae.amicus @@ -514,7 +514,7 @@ module julianae { >oralis : oralis >T0 : T0 >T1 : T1 ->caurinus : unknown +>caurinus : typeof caurinus >psilurus : caurinus.psilurus cepapi() : caurinus.psilurus { var x : caurinus.psilurus; () => { var y = this; }; return x; } @@ -751,7 +751,7 @@ module julianae { } export class sumatrana extends Lanthanum.jugularis { >sumatrana : sumatrana ->Lanthanum : unknown +>Lanthanum : typeof Lanthanum >jugularis : Lanthanum.jugularis wolffsohni() : Lanthanum.suillus { var x : Lanthanum.suillus; () => { var y = this; }; return x; } @@ -1276,7 +1276,7 @@ module julianae { } export class durangae extends dogramacii.aurata { >durangae : durangae ->dogramacii : unknown +>dogramacii : typeof dogramacii >aurata : dogramacii.aurata Californium() : panamensis.setulosus { var x : panamensis.setulosus; () => { var y = this; }; return x; } @@ -1429,7 +1429,7 @@ module Lanthanum { >nitidus : nitidus >T0 : T0 >T1 : T1 ->argurus : unknown +>argurus : typeof argurus >gilbertii : argurus.gilbertii >lavali : unknown >thaeleri : lavali.thaeleri @@ -1598,7 +1598,7 @@ module Lanthanum { } export class megalonyx extends caurinus.johorensis { >megalonyx : megalonyx ->caurinus : unknown +>caurinus : typeof caurinus >johorensis : caurinus.johorensis >caurinus : unknown >megaphyllus : caurinus.megaphyllus @@ -1984,7 +1984,7 @@ module rendalli { export class zuluensis extends julianae.steerii { >zuluensis : zuluensis ->julianae : unknown +>julianae : typeof julianae >steerii : julianae.steerii telfairi() : argurus.wetmorei { var x : argurus.wetmorei; () => { var y = this; }; return x; } @@ -2418,7 +2418,7 @@ module rendalli { >crenulata : crenulata >T0 : T0 >T1 : T1 ->trivirgatus : unknown +>trivirgatus : typeof trivirgatus >falconeri : trivirgatus.falconeri salvanius() : howi.coludo { var x : howi.coludo; () => { var y = this; }; return x; } @@ -2612,7 +2612,7 @@ module trivirgatus { >mixtus : mixtus >T0 : T0 >T1 : T1 ->argurus : unknown +>argurus : typeof argurus >pygmaea : argurus.pygmaea >argurus : unknown >oreas : argurus.oreas @@ -3349,7 +3349,7 @@ module ruatanica { export class americanus extends imperfecta.ciliolabrum { >americanus : americanus ->imperfecta : unknown +>imperfecta : typeof imperfecta >ciliolabrum : imperfecta.ciliolabrum >argurus : unknown >germaini : argurus.germaini @@ -3418,7 +3418,7 @@ module lavali { export class wilsoni extends Lanthanum.nitidus { >wilsoni : wilsoni ->Lanthanum : unknown +>Lanthanum : typeof Lanthanum >nitidus : Lanthanum.nitidus >rionegrensis : unknown >caniventer : rionegrensis.caniventer @@ -3638,7 +3638,7 @@ module lavali { } export class otion extends howi.coludo { >otion : otion ->howi : unknown +>howi : typeof howi >coludo : howi.coludo >argurus : unknown >oreas : argurus.oreas @@ -4112,7 +4112,7 @@ module lavali { } export class thaeleri extends argurus.oreas { >thaeleri : thaeleri ->argurus : unknown +>argurus : typeof argurus >oreas : argurus.oreas coromandra() : julianae.galapagoensis { var x : julianae.galapagoensis; () => { var y = this; }; return x; } @@ -4275,7 +4275,7 @@ module lavali { } export class lepturus extends Lanthanum.suillus { >lepturus : lepturus ->Lanthanum : unknown +>Lanthanum : typeof Lanthanum >suillus : Lanthanum.suillus >dammermani : unknown >melanops : dammermani.melanops @@ -4350,7 +4350,7 @@ module dogramacii { export class robustulus extends lavali.wilsoni { >robustulus : robustulus ->lavali : unknown +>lavali : typeof lavali >wilsoni : lavali.wilsoni fossor() : minutus.inez { var x : minutus.inez; () => { var y = this; }; return x; } @@ -4924,7 +4924,7 @@ module lutreolus { export class schlegeli extends lavali.beisa { >schlegeli : schlegeli ->lavali : unknown +>lavali : typeof lavali >beisa : lavali.beisa mittendorfi() : rionegrensis.caniventer { var x : rionegrensis.caniventer; () => { var y = this; }; return x; } @@ -5661,7 +5661,7 @@ module panglima { >amphibius : amphibius >T0 : T0 >T1 : T1 ->caurinus : unknown +>caurinus : typeof caurinus >johorensis : caurinus.johorensis >Lanthanum : unknown >nitidus : Lanthanum.nitidus @@ -5794,7 +5794,7 @@ module panglima { >fundatus : fundatus >T0 : T0 >T1 : T1 ->lutreolus : unknown +>lutreolus : typeof lutreolus >schlegeli : lutreolus.schlegeli crassulus(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } @@ -5899,7 +5899,7 @@ module panglima { >abidi : abidi >T0 : T0 >T1 : T1 ->argurus : unknown +>argurus : typeof argurus >dauricus : argurus.dauricus >argurus : unknown >germaini : argurus.germaini @@ -6113,7 +6113,7 @@ module minutus { >himalayana : himalayana >T0 : T0 >T1 : T1 ->lutreolus : unknown +>lutreolus : typeof lutreolus >punicus : lutreolus.punicus simoni(): argurus.netscheri> { var x: argurus.netscheri>; () => { var y = this; }; return x; } @@ -6356,7 +6356,7 @@ module caurinus { >mahaganus : mahaganus >T0 : T0 >T1 : T1 ->panglima : unknown +>panglima : typeof panglima >fundatus : panglima.fundatus >quasiater : unknown >carolinensis : quasiater.carolinensis @@ -6584,7 +6584,7 @@ module howi { >angulatus : angulatus >T0 : T0 >T1 : T1 ->sagitta : unknown +>sagitta : typeof sagitta >stolzmanni : sagitta.stolzmanni pennatus(): howi.marcanoi { var x: howi.marcanoi; () => { var y = this; }; return x; } @@ -6791,7 +6791,7 @@ module sagitta { export class walkeri extends minutus.portoricensis { >walkeri : walkeri ->minutus : unknown +>minutus : typeof minutus >portoricensis : minutus.portoricensis maracajuensis(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } @@ -6822,7 +6822,7 @@ module minutus { >inez : inez >T0 : T0 >T1 : T1 ->samarensis : unknown +>samarensis : typeof samarensis >pelurus : samarensis.pelurus >argurus : unknown >germaini : argurus.germaini @@ -6855,7 +6855,7 @@ module macrorhinos { export class konganensis extends imperfecta.lasiurus { >konganensis : konganensis ->imperfecta : unknown +>imperfecta : typeof imperfecta >lasiurus : imperfecta.lasiurus >caurinus : unknown >psilurus : caurinus.psilurus @@ -6870,7 +6870,7 @@ module panamensis { >linulus : linulus >T0 : T0 >T1 : T1 ->ruatanica : unknown +>ruatanica : typeof ruatanica >hector : ruatanica.hector >julianae : unknown >sumatrana : julianae.sumatrana @@ -7330,7 +7330,7 @@ module samarensis { >pelurus : pelurus >T0 : T0 >T1 : T1 ->sagitta : unknown +>sagitta : typeof sagitta >stolzmanni : sagitta.stolzmanni Palladium(): panamensis.linulus { var x: panamensis.linulus; () => { var y = this; }; return x; } @@ -7587,7 +7587,7 @@ module samarensis { >fuscus : fuscus >T0 : T0 >T1 : T1 ->macrorhinos : unknown +>macrorhinos : typeof macrorhinos >daphaenodon : macrorhinos.daphaenodon planifrons(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } @@ -8064,7 +8064,7 @@ module sagitta { >leptoceros : leptoceros >T0 : T0 >T1 : T1 ->caurinus : unknown +>caurinus : typeof caurinus >johorensis : caurinus.johorensis >argurus : unknown >peninsulae : argurus.peninsulae @@ -8175,7 +8175,7 @@ module daubentonii { >nigricans : nigricans >T0 : T0 >T1 : T1 ->sagitta : unknown +>sagitta : typeof sagitta >stolzmanni : sagitta.stolzmanni woosnami(): dogramacii.robustulus { var x: dogramacii.robustulus; () => { var y = this; }; return x; } @@ -8207,7 +8207,7 @@ module argurus { >pygmaea : pygmaea >T0 : T0 >T1 : T1 ->rendalli : unknown +>rendalli : typeof rendalli >moojeni : rendalli.moojeni >macrorhinos : unknown >konganensis : macrorhinos.konganensis @@ -8258,7 +8258,7 @@ module chrysaeolus { >sarasinorum : sarasinorum >T0 : T0 >T1 : T1 ->caurinus : unknown +>caurinus : typeof caurinus >psilurus : caurinus.psilurus belzebul(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } @@ -8500,7 +8500,7 @@ module argurus { export class oreas extends lavali.wilsoni { >oreas : oreas ->lavali : unknown +>lavali : typeof lavali >wilsoni : lavali.wilsoni salamonis(): lavali.xanthognathus { var x: lavali.xanthognathus; () => { var y = this; }; return x; } @@ -9129,7 +9129,7 @@ module provocax { export class melanoleuca extends lavali.wilsoni { >melanoleuca : melanoleuca ->lavali : unknown +>lavali : typeof lavali >wilsoni : lavali.wilsoni Neodymium(): macrorhinos.marmosurus, lutreolus.foina> { var x: macrorhinos.marmosurus, lutreolus.foina>; () => { var y = this; }; return x; } @@ -9275,7 +9275,7 @@ module howi { export class marcanoi extends Lanthanum.megalonyx { >marcanoi : marcanoi ->Lanthanum : unknown +>Lanthanum : typeof Lanthanum >megalonyx : Lanthanum.megalonyx formosae(): Lanthanum.megalonyx { var x: Lanthanum.megalonyx; () => { var y = this; }; return x; } @@ -10362,7 +10362,7 @@ module gabriellae { >klossii : klossii >T0 : T0 >T1 : T1 ->imperfecta : unknown +>imperfecta : typeof imperfecta >lasiurus : imperfecta.lasiurus >dogramacii : unknown >robustulus : dogramacii.robustulus @@ -10871,7 +10871,7 @@ module imperfecta { >ciliolabrum : ciliolabrum >T0 : T0 >T1 : T1 ->dogramacii : unknown +>dogramacii : typeof dogramacii >robustulus : dogramacii.robustulus leschenaultii(): argurus.dauricus> { var x: argurus.dauricus>; () => { var y = this; }; return x; } @@ -11034,7 +11034,7 @@ module petrophilus { >sodyi : sodyi >T0 : T0 >T1 : T1 ->quasiater : unknown +>quasiater : typeof quasiater >bobrinskoi : quasiater.bobrinskoi saundersiae(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } @@ -11167,7 +11167,7 @@ module caurinus { export class megaphyllus extends imperfecta.lasiurus> { >megaphyllus : megaphyllus ->imperfecta : unknown +>imperfecta : typeof imperfecta >lasiurus : imperfecta.lasiurus >julianae : unknown >acariensis : julianae.acariensis @@ -11600,7 +11600,7 @@ module lutreolus { >cor : cor >T0 : T0 >T1 : T1 ->panglima : unknown +>panglima : typeof panglima >fundatus : panglima.fundatus >panamensis : unknown >linulus : panamensis.linulus @@ -11846,7 +11846,7 @@ module argurus { export class germaini extends gabriellae.amicus { >germaini : germaini ->gabriellae : unknown +>gabriellae : typeof gabriellae >amicus : gabriellae.amicus sharpei(): lavali.wilsoni { var x: lavali.wilsoni; () => { var y = this; }; return x; } @@ -12058,7 +12058,7 @@ module dammermani { export class melanops extends minutus.inez { >melanops : melanops ->minutus : unknown +>minutus : typeof minutus >inez : minutus.inez >sagitta : unknown >stolzmanni : sagitta.stolzmanni @@ -12307,7 +12307,7 @@ module argurus { export class peninsulae extends patas.uralensis { >peninsulae : peninsulae ->patas : unknown +>patas : typeof patas >uralensis : patas.uralensis aitkeni(): trivirgatus.mixtus, panglima.amphibius> { var x: trivirgatus.mixtus, panglima.amphibius>; () => { var y = this; }; return x; } @@ -12771,7 +12771,7 @@ module ruatanica { >Praseodymium : Praseodymium >T0 : T0 >T1 : T1 ->ruatanica : unknown +>ruatanica : typeof ruatanica >hector : hector >lutreolus : unknown >punicus : lutreolus.punicus @@ -13118,7 +13118,7 @@ module caurinus { >johorensis : johorensis >T0 : T0 >T1 : T1 ->lutreolus : unknown +>lutreolus : typeof lutreolus >punicus : lutreolus.punicus maini(): ruatanica.Praseodymium { var x: ruatanica.Praseodymium; () => { var y = this; }; return x; } @@ -13564,7 +13564,7 @@ module caurinus { export class psilurus extends lutreolus.punicus { >psilurus : psilurus ->lutreolus : unknown +>lutreolus : typeof lutreolus >punicus : lutreolus.punicus socialis(): panglima.amphibius { var x: panglima.amphibius; () => { var y = this; }; return x; } diff --git a/tests/baselines/reference/thisInInvalidContexts.errors.txt b/tests/baselines/reference/thisInInvalidContexts.errors.txt index c9ec44b8cd6..a04b42074d5 100644 --- a/tests/baselines/reference/thisInInvalidContexts.errors.txt +++ b/tests/baselines/reference/thisInInvalidContexts.errors.txt @@ -1,13 +1,12 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(22,15): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(28,13): error TS2331: 'this' cannot be referenced in a module body. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(38,25): error TS1133: Type reference expected. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(38,30): error TS1005: ';' expected. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(38,25): error TS9002: Only type references are currently supported in a class 'extends' clauses. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(44,9): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9): error TS2332: 'this' cannot be referenced in current location. -==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts (7 errors) ==== +==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts (6 errors) ==== //'this' in static member initializer class ErrClass1 { static t = this; // Error @@ -53,9 +52,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9): class ErrClass3 extends this { ~~~~ -!!! error TS1133: Type reference expected. - ~ -!!! error TS1005: ';' expected. +!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. } diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index f21ebedc1eb..5720156de0b 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -94,14 +94,13 @@ var M; //'this' as a type argument function genericFunc(x) { } genericFunc < this > (undefined); // Should be an error -var ErrClass3 = (function () { +var ErrClass3 = (function (_super) { + __extends(ErrClass3, _super); function ErrClass3() { + _super.apply(this, arguments); } return ErrClass3; -})(); -this; -{ -} +})(this); //'this' as a computed enum value var SomeEnum; (function (SomeEnum) { diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt index 0453d3ed315..90264376a82 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt @@ -1,14 +1,13 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(22,15): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(28,13): error TS2331: 'this' cannot be referenced in a module body. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,25): error TS1133: Type reference expected. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,30): error TS1005: ';' expected. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,25): error TS9002: Only type references are currently supported in a class 'extends' clauses. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(44,9): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(45,9): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(48,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. -==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts (8 errors) ==== +==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts (7 errors) ==== //'this' in static member initializer class ErrClass1 { static t = this; // Error @@ -54,9 +53,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod class ErrClass3 extends this { ~~~~ -!!! error TS1133: Type reference expected. - ~ -!!! error TS1005: ';' expected. +!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. } diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index e9fddd380bf..eee8bcc8487 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -94,14 +94,13 @@ var M; //'this' as a type argument function genericFunc(x) { } genericFunc < this > (undefined); // Should be an error -var ErrClass3 = (function () { +var ErrClass3 = (function (_super) { + __extends(ErrClass3, _super); function ErrClass3() { + _super.apply(this, arguments); } return ErrClass3; -})(); -this; -{ -} +})(this); //'this' as a computed enum value var SomeEnum; (function (SomeEnum) { diff --git a/tests/cases/fourslash/completionListInExtendsClause.ts b/tests/cases/fourslash/completionListInExtendsClause.ts index ee2acc6a12c..87cd2ddec09 100644 --- a/tests/cases/fourslash/completionListInExtendsClause.ts +++ b/tests/cases/fourslash/completionListInExtendsClause.ts @@ -17,9 +17,9 @@ ////interface test3 extends IFoo./*3*/ {} ////interface test4 implements Foo./*4*/ {} - +debugger; goTo.marker("1"); -verify.completionListIsEmpty(); +verify.not.completionListIsEmpty(); goTo.marker("2"); verify.completionListIsEmpty(); @@ -28,4 +28,4 @@ goTo.marker("3"); verify.completionListIsEmpty(); goTo.marker("4"); -verify.completionListIsEmpty(); \ No newline at end of file +verify.not.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts b/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts index 53840fc3bd9..2bfa9e265fa 100644 --- a/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts +++ b/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts @@ -15,11 +15,11 @@ ////} //// ////(new C()).[|abc|]; - test.ranges().forEach(r => { goTo.position(r.start); test.ranges().forEach(range => { + debugger; verify.occurrencesAtPositionContains(range); }); verify.occurrencesAtPositionCount(test.ranges().length); diff --git a/tests/cases/fourslash/semanticClassification1.ts b/tests/cases/fourslash/semanticClassification1.ts index 4eb7f2a32ed..eb04aca9d7b 100644 --- a/tests/cases/fourslash/semanticClassification1.ts +++ b/tests/cases/fourslash/semanticClassification1.ts @@ -7,6 +7,7 @@ //// interface /*2*/X extends /*3*/M./*4*/I { } var c = classification; +debugger; verify.semanticClassificationsAre( c.moduleName("M", test.marker("0").position), c.interfaceName("I", test.marker("1").position), From 3d4445c645792e12c05a431c0caaaaf12d800a02 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 12:42:40 -0700 Subject: [PATCH 25/61] Add contents for editTest --- tests/cases/unittests/versionCache.ts | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts index 8a4d1b1af0d..2a39442e4ec 100644 --- a/tests/cases/unittests/versionCache.ts +++ b/tests/cases/unittests/versionCache.ts @@ -92,14 +92,17 @@ module ts{ } function editTest() { - var fname = testDataDir + 'editme'; - var content = ts.sys.readFile(fname); - var lm = server.LineIndex.linesFromText(content); - var lines = lm.lines; + var content = `in this story: +the lazy brown fox +jumped over the cow +that ate the grass +that was purple at the tips +and grew 1cm per day`; + + var {lines, lineMap} = server.LineIndex.linesFromText(content); if (lines.length == 0) { return; } - var lineMap = lm.lineMap; var lineIndex = new server.LineIndex(); lineIndex.load(lines); @@ -420,11 +423,11 @@ module ts{ } } - function edTest() { - editTest(); - tstTest(); - bigTest(); - } + //function edTest() { + // editTest(); + // tstTest(); + // bigTest(); + //} - edTest(); + //edTest(); } From cb00b472543f7774c739c3f52b406e73d3056127 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 13:32:53 -0700 Subject: [PATCH 26/61] use descript and it to run tests --- tests/cases/unittests/versionCache.ts | 220 ++++++++++++++------------ 1 file changed, 122 insertions(+), 98 deletions(-) diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts index 2a39442e4ec..0a93fcb55cf 100644 --- a/tests/cases/unittests/versionCache.ts +++ b/tests/cases/unittests/versionCache.ts @@ -1,9 +1,9 @@ /// /// -module ts{ - function editFlat(s: number, dl: number, nt: string, source: string) { - return source.substring(0, s) + nt + source.substring(s + dl, source.length); +module ts { + function editFlat(position: number, deletedLength: number, newText: string, source: string) { + return source.substring(0, position) + newText + source.substring(position + deletedLength, source.length); } var testDataDir = "..\..\..\src\compiler"; @@ -91,7 +91,8 @@ module ts{ } } - function editTest() { + describe('versionCache -- Edit test', () => { + var content = `in this story: the lazy brown fox jumped over the cow @@ -113,137 +114,160 @@ and grew 1cm per day`; var checkText: string; var insertString: string; - // Case VII: insert at end of file - insertString = "hmmmm...\r\n"; - checkText = editFlat(content.length, 0, insertString, content); - snapshot = lineIndex.edit(content.length, 0, insertString); - editedText = snapshot.getText(0, checkText.length); + it('Case VII: insert at end of file', () => { + insertString = "hmmmm...\r\n"; + checkText = editFlat(content.length, 0, insertString, content); + snapshot = lineIndex.edit(content.length, 0, insertString); + editedText = snapshot.getText(0, checkText.length); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - // Case IV: unusual line endings merge - snapshot = lineIndex.edit(lines[0].length - 1, lines[1].length, ""); - editedText = snapshot.getText(0, content.length - lines[1].length); - checkText = editFlat(lines[0].length - 1, lines[1].length, "", content); + it('Case IV: unusual line endings merge', () => { + snapshot = lineIndex.edit(lines[0].length - 1, lines[1].length, ""); + editedText = snapshot.getText(0, content.length - lines[1].length); + checkText = editFlat(lines[0].length - 1, lines[1].length, "", content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - // Case VIIa: delete whole line and nothing but line (last line) - var llpos = lm.lineMap[lm.lineMap.length - 2]; - snapshot = lineIndex.edit(llpos, lines[lines.length - 1].length, ""); - checkText = editFlat(llpos, lines[lines.length - 1].length, "", content); - editedText = snapshot.getText(0, checkText.length); + it('Case VIIa: delete whole line and nothing but line (last line)', () => { + var llpos = lineMap[lineMap.length - 2]; + snapshot = lineIndex.edit(llpos, lines[lines.length - 1].length, ""); + checkText = editFlat(llpos, lines[lines.length - 1].length, "", content); + editedText = snapshot.getText(0, checkText.length); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - // Case VIIb: delete whole line and nothing but line (first line) - snapshot = lineIndex.edit(0, lines[0].length, ""); - editedText = snapshot.getText(0, content.length - lines[0].length); - checkText = editFlat(0, lines[0].length, "", content); + it('Case VIIb: delete whole line and nothing but line (first line)', () => { + snapshot = lineIndex.edit(0, lines[0].length, ""); + editedText = snapshot.getText(0, content.length - lines[0].length); + checkText = editFlat(0, lines[0].length, "", content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - // and insert with no line breaks - insertString = "moo, moo, moo! "; - snapshot = lineIndex.edit(0, lines[0].length, insertString); - editedText = snapshot.getText(0, content.length - lines[0].length + insertString.length); - checkText = editFlat(0, lines[0].length, insertString, content); + it('Case VIIc: delete whole line (first line) and insert with no line breaks', () => { + insertString = "moo, moo, moo! "; + snapshot = lineIndex.edit(0, lines[0].length, insertString); + editedText = snapshot.getText(0, content.length - lines[0].length + insertString.length); + checkText = editFlat(0, lines[0].length, insertString, content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - // and insert with multiple line breaks - insertString = "moo, \r\nmoo, \r\nmoo! "; - snapshot = lineIndex.edit(0, lines[0].length, insertString); - editedText = snapshot.getText(0, content.length - lines[0].length + insertString.length); - checkText = editFlat(0, lines[0].length, insertString, content); + it('Case VIIc: delete whole line (first line) and insert with multiple line breaks', () => { + insertString = "moo, \r\nmoo, \r\nmoo! "; + snapshot = lineIndex.edit(0, lines[0].length, insertString); + editedText = snapshot.getText(0, content.length - lines[0].length + insertString.length); + checkText = editFlat(0, lines[0].length, insertString, content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - snapshot = lineIndex.edit(0, lines[0].length + lines[1].length, ""); - editedText = snapshot.getText(0, content.length - (lines[0].length + lines[1].length)); - checkText = editFlat(0, lines[0].length + lines[1].length, "", content); + it('Case VIId: delete multiple lines and nothing but lines (first and second lines)', () => { + snapshot = lineIndex.edit(0, lines[0].length + lines[1].length, ""); + editedText = snapshot.getText(0, content.length - (lines[0].length + lines[1].length)); + checkText = editFlat(0, lines[0].length + lines[1].length, "", content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - snapshot = lineIndex.edit(lines[0].length, lines[1].length + lines[2].length, ""); + it('Case VIIe: delete multiple lines and nothing but lines (second and third lines)', () => { + snapshot = lineIndex.edit(lines[0].length, lines[1].length + lines[2].length, ""); - editedText = snapshot.getText(0, content.length - (lines[1].length + lines[2].length)); - checkText = editFlat(lines[0].length, lines[1].length + lines[2].length, "", content); + editedText = snapshot.getText(0, content.length - (lines[1].length + lines[2].length)); + checkText = editFlat(lines[0].length, lines[1].length + lines[2].length, "", content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - // Case VI: insert multiple line breaks + it('Case VI: insert multiple line breaks', () => { + insertString = "cr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr"; + snapshot = lineIndex.edit(21, 1, insertString); + editedText = snapshot.getText(0, content.length + insertString.length - 1); + checkText = editFlat(21, 1, insertString, content); - insertString = "cr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr"; - snapshot = lineIndex.edit(21, 1, insertString); - editedText = snapshot.getText(0, content.length + insertString.length - 1); - checkText = editFlat(21, 1, insertString, content); + assert.equal(editedText, checkText); + }); - assert.equal(editedText, checkText); + it('Case VIb: insert multiple line breaks', () => { - insertString = "cr...\r\ncr...\r\ncr"; - snapshot = lineIndex.edit(21, 1, insertString); - editedText = snapshot.getText(0, content.length + insertString.length - 1); - checkText = editFlat(21, 1, insertString, content); + insertString = "cr...\r\ncr...\r\ncr"; + snapshot = lineIndex.edit(21, 1, insertString); + editedText = snapshot.getText(0, content.length + insertString.length - 1); + checkText = editFlat(21, 1, insertString, content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - // leading '\n' - insertString = "\ncr...\r\ncr...\r\ncr"; - snapshot = lineIndex.edit(21, 1, insertString); - editedText = snapshot.getText(0, content.length + insertString.length - 1); - checkText = editFlat(21, 1, insertString, content); + it('Case VIc: insert multiple line breaks with leading \\n', () => { + insertString = "\ncr...\r\ncr...\r\ncr"; + snapshot = lineIndex.edit(21, 1, insertString); + editedText = snapshot.getText(0, content.length + insertString.length - 1); + checkText = editFlat(21, 1, insertString, content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - // Case I: single line no line breaks deleted or inserted - // delete 1 char - snapshot = lineIndex.edit(21, 1); - editedText = snapshot.getText(0, content.length - 1); - checkText = editFlat(21, 1, "", content); + it('Case I: single line no line breaks deleted or inserted, delete 1 char', () => { + snapshot = lineIndex.edit(21, 1); + editedText = snapshot.getText(0, content.length - 1); + checkText = editFlat(21, 1, "", content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - // insert 1 char - snapshot = lineIndex.edit(21, 0, "b"); - editedText = snapshot.getText(0, content.length + 1); - checkText = editFlat(21, 0, "b", content); + it('Case Ib: single line no line breaks deleted or inserted, insert 1 char', () => { + snapshot = lineIndex.edit(21, 0, "b"); + editedText = snapshot.getText(0, content.length + 1); + checkText = editFlat(21, 0, "b", content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - // delete 1, insert 2 - snapshot = lineIndex.edit(21, 1, "cr"); - editedText = snapshot.getText(0, content.length + 1); - checkText = editFlat(21, 1, "cr", content); + it('Case Ib: single line no line breaks deleted or inserted, delete 1, insert 2 chars', () => { + snapshot = lineIndex.edit(21, 1, "cr"); + editedText = snapshot.getText(0, content.length + 1); + checkText = editFlat(21, 1, "cr", content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - // Case II: delete across line break - snapshot = lineIndex.edit(21, 22); - editedText = snapshot.getText(0, content.length - 22); - checkText = editFlat(21, 22, "", content); + it('Case II: delete across line break (just the line break)', () => { + snapshot = lineIndex.edit(21, 22); + editedText = snapshot.getText(0, content.length - 22); + checkText = editFlat(21, 22, "", content); - assert.equal(editedText, checkText); + assert.equal(editedText, checkText); + }); - snapshot = lineIndex.edit(21, 32); - editedText = snapshot.getText(0, content.length - 32); - checkText = editFlat(21, 32, "", content); + it('Case IIb: delete across line break', () => { - assert.equal(editedText, checkText); + snapshot = lineIndex.edit(21, 32); + editedText = snapshot.getText(0, content.length - 32); + checkText = editFlat(21, 32, "", content); - // Case III: delete across multiple line breaks and insert no line breaks - snapshot = lineIndex.edit(21, 42); - editedText = snapshot.getText(0, content.length - 42); - checkText = editFlat(21, 42, "", content); + assert.equal(editedText, checkText); + }); - assert.equal(editedText, checkText); + it('Case III: delete across multiple line breaks and insert no line breaks', () => { + snapshot = lineIndex.edit(21, 42); + editedText = snapshot.getText(0, content.length - 42); + checkText = editFlat(21, 42, "", content); - snapshot = lineIndex.edit(21, 42, "slithery "); - editedText = snapshot.getText(0, content.length - 33); - checkText = editFlat(21, 42, "slithery ", content); + assert.equal(editedText, checkText); + }); - assert.equal(editedText, checkText); - } + it('Case IIIb: delete across multiple line breaks and insert text', () => { + snapshot = lineIndex.edit(21, 42, "slithery "); + editedText = snapshot.getText(0, content.length - 33); + checkText = editFlat(21, 42, "slithery ", content); + + assert.equal(editedText, checkText); + }); + }); function editStress(fname: string, timing: boolean) { var content = ts.sys.readFile(testDataDir + fname); From 7f5337701f2fe3d11bf6449b92c4f74ed52d1482 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 13:40:17 -0700 Subject: [PATCH 27/61] Consolidate test logic in one helper function --- src/server/editorServices.ts | 4 + tests/cases/unittests/versionCache.ts | 119 ++++++-------------------- 2 files changed, 30 insertions(+), 93 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index a3814c8fec1..366e4dbfd84 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1466,6 +1466,10 @@ module ts.server { return accum; } + getLength(): number { + return this.root.charCount(); + } + every(f: (ll: LineLeaf, s: number, len: number) => boolean, rangeStart: number, rangeEnd?: number) { if (!rangeEnd) { rangeEnd = this.root.charCount(); diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts index 0a93fcb55cf..c739b0e9f32 100644 --- a/tests/cases/unittests/versionCache.ts +++ b/tests/cases/unittests/versionCache.ts @@ -114,158 +114,91 @@ and grew 1cm per day`; var checkText: string; var insertString: string; - it('Case VII: insert at end of file', () => { - insertString = "hmmmm...\r\n"; - checkText = editFlat(content.length, 0, insertString, content); - snapshot = lineIndex.edit(content.length, 0, insertString); - editedText = snapshot.getText(0, checkText.length); + function testEdit(position: number, deleteLength: number, insertString: string): void { + var checkText = editFlat(position, deleteLength, insertString, content); + snapshot = lineIndex.edit(position, deleteLength, insertString); + var editedText = snapshot.getText(0, snapshot.getLength()); assert.equal(editedText, checkText); + } + + it('Case VII: insert at end of file', () => { + insertString = "hmmmm...\r\n"; + testEdit(content.length, 0, insertString); }); it('Case IV: unusual line endings merge', () => { - snapshot = lineIndex.edit(lines[0].length - 1, lines[1].length, ""); - editedText = snapshot.getText(0, content.length - lines[1].length); - checkText = editFlat(lines[0].length - 1, lines[1].length, "", content); - - assert.equal(editedText, checkText); + testEdit(lines[0].length - 1, lines[1].length, ""); }); it('Case VIIa: delete whole line and nothing but line (last line)', () => { var llpos = lineMap[lineMap.length - 2]; - snapshot = lineIndex.edit(llpos, lines[lines.length - 1].length, ""); - checkText = editFlat(llpos, lines[lines.length - 1].length, "", content); - editedText = snapshot.getText(0, checkText.length); - - assert.equal(editedText, checkText); + testEdit(llpos, lines[lines.length - 1].length, ""); }); it('Case VIIb: delete whole line and nothing but line (first line)', () => { - snapshot = lineIndex.edit(0, lines[0].length, ""); - editedText = snapshot.getText(0, content.length - lines[0].length); - checkText = editFlat(0, lines[0].length, "", content); - - assert.equal(editedText, checkText); + testEdit(0, lines[0].length, ""); }); it('Case VIIc: delete whole line (first line) and insert with no line breaks', () => { insertString = "moo, moo, moo! "; - snapshot = lineIndex.edit(0, lines[0].length, insertString); - editedText = snapshot.getText(0, content.length - lines[0].length + insertString.length); - checkText = editFlat(0, lines[0].length, insertString, content); - - assert.equal(editedText, checkText); + testEdit(0, lines[0].length, insertString); }); it('Case VIIc: delete whole line (first line) and insert with multiple line breaks', () => { insertString = "moo, \r\nmoo, \r\nmoo! "; - snapshot = lineIndex.edit(0, lines[0].length, insertString); - editedText = snapshot.getText(0, content.length - lines[0].length + insertString.length); - checkText = editFlat(0, lines[0].length, insertString, content); - - assert.equal(editedText, checkText); + testEdit(0, lines[0].length, insertString); }); it('Case VIId: delete multiple lines and nothing but lines (first and second lines)', () => { - snapshot = lineIndex.edit(0, lines[0].length + lines[1].length, ""); - editedText = snapshot.getText(0, content.length - (lines[0].length + lines[1].length)); - checkText = editFlat(0, lines[0].length + lines[1].length, "", content); - - assert.equal(editedText, checkText); + testEdit(0, lines[0].length + lines[1].length, ""); }); it('Case VIIe: delete multiple lines and nothing but lines (second and third lines)', () => { - snapshot = lineIndex.edit(lines[0].length, lines[1].length + lines[2].length, ""); - - editedText = snapshot.getText(0, content.length - (lines[1].length + lines[2].length)); - checkText = editFlat(lines[0].length, lines[1].length + lines[2].length, "", content); - - assert.equal(editedText, checkText); + testEdit(lines[0].length, lines[1].length + lines[2].length, ""); }); it('Case VI: insert multiple line breaks', () => { insertString = "cr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr"; - snapshot = lineIndex.edit(21, 1, insertString); - editedText = snapshot.getText(0, content.length + insertString.length - 1); - checkText = editFlat(21, 1, insertString, content); - - assert.equal(editedText, checkText); + testEdit(21, 1, insertString); }); it('Case VIb: insert multiple line breaks', () => { - insertString = "cr...\r\ncr...\r\ncr"; - snapshot = lineIndex.edit(21, 1, insertString); - editedText = snapshot.getText(0, content.length + insertString.length - 1); - checkText = editFlat(21, 1, insertString, content); - - assert.equal(editedText, checkText); + testEdit(21, 1, insertString); }); it('Case VIc: insert multiple line breaks with leading \\n', () => { insertString = "\ncr...\r\ncr...\r\ncr"; - snapshot = lineIndex.edit(21, 1, insertString); - editedText = snapshot.getText(0, content.length + insertString.length - 1); - checkText = editFlat(21, 1, insertString, content); - - assert.equal(editedText, checkText); + testEdit(21, 1, insertString); }); it('Case I: single line no line breaks deleted or inserted, delete 1 char', () => { - snapshot = lineIndex.edit(21, 1); - editedText = snapshot.getText(0, content.length - 1); - checkText = editFlat(21, 1, "", content); - - assert.equal(editedText, checkText); + testEdit(21, 1, ""); }); it('Case Ib: single line no line breaks deleted or inserted, insert 1 char', () => { - snapshot = lineIndex.edit(21, 0, "b"); - editedText = snapshot.getText(0, content.length + 1); - checkText = editFlat(21, 0, "b", content); - - assert.equal(editedText, checkText); + testEdit(21, 0, "b"); }); it('Case Ib: single line no line breaks deleted or inserted, delete 1, insert 2 chars', () => { - snapshot = lineIndex.edit(21, 1, "cr"); - editedText = snapshot.getText(0, content.length + 1); - checkText = editFlat(21, 1, "cr", content); - - assert.equal(editedText, checkText); + testEdit(21, 1, "cr"); }); it('Case II: delete across line break (just the line break)', () => { - snapshot = lineIndex.edit(21, 22); - editedText = snapshot.getText(0, content.length - 22); - checkText = editFlat(21, 22, "", content); - - assert.equal(editedText, checkText); + testEdit(21, 22, ""); }); it('Case IIb: delete across line break', () => { - - snapshot = lineIndex.edit(21, 32); - editedText = snapshot.getText(0, content.length - 32); - checkText = editFlat(21, 32, "", content); - - assert.equal(editedText, checkText); + testEdit(21, 32, ""); }); it('Case III: delete across multiple line breaks and insert no line breaks', () => { - snapshot = lineIndex.edit(21, 42); - editedText = snapshot.getText(0, content.length - 42); - checkText = editFlat(21, 42, "", content); - - assert.equal(editedText, checkText); + testEdit(21, 42, ""); }); it('Case IIIb: delete across multiple line breaks and insert text', () => { - snapshot = lineIndex.edit(21, 42, "slithery "); - editedText = snapshot.getText(0, content.length - 33); - checkText = editFlat(21, 42, "slithery ", content); - - assert.equal(editedText, checkText); + testEdit(21, 42, "slithery "); }); }); From 79af91a8e9d027a9f612eb49b37428ee20b98737 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 13:45:11 -0700 Subject: [PATCH 28/61] Cleanup --- tests/cases/unittests/versionCache.ts | 46 +++++++++------------------ 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts index c739b0e9f32..8fe8109315e 100644 --- a/tests/cases/unittests/versionCache.ts +++ b/tests/cases/unittests/versionCache.ts @@ -92,39 +92,29 @@ module ts { } describe('versionCache -- Edit test', () => { - - var content = `in this story: + let testContent = `in this story: the lazy brown fox jumped over the cow that ate the grass that was purple at the tips and grew 1cm per day`; - var {lines, lineMap} = server.LineIndex.linesFromText(content); - if (lines.length == 0) { - return; - } + let {lines, lineMap} = server.LineIndex.linesFromText(testContent); + assert.isTrue(lines.length > 0, "Failed to initialize test text. Expected text to have at least one line"); - var lineIndex = new server.LineIndex(); + let lineIndex = new server.LineIndex(); lineIndex.load(lines); - var editedText = lineIndex.getText(0, content.length); - - var snapshot: server.LineIndex; - var checkText: string; - var insertString: string; - function testEdit(position: number, deleteLength: number, insertString: string): void { - var checkText = editFlat(position, deleteLength, insertString, content); - snapshot = lineIndex.edit(position, deleteLength, insertString); - var editedText = snapshot.getText(0, snapshot.getLength()); + let checkText = editFlat(position, deleteLength, insertString, testContent); + let snapshot = lineIndex.edit(position, deleteLength, insertString); + let editedText = snapshot.getText(0, snapshot.getLength()); assert.equal(editedText, checkText); } - + it('Case VII: insert at end of file', () => { - insertString = "hmmmm...\r\n"; - testEdit(content.length, 0, insertString); + testEdit(testContent.length, 0, "hmmmm...\r\n"); }); it('Case IV: unusual line endings merge', () => { @@ -132,8 +122,7 @@ and grew 1cm per day`; }); it('Case VIIa: delete whole line and nothing but line (last line)', () => { - var llpos = lineMap[lineMap.length - 2]; - testEdit(llpos, lines[lines.length - 1].length, ""); + testEdit(lineMap[lineMap.length - 2], lines[lines.length - 1].length, ""); }); it('Case VIIb: delete whole line and nothing but line (first line)', () => { @@ -141,13 +130,11 @@ and grew 1cm per day`; }); it('Case VIIc: delete whole line (first line) and insert with no line breaks', () => { - insertString = "moo, moo, moo! "; - testEdit(0, lines[0].length, insertString); + testEdit(0, lines[0].length, "moo, moo, moo! "); }); it('Case VIIc: delete whole line (first line) and insert with multiple line breaks', () => { - insertString = "moo, \r\nmoo, \r\nmoo! "; - testEdit(0, lines[0].length, insertString); + testEdit(0, lines[0].length, "moo, \r\nmoo, \r\nmoo! "); }); it('Case VIId: delete multiple lines and nothing but lines (first and second lines)', () => { @@ -159,18 +146,15 @@ and grew 1cm per day`; }); it('Case VI: insert multiple line breaks', () => { - insertString = "cr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr"; - testEdit(21, 1, insertString); + testEdit(21, 1, "cr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr"); }); it('Case VIb: insert multiple line breaks', () => { - insertString = "cr...\r\ncr...\r\ncr"; - testEdit(21, 1, insertString); + testEdit(21, 1, "cr...\r\ncr...\r\ncr"); }); it('Case VIc: insert multiple line breaks with leading \\n', () => { - insertString = "\ncr...\r\ncr...\r\ncr"; - testEdit(21, 1, insertString); + testEdit(21, 1, "\ncr...\r\ncr...\r\ncr"); }); it('Case I: single line no line breaks deleted or inserted, delete 1 char', () => { From 1f75c0388409cf0369e8117a3d559a4611e14aed Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 13:48:53 -0700 Subject: [PATCH 29/61] Update test names --- tests/cases/unittests/versionCache.ts | 39 +++++++++++++-------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts index 8fe8109315e..3a9d9bd5a9f 100644 --- a/tests/cases/unittests/versionCache.ts +++ b/tests/cases/unittests/versionCache.ts @@ -91,7 +91,7 @@ module ts { } } - describe('versionCache -- Edit test', () => { + describe('VersionCache edit', () => { let testContent = `in this story: the lazy brown fox jumped over the cow @@ -113,75 +113,75 @@ and grew 1cm per day`; assert.equal(editedText, checkText); } - it('Case VII: insert at end of file', () => { + it('Insert at end of file', () => { testEdit(testContent.length, 0, "hmmmm...\r\n"); }); - it('Case IV: unusual line endings merge', () => { + it('Unusual line endings merge', () => { testEdit(lines[0].length - 1, lines[1].length, ""); }); - it('Case VIIa: delete whole line and nothing but line (last line)', () => { + it('Delete whole line and nothing but line (last line)', () => { testEdit(lineMap[lineMap.length - 2], lines[lines.length - 1].length, ""); }); - it('Case VIIb: delete whole line and nothing but line (first line)', () => { + it('Delete whole line and nothing but line (first line)', () => { testEdit(0, lines[0].length, ""); }); - it('Case VIIc: delete whole line (first line) and insert with no line breaks', () => { + it('Delete whole line (first line) and insert with no line breaks', () => { testEdit(0, lines[0].length, "moo, moo, moo! "); }); - it('Case VIIc: delete whole line (first line) and insert with multiple line breaks', () => { + it('Delete whole line (first line) and insert with multiple line breaks', () => { testEdit(0, lines[0].length, "moo, \r\nmoo, \r\nmoo! "); }); - it('Case VIId: delete multiple lines and nothing but lines (first and second lines)', () => { + it('Delete multiple lines and nothing but lines (first and second lines)', () => { testEdit(0, lines[0].length + lines[1].length, ""); }); - it('Case VIIe: delete multiple lines and nothing but lines (second and third lines)', () => { + it('Delete multiple lines and nothing but lines (second and third lines)', () => { testEdit(lines[0].length, lines[1].length + lines[2].length, ""); }); - it('Case VI: insert multiple line breaks', () => { + it('Insert multiple line breaks', () => { testEdit(21, 1, "cr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr"); }); - it('Case VIb: insert multiple line breaks', () => { + it('Insert multiple line breaks', () => { testEdit(21, 1, "cr...\r\ncr...\r\ncr"); }); - it('Case VIc: insert multiple line breaks with leading \\n', () => { + it('Insert multiple line breaks with leading \\n', () => { testEdit(21, 1, "\ncr...\r\ncr...\r\ncr"); }); - it('Case I: single line no line breaks deleted or inserted, delete 1 char', () => { + it('Single line no line breaks deleted or inserted, delete 1 char', () => { testEdit(21, 1, ""); }); - it('Case Ib: single line no line breaks deleted or inserted, insert 1 char', () => { + it('Single line no line breaks deleted or inserted, insert 1 char', () => { testEdit(21, 0, "b"); }); - it('Case Ib: single line no line breaks deleted or inserted, delete 1, insert 2 chars', () => { + it('Single line no line breaks deleted or inserted, delete 1, insert 2 chars', () => { testEdit(21, 1, "cr"); }); - it('Case II: delete across line break (just the line break)', () => { + it('Delete across line break (just the line break)', () => { testEdit(21, 22, ""); }); - it('Case IIb: delete across line break', () => { + it('Delete across line break', () => { testEdit(21, 32, ""); }); - it('Case III: delete across multiple line breaks and insert no line breaks', () => { + it('Delete across multiple line breaks and insert no line breaks', () => { testEdit(21, 42, ""); }); - it('Case IIIb: delete across multiple line breaks and insert text', () => { + it('Delete across multiple line breaks and insert text', () => { testEdit(21, 42, "slithery "); }); }); @@ -365,7 +365,6 @@ and grew 1cm per day`; } //function edTest() { - // editTest(); // tstTest(); // bigTest(); //} From f7aaf096038a291c9ddfe718e78489de67976f3f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 13:23:46 -0700 Subject: [PATCH 30/61] Add support for parsing and emitting class expressions. --- src/compiler/binder.ts | 11 +- src/compiler/checker.ts | 23 +- .../diagnosticInformationMap.generated.ts | 2 + src/compiler/diagnosticMessages.json | 8 + src/compiler/emitter.ts | 185 +- src/compiler/parser.ts | 68 +- src/compiler/types.ts | 9 +- src/compiler/utilities.ts | 6 +- .../baselines/reference/APISample_compile.js | 115 +- .../reference/APISample_compile.types | 126 +- tests/baselines/reference/APISample_linter.js | 131 +- .../reference/APISample_linter.types | 126 +- .../reference/APISample_linter.types.pull | 6384 ----------------- .../reference/APISample_transform.js | 115 +- .../reference/APISample_transform.types | 126 +- .../baselines/reference/APISample_watcher.js | 115 +- .../reference/APISample_watcher.types | 126 +- .../reference/classExpression.errors.txt | 30 +- tests/baselines/reference/classExpression.js | 13 +- .../reference/classExpression1.errors.txt | 7 + tests/baselines/reference/classExpression1.js | 9 + .../reference/classExpression2.errors.txt | 8 + tests/baselines/reference/classExpression2.js | 17 + .../reference/classExpressionES61.errors.txt | 7 + .../reference/classExpressionES61.js | 7 + .../reference/classExpressionES62.errors.txt | 8 + .../reference/classExpressionES62.js | 10 + .../reference/classInsideBlock.errors.txt | 9 + tests/baselines/reference/classInsideBlock.js | 13 + .../exportAssignNonIdentifier.errors.txt | 6 +- .../reference/exportAssignNonIdentifier.js | 3 +- .../reference/externModule.errors.txt | 11 +- tests/baselines/reference/externModule.js | 15 +- .../nestedClassDeclaration.errors.txt | 8 +- .../reference/nestedClassDeclaration.js | 13 +- ...rErrorRecovery_SwitchStatement2.errors.txt | 7 +- .../parserErrorRecovery_SwitchStatement2.js | 10 +- ...dentifiersInVariableStatements1.errors.txt | 5 +- ...InvalidIdentifiersInVariableStatements1.js | 6 + .../reference/withStatementErrors.errors.txt | 6 +- .../reference/withStatementErrors.js | 14 +- .../classDeclarations/classInsideBlock.ts | 3 + .../classExpressions/classExpression1.ts | 1 + .../classExpressions/classExpression2.ts | 2 + .../classExpressions/classExpressionES61.ts | 2 + .../classExpressions/classExpressionES62.ts | 3 + .../fourslash/getOccurrencesReturnBroken.ts | 4 +- .../fourslash/identifierErrorRecovery.ts | 2 +- 48 files changed, 906 insertions(+), 7029 deletions(-) delete mode 100644 tests/baselines/reference/APISample_linter.types.pull create mode 100644 tests/baselines/reference/classExpression1.errors.txt create mode 100644 tests/baselines/reference/classExpression1.js create mode 100644 tests/baselines/reference/classExpression2.errors.txt create mode 100644 tests/baselines/reference/classExpression2.js create mode 100644 tests/baselines/reference/classExpressionES61.errors.txt create mode 100644 tests/baselines/reference/classExpressionES61.js create mode 100644 tests/baselines/reference/classExpressionES62.errors.txt create mode 100644 tests/baselines/reference/classExpressionES62.js create mode 100644 tests/baselines/reference/classInsideBlock.errors.txt create mode 100644 tests/baselines/reference/classInsideBlock.js create mode 100644 tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts create mode 100644 tests/cases/conformance/classes/classExpressions/classExpression1.ts create mode 100644 tests/cases/conformance/classes/classExpressions/classExpression2.ts create mode 100644 tests/cases/conformance/es6/classExpressions/classExpressionES61.ts create mode 100644 tests/cases/conformance/es6/classExpressions/classExpressionES62.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 304777e0401..d3dafb61e76 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -126,6 +126,7 @@ module ts { return (node).isExportEquals ? "export=" : "default"; case SyntaxKind.FunctionDeclaration: case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: return node.flags & NodeFlags.Default ? "default" : undefined; } } @@ -168,7 +169,7 @@ module ts { addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === SyntaxKind.ClassDeclaration && symbol.exports) { + if ((node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression) && symbol.exports) { // TypeScript 1.0 spec (April 2014): 8.4 // Every class automatically contains a static property member named 'prototype', // the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter. @@ -286,6 +287,7 @@ module ts { case SyntaxKind.ArrowFunction: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; + case SyntaxKind.ClassExpression: case SyntaxKind.ClassDeclaration: if (node.flags & NodeFlags.Static) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); @@ -485,6 +487,9 @@ module ts { case SyntaxKind.ArrowFunction: bindAnonymousDeclaration(node, SymbolFlags.Function, "__function", /*isBlockScopeContainer*/ true); break; + case SyntaxKind.ClassExpression: + bindAnonymousDeclaration(node, SymbolFlags.Class, "__class", /*isBlockScopeContainer*/ false); + break; case SyntaxKind.CatchClause: bindCatchVariableDeclaration(node); break; @@ -584,9 +589,9 @@ module ts { // containing class. if (node.flags & NodeFlags.AccessibilityModifier && node.parent.kind === SyntaxKind.Constructor && - node.parent.parent.kind === SyntaxKind.ClassDeclaration) { + (node.parent.parent.kind === SyntaxKind.ClassDeclaration || node.parent.parent.kind === SyntaxKind.ClassExpression)) { - let classDeclaration = node.parent.parent; + let classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes); } } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e6594ee271c..02dfc70c6d3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -422,8 +422,15 @@ module ts { result = argumentsSymbol; break loop; } - let id = (location).name; - if (id && name === id.text) { + let functionName = (location).name; + if (functionName && name === functionName.text) { + result = location.symbol; + break loop; + } + break; + case SyntaxKind.ClassExpression: + let className = (location).name; + if (className && name === className.text) { result = location.symbol; break loop; } @@ -7991,6 +7998,8 @@ module ts { return checkTypeAssertion(node); case SyntaxKind.ParenthesizedExpression: return checkExpression((node).expression, contextualMapper); + case SyntaxKind.ClassExpression: + return checkClassExpression(node); case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -9732,8 +9741,18 @@ module ts { } } + function checkClassExpression(node: ClassExpression): Type { + grammarErrorOnNode(node, Diagnostics.class_expressions_are_not_currently_supported); + forEach(node.members, checkSourceElement); + return unknownType; + } + function checkClassDeclaration(node: ClassDeclaration) { // Grammar checking + if (node.parent.kind !== SyntaxKind.ModuleBlock && node.parent.kind !== SyntaxKind.SourceFile) { + grammarErrorOnNode(node, Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + } + checkGrammarClassDeclarationHeritageClauses(node); checkDecorators(node); if (node.name) { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 22e3a81ff38..0686a18c76b 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -501,5 +501,7 @@ module ts { yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, Only_type_references_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only type references are currently supported in a class 'extends' clauses." }, + class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." }, + class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 347ae084607..4c98702a94f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1997,5 +1997,13 @@ "Only type references are currently supported in a class 'extends' clauses.": { "category": "Error", "code": 9002 + }, + "'class' expressions are not currently supported.": { + "category": "Error", + "code": 9003 + }, + "'class' declarations are only supported directly inside a module or as a top level declaration.": { + "category": "Error", + "code": 9004 } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 09e721c9cfb..60a09fb20ef 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3193,7 +3193,7 @@ module ts { } } - function emitMemberAssignments(node: ClassDeclaration, staticFlag: NodeFlags) { + function emitMemberAssignments(node: ClassLikeDeclaration, staticFlag: NodeFlags) { forEach(node.members, member => { if (member.kind === SyntaxKind.PropertyDeclaration && (member.flags & NodeFlags.Static) === staticFlag && (member).initializer) { writeLine(); @@ -3217,7 +3217,7 @@ module ts { }); } - function emitMemberFunctionsForES5AndLower(node: ClassDeclaration) { + function emitMemberFunctionsForES5AndLower(node: ClassLikeDeclaration) { forEach(node.members, member => { if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) { if (!(member).body) { @@ -3287,7 +3287,7 @@ module ts { }); } - function emitMemberFunctionsForES6AndHigher(node: ClassDeclaration) { + function emitMemberFunctionsForES6AndHigher(node: ClassLikeDeclaration) { for (let member of node.members) { if ((member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) && !(member).body) { emitOnlyPinnedOrTripleSlashComments(member); @@ -3314,7 +3314,7 @@ module ts { } } - function emitConstructor(node: ClassDeclaration, baseTypeElement: HeritageClauseElement) { + function emitConstructor(node: ClassLikeDeclaration, baseTypeElement: HeritageClauseElement) { let saveTempFlags = tempFlags; let saveTempVariables = tempVariables; let saveTempParameters = tempParameters; @@ -3435,82 +3435,92 @@ module ts { tempParameters = saveTempParameters; } + function emitClassExpression(node: ClassExpression) { + return emitClassLikeDeclaration(node); + } + function emitClassDeclaration(node: ClassDeclaration) { + return emitClassLikeDeclaration(node); + } + + function emitClassLikeDeclaration(node: ClassLikeDeclaration) { if (languageVersion < ScriptTarget.ES6) { - emitClassDeclarationBelowES6(node); + emitClassLikeDeclarationBelowES6(node); } else { - emitClassDeclarationForES6AndHigher(node); + emitClassLikeDeclarationForES6AndHigher(node); } } - function emitClassDeclarationForES6AndHigher(node: ClassDeclaration) { + function emitClassLikeDeclarationForES6AndHigher(node: ClassLikeDeclaration) { let thisNodeIsDecorated = nodeIsDecorated(node); - if (thisNodeIsDecorated) { - // To preserve the correct runtime semantics when decorators are applied to the class, - // the emit needs to follow one of the following rules: - // - // * For a local class declaration: - // - // @dec class C { - // } - // - // The emit should be: - // - // let C = class { - // }; - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // C = __decorate([dec], C); - // - // * For an exported class declaration: - // - // @dec export class C { - // } - // - // The emit should be: - // - // export let C = class { - // }; - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // C = __decorate([dec], C); - // - // * For a default export of a class declaration with a name: - // - // @dec default export class C { - // } - // - // The emit should be: - // - // let C = class { - // } - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // C = __decorate([dec], C); - // export default C; - // - // * For a default export of a class declaration without a name: - // - // @dec default export class { - // } - // - // The emit should be: - // - // let _default = class { - // } - // _default = __decorate([dec], _default); - // export default _default; - // - if (isES6ExportedDeclaration(node) && !(node.flags & NodeFlags.Default)) { - write("export "); - } + if (node.kind === SyntaxKind.ClassDeclaration) { + if (thisNodeIsDecorated) { + // To preserve the correct runtime semantics when decorators are applied to the class, + // the emit needs to follow one of the following rules: + // + // * For a local class declaration: + // + // @dec class C { + // } + // + // The emit should be: + // + // let C = class { + // }; + // Object.defineProperty(C, "name", { value: "C", configurable: true }); + // C = __decorate([dec], C); + // + // * For an exported class declaration: + // + // @dec export class C { + // } + // + // The emit should be: + // + // export let C = class { + // }; + // Object.defineProperty(C, "name", { value: "C", configurable: true }); + // C = __decorate([dec], C); + // + // * For a default export of a class declaration with a name: + // + // @dec default export class C { + // } + // + // The emit should be: + // + // let C = class { + // } + // Object.defineProperty(C, "name", { value: "C", configurable: true }); + // C = __decorate([dec], C); + // export default C; + // + // * For a default export of a class declaration without a name: + // + // @dec default export class { + // } + // + // The emit should be: + // + // let _default = class { + // } + // _default = __decorate([dec], _default); + // export default _default; + // + if (isES6ExportedDeclaration(node) && !(node.flags & NodeFlags.Default)) { + write("export "); + } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & NodeFlags.Default) { - write("default "); + write("let "); + emitDeclarationName(node); + write(" = "); + } + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & NodeFlags.Default) { + write("default "); + } } } @@ -3588,10 +3598,14 @@ module ts { } } - function emitClassDeclarationBelowES6(node: ClassDeclaration) { - write("var "); - emitDeclarationName(node); - write(" = (function ("); + function emitClassLikeDeclarationBelowES6(node: ClassLikeDeclaration) { + if (node.kind === SyntaxKind.ClassDeclaration) { + write("var "); + emitDeclarationName(node); + write(" = "); + } + + write("(function ("); let baseTypeNode = getClassBaseTypeNode(node); if (baseTypeNode) { write("_super"); @@ -3641,30 +3655,35 @@ module ts { if (baseTypeNode) { emit(baseTypeNode.expression); } - write(");"); + write(")"); + if (node.kind === SyntaxKind.ClassDeclaration) { + write(";"); + } emitEnd(node); - emitExportMemberAssignment(node); + if (node.kind === SyntaxKind.ClassDeclaration) { + emitExportMemberAssignment(node); + } if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } } - function emitClassMemberPrefix(node: ClassDeclaration, member: Node) { + function emitClassMemberPrefix(node: ClassLikeDeclaration, member: Node) { emitDeclarationName(node); if (!(member.flags & NodeFlags.Static)) { write(".prototype"); } } - function emitDecoratorsOfClass(node: ClassDeclaration) { + function emitDecoratorsOfClass(node: ClassLikeDeclaration) { emitDecoratorsOfMembers(node, /*staticFlag*/ 0); emitDecoratorsOfMembers(node, NodeFlags.Static); emitDecoratorsOfConstructor(node); } - function emitDecoratorsOfConstructor(node: ClassDeclaration) { + function emitDecoratorsOfConstructor(node: ClassLikeDeclaration) { let constructor = getFirstConstructorWithBody(node); if (constructor) { emitDecoratorsOfParameters(node, constructor); @@ -3696,7 +3715,7 @@ module ts { writeLine(); } - function emitDecoratorsOfMembers(node: ClassDeclaration, staticFlag: NodeFlags) { + function emitDecoratorsOfMembers(node: ClassLikeDeclaration, staticFlag: NodeFlags) { forEach(node.members, member => { if ((member.flags & NodeFlags.Static) !== staticFlag) { return; @@ -3800,7 +3819,7 @@ module ts { }); } - function emitDecoratorsOfParameters(node: ClassDeclaration, member: FunctionLikeDeclaration) { + function emitDecoratorsOfParameters(node: ClassLikeDeclaration, member: FunctionLikeDeclaration) { forEach(member.parameters, (parameter, parameterIndex) => { if (!nodeIsDecorated(parameter)) { return; @@ -4768,6 +4787,8 @@ var __decorate = this.__decorate || function (decorators, target, key, value) { return emitDebuggerStatement(node); case SyntaxKind.VariableDeclaration: return emitVariableDeclaration(node); + case SyntaxKind.ClassExpression: + return emitClassExpression(node); case SyntaxKind.ClassDeclaration: return emitClassDeclaration(node); case SyntaxKind.InterfaceDeclaration: diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 49bd301dc7e..f728536e72a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -237,12 +237,13 @@ module ts { case SyntaxKind.Decorator: return visitNode(cbNode, (node).expression); case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, (node).name) || - visitNodes(cbNodes, (node).typeParameters) || - visitNodes(cbNodes, (node).heritageClauses) || - visitNodes(cbNodes, (node).members); + visitNode(cbNode, (node).name) || + visitNodes(cbNodes, (node).typeParameters) || + visitNodes(cbNodes, (node).heritageClauses) || + visitNodes(cbNodes, (node).members); case SyntaxKind.InterfaceDeclaration: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -2899,6 +2900,7 @@ module ts { case SyntaxKind.OpenBracketToken: case SyntaxKind.OpenBraceToken: case SyntaxKind.FunctionKeyword: + case SyntaxKind.ClassKeyword: case SyntaxKind.NewKeyword: case SyntaxKind.SlashToken: case SyntaxKind.SlashEqualsToken: @@ -2944,8 +2946,12 @@ module ts { } function isStartOfExpressionStatement(): boolean { - // As per the grammar, neither '{' nor 'function' can start an expression statement. - return token !== SyntaxKind.OpenBraceToken && token !== SyntaxKind.FunctionKeyword && token !== SyntaxKind.AtToken && isStartOfExpression(); + // As per the grammar, none of '{' or 'function' or 'class' can start an expression statement. + return token !== SyntaxKind.OpenBraceToken && + token !== SyntaxKind.FunctionKeyword && + token !== SyntaxKind.ClassKeyword && + token !== SyntaxKind.AtToken && + isStartOfExpression(); } function parseExpression(): Expression { @@ -3290,8 +3296,12 @@ module ts { return parseFunctionBlock(/*allowYield:*/ false, /* ignoreMissingOpenBrace */ false); } - if (isStartOfStatement(/*inErrorRecovery:*/ true) && !isStartOfExpressionStatement() && token !== SyntaxKind.FunctionKeyword) { - // Check if we got a plain statement (i.e. no expression-statements, no functions expressions/declarations) + if (isStartOfStatement(/*inErrorRecovery:*/ true) && + !isStartOfExpressionStatement() && + token !== SyntaxKind.FunctionKeyword && + token !== SyntaxKind.ClassKeyword) { + + // Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations) // // Here we try to recover from a potential error situation in the case where the // user meant to supply a block. For example, if the user wrote: @@ -3763,6 +3773,8 @@ module ts { return parseArrayLiteralExpression(); case SyntaxKind.OpenBraceToken: return parseObjectLiteralExpression(); + case SyntaxKind.ClassKeyword: + return parseClassExpression(); case SyntaxKind.FunctionKeyword: return parseFunctionExpression(); case SyntaxKind.NewKeyword: @@ -4183,13 +4195,14 @@ module ts { } function isStartOfStatement(inErrorRecovery: boolean): boolean { - // Functions and variable statements are allowed as a statement. But as per the grammar, - // they also allow modifiers. So we have to check for those statements that might be - // following modifiers.This ensures that things work properly when incrementally parsing - // as the parser will produce the same FunctionDeclaraiton or VariableStatement if it has - // the same text regardless of whether it is inside a block or not. + // Functions, variable statements and classes are allowed as a statement. But as per + // the grammar, they also allow modifiers. So we have to check for those statements + // that might be following modifiers.This ensures that things work properly when + // incrementally parsing as the parser will produce the same FunctionDeclaraiton, + // VariableStatement or ClassDeclaration, if it has the same text regardless of whether + // it is inside a block or not. if (isModifier(token)) { - let result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + let result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return true; } @@ -4208,6 +4221,7 @@ module ts { case SyntaxKind.VarKeyword: case SyntaxKind.LetKeyword: case SyntaxKind.FunctionKeyword: + case SyntaxKind.ClassKeyword: case SyntaxKind.IfKeyword: case SyntaxKind.DoKeyword: case SyntaxKind.WhileKeyword: @@ -4232,7 +4246,6 @@ module ts { let isConstEnum = lookAhead(nextTokenIsEnumKeyword); return !isConstEnum; case SyntaxKind.InterfaceKeyword: - case SyntaxKind.ClassKeyword: case SyntaxKind.ModuleKeyword: case SyntaxKind.EnumKeyword: case SyntaxKind.TypeKeyword: @@ -4276,6 +4289,8 @@ module ts { return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined); case SyntaxKind.FunctionKeyword: return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined); + case SyntaxKind.ClassKeyword: + return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined); case SyntaxKind.SemicolonToken: return parseEmptyStatement(); case SyntaxKind.IfKeyword: @@ -4321,7 +4336,7 @@ module ts { // Even though variable statements and function declarations cannot have decorators, // we parse them here to provide better error recovery. if (isModifier(token) || token === SyntaxKind.AtToken) { - let result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + let result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return result; } @@ -4331,7 +4346,7 @@ module ts { } } - function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers(): FunctionDeclaration | VariableStatement { + function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers(): FunctionDeclaration | VariableStatement | ClassDeclaration { let start = scanner.getStartPos(); let decorators = parseDecorators(); let modifiers = parseModifiers(); @@ -4351,8 +4366,12 @@ module ts { case SyntaxKind.VarKeyword: return parseVariableStatement(start, decorators, modifiers); + case SyntaxKind.FunctionKeyword: return parseFunctionDeclaration(start, decorators, modifiers); + + case SyntaxKind.ClassKeyword: + return parseClassDeclaration(start, decorators, modifiers); } return undefined; @@ -4711,14 +4730,26 @@ module ts { Debug.fail("Should not have attempted to parse class member declaration."); } + function parseClassExpression(): ClassExpression { + return parseClassDeclarationOrExpression( + /*fullStart:*/ scanner.getStartPos(), + /*decorators:*/ undefined, + /*modifiers:*/ undefined, + SyntaxKind.ClassExpression); + } + function parseClassDeclaration(fullStart: number, decorators: NodeArray, modifiers: ModifiersArray): ClassDeclaration { + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, SyntaxKind.ClassDeclaration); + } + + function parseClassDeclarationOrExpression(fullStart: number, decorators: NodeArray, modifiers: ModifiersArray, kind: SyntaxKind): ClassLikeDeclaration { // In ES6 specification, All parts of a ClassDeclaration or a ClassExpression are strict mode code let savedStrictModeContext = inStrictModeContext(); if (languageVersion >= ScriptTarget.ES6) { setStrictModeContext(true); } - var node = createNode(SyntaxKind.ClassDeclaration, fullStart); + var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(SyntaxKind.ClassKeyword); @@ -5327,6 +5358,7 @@ module ts { case SyntaxKind.ArrayLiteralExpression: case SyntaxKind.ParenthesizedExpression: case SyntaxKind.ObjectLiteralExpression: + case SyntaxKind.ClassExpression: case SyntaxKind.FunctionExpression: case SyntaxKind.Identifier: case SyntaxKind.RegularExpressionLiteral: diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a9a04c3bd3a..08c8985b144 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -203,6 +203,7 @@ module ts { TemplateExpression, YieldExpression, SpreadElementExpression, + ClassExpression, OmittedExpression, // Misc TemplateSpan, @@ -855,13 +856,19 @@ module ts { _moduleElementBrand: any; } - export interface ClassDeclaration extends Declaration, ModuleElement { + export interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } + export interface ClassDeclaration extends ClassLikeDeclaration, Statement { + } + + export interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + } + export interface ClassElement extends Declaration { _classElementBrand: any; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 761e1cdb4de..e8d4ca66e00 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -279,6 +279,7 @@ module ts { case SyntaxKind.VariableDeclaration: case SyntaxKind.BindingElement: case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.ModuleDeclaration: case SyntaxKind.EnumDeclaration: @@ -670,6 +671,7 @@ module ts { case SyntaxKind.TypeAssertionExpression: case SyntaxKind.ParenthesizedExpression: case SyntaxKind.FunctionExpression: + case SyntaxKind.ClassExpression: case SyntaxKind.ArrowFunction: case SyntaxKind.VoidExpression: case SyntaxKind.DeleteExpression: @@ -942,7 +944,7 @@ module ts { node.kind === SyntaxKind.ExportAssignment && (node).expression.kind === SyntaxKind.Identifier; } - export function getClassBaseTypeNode(node: ClassDeclaration) { + export function getClassBaseTypeNode(node: ClassLikeDeclaration) { let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } @@ -1573,7 +1575,7 @@ module ts { return getLineAndCharacterOfPosition(currentSourceFile, pos).line; } - export function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration { + export function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration { return forEach(node.members, member => { if (member.kind === SyntaxKind.Constructor && nodeIsPresent((member).body)) { return member; diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 92711f4b753..9bbd1bb1af4 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -233,60 +233,61 @@ declare module "typescript" { TemplateExpression = 171, YieldExpression = 172, SpreadElementExpression = 173, - OmittedExpression = 174, - TemplateSpan = 175, - HeritageClauseElement = 176, - Block = 177, - VariableStatement = 178, - EmptyStatement = 179, - ExpressionStatement = 180, - IfStatement = 181, - DoStatement = 182, - WhileStatement = 183, - ForStatement = 184, - ForInStatement = 185, - ForOfStatement = 186, - ContinueStatement = 187, - BreakStatement = 188, - ReturnStatement = 189, - WithStatement = 190, - SwitchStatement = 191, - LabeledStatement = 192, - ThrowStatement = 193, - TryStatement = 194, - DebuggerStatement = 195, - VariableDeclaration = 196, - VariableDeclarationList = 197, - FunctionDeclaration = 198, - ClassDeclaration = 199, - InterfaceDeclaration = 200, - TypeAliasDeclaration = 201, - EnumDeclaration = 202, - ModuleDeclaration = 203, - ModuleBlock = 204, - CaseBlock = 205, - ImportEqualsDeclaration = 206, - ImportDeclaration = 207, - ImportClause = 208, - NamespaceImport = 209, - NamedImports = 210, - ImportSpecifier = 211, - ExportAssignment = 212, - ExportDeclaration = 213, - NamedExports = 214, - ExportSpecifier = 215, - MissingDeclaration = 216, - ExternalModuleReference = 217, - CaseClause = 218, - DefaultClause = 219, - HeritageClause = 220, - CatchClause = 221, - PropertyAssignment = 222, - ShorthandPropertyAssignment = 223, - EnumMember = 224, - SourceFile = 225, - SyntaxList = 226, - Count = 227, + ClassExpression = 174, + OmittedExpression = 175, + TemplateSpan = 176, + HeritageClauseElement = 177, + Block = 178, + VariableStatement = 179, + EmptyStatement = 180, + ExpressionStatement = 181, + IfStatement = 182, + DoStatement = 183, + WhileStatement = 184, + ForStatement = 185, + ForInStatement = 186, + ForOfStatement = 187, + ContinueStatement = 188, + BreakStatement = 189, + ReturnStatement = 190, + WithStatement = 191, + SwitchStatement = 192, + LabeledStatement = 193, + ThrowStatement = 194, + TryStatement = 195, + DebuggerStatement = 196, + VariableDeclaration = 197, + VariableDeclarationList = 198, + FunctionDeclaration = 199, + ClassDeclaration = 200, + InterfaceDeclaration = 201, + TypeAliasDeclaration = 202, + EnumDeclaration = 203, + ModuleDeclaration = 204, + ModuleBlock = 205, + CaseBlock = 206, + ImportEqualsDeclaration = 207, + ImportDeclaration = 208, + ImportClause = 209, + NamespaceImport = 210, + NamedImports = 211, + ImportSpecifier = 212, + ExportAssignment = 213, + ExportDeclaration = 214, + NamedExports = 215, + ExportSpecifier = 216, + MissingDeclaration = 217, + ExternalModuleReference = 218, + CaseClause = 219, + DefaultClause = 220, + HeritageClause = 221, + CatchClause = 222, + PropertyAssignment = 223, + ShorthandPropertyAssignment = 224, + EnumMember = 225, + SourceFile = 226, + SyntaxList = 227, + Count = 228, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -706,12 +707,16 @@ declare module "typescript" { interface ModuleElement extends Node { _moduleElementBrand: any; } - interface ClassDeclaration extends Declaration, ModuleElement { + interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + } interface ClassElement extends Declaration { _classElementBrand: any; } diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 31322f07ea1..ca965a9161d 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -717,166 +717,169 @@ declare module "typescript" { SpreadElementExpression = 173, >SpreadElementExpression : SyntaxKind - OmittedExpression = 174, + ClassExpression = 174, +>ClassExpression : SyntaxKind + + OmittedExpression = 175, >OmittedExpression : SyntaxKind - TemplateSpan = 175, + TemplateSpan = 176, >TemplateSpan : SyntaxKind - HeritageClauseElement = 176, + HeritageClauseElement = 177, >HeritageClauseElement : SyntaxKind - Block = 177, + Block = 178, >Block : SyntaxKind - VariableStatement = 178, + VariableStatement = 179, >VariableStatement : SyntaxKind - EmptyStatement = 179, + EmptyStatement = 180, >EmptyStatement : SyntaxKind - ExpressionStatement = 180, + ExpressionStatement = 181, >ExpressionStatement : SyntaxKind - IfStatement = 181, + IfStatement = 182, >IfStatement : SyntaxKind - DoStatement = 182, + DoStatement = 183, >DoStatement : SyntaxKind - WhileStatement = 183, + WhileStatement = 184, >WhileStatement : SyntaxKind - ForStatement = 184, + ForStatement = 185, >ForStatement : SyntaxKind - ForInStatement = 185, + ForInStatement = 186, >ForInStatement : SyntaxKind - ForOfStatement = 186, + ForOfStatement = 187, >ForOfStatement : SyntaxKind - ContinueStatement = 187, + ContinueStatement = 188, >ContinueStatement : SyntaxKind - BreakStatement = 188, + BreakStatement = 189, >BreakStatement : SyntaxKind - ReturnStatement = 189, + ReturnStatement = 190, >ReturnStatement : SyntaxKind - WithStatement = 190, + WithStatement = 191, >WithStatement : SyntaxKind - SwitchStatement = 191, + SwitchStatement = 192, >SwitchStatement : SyntaxKind - LabeledStatement = 192, + LabeledStatement = 193, >LabeledStatement : SyntaxKind - ThrowStatement = 193, + ThrowStatement = 194, >ThrowStatement : SyntaxKind - TryStatement = 194, + TryStatement = 195, >TryStatement : SyntaxKind - DebuggerStatement = 195, + DebuggerStatement = 196, >DebuggerStatement : SyntaxKind - VariableDeclaration = 196, + VariableDeclaration = 197, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 197, + VariableDeclarationList = 198, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 198, + FunctionDeclaration = 199, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 199, + ClassDeclaration = 200, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 200, + InterfaceDeclaration = 201, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 201, + TypeAliasDeclaration = 202, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 202, + EnumDeclaration = 203, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 203, + ModuleDeclaration = 204, >ModuleDeclaration : SyntaxKind - ModuleBlock = 204, + ModuleBlock = 205, >ModuleBlock : SyntaxKind - CaseBlock = 205, + CaseBlock = 206, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 206, + ImportEqualsDeclaration = 207, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 207, + ImportDeclaration = 208, >ImportDeclaration : SyntaxKind - ImportClause = 208, + ImportClause = 209, >ImportClause : SyntaxKind - NamespaceImport = 209, + NamespaceImport = 210, >NamespaceImport : SyntaxKind - NamedImports = 210, + NamedImports = 211, >NamedImports : SyntaxKind - ImportSpecifier = 211, + ImportSpecifier = 212, >ImportSpecifier : SyntaxKind - ExportAssignment = 212, + ExportAssignment = 213, >ExportAssignment : SyntaxKind - ExportDeclaration = 213, + ExportDeclaration = 214, >ExportDeclaration : SyntaxKind - NamedExports = 214, + NamedExports = 215, >NamedExports : SyntaxKind - ExportSpecifier = 215, + ExportSpecifier = 216, >ExportSpecifier : SyntaxKind - MissingDeclaration = 216, + MissingDeclaration = 217, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 217, + ExternalModuleReference = 218, >ExternalModuleReference : SyntaxKind - CaseClause = 218, + CaseClause = 219, >CaseClause : SyntaxKind - DefaultClause = 219, + DefaultClause = 220, >DefaultClause : SyntaxKind - HeritageClause = 220, + HeritageClause = 221, >HeritageClause : SyntaxKind - CatchClause = 221, + CatchClause = 222, >CatchClause : SyntaxKind - PropertyAssignment = 222, + PropertyAssignment = 223, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 223, + ShorthandPropertyAssignment = 224, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 224, + EnumMember = 225, >EnumMember : SyntaxKind - SourceFile = 225, + SourceFile = 226, >SourceFile : SyntaxKind - SyntaxList = 226, + SyntaxList = 227, >SyntaxList : SyntaxKind - Count = 227, + Count = 228, >Count : SyntaxKind FirstAssignment = 53, @@ -2131,10 +2134,9 @@ declare module "typescript" { _moduleElementBrand: any; >_moduleElementBrand : any } - interface ClassDeclaration extends Declaration, ModuleElement { ->ClassDeclaration : ClassDeclaration + interface ClassLikeDeclaration extends Declaration { +>ClassLikeDeclaration : ClassLikeDeclaration >Declaration : Declaration ->ModuleElement : ModuleElement name?: Identifier; >name : Identifier @@ -2154,6 +2156,16 @@ declare module "typescript" { >members : NodeArray >NodeArray : NodeArray >ClassElement : ClassElement + } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { +>ClassDeclaration : ClassDeclaration +>ClassLikeDeclaration : ClassLikeDeclaration +>Statement : Statement + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { +>ClassExpression : ClassExpression +>ClassLikeDeclaration : ClassLikeDeclaration +>PrimaryExpression : PrimaryExpression } interface ClassElement extends Declaration { >ClassElement : ClassElement diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index dc96584dc55..d7d3ece0c86 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -264,60 +264,61 @@ declare module "typescript" { TemplateExpression = 171, YieldExpression = 172, SpreadElementExpression = 173, - OmittedExpression = 174, - TemplateSpan = 175, - HeritageClauseElement = 176, - Block = 177, - VariableStatement = 178, - EmptyStatement = 179, - ExpressionStatement = 180, - IfStatement = 181, - DoStatement = 182, - WhileStatement = 183, - ForStatement = 184, - ForInStatement = 185, - ForOfStatement = 186, - ContinueStatement = 187, - BreakStatement = 188, - ReturnStatement = 189, - WithStatement = 190, - SwitchStatement = 191, - LabeledStatement = 192, - ThrowStatement = 193, - TryStatement = 194, - DebuggerStatement = 195, - VariableDeclaration = 196, - VariableDeclarationList = 197, - FunctionDeclaration = 198, - ClassDeclaration = 199, - InterfaceDeclaration = 200, - TypeAliasDeclaration = 201, - EnumDeclaration = 202, - ModuleDeclaration = 203, - ModuleBlock = 204, - CaseBlock = 205, - ImportEqualsDeclaration = 206, - ImportDeclaration = 207, - ImportClause = 208, - NamespaceImport = 209, - NamedImports = 210, - ImportSpecifier = 211, - ExportAssignment = 212, - ExportDeclaration = 213, - NamedExports = 214, - ExportSpecifier = 215, - MissingDeclaration = 216, - ExternalModuleReference = 217, - CaseClause = 218, - DefaultClause = 219, - HeritageClause = 220, - CatchClause = 221, - PropertyAssignment = 222, - ShorthandPropertyAssignment = 223, - EnumMember = 224, - SourceFile = 225, - SyntaxList = 226, - Count = 227, + ClassExpression = 174, + OmittedExpression = 175, + TemplateSpan = 176, + HeritageClauseElement = 177, + Block = 178, + VariableStatement = 179, + EmptyStatement = 180, + ExpressionStatement = 181, + IfStatement = 182, + DoStatement = 183, + WhileStatement = 184, + ForStatement = 185, + ForInStatement = 186, + ForOfStatement = 187, + ContinueStatement = 188, + BreakStatement = 189, + ReturnStatement = 190, + WithStatement = 191, + SwitchStatement = 192, + LabeledStatement = 193, + ThrowStatement = 194, + TryStatement = 195, + DebuggerStatement = 196, + VariableDeclaration = 197, + VariableDeclarationList = 198, + FunctionDeclaration = 199, + ClassDeclaration = 200, + InterfaceDeclaration = 201, + TypeAliasDeclaration = 202, + EnumDeclaration = 203, + ModuleDeclaration = 204, + ModuleBlock = 205, + CaseBlock = 206, + ImportEqualsDeclaration = 207, + ImportDeclaration = 208, + ImportClause = 209, + NamespaceImport = 210, + NamedImports = 211, + ImportSpecifier = 212, + ExportAssignment = 213, + ExportDeclaration = 214, + NamedExports = 215, + ExportSpecifier = 216, + MissingDeclaration = 217, + ExternalModuleReference = 218, + CaseClause = 219, + DefaultClause = 220, + HeritageClause = 221, + CatchClause = 222, + PropertyAssignment = 223, + ShorthandPropertyAssignment = 224, + EnumMember = 225, + SourceFile = 226, + SyntaxList = 227, + Count = 228, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -737,12 +738,16 @@ declare module "typescript" { interface ModuleElement extends Node { _moduleElementBrand: any; } - interface ClassDeclaration extends Declaration, ModuleElement { + interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + } interface ClassElement extends Declaration { _classElementBrand: any; } @@ -2047,21 +2052,21 @@ function delint(sourceFile) { delintNode(sourceFile); function delintNode(node) { switch (node.kind) { - case 184 /* ForStatement */: - case 185 /* ForInStatement */: - case 183 /* WhileStatement */: - case 182 /* DoStatement */: - if (node.statement.kind !== 177 /* Block */) { + case 185 /* ForStatement */: + case 186 /* ForInStatement */: + case 184 /* WhileStatement */: + case 183 /* DoStatement */: + if (node.statement.kind !== 178 /* Block */) { report(node, "A looping statement's contents should be wrapped in a block body."); } break; - case 181 /* IfStatement */: + case 182 /* IfStatement */: var ifStatement = node; - if (ifStatement.thenStatement.kind !== 177 /* Block */) { + if (ifStatement.thenStatement.kind !== 178 /* Block */) { report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); } if (ifStatement.elseStatement && - ifStatement.elseStatement.kind !== 177 /* Block */ && ifStatement.elseStatement.kind !== 181 /* IfStatement */) { + ifStatement.elseStatement.kind !== 178 /* Block */ && ifStatement.elseStatement.kind !== 182 /* IfStatement */) { report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); } break; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 57473b8981d..e68910b26e6 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -863,166 +863,169 @@ declare module "typescript" { SpreadElementExpression = 173, >SpreadElementExpression : SyntaxKind - OmittedExpression = 174, + ClassExpression = 174, +>ClassExpression : SyntaxKind + + OmittedExpression = 175, >OmittedExpression : SyntaxKind - TemplateSpan = 175, + TemplateSpan = 176, >TemplateSpan : SyntaxKind - HeritageClauseElement = 176, + HeritageClauseElement = 177, >HeritageClauseElement : SyntaxKind - Block = 177, + Block = 178, >Block : SyntaxKind - VariableStatement = 178, + VariableStatement = 179, >VariableStatement : SyntaxKind - EmptyStatement = 179, + EmptyStatement = 180, >EmptyStatement : SyntaxKind - ExpressionStatement = 180, + ExpressionStatement = 181, >ExpressionStatement : SyntaxKind - IfStatement = 181, + IfStatement = 182, >IfStatement : SyntaxKind - DoStatement = 182, + DoStatement = 183, >DoStatement : SyntaxKind - WhileStatement = 183, + WhileStatement = 184, >WhileStatement : SyntaxKind - ForStatement = 184, + ForStatement = 185, >ForStatement : SyntaxKind - ForInStatement = 185, + ForInStatement = 186, >ForInStatement : SyntaxKind - ForOfStatement = 186, + ForOfStatement = 187, >ForOfStatement : SyntaxKind - ContinueStatement = 187, + ContinueStatement = 188, >ContinueStatement : SyntaxKind - BreakStatement = 188, + BreakStatement = 189, >BreakStatement : SyntaxKind - ReturnStatement = 189, + ReturnStatement = 190, >ReturnStatement : SyntaxKind - WithStatement = 190, + WithStatement = 191, >WithStatement : SyntaxKind - SwitchStatement = 191, + SwitchStatement = 192, >SwitchStatement : SyntaxKind - LabeledStatement = 192, + LabeledStatement = 193, >LabeledStatement : SyntaxKind - ThrowStatement = 193, + ThrowStatement = 194, >ThrowStatement : SyntaxKind - TryStatement = 194, + TryStatement = 195, >TryStatement : SyntaxKind - DebuggerStatement = 195, + DebuggerStatement = 196, >DebuggerStatement : SyntaxKind - VariableDeclaration = 196, + VariableDeclaration = 197, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 197, + VariableDeclarationList = 198, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 198, + FunctionDeclaration = 199, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 199, + ClassDeclaration = 200, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 200, + InterfaceDeclaration = 201, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 201, + TypeAliasDeclaration = 202, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 202, + EnumDeclaration = 203, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 203, + ModuleDeclaration = 204, >ModuleDeclaration : SyntaxKind - ModuleBlock = 204, + ModuleBlock = 205, >ModuleBlock : SyntaxKind - CaseBlock = 205, + CaseBlock = 206, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 206, + ImportEqualsDeclaration = 207, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 207, + ImportDeclaration = 208, >ImportDeclaration : SyntaxKind - ImportClause = 208, + ImportClause = 209, >ImportClause : SyntaxKind - NamespaceImport = 209, + NamespaceImport = 210, >NamespaceImport : SyntaxKind - NamedImports = 210, + NamedImports = 211, >NamedImports : SyntaxKind - ImportSpecifier = 211, + ImportSpecifier = 212, >ImportSpecifier : SyntaxKind - ExportAssignment = 212, + ExportAssignment = 213, >ExportAssignment : SyntaxKind - ExportDeclaration = 213, + ExportDeclaration = 214, >ExportDeclaration : SyntaxKind - NamedExports = 214, + NamedExports = 215, >NamedExports : SyntaxKind - ExportSpecifier = 215, + ExportSpecifier = 216, >ExportSpecifier : SyntaxKind - MissingDeclaration = 216, + MissingDeclaration = 217, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 217, + ExternalModuleReference = 218, >ExternalModuleReference : SyntaxKind - CaseClause = 218, + CaseClause = 219, >CaseClause : SyntaxKind - DefaultClause = 219, + DefaultClause = 220, >DefaultClause : SyntaxKind - HeritageClause = 220, + HeritageClause = 221, >HeritageClause : SyntaxKind - CatchClause = 221, + CatchClause = 222, >CatchClause : SyntaxKind - PropertyAssignment = 222, + PropertyAssignment = 223, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 223, + ShorthandPropertyAssignment = 224, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 224, + EnumMember = 225, >EnumMember : SyntaxKind - SourceFile = 225, + SourceFile = 226, >SourceFile : SyntaxKind - SyntaxList = 226, + SyntaxList = 227, >SyntaxList : SyntaxKind - Count = 227, + Count = 228, >Count : SyntaxKind FirstAssignment = 53, @@ -2277,10 +2280,9 @@ declare module "typescript" { _moduleElementBrand: any; >_moduleElementBrand : any } - interface ClassDeclaration extends Declaration, ModuleElement { ->ClassDeclaration : ClassDeclaration + interface ClassLikeDeclaration extends Declaration { +>ClassLikeDeclaration : ClassLikeDeclaration >Declaration : Declaration ->ModuleElement : ModuleElement name?: Identifier; >name : Identifier @@ -2300,6 +2302,16 @@ declare module "typescript" { >members : NodeArray >NodeArray : NodeArray >ClassElement : ClassElement + } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { +>ClassDeclaration : ClassDeclaration +>ClassLikeDeclaration : ClassLikeDeclaration +>Statement : Statement + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { +>ClassExpression : ClassExpression +>ClassLikeDeclaration : ClassLikeDeclaration +>PrimaryExpression : PrimaryExpression } interface ClassElement extends Declaration { >ClassElement : ClassElement diff --git a/tests/baselines/reference/APISample_linter.types.pull b/tests/baselines/reference/APISample_linter.types.pull deleted file mode 100644 index 74632737ca9..00000000000 --- a/tests/baselines/reference/APISample_linter.types.pull +++ /dev/null @@ -1,6384 +0,0 @@ -=== tests/cases/compiler/APISample_linter.ts === - -/* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - -declare var process: any; ->process : any - -declare var console: any; ->console : any - -declare var fs: any; ->fs : any - -import ts = require("typescript"); ->ts : typeof ts - -export function delint(sourceFile: ts.SourceFile) { ->delint : (sourceFile: ts.SourceFile) => void ->sourceFile : ts.SourceFile ->ts : unknown ->SourceFile : ts.SourceFile - - delintNode(sourceFile); ->delintNode(sourceFile) : void ->delintNode : (node: ts.Node) => void ->sourceFile : ts.SourceFile - - function delintNode(node: ts.Node) { ->delintNode : (node: ts.Node) => void ->node : ts.Node ->ts : unknown ->Node : ts.Node - - switch (node.kind) { ->node.kind : ts.SyntaxKind ->node : ts.Node ->kind : ts.SyntaxKind - - case ts.SyntaxKind.ForStatement: ->ts.SyntaxKind.ForStatement : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->ForStatement : ts.SyntaxKind - - case ts.SyntaxKind.ForInStatement: ->ts.SyntaxKind.ForInStatement : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->ForInStatement : ts.SyntaxKind - - case ts.SyntaxKind.WhileStatement: ->ts.SyntaxKind.WhileStatement : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->WhileStatement : ts.SyntaxKind - - case ts.SyntaxKind.DoStatement: ->ts.SyntaxKind.DoStatement : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->DoStatement : ts.SyntaxKind - - if ((node).statement.kind !== ts.SyntaxKind.Block) { ->(node).statement.kind !== ts.SyntaxKind.Block : boolean ->(node).statement.kind : ts.SyntaxKind ->(node).statement : ts.Statement ->(node) : ts.IterationStatement ->node : ts.IterationStatement ->ts : unknown ->IterationStatement : ts.IterationStatement ->node : ts.Node ->statement : ts.Statement ->kind : ts.SyntaxKind ->ts.SyntaxKind.Block : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->Block : ts.SyntaxKind - - report(node, "A looping statement's contents should be wrapped in a block body."); ->report(node, "A looping statement's contents should be wrapped in a block body.") : void ->report : (node: ts.Node, message: string) => void ->node : ts.Node - } - break; - case ts.SyntaxKind.IfStatement: ->ts.SyntaxKind.IfStatement : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->IfStatement : ts.SyntaxKind - - var ifStatement = (node); ->ifStatement : ts.IfStatement ->(node) : ts.IfStatement ->node : ts.IfStatement ->ts : unknown ->IfStatement : ts.IfStatement ->node : ts.Node - - if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) { ->ifStatement.thenStatement.kind !== ts.SyntaxKind.Block : boolean ->ifStatement.thenStatement.kind : ts.SyntaxKind ->ifStatement.thenStatement : ts.Statement ->ifStatement : ts.IfStatement ->thenStatement : ts.Statement ->kind : ts.SyntaxKind ->ts.SyntaxKind.Block : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->Block : ts.SyntaxKind - - report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); ->report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.") : void ->report : (node: ts.Node, message: string) => void ->ifStatement.thenStatement : ts.Statement ->ifStatement : ts.IfStatement ->thenStatement : ts.Statement - } - if (ifStatement.elseStatement && ->ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean ->ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean ->ifStatement.elseStatement : ts.Statement ->ifStatement : ts.IfStatement ->elseStatement : ts.Statement - - ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) { ->ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean ->ifStatement.elseStatement.kind : ts.SyntaxKind ->ifStatement.elseStatement : ts.Statement ->ifStatement : ts.IfStatement ->elseStatement : ts.Statement ->kind : ts.SyntaxKind ->ts.SyntaxKind.Block : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->Block : ts.SyntaxKind ->ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean ->ifStatement.elseStatement.kind : ts.SyntaxKind ->ifStatement.elseStatement : ts.Statement ->ifStatement : ts.IfStatement ->elseStatement : ts.Statement ->kind : ts.SyntaxKind ->ts.SyntaxKind.IfStatement : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->IfStatement : ts.SyntaxKind - - report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); ->report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.") : void ->report : (node: ts.Node, message: string) => void ->ifStatement.elseStatement : ts.Statement ->ifStatement : ts.IfStatement ->elseStatement : ts.Statement - } - break; - - case ts.SyntaxKind.BinaryExpression: ->ts.SyntaxKind.BinaryExpression : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->BinaryExpression : ts.SyntaxKind - - var op = (node).operatorToken.kind; ->op : ts.SyntaxKind ->(node).operatorToken.kind : ts.SyntaxKind ->(node).operatorToken : ts.Node ->(node) : ts.BinaryExpression ->node : ts.BinaryExpression ->ts : unknown ->BinaryExpression : ts.BinaryExpression ->node : ts.Node ->operatorToken : ts.Node ->kind : ts.SyntaxKind - - if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { ->op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken : boolean ->op === ts.SyntaxKind.EqualsEqualsToken : boolean ->op : ts.SyntaxKind ->ts.SyntaxKind.EqualsEqualsToken : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->EqualsEqualsToken : ts.SyntaxKind ->op === ts.SyntaxKind.ExclamationEqualsToken : boolean ->op : ts.SyntaxKind ->ts.SyntaxKind.ExclamationEqualsToken : ts.SyntaxKind ->ts.SyntaxKind : typeof ts.SyntaxKind ->ts : typeof ts ->SyntaxKind : typeof ts.SyntaxKind ->ExclamationEqualsToken : ts.SyntaxKind - - report(node, "Use '===' and '!=='.") ->report(node, "Use '===' and '!=='.") : void ->report : (node: ts.Node, message: string) => void ->node : ts.Node - } - break; - } - - ts.forEachChild(node, delintNode); ->ts.forEachChild(node, delintNode) : void ->ts.forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T ->ts : typeof ts ->forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T ->node : ts.Node ->delintNode : (node: ts.Node) => void - } - - function report(node: ts.Node, message: string) { ->report : (node: ts.Node, message: string) => void ->node : ts.Node ->ts : unknown ->Node : ts.Node ->message : string - - var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); ->lineChar : ts.LineAndCharacter ->sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter ->sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter ->sourceFile : ts.SourceFile ->getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter ->node.getStart() : number ->node.getStart : (sourceFile?: ts.SourceFile) => number ->node : ts.Node ->getStart : (sourceFile?: ts.SourceFile) => number - - console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) ->console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) : any ->console.log : any ->console : any ->log : any ->sourceFile.fileName : string ->sourceFile : ts.SourceFile ->fileName : string ->lineChar.line + 1 : number ->lineChar.line : number ->lineChar : ts.LineAndCharacter ->line : number ->lineChar.character + 1 : number ->lineChar.character : number ->lineChar : ts.LineAndCharacter ->character : number ->message : string - } -} - -var fileNames = process.argv.slice(2); ->fileNames : any ->process.argv.slice(2) : any ->process.argv.slice : any ->process.argv : any ->process : any ->argv : any ->slice : any - -fileNames.forEach(fileName => { ->fileNames.forEach(fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);}) : any ->fileNames.forEach : any ->fileNames : any ->forEach : any ->fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);} : (fileName: any) => void ->fileName : any - - // Parse a file - var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); ->sourceFile : ts.SourceFile ->ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true) : ts.SourceFile ->ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile ->ts : typeof ts ->createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile ->fileName : any ->fs.readFileSync(fileName).toString() : any ->fs.readFileSync(fileName).toString : any ->fs.readFileSync(fileName) : any ->fs.readFileSync : any ->fs : any ->readFileSync : any ->fileName : any ->toString : any ->ts.ScriptTarget.ES6 : ts.ScriptTarget ->ts.ScriptTarget : typeof ts.ScriptTarget ->ts : typeof ts ->ScriptTarget : typeof ts.ScriptTarget ->ES6 : ts.ScriptTarget - - // delint it - delint(sourceFile); ->delint(sourceFile) : void ->delint : (sourceFile: ts.SourceFile) => void ->sourceFile : ts.SourceFile - -}); - -=== typescript.d.ts === -/*! ***************************************************************************** -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 module "typescript" { - interface Map { ->Map : Map ->T : T - - [index: string]: T; ->index : string ->T : T - } - interface TextRange { ->TextRange : TextRange - - pos: number; ->pos : number - - end: number; ->end : number - } - const enum SyntaxKind { ->SyntaxKind : SyntaxKind - - Unknown = 0, ->Unknown : SyntaxKind - - EndOfFileToken = 1, ->EndOfFileToken : SyntaxKind - - SingleLineCommentTrivia = 2, ->SingleLineCommentTrivia : SyntaxKind - - MultiLineCommentTrivia = 3, ->MultiLineCommentTrivia : SyntaxKind - - NewLineTrivia = 4, ->NewLineTrivia : SyntaxKind - - WhitespaceTrivia = 5, ->WhitespaceTrivia : SyntaxKind - - ConflictMarkerTrivia = 6, ->ConflictMarkerTrivia : SyntaxKind - - NumericLiteral = 7, ->NumericLiteral : SyntaxKind - - StringLiteral = 8, ->StringLiteral : SyntaxKind - - RegularExpressionLiteral = 9, ->RegularExpressionLiteral : SyntaxKind - - NoSubstitutionTemplateLiteral = 10, ->NoSubstitutionTemplateLiteral : SyntaxKind - - TemplateHead = 11, ->TemplateHead : SyntaxKind - - TemplateMiddle = 12, ->TemplateMiddle : SyntaxKind - - TemplateTail = 13, ->TemplateTail : SyntaxKind - - OpenBraceToken = 14, ->OpenBraceToken : SyntaxKind - - CloseBraceToken = 15, ->CloseBraceToken : SyntaxKind - - OpenParenToken = 16, ->OpenParenToken : SyntaxKind - - CloseParenToken = 17, ->CloseParenToken : SyntaxKind - - OpenBracketToken = 18, ->OpenBracketToken : SyntaxKind - - CloseBracketToken = 19, ->CloseBracketToken : SyntaxKind - - DotToken = 20, ->DotToken : SyntaxKind - - DotDotDotToken = 21, ->DotDotDotToken : SyntaxKind - - SemicolonToken = 22, ->SemicolonToken : SyntaxKind - - CommaToken = 23, ->CommaToken : SyntaxKind - - LessThanToken = 24, ->LessThanToken : SyntaxKind - - GreaterThanToken = 25, ->GreaterThanToken : SyntaxKind - - LessThanEqualsToken = 26, ->LessThanEqualsToken : SyntaxKind - - GreaterThanEqualsToken = 27, ->GreaterThanEqualsToken : SyntaxKind - - EqualsEqualsToken = 28, ->EqualsEqualsToken : SyntaxKind - - ExclamationEqualsToken = 29, ->ExclamationEqualsToken : SyntaxKind - - EqualsEqualsEqualsToken = 30, ->EqualsEqualsEqualsToken : SyntaxKind - - ExclamationEqualsEqualsToken = 31, ->ExclamationEqualsEqualsToken : SyntaxKind - - EqualsGreaterThanToken = 32, ->EqualsGreaterThanToken : SyntaxKind - - PlusToken = 33, ->PlusToken : SyntaxKind - - MinusToken = 34, ->MinusToken : SyntaxKind - - AsteriskToken = 35, ->AsteriskToken : SyntaxKind - - SlashToken = 36, ->SlashToken : SyntaxKind - - PercentToken = 37, ->PercentToken : SyntaxKind - - PlusPlusToken = 38, ->PlusPlusToken : SyntaxKind - - MinusMinusToken = 39, ->MinusMinusToken : SyntaxKind - - LessThanLessThanToken = 40, ->LessThanLessThanToken : SyntaxKind - - GreaterThanGreaterThanToken = 41, ->GreaterThanGreaterThanToken : SyntaxKind - - GreaterThanGreaterThanGreaterThanToken = 42, ->GreaterThanGreaterThanGreaterThanToken : SyntaxKind - - AmpersandToken = 43, ->AmpersandToken : SyntaxKind - - BarToken = 44, ->BarToken : SyntaxKind - - CaretToken = 45, ->CaretToken : SyntaxKind - - ExclamationToken = 46, ->ExclamationToken : SyntaxKind - - TildeToken = 47, ->TildeToken : SyntaxKind - - AmpersandAmpersandToken = 48, ->AmpersandAmpersandToken : SyntaxKind - - BarBarToken = 49, ->BarBarToken : SyntaxKind - - QuestionToken = 50, ->QuestionToken : SyntaxKind - - ColonToken = 51, ->ColonToken : SyntaxKind - - AtToken = 52, ->AtToken : SyntaxKind - - EqualsToken = 53, ->EqualsToken : SyntaxKind - - PlusEqualsToken = 54, ->PlusEqualsToken : SyntaxKind - - MinusEqualsToken = 55, ->MinusEqualsToken : SyntaxKind - - AsteriskEqualsToken = 56, ->AsteriskEqualsToken : SyntaxKind - - SlashEqualsToken = 57, ->SlashEqualsToken : SyntaxKind - - PercentEqualsToken = 58, ->PercentEqualsToken : SyntaxKind - - LessThanLessThanEqualsToken = 59, ->LessThanLessThanEqualsToken : SyntaxKind - - GreaterThanGreaterThanEqualsToken = 60, ->GreaterThanGreaterThanEqualsToken : SyntaxKind - - GreaterThanGreaterThanGreaterThanEqualsToken = 61, ->GreaterThanGreaterThanGreaterThanEqualsToken : SyntaxKind - - AmpersandEqualsToken = 62, ->AmpersandEqualsToken : SyntaxKind - - BarEqualsToken = 63, ->BarEqualsToken : SyntaxKind - - CaretEqualsToken = 64, ->CaretEqualsToken : SyntaxKind - - Identifier = 65, ->Identifier : SyntaxKind - - BreakKeyword = 66, ->BreakKeyword : SyntaxKind - - CaseKeyword = 67, ->CaseKeyword : SyntaxKind - - CatchKeyword = 68, ->CatchKeyword : SyntaxKind - - ClassKeyword = 69, ->ClassKeyword : SyntaxKind - - ConstKeyword = 70, ->ConstKeyword : SyntaxKind - - ContinueKeyword = 71, ->ContinueKeyword : SyntaxKind - - DebuggerKeyword = 72, ->DebuggerKeyword : SyntaxKind - - DefaultKeyword = 73, ->DefaultKeyword : SyntaxKind - - DeleteKeyword = 74, ->DeleteKeyword : SyntaxKind - - DoKeyword = 75, ->DoKeyword : SyntaxKind - - ElseKeyword = 76, ->ElseKeyword : SyntaxKind - - EnumKeyword = 77, ->EnumKeyword : SyntaxKind - - ExportKeyword = 78, ->ExportKeyword : SyntaxKind - - ExtendsKeyword = 79, ->ExtendsKeyword : SyntaxKind - - FalseKeyword = 80, ->FalseKeyword : SyntaxKind - - FinallyKeyword = 81, ->FinallyKeyword : SyntaxKind - - ForKeyword = 82, ->ForKeyword : SyntaxKind - - FunctionKeyword = 83, ->FunctionKeyword : SyntaxKind - - IfKeyword = 84, ->IfKeyword : SyntaxKind - - ImportKeyword = 85, ->ImportKeyword : SyntaxKind - - InKeyword = 86, ->InKeyword : SyntaxKind - - InstanceOfKeyword = 87, ->InstanceOfKeyword : SyntaxKind - - NewKeyword = 88, ->NewKeyword : SyntaxKind - - NullKeyword = 89, ->NullKeyword : SyntaxKind - - ReturnKeyword = 90, ->ReturnKeyword : SyntaxKind - - SuperKeyword = 91, ->SuperKeyword : SyntaxKind - - SwitchKeyword = 92, ->SwitchKeyword : SyntaxKind - - ThisKeyword = 93, ->ThisKeyword : SyntaxKind - - ThrowKeyword = 94, ->ThrowKeyword : SyntaxKind - - TrueKeyword = 95, ->TrueKeyword : SyntaxKind - - TryKeyword = 96, ->TryKeyword : SyntaxKind - - TypeOfKeyword = 97, ->TypeOfKeyword : SyntaxKind - - VarKeyword = 98, ->VarKeyword : SyntaxKind - - VoidKeyword = 99, ->VoidKeyword : SyntaxKind - - WhileKeyword = 100, ->WhileKeyword : SyntaxKind - - WithKeyword = 101, ->WithKeyword : SyntaxKind - - AsKeyword = 102, ->AsKeyword : SyntaxKind - - ImplementsKeyword = 103, ->ImplementsKeyword : SyntaxKind - - InterfaceKeyword = 104, ->InterfaceKeyword : SyntaxKind - - LetKeyword = 105, ->LetKeyword : SyntaxKind - - PackageKeyword = 106, ->PackageKeyword : SyntaxKind - - PrivateKeyword = 107, ->PrivateKeyword : SyntaxKind - - ProtectedKeyword = 108, ->ProtectedKeyword : SyntaxKind - - PublicKeyword = 109, ->PublicKeyword : SyntaxKind - - StaticKeyword = 110, ->StaticKeyword : SyntaxKind - - YieldKeyword = 111, ->YieldKeyword : SyntaxKind - - AnyKeyword = 112, ->AnyKeyword : SyntaxKind - - BooleanKeyword = 113, ->BooleanKeyword : SyntaxKind - - ConstructorKeyword = 114, ->ConstructorKeyword : SyntaxKind - - DeclareKeyword = 115, ->DeclareKeyword : SyntaxKind - - GetKeyword = 116, ->GetKeyword : SyntaxKind - - ModuleKeyword = 117, ->ModuleKeyword : SyntaxKind - - RequireKeyword = 118, ->RequireKeyword : SyntaxKind - - NumberKeyword = 119, ->NumberKeyword : SyntaxKind - - SetKeyword = 120, ->SetKeyword : SyntaxKind - - StringKeyword = 121, ->StringKeyword : SyntaxKind - - SymbolKeyword = 122, ->SymbolKeyword : SyntaxKind - - TypeKeyword = 123, ->TypeKeyword : SyntaxKind - - FromKeyword = 124, ->FromKeyword : SyntaxKind - - OfKeyword = 125, ->OfKeyword : SyntaxKind - - QualifiedName = 126, ->QualifiedName : SyntaxKind - - ComputedPropertyName = 127, ->ComputedPropertyName : SyntaxKind - - TypeParameter = 128, ->TypeParameter : SyntaxKind - - Parameter = 129, ->Parameter : SyntaxKind - - Decorator = 130, ->Decorator : SyntaxKind - - PropertySignature = 131, ->PropertySignature : SyntaxKind - - PropertyDeclaration = 132, ->PropertyDeclaration : SyntaxKind - - MethodSignature = 133, ->MethodSignature : SyntaxKind - - MethodDeclaration = 134, ->MethodDeclaration : SyntaxKind - - Constructor = 135, ->Constructor : SyntaxKind - - GetAccessor = 136, ->GetAccessor : SyntaxKind - - SetAccessor = 137, ->SetAccessor : SyntaxKind - - CallSignature = 138, ->CallSignature : SyntaxKind - - ConstructSignature = 139, ->ConstructSignature : SyntaxKind - - IndexSignature = 140, ->IndexSignature : SyntaxKind - - TypeReference = 141, ->TypeReference : SyntaxKind - - FunctionType = 142, ->FunctionType : SyntaxKind - - ConstructorType = 143, ->ConstructorType : SyntaxKind - - TypeQuery = 144, ->TypeQuery : SyntaxKind - - TypeLiteral = 145, ->TypeLiteral : SyntaxKind - - ArrayType = 146, ->ArrayType : SyntaxKind - - TupleType = 147, ->TupleType : SyntaxKind - - UnionType = 148, ->UnionType : SyntaxKind - - ParenthesizedType = 149, ->ParenthesizedType : SyntaxKind - - ObjectBindingPattern = 150, ->ObjectBindingPattern : SyntaxKind - - ArrayBindingPattern = 151, ->ArrayBindingPattern : SyntaxKind - - BindingElement = 152, ->BindingElement : SyntaxKind - - ArrayLiteralExpression = 153, ->ArrayLiteralExpression : SyntaxKind - - ObjectLiteralExpression = 154, ->ObjectLiteralExpression : SyntaxKind - - PropertyAccessExpression = 155, ->PropertyAccessExpression : SyntaxKind - - ElementAccessExpression = 156, ->ElementAccessExpression : SyntaxKind - - CallExpression = 157, ->CallExpression : SyntaxKind - - NewExpression = 158, ->NewExpression : SyntaxKind - - TaggedTemplateExpression = 159, ->TaggedTemplateExpression : SyntaxKind - - TypeAssertionExpression = 160, ->TypeAssertionExpression : SyntaxKind - - ParenthesizedExpression = 161, ->ParenthesizedExpression : SyntaxKind - - FunctionExpression = 162, ->FunctionExpression : SyntaxKind - - ArrowFunction = 163, ->ArrowFunction : SyntaxKind - - DeleteExpression = 164, ->DeleteExpression : SyntaxKind - - TypeOfExpression = 165, ->TypeOfExpression : SyntaxKind - - VoidExpression = 166, ->VoidExpression : SyntaxKind - - PrefixUnaryExpression = 167, ->PrefixUnaryExpression : SyntaxKind - - PostfixUnaryExpression = 168, ->PostfixUnaryExpression : SyntaxKind - - BinaryExpression = 169, ->BinaryExpression : SyntaxKind - - ConditionalExpression = 170, ->ConditionalExpression : SyntaxKind - - TemplateExpression = 171, ->TemplateExpression : SyntaxKind - - YieldExpression = 172, ->YieldExpression : SyntaxKind - - SpreadElementExpression = 173, ->SpreadElementExpression : SyntaxKind - - OmittedExpression = 174, ->OmittedExpression : SyntaxKind - - TemplateSpan = 175, ->TemplateSpan : SyntaxKind - - HeritageClauseElement = 176, ->HeritageClauseElement : SyntaxKind - - Block = 177, ->Block : SyntaxKind - - VariableStatement = 178, ->VariableStatement : SyntaxKind - - EmptyStatement = 179, ->EmptyStatement : SyntaxKind - - ExpressionStatement = 180, ->ExpressionStatement : SyntaxKind - - IfStatement = 181, ->IfStatement : SyntaxKind - - DoStatement = 182, ->DoStatement : SyntaxKind - - WhileStatement = 183, ->WhileStatement : SyntaxKind - - ForStatement = 184, ->ForStatement : SyntaxKind - - ForInStatement = 185, ->ForInStatement : SyntaxKind - - ForOfStatement = 186, ->ForOfStatement : SyntaxKind - - ContinueStatement = 187, ->ContinueStatement : SyntaxKind - - BreakStatement = 188, ->BreakStatement : SyntaxKind - - ReturnStatement = 189, ->ReturnStatement : SyntaxKind - - WithStatement = 190, ->WithStatement : SyntaxKind - - SwitchStatement = 191, ->SwitchStatement : SyntaxKind - - LabeledStatement = 192, ->LabeledStatement : SyntaxKind - - ThrowStatement = 193, ->ThrowStatement : SyntaxKind - - TryStatement = 194, ->TryStatement : SyntaxKind - - DebuggerStatement = 195, ->DebuggerStatement : SyntaxKind - - VariableDeclaration = 196, ->VariableDeclaration : SyntaxKind - - VariableDeclarationList = 197, ->VariableDeclarationList : SyntaxKind - - FunctionDeclaration = 198, ->FunctionDeclaration : SyntaxKind - - ClassDeclaration = 199, ->ClassDeclaration : SyntaxKind - - InterfaceDeclaration = 200, ->InterfaceDeclaration : SyntaxKind - - TypeAliasDeclaration = 201, ->TypeAliasDeclaration : SyntaxKind - - EnumDeclaration = 202, ->EnumDeclaration : SyntaxKind - - ModuleDeclaration = 203, ->ModuleDeclaration : SyntaxKind - - ModuleBlock = 204, ->ModuleBlock : SyntaxKind - - CaseBlock = 205, ->CaseBlock : SyntaxKind - - ImportEqualsDeclaration = 206, ->ImportEqualsDeclaration : SyntaxKind - - ImportDeclaration = 207, ->ImportDeclaration : SyntaxKind - - ImportClause = 208, ->ImportClause : SyntaxKind - - NamespaceImport = 209, ->NamespaceImport : SyntaxKind - - NamedImports = 210, ->NamedImports : SyntaxKind - - ImportSpecifier = 211, ->ImportSpecifier : SyntaxKind - - ExportAssignment = 212, ->ExportAssignment : SyntaxKind - - ExportDeclaration = 213, ->ExportDeclaration : SyntaxKind - - NamedExports = 214, ->NamedExports : SyntaxKind - - ExportSpecifier = 215, ->ExportSpecifier : SyntaxKind - - MissingDeclaration = 216, ->MissingDeclaration : SyntaxKind - - ExternalModuleReference = 217, ->ExternalModuleReference : SyntaxKind - - CaseClause = 218, ->CaseClause : SyntaxKind - - DefaultClause = 219, ->DefaultClause : SyntaxKind - - HeritageClause = 220, ->HeritageClause : SyntaxKind - - CatchClause = 221, ->CatchClause : SyntaxKind - - PropertyAssignment = 222, ->PropertyAssignment : SyntaxKind - - ShorthandPropertyAssignment = 223, ->ShorthandPropertyAssignment : SyntaxKind - - EnumMember = 224, ->EnumMember : SyntaxKind - - SourceFile = 225, ->SourceFile : SyntaxKind - - SyntaxList = 226, ->SyntaxList : SyntaxKind - - Count = 227, ->Count : SyntaxKind - - FirstAssignment = 53, ->FirstAssignment : SyntaxKind - - LastAssignment = 64, ->LastAssignment : SyntaxKind - - FirstReservedWord = 66, ->FirstReservedWord : SyntaxKind - - LastReservedWord = 101, ->LastReservedWord : SyntaxKind - - FirstKeyword = 66, ->FirstKeyword : SyntaxKind - - LastKeyword = 125, ->LastKeyword : SyntaxKind - - FirstFutureReservedWord = 103, ->FirstFutureReservedWord : SyntaxKind - - LastFutureReservedWord = 111, ->LastFutureReservedWord : SyntaxKind - - FirstTypeNode = 141, ->FirstTypeNode : SyntaxKind - - LastTypeNode = 149, ->LastTypeNode : SyntaxKind - - FirstPunctuation = 14, ->FirstPunctuation : SyntaxKind - - LastPunctuation = 64, ->LastPunctuation : SyntaxKind - - FirstToken = 0, ->FirstToken : SyntaxKind - - LastToken = 125, ->LastToken : SyntaxKind - - FirstTriviaToken = 2, ->FirstTriviaToken : SyntaxKind - - LastTriviaToken = 6, ->LastTriviaToken : SyntaxKind - - FirstLiteralToken = 7, ->FirstLiteralToken : SyntaxKind - - LastLiteralToken = 10, ->LastLiteralToken : SyntaxKind - - FirstTemplateToken = 10, ->FirstTemplateToken : SyntaxKind - - LastTemplateToken = 13, ->LastTemplateToken : SyntaxKind - - FirstBinaryOperator = 24, ->FirstBinaryOperator : SyntaxKind - - LastBinaryOperator = 64, ->LastBinaryOperator : SyntaxKind - - FirstNode = 126, ->FirstNode : SyntaxKind - } - const enum NodeFlags { ->NodeFlags : NodeFlags - - Export = 1, ->Export : NodeFlags - - Ambient = 2, ->Ambient : NodeFlags - - Public = 16, ->Public : NodeFlags - - Private = 32, ->Private : NodeFlags - - Protected = 64, ->Protected : NodeFlags - - Static = 128, ->Static : NodeFlags - - Default = 256, ->Default : NodeFlags - - MultiLine = 512, ->MultiLine : NodeFlags - - Synthetic = 1024, ->Synthetic : NodeFlags - - DeclarationFile = 2048, ->DeclarationFile : NodeFlags - - Let = 4096, ->Let : NodeFlags - - Const = 8192, ->Const : NodeFlags - - OctalLiteral = 16384, ->OctalLiteral : NodeFlags - - ExportContext = 32768, ->ExportContext : NodeFlags - - Modifier = 499, ->Modifier : NodeFlags - - AccessibilityModifier = 112, ->AccessibilityModifier : NodeFlags - - BlockScoped = 12288, ->BlockScoped : NodeFlags - } - const enum ParserContextFlags { ->ParserContextFlags : ParserContextFlags - - StrictMode = 1, ->StrictMode : ParserContextFlags - - DisallowIn = 2, ->DisallowIn : ParserContextFlags - - Yield = 4, ->Yield : ParserContextFlags - - GeneratorParameter = 8, ->GeneratorParameter : ParserContextFlags - - Decorator = 16, ->Decorator : ParserContextFlags - - ThisNodeHasError = 32, ->ThisNodeHasError : ParserContextFlags - - ParserGeneratedFlags = 63, ->ParserGeneratedFlags : ParserContextFlags - - ThisNodeOrAnySubNodesHasError = 64, ->ThisNodeOrAnySubNodesHasError : ParserContextFlags - - HasAggregatedChildData = 128, ->HasAggregatedChildData : ParserContextFlags - } - const enum RelationComparisonResult { ->RelationComparisonResult : RelationComparisonResult - - Succeeded = 1, ->Succeeded : RelationComparisonResult - - Failed = 2, ->Failed : RelationComparisonResult - - FailedAndReported = 3, ->FailedAndReported : RelationComparisonResult - } - interface Node extends TextRange { ->Node : Node ->TextRange : TextRange - - kind: SyntaxKind; ->kind : SyntaxKind ->SyntaxKind : SyntaxKind - - flags: NodeFlags; ->flags : NodeFlags ->NodeFlags : NodeFlags - - parserContextFlags?: ParserContextFlags; ->parserContextFlags : ParserContextFlags ->ParserContextFlags : ParserContextFlags - - decorators?: NodeArray; ->decorators : NodeArray ->NodeArray : NodeArray ->Decorator : Decorator - - modifiers?: ModifiersArray; ->modifiers : ModifiersArray ->ModifiersArray : ModifiersArray - - id?: number; ->id : number - - parent?: Node; ->parent : Node ->Node : Node - - symbol?: Symbol; ->symbol : Symbol ->Symbol : Symbol - - locals?: SymbolTable; ->locals : SymbolTable ->SymbolTable : SymbolTable - - nextContainer?: Node; ->nextContainer : Node ->Node : Node - - localSymbol?: Symbol; ->localSymbol : Symbol ->Symbol : Symbol - } - interface NodeArray extends Array, TextRange { ->NodeArray : NodeArray ->T : T ->Array : T[] ->T : T ->TextRange : TextRange - - hasTrailingComma?: boolean; ->hasTrailingComma : boolean - } - interface ModifiersArray extends NodeArray { ->ModifiersArray : ModifiersArray ->NodeArray : NodeArray ->Node : Node - - flags: number; ->flags : number - } - interface Identifier extends PrimaryExpression { ->Identifier : Identifier ->PrimaryExpression : PrimaryExpression - - text: string; ->text : string - } - interface QualifiedName extends Node { ->QualifiedName : QualifiedName ->Node : Node - - left: EntityName; ->left : Identifier | QualifiedName ->EntityName : Identifier | QualifiedName - - right: Identifier; ->right : Identifier ->Identifier : Identifier - } - type EntityName = Identifier | QualifiedName; ->EntityName : Identifier | QualifiedName ->Identifier : Identifier ->QualifiedName : QualifiedName - - type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; ->DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern ->Identifier : Identifier ->LiteralExpression : LiteralExpression ->ComputedPropertyName : ComputedPropertyName ->BindingPattern : BindingPattern - - interface Declaration extends Node { ->Declaration : Declaration ->Node : Node - - _declarationBrand: any; ->_declarationBrand : any - - name?: DeclarationName; ->name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern ->DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern - } - interface ComputedPropertyName extends Node { ->ComputedPropertyName : ComputedPropertyName ->Node : Node - - expression: Expression; ->expression : Expression ->Expression : Expression - } - interface Decorator extends Node { ->Decorator : Decorator ->Node : Node - - expression: LeftHandSideExpression; ->expression : LeftHandSideExpression ->LeftHandSideExpression : LeftHandSideExpression - } - interface TypeParameterDeclaration extends Declaration { ->TypeParameterDeclaration : TypeParameterDeclaration ->Declaration : Declaration - - name: Identifier; ->name : Identifier ->Identifier : Identifier - - constraint?: TypeNode; ->constraint : TypeNode ->TypeNode : TypeNode - - expression?: Expression; ->expression : Expression ->Expression : Expression - } - interface SignatureDeclaration extends Declaration { ->SignatureDeclaration : SignatureDeclaration ->Declaration : Declaration - - typeParameters?: NodeArray; ->typeParameters : NodeArray ->NodeArray : NodeArray ->TypeParameterDeclaration : TypeParameterDeclaration - - parameters: NodeArray; ->parameters : NodeArray ->NodeArray : NodeArray ->ParameterDeclaration : ParameterDeclaration - - type?: TypeNode; ->type : TypeNode ->TypeNode : TypeNode - } - interface VariableDeclaration extends Declaration { ->VariableDeclaration : VariableDeclaration ->Declaration : Declaration - - parent?: VariableDeclarationList; ->parent : VariableDeclarationList ->VariableDeclarationList : VariableDeclarationList - - name: Identifier | BindingPattern; ->name : Identifier | BindingPattern ->Identifier : Identifier ->BindingPattern : BindingPattern - - type?: TypeNode; ->type : TypeNode ->TypeNode : TypeNode - - initializer?: Expression; ->initializer : Expression ->Expression : Expression - } - interface VariableDeclarationList extends Node { ->VariableDeclarationList : VariableDeclarationList ->Node : Node - - declarations: NodeArray; ->declarations : NodeArray ->NodeArray : NodeArray ->VariableDeclaration : VariableDeclaration - } - interface ParameterDeclaration extends Declaration { ->ParameterDeclaration : ParameterDeclaration ->Declaration : Declaration - - dotDotDotToken?: Node; ->dotDotDotToken : Node ->Node : Node - - name: Identifier | BindingPattern; ->name : Identifier | BindingPattern ->Identifier : Identifier ->BindingPattern : BindingPattern - - questionToken?: Node; ->questionToken : Node ->Node : Node - - type?: TypeNode; ->type : TypeNode ->TypeNode : TypeNode - - initializer?: Expression; ->initializer : Expression ->Expression : Expression - } - interface BindingElement extends Declaration { ->BindingElement : BindingElement ->Declaration : Declaration - - propertyName?: Identifier; ->propertyName : Identifier ->Identifier : Identifier - - dotDotDotToken?: Node; ->dotDotDotToken : Node ->Node : Node - - name: Identifier | BindingPattern; ->name : Identifier | BindingPattern ->Identifier : Identifier ->BindingPattern : BindingPattern - - initializer?: Expression; ->initializer : Expression ->Expression : Expression - } - interface PropertyDeclaration extends Declaration, ClassElement { ->PropertyDeclaration : PropertyDeclaration ->Declaration : Declaration ->ClassElement : ClassElement - - name: DeclarationName; ->name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern ->DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern - - questionToken?: Node; ->questionToken : Node ->Node : Node - - type?: TypeNode; ->type : TypeNode ->TypeNode : TypeNode - - initializer?: Expression; ->initializer : Expression ->Expression : Expression - } - interface ObjectLiteralElement extends Declaration { ->ObjectLiteralElement : ObjectLiteralElement ->Declaration : Declaration - - _objectLiteralBrandBrand: any; ->_objectLiteralBrandBrand : any - } - interface PropertyAssignment extends ObjectLiteralElement { ->PropertyAssignment : PropertyAssignment ->ObjectLiteralElement : ObjectLiteralElement - - _propertyAssignmentBrand: any; ->_propertyAssignmentBrand : any - - name: DeclarationName; ->name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern ->DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern - - questionToken?: Node; ->questionToken : Node ->Node : Node - - initializer: Expression; ->initializer : Expression ->Expression : Expression - } - interface ShorthandPropertyAssignment extends ObjectLiteralElement { ->ShorthandPropertyAssignment : ShorthandPropertyAssignment ->ObjectLiteralElement : ObjectLiteralElement - - name: Identifier; ->name : Identifier ->Identifier : Identifier - - questionToken?: Node; ->questionToken : Node ->Node : Node - } - interface VariableLikeDeclaration extends Declaration { ->VariableLikeDeclaration : VariableLikeDeclaration ->Declaration : Declaration - - propertyName?: Identifier; ->propertyName : Identifier ->Identifier : Identifier - - dotDotDotToken?: Node; ->dotDotDotToken : Node ->Node : Node - - name: DeclarationName; ->name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern ->DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern - - questionToken?: Node; ->questionToken : Node ->Node : Node - - type?: TypeNode; ->type : TypeNode ->TypeNode : TypeNode - - initializer?: Expression; ->initializer : Expression ->Expression : Expression - } - interface BindingPattern extends Node { ->BindingPattern : BindingPattern ->Node : Node - - elements: NodeArray; ->elements : NodeArray ->NodeArray : NodeArray ->BindingElement : BindingElement - } - /** - * Several node kinds share function-like features such as a signature, - * a name, and a body. These nodes should extend FunctionLikeDeclaration. - * Examples: - * FunctionDeclaration - * MethodDeclaration - * AccessorDeclaration - */ - interface FunctionLikeDeclaration extends SignatureDeclaration { ->FunctionLikeDeclaration : FunctionLikeDeclaration ->SignatureDeclaration : SignatureDeclaration - - _functionLikeDeclarationBrand: any; ->_functionLikeDeclarationBrand : any - - asteriskToken?: Node; ->asteriskToken : Node ->Node : Node - - questionToken?: Node; ->questionToken : Node ->Node : Node - - body?: Block | Expression; ->body : Expression | Block ->Block : Block ->Expression : Expression - } - interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { ->FunctionDeclaration : FunctionDeclaration ->FunctionLikeDeclaration : FunctionLikeDeclaration ->Statement : Statement - - name?: Identifier; ->name : Identifier ->Identifier : Identifier - - body?: Block; ->body : Block ->Block : Block - } - interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { ->MethodDeclaration : MethodDeclaration ->FunctionLikeDeclaration : FunctionLikeDeclaration ->ClassElement : ClassElement ->ObjectLiteralElement : ObjectLiteralElement - - body?: Block; ->body : Block ->Block : Block - } - interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { ->ConstructorDeclaration : ConstructorDeclaration ->FunctionLikeDeclaration : FunctionLikeDeclaration ->ClassElement : ClassElement - - body?: Block; ->body : Block ->Block : Block - } - interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { ->AccessorDeclaration : AccessorDeclaration ->FunctionLikeDeclaration : FunctionLikeDeclaration ->ClassElement : ClassElement ->ObjectLiteralElement : ObjectLiteralElement - - _accessorDeclarationBrand: any; ->_accessorDeclarationBrand : any - - body: Block; ->body : Block ->Block : Block - } - interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { ->IndexSignatureDeclaration : IndexSignatureDeclaration ->SignatureDeclaration : SignatureDeclaration ->ClassElement : ClassElement - - _indexSignatureDeclarationBrand: any; ->_indexSignatureDeclarationBrand : any - } - interface TypeNode extends Node { ->TypeNode : TypeNode ->Node : Node - - _typeNodeBrand: any; ->_typeNodeBrand : any - } - interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { ->FunctionOrConstructorTypeNode : FunctionOrConstructorTypeNode ->TypeNode : TypeNode ->SignatureDeclaration : SignatureDeclaration - - _functionOrConstructorTypeNodeBrand: any; ->_functionOrConstructorTypeNodeBrand : any - } - interface TypeReferenceNode extends TypeNode { ->TypeReferenceNode : TypeReferenceNode ->TypeNode : TypeNode - - typeName: EntityName; ->typeName : Identifier | QualifiedName ->EntityName : Identifier | QualifiedName - - typeArguments?: NodeArray; ->typeArguments : NodeArray ->NodeArray : NodeArray ->TypeNode : TypeNode - } - interface TypeQueryNode extends TypeNode { ->TypeQueryNode : TypeQueryNode ->TypeNode : TypeNode - - exprName: EntityName; ->exprName : Identifier | QualifiedName ->EntityName : Identifier | QualifiedName - } - interface TypeLiteralNode extends TypeNode, Declaration { ->TypeLiteralNode : TypeLiteralNode ->TypeNode : TypeNode ->Declaration : Declaration - - members: NodeArray; ->members : NodeArray ->NodeArray : NodeArray ->Node : Node - } - interface ArrayTypeNode extends TypeNode { ->ArrayTypeNode : ArrayTypeNode ->TypeNode : TypeNode - - elementType: TypeNode; ->elementType : TypeNode ->TypeNode : TypeNode - } - interface TupleTypeNode extends TypeNode { ->TupleTypeNode : TupleTypeNode ->TypeNode : TypeNode - - elementTypes: NodeArray; ->elementTypes : NodeArray ->NodeArray : NodeArray ->TypeNode : TypeNode - } - interface UnionTypeNode extends TypeNode { ->UnionTypeNode : UnionTypeNode ->TypeNode : TypeNode - - types: NodeArray; ->types : NodeArray ->NodeArray : NodeArray ->TypeNode : TypeNode - } - interface ParenthesizedTypeNode extends TypeNode { ->ParenthesizedTypeNode : ParenthesizedTypeNode ->TypeNode : TypeNode - - type: TypeNode; ->type : TypeNode ->TypeNode : TypeNode - } - interface StringLiteralTypeNode extends LiteralExpression, TypeNode { ->StringLiteralTypeNode : StringLiteralTypeNode ->LiteralExpression : LiteralExpression ->TypeNode : TypeNode - } - interface Expression extends Node { ->Expression : Expression ->Node : Node - - _expressionBrand: any; ->_expressionBrand : any - - contextualType?: Type; ->contextualType : Type ->Type : Type - } - interface UnaryExpression extends Expression { ->UnaryExpression : UnaryExpression ->Expression : Expression - - _unaryExpressionBrand: any; ->_unaryExpressionBrand : any - } - interface PrefixUnaryExpression extends UnaryExpression { ->PrefixUnaryExpression : PrefixUnaryExpression ->UnaryExpression : UnaryExpression - - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind - - operand: UnaryExpression; ->operand : UnaryExpression ->UnaryExpression : UnaryExpression - } - interface PostfixUnaryExpression extends PostfixExpression { ->PostfixUnaryExpression : PostfixUnaryExpression ->PostfixExpression : PostfixExpression - - operand: LeftHandSideExpression; ->operand : LeftHandSideExpression ->LeftHandSideExpression : LeftHandSideExpression - - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind - } - interface PostfixExpression extends UnaryExpression { ->PostfixExpression : PostfixExpression ->UnaryExpression : UnaryExpression - - _postfixExpressionBrand: any; ->_postfixExpressionBrand : any - } - interface LeftHandSideExpression extends PostfixExpression { ->LeftHandSideExpression : LeftHandSideExpression ->PostfixExpression : PostfixExpression - - _leftHandSideExpressionBrand: any; ->_leftHandSideExpressionBrand : any - } - interface MemberExpression extends LeftHandSideExpression { ->MemberExpression : MemberExpression ->LeftHandSideExpression : LeftHandSideExpression - - _memberExpressionBrand: any; ->_memberExpressionBrand : any - } - interface PrimaryExpression extends MemberExpression { ->PrimaryExpression : PrimaryExpression ->MemberExpression : MemberExpression - - _primaryExpressionBrand: any; ->_primaryExpressionBrand : any - } - interface DeleteExpression extends UnaryExpression { ->DeleteExpression : DeleteExpression ->UnaryExpression : UnaryExpression - - expression: UnaryExpression; ->expression : UnaryExpression ->UnaryExpression : UnaryExpression - } - interface TypeOfExpression extends UnaryExpression { ->TypeOfExpression : TypeOfExpression ->UnaryExpression : UnaryExpression - - expression: UnaryExpression; ->expression : UnaryExpression ->UnaryExpression : UnaryExpression - } - interface VoidExpression extends UnaryExpression { ->VoidExpression : VoidExpression ->UnaryExpression : UnaryExpression - - expression: UnaryExpression; ->expression : UnaryExpression ->UnaryExpression : UnaryExpression - } - interface YieldExpression extends Expression { ->YieldExpression : YieldExpression ->Expression : Expression - - asteriskToken?: Node; ->asteriskToken : Node ->Node : Node - - expression: Expression; ->expression : Expression ->Expression : Expression - } - interface BinaryExpression extends Expression { ->BinaryExpression : BinaryExpression ->Expression : Expression - - left: Expression; ->left : Expression ->Expression : Expression - - operatorToken: Node; ->operatorToken : Node ->Node : Node - - right: Expression; ->right : Expression ->Expression : Expression - } - interface ConditionalExpression extends Expression { ->ConditionalExpression : ConditionalExpression ->Expression : Expression - - condition: Expression; ->condition : Expression ->Expression : Expression - - questionToken: Node; ->questionToken : Node ->Node : Node - - whenTrue: Expression; ->whenTrue : Expression ->Expression : Expression - - colonToken: Node; ->colonToken : Node ->Node : Node - - whenFalse: Expression; ->whenFalse : Expression ->Expression : Expression - } - interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { ->FunctionExpression : FunctionExpression ->PrimaryExpression : PrimaryExpression ->FunctionLikeDeclaration : FunctionLikeDeclaration - - name?: Identifier; ->name : Identifier ->Identifier : Identifier - - body: Block | Expression; ->body : Expression | Block ->Block : Block ->Expression : Expression - } - interface ArrowFunction extends Expression, FunctionLikeDeclaration { ->ArrowFunction : ArrowFunction ->Expression : Expression ->FunctionLikeDeclaration : FunctionLikeDeclaration - - equalsGreaterThanToken: Node; ->equalsGreaterThanToken : Node ->Node : Node - } - interface LiteralExpression extends PrimaryExpression { ->LiteralExpression : LiteralExpression ->PrimaryExpression : PrimaryExpression - - text: string; ->text : string - - isUnterminated?: boolean; ->isUnterminated : boolean - - hasExtendedUnicodeEscape?: boolean; ->hasExtendedUnicodeEscape : boolean - } - interface StringLiteralExpression extends LiteralExpression { ->StringLiteralExpression : StringLiteralExpression ->LiteralExpression : LiteralExpression - - _stringLiteralExpressionBrand: any; ->_stringLiteralExpressionBrand : any - } - interface TemplateExpression extends PrimaryExpression { ->TemplateExpression : TemplateExpression ->PrimaryExpression : PrimaryExpression - - head: LiteralExpression; ->head : LiteralExpression ->LiteralExpression : LiteralExpression - - templateSpans: NodeArray; ->templateSpans : NodeArray ->NodeArray : NodeArray ->TemplateSpan : TemplateSpan - } - interface TemplateSpan extends Node { ->TemplateSpan : TemplateSpan ->Node : Node - - expression: Expression; ->expression : Expression ->Expression : Expression - - literal: LiteralExpression; ->literal : LiteralExpression ->LiteralExpression : LiteralExpression - } - interface ParenthesizedExpression extends PrimaryExpression { ->ParenthesizedExpression : ParenthesizedExpression ->PrimaryExpression : PrimaryExpression - - expression: Expression; ->expression : Expression ->Expression : Expression - } - interface ArrayLiteralExpression extends PrimaryExpression { ->ArrayLiteralExpression : ArrayLiteralExpression ->PrimaryExpression : PrimaryExpression - - elements: NodeArray; ->elements : NodeArray ->NodeArray : NodeArray ->Expression : Expression - } - interface SpreadElementExpression extends Expression { ->SpreadElementExpression : SpreadElementExpression ->Expression : Expression - - expression: Expression; ->expression : Expression ->Expression : Expression - } - interface ObjectLiteralExpression extends PrimaryExpression, Declaration { ->ObjectLiteralExpression : ObjectLiteralExpression ->PrimaryExpression : PrimaryExpression ->Declaration : Declaration - - properties: NodeArray; ->properties : NodeArray ->NodeArray : NodeArray ->ObjectLiteralElement : ObjectLiteralElement - } - interface PropertyAccessExpression extends MemberExpression { ->PropertyAccessExpression : PropertyAccessExpression ->MemberExpression : MemberExpression - - expression: LeftHandSideExpression; ->expression : LeftHandSideExpression ->LeftHandSideExpression : LeftHandSideExpression - - dotToken: Node; ->dotToken : Node ->Node : Node - - name: Identifier; ->name : Identifier ->Identifier : Identifier - } - interface ElementAccessExpression extends MemberExpression { ->ElementAccessExpression : ElementAccessExpression ->MemberExpression : MemberExpression - - expression: LeftHandSideExpression; ->expression : LeftHandSideExpression ->LeftHandSideExpression : LeftHandSideExpression - - argumentExpression?: Expression; ->argumentExpression : Expression ->Expression : Expression - } - interface CallExpression extends LeftHandSideExpression { ->CallExpression : CallExpression ->LeftHandSideExpression : LeftHandSideExpression - - expression: LeftHandSideExpression; ->expression : LeftHandSideExpression ->LeftHandSideExpression : LeftHandSideExpression - - typeArguments?: NodeArray; ->typeArguments : NodeArray ->NodeArray : NodeArray ->TypeNode : TypeNode - - arguments: NodeArray; ->arguments : NodeArray ->NodeArray : NodeArray ->Expression : Expression - } - interface HeritageClauseElement extends Node { ->HeritageClauseElement : HeritageClauseElement ->Node : Node - - expression: LeftHandSideExpression; ->expression : LeftHandSideExpression ->LeftHandSideExpression : LeftHandSideExpression - - typeArguments?: NodeArray; ->typeArguments : NodeArray ->NodeArray : NodeArray ->TypeNode : TypeNode - } - interface NewExpression extends CallExpression, PrimaryExpression { ->NewExpression : NewExpression ->CallExpression : CallExpression ->PrimaryExpression : PrimaryExpression - } - interface TaggedTemplateExpression extends MemberExpression { ->TaggedTemplateExpression : TaggedTemplateExpression ->MemberExpression : MemberExpression - - tag: LeftHandSideExpression; ->tag : LeftHandSideExpression ->LeftHandSideExpression : LeftHandSideExpression - - template: LiteralExpression | TemplateExpression; ->template : LiteralExpression | TemplateExpression ->LiteralExpression : LiteralExpression ->TemplateExpression : TemplateExpression - } - type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression; ->CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression ->CallExpression : CallExpression ->NewExpression : NewExpression ->TaggedTemplateExpression : TaggedTemplateExpression - - interface TypeAssertion extends UnaryExpression { ->TypeAssertion : TypeAssertion ->UnaryExpression : UnaryExpression - - type: TypeNode; ->type : TypeNode ->TypeNode : TypeNode - - expression: UnaryExpression; ->expression : UnaryExpression ->UnaryExpression : UnaryExpression - } - interface Statement extends Node, ModuleElement { ->Statement : Statement ->Node : Node ->ModuleElement : ModuleElement - - _statementBrand: any; ->_statementBrand : any - } - interface Block extends Statement { ->Block : Block ->Statement : Statement - - statements: NodeArray; ->statements : NodeArray ->NodeArray : NodeArray ->Statement : Statement - } - interface VariableStatement extends Statement { ->VariableStatement : VariableStatement ->Statement : Statement - - declarationList: VariableDeclarationList; ->declarationList : VariableDeclarationList ->VariableDeclarationList : VariableDeclarationList - } - interface ExpressionStatement extends Statement { ->ExpressionStatement : ExpressionStatement ->Statement : Statement - - expression: Expression; ->expression : Expression ->Expression : Expression - } - interface IfStatement extends Statement { ->IfStatement : IfStatement ->Statement : Statement - - expression: Expression; ->expression : Expression ->Expression : Expression - - thenStatement: Statement; ->thenStatement : Statement ->Statement : Statement - - elseStatement?: Statement; ->elseStatement : Statement ->Statement : Statement - } - interface IterationStatement extends Statement { ->IterationStatement : IterationStatement ->Statement : Statement - - statement: Statement; ->statement : Statement ->Statement : Statement - } - interface DoStatement extends IterationStatement { ->DoStatement : DoStatement ->IterationStatement : IterationStatement - - expression: Expression; ->expression : Expression ->Expression : Expression - } - interface WhileStatement extends IterationStatement { ->WhileStatement : WhileStatement ->IterationStatement : IterationStatement - - expression: Expression; ->expression : Expression ->Expression : Expression - } - interface ForStatement extends IterationStatement { ->ForStatement : ForStatement ->IterationStatement : IterationStatement - - initializer?: VariableDeclarationList | Expression; ->initializer : Expression | VariableDeclarationList ->VariableDeclarationList : VariableDeclarationList ->Expression : Expression - - condition?: Expression; ->condition : Expression ->Expression : Expression - - iterator?: Expression; ->iterator : Expression ->Expression : Expression - } - interface ForInStatement extends IterationStatement { ->ForInStatement : ForInStatement ->IterationStatement : IterationStatement - - initializer: VariableDeclarationList | Expression; ->initializer : Expression | VariableDeclarationList ->VariableDeclarationList : VariableDeclarationList ->Expression : Expression - - expression: Expression; ->expression : Expression ->Expression : Expression - } - interface ForOfStatement extends IterationStatement { ->ForOfStatement : ForOfStatement ->IterationStatement : IterationStatement - - initializer: VariableDeclarationList | Expression; ->initializer : Expression | VariableDeclarationList ->VariableDeclarationList : VariableDeclarationList ->Expression : Expression - - expression: Expression; ->expression : Expression ->Expression : Expression - } - interface BreakOrContinueStatement extends Statement { ->BreakOrContinueStatement : BreakOrContinueStatement ->Statement : Statement - - label?: Identifier; ->label : Identifier ->Identifier : Identifier - } - interface ReturnStatement extends Statement { ->ReturnStatement : ReturnStatement ->Statement : Statement - - expression?: Expression; ->expression : Expression ->Expression : Expression - } - interface WithStatement extends Statement { ->WithStatement : WithStatement ->Statement : Statement - - expression: Expression; ->expression : Expression ->Expression : Expression - - statement: Statement; ->statement : Statement ->Statement : Statement - } - interface SwitchStatement extends Statement { ->SwitchStatement : SwitchStatement ->Statement : Statement - - expression: Expression; ->expression : Expression ->Expression : Expression - - caseBlock: CaseBlock; ->caseBlock : CaseBlock ->CaseBlock : CaseBlock - } - interface CaseBlock extends Node { ->CaseBlock : CaseBlock ->Node : Node - - clauses: NodeArray; ->clauses : NodeArray ->NodeArray : NodeArray ->CaseOrDefaultClause : CaseClause | DefaultClause - } - interface CaseClause extends Node { ->CaseClause : CaseClause ->Node : Node - - expression?: Expression; ->expression : Expression ->Expression : Expression - - statements: NodeArray; ->statements : NodeArray ->NodeArray : NodeArray ->Statement : Statement - } - interface DefaultClause extends Node { ->DefaultClause : DefaultClause ->Node : Node - - statements: NodeArray; ->statements : NodeArray ->NodeArray : NodeArray ->Statement : Statement - } - type CaseOrDefaultClause = CaseClause | DefaultClause; ->CaseOrDefaultClause : CaseClause | DefaultClause ->CaseClause : CaseClause ->DefaultClause : DefaultClause - - interface LabeledStatement extends Statement { ->LabeledStatement : LabeledStatement ->Statement : Statement - - label: Identifier; ->label : Identifier ->Identifier : Identifier - - statement: Statement; ->statement : Statement ->Statement : Statement - } - interface ThrowStatement extends Statement { ->ThrowStatement : ThrowStatement ->Statement : Statement - - expression: Expression; ->expression : Expression ->Expression : Expression - } - interface TryStatement extends Statement { ->TryStatement : TryStatement ->Statement : Statement - - tryBlock: Block; ->tryBlock : Block ->Block : Block - - catchClause?: CatchClause; ->catchClause : CatchClause ->CatchClause : CatchClause - - finallyBlock?: Block; ->finallyBlock : Block ->Block : Block - } - interface CatchClause extends Node { ->CatchClause : CatchClause ->Node : Node - - variableDeclaration: VariableDeclaration; ->variableDeclaration : VariableDeclaration ->VariableDeclaration : VariableDeclaration - - block: Block; ->block : Block ->Block : Block - } - interface ModuleElement extends Node { ->ModuleElement : ModuleElement ->Node : Node - - _moduleElementBrand: any; ->_moduleElementBrand : any - } - interface ClassDeclaration extends Declaration, ModuleElement { ->ClassDeclaration : ClassDeclaration ->Declaration : Declaration ->ModuleElement : ModuleElement - - name?: Identifier; ->name : Identifier ->Identifier : Identifier - - typeParameters?: NodeArray; ->typeParameters : NodeArray ->NodeArray : NodeArray ->TypeParameterDeclaration : TypeParameterDeclaration - - heritageClauses?: NodeArray; ->heritageClauses : NodeArray ->NodeArray : NodeArray ->HeritageClause : HeritageClause - - members: NodeArray; ->members : NodeArray ->NodeArray : NodeArray ->ClassElement : ClassElement - } - interface ClassElement extends Declaration { ->ClassElement : ClassElement ->Declaration : Declaration - - _classElementBrand: any; ->_classElementBrand : any - } - interface InterfaceDeclaration extends Declaration, ModuleElement { ->InterfaceDeclaration : InterfaceDeclaration ->Declaration : Declaration ->ModuleElement : ModuleElement - - name: Identifier; ->name : Identifier ->Identifier : Identifier - - typeParameters?: NodeArray; ->typeParameters : NodeArray ->NodeArray : NodeArray ->TypeParameterDeclaration : TypeParameterDeclaration - - heritageClauses?: NodeArray; ->heritageClauses : NodeArray ->NodeArray : NodeArray ->HeritageClause : HeritageClause - - members: NodeArray; ->members : NodeArray ->NodeArray : NodeArray ->Declaration : Declaration - } - interface HeritageClause extends Node { ->HeritageClause : HeritageClause ->Node : Node - - token: SyntaxKind; ->token : SyntaxKind ->SyntaxKind : SyntaxKind - - types?: NodeArray; ->types : NodeArray ->NodeArray : NodeArray ->HeritageClauseElement : HeritageClauseElement - } - interface TypeAliasDeclaration extends Declaration, ModuleElement { ->TypeAliasDeclaration : TypeAliasDeclaration ->Declaration : Declaration ->ModuleElement : ModuleElement - - name: Identifier; ->name : Identifier ->Identifier : Identifier - - type: TypeNode; ->type : TypeNode ->TypeNode : TypeNode - } - interface EnumMember extends Declaration { ->EnumMember : EnumMember ->Declaration : Declaration - - name: DeclarationName; ->name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern ->DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern - - initializer?: Expression; ->initializer : Expression ->Expression : Expression - } - interface EnumDeclaration extends Declaration, ModuleElement { ->EnumDeclaration : EnumDeclaration ->Declaration : Declaration ->ModuleElement : ModuleElement - - name: Identifier; ->name : Identifier ->Identifier : Identifier - - members: NodeArray; ->members : NodeArray ->NodeArray : NodeArray ->EnumMember : EnumMember - } - interface ModuleDeclaration extends Declaration, ModuleElement { ->ModuleDeclaration : ModuleDeclaration ->Declaration : Declaration ->ModuleElement : ModuleElement - - name: Identifier | LiteralExpression; ->name : Identifier | LiteralExpression ->Identifier : Identifier ->LiteralExpression : LiteralExpression - - body: ModuleBlock | ModuleDeclaration; ->body : ModuleDeclaration | ModuleBlock ->ModuleBlock : ModuleBlock ->ModuleDeclaration : ModuleDeclaration - } - interface ModuleBlock extends Node, ModuleElement { ->ModuleBlock : ModuleBlock ->Node : Node ->ModuleElement : ModuleElement - - statements: NodeArray; ->statements : NodeArray ->NodeArray : NodeArray ->ModuleElement : ModuleElement - } - interface ImportEqualsDeclaration extends Declaration, ModuleElement { ->ImportEqualsDeclaration : ImportEqualsDeclaration ->Declaration : Declaration ->ModuleElement : ModuleElement - - name: Identifier; ->name : Identifier ->Identifier : Identifier - - moduleReference: EntityName | ExternalModuleReference; ->moduleReference : Identifier | QualifiedName | ExternalModuleReference ->EntityName : Identifier | QualifiedName ->ExternalModuleReference : ExternalModuleReference - } - interface ExternalModuleReference extends Node { ->ExternalModuleReference : ExternalModuleReference ->Node : Node - - expression?: Expression; ->expression : Expression ->Expression : Expression - } - interface ImportDeclaration extends Statement, ModuleElement { ->ImportDeclaration : ImportDeclaration ->Statement : Statement ->ModuleElement : ModuleElement - - importClause?: ImportClause; ->importClause : ImportClause ->ImportClause : ImportClause - - moduleSpecifier: Expression; ->moduleSpecifier : Expression ->Expression : Expression - } - interface ImportClause extends Declaration { ->ImportClause : ImportClause ->Declaration : Declaration - - name?: Identifier; ->name : Identifier ->Identifier : Identifier - - namedBindings?: NamespaceImport | NamedImports; ->namedBindings : NamespaceImport | NamedImportsOrExports ->NamespaceImport : NamespaceImport ->NamedImports : NamedImportsOrExports - } - interface NamespaceImport extends Declaration { ->NamespaceImport : NamespaceImport ->Declaration : Declaration - - name: Identifier; ->name : Identifier ->Identifier : Identifier - } - interface ExportDeclaration extends Declaration, ModuleElement { ->ExportDeclaration : ExportDeclaration ->Declaration : Declaration ->ModuleElement : ModuleElement - - exportClause?: NamedExports; ->exportClause : NamedImportsOrExports ->NamedExports : NamedImportsOrExports - - moduleSpecifier?: Expression; ->moduleSpecifier : Expression ->Expression : Expression - } - interface NamedImportsOrExports extends Node { ->NamedImportsOrExports : NamedImportsOrExports ->Node : Node - - elements: NodeArray; ->elements : NodeArray ->NodeArray : NodeArray ->ImportOrExportSpecifier : ImportOrExportSpecifier - } - type NamedImports = NamedImportsOrExports; ->NamedImports : NamedImportsOrExports ->NamedImportsOrExports : NamedImportsOrExports - - type NamedExports = NamedImportsOrExports; ->NamedExports : NamedImportsOrExports ->NamedImportsOrExports : NamedImportsOrExports - - interface ImportOrExportSpecifier extends Declaration { ->ImportOrExportSpecifier : ImportOrExportSpecifier ->Declaration : Declaration - - propertyName?: Identifier; ->propertyName : Identifier ->Identifier : Identifier - - name: Identifier; ->name : Identifier ->Identifier : Identifier - } - type ImportSpecifier = ImportOrExportSpecifier; ->ImportSpecifier : ImportOrExportSpecifier ->ImportOrExportSpecifier : ImportOrExportSpecifier - - type ExportSpecifier = ImportOrExportSpecifier; ->ExportSpecifier : ImportOrExportSpecifier ->ImportOrExportSpecifier : ImportOrExportSpecifier - - interface ExportAssignment extends Declaration, ModuleElement { ->ExportAssignment : ExportAssignment ->Declaration : Declaration ->ModuleElement : ModuleElement - - isExportEquals?: boolean; ->isExportEquals : boolean - - expression?: Expression; ->expression : Expression ->Expression : Expression - - type?: TypeNode; ->type : TypeNode ->TypeNode : TypeNode - } - interface FileReference extends TextRange { ->FileReference : FileReference ->TextRange : TextRange - - fileName: string; ->fileName : string - } - interface CommentRange extends TextRange { ->CommentRange : CommentRange ->TextRange : TextRange - - hasTrailingNewLine?: boolean; ->hasTrailingNewLine : boolean - } - interface SourceFile extends Declaration { ->SourceFile : SourceFile ->Declaration : Declaration - - statements: NodeArray; ->statements : NodeArray ->NodeArray : NodeArray ->ModuleElement : ModuleElement - - endOfFileToken: Node; ->endOfFileToken : Node ->Node : Node - - fileName: string; ->fileName : string - - text: string; ->text : string - - amdDependencies: { ->amdDependencies : { path: string; name: string; }[] - - path: string; ->path : string - - name: string; ->name : string - - }[]; - amdModuleName: string; ->amdModuleName : string - - referencedFiles: FileReference[]; ->referencedFiles : FileReference[] ->FileReference : FileReference - - hasNoDefaultLib: boolean; ->hasNoDefaultLib : boolean - - externalModuleIndicator: Node; ->externalModuleIndicator : Node ->Node : Node - - languageVersion: ScriptTarget; ->languageVersion : ScriptTarget ->ScriptTarget : ScriptTarget - - identifiers: Map; ->identifiers : Map ->Map : Map - } - interface ScriptReferenceHost { ->ScriptReferenceHost : ScriptReferenceHost - - getCompilerOptions(): CompilerOptions; ->getCompilerOptions : () => CompilerOptions ->CompilerOptions : CompilerOptions - - getSourceFile(fileName: string): SourceFile; ->getSourceFile : (fileName: string) => SourceFile ->fileName : string ->SourceFile : SourceFile - - getCurrentDirectory(): string; ->getCurrentDirectory : () => string - } - interface WriteFileCallback { ->WriteFileCallback : WriteFileCallback - - (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; ->fileName : string ->data : string ->writeByteOrderMark : boolean ->onError : (message: string) => void ->message : string - } - interface Program extends ScriptReferenceHost { ->Program : Program ->ScriptReferenceHost : ScriptReferenceHost - - getSourceFiles(): SourceFile[]; ->getSourceFiles : () => SourceFile[] ->SourceFile : SourceFile - - /** - * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then - * the JavaScript and declaration files will be produced for all the files in this program. - * If targetSourceFile is specified, then only the JavaScript and declaration for that - * specific file will be generated. - * - * If writeFile is not specified then the writeFile callback from the compiler host will be - * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter - * will be invoked when writing the JavaScript and declaration files. - */ - emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; ->emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult ->targetSourceFile : SourceFile ->SourceFile : SourceFile ->writeFile : WriteFileCallback ->WriteFileCallback : WriteFileCallback ->EmitResult : EmitResult - - getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; ->getSyntacticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] ->sourceFile : SourceFile ->SourceFile : SourceFile ->Diagnostic : Diagnostic - - getGlobalDiagnostics(): Diagnostic[]; ->getGlobalDiagnostics : () => Diagnostic[] ->Diagnostic : Diagnostic - - getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; ->getSemanticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] ->sourceFile : SourceFile ->SourceFile : SourceFile ->Diagnostic : Diagnostic - - getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; ->getDeclarationDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] ->sourceFile : SourceFile ->SourceFile : SourceFile ->Diagnostic : Diagnostic - - getTypeChecker(): TypeChecker; ->getTypeChecker : () => TypeChecker ->TypeChecker : TypeChecker - - getCommonSourceDirectory(): string; ->getCommonSourceDirectory : () => string - } - interface SourceMapSpan { ->SourceMapSpan : SourceMapSpan - - emittedLine: number; ->emittedLine : number - - emittedColumn: number; ->emittedColumn : number - - sourceLine: number; ->sourceLine : number - - sourceColumn: number; ->sourceColumn : number - - nameIndex?: number; ->nameIndex : number - - sourceIndex: number; ->sourceIndex : number - } - interface SourceMapData { ->SourceMapData : SourceMapData - - sourceMapFilePath: string; ->sourceMapFilePath : string - - jsSourceMappingURL: string; ->jsSourceMappingURL : string - - sourceMapFile: string; ->sourceMapFile : string - - sourceMapSourceRoot: string; ->sourceMapSourceRoot : string - - sourceMapSources: string[]; ->sourceMapSources : string[] - - inputSourceFileNames: string[]; ->inputSourceFileNames : string[] - - sourceMapNames?: string[]; ->sourceMapNames : string[] - - sourceMapMappings: string; ->sourceMapMappings : string - - sourceMapDecodedMappings: SourceMapSpan[]; ->sourceMapDecodedMappings : SourceMapSpan[] ->SourceMapSpan : SourceMapSpan - } - enum ExitStatus { ->ExitStatus : ExitStatus - - Success = 0, ->Success : ExitStatus - - DiagnosticsPresent_OutputsSkipped = 1, ->DiagnosticsPresent_OutputsSkipped : ExitStatus - - DiagnosticsPresent_OutputsGenerated = 2, ->DiagnosticsPresent_OutputsGenerated : ExitStatus - } - interface EmitResult { ->EmitResult : EmitResult - - emitSkipped: boolean; ->emitSkipped : boolean - - diagnostics: Diagnostic[]; ->diagnostics : Diagnostic[] ->Diagnostic : Diagnostic - - sourceMaps: SourceMapData[]; ->sourceMaps : SourceMapData[] ->SourceMapData : SourceMapData - } - interface TypeCheckerHost { ->TypeCheckerHost : TypeCheckerHost - - getCompilerOptions(): CompilerOptions; ->getCompilerOptions : () => CompilerOptions ->CompilerOptions : CompilerOptions - - getSourceFiles(): SourceFile[]; ->getSourceFiles : () => SourceFile[] ->SourceFile : SourceFile - - getSourceFile(fileName: string): SourceFile; ->getSourceFile : (fileName: string) => SourceFile ->fileName : string ->SourceFile : SourceFile - } - interface TypeChecker { ->TypeChecker : TypeChecker - - getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; ->getTypeOfSymbolAtLocation : (symbol: Symbol, node: Node) => Type ->symbol : Symbol ->Symbol : Symbol ->node : Node ->Node : Node ->Type : Type - - getDeclaredTypeOfSymbol(symbol: Symbol): Type; ->getDeclaredTypeOfSymbol : (symbol: Symbol) => Type ->symbol : Symbol ->Symbol : Symbol ->Type : Type - - getPropertiesOfType(type: Type): Symbol[]; ->getPropertiesOfType : (type: Type) => Symbol[] ->type : Type ->Type : Type ->Symbol : Symbol - - getPropertyOfType(type: Type, propertyName: string): Symbol; ->getPropertyOfType : (type: Type, propertyName: string) => Symbol ->type : Type ->Type : Type ->propertyName : string ->Symbol : Symbol - - getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; ->getSignaturesOfType : (type: Type, kind: SignatureKind) => Signature[] ->type : Type ->Type : Type ->kind : SignatureKind ->SignatureKind : SignatureKind ->Signature : Signature - - getIndexTypeOfType(type: Type, kind: IndexKind): Type; ->getIndexTypeOfType : (type: Type, kind: IndexKind) => Type ->type : Type ->Type : Type ->kind : IndexKind ->IndexKind : IndexKind ->Type : Type - - getReturnTypeOfSignature(signature: Signature): Type; ->getReturnTypeOfSignature : (signature: Signature) => Type ->signature : Signature ->Signature : Signature ->Type : Type - - getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; ->getSymbolsInScope : (location: Node, meaning: SymbolFlags) => Symbol[] ->location : Node ->Node : Node ->meaning : SymbolFlags ->SymbolFlags : SymbolFlags ->Symbol : Symbol - - getSymbolAtLocation(node: Node): Symbol; ->getSymbolAtLocation : (node: Node) => Symbol ->node : Node ->Node : Node ->Symbol : Symbol - - getShorthandAssignmentValueSymbol(location: Node): Symbol; ->getShorthandAssignmentValueSymbol : (location: Node) => Symbol ->location : Node ->Node : Node ->Symbol : Symbol - - getTypeAtLocation(node: Node): Type; ->getTypeAtLocation : (node: Node) => Type ->node : Node ->Node : Node ->Type : Type - - typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; ->typeToString : (type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => string ->type : Type ->Type : Type ->enclosingDeclaration : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags - - symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; ->symbolToString : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => string ->symbol : Symbol ->Symbol : Symbol ->enclosingDeclaration : Node ->Node : Node ->meaning : SymbolFlags ->SymbolFlags : SymbolFlags - - getSymbolDisplayBuilder(): SymbolDisplayBuilder; ->getSymbolDisplayBuilder : () => SymbolDisplayBuilder ->SymbolDisplayBuilder : SymbolDisplayBuilder - - getFullyQualifiedName(symbol: Symbol): string; ->getFullyQualifiedName : (symbol: Symbol) => string ->symbol : Symbol ->Symbol : Symbol - - getAugmentedPropertiesOfType(type: Type): Symbol[]; ->getAugmentedPropertiesOfType : (type: Type) => Symbol[] ->type : Type ->Type : Type ->Symbol : Symbol - - getRootSymbols(symbol: Symbol): Symbol[]; ->getRootSymbols : (symbol: Symbol) => Symbol[] ->symbol : Symbol ->Symbol : Symbol ->Symbol : Symbol - - getContextualType(node: Expression): Type; ->getContextualType : (node: Expression) => Type ->node : Expression ->Expression : Expression ->Type : Type - - getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; ->getResolvedSignature : (node: CallExpression | NewExpression | TaggedTemplateExpression, candidatesOutArray?: Signature[]) => Signature ->node : CallExpression | NewExpression | TaggedTemplateExpression ->CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression ->candidatesOutArray : Signature[] ->Signature : Signature ->Signature : Signature - - getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; ->getSignatureFromDeclaration : (declaration: SignatureDeclaration) => Signature ->declaration : SignatureDeclaration ->SignatureDeclaration : SignatureDeclaration ->Signature : Signature - - isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; ->isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean ->node : FunctionLikeDeclaration ->FunctionLikeDeclaration : FunctionLikeDeclaration - - isUndefinedSymbol(symbol: Symbol): boolean; ->isUndefinedSymbol : (symbol: Symbol) => boolean ->symbol : Symbol ->Symbol : Symbol - - isArgumentsSymbol(symbol: Symbol): boolean; ->isArgumentsSymbol : (symbol: Symbol) => boolean ->symbol : Symbol ->Symbol : Symbol - - getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; ->getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number ->node : PropertyAccessExpression | ElementAccessExpression | EnumMember ->EnumMember : EnumMember ->PropertyAccessExpression : PropertyAccessExpression ->ElementAccessExpression : ElementAccessExpression - - isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; ->isValidPropertyAccess : (node: QualifiedName | PropertyAccessExpression, propertyName: string) => boolean ->node : QualifiedName | PropertyAccessExpression ->PropertyAccessExpression : PropertyAccessExpression ->QualifiedName : QualifiedName ->propertyName : string - - getAliasedSymbol(symbol: Symbol): Symbol; ->getAliasedSymbol : (symbol: Symbol) => Symbol ->symbol : Symbol ->Symbol : Symbol ->Symbol : Symbol - - getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; ->getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration ->Symbol : Symbol - } - interface SymbolDisplayBuilder { ->SymbolDisplayBuilder : SymbolDisplayBuilder - - buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; ->buildTypeDisplay : (type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void ->type : Type ->Type : Type ->writer : SymbolWriter ->SymbolWriter : SymbolWriter ->enclosingDeclaration : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags - - buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; ->buildSymbolDisplay : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags) => void ->symbol : Symbol ->Symbol : Symbol ->writer : SymbolWriter ->SymbolWriter : SymbolWriter ->enclosingDeclaration : Node ->Node : Node ->meaning : SymbolFlags ->SymbolFlags : SymbolFlags ->flags : SymbolFormatFlags ->SymbolFormatFlags : SymbolFormatFlags - - buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; ->buildSignatureDisplay : (signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void ->signatures : Signature ->Signature : Signature ->writer : SymbolWriter ->SymbolWriter : SymbolWriter ->enclosingDeclaration : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags - - buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; ->buildParameterDisplay : (parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void ->parameter : Symbol ->Symbol : Symbol ->writer : SymbolWriter ->SymbolWriter : SymbolWriter ->enclosingDeclaration : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags - - buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; ->buildTypeParameterDisplay : (tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void ->tp : TypeParameter ->TypeParameter : TypeParameter ->writer : SymbolWriter ->SymbolWriter : SymbolWriter ->enclosingDeclaration : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags - - buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; ->buildTypeParameterDisplayFromSymbol : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags) => void ->symbol : Symbol ->Symbol : Symbol ->writer : SymbolWriter ->SymbolWriter : SymbolWriter ->enclosingDeclaraiton : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags - - buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; ->buildDisplayForParametersAndDelimiters : (parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void ->parameters : Symbol[] ->Symbol : Symbol ->writer : SymbolWriter ->SymbolWriter : SymbolWriter ->enclosingDeclaration : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags - - buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; ->buildDisplayForTypeParametersAndDelimiters : (typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void ->typeParameters : TypeParameter[] ->TypeParameter : TypeParameter ->writer : SymbolWriter ->SymbolWriter : SymbolWriter ->enclosingDeclaration : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags - - buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; ->buildReturnTypeDisplay : (signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void ->signature : Signature ->Signature : Signature ->writer : SymbolWriter ->SymbolWriter : SymbolWriter ->enclosingDeclaration : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags - } - interface SymbolWriter { ->SymbolWriter : SymbolWriter - - writeKeyword(text: string): void; ->writeKeyword : (text: string) => void ->text : string - - writeOperator(text: string): void; ->writeOperator : (text: string) => void ->text : string - - writePunctuation(text: string): void; ->writePunctuation : (text: string) => void ->text : string - - writeSpace(text: string): void; ->writeSpace : (text: string) => void ->text : string - - writeStringLiteral(text: string): void; ->writeStringLiteral : (text: string) => void ->text : string - - writeParameter(text: string): void; ->writeParameter : (text: string) => void ->text : string - - writeSymbol(text: string, symbol: Symbol): void; ->writeSymbol : (text: string, symbol: Symbol) => void ->text : string ->symbol : Symbol ->Symbol : Symbol - - writeLine(): void; ->writeLine : () => void - - increaseIndent(): void; ->increaseIndent : () => void - - decreaseIndent(): void; ->decreaseIndent : () => void - - clear(): void; ->clear : () => void - - trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; ->trackSymbol : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => void ->symbol : Symbol ->Symbol : Symbol ->enclosingDeclaration : Node ->Node : Node ->meaning : SymbolFlags ->SymbolFlags : SymbolFlags - } - const enum TypeFormatFlags { ->TypeFormatFlags : TypeFormatFlags - - None = 0, ->None : TypeFormatFlags - - WriteArrayAsGenericType = 1, ->WriteArrayAsGenericType : TypeFormatFlags - - UseTypeOfFunction = 2, ->UseTypeOfFunction : TypeFormatFlags - - NoTruncation = 4, ->NoTruncation : TypeFormatFlags - - WriteArrowStyleSignature = 8, ->WriteArrowStyleSignature : TypeFormatFlags - - WriteOwnNameForAnyLike = 16, ->WriteOwnNameForAnyLike : TypeFormatFlags - - WriteTypeArgumentsOfSignature = 32, ->WriteTypeArgumentsOfSignature : TypeFormatFlags - - InElementType = 64, ->InElementType : TypeFormatFlags - - UseFullyQualifiedType = 128, ->UseFullyQualifiedType : TypeFormatFlags - } - const enum SymbolFormatFlags { ->SymbolFormatFlags : SymbolFormatFlags - - None = 0, ->None : SymbolFormatFlags - - WriteTypeParametersOrArguments = 1, ->WriteTypeParametersOrArguments : SymbolFormatFlags - - UseOnlyExternalAliasing = 2, ->UseOnlyExternalAliasing : SymbolFormatFlags - } - const enum SymbolAccessibility { ->SymbolAccessibility : SymbolAccessibility - - Accessible = 0, ->Accessible : SymbolAccessibility - - NotAccessible = 1, ->NotAccessible : SymbolAccessibility - - CannotBeNamed = 2, ->CannotBeNamed : SymbolAccessibility - } - type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration; ->AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration ->ImportDeclaration : ImportDeclaration ->ImportEqualsDeclaration : ImportEqualsDeclaration - - interface SymbolVisibilityResult { ->SymbolVisibilityResult : SymbolVisibilityResult - - accessibility: SymbolAccessibility; ->accessibility : SymbolAccessibility ->SymbolAccessibility : SymbolAccessibility - - aliasesToMakeVisible?: AnyImportSyntax[]; ->aliasesToMakeVisible : (ImportEqualsDeclaration | ImportDeclaration)[] ->AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration - - errorSymbolName?: string; ->errorSymbolName : string - - errorNode?: Node; ->errorNode : Node ->Node : Node - } - interface SymbolAccessiblityResult extends SymbolVisibilityResult { ->SymbolAccessiblityResult : SymbolAccessiblityResult ->SymbolVisibilityResult : SymbolVisibilityResult - - errorModuleName?: string; ->errorModuleName : string - } - interface EmitResolver { ->EmitResolver : EmitResolver - - hasGlobalName(name: string): boolean; ->hasGlobalName : (name: string) => boolean ->name : string - - getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string; ->getExpressionNameSubstitution : (node: Identifier, getGeneratedNameForNode: (node: Node) => string) => string ->node : Identifier ->Identifier : Identifier ->getGeneratedNameForNode : (node: Node) => string ->node : Node ->Node : Node - - isValueAliasDeclaration(node: Node): boolean; ->isValueAliasDeclaration : (node: Node) => boolean ->node : Node ->Node : Node - - isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean; ->isReferencedAliasDeclaration : (node: Node, checkChildren?: boolean) => boolean ->node : Node ->Node : Node ->checkChildren : boolean - - isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; ->isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean ->node : ImportEqualsDeclaration ->ImportEqualsDeclaration : ImportEqualsDeclaration - - getNodeCheckFlags(node: Node): NodeCheckFlags; ->getNodeCheckFlags : (node: Node) => NodeCheckFlags ->node : Node ->Node : Node ->NodeCheckFlags : NodeCheckFlags - - isDeclarationVisible(node: Declaration): boolean; ->isDeclarationVisible : (node: Declaration) => boolean ->node : Declaration ->Declaration : Declaration - - collectLinkedAliases(node: Identifier): Node[]; ->collectLinkedAliases : (node: Identifier) => Node[] ->node : Identifier ->Identifier : Identifier ->Node : Node - - isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; ->isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean ->node : FunctionLikeDeclaration ->FunctionLikeDeclaration : FunctionLikeDeclaration - - writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; ->writeTypeOfDeclaration : (declaration: VariableLikeDeclaration | AccessorDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void ->declaration : VariableLikeDeclaration | AccessorDeclaration ->AccessorDeclaration : AccessorDeclaration ->VariableLikeDeclaration : VariableLikeDeclaration ->enclosingDeclaration : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags ->writer : SymbolWriter ->SymbolWriter : SymbolWriter - - writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; ->writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void ->signatureDeclaration : SignatureDeclaration ->SignatureDeclaration : SignatureDeclaration ->enclosingDeclaration : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags ->writer : SymbolWriter ->SymbolWriter : SymbolWriter - - writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; ->writeTypeOfExpression : (expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void ->expr : Expression ->Expression : Expression ->enclosingDeclaration : Node ->Node : Node ->flags : TypeFormatFlags ->TypeFormatFlags : TypeFormatFlags ->writer : SymbolWriter ->SymbolWriter : SymbolWriter - - isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; ->isSymbolAccessible : (symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) => SymbolAccessiblityResult ->symbol : Symbol ->Symbol : Symbol ->enclosingDeclaration : Node ->Node : Node ->meaning : SymbolFlags ->SymbolFlags : SymbolFlags ->SymbolAccessiblityResult : SymbolAccessiblityResult - - isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; ->isEntityNameVisible : (entityName: Expression | Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult ->entityName : Expression | Identifier | QualifiedName ->EntityName : Identifier | QualifiedName ->Expression : Expression ->enclosingDeclaration : Node ->Node : Node ->SymbolVisibilityResult : SymbolVisibilityResult - - getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; ->getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number ->node : PropertyAccessExpression | ElementAccessExpression | EnumMember ->EnumMember : EnumMember ->PropertyAccessExpression : PropertyAccessExpression ->ElementAccessExpression : ElementAccessExpression - - resolvesToSomeValue(location: Node, name: string): boolean; ->resolvesToSomeValue : (location: Node, name: string) => boolean ->location : Node ->Node : Node ->name : string - - getBlockScopedVariableId(node: Identifier): number; ->getBlockScopedVariableId : (node: Identifier) => number ->node : Identifier ->Identifier : Identifier - } - const enum SymbolFlags { ->SymbolFlags : SymbolFlags - - FunctionScopedVariable = 1, ->FunctionScopedVariable : SymbolFlags - - BlockScopedVariable = 2, ->BlockScopedVariable : SymbolFlags - - Property = 4, ->Property : SymbolFlags - - EnumMember = 8, ->EnumMember : SymbolFlags - - Function = 16, ->Function : SymbolFlags - - Class = 32, ->Class : SymbolFlags - - Interface = 64, ->Interface : SymbolFlags - - ConstEnum = 128, ->ConstEnum : SymbolFlags - - RegularEnum = 256, ->RegularEnum : SymbolFlags - - ValueModule = 512, ->ValueModule : SymbolFlags - - NamespaceModule = 1024, ->NamespaceModule : SymbolFlags - - TypeLiteral = 2048, ->TypeLiteral : SymbolFlags - - ObjectLiteral = 4096, ->ObjectLiteral : SymbolFlags - - Method = 8192, ->Method : SymbolFlags - - Constructor = 16384, ->Constructor : SymbolFlags - - GetAccessor = 32768, ->GetAccessor : SymbolFlags - - SetAccessor = 65536, ->SetAccessor : SymbolFlags - - Signature = 131072, ->Signature : SymbolFlags - - TypeParameter = 262144, ->TypeParameter : SymbolFlags - - TypeAlias = 524288, ->TypeAlias : SymbolFlags - - ExportValue = 1048576, ->ExportValue : SymbolFlags - - ExportType = 2097152, ->ExportType : SymbolFlags - - ExportNamespace = 4194304, ->ExportNamespace : SymbolFlags - - Alias = 8388608, ->Alias : SymbolFlags - - Instantiated = 16777216, ->Instantiated : SymbolFlags - - Merged = 33554432, ->Merged : SymbolFlags - - Transient = 67108864, ->Transient : SymbolFlags - - Prototype = 134217728, ->Prototype : SymbolFlags - - UnionProperty = 268435456, ->UnionProperty : SymbolFlags - - Optional = 536870912, ->Optional : SymbolFlags - - ExportStar = 1073741824, ->ExportStar : SymbolFlags - - Enum = 384, ->Enum : SymbolFlags - - Variable = 3, ->Variable : SymbolFlags - - Value = 107455, ->Value : SymbolFlags - - Type = 793056, ->Type : SymbolFlags - - Namespace = 1536, ->Namespace : SymbolFlags - - Module = 1536, ->Module : SymbolFlags - - Accessor = 98304, ->Accessor : SymbolFlags - - FunctionScopedVariableExcludes = 107454, ->FunctionScopedVariableExcludes : SymbolFlags - - BlockScopedVariableExcludes = 107455, ->BlockScopedVariableExcludes : SymbolFlags - - ParameterExcludes = 107455, ->ParameterExcludes : SymbolFlags - - PropertyExcludes = 107455, ->PropertyExcludes : SymbolFlags - - EnumMemberExcludes = 107455, ->EnumMemberExcludes : SymbolFlags - - FunctionExcludes = 106927, ->FunctionExcludes : SymbolFlags - - ClassExcludes = 899583, ->ClassExcludes : SymbolFlags - - InterfaceExcludes = 792992, ->InterfaceExcludes : SymbolFlags - - RegularEnumExcludes = 899327, ->RegularEnumExcludes : SymbolFlags - - ConstEnumExcludes = 899967, ->ConstEnumExcludes : SymbolFlags - - ValueModuleExcludes = 106639, ->ValueModuleExcludes : SymbolFlags - - NamespaceModuleExcludes = 0, ->NamespaceModuleExcludes : SymbolFlags - - MethodExcludes = 99263, ->MethodExcludes : SymbolFlags - - GetAccessorExcludes = 41919, ->GetAccessorExcludes : SymbolFlags - - SetAccessorExcludes = 74687, ->SetAccessorExcludes : SymbolFlags - - TypeParameterExcludes = 530912, ->TypeParameterExcludes : SymbolFlags - - TypeAliasExcludes = 793056, ->TypeAliasExcludes : SymbolFlags - - AliasExcludes = 8388608, ->AliasExcludes : SymbolFlags - - ModuleMember = 8914931, ->ModuleMember : SymbolFlags - - ExportHasLocal = 944, ->ExportHasLocal : SymbolFlags - - HasLocals = 255504, ->HasLocals : SymbolFlags - - HasExports = 1952, ->HasExports : SymbolFlags - - HasMembers = 6240, ->HasMembers : SymbolFlags - - IsContainer = 262128, ->IsContainer : SymbolFlags - - PropertyOrAccessor = 98308, ->PropertyOrAccessor : SymbolFlags - - Export = 7340032, ->Export : SymbolFlags - } - interface Symbol { ->Symbol : Symbol - - flags: SymbolFlags; ->flags : SymbolFlags ->SymbolFlags : SymbolFlags - - name: string; ->name : string - - id?: number; ->id : number - - mergeId?: number; ->mergeId : number - - declarations?: Declaration[]; ->declarations : Declaration[] ->Declaration : Declaration - - parent?: Symbol; ->parent : Symbol ->Symbol : Symbol - - members?: SymbolTable; ->members : SymbolTable ->SymbolTable : SymbolTable - - exports?: SymbolTable; ->exports : SymbolTable ->SymbolTable : SymbolTable - - exportSymbol?: Symbol; ->exportSymbol : Symbol ->Symbol : Symbol - - valueDeclaration?: Declaration; ->valueDeclaration : Declaration ->Declaration : Declaration - - constEnumOnlyModule?: boolean; ->constEnumOnlyModule : boolean - } - interface SymbolLinks { ->SymbolLinks : SymbolLinks - - target?: Symbol; ->target : Symbol ->Symbol : Symbol - - type?: Type; ->type : Type ->Type : Type - - declaredType?: Type; ->declaredType : Type ->Type : Type - - mapper?: TypeMapper; ->mapper : TypeMapper ->TypeMapper : TypeMapper - - referenced?: boolean; ->referenced : boolean - - unionType?: UnionType; ->unionType : UnionType ->UnionType : UnionType - - resolvedExports?: SymbolTable; ->resolvedExports : SymbolTable ->SymbolTable : SymbolTable - - exportsChecked?: boolean; ->exportsChecked : boolean - } - interface TransientSymbol extends Symbol, SymbolLinks { ->TransientSymbol : TransientSymbol ->Symbol : Symbol ->SymbolLinks : SymbolLinks - } - interface SymbolTable { ->SymbolTable : SymbolTable - - [index: string]: Symbol; ->index : string ->Symbol : Symbol - } - const enum NodeCheckFlags { ->NodeCheckFlags : NodeCheckFlags - - TypeChecked = 1, ->TypeChecked : NodeCheckFlags - - LexicalThis = 2, ->LexicalThis : NodeCheckFlags - - CaptureThis = 4, ->CaptureThis : NodeCheckFlags - - EmitExtends = 8, ->EmitExtends : NodeCheckFlags - - SuperInstance = 16, ->SuperInstance : NodeCheckFlags - - SuperStatic = 32, ->SuperStatic : NodeCheckFlags - - ContextChecked = 64, ->ContextChecked : NodeCheckFlags - - EnumValuesComputed = 128, ->EnumValuesComputed : NodeCheckFlags - - BlockScopedBindingInLoop = 256, ->BlockScopedBindingInLoop : NodeCheckFlags - - EmitDecorate = 512, ->EmitDecorate : NodeCheckFlags - } - interface NodeLinks { ->NodeLinks : NodeLinks - - resolvedType?: Type; ->resolvedType : Type ->Type : Type - - resolvedSignature?: Signature; ->resolvedSignature : Signature ->Signature : Signature - - resolvedSymbol?: Symbol; ->resolvedSymbol : Symbol ->Symbol : Symbol - - flags?: NodeCheckFlags; ->flags : NodeCheckFlags ->NodeCheckFlags : NodeCheckFlags - - enumMemberValue?: number; ->enumMemberValue : number - - isIllegalTypeReferenceInConstraint?: boolean; ->isIllegalTypeReferenceInConstraint : boolean - - isVisible?: boolean; ->isVisible : boolean - - generatedName?: string; ->generatedName : string - - generatedNames?: Map; ->generatedNames : Map ->Map : Map - - assignmentChecks?: Map; ->assignmentChecks : Map ->Map : Map - - hasReportedStatementInAmbientContext?: boolean; ->hasReportedStatementInAmbientContext : boolean - - importOnRightSide?: Symbol; ->importOnRightSide : Symbol ->Symbol : Symbol - } - const enum TypeFlags { ->TypeFlags : TypeFlags - - Any = 1, ->Any : TypeFlags - - String = 2, ->String : TypeFlags - - Number = 4, ->Number : TypeFlags - - Boolean = 8, ->Boolean : TypeFlags - - Void = 16, ->Void : TypeFlags - - Undefined = 32, ->Undefined : TypeFlags - - Null = 64, ->Null : TypeFlags - - Enum = 128, ->Enum : TypeFlags - - StringLiteral = 256, ->StringLiteral : TypeFlags - - TypeParameter = 512, ->TypeParameter : TypeFlags - - Class = 1024, ->Class : TypeFlags - - Interface = 2048, ->Interface : TypeFlags - - Reference = 4096, ->Reference : TypeFlags - - Tuple = 8192, ->Tuple : TypeFlags - - Union = 16384, ->Union : TypeFlags - - Anonymous = 32768, ->Anonymous : TypeFlags - - FromSignature = 65536, ->FromSignature : TypeFlags - - ObjectLiteral = 131072, ->ObjectLiteral : TypeFlags - - ContainsUndefinedOrNull = 262144, ->ContainsUndefinedOrNull : TypeFlags - - ContainsObjectLiteral = 524288, ->ContainsObjectLiteral : TypeFlags - - ESSymbol = 1048576, ->ESSymbol : TypeFlags - - Intrinsic = 1048703, ->Intrinsic : TypeFlags - - Primitive = 1049086, ->Primitive : TypeFlags - - StringLike = 258, ->StringLike : TypeFlags - - NumberLike = 132, ->NumberLike : TypeFlags - - ObjectType = 48128, ->ObjectType : TypeFlags - - RequiresWidening = 786432, ->RequiresWidening : TypeFlags - } - interface Type { ->Type : Type - - flags: TypeFlags; ->flags : TypeFlags ->TypeFlags : TypeFlags - - id: number; ->id : number - - symbol?: Symbol; ->symbol : Symbol ->Symbol : Symbol - } - interface IntrinsicType extends Type { ->IntrinsicType : IntrinsicType ->Type : Type - - intrinsicName: string; ->intrinsicName : string - } - interface StringLiteralType extends Type { ->StringLiteralType : StringLiteralType ->Type : Type - - text: string; ->text : string - } - interface ObjectType extends Type { ->ObjectType : ObjectType ->Type : Type - } - interface InterfaceType extends ObjectType { ->InterfaceType : InterfaceType ->ObjectType : ObjectType - - typeParameters: TypeParameter[]; ->typeParameters : TypeParameter[] ->TypeParameter : TypeParameter - - baseTypes: ObjectType[]; ->baseTypes : ObjectType[] ->ObjectType : ObjectType - - declaredProperties: Symbol[]; ->declaredProperties : Symbol[] ->Symbol : Symbol - - declaredCallSignatures: Signature[]; ->declaredCallSignatures : Signature[] ->Signature : Signature - - declaredConstructSignatures: Signature[]; ->declaredConstructSignatures : Signature[] ->Signature : Signature - - declaredStringIndexType: Type; ->declaredStringIndexType : Type ->Type : Type - - declaredNumberIndexType: Type; ->declaredNumberIndexType : Type ->Type : Type - } - interface TypeReference extends ObjectType { ->TypeReference : TypeReference ->ObjectType : ObjectType - - target: GenericType; ->target : GenericType ->GenericType : GenericType - - typeArguments: Type[]; ->typeArguments : Type[] ->Type : Type - } - interface GenericType extends InterfaceType, TypeReference { ->GenericType : GenericType ->InterfaceType : InterfaceType ->TypeReference : TypeReference - - instantiations: Map; ->instantiations : Map ->Map : Map ->TypeReference : TypeReference - } - interface TupleType extends ObjectType { ->TupleType : TupleType ->ObjectType : ObjectType - - elementTypes: Type[]; ->elementTypes : Type[] ->Type : Type - - baseArrayType: TypeReference; ->baseArrayType : TypeReference ->TypeReference : TypeReference - } - interface UnionType extends Type { ->UnionType : UnionType ->Type : Type - - types: Type[]; ->types : Type[] ->Type : Type - - resolvedProperties: SymbolTable; ->resolvedProperties : SymbolTable ->SymbolTable : SymbolTable - } - interface ResolvedType extends ObjectType, UnionType { ->ResolvedType : ResolvedType ->ObjectType : ObjectType ->UnionType : UnionType - - members: SymbolTable; ->members : SymbolTable ->SymbolTable : SymbolTable - - properties: Symbol[]; ->properties : Symbol[] ->Symbol : Symbol - - callSignatures: Signature[]; ->callSignatures : Signature[] ->Signature : Signature - - constructSignatures: Signature[]; ->constructSignatures : Signature[] ->Signature : Signature - - stringIndexType: Type; ->stringIndexType : Type ->Type : Type - - numberIndexType: Type; ->numberIndexType : Type ->Type : Type - } - interface TypeParameter extends Type { ->TypeParameter : TypeParameter ->Type : Type - - constraint: Type; ->constraint : Type ->Type : Type - - target?: TypeParameter; ->target : TypeParameter ->TypeParameter : TypeParameter - - mapper?: TypeMapper; ->mapper : TypeMapper ->TypeMapper : TypeMapper - } - const enum SignatureKind { ->SignatureKind : SignatureKind - - Call = 0, ->Call : SignatureKind - - Construct = 1, ->Construct : SignatureKind - } - interface Signature { ->Signature : Signature - - declaration: SignatureDeclaration; ->declaration : SignatureDeclaration ->SignatureDeclaration : SignatureDeclaration - - typeParameters: TypeParameter[]; ->typeParameters : TypeParameter[] ->TypeParameter : TypeParameter - - parameters: Symbol[]; ->parameters : Symbol[] ->Symbol : Symbol - - resolvedReturnType: Type; ->resolvedReturnType : Type ->Type : Type - - minArgumentCount: number; ->minArgumentCount : number - - hasRestParameter: boolean; ->hasRestParameter : boolean - - hasStringLiterals: boolean; ->hasStringLiterals : boolean - - target?: Signature; ->target : Signature ->Signature : Signature - - mapper?: TypeMapper; ->mapper : TypeMapper ->TypeMapper : TypeMapper - - unionSignatures?: Signature[]; ->unionSignatures : Signature[] ->Signature : Signature - - erasedSignatureCache?: Signature; ->erasedSignatureCache : Signature ->Signature : Signature - - isolatedSignatureType?: ObjectType; ->isolatedSignatureType : ObjectType ->ObjectType : ObjectType - } - const enum IndexKind { ->IndexKind : IndexKind - - String = 0, ->String : IndexKind - - Number = 1, ->Number : IndexKind - } - interface TypeMapper { ->TypeMapper : TypeMapper - - (t: Type): Type; ->t : Type ->Type : Type ->Type : Type - } - interface DiagnosticMessage { ->DiagnosticMessage : DiagnosticMessage - - key: string; ->key : string - - category: DiagnosticCategory; ->category : DiagnosticCategory ->DiagnosticCategory : DiagnosticCategory - - code: number; ->code : number - } - interface DiagnosticMessageChain { ->DiagnosticMessageChain : DiagnosticMessageChain - - messageText: string; ->messageText : string - - category: DiagnosticCategory; ->category : DiagnosticCategory ->DiagnosticCategory : DiagnosticCategory - - code: number; ->code : number - - next?: DiagnosticMessageChain; ->next : DiagnosticMessageChain ->DiagnosticMessageChain : DiagnosticMessageChain - } - interface Diagnostic { ->Diagnostic : Diagnostic - - file: SourceFile; ->file : SourceFile ->SourceFile : SourceFile - - start: number; ->start : number - - length: number; ->length : number - - messageText: string | DiagnosticMessageChain; ->messageText : string | DiagnosticMessageChain ->DiagnosticMessageChain : DiagnosticMessageChain - - category: DiagnosticCategory; ->category : DiagnosticCategory ->DiagnosticCategory : DiagnosticCategory - - code: number; ->code : number - } - enum DiagnosticCategory { ->DiagnosticCategory : DiagnosticCategory - - Warning = 0, ->Warning : DiagnosticCategory - - Error = 1, ->Error : DiagnosticCategory - - Message = 2, ->Message : DiagnosticCategory - } - interface CompilerOptions { ->CompilerOptions : CompilerOptions - - allowNonTsExtensions?: boolean; ->allowNonTsExtensions : boolean - - charset?: string; ->charset : string - - codepage?: number; ->codepage : number - - declaration?: boolean; ->declaration : boolean - - diagnostics?: boolean; ->diagnostics : boolean - - emitBOM?: boolean; ->emitBOM : boolean - - help?: boolean; ->help : boolean - - listFiles?: boolean; ->listFiles : boolean - - locale?: string; ->locale : string - - mapRoot?: string; ->mapRoot : string - - module?: ModuleKind; ->module : ModuleKind ->ModuleKind : ModuleKind - - noEmit?: boolean; ->noEmit : boolean - - noEmitOnError?: boolean; ->noEmitOnError : boolean - - noErrorTruncation?: boolean; ->noErrorTruncation : boolean - - noImplicitAny?: boolean; ->noImplicitAny : boolean - - noLib?: boolean; ->noLib : boolean - - noLibCheck?: boolean; ->noLibCheck : boolean - - noResolve?: boolean; ->noResolve : boolean - - out?: string; ->out : string - - outDir?: string; ->outDir : string - - preserveConstEnums?: boolean; ->preserveConstEnums : boolean - - project?: string; ->project : string - - removeComments?: boolean; ->removeComments : boolean - - sourceMap?: boolean; ->sourceMap : boolean - - sourceRoot?: string; ->sourceRoot : string - - suppressImplicitAnyIndexErrors?: boolean; ->suppressImplicitAnyIndexErrors : boolean - - target?: ScriptTarget; ->target : ScriptTarget ->ScriptTarget : ScriptTarget - - version?: boolean; ->version : boolean - - watch?: boolean; ->watch : boolean - - [option: string]: string | number | boolean; ->option : string - } - const enum ModuleKind { ->ModuleKind : ModuleKind - - None = 0, ->None : ModuleKind - - CommonJS = 1, ->CommonJS : ModuleKind - - AMD = 2, ->AMD : ModuleKind - } - interface LineAndCharacter { ->LineAndCharacter : LineAndCharacter - - line: number; ->line : number - - character: number; ->character : number - } - const enum ScriptTarget { ->ScriptTarget : ScriptTarget - - ES3 = 0, ->ES3 : ScriptTarget - - ES5 = 1, ->ES5 : ScriptTarget - - ES6 = 2, ->ES6 : ScriptTarget - - Latest = 2, ->Latest : ScriptTarget - } - interface ParsedCommandLine { ->ParsedCommandLine : ParsedCommandLine - - options: CompilerOptions; ->options : CompilerOptions ->CompilerOptions : CompilerOptions - - fileNames: string[]; ->fileNames : string[] - - errors: Diagnostic[]; ->errors : Diagnostic[] ->Diagnostic : Diagnostic - } - interface CommandLineOption { ->CommandLineOption : CommandLineOption - - name: string; ->name : string - - type: string | Map; ->type : string | Map ->Map : Map - - isFilePath?: boolean; ->isFilePath : boolean - - shortName?: string; ->shortName : string - - description?: DiagnosticMessage; ->description : DiagnosticMessage ->DiagnosticMessage : DiagnosticMessage - - paramType?: DiagnosticMessage; ->paramType : DiagnosticMessage ->DiagnosticMessage : DiagnosticMessage - - error?: DiagnosticMessage; ->error : DiagnosticMessage ->DiagnosticMessage : DiagnosticMessage - - experimental?: boolean; ->experimental : boolean - } - const enum CharacterCodes { ->CharacterCodes : CharacterCodes - - nullCharacter = 0, ->nullCharacter : CharacterCodes - - maxAsciiCharacter = 127, ->maxAsciiCharacter : CharacterCodes - - lineFeed = 10, ->lineFeed : CharacterCodes - - carriageReturn = 13, ->carriageReturn : CharacterCodes - - lineSeparator = 8232, ->lineSeparator : CharacterCodes - - paragraphSeparator = 8233, ->paragraphSeparator : CharacterCodes - - nextLine = 133, ->nextLine : CharacterCodes - - space = 32, ->space : CharacterCodes - - nonBreakingSpace = 160, ->nonBreakingSpace : CharacterCodes - - enQuad = 8192, ->enQuad : CharacterCodes - - emQuad = 8193, ->emQuad : CharacterCodes - - enSpace = 8194, ->enSpace : CharacterCodes - - emSpace = 8195, ->emSpace : CharacterCodes - - threePerEmSpace = 8196, ->threePerEmSpace : CharacterCodes - - fourPerEmSpace = 8197, ->fourPerEmSpace : CharacterCodes - - sixPerEmSpace = 8198, ->sixPerEmSpace : CharacterCodes - - figureSpace = 8199, ->figureSpace : CharacterCodes - - punctuationSpace = 8200, ->punctuationSpace : CharacterCodes - - thinSpace = 8201, ->thinSpace : CharacterCodes - - hairSpace = 8202, ->hairSpace : CharacterCodes - - zeroWidthSpace = 8203, ->zeroWidthSpace : CharacterCodes - - narrowNoBreakSpace = 8239, ->narrowNoBreakSpace : CharacterCodes - - ideographicSpace = 12288, ->ideographicSpace : CharacterCodes - - mathematicalSpace = 8287, ->mathematicalSpace : CharacterCodes - - ogham = 5760, ->ogham : CharacterCodes - - _ = 95, ->_ : CharacterCodes - - $ = 36, ->$ : CharacterCodes - - _0 = 48, ->_0 : CharacterCodes - - _1 = 49, ->_1 : CharacterCodes - - _2 = 50, ->_2 : CharacterCodes - - _3 = 51, ->_3 : CharacterCodes - - _4 = 52, ->_4 : CharacterCodes - - _5 = 53, ->_5 : CharacterCodes - - _6 = 54, ->_6 : CharacterCodes - - _7 = 55, ->_7 : CharacterCodes - - _8 = 56, ->_8 : CharacterCodes - - _9 = 57, ->_9 : CharacterCodes - - a = 97, ->a : CharacterCodes - - b = 98, ->b : CharacterCodes - - c = 99, ->c : CharacterCodes - - d = 100, ->d : CharacterCodes - - e = 101, ->e : CharacterCodes - - f = 102, ->f : CharacterCodes - - g = 103, ->g : CharacterCodes - - h = 104, ->h : CharacterCodes - - i = 105, ->i : CharacterCodes - - j = 106, ->j : CharacterCodes - - k = 107, ->k : CharacterCodes - - l = 108, ->l : CharacterCodes - - m = 109, ->m : CharacterCodes - - n = 110, ->n : CharacterCodes - - o = 111, ->o : CharacterCodes - - p = 112, ->p : CharacterCodes - - q = 113, ->q : CharacterCodes - - r = 114, ->r : CharacterCodes - - s = 115, ->s : CharacterCodes - - t = 116, ->t : CharacterCodes - - u = 117, ->u : CharacterCodes - - v = 118, ->v : CharacterCodes - - w = 119, ->w : CharacterCodes - - x = 120, ->x : CharacterCodes - - y = 121, ->y : CharacterCodes - - z = 122, ->z : CharacterCodes - - A = 65, ->A : CharacterCodes - - B = 66, ->B : CharacterCodes - - C = 67, ->C : CharacterCodes - - D = 68, ->D : CharacterCodes - - E = 69, ->E : CharacterCodes - - F = 70, ->F : CharacterCodes - - G = 71, ->G : CharacterCodes - - H = 72, ->H : CharacterCodes - - I = 73, ->I : CharacterCodes - - J = 74, ->J : CharacterCodes - - K = 75, ->K : CharacterCodes - - L = 76, ->L : CharacterCodes - - M = 77, ->M : CharacterCodes - - N = 78, ->N : CharacterCodes - - O = 79, ->O : CharacterCodes - - P = 80, ->P : CharacterCodes - - Q = 81, ->Q : CharacterCodes - - R = 82, ->R : CharacterCodes - - S = 83, ->S : CharacterCodes - - T = 84, ->T : CharacterCodes - - U = 85, ->U : CharacterCodes - - V = 86, ->V : CharacterCodes - - W = 87, ->W : CharacterCodes - - X = 88, ->X : CharacterCodes - - Y = 89, ->Y : CharacterCodes - - Z = 90, ->Z : CharacterCodes - - ampersand = 38, ->ampersand : CharacterCodes - - asterisk = 42, ->asterisk : CharacterCodes - - at = 64, ->at : CharacterCodes - - backslash = 92, ->backslash : CharacterCodes - - backtick = 96, ->backtick : CharacterCodes - - bar = 124, ->bar : CharacterCodes - - caret = 94, ->caret : CharacterCodes - - closeBrace = 125, ->closeBrace : CharacterCodes - - closeBracket = 93, ->closeBracket : CharacterCodes - - closeParen = 41, ->closeParen : CharacterCodes - - colon = 58, ->colon : CharacterCodes - - comma = 44, ->comma : CharacterCodes - - dot = 46, ->dot : CharacterCodes - - doubleQuote = 34, ->doubleQuote : CharacterCodes - - equals = 61, ->equals : CharacterCodes - - exclamation = 33, ->exclamation : CharacterCodes - - greaterThan = 62, ->greaterThan : CharacterCodes - - hash = 35, ->hash : CharacterCodes - - lessThan = 60, ->lessThan : CharacterCodes - - minus = 45, ->minus : CharacterCodes - - openBrace = 123, ->openBrace : CharacterCodes - - openBracket = 91, ->openBracket : CharacterCodes - - openParen = 40, ->openParen : CharacterCodes - - percent = 37, ->percent : CharacterCodes - - plus = 43, ->plus : CharacterCodes - - question = 63, ->question : CharacterCodes - - semicolon = 59, ->semicolon : CharacterCodes - - singleQuote = 39, ->singleQuote : CharacterCodes - - slash = 47, ->slash : CharacterCodes - - tilde = 126, ->tilde : CharacterCodes - - backspace = 8, ->backspace : CharacterCodes - - formFeed = 12, ->formFeed : CharacterCodes - - byteOrderMark = 65279, ->byteOrderMark : CharacterCodes - - tab = 9, ->tab : CharacterCodes - - verticalTab = 11, ->verticalTab : CharacterCodes - } - interface CancellationToken { ->CancellationToken : CancellationToken - - isCancellationRequested(): boolean; ->isCancellationRequested : () => boolean - } - interface CompilerHost { ->CompilerHost : CompilerHost - - getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; ->getSourceFile : (fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile ->fileName : string ->languageVersion : ScriptTarget ->ScriptTarget : ScriptTarget ->onError : (message: string) => void ->message : string ->SourceFile : SourceFile - - getDefaultLibFileName(options: CompilerOptions): string; ->getDefaultLibFileName : (options: CompilerOptions) => string ->options : CompilerOptions ->CompilerOptions : CompilerOptions - - getCancellationToken?(): CancellationToken; ->getCancellationToken : () => CancellationToken ->CancellationToken : CancellationToken - - writeFile: WriteFileCallback; ->writeFile : WriteFileCallback ->WriteFileCallback : WriteFileCallback - - getCurrentDirectory(): string; ->getCurrentDirectory : () => string - - getCanonicalFileName(fileName: string): string; ->getCanonicalFileName : (fileName: string) => string ->fileName : string - - useCaseSensitiveFileNames(): boolean; ->useCaseSensitiveFileNames : () => boolean - - getNewLine(): string; ->getNewLine : () => string - } - interface TextSpan { ->TextSpan : TextSpan - - start: number; ->start : number - - length: number; ->length : number - } - interface TextChangeRange { ->TextChangeRange : TextChangeRange - - span: TextSpan; ->span : TextSpan ->TextSpan : TextSpan - - newLength: number; ->newLength : number - } -} -declare module "typescript" { - interface ErrorCallback { ->ErrorCallback : ErrorCallback - - (message: DiagnosticMessage, length: number): void; ->message : DiagnosticMessage ->DiagnosticMessage : DiagnosticMessage ->length : number - } - interface Scanner { ->Scanner : Scanner - - getStartPos(): number; ->getStartPos : () => number - - getToken(): SyntaxKind; ->getToken : () => SyntaxKind ->SyntaxKind : SyntaxKind - - getTextPos(): number; ->getTextPos : () => number - - getTokenPos(): number; ->getTokenPos : () => number - - getTokenText(): string; ->getTokenText : () => string - - getTokenValue(): string; ->getTokenValue : () => string - - hasExtendedUnicodeEscape(): boolean; ->hasExtendedUnicodeEscape : () => boolean - - hasPrecedingLineBreak(): boolean; ->hasPrecedingLineBreak : () => boolean - - isIdentifier(): boolean; ->isIdentifier : () => boolean - - isReservedWord(): boolean; ->isReservedWord : () => boolean - - isUnterminated(): boolean; ->isUnterminated : () => boolean - - reScanGreaterToken(): SyntaxKind; ->reScanGreaterToken : () => SyntaxKind ->SyntaxKind : SyntaxKind - - reScanSlashToken(): SyntaxKind; ->reScanSlashToken : () => SyntaxKind ->SyntaxKind : SyntaxKind - - reScanTemplateToken(): SyntaxKind; ->reScanTemplateToken : () => SyntaxKind ->SyntaxKind : SyntaxKind - - scan(): SyntaxKind; ->scan : () => SyntaxKind ->SyntaxKind : SyntaxKind - - setText(text: string): void; ->setText : (text: string) => void ->text : string - - setTextPos(textPos: number): void; ->setTextPos : (textPos: number) => void ->textPos : number - - lookAhead(callback: () => T): T; ->lookAhead : (callback: () => T) => T ->T : T ->callback : () => T ->T : T ->T : T - - tryScan(callback: () => T): T; ->tryScan : (callback: () => T) => T ->T : T ->callback : () => T ->T : T ->T : T - } - function tokenToString(t: SyntaxKind): string; ->tokenToString : (t: SyntaxKind) => string ->t : SyntaxKind ->SyntaxKind : SyntaxKind - - function computeLineStarts(text: string): number[]; ->computeLineStarts : (text: string) => number[] ->text : string - - function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number ->sourceFile : SourceFile ->SourceFile : SourceFile ->line : number ->character : number - - function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number ->lineStarts : number[] ->line : number ->character : number - - function getLineStarts(sourceFile: SourceFile): number[]; ->getLineStarts : (sourceFile: SourceFile) => number[] ->sourceFile : SourceFile ->SourceFile : SourceFile - - function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { ->computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } ->lineStarts : number[] ->position : number - - line: number; ->line : number - - character: number; ->character : number - - }; - function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; ->getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter ->sourceFile : SourceFile ->SourceFile : SourceFile ->position : number ->LineAndCharacter : LineAndCharacter - - function isWhiteSpace(ch: number): boolean; ->isWhiteSpace : (ch: number) => boolean ->ch : number - - function isLineBreak(ch: number): boolean; ->isLineBreak : (ch: number) => boolean ->ch : number - - function isOctalDigit(ch: number): boolean; ->isOctalDigit : (ch: number) => boolean ->ch : number - - function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; ->skipTrivia : (text: string, pos: number, stopAfterLineBreak?: boolean) => number ->text : string ->pos : number ->stopAfterLineBreak : boolean - - function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; ->getLeadingCommentRanges : (text: string, pos: number) => CommentRange[] ->text : string ->pos : number ->CommentRange : CommentRange - - function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; ->getTrailingCommentRanges : (text: string, pos: number) => CommentRange[] ->text : string ->pos : number ->CommentRange : CommentRange - - function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; ->isIdentifierStart : (ch: number, languageVersion: ScriptTarget) => boolean ->ch : number ->languageVersion : ScriptTarget ->ScriptTarget : ScriptTarget - - function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; ->isIdentifierPart : (ch: number, languageVersion: ScriptTarget) => boolean ->ch : number ->languageVersion : ScriptTarget ->ScriptTarget : ScriptTarget - - function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner; ->createScanner : (languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback) => Scanner ->languageVersion : ScriptTarget ->ScriptTarget : ScriptTarget ->skipTrivia : boolean ->text : string ->onError : ErrorCallback ->ErrorCallback : ErrorCallback ->Scanner : Scanner -} -declare module "typescript" { - function getNodeConstructor(kind: SyntaxKind): new () => Node; ->getNodeConstructor : (kind: SyntaxKind) => new () => Node ->kind : SyntaxKind ->SyntaxKind : SyntaxKind ->Node : Node - - function createNode(kind: SyntaxKind): Node; ->createNode : (kind: SyntaxKind) => Node ->kind : SyntaxKind ->SyntaxKind : SyntaxKind ->Node : Node - - function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; ->forEachChild : (node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T) => T ->T : T ->node : Node ->Node : Node ->cbNode : (node: Node) => T ->node : Node ->Node : Node ->T : T ->cbNodeArray : (nodes: Node[]) => T ->nodes : Node[] ->Node : Node ->T : T ->T : T - - function modifierToFlag(token: SyntaxKind): NodeFlags; ->modifierToFlag : (token: SyntaxKind) => NodeFlags ->token : SyntaxKind ->SyntaxKind : SyntaxKind ->NodeFlags : NodeFlags - - function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; ->updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile ->sourceFile : SourceFile ->SourceFile : SourceFile ->newText : string ->textChangeRange : TextChangeRange ->TextChangeRange : TextChangeRange ->aggressiveChecks : boolean ->SourceFile : SourceFile - - function isEvalOrArgumentsIdentifier(node: Node): boolean; ->isEvalOrArgumentsIdentifier : (node: Node) => boolean ->node : Node ->Node : Node - - function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; ->createSourceFile : (fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile ->fileName : string ->sourceText : string ->languageVersion : ScriptTarget ->ScriptTarget : ScriptTarget ->setParentNodes : boolean ->SourceFile : SourceFile - - function isLeftHandSideExpression(expr: Expression): boolean; ->isLeftHandSideExpression : (expr: Expression) => boolean ->expr : Expression ->Expression : Expression - - function isAssignmentOperator(token: SyntaxKind): boolean; ->isAssignmentOperator : (token: SyntaxKind) => boolean ->token : SyntaxKind ->SyntaxKind : SyntaxKind -} -declare module "typescript" { - function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; ->createTypeChecker : (host: TypeCheckerHost, produceDiagnostics: boolean) => TypeChecker ->host : TypeCheckerHost ->TypeCheckerHost : TypeCheckerHost ->produceDiagnostics : boolean ->TypeChecker : TypeChecker -} -declare module "typescript" { - /** The version of the TypeScript compiler release */ - let version: string; ->version : string - - function findConfigFile(searchPath: string): string; ->findConfigFile : (searchPath: string) => string ->searchPath : string - - function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; ->createCompilerHost : (options: CompilerOptions, setParentNodes?: boolean) => CompilerHost ->options : CompilerOptions ->CompilerOptions : CompilerOptions ->setParentNodes : boolean ->CompilerHost : CompilerHost - - function getPreEmitDiagnostics(program: Program): Diagnostic[]; ->getPreEmitDiagnostics : (program: Program) => Diagnostic[] ->program : Program ->Program : Program ->Diagnostic : Diagnostic - - function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; ->flattenDiagnosticMessageText : (messageText: string | DiagnosticMessageChain, newLine: string) => string ->messageText : string | DiagnosticMessageChain ->DiagnosticMessageChain : DiagnosticMessageChain ->newLine : string - - function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; ->createProgram : (rootNames: string[], options: CompilerOptions, host?: CompilerHost) => Program ->rootNames : string[] ->options : CompilerOptions ->CompilerOptions : CompilerOptions ->host : CompilerHost ->CompilerHost : CompilerHost ->Program : Program -} -declare module "typescript" { - /** The version of the language service API */ - let servicesVersion: string; ->servicesVersion : string - - interface Node { ->Node : Node - - getSourceFile(): SourceFile; ->getSourceFile : () => SourceFile ->SourceFile : SourceFile - - getChildCount(sourceFile?: SourceFile): number; ->getChildCount : (sourceFile?: SourceFile) => number ->sourceFile : SourceFile ->SourceFile : SourceFile - - getChildAt(index: number, sourceFile?: SourceFile): Node; ->getChildAt : (index: number, sourceFile?: SourceFile) => Node ->index : number ->sourceFile : SourceFile ->SourceFile : SourceFile ->Node : Node - - getChildren(sourceFile?: SourceFile): Node[]; ->getChildren : (sourceFile?: SourceFile) => Node[] ->sourceFile : SourceFile ->SourceFile : SourceFile ->Node : Node - - getStart(sourceFile?: SourceFile): number; ->getStart : (sourceFile?: SourceFile) => number ->sourceFile : SourceFile ->SourceFile : SourceFile - - getFullStart(): number; ->getFullStart : () => number - - getEnd(): number; ->getEnd : () => number - - getWidth(sourceFile?: SourceFile): number; ->getWidth : (sourceFile?: SourceFile) => number ->sourceFile : SourceFile ->SourceFile : SourceFile - - getFullWidth(): number; ->getFullWidth : () => number - - getLeadingTriviaWidth(sourceFile?: SourceFile): number; ->getLeadingTriviaWidth : (sourceFile?: SourceFile) => number ->sourceFile : SourceFile ->SourceFile : SourceFile - - getFullText(sourceFile?: SourceFile): string; ->getFullText : (sourceFile?: SourceFile) => string ->sourceFile : SourceFile ->SourceFile : SourceFile - - getText(sourceFile?: SourceFile): string; ->getText : (sourceFile?: SourceFile) => string ->sourceFile : SourceFile ->SourceFile : SourceFile - - getFirstToken(sourceFile?: SourceFile): Node; ->getFirstToken : (sourceFile?: SourceFile) => Node ->sourceFile : SourceFile ->SourceFile : SourceFile ->Node : Node - - getLastToken(sourceFile?: SourceFile): Node; ->getLastToken : (sourceFile?: SourceFile) => Node ->sourceFile : SourceFile ->SourceFile : SourceFile ->Node : Node - } - interface Symbol { ->Symbol : Symbol - - getFlags(): SymbolFlags; ->getFlags : () => SymbolFlags ->SymbolFlags : SymbolFlags - - getName(): string; ->getName : () => string - - getDeclarations(): Declaration[]; ->getDeclarations : () => Declaration[] ->Declaration : Declaration - - getDocumentationComment(): SymbolDisplayPart[]; ->getDocumentationComment : () => SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - } - interface Type { ->Type : Type - - getFlags(): TypeFlags; ->getFlags : () => TypeFlags ->TypeFlags : TypeFlags - - getSymbol(): Symbol; ->getSymbol : () => Symbol ->Symbol : Symbol - - getProperties(): Symbol[]; ->getProperties : () => Symbol[] ->Symbol : Symbol - - getProperty(propertyName: string): Symbol; ->getProperty : (propertyName: string) => Symbol ->propertyName : string ->Symbol : Symbol - - getApparentProperties(): Symbol[]; ->getApparentProperties : () => Symbol[] ->Symbol : Symbol - - getCallSignatures(): Signature[]; ->getCallSignatures : () => Signature[] ->Signature : Signature - - getConstructSignatures(): Signature[]; ->getConstructSignatures : () => Signature[] ->Signature : Signature - - getStringIndexType(): Type; ->getStringIndexType : () => Type ->Type : Type - - getNumberIndexType(): Type; ->getNumberIndexType : () => Type ->Type : Type - } - interface Signature { ->Signature : Signature - - getDeclaration(): SignatureDeclaration; ->getDeclaration : () => SignatureDeclaration ->SignatureDeclaration : SignatureDeclaration - - getTypeParameters(): Type[]; ->getTypeParameters : () => Type[] ->Type : Type - - getParameters(): Symbol[]; ->getParameters : () => Symbol[] ->Symbol : Symbol - - getReturnType(): Type; ->getReturnType : () => Type ->Type : Type - - getDocumentationComment(): SymbolDisplayPart[]; ->getDocumentationComment : () => SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - } - interface SourceFile { ->SourceFile : SourceFile - - getNamedDeclarations(): Declaration[]; ->getNamedDeclarations : () => Declaration[] ->Declaration : Declaration - - getLineAndCharacterOfPosition(pos: number): LineAndCharacter; ->getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter ->pos : number ->LineAndCharacter : LineAndCharacter - - getLineStarts(): number[]; ->getLineStarts : () => number[] - - getPositionOfLineAndCharacter(line: number, character: number): number; ->getPositionOfLineAndCharacter : (line: number, character: number) => number ->line : number ->character : number - - update(newText: string, textChangeRange: TextChangeRange): SourceFile; ->update : (newText: string, textChangeRange: TextChangeRange) => SourceFile ->newText : string ->textChangeRange : TextChangeRange ->TextChangeRange : TextChangeRange ->SourceFile : SourceFile - } - /** - * Represents an immutable snapshot of a script at a specified time.Once acquired, the - * snapshot is observably immutable. i.e. the same calls with the same parameters will return - * the same values. - */ - interface IScriptSnapshot { ->IScriptSnapshot : IScriptSnapshot - - /** Gets a portion of the script snapshot specified by [start, end). */ - getText(start: number, end: number): string; ->getText : (start: number, end: number) => string ->start : number ->end : number - - /** Gets the length of this script snapshot. */ - getLength(): number; ->getLength : () => number - - /** - * Gets the TextChangeRange that describe how the text changed between this text and - * an older version. This information is used by the incremental parser to determine - * what sections of the script need to be re-parsed. 'undefined' can be returned if the - * change range cannot be determined. However, in that case, incremental parsing will - * not happen and the entire document will be re - parsed. - */ - getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; ->getChangeRange : (oldSnapshot: IScriptSnapshot) => TextChangeRange ->oldSnapshot : IScriptSnapshot ->IScriptSnapshot : IScriptSnapshot ->TextChangeRange : TextChangeRange - } - module ScriptSnapshot { ->ScriptSnapshot : typeof ScriptSnapshot - - function fromString(text: string): IScriptSnapshot; ->fromString : (text: string) => IScriptSnapshot ->text : string ->IScriptSnapshot : IScriptSnapshot - } - interface PreProcessedFileInfo { ->PreProcessedFileInfo : PreProcessedFileInfo - - referencedFiles: FileReference[]; ->referencedFiles : FileReference[] ->FileReference : FileReference - - importedFiles: FileReference[]; ->importedFiles : FileReference[] ->FileReference : FileReference - - isLibFile: boolean; ->isLibFile : boolean - } - interface LanguageServiceHost { ->LanguageServiceHost : LanguageServiceHost - - getCompilationSettings(): CompilerOptions; ->getCompilationSettings : () => CompilerOptions ->CompilerOptions : CompilerOptions - - getNewLine?(): string; ->getNewLine : () => string - - getScriptFileNames(): string[]; ->getScriptFileNames : () => string[] - - getScriptVersion(fileName: string): string; ->getScriptVersion : (fileName: string) => string ->fileName : string - - getScriptSnapshot(fileName: string): IScriptSnapshot; ->getScriptSnapshot : (fileName: string) => IScriptSnapshot ->fileName : string ->IScriptSnapshot : IScriptSnapshot - - getLocalizedDiagnosticMessages?(): any; ->getLocalizedDiagnosticMessages : () => any - - getCancellationToken?(): CancellationToken; ->getCancellationToken : () => CancellationToken ->CancellationToken : CancellationToken - - getCurrentDirectory(): string; ->getCurrentDirectory : () => string - - getDefaultLibFileName(options: CompilerOptions): string; ->getDefaultLibFileName : (options: CompilerOptions) => string ->options : CompilerOptions ->CompilerOptions : CompilerOptions - - log?(s: string): void; ->log : (s: string) => void ->s : string - - trace?(s: string): void; ->trace : (s: string) => void ->s : string - - error?(s: string): void; ->error : (s: string) => void ->s : string - } - interface LanguageService { ->LanguageService : LanguageService - - cleanupSemanticCache(): void; ->cleanupSemanticCache : () => void - - getSyntacticDiagnostics(fileName: string): Diagnostic[]; ->getSyntacticDiagnostics : (fileName: string) => Diagnostic[] ->fileName : string ->Diagnostic : Diagnostic - - getSemanticDiagnostics(fileName: string): Diagnostic[]; ->getSemanticDiagnostics : (fileName: string) => Diagnostic[] ->fileName : string ->Diagnostic : Diagnostic - - getCompilerOptionsDiagnostics(): Diagnostic[]; ->getCompilerOptionsDiagnostics : () => Diagnostic[] ->Diagnostic : Diagnostic - - getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; ->getSyntacticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] ->fileName : string ->span : TextSpan ->TextSpan : TextSpan ->ClassifiedSpan : ClassifiedSpan - - getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; ->getSemanticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] ->fileName : string ->span : TextSpan ->TextSpan : TextSpan ->ClassifiedSpan : ClassifiedSpan - - getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; ->getCompletionsAtPosition : (fileName: string, position: number) => CompletionInfo ->fileName : string ->position : number ->CompletionInfo : CompletionInfo - - getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; ->getCompletionEntryDetails : (fileName: string, position: number, entryName: string) => CompletionEntryDetails ->fileName : string ->position : number ->entryName : string ->CompletionEntryDetails : CompletionEntryDetails - - getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; ->getQuickInfoAtPosition : (fileName: string, position: number) => QuickInfo ->fileName : string ->position : number ->QuickInfo : QuickInfo - - getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; ->getNameOrDottedNameSpan : (fileName: string, startPos: number, endPos: number) => TextSpan ->fileName : string ->startPos : number ->endPos : number ->TextSpan : TextSpan - - getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; ->getBreakpointStatementAtPosition : (fileName: string, position: number) => TextSpan ->fileName : string ->position : number ->TextSpan : TextSpan - - getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; ->getSignatureHelpItems : (fileName: string, position: number) => SignatureHelpItems ->fileName : string ->position : number ->SignatureHelpItems : SignatureHelpItems - - getRenameInfo(fileName: string, position: number): RenameInfo; ->getRenameInfo : (fileName: string, position: number) => RenameInfo ->fileName : string ->position : number ->RenameInfo : RenameInfo - - findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; ->findRenameLocations : (fileName: string, position: number, findInStrings: boolean, findInComments: boolean) => RenameLocation[] ->fileName : string ->position : number ->findInStrings : boolean ->findInComments : boolean ->RenameLocation : RenameLocation - - getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; ->getDefinitionAtPosition : (fileName: string, position: number) => DefinitionInfo[] ->fileName : string ->position : number ->DefinitionInfo : DefinitionInfo - - getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; ->getReferencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] ->fileName : string ->position : number ->ReferenceEntry : ReferenceEntry - - getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; ->getOccurrencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] ->fileName : string ->position : number ->ReferenceEntry : ReferenceEntry - - findReferences(fileName: string, position: number): ReferencedSymbol[]; ->findReferences : (fileName: string, position: number) => ReferencedSymbol[] ->fileName : string ->position : number ->ReferencedSymbol : ReferencedSymbol - - getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; ->getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] ->searchValue : string ->maxResultCount : number ->NavigateToItem : NavigateToItem - - getNavigationBarItems(fileName: string): NavigationBarItem[]; ->getNavigationBarItems : (fileName: string) => NavigationBarItem[] ->fileName : string ->NavigationBarItem : NavigationBarItem - - getOutliningSpans(fileName: string): OutliningSpan[]; ->getOutliningSpans : (fileName: string) => OutliningSpan[] ->fileName : string ->OutliningSpan : OutliningSpan - - getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; ->getTodoComments : (fileName: string, descriptors: TodoCommentDescriptor[]) => TodoComment[] ->fileName : string ->descriptors : TodoCommentDescriptor[] ->TodoCommentDescriptor : TodoCommentDescriptor ->TodoComment : TodoComment - - getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; ->getBraceMatchingAtPosition : (fileName: string, position: number) => TextSpan[] ->fileName : string ->position : number ->TextSpan : TextSpan - - getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; ->getIndentationAtPosition : (fileName: string, position: number, options: EditorOptions) => number ->fileName : string ->position : number ->options : EditorOptions ->EditorOptions : EditorOptions - - getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; ->getFormattingEditsForRange : (fileName: string, start: number, end: number, options: FormatCodeOptions) => TextChange[] ->fileName : string ->start : number ->end : number ->options : FormatCodeOptions ->FormatCodeOptions : FormatCodeOptions ->TextChange : TextChange - - getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; ->getFormattingEditsForDocument : (fileName: string, options: FormatCodeOptions) => TextChange[] ->fileName : string ->options : FormatCodeOptions ->FormatCodeOptions : FormatCodeOptions ->TextChange : TextChange - - getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; ->getFormattingEditsAfterKeystroke : (fileName: string, position: number, key: string, options: FormatCodeOptions) => TextChange[] ->fileName : string ->position : number ->key : string ->options : FormatCodeOptions ->FormatCodeOptions : FormatCodeOptions ->TextChange : TextChange - - getEmitOutput(fileName: string): EmitOutput; ->getEmitOutput : (fileName: string) => EmitOutput ->fileName : string ->EmitOutput : EmitOutput - - getProgram(): Program; ->getProgram : () => Program ->Program : Program - - getSourceFile(fileName: string): SourceFile; ->getSourceFile : (fileName: string) => SourceFile ->fileName : string ->SourceFile : SourceFile - - dispose(): void; ->dispose : () => void - } - interface ClassifiedSpan { ->ClassifiedSpan : ClassifiedSpan - - textSpan: TextSpan; ->textSpan : TextSpan ->TextSpan : TextSpan - - classificationType: string; ->classificationType : string - } - interface NavigationBarItem { ->NavigationBarItem : NavigationBarItem - - text: string; ->text : string - - kind: string; ->kind : string - - kindModifiers: string; ->kindModifiers : string - - spans: TextSpan[]; ->spans : TextSpan[] ->TextSpan : TextSpan - - childItems: NavigationBarItem[]; ->childItems : NavigationBarItem[] ->NavigationBarItem : NavigationBarItem - - indent: number; ->indent : number - - bolded: boolean; ->bolded : boolean - - grayed: boolean; ->grayed : boolean - } - interface TodoCommentDescriptor { ->TodoCommentDescriptor : TodoCommentDescriptor - - text: string; ->text : string - - priority: number; ->priority : number - } - interface TodoComment { ->TodoComment : TodoComment - - descriptor: TodoCommentDescriptor; ->descriptor : TodoCommentDescriptor ->TodoCommentDescriptor : TodoCommentDescriptor - - message: string; ->message : string - - position: number; ->position : number - } - class TextChange { ->TextChange : TextChange - - span: TextSpan; ->span : TextSpan ->TextSpan : TextSpan - - newText: string; ->newText : string - } - interface RenameLocation { ->RenameLocation : RenameLocation - - textSpan: TextSpan; ->textSpan : TextSpan ->TextSpan : TextSpan - - fileName: string; ->fileName : string - } - interface ReferenceEntry { ->ReferenceEntry : ReferenceEntry - - textSpan: TextSpan; ->textSpan : TextSpan ->TextSpan : TextSpan - - fileName: string; ->fileName : string - - isWriteAccess: boolean; ->isWriteAccess : boolean - } - interface NavigateToItem { ->NavigateToItem : NavigateToItem - - name: string; ->name : string - - kind: string; ->kind : string - - kindModifiers: string; ->kindModifiers : string - - matchKind: string; ->matchKind : string - - isCaseSensitive: boolean; ->isCaseSensitive : boolean - - fileName: string; ->fileName : string - - textSpan: TextSpan; ->textSpan : TextSpan ->TextSpan : TextSpan - - containerName: string; ->containerName : string - - containerKind: string; ->containerKind : string - } - interface EditorOptions { ->EditorOptions : EditorOptions - - IndentSize: number; ->IndentSize : number - - TabSize: number; ->TabSize : number - - NewLineCharacter: string; ->NewLineCharacter : string - - ConvertTabsToSpaces: boolean; ->ConvertTabsToSpaces : boolean - } - interface FormatCodeOptions extends EditorOptions { ->FormatCodeOptions : FormatCodeOptions ->EditorOptions : EditorOptions - - InsertSpaceAfterCommaDelimiter: boolean; ->InsertSpaceAfterCommaDelimiter : boolean - - InsertSpaceAfterSemicolonInForStatements: boolean; ->InsertSpaceAfterSemicolonInForStatements : boolean - - InsertSpaceBeforeAndAfterBinaryOperators: boolean; ->InsertSpaceBeforeAndAfterBinaryOperators : boolean - - InsertSpaceAfterKeywordsInControlFlowStatements: boolean; ->InsertSpaceAfterKeywordsInControlFlowStatements : boolean - - InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; ->InsertSpaceAfterFunctionKeywordForAnonymousFunctions : boolean - - InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; ->InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis : boolean - - PlaceOpenBraceOnNewLineForFunctions: boolean; ->PlaceOpenBraceOnNewLineForFunctions : boolean - - PlaceOpenBraceOnNewLineForControlBlocks: boolean; ->PlaceOpenBraceOnNewLineForControlBlocks : boolean - - [s: string]: boolean | number | string; ->s : string - } - interface DefinitionInfo { ->DefinitionInfo : DefinitionInfo - - fileName: string; ->fileName : string - - textSpan: TextSpan; ->textSpan : TextSpan ->TextSpan : TextSpan - - kind: string; ->kind : string - - name: string; ->name : string - - containerKind: string; ->containerKind : string - - containerName: string; ->containerName : string - } - interface ReferencedSymbol { ->ReferencedSymbol : ReferencedSymbol - - definition: DefinitionInfo; ->definition : DefinitionInfo ->DefinitionInfo : DefinitionInfo - - references: ReferenceEntry[]; ->references : ReferenceEntry[] ->ReferenceEntry : ReferenceEntry - } - enum SymbolDisplayPartKind { ->SymbolDisplayPartKind : SymbolDisplayPartKind - - aliasName = 0, ->aliasName : SymbolDisplayPartKind - - className = 1, ->className : SymbolDisplayPartKind - - enumName = 2, ->enumName : SymbolDisplayPartKind - - fieldName = 3, ->fieldName : SymbolDisplayPartKind - - interfaceName = 4, ->interfaceName : SymbolDisplayPartKind - - keyword = 5, ->keyword : SymbolDisplayPartKind - - lineBreak = 6, ->lineBreak : SymbolDisplayPartKind - - numericLiteral = 7, ->numericLiteral : SymbolDisplayPartKind - - stringLiteral = 8, ->stringLiteral : SymbolDisplayPartKind - - localName = 9, ->localName : SymbolDisplayPartKind - - methodName = 10, ->methodName : SymbolDisplayPartKind - - moduleName = 11, ->moduleName : SymbolDisplayPartKind - - operator = 12, ->operator : SymbolDisplayPartKind - - parameterName = 13, ->parameterName : SymbolDisplayPartKind - - propertyName = 14, ->propertyName : SymbolDisplayPartKind - - punctuation = 15, ->punctuation : SymbolDisplayPartKind - - space = 16, ->space : SymbolDisplayPartKind - - text = 17, ->text : SymbolDisplayPartKind - - typeParameterName = 18, ->typeParameterName : SymbolDisplayPartKind - - enumMemberName = 19, ->enumMemberName : SymbolDisplayPartKind - - functionName = 20, ->functionName : SymbolDisplayPartKind - - regularExpressionLiteral = 21, ->regularExpressionLiteral : SymbolDisplayPartKind - } - interface SymbolDisplayPart { ->SymbolDisplayPart : SymbolDisplayPart - - text: string; ->text : string - - kind: string; ->kind : string - } - interface QuickInfo { ->QuickInfo : QuickInfo - - kind: string; ->kind : string - - kindModifiers: string; ->kindModifiers : string - - textSpan: TextSpan; ->textSpan : TextSpan ->TextSpan : TextSpan - - displayParts: SymbolDisplayPart[]; ->displayParts : SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - - documentation: SymbolDisplayPart[]; ->documentation : SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - } - interface RenameInfo { ->RenameInfo : RenameInfo - - canRename: boolean; ->canRename : boolean - - localizedErrorMessage: string; ->localizedErrorMessage : string - - displayName: string; ->displayName : string - - fullDisplayName: string; ->fullDisplayName : string - - kind: string; ->kind : string - - kindModifiers: string; ->kindModifiers : string - - triggerSpan: TextSpan; ->triggerSpan : TextSpan ->TextSpan : TextSpan - } - interface SignatureHelpParameter { ->SignatureHelpParameter : SignatureHelpParameter - - name: string; ->name : string - - documentation: SymbolDisplayPart[]; ->documentation : SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - - displayParts: SymbolDisplayPart[]; ->displayParts : SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - - isOptional: boolean; ->isOptional : boolean - } - /** - * Represents a single signature to show in signature help. - * The id is used for subsequent calls into the language service to ask questions about the - * signature help item in the context of any documents that have been updated. i.e. after - * an edit has happened, while signature help is still active, the host can ask important - * questions like 'what parameter is the user currently contained within?'. - */ - interface SignatureHelpItem { ->SignatureHelpItem : SignatureHelpItem - - isVariadic: boolean; ->isVariadic : boolean - - prefixDisplayParts: SymbolDisplayPart[]; ->prefixDisplayParts : SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - - suffixDisplayParts: SymbolDisplayPart[]; ->suffixDisplayParts : SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - - separatorDisplayParts: SymbolDisplayPart[]; ->separatorDisplayParts : SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - - parameters: SignatureHelpParameter[]; ->parameters : SignatureHelpParameter[] ->SignatureHelpParameter : SignatureHelpParameter - - documentation: SymbolDisplayPart[]; ->documentation : SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - } - /** - * Represents a set of signature help items, and the preferred item that should be selected. - */ - interface SignatureHelpItems { ->SignatureHelpItems : SignatureHelpItems - - items: SignatureHelpItem[]; ->items : SignatureHelpItem[] ->SignatureHelpItem : SignatureHelpItem - - applicableSpan: TextSpan; ->applicableSpan : TextSpan ->TextSpan : TextSpan - - selectedItemIndex: number; ->selectedItemIndex : number - - argumentIndex: number; ->argumentIndex : number - - argumentCount: number; ->argumentCount : number - } - interface CompletionInfo { ->CompletionInfo : CompletionInfo - - isMemberCompletion: boolean; ->isMemberCompletion : boolean - - isNewIdentifierLocation: boolean; ->isNewIdentifierLocation : boolean - - entries: CompletionEntry[]; ->entries : CompletionEntry[] ->CompletionEntry : CompletionEntry - } - interface CompletionEntry { ->CompletionEntry : CompletionEntry - - name: string; ->name : string - - kind: string; ->kind : string - - kindModifiers: string; ->kindModifiers : string - } - interface CompletionEntryDetails { ->CompletionEntryDetails : CompletionEntryDetails - - name: string; ->name : string - - kind: string; ->kind : string - - kindModifiers: string; ->kindModifiers : string - - displayParts: SymbolDisplayPart[]; ->displayParts : SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - - documentation: SymbolDisplayPart[]; ->documentation : SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - } - interface OutliningSpan { ->OutliningSpan : OutliningSpan - - /** The span of the document to actually collapse. */ - textSpan: TextSpan; ->textSpan : TextSpan ->TextSpan : TextSpan - - /** The span of the document to display when the user hovers over the collapsed span. */ - hintSpan: TextSpan; ->hintSpan : TextSpan ->TextSpan : TextSpan - - /** The text to display in the editor for the collapsed region. */ - bannerText: string; ->bannerText : string - - /** - * Whether or not this region should be automatically collapsed when - * the 'Collapse to Definitions' command is invoked. - */ - autoCollapse: boolean; ->autoCollapse : boolean - } - interface EmitOutput { ->EmitOutput : EmitOutput - - outputFiles: OutputFile[]; ->outputFiles : OutputFile[] ->OutputFile : OutputFile - - emitSkipped: boolean; ->emitSkipped : boolean - } - const enum OutputFileType { ->OutputFileType : OutputFileType - - JavaScript = 0, ->JavaScript : OutputFileType - - SourceMap = 1, ->SourceMap : OutputFileType - - Declaration = 2, ->Declaration : OutputFileType - } - interface OutputFile { ->OutputFile : OutputFile - - name: string; ->name : string - - writeByteOrderMark: boolean; ->writeByteOrderMark : boolean - - text: string; ->text : string - } - const enum EndOfLineState { ->EndOfLineState : EndOfLineState - - Start = 0, ->Start : EndOfLineState - - InMultiLineCommentTrivia = 1, ->InMultiLineCommentTrivia : EndOfLineState - - InSingleQuoteStringLiteral = 2, ->InSingleQuoteStringLiteral : EndOfLineState - - InDoubleQuoteStringLiteral = 3, ->InDoubleQuoteStringLiteral : EndOfLineState - - InTemplateHeadOrNoSubstitutionTemplate = 4, ->InTemplateHeadOrNoSubstitutionTemplate : EndOfLineState - - InTemplateMiddleOrTail = 5, ->InTemplateMiddleOrTail : EndOfLineState - - InTemplateSubstitutionPosition = 6, ->InTemplateSubstitutionPosition : EndOfLineState - } - enum TokenClass { ->TokenClass : TokenClass - - Punctuation = 0, ->Punctuation : TokenClass - - Keyword = 1, ->Keyword : TokenClass - - Operator = 2, ->Operator : TokenClass - - Comment = 3, ->Comment : TokenClass - - Whitespace = 4, ->Whitespace : TokenClass - - Identifier = 5, ->Identifier : TokenClass - - NumberLiteral = 6, ->NumberLiteral : TokenClass - - StringLiteral = 7, ->StringLiteral : TokenClass - - RegExpLiteral = 8, ->RegExpLiteral : TokenClass - } - interface ClassificationResult { ->ClassificationResult : ClassificationResult - - finalLexState: EndOfLineState; ->finalLexState : EndOfLineState ->EndOfLineState : EndOfLineState - - entries: ClassificationInfo[]; ->entries : ClassificationInfo[] ->ClassificationInfo : ClassificationInfo - } - interface ClassificationInfo { ->ClassificationInfo : ClassificationInfo - - length: number; ->length : number - - classification: TokenClass; ->classification : TokenClass ->TokenClass : TokenClass - } - interface Classifier { ->Classifier : Classifier - - /** - * Gives lexical classifications of tokens on a line without any syntactic context. - * For instance, a token consisting of the text 'string' can be either an identifier - * named 'string' or the keyword 'string', however, because this classifier is not aware, - * it relies on certain heuristics to give acceptable results. For classifications where - * speed trumps accuracy, this function is preferable; however, for true accuracy, the - * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the - * lexical, syntactic, and semantic classifiers may issue the best user experience. - * - * @param text The text of a line to classify. - * @param lexState The state of the lexical classifier at the end of the previous line. - * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. - * If there is no syntactic classifier (syntacticClassifierAbsent=true), - * certain heuristics may be used in its place; however, if there is a - * syntactic classifier (syntacticClassifierAbsent=false), certain - * classifications which may be incorrectly categorized will be given - * back as Identifiers in order to allow the syntactic classifier to - * subsume the classification. - */ - getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; ->getClassificationsForLine : (text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean) => ClassificationResult ->text : string ->lexState : EndOfLineState ->EndOfLineState : EndOfLineState ->syntacticClassifierAbsent : boolean ->ClassificationResult : ClassificationResult - } - /** - * The document registry represents a store of SourceFile objects that can be shared between - * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) - * of files in the context. - * SourceFile objects account for most of the memory usage by the language service. Sharing - * the same DocumentRegistry instance between different instances of LanguageService allow - * for more efficient memory utilization since all projects will share at least the library - * file (lib.d.ts). - * - * A more advanced use of the document registry is to serialize sourceFile objects to disk - * and re-hydrate them when needed. - * - * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it - * to all subsequent createLanguageService calls. - */ - interface DocumentRegistry { ->DocumentRegistry : DocumentRegistry - - /** - * Request a stored SourceFile with a given fileName and compilationSettings. - * The first call to acquire will call createLanguageServiceSourceFile to generate - * the SourceFile if was not found in the registry. - * - * @param fileName The name of the file requested - * @param compilationSettings Some compilation settings like target affects the - * shape of a the resulting SourceFile. This allows the DocumentRegistry to store - * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - */ - acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; ->acquireDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile ->fileName : string ->compilationSettings : CompilerOptions ->CompilerOptions : CompilerOptions ->scriptSnapshot : IScriptSnapshot ->IScriptSnapshot : IScriptSnapshot ->version : string ->SourceFile : SourceFile - - /** - * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile - * to get an updated SourceFile. - * - * @param fileName The name of the file requested - * @param compilationSettings Some compilation settings like target affects the - * shape of a the resulting SourceFile. This allows the DocumentRegistry to store - * multiple copies of the same file for different compilation settings. - * @param scriptSnapshot Text of the file. - * @param version Current version of the file. - */ - updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; ->updateDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile ->fileName : string ->compilationSettings : CompilerOptions ->CompilerOptions : CompilerOptions ->scriptSnapshot : IScriptSnapshot ->IScriptSnapshot : IScriptSnapshot ->version : string ->SourceFile : SourceFile - - /** - * Informs the DocumentRegistry that a file is not needed any longer. - * - * Note: It is not allowed to call release on a SourceFile that was not acquired from - * this registry originally. - * - * @param fileName The name of the file to be released - * @param compilationSettings The compilation settings used to acquire the file - */ - releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; ->releaseDocument : (fileName: string, compilationSettings: CompilerOptions) => void ->fileName : string ->compilationSettings : CompilerOptions ->CompilerOptions : CompilerOptions - } - class ScriptElementKind { ->ScriptElementKind : ScriptElementKind - - static unknown: string; ->unknown : string - - static keyword: string; ->keyword : string - - static scriptElement: string; ->scriptElement : string - - static moduleElement: string; ->moduleElement : string - - static classElement: string; ->classElement : string - - static interfaceElement: string; ->interfaceElement : string - - static typeElement: string; ->typeElement : string - - static enumElement: string; ->enumElement : string - - static variableElement: string; ->variableElement : string - - static localVariableElement: string; ->localVariableElement : string - - static functionElement: string; ->functionElement : string - - static localFunctionElement: string; ->localFunctionElement : string - - static memberFunctionElement: string; ->memberFunctionElement : string - - static memberGetAccessorElement: string; ->memberGetAccessorElement : string - - static memberSetAccessorElement: string; ->memberSetAccessorElement : string - - static memberVariableElement: string; ->memberVariableElement : string - - static constructorImplementationElement: string; ->constructorImplementationElement : string - - static callSignatureElement: string; ->callSignatureElement : string - - static indexSignatureElement: string; ->indexSignatureElement : string - - static constructSignatureElement: string; ->constructSignatureElement : string - - static parameterElement: string; ->parameterElement : string - - static typeParameterElement: string; ->typeParameterElement : string - - static primitiveType: string; ->primitiveType : string - - static label: string; ->label : string - - static alias: string; ->alias : string - - static constElement: string; ->constElement : string - - static letElement: string; ->letElement : string - } - class ScriptElementKindModifier { ->ScriptElementKindModifier : ScriptElementKindModifier - - static none: string; ->none : string - - static publicMemberModifier: string; ->publicMemberModifier : string - - static privateMemberModifier: string; ->privateMemberModifier : string - - static protectedMemberModifier: string; ->protectedMemberModifier : string - - static exportedModifier: string; ->exportedModifier : string - - static ambientModifier: string; ->ambientModifier : string - - static staticModifier: string; ->staticModifier : string - } - class ClassificationTypeNames { ->ClassificationTypeNames : ClassificationTypeNames - - static comment: string; ->comment : string - - static identifier: string; ->identifier : string - - static keyword: string; ->keyword : string - - static numericLiteral: string; ->numericLiteral : string - - static operator: string; ->operator : string - - static stringLiteral: string; ->stringLiteral : string - - static whiteSpace: string; ->whiteSpace : string - - static text: string; ->text : string - - static punctuation: string; ->punctuation : string - - static className: string; ->className : string - - static enumName: string; ->enumName : string - - static interfaceName: string; ->interfaceName : string - - static moduleName: string; ->moduleName : string - - static typeParameterName: string; ->typeParameterName : string - - static typeAlias: string; ->typeAlias : string - } - interface DisplayPartsSymbolWriter extends SymbolWriter { ->DisplayPartsSymbolWriter : DisplayPartsSymbolWriter ->SymbolWriter : SymbolWriter - - displayParts(): SymbolDisplayPart[]; ->displayParts : () => SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - } - function displayPartsToString(displayParts: SymbolDisplayPart[]): string; ->displayPartsToString : (displayParts: SymbolDisplayPart[]) => string ->displayParts : SymbolDisplayPart[] ->SymbolDisplayPart : SymbolDisplayPart - - function getDefaultCompilerOptions(): CompilerOptions; ->getDefaultCompilerOptions : () => CompilerOptions ->CompilerOptions : CompilerOptions - - class OperationCanceledException { ->OperationCanceledException : OperationCanceledException - } - class CancellationTokenObject { ->CancellationTokenObject : CancellationTokenObject - - private cancellationToken; ->cancellationToken : any - - static None: CancellationTokenObject; ->None : CancellationTokenObject ->CancellationTokenObject : CancellationTokenObject - - constructor(cancellationToken: CancellationToken); ->cancellationToken : CancellationToken ->CancellationToken : CancellationToken - - isCancellationRequested(): boolean; ->isCancellationRequested : () => boolean - - throwIfCancellationRequested(): void; ->throwIfCancellationRequested : () => void - } - function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; ->createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile ->fileName : string ->scriptSnapshot : IScriptSnapshot ->IScriptSnapshot : IScriptSnapshot ->scriptTarget : ScriptTarget ->ScriptTarget : ScriptTarget ->version : string ->setNodeParents : boolean ->SourceFile : SourceFile - - let disableIncrementalParsing: boolean; ->disableIncrementalParsing : boolean - - function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; ->updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile ->sourceFile : SourceFile ->SourceFile : SourceFile ->scriptSnapshot : IScriptSnapshot ->IScriptSnapshot : IScriptSnapshot ->version : string ->textChangeRange : TextChangeRange ->TextChangeRange : TextChangeRange ->aggressiveChecks : boolean ->SourceFile : SourceFile - - function createDocumentRegistry(): DocumentRegistry; ->createDocumentRegistry : () => DocumentRegistry ->DocumentRegistry : DocumentRegistry - - function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; ->preProcessFile : (sourceText: string, readImportFiles?: boolean) => PreProcessedFileInfo ->sourceText : string ->readImportFiles : boolean ->PreProcessedFileInfo : PreProcessedFileInfo - - function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; ->createLanguageService : (host: LanguageServiceHost, documentRegistry?: DocumentRegistry) => LanguageService ->host : LanguageServiceHost ->LanguageServiceHost : LanguageServiceHost ->documentRegistry : DocumentRegistry ->DocumentRegistry : DocumentRegistry ->LanguageService : LanguageService - - function createClassifier(): Classifier; ->createClassifier : () => Classifier ->Classifier : Classifier - - /** - * Get the path of the default library file (lib.d.ts) as distributed with the typescript - * node package. - * The functionality is not supported if the ts module is consumed outside of a node module. - */ - function getDefaultLibFilePath(options: CompilerOptions): string; ->getDefaultLibFilePath : (options: CompilerOptions) => string ->options : CompilerOptions ->CompilerOptions : CompilerOptions -} - diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index a29467c1c4c..aac968cade7 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -265,60 +265,61 @@ declare module "typescript" { TemplateExpression = 171, YieldExpression = 172, SpreadElementExpression = 173, - OmittedExpression = 174, - TemplateSpan = 175, - HeritageClauseElement = 176, - Block = 177, - VariableStatement = 178, - EmptyStatement = 179, - ExpressionStatement = 180, - IfStatement = 181, - DoStatement = 182, - WhileStatement = 183, - ForStatement = 184, - ForInStatement = 185, - ForOfStatement = 186, - ContinueStatement = 187, - BreakStatement = 188, - ReturnStatement = 189, - WithStatement = 190, - SwitchStatement = 191, - LabeledStatement = 192, - ThrowStatement = 193, - TryStatement = 194, - DebuggerStatement = 195, - VariableDeclaration = 196, - VariableDeclarationList = 197, - FunctionDeclaration = 198, - ClassDeclaration = 199, - InterfaceDeclaration = 200, - TypeAliasDeclaration = 201, - EnumDeclaration = 202, - ModuleDeclaration = 203, - ModuleBlock = 204, - CaseBlock = 205, - ImportEqualsDeclaration = 206, - ImportDeclaration = 207, - ImportClause = 208, - NamespaceImport = 209, - NamedImports = 210, - ImportSpecifier = 211, - ExportAssignment = 212, - ExportDeclaration = 213, - NamedExports = 214, - ExportSpecifier = 215, - MissingDeclaration = 216, - ExternalModuleReference = 217, - CaseClause = 218, - DefaultClause = 219, - HeritageClause = 220, - CatchClause = 221, - PropertyAssignment = 222, - ShorthandPropertyAssignment = 223, - EnumMember = 224, - SourceFile = 225, - SyntaxList = 226, - Count = 227, + ClassExpression = 174, + OmittedExpression = 175, + TemplateSpan = 176, + HeritageClauseElement = 177, + Block = 178, + VariableStatement = 179, + EmptyStatement = 180, + ExpressionStatement = 181, + IfStatement = 182, + DoStatement = 183, + WhileStatement = 184, + ForStatement = 185, + ForInStatement = 186, + ForOfStatement = 187, + ContinueStatement = 188, + BreakStatement = 189, + ReturnStatement = 190, + WithStatement = 191, + SwitchStatement = 192, + LabeledStatement = 193, + ThrowStatement = 194, + TryStatement = 195, + DebuggerStatement = 196, + VariableDeclaration = 197, + VariableDeclarationList = 198, + FunctionDeclaration = 199, + ClassDeclaration = 200, + InterfaceDeclaration = 201, + TypeAliasDeclaration = 202, + EnumDeclaration = 203, + ModuleDeclaration = 204, + ModuleBlock = 205, + CaseBlock = 206, + ImportEqualsDeclaration = 207, + ImportDeclaration = 208, + ImportClause = 209, + NamespaceImport = 210, + NamedImports = 211, + ImportSpecifier = 212, + ExportAssignment = 213, + ExportDeclaration = 214, + NamedExports = 215, + ExportSpecifier = 216, + MissingDeclaration = 217, + ExternalModuleReference = 218, + CaseClause = 219, + DefaultClause = 220, + HeritageClause = 221, + CatchClause = 222, + PropertyAssignment = 223, + ShorthandPropertyAssignment = 224, + EnumMember = 225, + SourceFile = 226, + SyntaxList = 227, + Count = 228, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -738,12 +739,16 @@ declare module "typescript" { interface ModuleElement extends Node { _moduleElementBrand: any; } - interface ClassDeclaration extends Declaration, ModuleElement { + interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + } interface ClassElement extends Declaration { _classElementBrand: any; } diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 68ce9de45be..9c546b8c828 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -813,166 +813,169 @@ declare module "typescript" { SpreadElementExpression = 173, >SpreadElementExpression : SyntaxKind - OmittedExpression = 174, + ClassExpression = 174, +>ClassExpression : SyntaxKind + + OmittedExpression = 175, >OmittedExpression : SyntaxKind - TemplateSpan = 175, + TemplateSpan = 176, >TemplateSpan : SyntaxKind - HeritageClauseElement = 176, + HeritageClauseElement = 177, >HeritageClauseElement : SyntaxKind - Block = 177, + Block = 178, >Block : SyntaxKind - VariableStatement = 178, + VariableStatement = 179, >VariableStatement : SyntaxKind - EmptyStatement = 179, + EmptyStatement = 180, >EmptyStatement : SyntaxKind - ExpressionStatement = 180, + ExpressionStatement = 181, >ExpressionStatement : SyntaxKind - IfStatement = 181, + IfStatement = 182, >IfStatement : SyntaxKind - DoStatement = 182, + DoStatement = 183, >DoStatement : SyntaxKind - WhileStatement = 183, + WhileStatement = 184, >WhileStatement : SyntaxKind - ForStatement = 184, + ForStatement = 185, >ForStatement : SyntaxKind - ForInStatement = 185, + ForInStatement = 186, >ForInStatement : SyntaxKind - ForOfStatement = 186, + ForOfStatement = 187, >ForOfStatement : SyntaxKind - ContinueStatement = 187, + ContinueStatement = 188, >ContinueStatement : SyntaxKind - BreakStatement = 188, + BreakStatement = 189, >BreakStatement : SyntaxKind - ReturnStatement = 189, + ReturnStatement = 190, >ReturnStatement : SyntaxKind - WithStatement = 190, + WithStatement = 191, >WithStatement : SyntaxKind - SwitchStatement = 191, + SwitchStatement = 192, >SwitchStatement : SyntaxKind - LabeledStatement = 192, + LabeledStatement = 193, >LabeledStatement : SyntaxKind - ThrowStatement = 193, + ThrowStatement = 194, >ThrowStatement : SyntaxKind - TryStatement = 194, + TryStatement = 195, >TryStatement : SyntaxKind - DebuggerStatement = 195, + DebuggerStatement = 196, >DebuggerStatement : SyntaxKind - VariableDeclaration = 196, + VariableDeclaration = 197, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 197, + VariableDeclarationList = 198, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 198, + FunctionDeclaration = 199, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 199, + ClassDeclaration = 200, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 200, + InterfaceDeclaration = 201, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 201, + TypeAliasDeclaration = 202, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 202, + EnumDeclaration = 203, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 203, + ModuleDeclaration = 204, >ModuleDeclaration : SyntaxKind - ModuleBlock = 204, + ModuleBlock = 205, >ModuleBlock : SyntaxKind - CaseBlock = 205, + CaseBlock = 206, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 206, + ImportEqualsDeclaration = 207, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 207, + ImportDeclaration = 208, >ImportDeclaration : SyntaxKind - ImportClause = 208, + ImportClause = 209, >ImportClause : SyntaxKind - NamespaceImport = 209, + NamespaceImport = 210, >NamespaceImport : SyntaxKind - NamedImports = 210, + NamedImports = 211, >NamedImports : SyntaxKind - ImportSpecifier = 211, + ImportSpecifier = 212, >ImportSpecifier : SyntaxKind - ExportAssignment = 212, + ExportAssignment = 213, >ExportAssignment : SyntaxKind - ExportDeclaration = 213, + ExportDeclaration = 214, >ExportDeclaration : SyntaxKind - NamedExports = 214, + NamedExports = 215, >NamedExports : SyntaxKind - ExportSpecifier = 215, + ExportSpecifier = 216, >ExportSpecifier : SyntaxKind - MissingDeclaration = 216, + MissingDeclaration = 217, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 217, + ExternalModuleReference = 218, >ExternalModuleReference : SyntaxKind - CaseClause = 218, + CaseClause = 219, >CaseClause : SyntaxKind - DefaultClause = 219, + DefaultClause = 220, >DefaultClause : SyntaxKind - HeritageClause = 220, + HeritageClause = 221, >HeritageClause : SyntaxKind - CatchClause = 221, + CatchClause = 222, >CatchClause : SyntaxKind - PropertyAssignment = 222, + PropertyAssignment = 223, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 223, + ShorthandPropertyAssignment = 224, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 224, + EnumMember = 225, >EnumMember : SyntaxKind - SourceFile = 225, + SourceFile = 226, >SourceFile : SyntaxKind - SyntaxList = 226, + SyntaxList = 227, >SyntaxList : SyntaxKind - Count = 227, + Count = 228, >Count : SyntaxKind FirstAssignment = 53, @@ -2227,10 +2230,9 @@ declare module "typescript" { _moduleElementBrand: any; >_moduleElementBrand : any } - interface ClassDeclaration extends Declaration, ModuleElement { ->ClassDeclaration : ClassDeclaration + interface ClassLikeDeclaration extends Declaration { +>ClassLikeDeclaration : ClassLikeDeclaration >Declaration : Declaration ->ModuleElement : ModuleElement name?: Identifier; >name : Identifier @@ -2250,6 +2252,16 @@ declare module "typescript" { >members : NodeArray >NodeArray : NodeArray >ClassElement : ClassElement + } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { +>ClassDeclaration : ClassDeclaration +>ClassLikeDeclaration : ClassLikeDeclaration +>Statement : Statement + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { +>ClassExpression : ClassExpression +>ClassLikeDeclaration : ClassLikeDeclaration +>PrimaryExpression : PrimaryExpression } interface ClassElement extends Declaration { >ClassElement : ClassElement diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 918768222b7..e3280bfb2cf 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -302,60 +302,61 @@ declare module "typescript" { TemplateExpression = 171, YieldExpression = 172, SpreadElementExpression = 173, - OmittedExpression = 174, - TemplateSpan = 175, - HeritageClauseElement = 176, - Block = 177, - VariableStatement = 178, - EmptyStatement = 179, - ExpressionStatement = 180, - IfStatement = 181, - DoStatement = 182, - WhileStatement = 183, - ForStatement = 184, - ForInStatement = 185, - ForOfStatement = 186, - ContinueStatement = 187, - BreakStatement = 188, - ReturnStatement = 189, - WithStatement = 190, - SwitchStatement = 191, - LabeledStatement = 192, - ThrowStatement = 193, - TryStatement = 194, - DebuggerStatement = 195, - VariableDeclaration = 196, - VariableDeclarationList = 197, - FunctionDeclaration = 198, - ClassDeclaration = 199, - InterfaceDeclaration = 200, - TypeAliasDeclaration = 201, - EnumDeclaration = 202, - ModuleDeclaration = 203, - ModuleBlock = 204, - CaseBlock = 205, - ImportEqualsDeclaration = 206, - ImportDeclaration = 207, - ImportClause = 208, - NamespaceImport = 209, - NamedImports = 210, - ImportSpecifier = 211, - ExportAssignment = 212, - ExportDeclaration = 213, - NamedExports = 214, - ExportSpecifier = 215, - MissingDeclaration = 216, - ExternalModuleReference = 217, - CaseClause = 218, - DefaultClause = 219, - HeritageClause = 220, - CatchClause = 221, - PropertyAssignment = 222, - ShorthandPropertyAssignment = 223, - EnumMember = 224, - SourceFile = 225, - SyntaxList = 226, - Count = 227, + ClassExpression = 174, + OmittedExpression = 175, + TemplateSpan = 176, + HeritageClauseElement = 177, + Block = 178, + VariableStatement = 179, + EmptyStatement = 180, + ExpressionStatement = 181, + IfStatement = 182, + DoStatement = 183, + WhileStatement = 184, + ForStatement = 185, + ForInStatement = 186, + ForOfStatement = 187, + ContinueStatement = 188, + BreakStatement = 189, + ReturnStatement = 190, + WithStatement = 191, + SwitchStatement = 192, + LabeledStatement = 193, + ThrowStatement = 194, + TryStatement = 195, + DebuggerStatement = 196, + VariableDeclaration = 197, + VariableDeclarationList = 198, + FunctionDeclaration = 199, + ClassDeclaration = 200, + InterfaceDeclaration = 201, + TypeAliasDeclaration = 202, + EnumDeclaration = 203, + ModuleDeclaration = 204, + ModuleBlock = 205, + CaseBlock = 206, + ImportEqualsDeclaration = 207, + ImportDeclaration = 208, + ImportClause = 209, + NamespaceImport = 210, + NamedImports = 211, + ImportSpecifier = 212, + ExportAssignment = 213, + ExportDeclaration = 214, + NamedExports = 215, + ExportSpecifier = 216, + MissingDeclaration = 217, + ExternalModuleReference = 218, + CaseClause = 219, + DefaultClause = 220, + HeritageClause = 221, + CatchClause = 222, + PropertyAssignment = 223, + ShorthandPropertyAssignment = 224, + EnumMember = 225, + SourceFile = 226, + SyntaxList = 227, + Count = 228, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -775,12 +776,16 @@ declare module "typescript" { interface ModuleElement extends Node { _moduleElementBrand: any; } - interface ClassDeclaration extends Declaration, ModuleElement { + interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + } interface ClassElement extends Declaration { _classElementBrand: any; } diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 9745c79e94d..6507fa41e23 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -986,166 +986,169 @@ declare module "typescript" { SpreadElementExpression = 173, >SpreadElementExpression : SyntaxKind - OmittedExpression = 174, + ClassExpression = 174, +>ClassExpression : SyntaxKind + + OmittedExpression = 175, >OmittedExpression : SyntaxKind - TemplateSpan = 175, + TemplateSpan = 176, >TemplateSpan : SyntaxKind - HeritageClauseElement = 176, + HeritageClauseElement = 177, >HeritageClauseElement : SyntaxKind - Block = 177, + Block = 178, >Block : SyntaxKind - VariableStatement = 178, + VariableStatement = 179, >VariableStatement : SyntaxKind - EmptyStatement = 179, + EmptyStatement = 180, >EmptyStatement : SyntaxKind - ExpressionStatement = 180, + ExpressionStatement = 181, >ExpressionStatement : SyntaxKind - IfStatement = 181, + IfStatement = 182, >IfStatement : SyntaxKind - DoStatement = 182, + DoStatement = 183, >DoStatement : SyntaxKind - WhileStatement = 183, + WhileStatement = 184, >WhileStatement : SyntaxKind - ForStatement = 184, + ForStatement = 185, >ForStatement : SyntaxKind - ForInStatement = 185, + ForInStatement = 186, >ForInStatement : SyntaxKind - ForOfStatement = 186, + ForOfStatement = 187, >ForOfStatement : SyntaxKind - ContinueStatement = 187, + ContinueStatement = 188, >ContinueStatement : SyntaxKind - BreakStatement = 188, + BreakStatement = 189, >BreakStatement : SyntaxKind - ReturnStatement = 189, + ReturnStatement = 190, >ReturnStatement : SyntaxKind - WithStatement = 190, + WithStatement = 191, >WithStatement : SyntaxKind - SwitchStatement = 191, + SwitchStatement = 192, >SwitchStatement : SyntaxKind - LabeledStatement = 192, + LabeledStatement = 193, >LabeledStatement : SyntaxKind - ThrowStatement = 193, + ThrowStatement = 194, >ThrowStatement : SyntaxKind - TryStatement = 194, + TryStatement = 195, >TryStatement : SyntaxKind - DebuggerStatement = 195, + DebuggerStatement = 196, >DebuggerStatement : SyntaxKind - VariableDeclaration = 196, + VariableDeclaration = 197, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 197, + VariableDeclarationList = 198, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 198, + FunctionDeclaration = 199, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 199, + ClassDeclaration = 200, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 200, + InterfaceDeclaration = 201, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 201, + TypeAliasDeclaration = 202, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 202, + EnumDeclaration = 203, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 203, + ModuleDeclaration = 204, >ModuleDeclaration : SyntaxKind - ModuleBlock = 204, + ModuleBlock = 205, >ModuleBlock : SyntaxKind - CaseBlock = 205, + CaseBlock = 206, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 206, + ImportEqualsDeclaration = 207, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 207, + ImportDeclaration = 208, >ImportDeclaration : SyntaxKind - ImportClause = 208, + ImportClause = 209, >ImportClause : SyntaxKind - NamespaceImport = 209, + NamespaceImport = 210, >NamespaceImport : SyntaxKind - NamedImports = 210, + NamedImports = 211, >NamedImports : SyntaxKind - ImportSpecifier = 211, + ImportSpecifier = 212, >ImportSpecifier : SyntaxKind - ExportAssignment = 212, + ExportAssignment = 213, >ExportAssignment : SyntaxKind - ExportDeclaration = 213, + ExportDeclaration = 214, >ExportDeclaration : SyntaxKind - NamedExports = 214, + NamedExports = 215, >NamedExports : SyntaxKind - ExportSpecifier = 215, + ExportSpecifier = 216, >ExportSpecifier : SyntaxKind - MissingDeclaration = 216, + MissingDeclaration = 217, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 217, + ExternalModuleReference = 218, >ExternalModuleReference : SyntaxKind - CaseClause = 218, + CaseClause = 219, >CaseClause : SyntaxKind - DefaultClause = 219, + DefaultClause = 220, >DefaultClause : SyntaxKind - HeritageClause = 220, + HeritageClause = 221, >HeritageClause : SyntaxKind - CatchClause = 221, + CatchClause = 222, >CatchClause : SyntaxKind - PropertyAssignment = 222, + PropertyAssignment = 223, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 223, + ShorthandPropertyAssignment = 224, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 224, + EnumMember = 225, >EnumMember : SyntaxKind - SourceFile = 225, + SourceFile = 226, >SourceFile : SyntaxKind - SyntaxList = 226, + SyntaxList = 227, >SyntaxList : SyntaxKind - Count = 227, + Count = 228, >Count : SyntaxKind FirstAssignment = 53, @@ -2400,10 +2403,9 @@ declare module "typescript" { _moduleElementBrand: any; >_moduleElementBrand : any } - interface ClassDeclaration extends Declaration, ModuleElement { ->ClassDeclaration : ClassDeclaration + interface ClassLikeDeclaration extends Declaration { +>ClassLikeDeclaration : ClassLikeDeclaration >Declaration : Declaration ->ModuleElement : ModuleElement name?: Identifier; >name : Identifier @@ -2423,6 +2425,16 @@ declare module "typescript" { >members : NodeArray >NodeArray : NodeArray >ClassElement : ClassElement + } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { +>ClassDeclaration : ClassDeclaration +>ClassLikeDeclaration : ClassLikeDeclaration +>Statement : Statement + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { +>ClassExpression : ClassExpression +>ClassLikeDeclaration : ClassLikeDeclaration +>PrimaryExpression : PrimaryExpression } interface ClassElement extends Declaration { >ClassElement : ClassElement diff --git a/tests/baselines/reference/classExpression.errors.txt b/tests/baselines/reference/classExpression.errors.txt index f5028814acc..c8266d0e879 100644 --- a/tests/baselines/reference/classExpression.errors.txt +++ b/tests/baselines/reference/classExpression.errors.txt @@ -1,36 +1,24 @@ -tests/cases/conformance/classes/classExpression.ts(1,9): error TS1109: Expression expected. -tests/cases/conformance/classes/classExpression.ts(5,10): error TS1109: Expression expected. -tests/cases/conformance/classes/classExpression.ts(5,16): error TS1005: ':' expected. -tests/cases/conformance/classes/classExpression.ts(5,16): error TS2304: Cannot find name 'C2'. -tests/cases/conformance/classes/classExpression.ts(5,19): error TS1005: ',' expected. -tests/cases/conformance/classes/classExpression.ts(7,1): error TS1128: Declaration or statement expected. -tests/cases/conformance/classes/classExpression.ts(10,13): error TS1109: Expression expected. +tests/cases/conformance/classes/classExpression.ts(1,15): error TS9003: 'class' expressions are not currently supported. +tests/cases/conformance/classes/classExpression.ts(5,16): error TS9003: 'class' expressions are not currently supported. +tests/cases/conformance/classes/classExpression.ts(10,19): error TS9003: 'class' expressions are not currently supported. -==== tests/cases/conformance/classes/classExpression.ts (7 errors) ==== +==== tests/cases/conformance/classes/classExpression.ts (3 errors) ==== var x = class C { - ~~~~~ -!!! error TS1109: Expression expected. + ~ +!!! error TS9003: 'class' expressions are not currently supported. } var y = { foo: class C2 { - ~~~~~ -!!! error TS1109: Expression expected. ~~ -!!! error TS1005: ':' expected. - ~~ -!!! error TS2304: Cannot find name 'C2'. - ~ -!!! error TS1005: ',' expected. +!!! error TS9003: 'class' expressions are not currently supported. } } - ~ -!!! error TS1128: Declaration or statement expected. module M { var z = class C4 { - ~~~~~ -!!! error TS1109: Expression expected. + ~~ +!!! error TS9003: 'class' expressions are not currently supported. } } \ No newline at end of file diff --git a/tests/baselines/reference/classExpression.js b/tests/baselines/reference/classExpression.js index 6bcf0f46f74..8f3270d13e7 100644 --- a/tests/baselines/reference/classExpression.js +++ b/tests/baselines/reference/classExpression.js @@ -13,18 +13,21 @@ module M { } //// [classExpression.js] -var x = ; -var C = (function () { +var x = (function () { function C() { } return C; })(); var y = { - foo: , class: C2 }, _a = void 0; + foo: (function () { + function C2() { + } + return C2; + })() +}; var M; (function (M) { - var z = ; - var C4 = (function () { + var z = (function () { function C4() { } return C4; diff --git a/tests/baselines/reference/classExpression1.errors.txt b/tests/baselines/reference/classExpression1.errors.txt new file mode 100644 index 00000000000..9d7d14d8571 --- /dev/null +++ b/tests/baselines/reference/classExpression1.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/classes/classExpressions/classExpression1.ts(1,15): error TS9003: 'class' expressions are not currently supported. + + +==== tests/cases/conformance/classes/classExpressions/classExpression1.ts (1 errors) ==== + var v = class C {}; + ~ +!!! error TS9003: 'class' expressions are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/classExpression1.js b/tests/baselines/reference/classExpression1.js new file mode 100644 index 00000000000..68c7bc5e1e7 --- /dev/null +++ b/tests/baselines/reference/classExpression1.js @@ -0,0 +1,9 @@ +//// [classExpression1.ts] +var v = class C {}; + +//// [classExpression1.js] +var v = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/classExpression2.errors.txt b/tests/baselines/reference/classExpression2.errors.txt new file mode 100644 index 00000000000..e2f3ccd77cd --- /dev/null +++ b/tests/baselines/reference/classExpression2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/classes/classExpressions/classExpression2.ts(2,15): error TS9003: 'class' expressions are not currently supported. + + +==== tests/cases/conformance/classes/classExpressions/classExpression2.ts (1 errors) ==== + class D { } + var v = class C extends D {}; + ~ +!!! error TS9003: 'class' expressions are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/classExpression2.js b/tests/baselines/reference/classExpression2.js new file mode 100644 index 00000000000..4220b88fb11 --- /dev/null +++ b/tests/baselines/reference/classExpression2.js @@ -0,0 +1,17 @@ +//// [classExpression2.ts] +class D { } +var v = class C extends D {}; + +//// [classExpression2.js] +var D = (function () { + function D() { + } + return D; +})(); +var v = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(D); diff --git a/tests/baselines/reference/classExpressionES61.errors.txt b/tests/baselines/reference/classExpressionES61.errors.txt new file mode 100644 index 00000000000..abaa5ab893c --- /dev/null +++ b/tests/baselines/reference/classExpressionES61.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/classExpressions/classExpressionES61.ts(1,15): error TS9003: 'class' expressions are not currently supported. + + +==== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts (1 errors) ==== + var v = class C {}; + ~ +!!! error TS9003: 'class' expressions are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/classExpressionES61.js b/tests/baselines/reference/classExpressionES61.js new file mode 100644 index 00000000000..afef0909039 --- /dev/null +++ b/tests/baselines/reference/classExpressionES61.js @@ -0,0 +1,7 @@ +//// [classExpressionES61.ts] +var v = class C {}; + +//// [classExpressionES61.js] +var v = class C { +} +; diff --git a/tests/baselines/reference/classExpressionES62.errors.txt b/tests/baselines/reference/classExpressionES62.errors.txt new file mode 100644 index 00000000000..1e28367a17e --- /dev/null +++ b/tests/baselines/reference/classExpressionES62.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/classExpressions/classExpressionES62.ts(2,15): error TS9003: 'class' expressions are not currently supported. + + +==== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts (1 errors) ==== + class D { } + var v = class C extends D {}; + ~ +!!! error TS9003: 'class' expressions are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/classExpressionES62.js b/tests/baselines/reference/classExpressionES62.js new file mode 100644 index 00000000000..79cede7300d --- /dev/null +++ b/tests/baselines/reference/classExpressionES62.js @@ -0,0 +1,10 @@ +//// [classExpressionES62.ts] +class D { } +var v = class C extends D {}; + +//// [classExpressionES62.js] +class D { +} +var v = class C extends D { +} +; diff --git a/tests/baselines/reference/classInsideBlock.errors.txt b/tests/baselines/reference/classInsideBlock.errors.txt new file mode 100644 index 00000000000..369e77735e2 --- /dev/null +++ b/tests/baselines/reference/classInsideBlock.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. + + +==== tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts (1 errors) ==== + function foo() { + class C { } + ~ +!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. + } \ No newline at end of file diff --git a/tests/baselines/reference/classInsideBlock.js b/tests/baselines/reference/classInsideBlock.js new file mode 100644 index 00000000000..55b3b0bbead --- /dev/null +++ b/tests/baselines/reference/classInsideBlock.js @@ -0,0 +1,13 @@ +//// [classInsideBlock.ts] +function foo() { + class C { } +} + +//// [classInsideBlock.js] +function foo() { + var C = (function () { + function C() { + } + return C; + })(); +} diff --git a/tests/baselines/reference/exportAssignNonIdentifier.errors.txt b/tests/baselines/reference/exportAssignNonIdentifier.errors.txt index 9c9f1aa6874..2935308909b 100644 --- a/tests/baselines/reference/exportAssignNonIdentifier.errors.txt +++ b/tests/baselines/reference/exportAssignNonIdentifier.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/externalModules/foo1.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. -tests/cases/conformance/externalModules/foo3.ts(1,10): error TS1109: Expression expected. +tests/cases/conformance/externalModules/foo3.ts(1,16): error TS9003: 'class' expressions are not currently supported. tests/cases/conformance/externalModules/foo6.ts(1,14): error TS1109: Expression expected. @@ -14,8 +14,8 @@ tests/cases/conformance/externalModules/foo6.ts(1,14): error TS1109: Expression ==== tests/cases/conformance/externalModules/foo3.ts (1 errors) ==== export = class Foo3 {}; // Error, not an expression - ~~~~~ -!!! error TS1109: Expression expected. + ~~~~ +!!! error TS9003: 'class' expressions are not currently supported. ==== tests/cases/conformance/externalModules/foo4.ts (0 errors) ==== export = true; // Ok diff --git a/tests/baselines/reference/exportAssignNonIdentifier.js b/tests/baselines/reference/exportAssignNonIdentifier.js index ffa2fb9ba58..343405c8624 100644 --- a/tests/baselines/reference/exportAssignNonIdentifier.js +++ b/tests/baselines/reference/exportAssignNonIdentifier.js @@ -33,12 +33,11 @@ module.exports = typeof x; //// [foo2.js] module.exports = "sausages"; //// [foo3.js] -var Foo3 = (function () { +module.exports = (function () { function Foo3() { } return Foo3; })(); -; // Error, not an expression //// [foo4.js] module.exports = true; //// [foo5.js] diff --git a/tests/baselines/reference/externModule.errors.txt b/tests/baselines/reference/externModule.errors.txt index eff17eb8586..d16c71ab05b 100644 --- a/tests/baselines/reference/externModule.errors.txt +++ b/tests/baselines/reference/externModule.errors.txt @@ -2,18 +2,15 @@ tests/cases/compiler/externModule.ts(1,1): error TS2304: Cannot find name 'decla tests/cases/compiler/externModule.ts(1,9): error TS1005: ';' expected. tests/cases/compiler/externModule.ts(1,9): error TS2304: Cannot find name 'module'. tests/cases/compiler/externModule.ts(1,16): error TS1005: ';' expected. -tests/cases/compiler/externModule.ts(2,5): error TS1129: Statement expected. -tests/cases/compiler/externModule.ts(2,18): error TS1148: Cannot compile external modules unless the '--module' flag is provided. tests/cases/compiler/externModule.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/externModule.ts(4,10): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/externModule.ts(18,6): error TS2390: Constructor implementation is missing. tests/cases/compiler/externModule.ts(20,13): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/externModule.ts(26,13): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/externModule.ts(28,13): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/compiler/externModule.ts(30,1): error TS1128: Declaration or statement expected. -==== tests/cases/compiler/externModule.ts (13 errors) ==== +==== tests/cases/compiler/externModule.ts (10 errors) ==== declare module { ~~~~~~~ !!! error TS2304: Cannot find name 'declare'. @@ -24,10 +21,6 @@ tests/cases/compiler/externModule.ts(30,1): error TS1128: Declaration or stateme ~ !!! error TS1005: ';' expected. export class XDate { - ~~~~~~ -!!! error TS1129: Statement expected. - ~~~~~ -!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. public getDay():number; ~~~~~~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. @@ -68,8 +61,6 @@ tests/cases/compiler/externModule.ts(30,1): error TS1128: Declaration or stateme !!! error TS2391: Function implementation is missing or not immediately following the declaration. } } - ~ -!!! error TS1128: Declaration or statement expected. var d=new XDate(); d.getDay(); diff --git a/tests/baselines/reference/externModule.js b/tests/baselines/reference/externModule.js index 719b68451ae..bf175f0eeff 100644 --- a/tests/baselines/reference/externModule.js +++ b/tests/baselines/reference/externModule.js @@ -42,13 +42,14 @@ n=XDate.UTC(1964,2,1); //// [externModule.js] declare; module; -{ } -var XDate = (function () { - function XDate() { - } - return XDate; -})(); -exports.XDate = XDate; +{ + var XDate = (function () { + function XDate() { + } + return XDate; + })(); + exports.XDate = XDate; +} var d = new XDate(); d.getDay(); d = new XDate(1978, 2); diff --git a/tests/baselines/reference/nestedClassDeclaration.errors.txt b/tests/baselines/reference/nestedClassDeclaration.errors.txt index f5c5e41ad99..f897c38d681 100644 --- a/tests/baselines/reference/nestedClassDeclaration.errors.txt +++ b/tests/baselines/reference/nestedClassDeclaration.errors.txt @@ -1,14 +1,12 @@ tests/cases/conformance/classes/nestedClassDeclaration.ts(5,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/conformance/classes/nestedClassDeclaration.ts(7,1): error TS1128: Declaration or statement expected. -tests/cases/conformance/classes/nestedClassDeclaration.ts(10,5): error TS1129: Statement expected. -tests/cases/conformance/classes/nestedClassDeclaration.ts(12,1): error TS1128: Declaration or statement expected. tests/cases/conformance/classes/nestedClassDeclaration.ts(15,11): error TS1005: ':' expected. tests/cases/conformance/classes/nestedClassDeclaration.ts(15,11): error TS2304: Cannot find name 'C4'. tests/cases/conformance/classes/nestedClassDeclaration.ts(15,14): error TS1005: ',' expected. tests/cases/conformance/classes/nestedClassDeclaration.ts(17,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/classes/nestedClassDeclaration.ts (8 errors) ==== +==== tests/cases/conformance/classes/nestedClassDeclaration.ts (6 errors) ==== // nested classes are not allowed class C { @@ -23,12 +21,8 @@ tests/cases/conformance/classes/nestedClassDeclaration.ts(17,1): error TS1128: D function foo() { class C3 { - ~~~~~ -!!! error TS1129: Statement expected. } } - ~ -!!! error TS1128: Declaration or statement expected. var x = { class C4 { diff --git a/tests/baselines/reference/nestedClassDeclaration.js b/tests/baselines/reference/nestedClassDeclaration.js index 70445b3372f..2fee6f08ab9 100644 --- a/tests/baselines/reference/nestedClassDeclaration.js +++ b/tests/baselines/reference/nestedClassDeclaration.js @@ -30,11 +30,12 @@ var C2 = (function () { } return C2; })(); -function foo() { } -var C3 = (function () { - function C3() { - } - return C3; -})(); +function foo() { + var C3 = (function () { + function C3() { + } + return C3; + })(); +} var x = { class: C4 }, _a = void 0; diff --git a/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt b/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt index 12e8c8b6500..86bc6fbfd74 100644 --- a/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt @@ -1,8 +1,9 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts(3,13): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts(5,1): error TS1130: 'case' or 'default' expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts(6,2): error TS1005: '}' expected. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts (3 errors) ==== class C { constructor() { switch (e) { @@ -12,4 +13,6 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parser class D { ~~~~~ !!! error TS1130: 'case' or 'default' expected. - } \ No newline at end of file + } + +!!! error TS1005: '}' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.js b/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.js index d7000bc23d7..0fd532dde15 100644 --- a/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.js +++ b/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.js @@ -11,11 +11,11 @@ var C = (function () { function C() { switch (e) { } + var D = (function () { + function D() { + } + return D; + })(); } return C; })(); -var D = (function () { - function D() { - } - return D; -})(); diff --git a/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.errors.txt b/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.errors.txt index c57ca1e3028..35b279b4437 100644 --- a/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.errors.txt +++ b/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.errors.txt @@ -1,8 +1,9 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts(1,5): error TS1134: Variable declaration expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts(3,5): error TS1134: Variable declaration expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts(3,10): error TS1003: Identifier expected. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts (3 errors) ==== var export; ~~~~~~ !!! error TS1134: Variable declaration expected. @@ -10,5 +11,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInv var class; ~~~~~ !!! error TS1134: Variable declaration expected. + ~ +!!! error TS1003: Identifier expected. var bar; \ No newline at end of file diff --git a/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.js b/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.js index 09fcffc1b0d..422b0122466 100644 --- a/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.js +++ b/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.js @@ -9,4 +9,10 @@ var bar; var ; var foo; var ; +var = (function () { + function () { + } + return ; +})(); +; var bar; diff --git a/tests/baselines/reference/withStatementErrors.errors.txt b/tests/baselines/reference/withStatementErrors.errors.txt index 623e35c855c..ba399f51197 100644 --- a/tests/baselines/reference/withStatementErrors.errors.txt +++ b/tests/baselines/reference/withStatementErrors.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/withStatementErrors.ts(3,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. -tests/cases/compiler/withStatementErrors.ts(11,5): error TS1129: Statement expected. +tests/cases/compiler/withStatementErrors.ts(13,5): error TS1129: Statement expected. tests/cases/compiler/withStatementErrors.ts(17,1): error TS1128: Declaration or statement expected. @@ -17,10 +17,10 @@ tests/cases/compiler/withStatementErrors.ts(17,1): error TS1128: Declaration or bar(); // no error class C {} // error - ~~~~~ -!!! error TS1129: Statement expected. interface I {} // error + ~~~~~~~~~ +!!! error TS1129: Statement expected. module M {} // error diff --git a/tests/baselines/reference/withStatementErrors.js b/tests/baselines/reference/withStatementErrors.js index 5a4e0635db4..43236c94d8d 100644 --- a/tests/baselines/reference/withStatementErrors.js +++ b/tests/baselines/reference/withStatementErrors.js @@ -23,10 +23,10 @@ with (ooo.eee.oo.ah_ah.ting.tang.walla.walla) { bing = true; // no error bang = true; // no error function bar() { } // no error - bar(); -} // no error -var C = (function () { - function C() { - } - return C; -})(); // error + bar(); // no error + var C = (function () { + function C() { + } + return C; + })(); +} // error diff --git a/tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts b/tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts new file mode 100644 index 00000000000..efc3ccff9aa --- /dev/null +++ b/tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts @@ -0,0 +1,3 @@ +function foo() { + class C { } +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/classExpressions/classExpression1.ts b/tests/cases/conformance/classes/classExpressions/classExpression1.ts new file mode 100644 index 00000000000..809557f49a3 --- /dev/null +++ b/tests/cases/conformance/classes/classExpressions/classExpression1.ts @@ -0,0 +1 @@ +var v = class C {}; \ No newline at end of file diff --git a/tests/cases/conformance/classes/classExpressions/classExpression2.ts b/tests/cases/conformance/classes/classExpressions/classExpression2.ts new file mode 100644 index 00000000000..6365cd07eba --- /dev/null +++ b/tests/cases/conformance/classes/classExpressions/classExpression2.ts @@ -0,0 +1,2 @@ +class D { } +var v = class C extends D {}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/classExpressions/classExpressionES61.ts b/tests/cases/conformance/es6/classExpressions/classExpressionES61.ts new file mode 100644 index 00000000000..611a2fd4bc1 --- /dev/null +++ b/tests/cases/conformance/es6/classExpressions/classExpressionES61.ts @@ -0,0 +1,2 @@ +// @target: es6 +var v = class C {}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/classExpressions/classExpressionES62.ts b/tests/cases/conformance/es6/classExpressions/classExpressionES62.ts new file mode 100644 index 00000000000..97ca36a4162 --- /dev/null +++ b/tests/cases/conformance/es6/classExpressions/classExpressionES62.ts @@ -0,0 +1,3 @@ +// @target: es6 +class D { } +var v = class C extends D {}; \ No newline at end of file diff --git a/tests/cases/fourslash/getOccurrencesReturnBroken.ts b/tests/cases/fourslash/getOccurrencesReturnBroken.ts index 08ec794f7e8..2327a62d12c 100644 --- a/tests/cases/fourslash/getOccurrencesReturnBroken.ts +++ b/tests/cases/fourslash/getOccurrencesReturnBroken.ts @@ -44,11 +44,13 @@ for (var i = 1; i <= test.markers().length; i++) { switch (i) { case 0: case 1: - case 4: verify.occurrencesAtPositionCount(0); break; case 3: verify.occurrencesAtPositionCount(1); // 'return' is an instance member break; + case 4: + verify.occurrencesAtPositionCount(4); + break; } } \ No newline at end of file diff --git a/tests/cases/fourslash/identifierErrorRecovery.ts b/tests/cases/fourslash/identifierErrorRecovery.ts index 3ba5d11469d..cb266584b04 100644 --- a/tests/cases/fourslash/identifierErrorRecovery.ts +++ b/tests/cases/fourslash/identifierErrorRecovery.ts @@ -8,7 +8,7 @@ verify.errorExistsBetweenMarkers("1", "2"); verify.errorExistsBetweenMarkers("3", "4"); -verify.numberOfErrorsInCurrentFile(2); +verify.numberOfErrorsInCurrentFile(3); goTo.eof(); verify.completionListContains("foo"); verify.completionListContains("bar"); From b363a459ff8325d110b2614f9ede154def494a55 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 14:12:35 -0700 Subject: [PATCH 31/61] Add support for semicolons in class bodies --- src/compiler/binder.ts | 1 - src/compiler/emitter.ts | 14 +- src/compiler/parser.ts | 13 +- src/compiler/types.ts | 6 + .../baselines/reference/APISample_compile.js | 106 +++++++-------- .../reference/APISample_compile.types | 112 ++++++++-------- tests/baselines/reference/APISample_linter.js | 122 +++++++++--------- .../reference/APISample_linter.types | 112 ++++++++-------- .../reference/APISample_transform.js | 106 +++++++-------- .../reference/APISample_transform.types | 112 ++++++++-------- .../baselines/reference/APISample_watcher.js | 106 +++++++-------- .../reference/APISample_watcher.types | 112 ++++++++-------- .../classWithSemicolonClassElement1.js | 12 ++ .../classWithSemicolonClassElement1.types | 6 + .../classWithSemicolonClassElement2.js | 14 ++ .../classWithSemicolonClassElement2.types | 7 + .../classWithSemicolonClassElementES61.js | 9 ++ .../classWithSemicolonClassElementES61.types | 6 + .../classWithSemicolonClassElementES62.js | 11 ++ .../classWithSemicolonClassElementES62.types | 7 + .../reference/es6ClassTest3.errors.txt | 23 ---- tests/baselines/reference/es6ClassTest3.js | 2 + tests/baselines/reference/es6ClassTest3.types | 37 ++++++ .../reference/exportDeclareClass1.errors.txt | 12 +- .../reference/parser0_004152.errors.txt | 5 +- tests/baselines/reference/parser0_004152.js | 1 + .../parserErrantSemicolonInClass1.errors.txt | 17 ++- .../parserErrantSemicolonInClass1.js | 1 + ...sWhenHittingUnexpectedSemicolon.errors.txt | 11 -- ...sRecoversWhenHittingUnexpectedSemicolon.js | 1 + ...coversWhenHittingUnexpectedSemicolon.types | 11 ++ .../reference/primitiveMembers.errors.txt | 8 +- tests/baselines/reference/primitiveMembers.js | 2 + .../classWithSemicolonClassElement1.ts | 3 + .../classWithSemicolonClassElement2.ts | 4 + .../classWithSemicolonClassElementES61.ts | 4 + .../classWithSemicolonClassElementES62.ts | 5 + 37 files changed, 666 insertions(+), 475 deletions(-) create mode 100644 tests/baselines/reference/classWithSemicolonClassElement1.js create mode 100644 tests/baselines/reference/classWithSemicolonClassElement1.types create mode 100644 tests/baselines/reference/classWithSemicolonClassElement2.js create mode 100644 tests/baselines/reference/classWithSemicolonClassElement2.types create mode 100644 tests/baselines/reference/classWithSemicolonClassElementES61.js create mode 100644 tests/baselines/reference/classWithSemicolonClassElementES61.types create mode 100644 tests/baselines/reference/classWithSemicolonClassElementES62.js create mode 100644 tests/baselines/reference/classWithSemicolonClassElementES62.types delete mode 100644 tests/baselines/reference/es6ClassTest3.errors.txt create mode 100644 tests/baselines/reference/es6ClassTest3.types delete mode 100644 tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.errors.txt create mode 100644 tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.types create mode 100644 tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement1.ts create mode 100644 tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement2.ts create mode 100644 tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES61.ts create mode 100644 tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES62.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index d3dafb61e76..0ae33d08fd6 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -126,7 +126,6 @@ module ts { return (node).isExportEquals ? "export=" : "default"; case SyntaxKind.FunctionDeclaration: case SyntaxKind.ClassDeclaration: - case SyntaxKind.ClassExpression: return node.flags & NodeFlags.Default ? "default" : undefined; } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 60a09fb20ef..dc532972b43 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3219,7 +3219,11 @@ module ts { function emitMemberFunctionsForES5AndLower(node: ClassLikeDeclaration) { forEach(node.members, member => { - if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) { + if (member.kind === SyntaxKind.SemicolonClassElement) { + writeLine(); + write(";"); + } + else if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) { if (!(member).body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -3292,7 +3296,9 @@ module ts { if ((member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) && !(member).body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature || member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) { + else if (member.kind === SyntaxKind.MethodDeclaration || + member.kind === SyntaxKind.GetAccessor || + member.kind === SyntaxKind.SetAccessor) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -3311,6 +3317,10 @@ module ts { emitEnd(member); emitTrailingComments(member); } + else if (member.kind === SyntaxKind.SemicolonClassElement) { + writeLine(); + write(";"); + } } } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f728536e72a..2972fba3979 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1609,7 +1609,11 @@ module ts { case ParsingContext.TypeMembers: return isStartOfTypeMember(); case ParsingContext.ClassMembers: - return lookAhead(isClassMemberStart); + // We allow semicolons as class elements (as specified by ES6) as long as we're + // not in error recovery. If we're in error recovery, we don't want an errant + // semicolon to be treated as a class member (since they're almost always used + // for statements. + return lookAhead(isClassMemberStart) || (token === SyntaxKind.SemicolonToken && !inErrorRecovery); case ParsingContext.EnumMembers: // Include open bracket computed properties. This technically also lets in indexers, // which would be a candidate for improved error reporting. @@ -1996,6 +2000,7 @@ module ts { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.PropertyDeclaration: + case SyntaxKind.SemicolonClassElement: return true; } } @@ -4692,6 +4697,12 @@ module ts { } function parseClassElement(): ClassElement { + if (token === SyntaxKind.SemicolonToken) { + let result = createNode(SyntaxKind.SemicolonClassElement); + nextToken(); + return finishNode(result); + } + let fullStart = getNodePos(); let decorators = parseDecorators(); let modifiers = parseModifiers(); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 08c8985b144..82af3dfde08 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -208,6 +208,7 @@ module ts { // Misc TemplateSpan, HeritageClauseElement, + SemicolonClassElement, // Element Block, VariableStatement, @@ -538,6 +539,11 @@ module ts { body?: Block; } + // For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. + export interface SemicolonClassElement extends ClassElement { + _semicolonClassElementBrand: any; + } + // See the comment on MethodDeclaration for the intuition behind AccessorDeclaration being a // ClassElement and an ObjectLiteralElement. export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 9bbd1bb1af4..3d49f246132 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -237,57 +237,58 @@ declare module "typescript" { OmittedExpression = 175, TemplateSpan = 176, HeritageClauseElement = 177, - Block = 178, - VariableStatement = 179, - EmptyStatement = 180, - ExpressionStatement = 181, - IfStatement = 182, - DoStatement = 183, - WhileStatement = 184, - ForStatement = 185, - ForInStatement = 186, - ForOfStatement = 187, - ContinueStatement = 188, - BreakStatement = 189, - ReturnStatement = 190, - WithStatement = 191, - SwitchStatement = 192, - LabeledStatement = 193, - ThrowStatement = 194, - TryStatement = 195, - DebuggerStatement = 196, - VariableDeclaration = 197, - VariableDeclarationList = 198, - FunctionDeclaration = 199, - ClassDeclaration = 200, - InterfaceDeclaration = 201, - TypeAliasDeclaration = 202, - EnumDeclaration = 203, - ModuleDeclaration = 204, - ModuleBlock = 205, - CaseBlock = 206, - ImportEqualsDeclaration = 207, - ImportDeclaration = 208, - ImportClause = 209, - NamespaceImport = 210, - NamedImports = 211, - ImportSpecifier = 212, - ExportAssignment = 213, - ExportDeclaration = 214, - NamedExports = 215, - ExportSpecifier = 216, - MissingDeclaration = 217, - ExternalModuleReference = 218, - CaseClause = 219, - DefaultClause = 220, - HeritageClause = 221, - CatchClause = 222, - PropertyAssignment = 223, - ShorthandPropertyAssignment = 224, - EnumMember = 225, - SourceFile = 226, - SyntaxList = 227, - Count = 228, + SemicolonClassElement = 178, + Block = 179, + VariableStatement = 180, + EmptyStatement = 181, + ExpressionStatement = 182, + IfStatement = 183, + DoStatement = 184, + WhileStatement = 185, + ForStatement = 186, + ForInStatement = 187, + ForOfStatement = 188, + ContinueStatement = 189, + BreakStatement = 190, + ReturnStatement = 191, + WithStatement = 192, + SwitchStatement = 193, + LabeledStatement = 194, + ThrowStatement = 195, + TryStatement = 196, + DebuggerStatement = 197, + VariableDeclaration = 198, + VariableDeclarationList = 199, + FunctionDeclaration = 200, + ClassDeclaration = 201, + InterfaceDeclaration = 202, + TypeAliasDeclaration = 203, + EnumDeclaration = 204, + ModuleDeclaration = 205, + ModuleBlock = 206, + CaseBlock = 207, + ImportEqualsDeclaration = 208, + ImportDeclaration = 209, + ImportClause = 210, + NamespaceImport = 211, + NamedImports = 212, + ImportSpecifier = 213, + ExportAssignment = 214, + ExportDeclaration = 215, + NamedExports = 216, + ExportSpecifier = 217, + MissingDeclaration = 218, + ExternalModuleReference = 219, + CaseClause = 220, + DefaultClause = 221, + HeritageClause = 222, + CatchClause = 223, + PropertyAssignment = 224, + ShorthandPropertyAssignment = 225, + EnumMember = 226, + SourceFile = 227, + SyntaxList = 228, + Count = 229, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -471,6 +472,9 @@ declare module "typescript" { interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { body?: Block; } + interface SemicolonClassElement extends ClassElement { + _semicolonClassElementBrand: any; + } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; body: Block; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index ca965a9161d..2f25a4a588a 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -729,157 +729,160 @@ declare module "typescript" { HeritageClauseElement = 177, >HeritageClauseElement : SyntaxKind - Block = 178, + SemicolonClassElement = 178, +>SemicolonClassElement : SyntaxKind + + Block = 179, >Block : SyntaxKind - VariableStatement = 179, + VariableStatement = 180, >VariableStatement : SyntaxKind - EmptyStatement = 180, + EmptyStatement = 181, >EmptyStatement : SyntaxKind - ExpressionStatement = 181, + ExpressionStatement = 182, >ExpressionStatement : SyntaxKind - IfStatement = 182, + IfStatement = 183, >IfStatement : SyntaxKind - DoStatement = 183, + DoStatement = 184, >DoStatement : SyntaxKind - WhileStatement = 184, + WhileStatement = 185, >WhileStatement : SyntaxKind - ForStatement = 185, + ForStatement = 186, >ForStatement : SyntaxKind - ForInStatement = 186, + ForInStatement = 187, >ForInStatement : SyntaxKind - ForOfStatement = 187, + ForOfStatement = 188, >ForOfStatement : SyntaxKind - ContinueStatement = 188, + ContinueStatement = 189, >ContinueStatement : SyntaxKind - BreakStatement = 189, + BreakStatement = 190, >BreakStatement : SyntaxKind - ReturnStatement = 190, + ReturnStatement = 191, >ReturnStatement : SyntaxKind - WithStatement = 191, + WithStatement = 192, >WithStatement : SyntaxKind - SwitchStatement = 192, + SwitchStatement = 193, >SwitchStatement : SyntaxKind - LabeledStatement = 193, + LabeledStatement = 194, >LabeledStatement : SyntaxKind - ThrowStatement = 194, + ThrowStatement = 195, >ThrowStatement : SyntaxKind - TryStatement = 195, + TryStatement = 196, >TryStatement : SyntaxKind - DebuggerStatement = 196, + DebuggerStatement = 197, >DebuggerStatement : SyntaxKind - VariableDeclaration = 197, + VariableDeclaration = 198, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 198, + VariableDeclarationList = 199, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 199, + FunctionDeclaration = 200, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 200, + ClassDeclaration = 201, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 201, + InterfaceDeclaration = 202, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 202, + TypeAliasDeclaration = 203, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 203, + EnumDeclaration = 204, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 204, + ModuleDeclaration = 205, >ModuleDeclaration : SyntaxKind - ModuleBlock = 205, + ModuleBlock = 206, >ModuleBlock : SyntaxKind - CaseBlock = 206, + CaseBlock = 207, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 207, + ImportEqualsDeclaration = 208, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 208, + ImportDeclaration = 209, >ImportDeclaration : SyntaxKind - ImportClause = 209, + ImportClause = 210, >ImportClause : SyntaxKind - NamespaceImport = 210, + NamespaceImport = 211, >NamespaceImport : SyntaxKind - NamedImports = 211, + NamedImports = 212, >NamedImports : SyntaxKind - ImportSpecifier = 212, + ImportSpecifier = 213, >ImportSpecifier : SyntaxKind - ExportAssignment = 213, + ExportAssignment = 214, >ExportAssignment : SyntaxKind - ExportDeclaration = 214, + ExportDeclaration = 215, >ExportDeclaration : SyntaxKind - NamedExports = 215, + NamedExports = 216, >NamedExports : SyntaxKind - ExportSpecifier = 216, + ExportSpecifier = 217, >ExportSpecifier : SyntaxKind - MissingDeclaration = 217, + MissingDeclaration = 218, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 218, + ExternalModuleReference = 219, >ExternalModuleReference : SyntaxKind - CaseClause = 219, + CaseClause = 220, >CaseClause : SyntaxKind - DefaultClause = 220, + DefaultClause = 221, >DefaultClause : SyntaxKind - HeritageClause = 221, + HeritageClause = 222, >HeritageClause : SyntaxKind - CatchClause = 222, + CatchClause = 223, >CatchClause : SyntaxKind - PropertyAssignment = 223, + PropertyAssignment = 224, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 224, + ShorthandPropertyAssignment = 225, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 225, + EnumMember = 226, >EnumMember : SyntaxKind - SourceFile = 226, + SourceFile = 227, >SourceFile : SyntaxKind - SyntaxList = 227, + SyntaxList = 228, >SyntaxList : SyntaxKind - Count = 228, + Count = 229, >Count : SyntaxKind FirstAssignment = 53, @@ -1436,6 +1439,13 @@ declare module "typescript" { body?: Block; >body : Block >Block : Block + } + interface SemicolonClassElement extends ClassElement { +>SemicolonClassElement : SemicolonClassElement +>ClassElement : ClassElement + + _semicolonClassElementBrand: any; +>_semicolonClassElementBrand : any } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { >AccessorDeclaration : AccessorDeclaration diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index d7d3ece0c86..71e67ebec6b 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -268,57 +268,58 @@ declare module "typescript" { OmittedExpression = 175, TemplateSpan = 176, HeritageClauseElement = 177, - Block = 178, - VariableStatement = 179, - EmptyStatement = 180, - ExpressionStatement = 181, - IfStatement = 182, - DoStatement = 183, - WhileStatement = 184, - ForStatement = 185, - ForInStatement = 186, - ForOfStatement = 187, - ContinueStatement = 188, - BreakStatement = 189, - ReturnStatement = 190, - WithStatement = 191, - SwitchStatement = 192, - LabeledStatement = 193, - ThrowStatement = 194, - TryStatement = 195, - DebuggerStatement = 196, - VariableDeclaration = 197, - VariableDeclarationList = 198, - FunctionDeclaration = 199, - ClassDeclaration = 200, - InterfaceDeclaration = 201, - TypeAliasDeclaration = 202, - EnumDeclaration = 203, - ModuleDeclaration = 204, - ModuleBlock = 205, - CaseBlock = 206, - ImportEqualsDeclaration = 207, - ImportDeclaration = 208, - ImportClause = 209, - NamespaceImport = 210, - NamedImports = 211, - ImportSpecifier = 212, - ExportAssignment = 213, - ExportDeclaration = 214, - NamedExports = 215, - ExportSpecifier = 216, - MissingDeclaration = 217, - ExternalModuleReference = 218, - CaseClause = 219, - DefaultClause = 220, - HeritageClause = 221, - CatchClause = 222, - PropertyAssignment = 223, - ShorthandPropertyAssignment = 224, - EnumMember = 225, - SourceFile = 226, - SyntaxList = 227, - Count = 228, + SemicolonClassElement = 178, + Block = 179, + VariableStatement = 180, + EmptyStatement = 181, + ExpressionStatement = 182, + IfStatement = 183, + DoStatement = 184, + WhileStatement = 185, + ForStatement = 186, + ForInStatement = 187, + ForOfStatement = 188, + ContinueStatement = 189, + BreakStatement = 190, + ReturnStatement = 191, + WithStatement = 192, + SwitchStatement = 193, + LabeledStatement = 194, + ThrowStatement = 195, + TryStatement = 196, + DebuggerStatement = 197, + VariableDeclaration = 198, + VariableDeclarationList = 199, + FunctionDeclaration = 200, + ClassDeclaration = 201, + InterfaceDeclaration = 202, + TypeAliasDeclaration = 203, + EnumDeclaration = 204, + ModuleDeclaration = 205, + ModuleBlock = 206, + CaseBlock = 207, + ImportEqualsDeclaration = 208, + ImportDeclaration = 209, + ImportClause = 210, + NamespaceImport = 211, + NamedImports = 212, + ImportSpecifier = 213, + ExportAssignment = 214, + ExportDeclaration = 215, + NamedExports = 216, + ExportSpecifier = 217, + MissingDeclaration = 218, + ExternalModuleReference = 219, + CaseClause = 220, + DefaultClause = 221, + HeritageClause = 222, + CatchClause = 223, + PropertyAssignment = 224, + ShorthandPropertyAssignment = 225, + EnumMember = 226, + SourceFile = 227, + SyntaxList = 228, + Count = 229, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -502,6 +503,9 @@ declare module "typescript" { interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { body?: Block; } + interface SemicolonClassElement extends ClassElement { + _semicolonClassElementBrand: any; + } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; body: Block; @@ -2052,21 +2056,21 @@ function delint(sourceFile) { delintNode(sourceFile); function delintNode(node) { switch (node.kind) { - case 185 /* ForStatement */: - case 186 /* ForInStatement */: - case 184 /* WhileStatement */: - case 183 /* DoStatement */: - if (node.statement.kind !== 178 /* Block */) { + case 186 /* ForStatement */: + case 187 /* ForInStatement */: + case 185 /* WhileStatement */: + case 184 /* DoStatement */: + if (node.statement.kind !== 179 /* Block */) { report(node, "A looping statement's contents should be wrapped in a block body."); } break; - case 182 /* IfStatement */: + case 183 /* IfStatement */: var ifStatement = node; - if (ifStatement.thenStatement.kind !== 178 /* Block */) { + if (ifStatement.thenStatement.kind !== 179 /* Block */) { report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); } if (ifStatement.elseStatement && - ifStatement.elseStatement.kind !== 178 /* Block */ && ifStatement.elseStatement.kind !== 182 /* IfStatement */) { + ifStatement.elseStatement.kind !== 179 /* Block */ && ifStatement.elseStatement.kind !== 183 /* IfStatement */) { report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); } break; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index e68910b26e6..eb4a2f8a02e 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -875,157 +875,160 @@ declare module "typescript" { HeritageClauseElement = 177, >HeritageClauseElement : SyntaxKind - Block = 178, + SemicolonClassElement = 178, +>SemicolonClassElement : SyntaxKind + + Block = 179, >Block : SyntaxKind - VariableStatement = 179, + VariableStatement = 180, >VariableStatement : SyntaxKind - EmptyStatement = 180, + EmptyStatement = 181, >EmptyStatement : SyntaxKind - ExpressionStatement = 181, + ExpressionStatement = 182, >ExpressionStatement : SyntaxKind - IfStatement = 182, + IfStatement = 183, >IfStatement : SyntaxKind - DoStatement = 183, + DoStatement = 184, >DoStatement : SyntaxKind - WhileStatement = 184, + WhileStatement = 185, >WhileStatement : SyntaxKind - ForStatement = 185, + ForStatement = 186, >ForStatement : SyntaxKind - ForInStatement = 186, + ForInStatement = 187, >ForInStatement : SyntaxKind - ForOfStatement = 187, + ForOfStatement = 188, >ForOfStatement : SyntaxKind - ContinueStatement = 188, + ContinueStatement = 189, >ContinueStatement : SyntaxKind - BreakStatement = 189, + BreakStatement = 190, >BreakStatement : SyntaxKind - ReturnStatement = 190, + ReturnStatement = 191, >ReturnStatement : SyntaxKind - WithStatement = 191, + WithStatement = 192, >WithStatement : SyntaxKind - SwitchStatement = 192, + SwitchStatement = 193, >SwitchStatement : SyntaxKind - LabeledStatement = 193, + LabeledStatement = 194, >LabeledStatement : SyntaxKind - ThrowStatement = 194, + ThrowStatement = 195, >ThrowStatement : SyntaxKind - TryStatement = 195, + TryStatement = 196, >TryStatement : SyntaxKind - DebuggerStatement = 196, + DebuggerStatement = 197, >DebuggerStatement : SyntaxKind - VariableDeclaration = 197, + VariableDeclaration = 198, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 198, + VariableDeclarationList = 199, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 199, + FunctionDeclaration = 200, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 200, + ClassDeclaration = 201, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 201, + InterfaceDeclaration = 202, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 202, + TypeAliasDeclaration = 203, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 203, + EnumDeclaration = 204, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 204, + ModuleDeclaration = 205, >ModuleDeclaration : SyntaxKind - ModuleBlock = 205, + ModuleBlock = 206, >ModuleBlock : SyntaxKind - CaseBlock = 206, + CaseBlock = 207, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 207, + ImportEqualsDeclaration = 208, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 208, + ImportDeclaration = 209, >ImportDeclaration : SyntaxKind - ImportClause = 209, + ImportClause = 210, >ImportClause : SyntaxKind - NamespaceImport = 210, + NamespaceImport = 211, >NamespaceImport : SyntaxKind - NamedImports = 211, + NamedImports = 212, >NamedImports : SyntaxKind - ImportSpecifier = 212, + ImportSpecifier = 213, >ImportSpecifier : SyntaxKind - ExportAssignment = 213, + ExportAssignment = 214, >ExportAssignment : SyntaxKind - ExportDeclaration = 214, + ExportDeclaration = 215, >ExportDeclaration : SyntaxKind - NamedExports = 215, + NamedExports = 216, >NamedExports : SyntaxKind - ExportSpecifier = 216, + ExportSpecifier = 217, >ExportSpecifier : SyntaxKind - MissingDeclaration = 217, + MissingDeclaration = 218, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 218, + ExternalModuleReference = 219, >ExternalModuleReference : SyntaxKind - CaseClause = 219, + CaseClause = 220, >CaseClause : SyntaxKind - DefaultClause = 220, + DefaultClause = 221, >DefaultClause : SyntaxKind - HeritageClause = 221, + HeritageClause = 222, >HeritageClause : SyntaxKind - CatchClause = 222, + CatchClause = 223, >CatchClause : SyntaxKind - PropertyAssignment = 223, + PropertyAssignment = 224, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 224, + ShorthandPropertyAssignment = 225, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 225, + EnumMember = 226, >EnumMember : SyntaxKind - SourceFile = 226, + SourceFile = 227, >SourceFile : SyntaxKind - SyntaxList = 227, + SyntaxList = 228, >SyntaxList : SyntaxKind - Count = 228, + Count = 229, >Count : SyntaxKind FirstAssignment = 53, @@ -1582,6 +1585,13 @@ declare module "typescript" { body?: Block; >body : Block >Block : Block + } + interface SemicolonClassElement extends ClassElement { +>SemicolonClassElement : SemicolonClassElement +>ClassElement : ClassElement + + _semicolonClassElementBrand: any; +>_semicolonClassElementBrand : any } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { >AccessorDeclaration : AccessorDeclaration diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index aac968cade7..cacd6bed772 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -269,57 +269,58 @@ declare module "typescript" { OmittedExpression = 175, TemplateSpan = 176, HeritageClauseElement = 177, - Block = 178, - VariableStatement = 179, - EmptyStatement = 180, - ExpressionStatement = 181, - IfStatement = 182, - DoStatement = 183, - WhileStatement = 184, - ForStatement = 185, - ForInStatement = 186, - ForOfStatement = 187, - ContinueStatement = 188, - BreakStatement = 189, - ReturnStatement = 190, - WithStatement = 191, - SwitchStatement = 192, - LabeledStatement = 193, - ThrowStatement = 194, - TryStatement = 195, - DebuggerStatement = 196, - VariableDeclaration = 197, - VariableDeclarationList = 198, - FunctionDeclaration = 199, - ClassDeclaration = 200, - InterfaceDeclaration = 201, - TypeAliasDeclaration = 202, - EnumDeclaration = 203, - ModuleDeclaration = 204, - ModuleBlock = 205, - CaseBlock = 206, - ImportEqualsDeclaration = 207, - ImportDeclaration = 208, - ImportClause = 209, - NamespaceImport = 210, - NamedImports = 211, - ImportSpecifier = 212, - ExportAssignment = 213, - ExportDeclaration = 214, - NamedExports = 215, - ExportSpecifier = 216, - MissingDeclaration = 217, - ExternalModuleReference = 218, - CaseClause = 219, - DefaultClause = 220, - HeritageClause = 221, - CatchClause = 222, - PropertyAssignment = 223, - ShorthandPropertyAssignment = 224, - EnumMember = 225, - SourceFile = 226, - SyntaxList = 227, - Count = 228, + SemicolonClassElement = 178, + Block = 179, + VariableStatement = 180, + EmptyStatement = 181, + ExpressionStatement = 182, + IfStatement = 183, + DoStatement = 184, + WhileStatement = 185, + ForStatement = 186, + ForInStatement = 187, + ForOfStatement = 188, + ContinueStatement = 189, + BreakStatement = 190, + ReturnStatement = 191, + WithStatement = 192, + SwitchStatement = 193, + LabeledStatement = 194, + ThrowStatement = 195, + TryStatement = 196, + DebuggerStatement = 197, + VariableDeclaration = 198, + VariableDeclarationList = 199, + FunctionDeclaration = 200, + ClassDeclaration = 201, + InterfaceDeclaration = 202, + TypeAliasDeclaration = 203, + EnumDeclaration = 204, + ModuleDeclaration = 205, + ModuleBlock = 206, + CaseBlock = 207, + ImportEqualsDeclaration = 208, + ImportDeclaration = 209, + ImportClause = 210, + NamespaceImport = 211, + NamedImports = 212, + ImportSpecifier = 213, + ExportAssignment = 214, + ExportDeclaration = 215, + NamedExports = 216, + ExportSpecifier = 217, + MissingDeclaration = 218, + ExternalModuleReference = 219, + CaseClause = 220, + DefaultClause = 221, + HeritageClause = 222, + CatchClause = 223, + PropertyAssignment = 224, + ShorthandPropertyAssignment = 225, + EnumMember = 226, + SourceFile = 227, + SyntaxList = 228, + Count = 229, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -503,6 +504,9 @@ declare module "typescript" { interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { body?: Block; } + interface SemicolonClassElement extends ClassElement { + _semicolonClassElementBrand: any; + } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; body: Block; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 9c546b8c828..284588b13f9 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -825,157 +825,160 @@ declare module "typescript" { HeritageClauseElement = 177, >HeritageClauseElement : SyntaxKind - Block = 178, + SemicolonClassElement = 178, +>SemicolonClassElement : SyntaxKind + + Block = 179, >Block : SyntaxKind - VariableStatement = 179, + VariableStatement = 180, >VariableStatement : SyntaxKind - EmptyStatement = 180, + EmptyStatement = 181, >EmptyStatement : SyntaxKind - ExpressionStatement = 181, + ExpressionStatement = 182, >ExpressionStatement : SyntaxKind - IfStatement = 182, + IfStatement = 183, >IfStatement : SyntaxKind - DoStatement = 183, + DoStatement = 184, >DoStatement : SyntaxKind - WhileStatement = 184, + WhileStatement = 185, >WhileStatement : SyntaxKind - ForStatement = 185, + ForStatement = 186, >ForStatement : SyntaxKind - ForInStatement = 186, + ForInStatement = 187, >ForInStatement : SyntaxKind - ForOfStatement = 187, + ForOfStatement = 188, >ForOfStatement : SyntaxKind - ContinueStatement = 188, + ContinueStatement = 189, >ContinueStatement : SyntaxKind - BreakStatement = 189, + BreakStatement = 190, >BreakStatement : SyntaxKind - ReturnStatement = 190, + ReturnStatement = 191, >ReturnStatement : SyntaxKind - WithStatement = 191, + WithStatement = 192, >WithStatement : SyntaxKind - SwitchStatement = 192, + SwitchStatement = 193, >SwitchStatement : SyntaxKind - LabeledStatement = 193, + LabeledStatement = 194, >LabeledStatement : SyntaxKind - ThrowStatement = 194, + ThrowStatement = 195, >ThrowStatement : SyntaxKind - TryStatement = 195, + TryStatement = 196, >TryStatement : SyntaxKind - DebuggerStatement = 196, + DebuggerStatement = 197, >DebuggerStatement : SyntaxKind - VariableDeclaration = 197, + VariableDeclaration = 198, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 198, + VariableDeclarationList = 199, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 199, + FunctionDeclaration = 200, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 200, + ClassDeclaration = 201, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 201, + InterfaceDeclaration = 202, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 202, + TypeAliasDeclaration = 203, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 203, + EnumDeclaration = 204, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 204, + ModuleDeclaration = 205, >ModuleDeclaration : SyntaxKind - ModuleBlock = 205, + ModuleBlock = 206, >ModuleBlock : SyntaxKind - CaseBlock = 206, + CaseBlock = 207, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 207, + ImportEqualsDeclaration = 208, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 208, + ImportDeclaration = 209, >ImportDeclaration : SyntaxKind - ImportClause = 209, + ImportClause = 210, >ImportClause : SyntaxKind - NamespaceImport = 210, + NamespaceImport = 211, >NamespaceImport : SyntaxKind - NamedImports = 211, + NamedImports = 212, >NamedImports : SyntaxKind - ImportSpecifier = 212, + ImportSpecifier = 213, >ImportSpecifier : SyntaxKind - ExportAssignment = 213, + ExportAssignment = 214, >ExportAssignment : SyntaxKind - ExportDeclaration = 214, + ExportDeclaration = 215, >ExportDeclaration : SyntaxKind - NamedExports = 215, + NamedExports = 216, >NamedExports : SyntaxKind - ExportSpecifier = 216, + ExportSpecifier = 217, >ExportSpecifier : SyntaxKind - MissingDeclaration = 217, + MissingDeclaration = 218, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 218, + ExternalModuleReference = 219, >ExternalModuleReference : SyntaxKind - CaseClause = 219, + CaseClause = 220, >CaseClause : SyntaxKind - DefaultClause = 220, + DefaultClause = 221, >DefaultClause : SyntaxKind - HeritageClause = 221, + HeritageClause = 222, >HeritageClause : SyntaxKind - CatchClause = 222, + CatchClause = 223, >CatchClause : SyntaxKind - PropertyAssignment = 223, + PropertyAssignment = 224, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 224, + ShorthandPropertyAssignment = 225, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 225, + EnumMember = 226, >EnumMember : SyntaxKind - SourceFile = 226, + SourceFile = 227, >SourceFile : SyntaxKind - SyntaxList = 227, + SyntaxList = 228, >SyntaxList : SyntaxKind - Count = 228, + Count = 229, >Count : SyntaxKind FirstAssignment = 53, @@ -1532,6 +1535,13 @@ declare module "typescript" { body?: Block; >body : Block >Block : Block + } + interface SemicolonClassElement extends ClassElement { +>SemicolonClassElement : SemicolonClassElement +>ClassElement : ClassElement + + _semicolonClassElementBrand: any; +>_semicolonClassElementBrand : any } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { >AccessorDeclaration : AccessorDeclaration diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index e3280bfb2cf..5b04b7cff17 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -306,57 +306,58 @@ declare module "typescript" { OmittedExpression = 175, TemplateSpan = 176, HeritageClauseElement = 177, - Block = 178, - VariableStatement = 179, - EmptyStatement = 180, - ExpressionStatement = 181, - IfStatement = 182, - DoStatement = 183, - WhileStatement = 184, - ForStatement = 185, - ForInStatement = 186, - ForOfStatement = 187, - ContinueStatement = 188, - BreakStatement = 189, - ReturnStatement = 190, - WithStatement = 191, - SwitchStatement = 192, - LabeledStatement = 193, - ThrowStatement = 194, - TryStatement = 195, - DebuggerStatement = 196, - VariableDeclaration = 197, - VariableDeclarationList = 198, - FunctionDeclaration = 199, - ClassDeclaration = 200, - InterfaceDeclaration = 201, - TypeAliasDeclaration = 202, - EnumDeclaration = 203, - ModuleDeclaration = 204, - ModuleBlock = 205, - CaseBlock = 206, - ImportEqualsDeclaration = 207, - ImportDeclaration = 208, - ImportClause = 209, - NamespaceImport = 210, - NamedImports = 211, - ImportSpecifier = 212, - ExportAssignment = 213, - ExportDeclaration = 214, - NamedExports = 215, - ExportSpecifier = 216, - MissingDeclaration = 217, - ExternalModuleReference = 218, - CaseClause = 219, - DefaultClause = 220, - HeritageClause = 221, - CatchClause = 222, - PropertyAssignment = 223, - ShorthandPropertyAssignment = 224, - EnumMember = 225, - SourceFile = 226, - SyntaxList = 227, - Count = 228, + SemicolonClassElement = 178, + Block = 179, + VariableStatement = 180, + EmptyStatement = 181, + ExpressionStatement = 182, + IfStatement = 183, + DoStatement = 184, + WhileStatement = 185, + ForStatement = 186, + ForInStatement = 187, + ForOfStatement = 188, + ContinueStatement = 189, + BreakStatement = 190, + ReturnStatement = 191, + WithStatement = 192, + SwitchStatement = 193, + LabeledStatement = 194, + ThrowStatement = 195, + TryStatement = 196, + DebuggerStatement = 197, + VariableDeclaration = 198, + VariableDeclarationList = 199, + FunctionDeclaration = 200, + ClassDeclaration = 201, + InterfaceDeclaration = 202, + TypeAliasDeclaration = 203, + EnumDeclaration = 204, + ModuleDeclaration = 205, + ModuleBlock = 206, + CaseBlock = 207, + ImportEqualsDeclaration = 208, + ImportDeclaration = 209, + ImportClause = 210, + NamespaceImport = 211, + NamedImports = 212, + ImportSpecifier = 213, + ExportAssignment = 214, + ExportDeclaration = 215, + NamedExports = 216, + ExportSpecifier = 217, + MissingDeclaration = 218, + ExternalModuleReference = 219, + CaseClause = 220, + DefaultClause = 221, + HeritageClause = 222, + CatchClause = 223, + PropertyAssignment = 224, + ShorthandPropertyAssignment = 225, + EnumMember = 226, + SourceFile = 227, + SyntaxList = 228, + Count = 229, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -540,6 +541,9 @@ declare module "typescript" { interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { body?: Block; } + interface SemicolonClassElement extends ClassElement { + _semicolonClassElementBrand: any; + } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; body: Block; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 6507fa41e23..077d5fb8c66 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -998,157 +998,160 @@ declare module "typescript" { HeritageClauseElement = 177, >HeritageClauseElement : SyntaxKind - Block = 178, + SemicolonClassElement = 178, +>SemicolonClassElement : SyntaxKind + + Block = 179, >Block : SyntaxKind - VariableStatement = 179, + VariableStatement = 180, >VariableStatement : SyntaxKind - EmptyStatement = 180, + EmptyStatement = 181, >EmptyStatement : SyntaxKind - ExpressionStatement = 181, + ExpressionStatement = 182, >ExpressionStatement : SyntaxKind - IfStatement = 182, + IfStatement = 183, >IfStatement : SyntaxKind - DoStatement = 183, + DoStatement = 184, >DoStatement : SyntaxKind - WhileStatement = 184, + WhileStatement = 185, >WhileStatement : SyntaxKind - ForStatement = 185, + ForStatement = 186, >ForStatement : SyntaxKind - ForInStatement = 186, + ForInStatement = 187, >ForInStatement : SyntaxKind - ForOfStatement = 187, + ForOfStatement = 188, >ForOfStatement : SyntaxKind - ContinueStatement = 188, + ContinueStatement = 189, >ContinueStatement : SyntaxKind - BreakStatement = 189, + BreakStatement = 190, >BreakStatement : SyntaxKind - ReturnStatement = 190, + ReturnStatement = 191, >ReturnStatement : SyntaxKind - WithStatement = 191, + WithStatement = 192, >WithStatement : SyntaxKind - SwitchStatement = 192, + SwitchStatement = 193, >SwitchStatement : SyntaxKind - LabeledStatement = 193, + LabeledStatement = 194, >LabeledStatement : SyntaxKind - ThrowStatement = 194, + ThrowStatement = 195, >ThrowStatement : SyntaxKind - TryStatement = 195, + TryStatement = 196, >TryStatement : SyntaxKind - DebuggerStatement = 196, + DebuggerStatement = 197, >DebuggerStatement : SyntaxKind - VariableDeclaration = 197, + VariableDeclaration = 198, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 198, + VariableDeclarationList = 199, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 199, + FunctionDeclaration = 200, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 200, + ClassDeclaration = 201, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 201, + InterfaceDeclaration = 202, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 202, + TypeAliasDeclaration = 203, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 203, + EnumDeclaration = 204, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 204, + ModuleDeclaration = 205, >ModuleDeclaration : SyntaxKind - ModuleBlock = 205, + ModuleBlock = 206, >ModuleBlock : SyntaxKind - CaseBlock = 206, + CaseBlock = 207, >CaseBlock : SyntaxKind - ImportEqualsDeclaration = 207, + ImportEqualsDeclaration = 208, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 208, + ImportDeclaration = 209, >ImportDeclaration : SyntaxKind - ImportClause = 209, + ImportClause = 210, >ImportClause : SyntaxKind - NamespaceImport = 210, + NamespaceImport = 211, >NamespaceImport : SyntaxKind - NamedImports = 211, + NamedImports = 212, >NamedImports : SyntaxKind - ImportSpecifier = 212, + ImportSpecifier = 213, >ImportSpecifier : SyntaxKind - ExportAssignment = 213, + ExportAssignment = 214, >ExportAssignment : SyntaxKind - ExportDeclaration = 214, + ExportDeclaration = 215, >ExportDeclaration : SyntaxKind - NamedExports = 215, + NamedExports = 216, >NamedExports : SyntaxKind - ExportSpecifier = 216, + ExportSpecifier = 217, >ExportSpecifier : SyntaxKind - MissingDeclaration = 217, + MissingDeclaration = 218, >MissingDeclaration : SyntaxKind - ExternalModuleReference = 218, + ExternalModuleReference = 219, >ExternalModuleReference : SyntaxKind - CaseClause = 219, + CaseClause = 220, >CaseClause : SyntaxKind - DefaultClause = 220, + DefaultClause = 221, >DefaultClause : SyntaxKind - HeritageClause = 221, + HeritageClause = 222, >HeritageClause : SyntaxKind - CatchClause = 222, + CatchClause = 223, >CatchClause : SyntaxKind - PropertyAssignment = 223, + PropertyAssignment = 224, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 224, + ShorthandPropertyAssignment = 225, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 225, + EnumMember = 226, >EnumMember : SyntaxKind - SourceFile = 226, + SourceFile = 227, >SourceFile : SyntaxKind - SyntaxList = 227, + SyntaxList = 228, >SyntaxList : SyntaxKind - Count = 228, + Count = 229, >Count : SyntaxKind FirstAssignment = 53, @@ -1705,6 +1708,13 @@ declare module "typescript" { body?: Block; >body : Block >Block : Block + } + interface SemicolonClassElement extends ClassElement { +>SemicolonClassElement : SemicolonClassElement +>ClassElement : ClassElement + + _semicolonClassElementBrand: any; +>_semicolonClassElementBrand : any } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { >AccessorDeclaration : AccessorDeclaration diff --git a/tests/baselines/reference/classWithSemicolonClassElement1.js b/tests/baselines/reference/classWithSemicolonClassElement1.js new file mode 100644 index 00000000000..3838316e113 --- /dev/null +++ b/tests/baselines/reference/classWithSemicolonClassElement1.js @@ -0,0 +1,12 @@ +//// [classWithSemicolonClassElement1.ts] +class C { + ; +} + +//// [classWithSemicolonClassElement1.js] +var C = (function () { + function C() { + } + ; + return C; +})(); diff --git a/tests/baselines/reference/classWithSemicolonClassElement1.types b/tests/baselines/reference/classWithSemicolonClassElement1.types new file mode 100644 index 00000000000..d3315c4cd03 --- /dev/null +++ b/tests/baselines/reference/classWithSemicolonClassElement1.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement1.ts === +class C { +>C : C + + ; +} diff --git a/tests/baselines/reference/classWithSemicolonClassElement2.js b/tests/baselines/reference/classWithSemicolonClassElement2.js new file mode 100644 index 00000000000..77af51bce60 --- /dev/null +++ b/tests/baselines/reference/classWithSemicolonClassElement2.js @@ -0,0 +1,14 @@ +//// [classWithSemicolonClassElement2.ts] +class C { + ; + ; +} + +//// [classWithSemicolonClassElement2.js] +var C = (function () { + function C() { + } + ; + ; + return C; +})(); diff --git a/tests/baselines/reference/classWithSemicolonClassElement2.types b/tests/baselines/reference/classWithSemicolonClassElement2.types new file mode 100644 index 00000000000..ce638e79fc0 --- /dev/null +++ b/tests/baselines/reference/classWithSemicolonClassElement2.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement2.ts === +class C { +>C : C + + ; + ; +} diff --git a/tests/baselines/reference/classWithSemicolonClassElementES61.js b/tests/baselines/reference/classWithSemicolonClassElementES61.js new file mode 100644 index 00000000000..27f020257f5 --- /dev/null +++ b/tests/baselines/reference/classWithSemicolonClassElementES61.js @@ -0,0 +1,9 @@ +//// [classWithSemicolonClassElementES61.ts] +class C { + ; +} + +//// [classWithSemicolonClassElementES61.js] +class C { + ; +} diff --git a/tests/baselines/reference/classWithSemicolonClassElementES61.types b/tests/baselines/reference/classWithSemicolonClassElementES61.types new file mode 100644 index 00000000000..974f269d33c --- /dev/null +++ b/tests/baselines/reference/classWithSemicolonClassElementES61.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES61.ts === +class C { +>C : C + + ; +} diff --git a/tests/baselines/reference/classWithSemicolonClassElementES62.js b/tests/baselines/reference/classWithSemicolonClassElementES62.js new file mode 100644 index 00000000000..068286c25ce --- /dev/null +++ b/tests/baselines/reference/classWithSemicolonClassElementES62.js @@ -0,0 +1,11 @@ +//// [classWithSemicolonClassElementES62.ts] +class C { + ; + ; +} + +//// [classWithSemicolonClassElementES62.js] +class C { + ; + ; +} diff --git a/tests/baselines/reference/classWithSemicolonClassElementES62.types b/tests/baselines/reference/classWithSemicolonClassElementES62.types new file mode 100644 index 00000000000..9f96fbb5ebd --- /dev/null +++ b/tests/baselines/reference/classWithSemicolonClassElementES62.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES62.ts === +class C { +>C : C + + ; + ; +} diff --git a/tests/baselines/reference/es6ClassTest3.errors.txt b/tests/baselines/reference/es6ClassTest3.errors.txt deleted file mode 100644 index 5eb310f338d..00000000000 --- a/tests/baselines/reference/es6ClassTest3.errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -tests/cases/compiler/es6ClassTest3.ts(3,22): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/compiler/es6ClassTest3.ts(4,23): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - - -==== tests/cases/compiler/es6ClassTest3.ts (2 errors) ==== - module M { - class Visibility { - public foo() { }; - ~ -!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - private bar() { }; - ~ -!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - private x: number; - public y: number; - public z: number; - - constructor() { - this.x = 1; - this.y = 2; - } - } - } \ No newline at end of file diff --git a/tests/baselines/reference/es6ClassTest3.js b/tests/baselines/reference/es6ClassTest3.js index dc9f1c67154..572bd079636 100644 --- a/tests/baselines/reference/es6ClassTest3.js +++ b/tests/baselines/reference/es6ClassTest3.js @@ -23,7 +23,9 @@ var M; this.y = 2; } Visibility.prototype.foo = function () { }; + ; Visibility.prototype.bar = function () { }; + ; return Visibility; })(); })(M || (M = {})); diff --git a/tests/baselines/reference/es6ClassTest3.types b/tests/baselines/reference/es6ClassTest3.types new file mode 100644 index 00000000000..ba0f2036f0e --- /dev/null +++ b/tests/baselines/reference/es6ClassTest3.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/es6ClassTest3.ts === +module M { +>M : typeof M + + class Visibility { +>Visibility : Visibility + + public foo() { }; +>foo : () => void + + private bar() { }; +>bar : () => void + + private x: number; +>x : number + + public y: number; +>y : number + + public z: number; +>z : number + + constructor() { + this.x = 1; +>this.x = 1 : number +>this.x : number +>this : Visibility +>x : number + + this.y = 2; +>this.y = 2 : number +>this.y : number +>this : Visibility +>y : number + } + } +} diff --git a/tests/baselines/reference/exportDeclareClass1.errors.txt b/tests/baselines/reference/exportDeclareClass1.errors.txt index c93dc5d0b01..247b0511ed1 100644 --- a/tests/baselines/reference/exportDeclareClass1.errors.txt +++ b/tests/baselines/reference/exportDeclareClass1.errors.txt @@ -1,15 +1,15 @@ -tests/cases/compiler/exportDeclareClass1.ts(2,24): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/compiler/exportDeclareClass1.ts(3,34): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/exportDeclareClass1.ts(2,21): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/exportDeclareClass1.ts(3,31): error TS1184: An implementation cannot be declared in ambient contexts. ==== tests/cases/compiler/exportDeclareClass1.ts (2 errors) ==== export declare class eaC { static tF() { }; - ~ -!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + ~ +!!! error TS1184: An implementation cannot be declared in ambient contexts. static tsF(param:any) { }; - ~ -!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + ~ +!!! error TS1184: An implementation cannot be declared in ambient contexts. }; export declare class eaC2 { diff --git a/tests/baselines/reference/parser0_004152.errors.txt b/tests/baselines/reference/parser0_004152.errors.txt index 97b9bfe34a6..43a8945ffea 100644 --- a/tests/baselines/reference/parser0_004152.errors.txt +++ b/tests/baselines/reference/parser0_004152.errors.txt @@ -32,11 +32,10 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,86): error T tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,94): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,96): error TS2300: Duplicate identifier '0'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,97): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,98): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error TS2304: Cannot find name 'SeedCoords'. -==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (36 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (35 errors) ==== export class Game { ~~~~ !!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. @@ -107,8 +106,6 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error T !!! error TS2300: Duplicate identifier '0'. ~ !!! error TS1005: ';' expected. - ~ -!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. private prevConfig: SeedCoords[][]; ~~~~~~~~~~ !!! error TS2304: Cannot find name 'SeedCoords'. diff --git a/tests/baselines/reference/parser0_004152.js b/tests/baselines/reference/parser0_004152.js index cce49f68fcc..cd6a20742a8 100644 --- a/tests/baselines/reference/parser0_004152.js +++ b/tests/baselines/reference/parser0_004152.js @@ -9,6 +9,7 @@ var Game = (function () { function Game() { this.position = new DisplayPosition([]); } + ; return Game; })(); exports.Game = Game; diff --git a/tests/baselines/reference/parserErrantSemicolonInClass1.errors.txt b/tests/baselines/reference/parserErrantSemicolonInClass1.errors.txt index 7e71ec8fc61..aec80ad934d 100644 --- a/tests/baselines/reference/parserErrantSemicolonInClass1.errors.txt +++ b/tests/baselines/reference/parserErrantSemicolonInClass1.errors.txt @@ -1,7 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts(9,21): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts(18,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts(24,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts (4 errors) ==== class a { //constructor (); constructor (n: number); @@ -11,23 +14,29 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonIn } public pgF() { }; - ~ -!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. public pv; public get d() { + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 30; } public set d() { + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } public static get p2() { + ~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return { x: 30, y: 40 }; } private static d2() { } private static get p3() { + ~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "string"; } private pv3; diff --git a/tests/baselines/reference/parserErrantSemicolonInClass1.js b/tests/baselines/reference/parserErrantSemicolonInClass1.js index f761b04ca78..f3834da7e78 100644 --- a/tests/baselines/reference/parserErrantSemicolonInClass1.js +++ b/tests/baselines/reference/parserErrantSemicolonInClass1.js @@ -40,6 +40,7 @@ var a = (function () { function a(ns) { } a.prototype.pgF = function () { }; + ; Object.defineProperty(a.prototype, "d", { get: function () { return 30; diff --git a/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.errors.txt b/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.errors.txt deleted file mode 100644 index 09eabb5b588..00000000000 --- a/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/compiler/parsingClassRecoversWhenHittingUnexpectedSemicolon.ts(2,19): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - - -==== tests/cases/compiler/parsingClassRecoversWhenHittingUnexpectedSemicolon.ts (1 errors) ==== - class C { - public f() { }; - ~ -!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - private m; - } - \ No newline at end of file diff --git a/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.js b/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.js index 8b197fd35a4..59129f91b97 100644 --- a/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.js +++ b/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.js @@ -10,5 +10,6 @@ var C = (function () { function C() { } C.prototype.f = function () { }; + ; return C; })(); diff --git a/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.types b/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.types new file mode 100644 index 00000000000..6fdfccfa7fd --- /dev/null +++ b/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/parsingClassRecoversWhenHittingUnexpectedSemicolon.ts === +class C { +>C : C + + public f() { }; +>f : () => void + + private m; +>m : any +} + diff --git a/tests/baselines/reference/primitiveMembers.errors.txt b/tests/baselines/reference/primitiveMembers.errors.txt index 801d3fac45c..da8b75f9bc5 100644 --- a/tests/baselines/reference/primitiveMembers.errors.txt +++ b/tests/baselines/reference/primitiveMembers.errors.txt @@ -1,10 +1,8 @@ tests/cases/compiler/primitiveMembers.ts(5,3): error TS2339: Property 'toBAZ' does not exist on type 'number'. tests/cases/compiler/primitiveMembers.ts(11,1): error TS2322: Type 'Number' is not assignable to type 'number'. -tests/cases/compiler/primitiveMembers.ts(24,35): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/compiler/primitiveMembers.ts(25,56): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -==== tests/cases/compiler/primitiveMembers.ts (4 errors) ==== +==== tests/cases/compiler/primitiveMembers.ts (2 errors) ==== var x = 5; var r = /yo/; r.source; @@ -33,11 +31,7 @@ tests/cases/compiler/primitiveMembers.ts(25,56): error TS1068: Unexpected token. class baz { public bar(): void { }; } - ~ -!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. class foo extends baz { public bar(){ return undefined}; } - ~ -!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index bf3f1a17105..629d55ed0f7 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -58,6 +58,7 @@ var baz = (function () { function baz() { } baz.prototype.bar = function () { }; + ; return baz; })(); var foo = (function (_super) { @@ -66,5 +67,6 @@ var foo = (function (_super) { _super.apply(this, arguments); } foo.prototype.bar = function () { return undefined; }; + ; return foo; })(baz); diff --git a/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement1.ts b/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement1.ts new file mode 100644 index 00000000000..6571258d9d1 --- /dev/null +++ b/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement1.ts @@ -0,0 +1,3 @@ +class C { + ; +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement2.ts b/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement2.ts new file mode 100644 index 00000000000..716c8b58aeb --- /dev/null +++ b/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement2.ts @@ -0,0 +1,4 @@ +class C { + ; + ; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES61.ts b/tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES61.ts new file mode 100644 index 00000000000..e1c31c16ad3 --- /dev/null +++ b/tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES61.ts @@ -0,0 +1,4 @@ +//@target: es6 +class C { + ; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES62.ts b/tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES62.ts new file mode 100644 index 00000000000..d83200da627 --- /dev/null +++ b/tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES62.ts @@ -0,0 +1,5 @@ +//@target: es6 +class C { + ; + ; +} \ No newline at end of file From c59ce68c63c8886211f87b993d1f33264706419a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 14:30:31 -0700 Subject: [PATCH 32/61] Fix comment. --- src/compiler/utilities.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index e8d4ca66e00..d59aedf068f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1770,7 +1770,7 @@ module ts { } } - // Returns true if this heritage clause element's expression contains something unsupported + // Returns false if this heritage clause element's expression contains something unsupported // (i.e. not a name or dotted name). export function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean { return isSupportedHeritageClauseElementExpression(node.expression); From 99581fe5ef99643389e8e355ae4a8f1610739b3e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 14:31:12 -0700 Subject: [PATCH 33/61] Remove blank line. --- src/compiler/checker.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 02dfc70c6d3..5d1c38eb827 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1268,7 +1268,6 @@ module ts { } function isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult { - // get symbol of the first identifier of the entityName let meaning: SymbolFlags; if (entityName.parent.kind === SyntaxKind.TypeQuery) { From 785cb5597724c698b59d06bcc65904c34c3720d7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 14:32:36 -0700 Subject: [PATCH 34/61] Add explanatory comment. --- src/compiler/checker.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5d1c38eb827..80ccd46e6c4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3327,6 +3327,8 @@ module ts { if (!links.resolvedType) { let type: Type; + // We don't currently support heritage clauses with complex expressions in them. + // For these cases, we just set the type to be the unknownType. if (node.kind !== SyntaxKind.HeritageClauseElement || isSupportedHeritageClauseElement(node)) { let typeNameOrExpression = node.kind === SyntaxKind.TypeReference ? (node).typeName From 82884e8f26e20c4ce6a572ece7cb8df130fb70f8 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 14:43:36 -0700 Subject: [PATCH 35/61] wire tst tests --- tests/cases/unittests/versionCache.ts | 181 ++++++++++++-------------- 1 file changed, 80 insertions(+), 101 deletions(-) diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts index 3a9d9bd5a9f..f0848828ac5 100644 --- a/tests/cases/unittests/versionCache.ts +++ b/tests/cases/unittests/versionCache.ts @@ -14,84 +14,68 @@ module ts { editStress("binder.ts", false); } - function tstTest() { - var fname = testDataDir + 'tst.ts'; - var content = ts.sys.readFile(fname); - var lm = server.LineIndex.linesFromText(content); - var lines = lm.lines; - if (lines.length == 0) { - return; - } - var lineMap = lm.lineMap; - - var lineIndex = new server.LineIndex(); - lineIndex.load(lines); - - var editedText = lineIndex.getText(0, content.length); - - var snapshot: server.LineIndex; - var checkText: string; - var insertString: string; - - // change 9 1 0 1 {"y"} - var pos = lineColToPosition(lineIndex, 9, 1); - insertString = "y"; - checkText = editFlat(pos, 0, insertString, content); - snapshot = lineIndex.edit(pos, 0, insertString); - editedText = snapshot.getText(0, checkText.length); - - assert.equal(editedText, checkText); - - // change 9 2 0 1 {"."} - var pos = lineColToPosition(snapshot, 9, 2); - insertString = "."; - checkText = editFlat(pos, 0, insertString, checkText); - snapshot = snapshot.edit(pos, 0, insertString); - editedText = snapshot.getText(0, checkText.length); - - assert.equal(editedText, checkText); - - // change 9 3 0 1 {"\n"} - var pos = lineColToPosition(snapshot, 9, 3); - insertString = "\n"; - checkText = editFlat(pos, 0, insertString, checkText); - snapshot = snapshot.edit(pos, 0, insertString); - editedText = snapshot.getText(0, checkText.length); - - assert.equal(editedText, checkText); - - // change 10 1 0 10 {"\n\n\n\n\n\n\n\n\n\n"} - pos = lineColToPosition(snapshot, 10, 1); - insertString = "\n\n\n\n\n\n\n\n\n\n"; - checkText = editFlat(pos, 0, insertString, checkText); - snapshot = snapshot.edit(pos, 0, insertString); - editedText = snapshot.getText(0, checkText.length); - - assert.equal(editedText, checkText); - - // change 19 1 1 0 - pos = lineColToPosition(snapshot, 19, 1); - checkText = editFlat(pos, 1, "", checkText); - snapshot = snapshot.edit(pos, 1); - editedText = snapshot.getText(0, checkText.length); - - assert.equal(editedText, checkText); - - // change 18 1 1 0 - pos = lineColToPosition(snapshot, 18, 1); - checkText = editFlat(pos, 1, "", checkText); - snapshot = snapshot.edit(pos, 1); - editedText = snapshot.getText(0, checkText.length); - - assert.equal(editedText, checkText); - - function lineColToPosition(lineIndex: server.LineIndex, line: number, col: number) { - var lineInfo = lineIndex.lineNumberToInfo(line); - return (lineInfo.offset + col - 1); - } + function lineColToPosition(lineIndex: server.LineIndex, line: number, col: number) { + var lineInfo = lineIndex.lineNumberToInfo(line); + return (lineInfo.offset + col - 1); } - describe('VersionCache edit', () => { + function validateEdit(lineIndex: server.LineIndex, sourceText: string, position: number, deleteLength: number, insertString: string): void { + let checkText = editFlat(position, deleteLength, insertString, sourceText); + let snapshot = lineIndex.edit(position, deleteLength, insertString); + let editedText = snapshot.getText(0, snapshot.getLength()); + + assert.equal(editedText, checkText); + } + + describe('VersionCache TS code', () => { + var testContent = `/// +var x = 10; +var y = { zebra: 12, giraffe: "ell" }; +z.a; +class Point { + x: number; +} +k=y; +var p:Point=new Point(); +var q:Point=p;` + + let {lines, lineMap} = server.LineIndex.linesFromText(testContent); + assert.isTrue(lines.length > 0, "Failed to initialize test text. Expected text to have at least one line"); + + let lineIndex = new server.LineIndex(); + lineIndex.load(lines); + + function validateEditAtLineCharIndex(line: number, char: number, deleteLength: number, insertString: string): void { + let position = lineColToPosition(lineIndex, line, char); + validateEdit(lineIndex, testContent, position, deleteLength, insertString); + } + + it('change 9 1 0 1 {"y"}', () => { + validateEditAtLineCharIndex(9, 1, 0, "y"); + }); + + it('change 9 2 0 1 {"."}', () => { + validateEditAtLineCharIndex(9, 2, 0, "."); + }); + + it('change 9 3 0 1 {"\\n"}', () => { + validateEditAtLineCharIndex(9, 3, 0, "\n"); + }); + + it('change 10 1 0 10 {"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"}', () => { + validateEditAtLineCharIndex(10, 1, 0, "\n\n\n\n\n\n\n\n\n\n"); + }); + + it('change 19 1 1 0', () => { + validateEditAtLineCharIndex(19, 1, 1, ""); + }); + + it('change 18 1 1 0', () => { + validateEditAtLineCharIndex(18, 1, 1, ""); + }); + }); + + describe('VersionCache simple text', () => { let testContent = `in this story: the lazy brown fox jumped over the cow @@ -105,84 +89,80 @@ and grew 1cm per day`; let lineIndex = new server.LineIndex(); lineIndex.load(lines); - function testEdit(position: number, deleteLength: number, insertString: string): void { - let checkText = editFlat(position, deleteLength, insertString, testContent); - let snapshot = lineIndex.edit(position, deleteLength, insertString); - let editedText = snapshot.getText(0, snapshot.getLength()); - - assert.equal(editedText, checkText); + function validateEditAtPosition(position: number, deleteLength: number, insertString: string): void { + validateEdit(lineIndex, testContent, position, deleteLength, insertString); } it('Insert at end of file', () => { - testEdit(testContent.length, 0, "hmmmm...\r\n"); + validateEditAtPosition(testContent.length, 0, "hmmmm...\r\n"); }); it('Unusual line endings merge', () => { - testEdit(lines[0].length - 1, lines[1].length, ""); + validateEditAtPosition(lines[0].length - 1, lines[1].length, ""); }); it('Delete whole line and nothing but line (last line)', () => { - testEdit(lineMap[lineMap.length - 2], lines[lines.length - 1].length, ""); + validateEditAtPosition(lineMap[lineMap.length - 2], lines[lines.length - 1].length, ""); }); it('Delete whole line and nothing but line (first line)', () => { - testEdit(0, lines[0].length, ""); + validateEditAtPosition(0, lines[0].length, ""); }); it('Delete whole line (first line) and insert with no line breaks', () => { - testEdit(0, lines[0].length, "moo, moo, moo! "); + validateEditAtPosition(0, lines[0].length, "moo, moo, moo! "); }); it('Delete whole line (first line) and insert with multiple line breaks', () => { - testEdit(0, lines[0].length, "moo, \r\nmoo, \r\nmoo! "); + validateEditAtPosition(0, lines[0].length, "moo, \r\nmoo, \r\nmoo! "); }); it('Delete multiple lines and nothing but lines (first and second lines)', () => { - testEdit(0, lines[0].length + lines[1].length, ""); + validateEditAtPosition(0, lines[0].length + lines[1].length, ""); }); it('Delete multiple lines and nothing but lines (second and third lines)', () => { - testEdit(lines[0].length, lines[1].length + lines[2].length, ""); + validateEditAtPosition(lines[0].length, lines[1].length + lines[2].length, ""); }); it('Insert multiple line breaks', () => { - testEdit(21, 1, "cr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr"); + validateEditAtPosition(21, 1, "cr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr"); }); it('Insert multiple line breaks', () => { - testEdit(21, 1, "cr...\r\ncr...\r\ncr"); + validateEditAtPosition(21, 1, "cr...\r\ncr...\r\ncr"); }); it('Insert multiple line breaks with leading \\n', () => { - testEdit(21, 1, "\ncr...\r\ncr...\r\ncr"); + validateEditAtPosition(21, 1, "\ncr...\r\ncr...\r\ncr"); }); it('Single line no line breaks deleted or inserted, delete 1 char', () => { - testEdit(21, 1, ""); + validateEditAtPosition(21, 1, ""); }); it('Single line no line breaks deleted or inserted, insert 1 char', () => { - testEdit(21, 0, "b"); + validateEditAtPosition(21, 0, "b"); }); it('Single line no line breaks deleted or inserted, delete 1, insert 2 chars', () => { - testEdit(21, 1, "cr"); + validateEditAtPosition(21, 1, "cr"); }); it('Delete across line break (just the line break)', () => { - testEdit(21, 22, ""); + validateEditAtPosition(21, 22, ""); }); it('Delete across line break', () => { - testEdit(21, 32, ""); + validateEditAtPosition(21, 32, ""); }); it('Delete across multiple line breaks and insert no line breaks', () => { - testEdit(21, 42, ""); + validateEditAtPosition(21, 42, ""); }); it('Delete across multiple line breaks and insert text', () => { - testEdit(21, 42, "slithery "); + validateEditAtPosition(21, 42, "slithery "); }); }); @@ -365,7 +345,6 @@ and grew 1cm per day`; } //function edTest() { - // tstTest(); // bigTest(); //} From fe5ed072fce3d5bbd2d780f43ff91688b6ce3c3d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 14:58:30 -0700 Subject: [PATCH 36/61] Add file that was errantly removed. --- .../reference/APISample_linter.types.pull | 6412 +++++++++++++++++ 1 file changed, 6412 insertions(+) create mode 100644 tests/baselines/reference/APISample_linter.types.pull diff --git a/tests/baselines/reference/APISample_linter.types.pull b/tests/baselines/reference/APISample_linter.types.pull new file mode 100644 index 00000000000..759a8390d60 --- /dev/null +++ b/tests/baselines/reference/APISample_linter.types.pull @@ -0,0 +1,6412 @@ +=== tests/cases/compiler/APISample_linter.ts === + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +>process : any + +declare var console: any; +>console : any + +declare var fs: any; +>fs : any + +import ts = require("typescript"); +>ts : typeof ts + +export function delint(sourceFile: ts.SourceFile) { +>delint : (sourceFile: ts.SourceFile) => void +>sourceFile : ts.SourceFile +>ts : unknown +>SourceFile : ts.SourceFile + + delintNode(sourceFile); +>delintNode(sourceFile) : void +>delintNode : (node: ts.Node) => void +>sourceFile : ts.SourceFile + + function delintNode(node: ts.Node) { +>delintNode : (node: ts.Node) => void +>node : ts.Node +>ts : unknown +>Node : ts.Node + + switch (node.kind) { +>node.kind : ts.SyntaxKind +>node : ts.Node +>kind : ts.SyntaxKind + + case ts.SyntaxKind.ForStatement: +>ts.SyntaxKind.ForStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>ForStatement : ts.SyntaxKind + + case ts.SyntaxKind.ForInStatement: +>ts.SyntaxKind.ForInStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>ForInStatement : ts.SyntaxKind + + case ts.SyntaxKind.WhileStatement: +>ts.SyntaxKind.WhileStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>WhileStatement : ts.SyntaxKind + + case ts.SyntaxKind.DoStatement: +>ts.SyntaxKind.DoStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>DoStatement : ts.SyntaxKind + + if ((node).statement.kind !== ts.SyntaxKind.Block) { +>(node).statement.kind !== ts.SyntaxKind.Block : boolean +>(node).statement.kind : ts.SyntaxKind +>(node).statement : ts.Statement +>(node) : ts.IterationStatement +>node : ts.IterationStatement +>ts : unknown +>IterationStatement : ts.IterationStatement +>node : ts.Node +>statement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.Block : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>Block : ts.SyntaxKind + + report(node, "A looping statement's contents should be wrapped in a block body."); +>report(node, "A looping statement's contents should be wrapped in a block body.") : void +>report : (node: ts.Node, message: string) => void +>node : ts.Node + } + break; + case ts.SyntaxKind.IfStatement: +>ts.SyntaxKind.IfStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>IfStatement : ts.SyntaxKind + + var ifStatement = (node); +>ifStatement : ts.IfStatement +>(node) : ts.IfStatement +>node : ts.IfStatement +>ts : unknown +>IfStatement : ts.IfStatement +>node : ts.Node + + if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) { +>ifStatement.thenStatement.kind !== ts.SyntaxKind.Block : boolean +>ifStatement.thenStatement.kind : ts.SyntaxKind +>ifStatement.thenStatement : ts.Statement +>ifStatement : ts.IfStatement +>thenStatement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.Block : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>Block : ts.SyntaxKind + + report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); +>report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.") : void +>report : (node: ts.Node, message: string) => void +>ifStatement.thenStatement : ts.Statement +>ifStatement : ts.IfStatement +>thenStatement : ts.Statement + } + if (ifStatement.elseStatement && +>ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean +>ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement + + ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) { +>ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean +>ifStatement.elseStatement.kind : ts.SyntaxKind +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.Block : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>Block : ts.SyntaxKind +>ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean +>ifStatement.elseStatement.kind : ts.SyntaxKind +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.IfStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>IfStatement : ts.SyntaxKind + + report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); +>report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.") : void +>report : (node: ts.Node, message: string) => void +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement + } + break; + + case ts.SyntaxKind.BinaryExpression: +>ts.SyntaxKind.BinaryExpression : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>BinaryExpression : ts.SyntaxKind + + var op = (node).operatorToken.kind; +>op : ts.SyntaxKind +>(node).operatorToken.kind : ts.SyntaxKind +>(node).operatorToken : ts.Node +>(node) : ts.BinaryExpression +>node : ts.BinaryExpression +>ts : unknown +>BinaryExpression : ts.BinaryExpression +>node : ts.Node +>operatorToken : ts.Node +>kind : ts.SyntaxKind + + if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { +>op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken : boolean +>op === ts.SyntaxKind.EqualsEqualsToken : boolean +>op : ts.SyntaxKind +>ts.SyntaxKind.EqualsEqualsToken : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>EqualsEqualsToken : ts.SyntaxKind +>op === ts.SyntaxKind.ExclamationEqualsToken : boolean +>op : ts.SyntaxKind +>ts.SyntaxKind.ExclamationEqualsToken : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>ExclamationEqualsToken : ts.SyntaxKind + + report(node, "Use '===' and '!=='.") +>report(node, "Use '===' and '!=='.") : void +>report : (node: ts.Node, message: string) => void +>node : ts.Node + } + break; + } + + ts.forEachChild(node, delintNode); +>ts.forEachChild(node, delintNode) : void +>ts.forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T +>ts : typeof ts +>forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T +>node : ts.Node +>delintNode : (node: ts.Node) => void + } + + function report(node: ts.Node, message: string) { +>report : (node: ts.Node, message: string) => void +>node : ts.Node +>ts : unknown +>Node : ts.Node +>message : string + + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); +>lineChar : ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter +>sourceFile : ts.SourceFile +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter +>node.getStart() : number +>node.getStart : (sourceFile?: ts.SourceFile) => number +>node : ts.Node +>getStart : (sourceFile?: ts.SourceFile) => number + + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) +>console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) : any +>console.log : any +>console : any +>log : any +>sourceFile.fileName : string +>sourceFile : ts.SourceFile +>fileName : string +>lineChar.line + 1 : number +>lineChar.line : number +>lineChar : ts.LineAndCharacter +>line : number +>lineChar.character + 1 : number +>lineChar.character : number +>lineChar : ts.LineAndCharacter +>character : number +>message : string + } +} + +var fileNames = process.argv.slice(2); +>fileNames : any +>process.argv.slice(2) : any +>process.argv.slice : any +>process.argv : any +>process : any +>argv : any +>slice : any + +fileNames.forEach(fileName => { +>fileNames.forEach(fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);}) : any +>fileNames.forEach : any +>fileNames : any +>forEach : any +>fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);} : (fileName: any) => void +>fileName : any + + // Parse a file + var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); +>sourceFile : ts.SourceFile +>ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true) : ts.SourceFile +>ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile +>ts : typeof ts +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile +>fileName : any +>fs.readFileSync(fileName).toString() : any +>fs.readFileSync(fileName).toString : any +>fs.readFileSync(fileName) : any +>fs.readFileSync : any +>fs : any +>readFileSync : any +>fileName : any +>toString : any +>ts.ScriptTarget.ES6 : ts.ScriptTarget +>ts.ScriptTarget : typeof ts.ScriptTarget +>ts : typeof ts +>ScriptTarget : typeof ts.ScriptTarget +>ES6 : ts.ScriptTarget + + // delint it + delint(sourceFile); +>delint(sourceFile) : void +>delint : (sourceFile: ts.SourceFile) => void +>sourceFile : ts.SourceFile + +}); + +=== typescript.d.ts === +/*! ***************************************************************************** +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 module "typescript" { + interface Map { +>Map : Map +>T : T + + [index: string]: T; +>index : string +>T : T + } + interface TextRange { +>TextRange : TextRange + + pos: number; +>pos : number + + end: number; +>end : number + } + const enum SyntaxKind { +>SyntaxKind : SyntaxKind + + Unknown = 0, +>Unknown : SyntaxKind + + EndOfFileToken = 1, +>EndOfFileToken : SyntaxKind + + SingleLineCommentTrivia = 2, +>SingleLineCommentTrivia : SyntaxKind + + MultiLineCommentTrivia = 3, +>MultiLineCommentTrivia : SyntaxKind + + NewLineTrivia = 4, +>NewLineTrivia : SyntaxKind + + WhitespaceTrivia = 5, +>WhitespaceTrivia : SyntaxKind + + ConflictMarkerTrivia = 6, +>ConflictMarkerTrivia : SyntaxKind + + NumericLiteral = 7, +>NumericLiteral : SyntaxKind + + StringLiteral = 8, +>StringLiteral : SyntaxKind + + RegularExpressionLiteral = 9, +>RegularExpressionLiteral : SyntaxKind + + NoSubstitutionTemplateLiteral = 10, +>NoSubstitutionTemplateLiteral : SyntaxKind + + TemplateHead = 11, +>TemplateHead : SyntaxKind + + TemplateMiddle = 12, +>TemplateMiddle : SyntaxKind + + TemplateTail = 13, +>TemplateTail : SyntaxKind + + OpenBraceToken = 14, +>OpenBraceToken : SyntaxKind + + CloseBraceToken = 15, +>CloseBraceToken : SyntaxKind + + OpenParenToken = 16, +>OpenParenToken : SyntaxKind + + CloseParenToken = 17, +>CloseParenToken : SyntaxKind + + OpenBracketToken = 18, +>OpenBracketToken : SyntaxKind + + CloseBracketToken = 19, +>CloseBracketToken : SyntaxKind + + DotToken = 20, +>DotToken : SyntaxKind + + DotDotDotToken = 21, +>DotDotDotToken : SyntaxKind + + SemicolonToken = 22, +>SemicolonToken : SyntaxKind + + CommaToken = 23, +>CommaToken : SyntaxKind + + LessThanToken = 24, +>LessThanToken : SyntaxKind + + GreaterThanToken = 25, +>GreaterThanToken : SyntaxKind + + LessThanEqualsToken = 26, +>LessThanEqualsToken : SyntaxKind + + GreaterThanEqualsToken = 27, +>GreaterThanEqualsToken : SyntaxKind + + EqualsEqualsToken = 28, +>EqualsEqualsToken : SyntaxKind + + ExclamationEqualsToken = 29, +>ExclamationEqualsToken : SyntaxKind + + EqualsEqualsEqualsToken = 30, +>EqualsEqualsEqualsToken : SyntaxKind + + ExclamationEqualsEqualsToken = 31, +>ExclamationEqualsEqualsToken : SyntaxKind + + EqualsGreaterThanToken = 32, +>EqualsGreaterThanToken : SyntaxKind + + PlusToken = 33, +>PlusToken : SyntaxKind + + MinusToken = 34, +>MinusToken : SyntaxKind + + AsteriskToken = 35, +>AsteriskToken : SyntaxKind + + SlashToken = 36, +>SlashToken : SyntaxKind + + PercentToken = 37, +>PercentToken : SyntaxKind + + PlusPlusToken = 38, +>PlusPlusToken : SyntaxKind + + MinusMinusToken = 39, +>MinusMinusToken : SyntaxKind + + LessThanLessThanToken = 40, +>LessThanLessThanToken : SyntaxKind + + GreaterThanGreaterThanToken = 41, +>GreaterThanGreaterThanToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanToken = 42, +>GreaterThanGreaterThanGreaterThanToken : SyntaxKind + + AmpersandToken = 43, +>AmpersandToken : SyntaxKind + + BarToken = 44, +>BarToken : SyntaxKind + + CaretToken = 45, +>CaretToken : SyntaxKind + + ExclamationToken = 46, +>ExclamationToken : SyntaxKind + + TildeToken = 47, +>TildeToken : SyntaxKind + + AmpersandAmpersandToken = 48, +>AmpersandAmpersandToken : SyntaxKind + + BarBarToken = 49, +>BarBarToken : SyntaxKind + + QuestionToken = 50, +>QuestionToken : SyntaxKind + + ColonToken = 51, +>ColonToken : SyntaxKind + + AtToken = 52, +>AtToken : SyntaxKind + + EqualsToken = 53, +>EqualsToken : SyntaxKind + + PlusEqualsToken = 54, +>PlusEqualsToken : SyntaxKind + + MinusEqualsToken = 55, +>MinusEqualsToken : SyntaxKind + + AsteriskEqualsToken = 56, +>AsteriskEqualsToken : SyntaxKind + + SlashEqualsToken = 57, +>SlashEqualsToken : SyntaxKind + + PercentEqualsToken = 58, +>PercentEqualsToken : SyntaxKind + + LessThanLessThanEqualsToken = 59, +>LessThanLessThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanEqualsToken = 60, +>GreaterThanGreaterThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanEqualsToken = 61, +>GreaterThanGreaterThanGreaterThanEqualsToken : SyntaxKind + + AmpersandEqualsToken = 62, +>AmpersandEqualsToken : SyntaxKind + + BarEqualsToken = 63, +>BarEqualsToken : SyntaxKind + + CaretEqualsToken = 64, +>CaretEqualsToken : SyntaxKind + + Identifier = 65, +>Identifier : SyntaxKind + + BreakKeyword = 66, +>BreakKeyword : SyntaxKind + + CaseKeyword = 67, +>CaseKeyword : SyntaxKind + + CatchKeyword = 68, +>CatchKeyword : SyntaxKind + + ClassKeyword = 69, +>ClassKeyword : SyntaxKind + + ConstKeyword = 70, +>ConstKeyword : SyntaxKind + + ContinueKeyword = 71, +>ContinueKeyword : SyntaxKind + + DebuggerKeyword = 72, +>DebuggerKeyword : SyntaxKind + + DefaultKeyword = 73, +>DefaultKeyword : SyntaxKind + + DeleteKeyword = 74, +>DeleteKeyword : SyntaxKind + + DoKeyword = 75, +>DoKeyword : SyntaxKind + + ElseKeyword = 76, +>ElseKeyword : SyntaxKind + + EnumKeyword = 77, +>EnumKeyword : SyntaxKind + + ExportKeyword = 78, +>ExportKeyword : SyntaxKind + + ExtendsKeyword = 79, +>ExtendsKeyword : SyntaxKind + + FalseKeyword = 80, +>FalseKeyword : SyntaxKind + + FinallyKeyword = 81, +>FinallyKeyword : SyntaxKind + + ForKeyword = 82, +>ForKeyword : SyntaxKind + + FunctionKeyword = 83, +>FunctionKeyword : SyntaxKind + + IfKeyword = 84, +>IfKeyword : SyntaxKind + + ImportKeyword = 85, +>ImportKeyword : SyntaxKind + + InKeyword = 86, +>InKeyword : SyntaxKind + + InstanceOfKeyword = 87, +>InstanceOfKeyword : SyntaxKind + + NewKeyword = 88, +>NewKeyword : SyntaxKind + + NullKeyword = 89, +>NullKeyword : SyntaxKind + + ReturnKeyword = 90, +>ReturnKeyword : SyntaxKind + + SuperKeyword = 91, +>SuperKeyword : SyntaxKind + + SwitchKeyword = 92, +>SwitchKeyword : SyntaxKind + + ThisKeyword = 93, +>ThisKeyword : SyntaxKind + + ThrowKeyword = 94, +>ThrowKeyword : SyntaxKind + + TrueKeyword = 95, +>TrueKeyword : SyntaxKind + + TryKeyword = 96, +>TryKeyword : SyntaxKind + + TypeOfKeyword = 97, +>TypeOfKeyword : SyntaxKind + + VarKeyword = 98, +>VarKeyword : SyntaxKind + + VoidKeyword = 99, +>VoidKeyword : SyntaxKind + + WhileKeyword = 100, +>WhileKeyword : SyntaxKind + + WithKeyword = 101, +>WithKeyword : SyntaxKind + + AsKeyword = 102, +>AsKeyword : SyntaxKind + + ImplementsKeyword = 103, +>ImplementsKeyword : SyntaxKind + + InterfaceKeyword = 104, +>InterfaceKeyword : SyntaxKind + + LetKeyword = 105, +>LetKeyword : SyntaxKind + + PackageKeyword = 106, +>PackageKeyword : SyntaxKind + + PrivateKeyword = 107, +>PrivateKeyword : SyntaxKind + + ProtectedKeyword = 108, +>ProtectedKeyword : SyntaxKind + + PublicKeyword = 109, +>PublicKeyword : SyntaxKind + + StaticKeyword = 110, +>StaticKeyword : SyntaxKind + + YieldKeyword = 111, +>YieldKeyword : SyntaxKind + + AnyKeyword = 112, +>AnyKeyword : SyntaxKind + + BooleanKeyword = 113, +>BooleanKeyword : SyntaxKind + + ConstructorKeyword = 114, +>ConstructorKeyword : SyntaxKind + + DeclareKeyword = 115, +>DeclareKeyword : SyntaxKind + + GetKeyword = 116, +>GetKeyword : SyntaxKind + + ModuleKeyword = 117, +>ModuleKeyword : SyntaxKind + + RequireKeyword = 118, +>RequireKeyword : SyntaxKind + + NumberKeyword = 119, +>NumberKeyword : SyntaxKind + + SetKeyword = 120, +>SetKeyword : SyntaxKind + + StringKeyword = 121, +>StringKeyword : SyntaxKind + + SymbolKeyword = 122, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 123, +>TypeKeyword : SyntaxKind + + FromKeyword = 124, +>FromKeyword : SyntaxKind + + OfKeyword = 125, +>OfKeyword : SyntaxKind + + QualifiedName = 126, +>QualifiedName : SyntaxKind + + ComputedPropertyName = 127, +>ComputedPropertyName : SyntaxKind + + TypeParameter = 128, +>TypeParameter : SyntaxKind + + Parameter = 129, +>Parameter : SyntaxKind + + Decorator = 130, +>Decorator : SyntaxKind + + PropertySignature = 131, +>PropertySignature : SyntaxKind + + PropertyDeclaration = 132, +>PropertyDeclaration : SyntaxKind + + MethodSignature = 133, +>MethodSignature : SyntaxKind + + MethodDeclaration = 134, +>MethodDeclaration : SyntaxKind + + Constructor = 135, +>Constructor : SyntaxKind + + GetAccessor = 136, +>GetAccessor : SyntaxKind + + SetAccessor = 137, +>SetAccessor : SyntaxKind + + CallSignature = 138, +>CallSignature : SyntaxKind + + ConstructSignature = 139, +>ConstructSignature : SyntaxKind + + IndexSignature = 140, +>IndexSignature : SyntaxKind + + TypeReference = 141, +>TypeReference : SyntaxKind + + FunctionType = 142, +>FunctionType : SyntaxKind + + ConstructorType = 143, +>ConstructorType : SyntaxKind + + TypeQuery = 144, +>TypeQuery : SyntaxKind + + TypeLiteral = 145, +>TypeLiteral : SyntaxKind + + ArrayType = 146, +>ArrayType : SyntaxKind + + TupleType = 147, +>TupleType : SyntaxKind + + UnionType = 148, +>UnionType : SyntaxKind + + ParenthesizedType = 149, +>ParenthesizedType : SyntaxKind + + ObjectBindingPattern = 150, +>ObjectBindingPattern : SyntaxKind + + ArrayBindingPattern = 151, +>ArrayBindingPattern : SyntaxKind + + BindingElement = 152, +>BindingElement : SyntaxKind + + ArrayLiteralExpression = 153, +>ArrayLiteralExpression : SyntaxKind + + ObjectLiteralExpression = 154, +>ObjectLiteralExpression : SyntaxKind + + PropertyAccessExpression = 155, +>PropertyAccessExpression : SyntaxKind + + ElementAccessExpression = 156, +>ElementAccessExpression : SyntaxKind + + CallExpression = 157, +>CallExpression : SyntaxKind + + NewExpression = 158, +>NewExpression : SyntaxKind + + TaggedTemplateExpression = 159, +>TaggedTemplateExpression : SyntaxKind + + TypeAssertionExpression = 160, +>TypeAssertionExpression : SyntaxKind + + ParenthesizedExpression = 161, +>ParenthesizedExpression : SyntaxKind + + FunctionExpression = 162, +>FunctionExpression : SyntaxKind + + ArrowFunction = 163, +>ArrowFunction : SyntaxKind + + DeleteExpression = 164, +>DeleteExpression : SyntaxKind + + TypeOfExpression = 165, +>TypeOfExpression : SyntaxKind + + VoidExpression = 166, +>VoidExpression : SyntaxKind + + PrefixUnaryExpression = 167, +>PrefixUnaryExpression : SyntaxKind + + PostfixUnaryExpression = 168, +>PostfixUnaryExpression : SyntaxKind + + BinaryExpression = 169, +>BinaryExpression : SyntaxKind + + ConditionalExpression = 170, +>ConditionalExpression : SyntaxKind + + TemplateExpression = 171, +>TemplateExpression : SyntaxKind + + YieldExpression = 172, +>YieldExpression : SyntaxKind + + SpreadElementExpression = 173, +>SpreadElementExpression : SyntaxKind + + ClassExpression = 174, +>ClassExpression : SyntaxKind + + OmittedExpression = 175, +>OmittedExpression : SyntaxKind + + TemplateSpan = 176, +>TemplateSpan : SyntaxKind + + HeritageClauseElement = 177, +>HeritageClauseElement : SyntaxKind + + SemicolonClassElement = 178, +>SemicolonClassElement : SyntaxKind + + Block = 179, +>Block : SyntaxKind + + VariableStatement = 180, +>VariableStatement : SyntaxKind + + EmptyStatement = 181, +>EmptyStatement : SyntaxKind + + ExpressionStatement = 182, +>ExpressionStatement : SyntaxKind + + IfStatement = 183, +>IfStatement : SyntaxKind + + DoStatement = 184, +>DoStatement : SyntaxKind + + WhileStatement = 185, +>WhileStatement : SyntaxKind + + ForStatement = 186, +>ForStatement : SyntaxKind + + ForInStatement = 187, +>ForInStatement : SyntaxKind + + ForOfStatement = 188, +>ForOfStatement : SyntaxKind + + ContinueStatement = 189, +>ContinueStatement : SyntaxKind + + BreakStatement = 190, +>BreakStatement : SyntaxKind + + ReturnStatement = 191, +>ReturnStatement : SyntaxKind + + WithStatement = 192, +>WithStatement : SyntaxKind + + SwitchStatement = 193, +>SwitchStatement : SyntaxKind + + LabeledStatement = 194, +>LabeledStatement : SyntaxKind + + ThrowStatement = 195, +>ThrowStatement : SyntaxKind + + TryStatement = 196, +>TryStatement : SyntaxKind + + DebuggerStatement = 197, +>DebuggerStatement : SyntaxKind + + VariableDeclaration = 198, +>VariableDeclaration : SyntaxKind + + VariableDeclarationList = 199, +>VariableDeclarationList : SyntaxKind + + FunctionDeclaration = 200, +>FunctionDeclaration : SyntaxKind + + ClassDeclaration = 201, +>ClassDeclaration : SyntaxKind + + InterfaceDeclaration = 202, +>InterfaceDeclaration : SyntaxKind + + TypeAliasDeclaration = 203, +>TypeAliasDeclaration : SyntaxKind + + EnumDeclaration = 204, +>EnumDeclaration : SyntaxKind + + ModuleDeclaration = 205, +>ModuleDeclaration : SyntaxKind + + ModuleBlock = 206, +>ModuleBlock : SyntaxKind + + CaseBlock = 207, +>CaseBlock : SyntaxKind + + ImportEqualsDeclaration = 208, +>ImportEqualsDeclaration : SyntaxKind + + ImportDeclaration = 209, +>ImportDeclaration : SyntaxKind + + ImportClause = 210, +>ImportClause : SyntaxKind + + NamespaceImport = 211, +>NamespaceImport : SyntaxKind + + NamedImports = 212, +>NamedImports : SyntaxKind + + ImportSpecifier = 213, +>ImportSpecifier : SyntaxKind + + ExportAssignment = 214, +>ExportAssignment : SyntaxKind + + ExportDeclaration = 215, +>ExportDeclaration : SyntaxKind + + NamedExports = 216, +>NamedExports : SyntaxKind + + ExportSpecifier = 217, +>ExportSpecifier : SyntaxKind + + MissingDeclaration = 218, +>MissingDeclaration : SyntaxKind + + ExternalModuleReference = 219, +>ExternalModuleReference : SyntaxKind + + CaseClause = 220, +>CaseClause : SyntaxKind + + DefaultClause = 221, +>DefaultClause : SyntaxKind + + HeritageClause = 222, +>HeritageClause : SyntaxKind + + CatchClause = 223, +>CatchClause : SyntaxKind + + PropertyAssignment = 224, +>PropertyAssignment : SyntaxKind + + ShorthandPropertyAssignment = 225, +>ShorthandPropertyAssignment : SyntaxKind + + EnumMember = 226, +>EnumMember : SyntaxKind + + SourceFile = 227, +>SourceFile : SyntaxKind + + SyntaxList = 228, +>SyntaxList : SyntaxKind + + Count = 229, +>Count : SyntaxKind + + FirstAssignment = 53, +>FirstAssignment : SyntaxKind + + LastAssignment = 64, +>LastAssignment : SyntaxKind + + FirstReservedWord = 66, +>FirstReservedWord : SyntaxKind + + LastReservedWord = 101, +>LastReservedWord : SyntaxKind + + FirstKeyword = 66, +>FirstKeyword : SyntaxKind + + LastKeyword = 125, +>LastKeyword : SyntaxKind + + FirstFutureReservedWord = 103, +>FirstFutureReservedWord : SyntaxKind + + LastFutureReservedWord = 111, +>LastFutureReservedWord : SyntaxKind + + FirstTypeNode = 141, +>FirstTypeNode : SyntaxKind + + LastTypeNode = 149, +>LastTypeNode : SyntaxKind + + FirstPunctuation = 14, +>FirstPunctuation : SyntaxKind + + LastPunctuation = 64, +>LastPunctuation : SyntaxKind + + FirstToken = 0, +>FirstToken : SyntaxKind + + LastToken = 125, +>LastToken : SyntaxKind + + FirstTriviaToken = 2, +>FirstTriviaToken : SyntaxKind + + LastTriviaToken = 6, +>LastTriviaToken : SyntaxKind + + FirstLiteralToken = 7, +>FirstLiteralToken : SyntaxKind + + LastLiteralToken = 10, +>LastLiteralToken : SyntaxKind + + FirstTemplateToken = 10, +>FirstTemplateToken : SyntaxKind + + LastTemplateToken = 13, +>LastTemplateToken : SyntaxKind + + FirstBinaryOperator = 24, +>FirstBinaryOperator : SyntaxKind + + LastBinaryOperator = 64, +>LastBinaryOperator : SyntaxKind + + FirstNode = 126, +>FirstNode : SyntaxKind + } + const enum NodeFlags { +>NodeFlags : NodeFlags + + Export = 1, +>Export : NodeFlags + + Ambient = 2, +>Ambient : NodeFlags + + Public = 16, +>Public : NodeFlags + + Private = 32, +>Private : NodeFlags + + Protected = 64, +>Protected : NodeFlags + + Static = 128, +>Static : NodeFlags + + Default = 256, +>Default : NodeFlags + + MultiLine = 512, +>MultiLine : NodeFlags + + Synthetic = 1024, +>Synthetic : NodeFlags + + DeclarationFile = 2048, +>DeclarationFile : NodeFlags + + Let = 4096, +>Let : NodeFlags + + Const = 8192, +>Const : NodeFlags + + OctalLiteral = 16384, +>OctalLiteral : NodeFlags + + ExportContext = 32768, +>ExportContext : NodeFlags + + Modifier = 499, +>Modifier : NodeFlags + + AccessibilityModifier = 112, +>AccessibilityModifier : NodeFlags + + BlockScoped = 12288, +>BlockScoped : NodeFlags + } + const enum ParserContextFlags { +>ParserContextFlags : ParserContextFlags + + StrictMode = 1, +>StrictMode : ParserContextFlags + + DisallowIn = 2, +>DisallowIn : ParserContextFlags + + Yield = 4, +>Yield : ParserContextFlags + + GeneratorParameter = 8, +>GeneratorParameter : ParserContextFlags + + Decorator = 16, +>Decorator : ParserContextFlags + + ThisNodeHasError = 32, +>ThisNodeHasError : ParserContextFlags + + ParserGeneratedFlags = 63, +>ParserGeneratedFlags : ParserContextFlags + + ThisNodeOrAnySubNodesHasError = 64, +>ThisNodeOrAnySubNodesHasError : ParserContextFlags + + HasAggregatedChildData = 128, +>HasAggregatedChildData : ParserContextFlags + } + const enum RelationComparisonResult { +>RelationComparisonResult : RelationComparisonResult + + Succeeded = 1, +>Succeeded : RelationComparisonResult + + Failed = 2, +>Failed : RelationComparisonResult + + FailedAndReported = 3, +>FailedAndReported : RelationComparisonResult + } + interface Node extends TextRange { +>Node : Node +>TextRange : TextRange + + kind: SyntaxKind; +>kind : SyntaxKind +>SyntaxKind : SyntaxKind + + flags: NodeFlags; +>flags : NodeFlags +>NodeFlags : NodeFlags + + parserContextFlags?: ParserContextFlags; +>parserContextFlags : ParserContextFlags +>ParserContextFlags : ParserContextFlags + + decorators?: NodeArray; +>decorators : NodeArray +>NodeArray : NodeArray +>Decorator : Decorator + + modifiers?: ModifiersArray; +>modifiers : ModifiersArray +>ModifiersArray : ModifiersArray + + id?: number; +>id : number + + parent?: Node; +>parent : Node +>Node : Node + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + + locals?: SymbolTable; +>locals : SymbolTable +>SymbolTable : SymbolTable + + nextContainer?: Node; +>nextContainer : Node +>Node : Node + + localSymbol?: Symbol; +>localSymbol : Symbol +>Symbol : Symbol + } + interface NodeArray extends Array, TextRange { +>NodeArray : NodeArray +>T : T +>Array : T[] +>T : T +>TextRange : TextRange + + hasTrailingComma?: boolean; +>hasTrailingComma : boolean + } + interface ModifiersArray extends NodeArray { +>ModifiersArray : ModifiersArray +>NodeArray : NodeArray +>Node : Node + + flags: number; +>flags : number + } + interface Identifier extends PrimaryExpression { +>Identifier : Identifier +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + } + interface QualifiedName extends Node { +>QualifiedName : QualifiedName +>Node : Node + + left: EntityName; +>left : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + right: Identifier; +>right : Identifier +>Identifier : Identifier + } + type EntityName = Identifier | QualifiedName; +>EntityName : Identifier | QualifiedName +>Identifier : Identifier +>QualifiedName : QualifiedName + + type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>Identifier : Identifier +>LiteralExpression : LiteralExpression +>ComputedPropertyName : ComputedPropertyName +>BindingPattern : BindingPattern + + interface Declaration extends Node { +>Declaration : Declaration +>Node : Node + + _declarationBrand: any; +>_declarationBrand : any + + name?: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + } + interface ComputedPropertyName extends Node { +>ComputedPropertyName : ComputedPropertyName +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface Decorator extends Node { +>Decorator : Decorator +>Node : Node + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + } + interface TypeParameterDeclaration extends Declaration { +>TypeParameterDeclaration : TypeParameterDeclaration +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + constraint?: TypeNode; +>constraint : TypeNode +>TypeNode : TypeNode + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface SignatureDeclaration extends Declaration { +>SignatureDeclaration : SignatureDeclaration +>Declaration : Declaration + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + parameters: NodeArray; +>parameters : NodeArray +>NodeArray : NodeArray +>ParameterDeclaration : ParameterDeclaration + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface VariableDeclaration extends Declaration { +>VariableDeclaration : VariableDeclaration +>Declaration : Declaration + + parent?: VariableDeclarationList; +>parent : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface VariableDeclarationList extends Node { +>VariableDeclarationList : VariableDeclarationList +>Node : Node + + declarations: NodeArray; +>declarations : NodeArray +>NodeArray : NodeArray +>VariableDeclaration : VariableDeclaration + } + interface ParameterDeclaration extends Declaration { +>ParameterDeclaration : ParameterDeclaration +>Declaration : Declaration + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingElement extends Declaration { +>BindingElement : BindingElement +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface PropertyDeclaration extends Declaration, ClassElement { +>PropertyDeclaration : PropertyDeclaration +>Declaration : Declaration +>ClassElement : ClassElement + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface ObjectLiteralElement extends Declaration { +>ObjectLiteralElement : ObjectLiteralElement +>Declaration : Declaration + + _objectLiteralBrandBrand: any; +>_objectLiteralBrandBrand : any + } + interface PropertyAssignment extends ObjectLiteralElement { +>PropertyAssignment : PropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + _propertyAssignmentBrand: any; +>_propertyAssignmentBrand : any + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + initializer: Expression; +>initializer : Expression +>Expression : Expression + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { +>ShorthandPropertyAssignment : ShorthandPropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + questionToken?: Node; +>questionToken : Node +>Node : Node + } + interface VariableLikeDeclaration extends Declaration { +>VariableLikeDeclaration : VariableLikeDeclaration +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingPattern extends Node { +>BindingPattern : BindingPattern +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>BindingElement : BindingElement + } + /** + * Several node kinds share function-like features such as a signature, + * a name, and a body. These nodes should extend FunctionLikeDeclaration. + * Examples: + * FunctionDeclaration + * MethodDeclaration + * AccessorDeclaration + */ + interface FunctionLikeDeclaration extends SignatureDeclaration { +>FunctionLikeDeclaration : FunctionLikeDeclaration +>SignatureDeclaration : SignatureDeclaration + + _functionLikeDeclarationBrand: any; +>_functionLikeDeclarationBrand : any + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + questionToken?: Node; +>questionToken : Node +>Node : Node + + body?: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { +>FunctionDeclaration : FunctionDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>Statement : Statement + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + body?: Block; +>body : Block +>Block : Block + } + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>MethodDeclaration : MethodDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + body?: Block; +>body : Block +>Block : Block + } + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { +>ConstructorDeclaration : ConstructorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement + + body?: Block; +>body : Block +>Block : Block + } + interface SemicolonClassElement extends ClassElement { +>SemicolonClassElement : SemicolonClassElement +>ClassElement : ClassElement + + _semicolonClassElementBrand: any; +>_semicolonClassElementBrand : any + } + interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>AccessorDeclaration : AccessorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + _accessorDeclarationBrand: any; +>_accessorDeclarationBrand : any + + body: Block; +>body : Block +>Block : Block + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { +>IndexSignatureDeclaration : IndexSignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>ClassElement : ClassElement + + _indexSignatureDeclarationBrand: any; +>_indexSignatureDeclarationBrand : any + } + interface TypeNode extends Node { +>TypeNode : TypeNode +>Node : Node + + _typeNodeBrand: any; +>_typeNodeBrand : any + } + interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { +>FunctionOrConstructorTypeNode : FunctionOrConstructorTypeNode +>TypeNode : TypeNode +>SignatureDeclaration : SignatureDeclaration + + _functionOrConstructorTypeNodeBrand: any; +>_functionOrConstructorTypeNodeBrand : any + } + interface TypeReferenceNode extends TypeNode { +>TypeReferenceNode : TypeReferenceNode +>TypeNode : TypeNode + + typeName: EntityName; +>typeName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface TypeQueryNode extends TypeNode { +>TypeQueryNode : TypeQueryNode +>TypeNode : TypeNode + + exprName: EntityName; +>exprName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + } + interface TypeLiteralNode extends TypeNode, Declaration { +>TypeLiteralNode : TypeLiteralNode +>TypeNode : TypeNode +>Declaration : Declaration + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Node : Node + } + interface ArrayTypeNode extends TypeNode { +>ArrayTypeNode : ArrayTypeNode +>TypeNode : TypeNode + + elementType: TypeNode; +>elementType : TypeNode +>TypeNode : TypeNode + } + interface TupleTypeNode extends TypeNode { +>TupleTypeNode : TupleTypeNode +>TypeNode : TypeNode + + elementTypes: NodeArray; +>elementTypes : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface UnionTypeNode extends TypeNode { +>UnionTypeNode : UnionTypeNode +>TypeNode : TypeNode + + types: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface ParenthesizedTypeNode extends TypeNode { +>ParenthesizedTypeNode : ParenthesizedTypeNode +>TypeNode : TypeNode + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface StringLiteralTypeNode extends LiteralExpression, TypeNode { +>StringLiteralTypeNode : StringLiteralTypeNode +>LiteralExpression : LiteralExpression +>TypeNode : TypeNode + } + interface Expression extends Node { +>Expression : Expression +>Node : Node + + _expressionBrand: any; +>_expressionBrand : any + + contextualType?: Type; +>contextualType : Type +>Type : Type + } + interface UnaryExpression extends Expression { +>UnaryExpression : UnaryExpression +>Expression : Expression + + _unaryExpressionBrand: any; +>_unaryExpressionBrand : any + } + interface PrefixUnaryExpression extends UnaryExpression { +>PrefixUnaryExpression : PrefixUnaryExpression +>UnaryExpression : UnaryExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + + operand: UnaryExpression; +>operand : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface PostfixUnaryExpression extends PostfixExpression { +>PostfixUnaryExpression : PostfixUnaryExpression +>PostfixExpression : PostfixExpression + + operand: LeftHandSideExpression; +>operand : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + } + interface PostfixExpression extends UnaryExpression { +>PostfixExpression : PostfixExpression +>UnaryExpression : UnaryExpression + + _postfixExpressionBrand: any; +>_postfixExpressionBrand : any + } + interface LeftHandSideExpression extends PostfixExpression { +>LeftHandSideExpression : LeftHandSideExpression +>PostfixExpression : PostfixExpression + + _leftHandSideExpressionBrand: any; +>_leftHandSideExpressionBrand : any + } + interface MemberExpression extends LeftHandSideExpression { +>MemberExpression : MemberExpression +>LeftHandSideExpression : LeftHandSideExpression + + _memberExpressionBrand: any; +>_memberExpressionBrand : any + } + interface PrimaryExpression extends MemberExpression { +>PrimaryExpression : PrimaryExpression +>MemberExpression : MemberExpression + + _primaryExpressionBrand: any; +>_primaryExpressionBrand : any + } + interface DeleteExpression extends UnaryExpression { +>DeleteExpression : DeleteExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface TypeOfExpression extends UnaryExpression { +>TypeOfExpression : TypeOfExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface VoidExpression extends UnaryExpression { +>VoidExpression : VoidExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface YieldExpression extends Expression { +>YieldExpression : YieldExpression +>Expression : Expression + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BinaryExpression extends Expression { +>BinaryExpression : BinaryExpression +>Expression : Expression + + left: Expression; +>left : Expression +>Expression : Expression + + operatorToken: Node; +>operatorToken : Node +>Node : Node + + right: Expression; +>right : Expression +>Expression : Expression + } + interface ConditionalExpression extends Expression { +>ConditionalExpression : ConditionalExpression +>Expression : Expression + + condition: Expression; +>condition : Expression +>Expression : Expression + + questionToken: Node; +>questionToken : Node +>Node : Node + + whenTrue: Expression; +>whenTrue : Expression +>Expression : Expression + + colonToken: Node; +>colonToken : Node +>Node : Node + + whenFalse: Expression; +>whenFalse : Expression +>Expression : Expression + } + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { +>FunctionExpression : FunctionExpression +>PrimaryExpression : PrimaryExpression +>FunctionLikeDeclaration : FunctionLikeDeclaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + body: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface ArrowFunction extends Expression, FunctionLikeDeclaration { +>ArrowFunction : ArrowFunction +>Expression : Expression +>FunctionLikeDeclaration : FunctionLikeDeclaration + + equalsGreaterThanToken: Node; +>equalsGreaterThanToken : Node +>Node : Node + } + interface LiteralExpression extends PrimaryExpression { +>LiteralExpression : LiteralExpression +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + + isUnterminated?: boolean; +>isUnterminated : boolean + + hasExtendedUnicodeEscape?: boolean; +>hasExtendedUnicodeEscape : boolean + } + interface StringLiteralExpression extends LiteralExpression { +>StringLiteralExpression : StringLiteralExpression +>LiteralExpression : LiteralExpression + + _stringLiteralExpressionBrand: any; +>_stringLiteralExpressionBrand : any + } + interface TemplateExpression extends PrimaryExpression { +>TemplateExpression : TemplateExpression +>PrimaryExpression : PrimaryExpression + + head: LiteralExpression; +>head : LiteralExpression +>LiteralExpression : LiteralExpression + + templateSpans: NodeArray; +>templateSpans : NodeArray +>NodeArray : NodeArray +>TemplateSpan : TemplateSpan + } + interface TemplateSpan extends Node { +>TemplateSpan : TemplateSpan +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + + literal: LiteralExpression; +>literal : LiteralExpression +>LiteralExpression : LiteralExpression + } + interface ParenthesizedExpression extends PrimaryExpression { +>ParenthesizedExpression : ParenthesizedExpression +>PrimaryExpression : PrimaryExpression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ArrayLiteralExpression extends PrimaryExpression { +>ArrayLiteralExpression : ArrayLiteralExpression +>PrimaryExpression : PrimaryExpression + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface SpreadElementExpression extends Expression { +>SpreadElementExpression : SpreadElementExpression +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ObjectLiteralExpression extends PrimaryExpression, Declaration { +>ObjectLiteralExpression : ObjectLiteralExpression +>PrimaryExpression : PrimaryExpression +>Declaration : Declaration + + properties: NodeArray; +>properties : NodeArray +>NodeArray : NodeArray +>ObjectLiteralElement : ObjectLiteralElement + } + interface PropertyAccessExpression extends MemberExpression { +>PropertyAccessExpression : PropertyAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + dotToken: Node; +>dotToken : Node +>Node : Node + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ElementAccessExpression extends MemberExpression { +>ElementAccessExpression : ElementAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + argumentExpression?: Expression; +>argumentExpression : Expression +>Expression : Expression + } + interface CallExpression extends LeftHandSideExpression { +>CallExpression : CallExpression +>LeftHandSideExpression : LeftHandSideExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + + arguments: NodeArray; +>arguments : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface HeritageClauseElement extends Node { +>HeritageClauseElement : HeritageClauseElement +>Node : Node + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface NewExpression extends CallExpression, PrimaryExpression { +>NewExpression : NewExpression +>CallExpression : CallExpression +>PrimaryExpression : PrimaryExpression + } + interface TaggedTemplateExpression extends MemberExpression { +>TaggedTemplateExpression : TaggedTemplateExpression +>MemberExpression : MemberExpression + + tag: LeftHandSideExpression; +>tag : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + template: LiteralExpression | TemplateExpression; +>template : LiteralExpression | TemplateExpression +>LiteralExpression : LiteralExpression +>TemplateExpression : TemplateExpression + } + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression; +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>CallExpression : CallExpression +>NewExpression : NewExpression +>TaggedTemplateExpression : TaggedTemplateExpression + + interface TypeAssertion extends UnaryExpression { +>TypeAssertion : TypeAssertion +>UnaryExpression : UnaryExpression + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface Statement extends Node, ModuleElement { +>Statement : Statement +>Node : Node +>ModuleElement : ModuleElement + + _statementBrand: any; +>_statementBrand : any + } + interface Block extends Statement { +>Block : Block +>Statement : Statement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface VariableStatement extends Statement { +>VariableStatement : VariableStatement +>Statement : Statement + + declarationList: VariableDeclarationList; +>declarationList : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + } + interface ExpressionStatement extends Statement { +>ExpressionStatement : ExpressionStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface IfStatement extends Statement { +>IfStatement : IfStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + thenStatement: Statement; +>thenStatement : Statement +>Statement : Statement + + elseStatement?: Statement; +>elseStatement : Statement +>Statement : Statement + } + interface IterationStatement extends Statement { +>IterationStatement : IterationStatement +>Statement : Statement + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface DoStatement extends IterationStatement { +>DoStatement : DoStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface WhileStatement extends IterationStatement { +>WhileStatement : WhileStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ForStatement extends IterationStatement { +>ForStatement : ForStatement +>IterationStatement : IterationStatement + + initializer?: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + condition?: Expression; +>condition : Expression +>Expression : Expression + + iterator?: Expression; +>iterator : Expression +>Expression : Expression + } + interface ForInStatement extends IterationStatement { +>ForInStatement : ForInStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BreakOrContinueStatement extends Statement { +>BreakOrContinueStatement : BreakOrContinueStatement +>Statement : Statement + + label?: Identifier; +>label : Identifier +>Identifier : Identifier + } + interface ReturnStatement extends Statement { +>ReturnStatement : ReturnStatement +>Statement : Statement + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface WithStatement extends Statement { +>WithStatement : WithStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface SwitchStatement extends Statement { +>SwitchStatement : SwitchStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + caseBlock: CaseBlock; +>caseBlock : CaseBlock +>CaseBlock : CaseBlock + } + interface CaseBlock extends Node { +>CaseBlock : CaseBlock +>Node : Node + + clauses: NodeArray; +>clauses : NodeArray +>NodeArray : NodeArray +>CaseOrDefaultClause : CaseClause | DefaultClause + } + interface CaseClause extends Node { +>CaseClause : CaseClause +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface DefaultClause extends Node { +>DefaultClause : DefaultClause +>Node : Node + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + type CaseOrDefaultClause = CaseClause | DefaultClause; +>CaseOrDefaultClause : CaseClause | DefaultClause +>CaseClause : CaseClause +>DefaultClause : DefaultClause + + interface LabeledStatement extends Statement { +>LabeledStatement : LabeledStatement +>Statement : Statement + + label: Identifier; +>label : Identifier +>Identifier : Identifier + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface ThrowStatement extends Statement { +>ThrowStatement : ThrowStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface TryStatement extends Statement { +>TryStatement : TryStatement +>Statement : Statement + + tryBlock: Block; +>tryBlock : Block +>Block : Block + + catchClause?: CatchClause; +>catchClause : CatchClause +>CatchClause : CatchClause + + finallyBlock?: Block; +>finallyBlock : Block +>Block : Block + } + interface CatchClause extends Node { +>CatchClause : CatchClause +>Node : Node + + variableDeclaration: VariableDeclaration; +>variableDeclaration : VariableDeclaration +>VariableDeclaration : VariableDeclaration + + block: Block; +>block : Block +>Block : Block + } + interface ModuleElement extends Node { +>ModuleElement : ModuleElement +>Node : Node + + _moduleElementBrand: any; +>_moduleElementBrand : any + } + interface ClassLikeDeclaration extends Declaration { +>ClassLikeDeclaration : ClassLikeDeclaration +>Declaration : Declaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>ClassElement : ClassElement + } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { +>ClassDeclaration : ClassDeclaration +>ClassLikeDeclaration : ClassLikeDeclaration +>Statement : Statement + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { +>ClassExpression : ClassExpression +>ClassLikeDeclaration : ClassLikeDeclaration +>PrimaryExpression : PrimaryExpression + } + interface ClassElement extends Declaration { +>ClassElement : ClassElement +>Declaration : Declaration + + _classElementBrand: any; +>_classElementBrand : any + } + interface InterfaceDeclaration extends Declaration, ModuleElement { +>InterfaceDeclaration : InterfaceDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Declaration : Declaration + } + interface HeritageClause extends Node { +>HeritageClause : HeritageClause +>Node : Node + + token: SyntaxKind; +>token : SyntaxKind +>SyntaxKind : SyntaxKind + + types?: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>HeritageClauseElement : HeritageClauseElement + } + interface TypeAliasDeclaration extends Declaration, ModuleElement { +>TypeAliasDeclaration : TypeAliasDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface EnumMember extends Declaration { +>EnumMember : EnumMember +>Declaration : Declaration + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface EnumDeclaration extends Declaration, ModuleElement { +>EnumDeclaration : EnumDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>EnumMember : EnumMember + } + interface ModuleDeclaration extends Declaration, ModuleElement { +>ModuleDeclaration : ModuleDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier | LiteralExpression; +>name : Identifier | LiteralExpression +>Identifier : Identifier +>LiteralExpression : LiteralExpression + + body: ModuleBlock | ModuleDeclaration; +>body : ModuleDeclaration | ModuleBlock +>ModuleBlock : ModuleBlock +>ModuleDeclaration : ModuleDeclaration + } + interface ModuleBlock extends Node, ModuleElement { +>ModuleBlock : ModuleBlock +>Node : Node +>ModuleElement : ModuleElement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + } + interface ImportEqualsDeclaration extends Declaration, ModuleElement { +>ImportEqualsDeclaration : ImportEqualsDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + moduleReference: EntityName | ExternalModuleReference; +>moduleReference : Identifier | QualifiedName | ExternalModuleReference +>EntityName : Identifier | QualifiedName +>ExternalModuleReference : ExternalModuleReference + } + interface ExternalModuleReference extends Node { +>ExternalModuleReference : ExternalModuleReference +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface ImportDeclaration extends Statement, ModuleElement { +>ImportDeclaration : ImportDeclaration +>Statement : Statement +>ModuleElement : ModuleElement + + importClause?: ImportClause; +>importClause : ImportClause +>ImportClause : ImportClause + + moduleSpecifier: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface ImportClause extends Declaration { +>ImportClause : ImportClause +>Declaration : Declaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + namedBindings?: NamespaceImport | NamedImports; +>namedBindings : NamespaceImport | NamedImportsOrExports +>NamespaceImport : NamespaceImport +>NamedImports : NamedImportsOrExports + } + interface NamespaceImport extends Declaration { +>NamespaceImport : NamespaceImport +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ExportDeclaration extends Declaration, ModuleElement { +>ExportDeclaration : ExportDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + exportClause?: NamedExports; +>exportClause : NamedImportsOrExports +>NamedExports : NamedImportsOrExports + + moduleSpecifier?: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface NamedImportsOrExports extends Node { +>NamedImportsOrExports : NamedImportsOrExports +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>ImportOrExportSpecifier : ImportOrExportSpecifier + } + type NamedImports = NamedImportsOrExports; +>NamedImports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + type NamedExports = NamedImportsOrExports; +>NamedExports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + interface ImportOrExportSpecifier extends Declaration { +>ImportOrExportSpecifier : ImportOrExportSpecifier +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + type ImportSpecifier = ImportOrExportSpecifier; +>ImportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + + type ExportSpecifier = ImportOrExportSpecifier; +>ExportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + + interface ExportAssignment extends Declaration, ModuleElement { +>ExportAssignment : ExportAssignment +>Declaration : Declaration +>ModuleElement : ModuleElement + + isExportEquals?: boolean; +>isExportEquals : boolean + + expression?: Expression; +>expression : Expression +>Expression : Expression + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface FileReference extends TextRange { +>FileReference : FileReference +>TextRange : TextRange + + fileName: string; +>fileName : string + } + interface CommentRange extends TextRange { +>CommentRange : CommentRange +>TextRange : TextRange + + hasTrailingNewLine?: boolean; +>hasTrailingNewLine : boolean + } + interface SourceFile extends Declaration { +>SourceFile : SourceFile +>Declaration : Declaration + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + + endOfFileToken: Node; +>endOfFileToken : Node +>Node : Node + + fileName: string; +>fileName : string + + text: string; +>text : string + + amdDependencies: { +>amdDependencies : { path: string; name: string; }[] + + path: string; +>path : string + + name: string; +>name : string + + }[]; + amdModuleName: string; +>amdModuleName : string + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + hasNoDefaultLib: boolean; +>hasNoDefaultLib : boolean + + externalModuleIndicator: Node; +>externalModuleIndicator : Node +>Node : Node + + languageVersion: ScriptTarget; +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + identifiers: Map; +>identifiers : Map +>Map : Map + } + interface ScriptReferenceHost { +>ScriptReferenceHost : ScriptReferenceHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + } + interface WriteFileCallback { +>WriteFileCallback : WriteFileCallback + + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; +>fileName : string +>data : string +>writeByteOrderMark : boolean +>onError : (message: string) => void +>message : string + } + interface Program extends ScriptReferenceHost { +>Program : Program +>ScriptReferenceHost : ScriptReferenceHost + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + /** + * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then + * the JavaScript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the JavaScript and declaration for that + * specific file will be generated. + * + * If writeFile is not specified then the writeFile callback from the compiler host will be + * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the JavaScript and declaration files. + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; +>emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult +>targetSourceFile : SourceFile +>SourceFile : SourceFile +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback +>EmitResult : EmitResult + + getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSyntacticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getGlobalDiagnostics(): Diagnostic[]; +>getGlobalDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSemanticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getDeclarationDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getTypeChecker(): TypeChecker; +>getTypeChecker : () => TypeChecker +>TypeChecker : TypeChecker + + getCommonSourceDirectory(): string; +>getCommonSourceDirectory : () => string + } + interface SourceMapSpan { +>SourceMapSpan : SourceMapSpan + + emittedLine: number; +>emittedLine : number + + emittedColumn: number; +>emittedColumn : number + + sourceLine: number; +>sourceLine : number + + sourceColumn: number; +>sourceColumn : number + + nameIndex?: number; +>nameIndex : number + + sourceIndex: number; +>sourceIndex : number + } + interface SourceMapData { +>SourceMapData : SourceMapData + + sourceMapFilePath: string; +>sourceMapFilePath : string + + jsSourceMappingURL: string; +>jsSourceMappingURL : string + + sourceMapFile: string; +>sourceMapFile : string + + sourceMapSourceRoot: string; +>sourceMapSourceRoot : string + + sourceMapSources: string[]; +>sourceMapSources : string[] + + inputSourceFileNames: string[]; +>inputSourceFileNames : string[] + + sourceMapNames?: string[]; +>sourceMapNames : string[] + + sourceMapMappings: string; +>sourceMapMappings : string + + sourceMapDecodedMappings: SourceMapSpan[]; +>sourceMapDecodedMappings : SourceMapSpan[] +>SourceMapSpan : SourceMapSpan + } + enum ExitStatus { +>ExitStatus : ExitStatus + + Success = 0, +>Success : ExitStatus + + DiagnosticsPresent_OutputsSkipped = 1, +>DiagnosticsPresent_OutputsSkipped : ExitStatus + + DiagnosticsPresent_OutputsGenerated = 2, +>DiagnosticsPresent_OutputsGenerated : ExitStatus + } + interface EmitResult { +>EmitResult : EmitResult + + emitSkipped: boolean; +>emitSkipped : boolean + + diagnostics: Diagnostic[]; +>diagnostics : Diagnostic[] +>Diagnostic : Diagnostic + + sourceMaps: SourceMapData[]; +>sourceMaps : SourceMapData[] +>SourceMapData : SourceMapData + } + interface TypeCheckerHost { +>TypeCheckerHost : TypeCheckerHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + } + interface TypeChecker { +>TypeChecker : TypeChecker + + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; +>getTypeOfSymbolAtLocation : (symbol: Symbol, node: Node) => Type +>symbol : Symbol +>Symbol : Symbol +>node : Node +>Node : Node +>Type : Type + + getDeclaredTypeOfSymbol(symbol: Symbol): Type; +>getDeclaredTypeOfSymbol : (symbol: Symbol) => Type +>symbol : Symbol +>Symbol : Symbol +>Type : Type + + getPropertiesOfType(type: Type): Symbol[]; +>getPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getPropertyOfType(type: Type, propertyName: string): Symbol; +>getPropertyOfType : (type: Type, propertyName: string) => Symbol +>type : Type +>Type : Type +>propertyName : string +>Symbol : Symbol + + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; +>getSignaturesOfType : (type: Type, kind: SignatureKind) => Signature[] +>type : Type +>Type : Type +>kind : SignatureKind +>SignatureKind : SignatureKind +>Signature : Signature + + getIndexTypeOfType(type: Type, kind: IndexKind): Type; +>getIndexTypeOfType : (type: Type, kind: IndexKind) => Type +>type : Type +>Type : Type +>kind : IndexKind +>IndexKind : IndexKind +>Type : Type + + getReturnTypeOfSignature(signature: Signature): Type; +>getReturnTypeOfSignature : (signature: Signature) => Type +>signature : Signature +>Signature : Signature +>Type : Type + + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; +>getSymbolsInScope : (location: Node, meaning: SymbolFlags) => Symbol[] +>location : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>Symbol : Symbol + + getSymbolAtLocation(node: Node): Symbol; +>getSymbolAtLocation : (node: Node) => Symbol +>node : Node +>Node : Node +>Symbol : Symbol + + getShorthandAssignmentValueSymbol(location: Node): Symbol; +>getShorthandAssignmentValueSymbol : (location: Node) => Symbol +>location : Node +>Node : Node +>Symbol : Symbol + + getTypeAtLocation(node: Node): Type; +>getTypeAtLocation : (node: Node) => Type +>node : Node +>Node : Node +>Type : Type + + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; +>typeToString : (type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => string +>type : Type +>Type : Type +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; +>symbolToString : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => string +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + + getSymbolDisplayBuilder(): SymbolDisplayBuilder; +>getSymbolDisplayBuilder : () => SymbolDisplayBuilder +>SymbolDisplayBuilder : SymbolDisplayBuilder + + getFullyQualifiedName(symbol: Symbol): string; +>getFullyQualifiedName : (symbol: Symbol) => string +>symbol : Symbol +>Symbol : Symbol + + getAugmentedPropertiesOfType(type: Type): Symbol[]; +>getAugmentedPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getRootSymbols(symbol: Symbol): Symbol[]; +>getRootSymbols : (symbol: Symbol) => Symbol[] +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + + getContextualType(node: Expression): Type; +>getContextualType : (node: Expression) => Type +>node : Expression +>Expression : Expression +>Type : Type + + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; +>getResolvedSignature : (node: CallExpression | NewExpression | TaggedTemplateExpression, candidatesOutArray?: Signature[]) => Signature +>node : CallExpression | NewExpression | TaggedTemplateExpression +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>candidatesOutArray : Signature[] +>Signature : Signature +>Signature : Signature + + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; +>getSignatureFromDeclaration : (declaration: SignatureDeclaration) => Signature +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>Signature : Signature + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + isUndefinedSymbol(symbol: Symbol): boolean; +>isUndefinedSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + isArgumentsSymbol(symbol: Symbol): boolean; +>isArgumentsSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; +>isValidPropertyAccess : (node: QualifiedName | PropertyAccessExpression, propertyName: string) => boolean +>node : QualifiedName | PropertyAccessExpression +>PropertyAccessExpression : PropertyAccessExpression +>QualifiedName : QualifiedName +>propertyName : string + + getAliasedSymbol(symbol: Symbol): Symbol; +>getAliasedSymbol : (symbol: Symbol) => Symbol +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + + getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; +>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration +>Symbol : Symbol + } + interface SymbolDisplayBuilder { +>SymbolDisplayBuilder : SymbolDisplayBuilder + + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeDisplay : (type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>type : Type +>Type : Type +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; +>buildSymbolDisplay : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>flags : SymbolFormatFlags +>SymbolFormatFlags : SymbolFormatFlags + + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildSignatureDisplay : (signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signatures : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildParameterDisplay : (parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameter : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplay : (tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>tp : TypeParameter +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplayFromSymbol : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaraiton : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForParametersAndDelimiters : (parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameters : Symbol[] +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForTypeParametersAndDelimiters : (typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildReturnTypeDisplay : (signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signature : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + } + interface SymbolWriter { +>SymbolWriter : SymbolWriter + + writeKeyword(text: string): void; +>writeKeyword : (text: string) => void +>text : string + + writeOperator(text: string): void; +>writeOperator : (text: string) => void +>text : string + + writePunctuation(text: string): void; +>writePunctuation : (text: string) => void +>text : string + + writeSpace(text: string): void; +>writeSpace : (text: string) => void +>text : string + + writeStringLiteral(text: string): void; +>writeStringLiteral : (text: string) => void +>text : string + + writeParameter(text: string): void; +>writeParameter : (text: string) => void +>text : string + + writeSymbol(text: string, symbol: Symbol): void; +>writeSymbol : (text: string, symbol: Symbol) => void +>text : string +>symbol : Symbol +>Symbol : Symbol + + writeLine(): void; +>writeLine : () => void + + increaseIndent(): void; +>increaseIndent : () => void + + decreaseIndent(): void; +>decreaseIndent : () => void + + clear(): void; +>clear : () => void + + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; +>trackSymbol : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => void +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + } + const enum TypeFormatFlags { +>TypeFormatFlags : TypeFormatFlags + + None = 0, +>None : TypeFormatFlags + + WriteArrayAsGenericType = 1, +>WriteArrayAsGenericType : TypeFormatFlags + + UseTypeOfFunction = 2, +>UseTypeOfFunction : TypeFormatFlags + + NoTruncation = 4, +>NoTruncation : TypeFormatFlags + + WriteArrowStyleSignature = 8, +>WriteArrowStyleSignature : TypeFormatFlags + + WriteOwnNameForAnyLike = 16, +>WriteOwnNameForAnyLike : TypeFormatFlags + + WriteTypeArgumentsOfSignature = 32, +>WriteTypeArgumentsOfSignature : TypeFormatFlags + + InElementType = 64, +>InElementType : TypeFormatFlags + + UseFullyQualifiedType = 128, +>UseFullyQualifiedType : TypeFormatFlags + } + const enum SymbolFormatFlags { +>SymbolFormatFlags : SymbolFormatFlags + + None = 0, +>None : SymbolFormatFlags + + WriteTypeParametersOrArguments = 1, +>WriteTypeParametersOrArguments : SymbolFormatFlags + + UseOnlyExternalAliasing = 2, +>UseOnlyExternalAliasing : SymbolFormatFlags + } + const enum SymbolAccessibility { +>SymbolAccessibility : SymbolAccessibility + + Accessible = 0, +>Accessible : SymbolAccessibility + + NotAccessible = 1, +>NotAccessible : SymbolAccessibility + + CannotBeNamed = 2, +>CannotBeNamed : SymbolAccessibility + } + type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration; +>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration +>ImportDeclaration : ImportDeclaration +>ImportEqualsDeclaration : ImportEqualsDeclaration + + interface SymbolVisibilityResult { +>SymbolVisibilityResult : SymbolVisibilityResult + + accessibility: SymbolAccessibility; +>accessibility : SymbolAccessibility +>SymbolAccessibility : SymbolAccessibility + + aliasesToMakeVisible?: AnyImportSyntax[]; +>aliasesToMakeVisible : (ImportEqualsDeclaration | ImportDeclaration)[] +>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration + + errorSymbolName?: string; +>errorSymbolName : string + + errorNode?: Node; +>errorNode : Node +>Node : Node + } + interface SymbolAccessiblityResult extends SymbolVisibilityResult { +>SymbolAccessiblityResult : SymbolAccessiblityResult +>SymbolVisibilityResult : SymbolVisibilityResult + + errorModuleName?: string; +>errorModuleName : string + } + interface EmitResolver { +>EmitResolver : EmitResolver + + hasGlobalName(name: string): boolean; +>hasGlobalName : (name: string) => boolean +>name : string + + getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string; +>getExpressionNameSubstitution : (node: Identifier, getGeneratedNameForNode: (node: Node) => string) => string +>node : Identifier +>Identifier : Identifier +>getGeneratedNameForNode : (node: Node) => string +>node : Node +>Node : Node + + isValueAliasDeclaration(node: Node): boolean; +>isValueAliasDeclaration : (node: Node) => boolean +>node : Node +>Node : Node + + isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean; +>isReferencedAliasDeclaration : (node: Node, checkChildren?: boolean) => boolean +>node : Node +>Node : Node +>checkChildren : boolean + + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; +>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean +>node : ImportEqualsDeclaration +>ImportEqualsDeclaration : ImportEqualsDeclaration + + getNodeCheckFlags(node: Node): NodeCheckFlags; +>getNodeCheckFlags : (node: Node) => NodeCheckFlags +>node : Node +>Node : Node +>NodeCheckFlags : NodeCheckFlags + + isDeclarationVisible(node: Declaration): boolean; +>isDeclarationVisible : (node: Declaration) => boolean +>node : Declaration +>Declaration : Declaration + + collectLinkedAliases(node: Identifier): Node[]; +>collectLinkedAliases : (node: Identifier) => Node[] +>node : Identifier +>Identifier : Identifier +>Node : Node + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeTypeOfDeclaration : (declaration: VariableLikeDeclaration | AccessorDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>declaration : VariableLikeDeclaration | AccessorDeclaration +>AccessorDeclaration : AccessorDeclaration +>VariableLikeDeclaration : VariableLikeDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>signatureDeclaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeTypeOfExpression : (expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>expr : Expression +>Expression : Expression +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; +>isSymbolAccessible : (symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) => SymbolAccessiblityResult +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>SymbolAccessiblityResult : SymbolAccessiblityResult + + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; +>isEntityNameVisible : (entityName: Expression | Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult +>entityName : Expression | Identifier | QualifiedName +>EntityName : Identifier | QualifiedName +>Expression : Expression +>enclosingDeclaration : Node +>Node : Node +>SymbolVisibilityResult : SymbolVisibilityResult + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + resolvesToSomeValue(location: Node, name: string): boolean; +>resolvesToSomeValue : (location: Node, name: string) => boolean +>location : Node +>Node : Node +>name : string + + getBlockScopedVariableId(node: Identifier): number; +>getBlockScopedVariableId : (node: Identifier) => number +>node : Identifier +>Identifier : Identifier + } + const enum SymbolFlags { +>SymbolFlags : SymbolFlags + + FunctionScopedVariable = 1, +>FunctionScopedVariable : SymbolFlags + + BlockScopedVariable = 2, +>BlockScopedVariable : SymbolFlags + + Property = 4, +>Property : SymbolFlags + + EnumMember = 8, +>EnumMember : SymbolFlags + + Function = 16, +>Function : SymbolFlags + + Class = 32, +>Class : SymbolFlags + + Interface = 64, +>Interface : SymbolFlags + + ConstEnum = 128, +>ConstEnum : SymbolFlags + + RegularEnum = 256, +>RegularEnum : SymbolFlags + + ValueModule = 512, +>ValueModule : SymbolFlags + + NamespaceModule = 1024, +>NamespaceModule : SymbolFlags + + TypeLiteral = 2048, +>TypeLiteral : SymbolFlags + + ObjectLiteral = 4096, +>ObjectLiteral : SymbolFlags + + Method = 8192, +>Method : SymbolFlags + + Constructor = 16384, +>Constructor : SymbolFlags + + GetAccessor = 32768, +>GetAccessor : SymbolFlags + + SetAccessor = 65536, +>SetAccessor : SymbolFlags + + Signature = 131072, +>Signature : SymbolFlags + + TypeParameter = 262144, +>TypeParameter : SymbolFlags + + TypeAlias = 524288, +>TypeAlias : SymbolFlags + + ExportValue = 1048576, +>ExportValue : SymbolFlags + + ExportType = 2097152, +>ExportType : SymbolFlags + + ExportNamespace = 4194304, +>ExportNamespace : SymbolFlags + + Alias = 8388608, +>Alias : SymbolFlags + + Instantiated = 16777216, +>Instantiated : SymbolFlags + + Merged = 33554432, +>Merged : SymbolFlags + + Transient = 67108864, +>Transient : SymbolFlags + + Prototype = 134217728, +>Prototype : SymbolFlags + + UnionProperty = 268435456, +>UnionProperty : SymbolFlags + + Optional = 536870912, +>Optional : SymbolFlags + + ExportStar = 1073741824, +>ExportStar : SymbolFlags + + Enum = 384, +>Enum : SymbolFlags + + Variable = 3, +>Variable : SymbolFlags + + Value = 107455, +>Value : SymbolFlags + + Type = 793056, +>Type : SymbolFlags + + Namespace = 1536, +>Namespace : SymbolFlags + + Module = 1536, +>Module : SymbolFlags + + Accessor = 98304, +>Accessor : SymbolFlags + + FunctionScopedVariableExcludes = 107454, +>FunctionScopedVariableExcludes : SymbolFlags + + BlockScopedVariableExcludes = 107455, +>BlockScopedVariableExcludes : SymbolFlags + + ParameterExcludes = 107455, +>ParameterExcludes : SymbolFlags + + PropertyExcludes = 107455, +>PropertyExcludes : SymbolFlags + + EnumMemberExcludes = 107455, +>EnumMemberExcludes : SymbolFlags + + FunctionExcludes = 106927, +>FunctionExcludes : SymbolFlags + + ClassExcludes = 899583, +>ClassExcludes : SymbolFlags + + InterfaceExcludes = 792992, +>InterfaceExcludes : SymbolFlags + + RegularEnumExcludes = 899327, +>RegularEnumExcludes : SymbolFlags + + ConstEnumExcludes = 899967, +>ConstEnumExcludes : SymbolFlags + + ValueModuleExcludes = 106639, +>ValueModuleExcludes : SymbolFlags + + NamespaceModuleExcludes = 0, +>NamespaceModuleExcludes : SymbolFlags + + MethodExcludes = 99263, +>MethodExcludes : SymbolFlags + + GetAccessorExcludes = 41919, +>GetAccessorExcludes : SymbolFlags + + SetAccessorExcludes = 74687, +>SetAccessorExcludes : SymbolFlags + + TypeParameterExcludes = 530912, +>TypeParameterExcludes : SymbolFlags + + TypeAliasExcludes = 793056, +>TypeAliasExcludes : SymbolFlags + + AliasExcludes = 8388608, +>AliasExcludes : SymbolFlags + + ModuleMember = 8914931, +>ModuleMember : SymbolFlags + + ExportHasLocal = 944, +>ExportHasLocal : SymbolFlags + + HasLocals = 255504, +>HasLocals : SymbolFlags + + HasExports = 1952, +>HasExports : SymbolFlags + + HasMembers = 6240, +>HasMembers : SymbolFlags + + IsContainer = 262128, +>IsContainer : SymbolFlags + + PropertyOrAccessor = 98308, +>PropertyOrAccessor : SymbolFlags + + Export = 7340032, +>Export : SymbolFlags + } + interface Symbol { +>Symbol : Symbol + + flags: SymbolFlags; +>flags : SymbolFlags +>SymbolFlags : SymbolFlags + + name: string; +>name : string + + id?: number; +>id : number + + mergeId?: number; +>mergeId : number + + declarations?: Declaration[]; +>declarations : Declaration[] +>Declaration : Declaration + + parent?: Symbol; +>parent : Symbol +>Symbol : Symbol + + members?: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + exports?: SymbolTable; +>exports : SymbolTable +>SymbolTable : SymbolTable + + exportSymbol?: Symbol; +>exportSymbol : Symbol +>Symbol : Symbol + + valueDeclaration?: Declaration; +>valueDeclaration : Declaration +>Declaration : Declaration + + constEnumOnlyModule?: boolean; +>constEnumOnlyModule : boolean + } + interface SymbolLinks { +>SymbolLinks : SymbolLinks + + target?: Symbol; +>target : Symbol +>Symbol : Symbol + + type?: Type; +>type : Type +>Type : Type + + declaredType?: Type; +>declaredType : Type +>Type : Type + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + referenced?: boolean; +>referenced : boolean + + unionType?: UnionType; +>unionType : UnionType +>UnionType : UnionType + + resolvedExports?: SymbolTable; +>resolvedExports : SymbolTable +>SymbolTable : SymbolTable + + exportsChecked?: boolean; +>exportsChecked : boolean + } + interface TransientSymbol extends Symbol, SymbolLinks { +>TransientSymbol : TransientSymbol +>Symbol : Symbol +>SymbolLinks : SymbolLinks + } + interface SymbolTable { +>SymbolTable : SymbolTable + + [index: string]: Symbol; +>index : string +>Symbol : Symbol + } + const enum NodeCheckFlags { +>NodeCheckFlags : NodeCheckFlags + + TypeChecked = 1, +>TypeChecked : NodeCheckFlags + + LexicalThis = 2, +>LexicalThis : NodeCheckFlags + + CaptureThis = 4, +>CaptureThis : NodeCheckFlags + + EmitExtends = 8, +>EmitExtends : NodeCheckFlags + + SuperInstance = 16, +>SuperInstance : NodeCheckFlags + + SuperStatic = 32, +>SuperStatic : NodeCheckFlags + + ContextChecked = 64, +>ContextChecked : NodeCheckFlags + + EnumValuesComputed = 128, +>EnumValuesComputed : NodeCheckFlags + + BlockScopedBindingInLoop = 256, +>BlockScopedBindingInLoop : NodeCheckFlags + + EmitDecorate = 512, +>EmitDecorate : NodeCheckFlags + } + interface NodeLinks { +>NodeLinks : NodeLinks + + resolvedType?: Type; +>resolvedType : Type +>Type : Type + + resolvedSignature?: Signature; +>resolvedSignature : Signature +>Signature : Signature + + resolvedSymbol?: Symbol; +>resolvedSymbol : Symbol +>Symbol : Symbol + + flags?: NodeCheckFlags; +>flags : NodeCheckFlags +>NodeCheckFlags : NodeCheckFlags + + enumMemberValue?: number; +>enumMemberValue : number + + isIllegalTypeReferenceInConstraint?: boolean; +>isIllegalTypeReferenceInConstraint : boolean + + isVisible?: boolean; +>isVisible : boolean + + generatedName?: string; +>generatedName : string + + generatedNames?: Map; +>generatedNames : Map +>Map : Map + + assignmentChecks?: Map; +>assignmentChecks : Map +>Map : Map + + hasReportedStatementInAmbientContext?: boolean; +>hasReportedStatementInAmbientContext : boolean + + importOnRightSide?: Symbol; +>importOnRightSide : Symbol +>Symbol : Symbol + } + const enum TypeFlags { +>TypeFlags : TypeFlags + + Any = 1, +>Any : TypeFlags + + String = 2, +>String : TypeFlags + + Number = 4, +>Number : TypeFlags + + Boolean = 8, +>Boolean : TypeFlags + + Void = 16, +>Void : TypeFlags + + Undefined = 32, +>Undefined : TypeFlags + + Null = 64, +>Null : TypeFlags + + Enum = 128, +>Enum : TypeFlags + + StringLiteral = 256, +>StringLiteral : TypeFlags + + TypeParameter = 512, +>TypeParameter : TypeFlags + + Class = 1024, +>Class : TypeFlags + + Interface = 2048, +>Interface : TypeFlags + + Reference = 4096, +>Reference : TypeFlags + + Tuple = 8192, +>Tuple : TypeFlags + + Union = 16384, +>Union : TypeFlags + + Anonymous = 32768, +>Anonymous : TypeFlags + + FromSignature = 65536, +>FromSignature : TypeFlags + + ObjectLiteral = 131072, +>ObjectLiteral : TypeFlags + + ContainsUndefinedOrNull = 262144, +>ContainsUndefinedOrNull : TypeFlags + + ContainsObjectLiteral = 524288, +>ContainsObjectLiteral : TypeFlags + + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, +>Intrinsic : TypeFlags + + Primitive = 1049086, +>Primitive : TypeFlags + + StringLike = 258, +>StringLike : TypeFlags + + NumberLike = 132, +>NumberLike : TypeFlags + + ObjectType = 48128, +>ObjectType : TypeFlags + + RequiresWidening = 786432, +>RequiresWidening : TypeFlags + } + interface Type { +>Type : Type + + flags: TypeFlags; +>flags : TypeFlags +>TypeFlags : TypeFlags + + id: number; +>id : number + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + } + interface IntrinsicType extends Type { +>IntrinsicType : IntrinsicType +>Type : Type + + intrinsicName: string; +>intrinsicName : string + } + interface StringLiteralType extends Type { +>StringLiteralType : StringLiteralType +>Type : Type + + text: string; +>text : string + } + interface ObjectType extends Type { +>ObjectType : ObjectType +>Type : Type + } + interface InterfaceType extends ObjectType { +>InterfaceType : InterfaceType +>ObjectType : ObjectType + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + baseTypes: ObjectType[]; +>baseTypes : ObjectType[] +>ObjectType : ObjectType + + declaredProperties: Symbol[]; +>declaredProperties : Symbol[] +>Symbol : Symbol + + declaredCallSignatures: Signature[]; +>declaredCallSignatures : Signature[] +>Signature : Signature + + declaredConstructSignatures: Signature[]; +>declaredConstructSignatures : Signature[] +>Signature : Signature + + declaredStringIndexType: Type; +>declaredStringIndexType : Type +>Type : Type + + declaredNumberIndexType: Type; +>declaredNumberIndexType : Type +>Type : Type + } + interface TypeReference extends ObjectType { +>TypeReference : TypeReference +>ObjectType : ObjectType + + target: GenericType; +>target : GenericType +>GenericType : GenericType + + typeArguments: Type[]; +>typeArguments : Type[] +>Type : Type + } + interface GenericType extends InterfaceType, TypeReference { +>GenericType : GenericType +>InterfaceType : InterfaceType +>TypeReference : TypeReference + + instantiations: Map; +>instantiations : Map +>Map : Map +>TypeReference : TypeReference + } + interface TupleType extends ObjectType { +>TupleType : TupleType +>ObjectType : ObjectType + + elementTypes: Type[]; +>elementTypes : Type[] +>Type : Type + + baseArrayType: TypeReference; +>baseArrayType : TypeReference +>TypeReference : TypeReference + } + interface UnionType extends Type { +>UnionType : UnionType +>Type : Type + + types: Type[]; +>types : Type[] +>Type : Type + + resolvedProperties: SymbolTable; +>resolvedProperties : SymbolTable +>SymbolTable : SymbolTable + } + interface ResolvedType extends ObjectType, UnionType { +>ResolvedType : ResolvedType +>ObjectType : ObjectType +>UnionType : UnionType + + members: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + properties: Symbol[]; +>properties : Symbol[] +>Symbol : Symbol + + callSignatures: Signature[]; +>callSignatures : Signature[] +>Signature : Signature + + constructSignatures: Signature[]; +>constructSignatures : Signature[] +>Signature : Signature + + stringIndexType: Type; +>stringIndexType : Type +>Type : Type + + numberIndexType: Type; +>numberIndexType : Type +>Type : Type + } + interface TypeParameter extends Type { +>TypeParameter : TypeParameter +>Type : Type + + constraint: Type; +>constraint : Type +>Type : Type + + target?: TypeParameter; +>target : TypeParameter +>TypeParameter : TypeParameter + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + } + const enum SignatureKind { +>SignatureKind : SignatureKind + + Call = 0, +>Call : SignatureKind + + Construct = 1, +>Construct : SignatureKind + } + interface Signature { +>Signature : Signature + + declaration: SignatureDeclaration; +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + parameters: Symbol[]; +>parameters : Symbol[] +>Symbol : Symbol + + resolvedReturnType: Type; +>resolvedReturnType : Type +>Type : Type + + minArgumentCount: number; +>minArgumentCount : number + + hasRestParameter: boolean; +>hasRestParameter : boolean + + hasStringLiterals: boolean; +>hasStringLiterals : boolean + + target?: Signature; +>target : Signature +>Signature : Signature + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + unionSignatures?: Signature[]; +>unionSignatures : Signature[] +>Signature : Signature + + erasedSignatureCache?: Signature; +>erasedSignatureCache : Signature +>Signature : Signature + + isolatedSignatureType?: ObjectType; +>isolatedSignatureType : ObjectType +>ObjectType : ObjectType + } + const enum IndexKind { +>IndexKind : IndexKind + + String = 0, +>String : IndexKind + + Number = 1, +>Number : IndexKind + } + interface TypeMapper { +>TypeMapper : TypeMapper + + (t: Type): Type; +>t : Type +>Type : Type +>Type : Type + } + interface DiagnosticMessage { +>DiagnosticMessage : DiagnosticMessage + + key: string; +>key : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + interface DiagnosticMessageChain { +>DiagnosticMessageChain : DiagnosticMessageChain + + messageText: string; +>messageText : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + + next?: DiagnosticMessageChain; +>next : DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + } + interface Diagnostic { +>Diagnostic : Diagnostic + + file: SourceFile; +>file : SourceFile +>SourceFile : SourceFile + + start: number; +>start : number + + length: number; +>length : number + + messageText: string | DiagnosticMessageChain; +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + enum DiagnosticCategory { +>DiagnosticCategory : DiagnosticCategory + + Warning = 0, +>Warning : DiagnosticCategory + + Error = 1, +>Error : DiagnosticCategory + + Message = 2, +>Message : DiagnosticCategory + } + interface CompilerOptions { +>CompilerOptions : CompilerOptions + + allowNonTsExtensions?: boolean; +>allowNonTsExtensions : boolean + + charset?: string; +>charset : string + + declaration?: boolean; +>declaration : boolean + + diagnostics?: boolean; +>diagnostics : boolean + + emitBOM?: boolean; +>emitBOM : boolean + + help?: boolean; +>help : boolean + + listFiles?: boolean; +>listFiles : boolean + + locale?: string; +>locale : string + + mapRoot?: string; +>mapRoot : string + + module?: ModuleKind; +>module : ModuleKind +>ModuleKind : ModuleKind + + noEmit?: boolean; +>noEmit : boolean + + noEmitOnError?: boolean; +>noEmitOnError : boolean + + noErrorTruncation?: boolean; +>noErrorTruncation : boolean + + noImplicitAny?: boolean; +>noImplicitAny : boolean + + noLib?: boolean; +>noLib : boolean + + noResolve?: boolean; +>noResolve : boolean + + out?: string; +>out : string + + outDir?: string; +>outDir : string + + preserveConstEnums?: boolean; +>preserveConstEnums : boolean + + project?: string; +>project : string + + removeComments?: boolean; +>removeComments : boolean + + sourceMap?: boolean; +>sourceMap : boolean + + sourceRoot?: string; +>sourceRoot : string + + suppressImplicitAnyIndexErrors?: boolean; +>suppressImplicitAnyIndexErrors : boolean + + target?: ScriptTarget; +>target : ScriptTarget +>ScriptTarget : ScriptTarget + + version?: boolean; +>version : boolean + + watch?: boolean; +>watch : boolean + + separateCompilation?: boolean; +>separateCompilation : boolean + + [option: string]: string | number | boolean; +>option : string + } + const enum ModuleKind { +>ModuleKind : ModuleKind + + None = 0, +>None : ModuleKind + + CommonJS = 1, +>CommonJS : ModuleKind + + AMD = 2, +>AMD : ModuleKind + } + interface LineAndCharacter { +>LineAndCharacter : LineAndCharacter + + line: number; +>line : number + + character: number; +>character : number + } + const enum ScriptTarget { +>ScriptTarget : ScriptTarget + + ES3 = 0, +>ES3 : ScriptTarget + + ES5 = 1, +>ES5 : ScriptTarget + + ES6 = 2, +>ES6 : ScriptTarget + + Latest = 2, +>Latest : ScriptTarget + } + interface ParsedCommandLine { +>ParsedCommandLine : ParsedCommandLine + + options: CompilerOptions; +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + fileNames: string[]; +>fileNames : string[] + + errors: Diagnostic[]; +>errors : Diagnostic[] +>Diagnostic : Diagnostic + } + interface CommandLineOption { +>CommandLineOption : CommandLineOption + + name: string; +>name : string + + type: string | Map; +>type : string | Map +>Map : Map + + isFilePath?: boolean; +>isFilePath : boolean + + shortName?: string; +>shortName : string + + description?: DiagnosticMessage; +>description : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + paramType?: DiagnosticMessage; +>paramType : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + error?: DiagnosticMessage; +>error : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + experimental?: boolean; +>experimental : boolean + } + const enum CharacterCodes { +>CharacterCodes : CharacterCodes + + nullCharacter = 0, +>nullCharacter : CharacterCodes + + maxAsciiCharacter = 127, +>maxAsciiCharacter : CharacterCodes + + lineFeed = 10, +>lineFeed : CharacterCodes + + carriageReturn = 13, +>carriageReturn : CharacterCodes + + lineSeparator = 8232, +>lineSeparator : CharacterCodes + + paragraphSeparator = 8233, +>paragraphSeparator : CharacterCodes + + nextLine = 133, +>nextLine : CharacterCodes + + space = 32, +>space : CharacterCodes + + nonBreakingSpace = 160, +>nonBreakingSpace : CharacterCodes + + enQuad = 8192, +>enQuad : CharacterCodes + + emQuad = 8193, +>emQuad : CharacterCodes + + enSpace = 8194, +>enSpace : CharacterCodes + + emSpace = 8195, +>emSpace : CharacterCodes + + threePerEmSpace = 8196, +>threePerEmSpace : CharacterCodes + + fourPerEmSpace = 8197, +>fourPerEmSpace : CharacterCodes + + sixPerEmSpace = 8198, +>sixPerEmSpace : CharacterCodes + + figureSpace = 8199, +>figureSpace : CharacterCodes + + punctuationSpace = 8200, +>punctuationSpace : CharacterCodes + + thinSpace = 8201, +>thinSpace : CharacterCodes + + hairSpace = 8202, +>hairSpace : CharacterCodes + + zeroWidthSpace = 8203, +>zeroWidthSpace : CharacterCodes + + narrowNoBreakSpace = 8239, +>narrowNoBreakSpace : CharacterCodes + + ideographicSpace = 12288, +>ideographicSpace : CharacterCodes + + mathematicalSpace = 8287, +>mathematicalSpace : CharacterCodes + + ogham = 5760, +>ogham : CharacterCodes + + _ = 95, +>_ : CharacterCodes + + $ = 36, +>$ : CharacterCodes + + _0 = 48, +>_0 : CharacterCodes + + _1 = 49, +>_1 : CharacterCodes + + _2 = 50, +>_2 : CharacterCodes + + _3 = 51, +>_3 : CharacterCodes + + _4 = 52, +>_4 : CharacterCodes + + _5 = 53, +>_5 : CharacterCodes + + _6 = 54, +>_6 : CharacterCodes + + _7 = 55, +>_7 : CharacterCodes + + _8 = 56, +>_8 : CharacterCodes + + _9 = 57, +>_9 : CharacterCodes + + a = 97, +>a : CharacterCodes + + b = 98, +>b : CharacterCodes + + c = 99, +>c : CharacterCodes + + d = 100, +>d : CharacterCodes + + e = 101, +>e : CharacterCodes + + f = 102, +>f : CharacterCodes + + g = 103, +>g : CharacterCodes + + h = 104, +>h : CharacterCodes + + i = 105, +>i : CharacterCodes + + j = 106, +>j : CharacterCodes + + k = 107, +>k : CharacterCodes + + l = 108, +>l : CharacterCodes + + m = 109, +>m : CharacterCodes + + n = 110, +>n : CharacterCodes + + o = 111, +>o : CharacterCodes + + p = 112, +>p : CharacterCodes + + q = 113, +>q : CharacterCodes + + r = 114, +>r : CharacterCodes + + s = 115, +>s : CharacterCodes + + t = 116, +>t : CharacterCodes + + u = 117, +>u : CharacterCodes + + v = 118, +>v : CharacterCodes + + w = 119, +>w : CharacterCodes + + x = 120, +>x : CharacterCodes + + y = 121, +>y : CharacterCodes + + z = 122, +>z : CharacterCodes + + A = 65, +>A : CharacterCodes + + B = 66, +>B : CharacterCodes + + C = 67, +>C : CharacterCodes + + D = 68, +>D : CharacterCodes + + E = 69, +>E : CharacterCodes + + F = 70, +>F : CharacterCodes + + G = 71, +>G : CharacterCodes + + H = 72, +>H : CharacterCodes + + I = 73, +>I : CharacterCodes + + J = 74, +>J : CharacterCodes + + K = 75, +>K : CharacterCodes + + L = 76, +>L : CharacterCodes + + M = 77, +>M : CharacterCodes + + N = 78, +>N : CharacterCodes + + O = 79, +>O : CharacterCodes + + P = 80, +>P : CharacterCodes + + Q = 81, +>Q : CharacterCodes + + R = 82, +>R : CharacterCodes + + S = 83, +>S : CharacterCodes + + T = 84, +>T : CharacterCodes + + U = 85, +>U : CharacterCodes + + V = 86, +>V : CharacterCodes + + W = 87, +>W : CharacterCodes + + X = 88, +>X : CharacterCodes + + Y = 89, +>Y : CharacterCodes + + Z = 90, +>Z : CharacterCodes + + ampersand = 38, +>ampersand : CharacterCodes + + asterisk = 42, +>asterisk : CharacterCodes + + at = 64, +>at : CharacterCodes + + backslash = 92, +>backslash : CharacterCodes + + backtick = 96, +>backtick : CharacterCodes + + bar = 124, +>bar : CharacterCodes + + caret = 94, +>caret : CharacterCodes + + closeBrace = 125, +>closeBrace : CharacterCodes + + closeBracket = 93, +>closeBracket : CharacterCodes + + closeParen = 41, +>closeParen : CharacterCodes + + colon = 58, +>colon : CharacterCodes + + comma = 44, +>comma : CharacterCodes + + dot = 46, +>dot : CharacterCodes + + doubleQuote = 34, +>doubleQuote : CharacterCodes + + equals = 61, +>equals : CharacterCodes + + exclamation = 33, +>exclamation : CharacterCodes + + greaterThan = 62, +>greaterThan : CharacterCodes + + hash = 35, +>hash : CharacterCodes + + lessThan = 60, +>lessThan : CharacterCodes + + minus = 45, +>minus : CharacterCodes + + openBrace = 123, +>openBrace : CharacterCodes + + openBracket = 91, +>openBracket : CharacterCodes + + openParen = 40, +>openParen : CharacterCodes + + percent = 37, +>percent : CharacterCodes + + plus = 43, +>plus : CharacterCodes + + question = 63, +>question : CharacterCodes + + semicolon = 59, +>semicolon : CharacterCodes + + singleQuote = 39, +>singleQuote : CharacterCodes + + slash = 47, +>slash : CharacterCodes + + tilde = 126, +>tilde : CharacterCodes + + backspace = 8, +>backspace : CharacterCodes + + formFeed = 12, +>formFeed : CharacterCodes + + byteOrderMark = 65279, +>byteOrderMark : CharacterCodes + + tab = 9, +>tab : CharacterCodes + + verticalTab = 11, +>verticalTab : CharacterCodes + } + interface CancellationToken { +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + } + interface CompilerHost { +>CompilerHost : CompilerHost + + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; +>getSourceFile : (fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile +>fileName : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>onError : (message: string) => void +>message : string +>SourceFile : SourceFile + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + writeFile: WriteFileCallback; +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getCanonicalFileName(fileName: string): string; +>getCanonicalFileName : (fileName: string) => string +>fileName : string + + useCaseSensitiveFileNames(): boolean; +>useCaseSensitiveFileNames : () => boolean + + getNewLine(): string; +>getNewLine : () => string + } + interface TextSpan { +>TextSpan : TextSpan + + start: number; +>start : number + + length: number; +>length : number + } + interface TextChangeRange { +>TextChangeRange : TextChangeRange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newLength: number; +>newLength : number + } +} +declare module "typescript" { + interface ErrorCallback { +>ErrorCallback : ErrorCallback + + (message: DiagnosticMessage, length: number): void; +>message : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage +>length : number + } + interface Scanner { +>Scanner : Scanner + + getStartPos(): number; +>getStartPos : () => number + + getToken(): SyntaxKind; +>getToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + getTextPos(): number; +>getTextPos : () => number + + getTokenPos(): number; +>getTokenPos : () => number + + getTokenText(): string; +>getTokenText : () => string + + getTokenValue(): string; +>getTokenValue : () => string + + hasExtendedUnicodeEscape(): boolean; +>hasExtendedUnicodeEscape : () => boolean + + hasPrecedingLineBreak(): boolean; +>hasPrecedingLineBreak : () => boolean + + isIdentifier(): boolean; +>isIdentifier : () => boolean + + isReservedWord(): boolean; +>isReservedWord : () => boolean + + isUnterminated(): boolean; +>isUnterminated : () => boolean + + reScanGreaterToken(): SyntaxKind; +>reScanGreaterToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanSlashToken(): SyntaxKind; +>reScanSlashToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanTemplateToken(): SyntaxKind; +>reScanTemplateToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + scan(): SyntaxKind; +>scan : () => SyntaxKind +>SyntaxKind : SyntaxKind + + setText(text: string): void; +>setText : (text: string) => void +>text : string + + setTextPos(textPos: number): void; +>setTextPos : (textPos: number) => void +>textPos : number + + lookAhead(callback: () => T): T; +>lookAhead : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + + tryScan(callback: () => T): T; +>tryScan : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + } + function tokenToString(t: SyntaxKind): string; +>tokenToString : (t: SyntaxKind) => string +>t : SyntaxKind +>SyntaxKind : SyntaxKind + + function computeLineStarts(text: string): number[]; +>computeLineStarts : (text: string) => number[] +>text : string + + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number +>sourceFile : SourceFile +>SourceFile : SourceFile +>line : number +>character : number + + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number +>lineStarts : number[] +>line : number +>character : number + + function getLineStarts(sourceFile: SourceFile): number[]; +>getLineStarts : (sourceFile: SourceFile) => number[] +>sourceFile : SourceFile +>SourceFile : SourceFile + + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } +>lineStarts : number[] +>position : number + + line: number; +>line : number + + character: number; +>character : number + + }; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter +>sourceFile : SourceFile +>SourceFile : SourceFile +>position : number +>LineAndCharacter : LineAndCharacter + + function isWhiteSpace(ch: number): boolean; +>isWhiteSpace : (ch: number) => boolean +>ch : number + + function isLineBreak(ch: number): boolean; +>isLineBreak : (ch: number) => boolean +>ch : number + + function isOctalDigit(ch: number): boolean; +>isOctalDigit : (ch: number) => boolean +>ch : number + + function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; +>skipTrivia : (text: string, pos: number, stopAfterLineBreak?: boolean) => number +>text : string +>pos : number +>stopAfterLineBreak : boolean + + function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; +>getLeadingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; +>getTrailingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierStart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierPart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner; +>createScanner : (languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback) => Scanner +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>skipTrivia : boolean +>text : string +>onError : ErrorCallback +>ErrorCallback : ErrorCallback +>Scanner : Scanner +} +declare module "typescript" { + function getNodeConstructor(kind: SyntaxKind): new () => Node; +>getNodeConstructor : (kind: SyntaxKind) => new () => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function createNode(kind: SyntaxKind): Node; +>createNode : (kind: SyntaxKind) => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; +>forEachChild : (node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T) => T +>T : T +>node : Node +>Node : Node +>cbNode : (node: Node) => T +>node : Node +>Node : Node +>T : T +>cbNodeArray : (nodes: Node[]) => T +>nodes : Node[] +>Node : Node +>T : T +>T : T + + function modifierToFlag(token: SyntaxKind): NodeFlags; +>modifierToFlag : (token: SyntaxKind) => NodeFlags +>token : SyntaxKind +>SyntaxKind : SyntaxKind +>NodeFlags : NodeFlags + + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; +>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>aggressiveChecks : boolean +>SourceFile : SourceFile + + function isEvalOrArgumentsIdentifier(node: Node): boolean; +>isEvalOrArgumentsIdentifier : (node: Node) => boolean +>node : Node +>Node : Node + + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile +>fileName : string +>sourceText : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>setParentNodes : boolean +>SourceFile : SourceFile + + function isLeftHandSideExpression(expr: Expression): boolean; +>isLeftHandSideExpression : (expr: Expression) => boolean +>expr : Expression +>Expression : Expression + + function isAssignmentOperator(token: SyntaxKind): boolean; +>isAssignmentOperator : (token: SyntaxKind) => boolean +>token : SyntaxKind +>SyntaxKind : SyntaxKind +} +declare module "typescript" { + function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; +>createTypeChecker : (host: TypeCheckerHost, produceDiagnostics: boolean) => TypeChecker +>host : TypeCheckerHost +>TypeCheckerHost : TypeCheckerHost +>produceDiagnostics : boolean +>TypeChecker : TypeChecker +} +declare module "typescript" { + /** The version of the TypeScript compiler release */ + let version: string; +>version : string + + function findConfigFile(searchPath: string): string; +>findConfigFile : (searchPath: string) => string +>searchPath : string + + function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; +>createCompilerHost : (options: CompilerOptions, setParentNodes?: boolean) => CompilerHost +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>setParentNodes : boolean +>CompilerHost : CompilerHost + + function getPreEmitDiagnostics(program: Program): Diagnostic[]; +>getPreEmitDiagnostics : (program: Program) => Diagnostic[] +>program : Program +>Program : Program +>Diagnostic : Diagnostic + + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; +>flattenDiagnosticMessageText : (messageText: string | DiagnosticMessageChain, newLine: string) => string +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain +>newLine : string + + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; +>createProgram : (rootNames: string[], options: CompilerOptions, host?: CompilerHost) => Program +>rootNames : string[] +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>host : CompilerHost +>CompilerHost : CompilerHost +>Program : Program +} +declare module "typescript" { + /** The version of the language service API */ + let servicesVersion: string; +>servicesVersion : string + + interface Node { +>Node : Node + + getSourceFile(): SourceFile; +>getSourceFile : () => SourceFile +>SourceFile : SourceFile + + getChildCount(sourceFile?: SourceFile): number; +>getChildCount : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getChildAt(index: number, sourceFile?: SourceFile): Node; +>getChildAt : (index: number, sourceFile?: SourceFile) => Node +>index : number +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getChildren(sourceFile?: SourceFile): Node[]; +>getChildren : (sourceFile?: SourceFile) => Node[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getStart(sourceFile?: SourceFile): number; +>getStart : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullStart(): number; +>getFullStart : () => number + + getEnd(): number; +>getEnd : () => number + + getWidth(sourceFile?: SourceFile): number; +>getWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullWidth(): number; +>getFullWidth : () => number + + getLeadingTriviaWidth(sourceFile?: SourceFile): number; +>getLeadingTriviaWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullText(sourceFile?: SourceFile): string; +>getFullText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getText(sourceFile?: SourceFile): string; +>getText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFirstToken(sourceFile?: SourceFile): Node; +>getFirstToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getLastToken(sourceFile?: SourceFile): Node; +>getLastToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + } + interface Symbol { +>Symbol : Symbol + + getFlags(): SymbolFlags; +>getFlags : () => SymbolFlags +>SymbolFlags : SymbolFlags + + getName(): string; +>getName : () => string + + getDeclarations(): Declaration[]; +>getDeclarations : () => Declaration[] +>Declaration : Declaration + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface Type { +>Type : Type + + getFlags(): TypeFlags; +>getFlags : () => TypeFlags +>TypeFlags : TypeFlags + + getSymbol(): Symbol; +>getSymbol : () => Symbol +>Symbol : Symbol + + getProperties(): Symbol[]; +>getProperties : () => Symbol[] +>Symbol : Symbol + + getProperty(propertyName: string): Symbol; +>getProperty : (propertyName: string) => Symbol +>propertyName : string +>Symbol : Symbol + + getApparentProperties(): Symbol[]; +>getApparentProperties : () => Symbol[] +>Symbol : Symbol + + getCallSignatures(): Signature[]; +>getCallSignatures : () => Signature[] +>Signature : Signature + + getConstructSignatures(): Signature[]; +>getConstructSignatures : () => Signature[] +>Signature : Signature + + getStringIndexType(): Type; +>getStringIndexType : () => Type +>Type : Type + + getNumberIndexType(): Type; +>getNumberIndexType : () => Type +>Type : Type + } + interface Signature { +>Signature : Signature + + getDeclaration(): SignatureDeclaration; +>getDeclaration : () => SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + getTypeParameters(): Type[]; +>getTypeParameters : () => Type[] +>Type : Type + + getParameters(): Symbol[]; +>getParameters : () => Symbol[] +>Symbol : Symbol + + getReturnType(): Type; +>getReturnType : () => Type +>Type : Type + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface SourceFile { +>SourceFile : SourceFile + + getNamedDeclarations(): Declaration[]; +>getNamedDeclarations : () => Declaration[] +>Declaration : Declaration + + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter +>pos : number +>LineAndCharacter : LineAndCharacter + + getLineStarts(): number[]; +>getLineStarts : () => number[] + + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number +>line : number +>character : number + + update(newText: string, textChangeRange: TextChangeRange): SourceFile; +>update : (newText: string, textChangeRange: TextChangeRange) => SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { +>IScriptSnapshot : IScriptSnapshot + + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; +>getText : (start: number, end: number) => string +>start : number +>end : number + + /** Gets the length of this script snapshot. */ + getLength(): number; +>getLength : () => number + + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; +>getChangeRange : (oldSnapshot: IScriptSnapshot) => TextChangeRange +>oldSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>TextChangeRange : TextChangeRange + } + module ScriptSnapshot { +>ScriptSnapshot : typeof ScriptSnapshot + + function fromString(text: string): IScriptSnapshot; +>fromString : (text: string) => IScriptSnapshot +>text : string +>IScriptSnapshot : IScriptSnapshot + } + interface PreProcessedFileInfo { +>PreProcessedFileInfo : PreProcessedFileInfo + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + importedFiles: FileReference[]; +>importedFiles : FileReference[] +>FileReference : FileReference + + isLibFile: boolean; +>isLibFile : boolean + } + interface LanguageServiceHost { +>LanguageServiceHost : LanguageServiceHost + + getCompilationSettings(): CompilerOptions; +>getCompilationSettings : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getNewLine?(): string; +>getNewLine : () => string + + getScriptFileNames(): string[]; +>getScriptFileNames : () => string[] + + getScriptVersion(fileName: string): string; +>getScriptVersion : (fileName: string) => string +>fileName : string + + getScriptSnapshot(fileName: string): IScriptSnapshot; +>getScriptSnapshot : (fileName: string) => IScriptSnapshot +>fileName : string +>IScriptSnapshot : IScriptSnapshot + + getLocalizedDiagnosticMessages?(): any; +>getLocalizedDiagnosticMessages : () => any + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + log?(s: string): void; +>log : (s: string) => void +>s : string + + trace?(s: string): void; +>trace : (s: string) => void +>s : string + + error?(s: string): void; +>error : (s: string) => void +>s : string + } + interface LanguageService { +>LanguageService : LanguageService + + cleanupSemanticCache(): void; +>cleanupSemanticCache : () => void + + getSyntacticDiagnostics(fileName: string): Diagnostic[]; +>getSyntacticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getSemanticDiagnostics(fileName: string): Diagnostic[]; +>getSemanticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getCompilerOptionsDiagnostics(): Diagnostic[]; +>getCompilerOptionsDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSyntacticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSemanticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; +>getCompletionsAtPosition : (fileName: string, position: number) => CompletionInfo +>fileName : string +>position : number +>CompletionInfo : CompletionInfo + + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; +>getCompletionEntryDetails : (fileName: string, position: number, entryName: string) => CompletionEntryDetails +>fileName : string +>position : number +>entryName : string +>CompletionEntryDetails : CompletionEntryDetails + + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; +>getQuickInfoAtPosition : (fileName: string, position: number) => QuickInfo +>fileName : string +>position : number +>QuickInfo : QuickInfo + + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; +>getNameOrDottedNameSpan : (fileName: string, startPos: number, endPos: number) => TextSpan +>fileName : string +>startPos : number +>endPos : number +>TextSpan : TextSpan + + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; +>getBreakpointStatementAtPosition : (fileName: string, position: number) => TextSpan +>fileName : string +>position : number +>TextSpan : TextSpan + + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; +>getSignatureHelpItems : (fileName: string, position: number) => SignatureHelpItems +>fileName : string +>position : number +>SignatureHelpItems : SignatureHelpItems + + getRenameInfo(fileName: string, position: number): RenameInfo; +>getRenameInfo : (fileName: string, position: number) => RenameInfo +>fileName : string +>position : number +>RenameInfo : RenameInfo + + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; +>findRenameLocations : (fileName: string, position: number, findInStrings: boolean, findInComments: boolean) => RenameLocation[] +>fileName : string +>position : number +>findInStrings : boolean +>findInComments : boolean +>RenameLocation : RenameLocation + + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; +>getDefinitionAtPosition : (fileName: string, position: number) => DefinitionInfo[] +>fileName : string +>position : number +>DefinitionInfo : DefinitionInfo + + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getReferencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getOccurrencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + findReferences(fileName: string, position: number): ReferencedSymbol[]; +>findReferences : (fileName: string, position: number) => ReferencedSymbol[] +>fileName : string +>position : number +>ReferencedSymbol : ReferencedSymbol + + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] +>searchValue : string +>maxResultCount : number +>NavigateToItem : NavigateToItem + + getNavigationBarItems(fileName: string): NavigationBarItem[]; +>getNavigationBarItems : (fileName: string) => NavigationBarItem[] +>fileName : string +>NavigationBarItem : NavigationBarItem + + getOutliningSpans(fileName: string): OutliningSpan[]; +>getOutliningSpans : (fileName: string) => OutliningSpan[] +>fileName : string +>OutliningSpan : OutliningSpan + + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; +>getTodoComments : (fileName: string, descriptors: TodoCommentDescriptor[]) => TodoComment[] +>fileName : string +>descriptors : TodoCommentDescriptor[] +>TodoCommentDescriptor : TodoCommentDescriptor +>TodoComment : TodoComment + + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; +>getBraceMatchingAtPosition : (fileName: string, position: number) => TextSpan[] +>fileName : string +>position : number +>TextSpan : TextSpan + + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; +>getIndentationAtPosition : (fileName: string, position: number, options: EditorOptions) => number +>fileName : string +>position : number +>options : EditorOptions +>EditorOptions : EditorOptions + + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForRange : (fileName: string, start: number, end: number, options: FormatCodeOptions) => TextChange[] +>fileName : string +>start : number +>end : number +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForDocument : (fileName: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsAfterKeystroke : (fileName: string, position: number, key: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>position : number +>key : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getEmitOutput(fileName: string): EmitOutput; +>getEmitOutput : (fileName: string) => EmitOutput +>fileName : string +>EmitOutput : EmitOutput + + getProgram(): Program; +>getProgram : () => Program +>Program : Program + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + dispose(): void; +>dispose : () => void + } + interface ClassifiedSpan { +>ClassifiedSpan : ClassifiedSpan + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + classificationType: string; +>classificationType : string + } + interface NavigationBarItem { +>NavigationBarItem : NavigationBarItem + + text: string; +>text : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + spans: TextSpan[]; +>spans : TextSpan[] +>TextSpan : TextSpan + + childItems: NavigationBarItem[]; +>childItems : NavigationBarItem[] +>NavigationBarItem : NavigationBarItem + + indent: number; +>indent : number + + bolded: boolean; +>bolded : boolean + + grayed: boolean; +>grayed : boolean + } + interface TodoCommentDescriptor { +>TodoCommentDescriptor : TodoCommentDescriptor + + text: string; +>text : string + + priority: number; +>priority : number + } + interface TodoComment { +>TodoComment : TodoComment + + descriptor: TodoCommentDescriptor; +>descriptor : TodoCommentDescriptor +>TodoCommentDescriptor : TodoCommentDescriptor + + message: string; +>message : string + + position: number; +>position : number + } + class TextChange { +>TextChange : TextChange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newText: string; +>newText : string + } + interface RenameLocation { +>RenameLocation : RenameLocation + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + } + interface ReferenceEntry { +>ReferenceEntry : ReferenceEntry + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + + isWriteAccess: boolean; +>isWriteAccess : boolean + } + interface NavigateToItem { +>NavigateToItem : NavigateToItem + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + matchKind: string; +>matchKind : string + + isCaseSensitive: boolean; +>isCaseSensitive : boolean + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + containerName: string; +>containerName : string + + containerKind: string; +>containerKind : string + } + interface EditorOptions { +>EditorOptions : EditorOptions + + IndentSize: number; +>IndentSize : number + + TabSize: number; +>TabSize : number + + NewLineCharacter: string; +>NewLineCharacter : string + + ConvertTabsToSpaces: boolean; +>ConvertTabsToSpaces : boolean + } + interface FormatCodeOptions extends EditorOptions { +>FormatCodeOptions : FormatCodeOptions +>EditorOptions : EditorOptions + + InsertSpaceAfterCommaDelimiter: boolean; +>InsertSpaceAfterCommaDelimiter : boolean + + InsertSpaceAfterSemicolonInForStatements: boolean; +>InsertSpaceAfterSemicolonInForStatements : boolean + + InsertSpaceBeforeAndAfterBinaryOperators: boolean; +>InsertSpaceBeforeAndAfterBinaryOperators : boolean + + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; +>InsertSpaceAfterKeywordsInControlFlowStatements : boolean + + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; +>InsertSpaceAfterFunctionKeywordForAnonymousFunctions : boolean + + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; +>InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis : boolean + + PlaceOpenBraceOnNewLineForFunctions: boolean; +>PlaceOpenBraceOnNewLineForFunctions : boolean + + PlaceOpenBraceOnNewLineForControlBlocks: boolean; +>PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string + } + interface DefinitionInfo { +>DefinitionInfo : DefinitionInfo + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + kind: string; +>kind : string + + name: string; +>name : string + + containerKind: string; +>containerKind : string + + containerName: string; +>containerName : string + } + interface ReferencedSymbol { +>ReferencedSymbol : ReferencedSymbol + + definition: DefinitionInfo; +>definition : DefinitionInfo +>DefinitionInfo : DefinitionInfo + + references: ReferenceEntry[]; +>references : ReferenceEntry[] +>ReferenceEntry : ReferenceEntry + } + enum SymbolDisplayPartKind { +>SymbolDisplayPartKind : SymbolDisplayPartKind + + aliasName = 0, +>aliasName : SymbolDisplayPartKind + + className = 1, +>className : SymbolDisplayPartKind + + enumName = 2, +>enumName : SymbolDisplayPartKind + + fieldName = 3, +>fieldName : SymbolDisplayPartKind + + interfaceName = 4, +>interfaceName : SymbolDisplayPartKind + + keyword = 5, +>keyword : SymbolDisplayPartKind + + lineBreak = 6, +>lineBreak : SymbolDisplayPartKind + + numericLiteral = 7, +>numericLiteral : SymbolDisplayPartKind + + stringLiteral = 8, +>stringLiteral : SymbolDisplayPartKind + + localName = 9, +>localName : SymbolDisplayPartKind + + methodName = 10, +>methodName : SymbolDisplayPartKind + + moduleName = 11, +>moduleName : SymbolDisplayPartKind + + operator = 12, +>operator : SymbolDisplayPartKind + + parameterName = 13, +>parameterName : SymbolDisplayPartKind + + propertyName = 14, +>propertyName : SymbolDisplayPartKind + + punctuation = 15, +>punctuation : SymbolDisplayPartKind + + space = 16, +>space : SymbolDisplayPartKind + + text = 17, +>text : SymbolDisplayPartKind + + typeParameterName = 18, +>typeParameterName : SymbolDisplayPartKind + + enumMemberName = 19, +>enumMemberName : SymbolDisplayPartKind + + functionName = 20, +>functionName : SymbolDisplayPartKind + + regularExpressionLiteral = 21, +>regularExpressionLiteral : SymbolDisplayPartKind + } + interface SymbolDisplayPart { +>SymbolDisplayPart : SymbolDisplayPart + + text: string; +>text : string + + kind: string; +>kind : string + } + interface QuickInfo { +>QuickInfo : QuickInfo + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface RenameInfo { +>RenameInfo : RenameInfo + + canRename: boolean; +>canRename : boolean + + localizedErrorMessage: string; +>localizedErrorMessage : string + + displayName: string; +>displayName : string + + fullDisplayName: string; +>fullDisplayName : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + triggerSpan: TextSpan; +>triggerSpan : TextSpan +>TextSpan : TextSpan + } + interface SignatureHelpParameter { +>SignatureHelpParameter : SignatureHelpParameter + + name: string; +>name : string + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + isOptional: boolean; +>isOptional : boolean + } + /** + * Represents a single signature to show in signature help. + * The id is used for subsequent calls into the language service to ask questions about the + * signature help item in the context of any documents that have been updated. i.e. after + * an edit has happened, while signature help is still active, the host can ask important + * questions like 'what parameter is the user currently contained within?'. + */ + interface SignatureHelpItem { +>SignatureHelpItem : SignatureHelpItem + + isVariadic: boolean; +>isVariadic : boolean + + prefixDisplayParts: SymbolDisplayPart[]; +>prefixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + suffixDisplayParts: SymbolDisplayPart[]; +>suffixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + separatorDisplayParts: SymbolDisplayPart[]; +>separatorDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + parameters: SignatureHelpParameter[]; +>parameters : SignatureHelpParameter[] +>SignatureHelpParameter : SignatureHelpParameter + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + /** + * Represents a set of signature help items, and the preferred item that should be selected. + */ + interface SignatureHelpItems { +>SignatureHelpItems : SignatureHelpItems + + items: SignatureHelpItem[]; +>items : SignatureHelpItem[] +>SignatureHelpItem : SignatureHelpItem + + applicableSpan: TextSpan; +>applicableSpan : TextSpan +>TextSpan : TextSpan + + selectedItemIndex: number; +>selectedItemIndex : number + + argumentIndex: number; +>argumentIndex : number + + argumentCount: number; +>argumentCount : number + } + interface CompletionInfo { +>CompletionInfo : CompletionInfo + + isMemberCompletion: boolean; +>isMemberCompletion : boolean + + isNewIdentifierLocation: boolean; +>isNewIdentifierLocation : boolean + + entries: CompletionEntry[]; +>entries : CompletionEntry[] +>CompletionEntry : CompletionEntry + } + interface CompletionEntry { +>CompletionEntry : CompletionEntry + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + } + interface CompletionEntryDetails { +>CompletionEntryDetails : CompletionEntryDetails + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface OutliningSpan { +>OutliningSpan : OutliningSpan + + /** The span of the document to actually collapse. */ + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + /** The span of the document to display when the user hovers over the collapsed span. */ + hintSpan: TextSpan; +>hintSpan : TextSpan +>TextSpan : TextSpan + + /** The text to display in the editor for the collapsed region. */ + bannerText: string; +>bannerText : string + + /** + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ + autoCollapse: boolean; +>autoCollapse : boolean + } + interface EmitOutput { +>EmitOutput : EmitOutput + + outputFiles: OutputFile[]; +>outputFiles : OutputFile[] +>OutputFile : OutputFile + + emitSkipped: boolean; +>emitSkipped : boolean + } + const enum OutputFileType { +>OutputFileType : OutputFileType + + JavaScript = 0, +>JavaScript : OutputFileType + + SourceMap = 1, +>SourceMap : OutputFileType + + Declaration = 2, +>Declaration : OutputFileType + } + interface OutputFile { +>OutputFile : OutputFile + + name: string; +>name : string + + writeByteOrderMark: boolean; +>writeByteOrderMark : boolean + + text: string; +>text : string + } + const enum EndOfLineState { +>EndOfLineState : EndOfLineState + + Start = 0, +>Start : EndOfLineState + + InMultiLineCommentTrivia = 1, +>InMultiLineCommentTrivia : EndOfLineState + + InSingleQuoteStringLiteral = 2, +>InSingleQuoteStringLiteral : EndOfLineState + + InDoubleQuoteStringLiteral = 3, +>InDoubleQuoteStringLiteral : EndOfLineState + + InTemplateHeadOrNoSubstitutionTemplate = 4, +>InTemplateHeadOrNoSubstitutionTemplate : EndOfLineState + + InTemplateMiddleOrTail = 5, +>InTemplateMiddleOrTail : EndOfLineState + + InTemplateSubstitutionPosition = 6, +>InTemplateSubstitutionPosition : EndOfLineState + } + enum TokenClass { +>TokenClass : TokenClass + + Punctuation = 0, +>Punctuation : TokenClass + + Keyword = 1, +>Keyword : TokenClass + + Operator = 2, +>Operator : TokenClass + + Comment = 3, +>Comment : TokenClass + + Whitespace = 4, +>Whitespace : TokenClass + + Identifier = 5, +>Identifier : TokenClass + + NumberLiteral = 6, +>NumberLiteral : TokenClass + + StringLiteral = 7, +>StringLiteral : TokenClass + + RegExpLiteral = 8, +>RegExpLiteral : TokenClass + } + interface ClassificationResult { +>ClassificationResult : ClassificationResult + + finalLexState: EndOfLineState; +>finalLexState : EndOfLineState +>EndOfLineState : EndOfLineState + + entries: ClassificationInfo[]; +>entries : ClassificationInfo[] +>ClassificationInfo : ClassificationInfo + } + interface ClassificationInfo { +>ClassificationInfo : ClassificationInfo + + length: number; +>length : number + + classification: TokenClass; +>classification : TokenClass +>TokenClass : TokenClass + } + interface Classifier { +>Classifier : Classifier + + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; +>getClassificationsForLine : (text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean) => ClassificationResult +>text : string +>lexState : EndOfLineState +>EndOfLineState : EndOfLineState +>syntacticClassifierAbsent : boolean +>ClassificationResult : ClassificationResult + } + /** + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ + interface DocumentRegistry { +>DocumentRegistry : DocumentRegistry + + /** + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>acquireDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>SourceFile : SourceFile + + /** + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. + */ + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>updateDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>SourceFile : SourceFile + + /** + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; +>releaseDocument : (fileName: string, compilationSettings: CompilerOptions) => void +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions + } + class ScriptElementKind { +>ScriptElementKind : ScriptElementKind + + static unknown: string; +>unknown : string + + static keyword: string; +>keyword : string + + static scriptElement: string; +>scriptElement : string + + static moduleElement: string; +>moduleElement : string + + static classElement: string; +>classElement : string + + static interfaceElement: string; +>interfaceElement : string + + static typeElement: string; +>typeElement : string + + static enumElement: string; +>enumElement : string + + static variableElement: string; +>variableElement : string + + static localVariableElement: string; +>localVariableElement : string + + static functionElement: string; +>functionElement : string + + static localFunctionElement: string; +>localFunctionElement : string + + static memberFunctionElement: string; +>memberFunctionElement : string + + static memberGetAccessorElement: string; +>memberGetAccessorElement : string + + static memberSetAccessorElement: string; +>memberSetAccessorElement : string + + static memberVariableElement: string; +>memberVariableElement : string + + static constructorImplementationElement: string; +>constructorImplementationElement : string + + static callSignatureElement: string; +>callSignatureElement : string + + static indexSignatureElement: string; +>indexSignatureElement : string + + static constructSignatureElement: string; +>constructSignatureElement : string + + static parameterElement: string; +>parameterElement : string + + static typeParameterElement: string; +>typeParameterElement : string + + static primitiveType: string; +>primitiveType : string + + static label: string; +>label : string + + static alias: string; +>alias : string + + static constElement: string; +>constElement : string + + static letElement: string; +>letElement : string + } + class ScriptElementKindModifier { +>ScriptElementKindModifier : ScriptElementKindModifier + + static none: string; +>none : string + + static publicMemberModifier: string; +>publicMemberModifier : string + + static privateMemberModifier: string; +>privateMemberModifier : string + + static protectedMemberModifier: string; +>protectedMemberModifier : string + + static exportedModifier: string; +>exportedModifier : string + + static ambientModifier: string; +>ambientModifier : string + + static staticModifier: string; +>staticModifier : string + } + class ClassificationTypeNames { +>ClassificationTypeNames : ClassificationTypeNames + + static comment: string; +>comment : string + + static identifier: string; +>identifier : string + + static keyword: string; +>keyword : string + + static numericLiteral: string; +>numericLiteral : string + + static operator: string; +>operator : string + + static stringLiteral: string; +>stringLiteral : string + + static whiteSpace: string; +>whiteSpace : string + + static text: string; +>text : string + + static punctuation: string; +>punctuation : string + + static className: string; +>className : string + + static enumName: string; +>enumName : string + + static interfaceName: string; +>interfaceName : string + + static moduleName: string; +>moduleName : string + + static typeParameterName: string; +>typeParameterName : string + + static typeAlias: string; +>typeAlias : string + } + interface DisplayPartsSymbolWriter extends SymbolWriter { +>DisplayPartsSymbolWriter : DisplayPartsSymbolWriter +>SymbolWriter : SymbolWriter + + displayParts(): SymbolDisplayPart[]; +>displayParts : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; +>displayPartsToString : (displayParts: SymbolDisplayPart[]) => string +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + function getDefaultCompilerOptions(): CompilerOptions; +>getDefaultCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + class OperationCanceledException { +>OperationCanceledException : OperationCanceledException + } + class CancellationTokenObject { +>CancellationTokenObject : CancellationTokenObject + + private cancellationToken; +>cancellationToken : any + + static None: CancellationTokenObject; +>None : CancellationTokenObject +>CancellationTokenObject : CancellationTokenObject + + constructor(cancellationToken: CancellationToken); +>cancellationToken : CancellationToken +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + + throwIfCancellationRequested(): void; +>throwIfCancellationRequested : () => void + } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; +>transpile : (input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]) => string +>input : string +>compilerOptions : CompilerOptions +>CompilerOptions : CompilerOptions +>fileName : string +>diagnostics : Diagnostic[] +>Diagnostic : Diagnostic + + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; +>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile +>fileName : string +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>scriptTarget : ScriptTarget +>ScriptTarget : ScriptTarget +>version : string +>setNodeParents : boolean +>SourceFile : SourceFile + + let disableIncrementalParsing: boolean; +>disableIncrementalParsing : boolean + + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; +>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>aggressiveChecks : boolean +>SourceFile : SourceFile + + function createDocumentRegistry(): DocumentRegistry; +>createDocumentRegistry : () => DocumentRegistry +>DocumentRegistry : DocumentRegistry + + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; +>preProcessFile : (sourceText: string, readImportFiles?: boolean) => PreProcessedFileInfo +>sourceText : string +>readImportFiles : boolean +>PreProcessedFileInfo : PreProcessedFileInfo + + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; +>createLanguageService : (host: LanguageServiceHost, documentRegistry?: DocumentRegistry) => LanguageService +>host : LanguageServiceHost +>LanguageServiceHost : LanguageServiceHost +>documentRegistry : DocumentRegistry +>DocumentRegistry : DocumentRegistry +>LanguageService : LanguageService + + function createClassifier(): Classifier; +>createClassifier : () => Classifier +>Classifier : Classifier + + /** + * Get the path of the default library file (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ + function getDefaultLibFilePath(options: CompilerOptions): string; +>getDefaultLibFilePath : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions +} + From 93ff9e69d71595cfddc069caf3d4eee9e8c7c7e3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 16:03:08 -0700 Subject: [PATCH 37/61] CR feedback. --- src/compiler/checker.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c8cbd3ef740..991824f0250 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -787,7 +787,7 @@ module ts { // Resolves a qualified name and any involved aliases function resolveEntityName(name: EntityName | Expression, meaning: SymbolFlags): Symbol { - if (getFullWidth(name) === 0) { + if (nodeIsMissing(name)) { return undefined; } @@ -803,7 +803,7 @@ module ts { let right = name.kind === SyntaxKind.QualifiedName ? (name).right : (name).name; let namespace = resolveEntityName(left, SymbolFlags.Namespace); - if (!namespace || namespace === unknownSymbol || getFullWidth(right) === 0) { + if (!namespace || namespace === unknownSymbol || nodeIsMissing(right)) { return undefined; } symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); @@ -4986,7 +4986,7 @@ module ts { function getResolvedSymbol(node: Identifier): Symbol { let links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (getFullWidth(node) > 0 && resolveName(node, node.text, SymbolFlags.Value | SymbolFlags.ExportValue, Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = (!nodeIsMissing(node) && resolveName(node, node.text, SymbolFlags.Value | SymbolFlags.ExportValue, Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; } return links.resolvedSymbol; } @@ -6484,7 +6484,7 @@ module ts { let templateExpression = tagExpression.template; let lastSpan = lastOrUndefined(templateExpression.templateSpans); Debug.assert(lastSpan !== undefined); // we should always have at least one span. - callIsIncomplete = getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + callIsIncomplete = nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } else { // If the template didn't end in a backtick, or its beginning occurred right prior to EOF, @@ -8477,7 +8477,7 @@ module ts { let isConstructor = (symbol.flags & SymbolFlags.Constructor) !== 0; function reportImplementationExpectedError(node: FunctionLikeDeclaration): void { - if (node.name && getFullWidth(node.name) === 0) { + if (node.name && nodeIsMissing(node.name)) { return; } @@ -10330,7 +10330,7 @@ module ts { function checkExternalImportOrExportDeclaration(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean { let moduleName = getExternalModuleName(node); - if (getFullWidth(moduleName) !== 0 && moduleName.kind !== SyntaxKind.StringLiteral) { + if (!nodeIsMissing(moduleName) && moduleName.kind !== SyntaxKind.StringLiteral) { error(moduleName, Diagnostics.String_literal_expected); return false; } @@ -11077,7 +11077,7 @@ module ts { return resolveEntityName(entityName, meaning); } else if (isExpression(entityName)) { - if (getFullWidth(entityName) === 0) { + if (nodeIsMissing(entityName)) { // Missing entity name. return undefined; } From ee3ba3bf753d230c32255530a4cc460c22b468c8 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 17:23:52 -0700 Subject: [PATCH 38/61] CR feedback. --- src/compiler/checker.ts | 104 ++++++++++-------- src/compiler/declarationEmitter.ts | 4 +- .../diagnosticInformationMap.generated.ts | 6 +- src/compiler/diagnosticMessages.json | 6 +- src/compiler/emitter.ts | 4 +- src/compiler/utilities.ts | 4 +- src/services/services.ts | 4 +- .../classExtendingPrimitive.errors.txt | 4 +- .../classExtendingPrimitive2.errors.txt | 4 +- .../classExtendsEveryObjectType.errors.txt | 8 +- .../classExtendsEveryObjectType2.errors.txt | 8 +- ...terfaceMayNotBeExtendedWitACall.errors.txt | 4 +- .../thisInInvalidContexts.errors.txt | 4 +- ...InInvalidContextsExternalModule.errors.txt | 4 +- .../completionListInExtendsClause.ts | 1 - ...etOccurrencesPropertyInAliasedInterface.ts | 1 - .../fourslash/semanticClassification1.ts | 1 - 17 files changed, 92 insertions(+), 79 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 991824f0250..fe93ffb5828 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -589,7 +589,7 @@ module ts { if (moduleSymbol.flags & SymbolFlags.Variable) { let typeAnnotation = (moduleSymbol.valueDeclaration).type; if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(typeAnnotation), name); + return getPropertyOfType(getTypeFromNode(typeAnnotation), name); } } } @@ -638,7 +638,7 @@ module ts { if (symbol.flags & SymbolFlags.Variable) { var typeAnnotation = (symbol.valueDeclaration).type; if (typeAnnotation) { - return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(typeAnnotation), name)); + return resolveSymbol(getPropertyOfType(getTypeFromNode(typeAnnotation), name)); } } } @@ -2106,7 +2106,7 @@ module ts { } // Use type from type annotation if one is present if (declaration.type) { - return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type); + return getTypeFromNode(declaration.type); } if (declaration.kind === SyntaxKind.Parameter) { let func = declaration.parent; @@ -2243,7 +2243,7 @@ module ts { return links.type = checkExpression(exportAssignment.expression); } else if (exportAssignment.type) { - return links.type = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(exportAssignment.type); + return links.type = getTypeFromNode(exportAssignment.type); } else { return links.type = anyType; @@ -2275,11 +2275,11 @@ module ts { function getAnnotatedAccessorType(accessor: AccessorDeclaration): Type { if (accessor) { if (accessor.kind === SyntaxKind.GetAccessor) { - return accessor.type && getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(accessor.type); + return accessor.type && getTypeFromNode(accessor.type); } else { let setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(setterTypeAnnotation); + return setterTypeAnnotation && getTypeFromNode(setterTypeAnnotation); } } return undefined; @@ -2445,9 +2445,9 @@ module ts { } type.baseTypes = []; let declaration = getDeclarationOfKind(symbol, SyntaxKind.ClassDeclaration); - let baseTypeNode = getClassBaseTypeNode(declaration); + let baseTypeNode = getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - let baseType = getTypeFromTypeReferenceOrHeritageClauseElement(baseTypeNode); + let baseType = getTypeFromHeritageClauseElement(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & TypeFlags.Class) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -2488,7 +2488,7 @@ module ts { forEach(symbol.declarations, declaration => { if (declaration.kind === SyntaxKind.InterfaceDeclaration && getInterfaceBaseTypeNodes(declaration)) { forEach(getInterfaceBaseTypeNodes(declaration), node => { - let baseType = getTypeFromTypeReferenceOrHeritageClauseElement(node); + let baseType = getTypeFromHeritageClauseElement(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (TypeFlags.Class | TypeFlags.Interface)) { @@ -2520,7 +2520,7 @@ module ts { if (!links.declaredType) { links.declaredType = resolvingType; let declaration = getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration); - let type = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type); + let type = getTypeFromNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } @@ -3062,7 +3062,7 @@ module ts { returnType = classType; } else if (declaration.type) { - returnType = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type); + returnType = getTypeFromNode(declaration.type); } else { // TypeScript 1.0 spec (April 2014): @@ -3220,7 +3220,7 @@ module ts { function getIndexTypeOfSymbol(symbol: Symbol, kind: IndexKind): Type { let declaration = getIndexDeclarationOfSymbol(symbol, kind); return declaration - ? declaration.type ? getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type) : anyType + ? declaration.type ? getTypeFromNode(declaration.type) : anyType : undefined; } @@ -3231,7 +3231,7 @@ module ts { type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement((getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint); + type.constraint = getTypeFromNode((getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -3328,6 +3328,14 @@ module ts { } } + function getTypeFromTypeReference(node: TypeReferenceNode): Type { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + + function getTypeFromHeritageClauseElement(node: HeritageClauseElement): Type { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement): Type { let links = getNodeLinks(node); if (!links.resolvedType) { @@ -3354,7 +3362,7 @@ module ts { if (type.flags & (TypeFlags.Class | TypeFlags.Interface) && type.flags & TypeFlags.Reference) { let typeParameters = (type).typeParameters; if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, map(node.typeArguments, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement)); + type = createTypeReference(type, map(node.typeArguments, getTypeFromNode)); } else { error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), typeParameters.length); @@ -3448,7 +3456,7 @@ module ts { function getTypeFromArrayTypeNode(node: ArrayTypeNode): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createArrayType(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.elementType)); + links.resolvedType = createArrayType(getTypeFromNode(node.elementType)); } return links.resolvedType; } @@ -3466,7 +3474,7 @@ module ts { function getTypeFromTupleTypeNode(node: TupleTypeNode): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement)); + links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromNode)); } return links.resolvedType; } @@ -3562,7 +3570,7 @@ module ts { function getTypeFromUnionTypeNode(node: UnionTypeNode): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement), /*noSubtypeReduction*/ true); + links.resolvedType = getUnionType(map(node.types, getTypeFromNode), /*noSubtypeReduction*/ true); } return links.resolvedType; } @@ -3594,7 +3602,7 @@ module ts { return links.resolvedType; } - function getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node: TypeNode | LiteralExpression | HeritageClauseElement): Type { + function getTypeFromNode(node: TypeNode | LiteralExpression | HeritageClauseElement): Type { switch (node.kind) { case SyntaxKind.AnyKeyword: return anyType; @@ -3611,9 +3619,9 @@ module ts { case SyntaxKind.StringLiteral: return getTypeFromStringLiteral(node); case SyntaxKind.TypeReference: - return getTypeFromTypeReferenceOrHeritageClauseElement(node); + return getTypeFromTypeReference(node); case SyntaxKind.HeritageClauseElement: - return getTypeFromTypeReferenceOrHeritageClauseElement(node); + return getTypeFromHeritageClauseElement(node); case SyntaxKind.TypeQuery: return getTypeFromTypeQueryNode(node); case SyntaxKind.ArrayType: @@ -3623,7 +3631,7 @@ module ts { case SyntaxKind.UnionType: return getTypeFromUnionTypeNode(node); case SyntaxKind.ParenthesizedType: - return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement((node).type); + return getTypeFromNode((node).type); case SyntaxKind.FunctionType: case SyntaxKind.ConstructorType: case SyntaxKind.TypeLiteral: @@ -5492,7 +5500,7 @@ module ts { let isCallExpression = node.parent.kind === SyntaxKind.CallExpression && (node.parent).expression === node; let enclosingClass = getAncestor(node, SyntaxKind.ClassDeclaration); let baseClass: Type; - if (enclosingClass && getClassBaseTypeNode(enclosingClass)) { + if (enclosingClass && getClassExtendsHeritageClauseElement(enclosingClass)) { let classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); baseClass = classType.baseTypes.length && classType.baseTypes[0]; } @@ -5624,7 +5632,7 @@ module ts { let declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { - return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type); + return getTypeFromNode(declaration.type); } if (declaration.kind === SyntaxKind.Parameter) { let type = getContextuallyTypedParameterType(declaration); @@ -5827,7 +5835,7 @@ module ts { case SyntaxKind.NewExpression: return getContextualTypeForArgument(parent, node); case SyntaxKind.TypeAssertionExpression: - return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement((parent).type); + return getTypeFromNode((parent).type); case SyntaxKind.BinaryExpression: return getContextualTypeForBinaryOperand(node); case SyntaxKind.PropertyAssignment: @@ -6628,7 +6636,7 @@ module ts { let typeArgumentsAreAssignable = true; for (let i = 0; i < typeParameters.length; i++) { let typeArgNode = typeArguments[i]; - let typeArgument = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(typeArgNode); + let typeArgument = getTypeFromNode(typeArgNode); // Do not push on this array! It has a preallocated length typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable /* so far */) { @@ -6702,7 +6710,7 @@ module ts { function getEffectiveTypeArguments(callExpression: CallExpression): TypeNode[] { if (callExpression.expression.kind === SyntaxKind.SuperKeyword) { let containingClass = getAncestor(callExpression, SyntaxKind.ClassDeclaration); - let baseClassTypeNode = containingClass && getClassBaseTypeNode(containingClass); + let baseClassTypeNode = containingClass && getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } else { @@ -7110,7 +7118,7 @@ module ts { function checkTypeAssertion(node: TypeAssertion): Type { let exprType = checkExpression(node.expression); - let targetType = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type); + let targetType = getTypeFromNode(node.type); if (produceDiagnostics && targetType !== unknownType) { let widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { @@ -7289,7 +7297,7 @@ module ts { function checkFunctionExpressionOrObjectLiteralMethodBody(node: FunctionExpression | MethodDeclaration) { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); if (node.type) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromNode(node.type)); } if (node.body) { @@ -7299,7 +7307,7 @@ module ts { else { let exprType = checkExpression(node.body); if (node.type) { - checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type), node.body, /*headMessage*/ undefined); + checkTypeAssignableTo(exprType, getTypeFromNode(node.type), node.body, /*headMessage*/ undefined); } checkFunctionExpressionBodies(node.body); } @@ -8234,7 +8242,7 @@ module ts { // TS 1.0 spec (April 2014): 8.3.2 // Constructors of classes with no extends clause may not contain super calls, whereas // constructors of derived classes must contain at least one super call somewhere in their function body. - if (getClassBaseTypeNode(node.parent)) { + if (getClassExtendsHeritageClauseElement(node.parent)) { if (containsSuperCall(node.body)) { // The first statement in the body of a constructor must be a super call if both of the following are true: @@ -8305,6 +8313,14 @@ module ts { checkDecorators(node); } + function checkTypeReferenceNode(node: TypeReferenceNode) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + + function checkHeritageClauseElement(node: HeritageClauseElement) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement) { // Grammar checking checkGrammarTypeArguments(node, node.typeArguments); @@ -8800,7 +8816,7 @@ module ts { checkSourceElement(node.body); if (node.type && !isAccessor(node.kind)) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromNode(node.type)); } // Report an implicit any error if there is no body, no explicit return type, and node is not a private method @@ -8900,7 +8916,7 @@ module ts { return; } - if (getClassBaseTypeNode(enclosingClass)) { + if (getClassExtendsHeritageClauseElement(enclosingClass)) { let isDeclaration = node.kind !== SyntaxKind.Identifier; if (isDeclaration) { error(node, Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); @@ -9772,14 +9788,14 @@ module ts { let symbol = getSymbolOfNode(node); let type = getDeclaredTypeOfSymbol(symbol); let staticType = getTypeOfSymbol(symbol); - let baseTypeNode = getClassBaseTypeNode(node); + let baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { if (!isSupportedHeritageClauseElement(baseTypeNode)) { - error(baseTypeNode.expression, Diagnostics.Only_type_references_are_currently_supported_in_a_class_extends_clauses); + error(baseTypeNode.expression, Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); } emitExtends = emitExtends || !isInAmbientContext(node); - checkTypeReferenceOrHeritageClauseElement(baseTypeNode); + checkHeritageClauseElement(baseTypeNode); } if (type.baseTypes.length) { if (produceDiagnostics) { @@ -9802,16 +9818,16 @@ module ts { checkExpressionOrQualifiedName(baseTypeNode.expression); } - let implementedTypeNodes = getClassImplementedTypeNodes(node); + let implementedTypeNodes = getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { forEach(implementedTypeNodes, typeRefNode => { if (!isSupportedHeritageClauseElement(typeRefNode)) { - error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_type_references); + error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } - checkTypeReferenceOrHeritageClauseElement(typeRefNode); + checkHeritageClauseElement(typeRefNode); if (produceDiagnostics) { - let t = getTypeFromTypeReferenceOrHeritageClauseElement(typeRefNode); + let t = getTypeFromHeritageClauseElement(typeRefNode); if (t !== unknownType) { let declaredType = (t.flags & TypeFlags.Reference) ? (t).target : t; if (declaredType.flags & (TypeFlags.Class | TypeFlags.Interface)) { @@ -9933,7 +9949,7 @@ module ts { if (!tp1.constraint || !tp2.constraint) { return false; } - if (!isTypeIdenticalTo(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(tp2.constraint))) { + if (!isTypeIdenticalTo(getTypeFromNode(tp1.constraint), getTypeFromNode(tp2.constraint))) { return false; } } @@ -10006,10 +10022,10 @@ module ts { } forEach(getInterfaceBaseTypeNodes(node), heritageElement => { if (!isSupportedHeritageClauseElement(heritageElement)) { - error(heritageElement.expression, Diagnostics.An_interface_can_only_extend_a_type_reference); + error(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); } - checkTypeReferenceOrHeritageClauseElement(heritageElement); + checkHeritageClauseElement(heritageElement); }); forEach(node.members, checkSourceElement); @@ -10551,7 +10567,7 @@ module ts { case SyntaxKind.SetAccessor: return checkAccessorDeclaration(node); case SyntaxKind.TypeReference: - return checkTypeReferenceOrHeritageClauseElement(node); + return checkTypeReferenceNode(node); case SyntaxKind.TypeQuery: return checkTypeQuery(node); case SyntaxKind.TypeLiteral: @@ -11193,7 +11209,7 @@ module ts { } if (isTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node)) { - return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node); + return getTypeFromNode(node); } if (isExpression(node)) { diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 7e089cbafee..7d41a72435f 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -892,11 +892,11 @@ module ts { let prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - let baseTypeNode = getClassBaseTypeNode(node); + let baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { emitHeritageClause([baseTypeNode], /*isImplementsList*/ false); } - emitHeritageClause(getClassImplementedTypeNodes(node), /*isImplementsList*/ true); + emitHeritageClause(getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true); write(" {"); writeLine(); increaseIndent(); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 344f289c18e..3e9017786e5 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -353,8 +353,8 @@ module ts { The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, - An_interface_can_only_extend_a_type_reference: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend a type reference." }, - A_class_can_only_implement_type_references: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement type references." }, + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -507,7 +507,7 @@ module ts { You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." }, yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, - Only_type_references_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only type references are currently supported in a class 'extends' clauses." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." }, class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." }, }; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f1f578da416..f6edb3150b6 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1403,11 +1403,11 @@ "category": "Error", "code": 2498 }, - "An interface can only extend a type reference.": { + "An interface can only extend an identifier/qualified-name with optional type arguments.": { "category": "Error", "code": 2499 }, - "A class can only implement type references.": { + "A class can only implement an identifier/qualified-name with optional type arguments.": { "category": "Error", "code": 2500 }, @@ -2021,7 +2021,7 @@ "category": "Error", "code": 9001 }, - "Only type references are currently supported in a class 'extends' clauses.": { + "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": { "category": "Error", "code": 9002 }, diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 1b0d769298b..6ec4ea23898 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3547,7 +3547,7 @@ module ts { emitDeclarationName(node); } - var baseTypeNode = getClassBaseTypeNode(node); + var baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write(" extends "); emit(baseTypeNode.expression); @@ -3621,7 +3621,7 @@ module ts { } write("(function ("); - let baseTypeNode = getClassBaseTypeNode(node); + let baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write("_super"); } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 2f4f29c5084..a30462594b6 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -951,12 +951,12 @@ module ts { node.kind === SyntaxKind.ExportAssignment && (node).expression.kind === SyntaxKind.Identifier; } - export function getClassBaseTypeNode(node: ClassLikeDeclaration) { + export function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration) { let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } - export function getClassImplementedTypeNodes(node: ClassDeclaration) { + export function getClassImplementsHeritageClauseElements(node: ClassDeclaration) { let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ImplementsKeyword); return heritageClause ? heritageClause.types : undefined; } diff --git a/src/services/services.ts b/src/services/services.ts index d865cdf9f8e..55ebc30bfe5 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -4948,8 +4948,8 @@ module ts { if (symbol && symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { forEach(symbol.getDeclarations(), declaration => { if (declaration.kind === SyntaxKind.ClassDeclaration) { - getPropertySymbolFromTypeReference(getClassBaseTypeNode(declaration)); - forEach(getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); + getPropertySymbolFromTypeReference(getClassExtendsHeritageClauseElement(declaration)); + forEach(getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } else if (declaration.kind === SyntaxKind.InterfaceDeclaration) { forEach(getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); diff --git a/tests/baselines/reference/classExtendingPrimitive.errors.txt b/tests/baselines/reference/classExtendingPrimitive.errors.txt index 4324884ba86..ae039640e99 100644 --- a/tests/baselines/reference/classExtendingPrimitive.errors.txt +++ b/tests/baselines/reference/classExtendingPrimitive.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(6,18): error TS2304: Cannot find name 'Void'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(7,19): error TS1109: Expression expected. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(8,18): error TS2304: Cannot find name 'Null'. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS9002: Only type references are currently supported in a class 'extends' clauses. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(10,18): error TS2304: Cannot find name 'undefined'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(11,18): error TS2304: Cannot find name 'Undefined'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(14,18): error TS2311: A class may only extend another class. @@ -33,7 +33,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla !!! error TS2304: Cannot find name 'Null'. class C5a extends null { } ~~~~ -!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. +!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. class C6 extends undefined { } ~~~~~~~~~ !!! error TS2304: Cannot find name 'undefined'. diff --git a/tests/baselines/reference/classExtendingPrimitive2.errors.txt b/tests/baselines/reference/classExtendingPrimitive2.errors.txt index c63307ae72c..3bba9b9e041 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.errors.txt +++ b/tests/baselines/reference/classExtendingPrimitive2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(3,19): error TS1109: Expression expected. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,19): error TS9002: Only type references are currently supported in a class 'extends' clauses. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,19): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts (2 errors) ==== @@ -10,4 +10,4 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla !!! error TS1109: Expression expected. class C5a extends null { } ~~~~ -!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. \ No newline at end of file +!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsEveryObjectType.errors.txt b/tests/baselines/reference/classExtendsEveryObjectType.errors.txt index f8c9e003244..75eced53139 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.errors.txt +++ b/tests/baselines/reference/classExtendsEveryObjectType.errors.txt @@ -1,10 +1,10 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(4,17): error TS2311: A class may only extend another class. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(6,18): error TS9002: Only type references are currently supported in a class 'extends' clauses. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(6,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(6,31): error TS1005: ',' expected. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(8,18): error TS2304: Cannot find name 'x'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(11,18): error TS2304: Cannot find name 'M'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(14,18): error TS2304: Cannot find name 'foo'. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS9002: Only type references are currently supported in a class 'extends' clauses. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts (7 errors) ==== @@ -17,7 +17,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla class C2 extends { foo: string; } { } // error ~~~~~~~~~~~~~~~~ -!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. +!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. ~ !!! error TS1005: ',' expected. var x: { foo: string; } @@ -37,4 +37,4 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla class C6 extends []{ } // error ~~ -!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. \ No newline at end of file +!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt b/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt index f191644d5d5..45a63030d00 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt +++ b/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt @@ -1,15 +1,15 @@ -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(1,18): error TS9002: Only type references are currently supported in a class 'extends' clauses. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(1,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(1,31): error TS1005: ',' expected. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,18): error TS9002: Only type references are currently supported in a class 'extends' clauses. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts (3 errors) ==== class C2 extends { foo: string; } { } // error ~~~~~~~~~~~~~~~~ -!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. +!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. ~ !!! error TS1005: ',' expected. class C6 extends []{ } // error ~~ -!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. \ No newline at end of file +!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt b/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt index f00c6923e89..f6ec9e02bbf 100644 --- a/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt +++ b/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts(3,24): error TS2499: An interface can only extend a type reference. +tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts(3,24): error TS2499: An interface can only extend an identifier/qualified-name with optional type arguments. ==== tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts(3,24): error TS2499: A interface blue extends color() { // error ~~~~~~~ -!!! error TS2499: An interface can only extend a type reference. +!!! error TS2499: An interface can only extend an identifier/qualified-name with optional type arguments. } \ No newline at end of file diff --git a/tests/baselines/reference/thisInInvalidContexts.errors.txt b/tests/baselines/reference/thisInInvalidContexts.errors.txt index a04b42074d5..481c4747c99 100644 --- a/tests/baselines/reference/thisInInvalidContexts.errors.txt +++ b/tests/baselines/reference/thisInInvalidContexts.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(22,15): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(28,13): error TS2331: 'this' cannot be referenced in a module body. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(38,25): error TS9002: Only type references are currently supported in a class 'extends' clauses. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(38,25): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(44,9): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9): error TS2332: 'this' cannot be referenced in current location. @@ -52,7 +52,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9): class ErrClass3 extends this { ~~~~ -!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. +!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. } diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt index 90264376a82..a8bf99de27b 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(22,15): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(28,13): error TS2331: 'this' cannot be referenced in a module body. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,25): error TS9002: Only type references are currently supported in a class 'extends' clauses. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,25): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(44,9): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(45,9): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(48,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. @@ -53,7 +53,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod class ErrClass3 extends this { ~~~~ -!!! error TS9002: Only type references are currently supported in a class 'extends' clauses. +!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses. } diff --git a/tests/cases/fourslash/completionListInExtendsClause.ts b/tests/cases/fourslash/completionListInExtendsClause.ts index 87cd2ddec09..b765f77d5d0 100644 --- a/tests/cases/fourslash/completionListInExtendsClause.ts +++ b/tests/cases/fourslash/completionListInExtendsClause.ts @@ -17,7 +17,6 @@ ////interface test3 extends IFoo./*3*/ {} ////interface test4 implements Foo./*4*/ {} -debugger; goTo.marker("1"); verify.not.completionListIsEmpty(); diff --git a/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts b/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts index 2bfa9e265fa..87ec260601b 100644 --- a/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts +++ b/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts @@ -19,7 +19,6 @@ test.ranges().forEach(r => { goTo.position(r.start); test.ranges().forEach(range => { - debugger; verify.occurrencesAtPositionContains(range); }); verify.occurrencesAtPositionCount(test.ranges().length); diff --git a/tests/cases/fourslash/semanticClassification1.ts b/tests/cases/fourslash/semanticClassification1.ts index eb04aca9d7b..4eb7f2a32ed 100644 --- a/tests/cases/fourslash/semanticClassification1.ts +++ b/tests/cases/fourslash/semanticClassification1.ts @@ -7,7 +7,6 @@ //// interface /*2*/X extends /*3*/M./*4*/I { } var c = classification; -debugger; verify.semanticClassificationsAre( c.moduleName("M", test.marker("0").position), c.interfaceName("I", test.marker("1").position), From 4bf91fd4ce6ef06265ae1702df2ac4d6d69ea5f8 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 17:30:48 -0700 Subject: [PATCH 39/61] Wire stress tests --- tests/cases/unittests/versionCache.ts | 235 +++++++++----------------- 1 file changed, 81 insertions(+), 154 deletions(-) diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts index f0848828ac5..5d10ed5006a 100644 --- a/tests/cases/unittests/versionCache.ts +++ b/tests/cases/unittests/versionCache.ts @@ -6,14 +6,6 @@ module ts { return source.substring(0, position) + newText + source.substring(position + deletedLength, source.length); } - var testDataDir = "..\..\..\src\compiler"; - - function bigTest() { - editStress("scanner.ts", false); - editStress("sys.ts", false); - editStress("binder.ts", false); - } - function lineColToPosition(lineIndex: server.LineIndex, line: number, col: number) { var lineInfo = lineIndex.lineNumberToInfo(line); return (lineInfo.offset + col - 1); @@ -166,29 +158,31 @@ and grew 1cm per day`; }); }); - function editStress(fname: string, timing: boolean) { - var content = ts.sys.readFile(testDataDir + fname); - var lm = server.LineIndex.linesFromText(content); - var lines = lm.lines; - if (lines.length == 0) { - return; - } - var lineMap = lm.lineMap; + describe('VersionCache stress test', () => { + const interationCount = 20; + //const interationCount = 20000; // uncomment for testing - var lineIndex = new server.LineIndex(); + // Use scanner.ts, decent size, does not change frequentlly + let testFileName = "src/compiler/scanner.ts"; + let testContent = Harness.IO.readFile(testFileName); + let totalChars = testContent.length; + assert.isTrue(totalChars > 0, "Failed to read test file."); + + let {lines, lineMap} = server.LineIndex.linesFromText(testContent); + assert.isTrue(lines.length > 0, "Failed to initialize test text. Expected text to have at least one line"); + + let lineIndex = new server.LineIndex(); lineIndex.load(lines); - var totalChars = content.length; - var rsa: number[] = []; - var la: number[] = []; - var las: number[] = []; - var elas: number[] = []; - var ersa: number[] = []; - var ela: number[] = []; - var etotalChars = totalChars; - var j: number; - var startTime: number; - for (j = 0; j < 100000; j++) { + let rsa: number[] = []; + let la: number[] = []; + let las: number[] = []; + let elas: number[] = []; + let ersa: number[] = []; + let ela: number[] = []; + let etotalChars = totalChars; + + for (let j = 0; j < 100000; j++) { rsa[j] = Math.floor(Math.random() * totalChars); la[j] = Math.floor(Math.random() * (totalChars - rsa[j])); if (la[j] > 4) { @@ -209,144 +203,77 @@ and grew 1cm per day`; etotalChars += (las[j] - elas[j]); } } - if (timing) { - startTime = Date.now(); - } - for (j = 0; j < 2000; j++) { - var s2 = lineIndex.getText(rsa[j], la[j]); - if (!timing) { - var s1 = content.substring(rsa[j], rsa[j] + la[j]); + + it("Range (average length 1/4 file size)", () => { + for (let i = 0; i < interationCount; i++) { + let s2 = lineIndex.getText(rsa[i], la[i]); + let s1 = testContent.substring(rsa[i], rsa[i] + la[i]); assert.equal(s1, s2); } - } - if (timing) { - console.log("range (average length 1/4 file size): " + ((Date.now() - startTime) / 2).toFixed(3) + " us"); - } - // console.log("check1"); - if (timing) { - startTime = Date.now(); - } - for (j = 0; j < 10000; j++) { - var s2 = lineIndex.getText(rsa[j], las[j]); - if (!timing) { - var s1 = content.substring(rsa[j], rsa[j] + las[j]); + }); + + it("Range (average length 4 chars)", () => { + for (let j = 0; j < interationCount; j++) { + let s2 = lineIndex.getText(rsa[j], las[j]); + let s1 = testContent.substring(rsa[j], rsa[j] + las[j]); assert.equal(s1, s2); } - } - // console.log("check2"); - if (timing) { - console.log("range (average length 4 chars): " + ((Date.now() - startTime) / 10).toFixed(3) + " us"); - } + }); - if (timing) { - startTime = Date.now(); - } - var snapshot: server.LineIndex; - for (j = 0; j < 2000; j++) { - var insertString = content.substring(rsa[100000 - j], rsa[100000 - j] + las[100000 - j]); - snapshot = lineIndex.edit(rsa[j], las[j], insertString); - if (!timing) { - var checkText = editFlat(rsa[j], las[j], insertString, content); - var snapText = snapshot.getText(0, checkText.length); - if (checkText != snapText) { - assert.equal(s1, s2); + it("Edit (average length 4)", () => { + for (let i = 0; i < interationCount; i++) { + let insertString = testContent.substring(rsa[100000 - i], rsa[100000 - i] + las[100000 - i]); + let snapshot = lineIndex.edit(rsa[i], las[i], insertString); + let checkText = editFlat(rsa[i], las[i], insertString, testContent); + let snapText = snapshot.getText(0, checkText.length); + assert.equal(checkText, snapText); + } + }); + + it("Edit ScriptVersionCache ", () => { + let svc = server.ScriptVersionCache.fromString(testContent); + let checkText = testContent; + + for (let i = 0; i < interationCount; i++) { + let insertString = testContent.substring(rsa[i], rsa[i] + las[i]); + svc.edit(ersa[i], elas[i], insertString); + checkText = editFlat(ersa[i], elas[i], insertString, checkText); + if (0 == (i % 4)) { + let snap = svc.getSnapshot(); + let snapText = snap.getText(0, checkText.length); + assert.equal(checkText, snapText); } } - } - // console.log("check3"); - if (timing) { - console.log("edit (average length 4): " + ((Date.now() - startTime) / 2).toFixed(3) + " us"); - } + }); - var svc = server.ScriptVersionCache.fromString(content); - checkText = content; - if (timing) { - startTime = Date.now(); - } - for (j = 0; j < 2000; j++) { - insertString = content.substring(rsa[j], rsa[j] + las[j]); - svc.edit(ersa[j], elas[j], insertString); - if (!timing) { - checkText = editFlat(ersa[j], elas[j], insertString, checkText); + it("Edit (average length 1/4th file size)", () => { + for (let i = 0; i < interationCount; i++) { + let insertString = testContent.substring(rsa[100000 - i], rsa[100000 - i] + la[100000 - i]); + let snapshot = lineIndex.edit(rsa[i], la[i], insertString); + let checkText = editFlat(rsa[i], la[i], insertString, testContent); + let snapText = snapshot.getText(0, checkText.length); + assert.equal(checkText, snapText); } - if (0 == (j % 4)) { - var snap = svc.getSnapshot(); - if (!timing) { - snapText = snap.getText(0, checkText.length); - if (checkText != snapText) { - assert.equal(s1, s2); - } - } + }); + + it("Line/offset from pos", () => { + for (let i = 0; i < interationCount; i++) { + let lp = lineIndex.charOffsetToLineNumberAndPos(rsa[i]); + let lac = ts.computeLineAndCharacterOfPosition(lineMap, rsa[i]); + assert.equal(lac.line + 1, lp.line, "Line number mismatch " + (lac.line + 1) + " " + lp.line + " " + i); + assert.equal(lac.character, (lp.offset), "Charachter offset mismatch " + lac.character + " " + lp.offset + " " + i); } - } - if (timing) { - console.log("edit ScriptVersionCache: " + ((Date.now() - startTime) / 2).toFixed(3) + " us"); - } + }); - // console.log("check4"); - if (timing) { - startTime = Date.now(); - } - for (j = 0; j < 5000; j++) { - insertString = content.substring(rsa[100000 - j], rsa[100000 - j] + la[100000 - j]); - snapshot = lineIndex.edit(rsa[j], la[j], insertString); - if (!timing) { - checkText = editFlat(rsa[j], la[j], insertString, content); - snapText = snapshot.getText(0, checkText.length); - if (checkText != snapText) { - assert.equal(s1, s2); - } - } - } - if (timing) { - console.log("edit (average length 1/4th file size): " + ((Date.now() - startTime) / 5).toFixed(3) + " us"); - } - - var t: ts.LineAndCharacter; - var errorCount = 0; - if (timing) { - startTime = Date.now(); - } - // console.log("check5"); - for (j = 0; j < 100000; j++) { - var lp = lineIndex.charOffsetToLineNumberAndPos(rsa[j]); - if (!timing) { - var lac = ts.computeLineAndCharacterOfPosition(lineMap, rsa[j]); - assert.equal(lac.line, lp.line, "Line number mismatch " + lac.line + " " + lp.line + " " + j); - assert.equal(lac.character, (lp.offset + 1), "Charachter offset mismatch " + lac.character + " " + (lp.offset + 1) + " " + j); - } - } - // console.log("check6"); - if (timing) { - console.log("line/offset from pos: " + ((Date.now() - startTime) / 100).toFixed(3) + " us"); - } - - if (timing) { - startTime = Date.now(); - } - - var outer = 1; - if (timing) { - outer = 100; - } - for (var ko = 0; ko < outer; ko++) { - for (var k = 0, llen = lines.length; k < llen; k++) { - var lineInfo = lineIndex.lineNumberToInfo(k + 1); - var lineIndexOffset = lineInfo.offset; - if (!timing) { - var lineMapOffset = lineMap[k]; + it("Start pos from line", () => { + for (let i = 0; i < interationCount; i++) { + for (let j = 0, llen = lines.length; j < llen; j++) { + let lineInfo = lineIndex.lineNumberToInfo(j + 1); + let lineIndexOffset = lineInfo.offset; + let lineMapOffset = lineMap[j]; assert.equal(lineIndexOffset, lineMapOffset); } } - } - if (timing) { - console.log("start pos from line: " + (((Date.now() - startTime) / lines.length) * 10).toFixed(3) + " us"); - } - } - - //function edTest() { - // bigTest(); - //} - - //edTest(); + }); + }); } From 82bc91467c0d44156984813680548e0602a94d18 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 17:30:57 -0700 Subject: [PATCH 40/61] Add to build --- Jakefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jakefile b/Jakefile index 665bb807b43..a777e134dfd 100644 --- a/Jakefile +++ b/Jakefile @@ -143,7 +143,8 @@ var harnessSources = [ "services/colorization.ts", "services/documentRegistry.ts", "services/preProcessFile.ts", - "services/patternMatcher.ts" + "services/patternMatcher.ts", + "versionCache.ts" ].map(function (f) { return path.join(unittestsDirectory, f); })).concat([ From cfda7df900568c38e82dddec8b4cff17352f9f05 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 31 Mar 2015 17:35:26 -0700 Subject: [PATCH 41/61] revert fix for #2456 'Import namespace exports should be immutable' --- src/compiler/checker.ts | 21 ---- ...externalModuleImmutableBindings.errors.txt | 104 ++---------------- .../externalModuleImmutableBindings.js | 3 + .../externalModuleImmutableBindings.ts | 2 + 4 files changed, 16 insertions(+), 114 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f59aaa64497..c0b5fe6669d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7354,23 +7354,6 @@ module ts { } } - function isImportedNameFromExternalModule(n: Node): boolean { - switch (n.kind) { - case SyntaxKind.ElementAccessExpression: - case SyntaxKind.PropertyAccessExpression: { - // all bindings for external module should be immutable - // so attempt to use a.b or a[b] as lhs will always fail - // no matter what b is - let symbol = findSymbol((n).expression); - return symbol && symbol.flags & SymbolFlags.Alias && isExternalModuleSymbol(resolveAlias(symbol)); - } - case SyntaxKind.ParenthesizedExpression: - return isImportedNameFromExternalModule((n).expression); - default: - return false; - } - } - if (!isReferenceOrErrorExpression(n)) { error(n, invalidReferenceMessage); return false; @@ -7381,10 +7364,6 @@ module ts { return false; } - if (isImportedNameFromExternalModule(n)) { - error(n, invalidReferenceMessage); - } - return true; } diff --git a/tests/baselines/reference/externalModuleImmutableBindings.errors.txt b/tests/baselines/reference/externalModuleImmutableBindings.errors.txt index 09cc7b33295..8ab07c26851 100644 --- a/tests/baselines/reference/externalModuleImmutableBindings.errors.txt +++ b/tests/baselines/reference/externalModuleImmutableBindings.errors.txt @@ -1,164 +1,82 @@ -tests/cases/compiler/f2.ts(5,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/compiler/f2.ts(6,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/compiler/f2.ts(7,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/compiler/f2.ts(7,7): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. -tests/cases/compiler/f2.ts(8,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/compiler/f2.ts(10,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. -tests/cases/compiler/f2.ts(11,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. -tests/cases/compiler/f2.ts(12,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. -tests/cases/compiler/f2.ts(13,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. -tests/cases/compiler/f2.ts(15,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/compiler/f2.ts(16,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/compiler/f2.ts(17,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/compiler/f2.ts(17,8): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. -tests/cases/compiler/f2.ts(18,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/compiler/f2.ts(20,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. -tests/cases/compiler/f2.ts(21,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. -tests/cases/compiler/f2.ts(22,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. -tests/cases/compiler/f2.ts(23,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. -tests/cases/compiler/f2.ts(25,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. -tests/cases/compiler/f2.ts(26,6): error TS2487: Invalid left-hand side in 'for...of' statement. +tests/cases/compiler/f2.ts(9,7): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. +tests/cases/compiler/f2.ts(19,8): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. tests/cases/compiler/f2.ts(27,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. -tests/cases/compiler/f2.ts(28,6): error TS2487: Invalid left-hand side in 'for...of' statement. -tests/cases/compiler/f2.ts(29,6): error TS2406: Invalid left-hand side in 'for...in' statement. -tests/cases/compiler/f2.ts(29,12): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. -tests/cases/compiler/f2.ts(30,6): error TS2487: Invalid left-hand side in 'for...of' statement. -tests/cases/compiler/f2.ts(30,12): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. -tests/cases/compiler/f2.ts(31,6): error TS2406: Invalid left-hand side in 'for...in' statement. -tests/cases/compiler/f2.ts(32,6): error TS2487: Invalid left-hand side in 'for...of' statement. -tests/cases/compiler/f2.ts(34,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. -tests/cases/compiler/f2.ts(35,6): error TS2487: Invalid left-hand side in 'for...of' statement. +tests/cases/compiler/f2.ts(29,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/compiler/f2.ts(31,12): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. +tests/cases/compiler/f2.ts(32,12): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. tests/cases/compiler/f2.ts(36,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. -tests/cases/compiler/f2.ts(37,6): error TS2487: Invalid left-hand side in 'for...of' statement. -tests/cases/compiler/f2.ts(38,6): error TS2406: Invalid left-hand side in 'for...in' statement. -tests/cases/compiler/f2.ts(38,13): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. -tests/cases/compiler/f2.ts(39,6): error TS2487: Invalid left-hand side in 'for...of' statement. -tests/cases/compiler/f2.ts(39,13): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. -tests/cases/compiler/f2.ts(40,6): error TS2406: Invalid left-hand side in 'for...in' statement. -tests/cases/compiler/f2.ts(41,6): error TS2487: Invalid left-hand side in 'for...of' statement. +tests/cases/compiler/f2.ts(38,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. +tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. ==== tests/cases/compiler/f1.ts (0 errors) ==== export var x = 1; -==== tests/cases/compiler/f2.ts (38 errors) ==== +==== tests/cases/compiler/f2.ts (10 errors) ==== + + // all mutations below are illegal and should be fixed import * as stuff from 'f1'; var n = 'baz'; stuff.x = 0; - ~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. stuff['x'] = 1; - ~~~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. stuff.blah = 2; - ~~~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. stuff[n] = 3; - ~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. stuff.x++; - ~~~~~~~ -!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. stuff['x']++; - ~~~~~~~~~~ -!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. stuff['blah']++; - ~~~~~~~~~~~~~ -!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. stuff[n]++; - ~~~~~~~~ -!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. (stuff.x) = 0; - ~~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. (stuff['x']) = 1; - ~~~~~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. (stuff.blah) = 2; - ~~~~~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. (stuff[n]) = 3; - ~~~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. (stuff.x)++; - ~~~~~~~~~ -!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. (stuff['x'])++; - ~~~~~~~~~~~~ -!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. (stuff['blah'])++; - ~~~~~~~~~~~~~~~ -!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. (stuff[n])++; - ~~~~~~~~~~ -!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. for (stuff.x in []) {} ~~~~~~~ !!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. for (stuff.x of []) {} - ~~~~~~~ -!!! error TS2487: Invalid left-hand side in 'for...of' statement. for (stuff['x'] in []) {} ~~~~~~~~~~ !!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. for (stuff['x'] of []) {} - ~~~~~~~~~~ -!!! error TS2487: Invalid left-hand side in 'for...of' statement. for (stuff.blah in []) {} - ~~~~~~~~~~ -!!! error TS2406: Invalid left-hand side in 'for...in' statement. ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. for (stuff.blah of []) {} - ~~~~~~~~~~ -!!! error TS2487: Invalid left-hand side in 'for...of' statement. ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. for (stuff[n] in []) {} - ~~~~~~~~ -!!! error TS2406: Invalid left-hand side in 'for...in' statement. for (stuff[n] of []) {} - ~~~~~~~~ -!!! error TS2487: Invalid left-hand side in 'for...of' statement. for ((stuff.x) in []) {} ~~~~~~~~~ !!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. for ((stuff.x) of []) {} - ~~~~~~~~~ -!!! error TS2487: Invalid left-hand side in 'for...of' statement. for ((stuff['x']) in []) {} ~~~~~~~~~~~~ !!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. for ((stuff['x']) of []) {} - ~~~~~~~~~~~~ -!!! error TS2487: Invalid left-hand side in 'for...of' statement. for ((stuff.blah) in []) {} - ~~~~~~~~~~~~ -!!! error TS2406: Invalid left-hand side in 'for...in' statement. ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. for ((stuff.blah) of []) {} - ~~~~~~~~~~~~ -!!! error TS2487: Invalid left-hand side in 'for...of' statement. ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. for ((stuff[n]) in []) {} - ~~~~~~~~~~ -!!! error TS2406: Invalid left-hand side in 'for...in' statement. for ((stuff[n]) of []) {} - ~~~~~~~~~~ -!!! error TS2487: Invalid left-hand side in 'for...of' statement. \ No newline at end of file diff --git a/tests/baselines/reference/externalModuleImmutableBindings.js b/tests/baselines/reference/externalModuleImmutableBindings.js index ed9b4c00afc..5e5ba6c2294 100644 --- a/tests/baselines/reference/externalModuleImmutableBindings.js +++ b/tests/baselines/reference/externalModuleImmutableBindings.js @@ -4,6 +4,8 @@ export var x = 1; //// [f2.ts] + +// all mutations below are illegal and should be fixed import * as stuff from 'f1'; var n = 'baz'; @@ -52,6 +54,7 @@ for ((stuff[n]) of []) {} //// [f1.js] exports.x = 1; //// [f2.js] +// all mutations below are illegal and should be fixed var stuff = require('f1'); var n = 'baz'; stuff.x = 0; diff --git a/tests/cases/compiler/externalModuleImmutableBindings.ts b/tests/cases/compiler/externalModuleImmutableBindings.ts index 9ed3d278a3a..2321961f6f8 100644 --- a/tests/cases/compiler/externalModuleImmutableBindings.ts +++ b/tests/cases/compiler/externalModuleImmutableBindings.ts @@ -3,6 +3,8 @@ export var x = 1; // @Filename: f2.ts + +// all mutations below are illegal and should be fixed import * as stuff from 'f1'; var n = 'baz'; From afc38c2956e0a5cd8b3e27c934bf204e3658b7d1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 17:36:15 -0700 Subject: [PATCH 42/61] Rename method. --- src/compiler/checker.ts | 54 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fe93ffb5828..fa3c845ec39 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -589,7 +589,7 @@ module ts { if (moduleSymbol.flags & SymbolFlags.Variable) { let typeAnnotation = (moduleSymbol.valueDeclaration).type; if (typeAnnotation) { - return getPropertyOfType(getTypeFromNode(typeAnnotation), name); + return getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name); } } } @@ -638,7 +638,7 @@ module ts { if (symbol.flags & SymbolFlags.Variable) { var typeAnnotation = (symbol.valueDeclaration).type; if (typeAnnotation) { - return resolveSymbol(getPropertyOfType(getTypeFromNode(typeAnnotation), name)); + return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name)); } } } @@ -2106,7 +2106,7 @@ module ts { } // Use type from type annotation if one is present if (declaration.type) { - return getTypeFromNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === SyntaxKind.Parameter) { let func = declaration.parent; @@ -2243,7 +2243,7 @@ module ts { return links.type = checkExpression(exportAssignment.expression); } else if (exportAssignment.type) { - return links.type = getTypeFromNode(exportAssignment.type); + return links.type = getTypeFromTypeNodeOrHeritageClauseElement(exportAssignment.type); } else { return links.type = anyType; @@ -2275,11 +2275,11 @@ module ts { function getAnnotatedAccessorType(accessor: AccessorDeclaration): Type { if (accessor) { if (accessor.kind === SyntaxKind.GetAccessor) { - return accessor.type && getTypeFromNode(accessor.type); + return accessor.type && getTypeFromTypeNodeOrHeritageClauseElement(accessor.type); } else { let setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromNode(setterTypeAnnotation); + return setterTypeAnnotation && getTypeFromTypeNodeOrHeritageClauseElement(setterTypeAnnotation); } } return undefined; @@ -2520,7 +2520,7 @@ module ts { if (!links.declaredType) { links.declaredType = resolvingType; let declaration = getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration); - let type = getTypeFromNode(declaration.type); + let type = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } @@ -3062,7 +3062,7 @@ module ts { returnType = classType; } else if (declaration.type) { - returnType = getTypeFromNode(declaration.type); + returnType = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } else { // TypeScript 1.0 spec (April 2014): @@ -3220,7 +3220,7 @@ module ts { function getIndexTypeOfSymbol(symbol: Symbol, kind: IndexKind): Type { let declaration = getIndexDeclarationOfSymbol(symbol, kind); return declaration - ? declaration.type ? getTypeFromNode(declaration.type) : anyType + ? declaration.type ? getTypeFromTypeNodeOrHeritageClauseElement(declaration.type) : anyType : undefined; } @@ -3231,7 +3231,7 @@ module ts { type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromNode((getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint); + type.constraint = getTypeFromTypeNodeOrHeritageClauseElement((getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -3362,7 +3362,7 @@ module ts { if (type.flags & (TypeFlags.Class | TypeFlags.Interface) && type.flags & TypeFlags.Reference) { let typeParameters = (type).typeParameters; if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, map(node.typeArguments, getTypeFromNode)); + type = createTypeReference(type, map(node.typeArguments, getTypeFromTypeNodeOrHeritageClauseElement)); } else { error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), typeParameters.length); @@ -3456,7 +3456,7 @@ module ts { function getTypeFromArrayTypeNode(node: ArrayTypeNode): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createArrayType(getTypeFromNode(node.elementType)); + links.resolvedType = createArrayType(getTypeFromTypeNodeOrHeritageClauseElement(node.elementType)); } return links.resolvedType; } @@ -3474,7 +3474,7 @@ module ts { function getTypeFromTupleTypeNode(node: TupleTypeNode): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromNode)); + links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromTypeNodeOrHeritageClauseElement)); } return links.resolvedType; } @@ -3570,7 +3570,7 @@ module ts { function getTypeFromUnionTypeNode(node: UnionTypeNode): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(map(node.types, getTypeFromNode), /*noSubtypeReduction*/ true); + links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNodeOrHeritageClauseElement), /*noSubtypeReduction*/ true); } return links.resolvedType; } @@ -3602,7 +3602,7 @@ module ts { return links.resolvedType; } - function getTypeFromNode(node: TypeNode | LiteralExpression | HeritageClauseElement): Type { + function getTypeFromTypeNodeOrHeritageClauseElement(node: TypeNode | LiteralExpression | HeritageClauseElement): Type { switch (node.kind) { case SyntaxKind.AnyKeyword: return anyType; @@ -3631,7 +3631,7 @@ module ts { case SyntaxKind.UnionType: return getTypeFromUnionTypeNode(node); case SyntaxKind.ParenthesizedType: - return getTypeFromNode((node).type); + return getTypeFromTypeNodeOrHeritageClauseElement((node).type); case SyntaxKind.FunctionType: case SyntaxKind.ConstructorType: case SyntaxKind.TypeLiteral: @@ -5632,7 +5632,7 @@ module ts { let declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { - return getTypeFromNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === SyntaxKind.Parameter) { let type = getContextuallyTypedParameterType(declaration); @@ -5835,7 +5835,7 @@ module ts { case SyntaxKind.NewExpression: return getContextualTypeForArgument(parent, node); case SyntaxKind.TypeAssertionExpression: - return getTypeFromNode((parent).type); + return getTypeFromTypeNodeOrHeritageClauseElement((parent).type); case SyntaxKind.BinaryExpression: return getContextualTypeForBinaryOperand(node); case SyntaxKind.PropertyAssignment: @@ -6636,7 +6636,7 @@ module ts { let typeArgumentsAreAssignable = true; for (let i = 0; i < typeParameters.length; i++) { let typeArgNode = typeArguments[i]; - let typeArgument = getTypeFromNode(typeArgNode); + let typeArgument = getTypeFromTypeNodeOrHeritageClauseElement(typeArgNode); // Do not push on this array! It has a preallocated length typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable /* so far */) { @@ -7118,7 +7118,7 @@ module ts { function checkTypeAssertion(node: TypeAssertion): Type { let exprType = checkExpression(node.expression); - let targetType = getTypeFromNode(node.type); + let targetType = getTypeFromTypeNodeOrHeritageClauseElement(node.type); if (produceDiagnostics && targetType !== unknownType) { let widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { @@ -7297,7 +7297,7 @@ module ts { function checkFunctionExpressionOrObjectLiteralMethodBody(node: FunctionExpression | MethodDeclaration) { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); if (node.type) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (node.body) { @@ -7307,7 +7307,7 @@ module ts { else { let exprType = checkExpression(node.body); if (node.type) { - checkTypeAssignableTo(exprType, getTypeFromNode(node.type), node.body, /*headMessage*/ undefined); + checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrHeritageClauseElement(node.type), node.body, /*headMessage*/ undefined); } checkFunctionExpressionBodies(node.body); } @@ -8816,7 +8816,7 @@ module ts { checkSourceElement(node.body); if (node.type && !isAccessor(node.kind)) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } // Report an implicit any error if there is no body, no explicit return type, and node is not a private method @@ -9949,7 +9949,7 @@ module ts { if (!tp1.constraint || !tp2.constraint) { return false; } - if (!isTypeIdenticalTo(getTypeFromNode(tp1.constraint), getTypeFromNode(tp2.constraint))) { + if (!isTypeIdenticalTo(getTypeFromTypeNodeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrHeritageClauseElement(tp2.constraint))) { return false; } } @@ -10959,7 +10959,7 @@ module ts { return node.parent && node.parent.kind === SyntaxKind.HeritageClauseElement; } - function isTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node: Node): boolean { + function isTypeNodeOrHeritageClauseElement(node: Node): boolean { if (SyntaxKind.FirstTypeNode <= node.kind && node.kind <= SyntaxKind.LastTypeNode) { return true; } @@ -11208,8 +11208,8 @@ module ts { return unknownType; } - if (isTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node)) { - return getTypeFromNode(node); + if (isTypeNodeOrHeritageClauseElement(node)) { + return getTypeFromTypeNodeOrHeritageClauseElement(node); } if (isExpression(node)) { From 72d23c7937f270db2e23b5daa600757d8bbb62d5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 17:48:07 -0700 Subject: [PATCH 43/61] Remove unnecessary code. --- src/services/services.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index a518c3a94d0..19c545019a8 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5369,12 +5369,6 @@ module ts { function getEmitOutput(fileName: string): EmitOutput { synchronizeHostData(); - // If the option is set to not emit on errors, and there are any errors, then we don't - // want to proceed. - if (program.getCompilerOptions().noEmitOnError && getPreEmitDiagnostics(program).length > 0) { - return { outputFiles: [], emitSkipped: true }; - } - let sourceFile = getValidSourceFile(fileName); let outputFiles: OutputFile[] = []; From 27f6f8f9190e6e3f78121d471c750c6c95793bf3 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 31 Mar 2015 18:00:02 -0700 Subject: [PATCH 44/61] Keep comments in debug builds. --- Jakefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Jakefile b/Jakefile index 665bb807b43..2eb87494f2f 100644 --- a/Jakefile +++ b/Jakefile @@ -222,15 +222,17 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory; var options = "--module commonjs -noImplicitAny"; - if (!keepComments) { - options += " -removeComments"; + // Keep comments when specifically requested + // or when in debug mode. + if (!(keepComments || useDebugMode)) { + options += " --removeComments"; } if (generateDeclarations) { options += " --declaration"; } - if (useDebugMode || preserveConstEnums) { + if (preserveConstEnums || useDebugMode) { options += " --preserveConstEnums"; } From 3df576d112de95308cb2328ef7a9f1b1c12954e1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 18:11:54 -0700 Subject: [PATCH 45/61] Adding a couple of class tests. --- .../reference/classExpressionTest1.errors.txt | 18 ++++++++++++ .../reference/classExpressionTest1.js | 29 +++++++++++++++++++ .../reference/classExpressionTest2.errors.txt | 21 ++++++++++++++ .../reference/classExpressionTest2.js | 29 +++++++++++++++++++ tests/cases/compiler/classExpressionTest1.ts | 12 ++++++++ tests/cases/compiler/classExpressionTest2.ts | 12 ++++++++ 6 files changed, 121 insertions(+) create mode 100644 tests/baselines/reference/classExpressionTest1.errors.txt create mode 100644 tests/baselines/reference/classExpressionTest1.js create mode 100644 tests/baselines/reference/classExpressionTest2.errors.txt create mode 100644 tests/baselines/reference/classExpressionTest2.js create mode 100644 tests/cases/compiler/classExpressionTest1.ts create mode 100644 tests/cases/compiler/classExpressionTest2.ts diff --git a/tests/baselines/reference/classExpressionTest1.errors.txt b/tests/baselines/reference/classExpressionTest1.errors.txt new file mode 100644 index 00000000000..4d7e1cda639 --- /dev/null +++ b/tests/baselines/reference/classExpressionTest1.errors.txt @@ -0,0 +1,18 @@ +tests/cases/compiler/classExpressionTest1.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. + + +==== tests/cases/compiler/classExpressionTest1.ts (1 errors) ==== + function M() { + class C { + ~ +!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. + f() { + var t: T; + var x: X; + return { t, x }; + } + } + + var v = new C(); + return v.f(); + } \ No newline at end of file diff --git a/tests/baselines/reference/classExpressionTest1.js b/tests/baselines/reference/classExpressionTest1.js new file mode 100644 index 00000000000..e91cdebb8c1 --- /dev/null +++ b/tests/baselines/reference/classExpressionTest1.js @@ -0,0 +1,29 @@ +//// [classExpressionTest1.ts] +function M() { + class C { + f() { + var t: T; + var x: X; + return { t, x }; + } + } + + var v = new C(); + return v.f(); +} + +//// [classExpressionTest1.js] +function M() { + var C = (function () { + function C() { + } + C.prototype.f = function () { + var t; + var x; + return { t: t, x: x }; + }; + return C; + })(); + var v = new C(); + return v.f(); +} diff --git a/tests/baselines/reference/classExpressionTest2.errors.txt b/tests/baselines/reference/classExpressionTest2.errors.txt new file mode 100644 index 00000000000..424eb590611 --- /dev/null +++ b/tests/baselines/reference/classExpressionTest2.errors.txt @@ -0,0 +1,21 @@ +tests/cases/compiler/classExpressionTest2.ts(2,19): error TS9003: 'class' expressions are not currently supported. +tests/cases/compiler/classExpressionTest2.ts(5,20): error TS2304: Cannot find name 'X'. + + +==== tests/cases/compiler/classExpressionTest2.ts (2 errors) ==== + function M() { + var m = class C { + ~ +!!! error TS9003: 'class' expressions are not currently supported. + f() { + var t: T; + var x: X; + ~ +!!! error TS2304: Cannot find name 'X'. + return { t, x }; + } + } + + var v = new m(); + return v.f(); + } \ No newline at end of file diff --git a/tests/baselines/reference/classExpressionTest2.js b/tests/baselines/reference/classExpressionTest2.js new file mode 100644 index 00000000000..ebb5c1e21b6 --- /dev/null +++ b/tests/baselines/reference/classExpressionTest2.js @@ -0,0 +1,29 @@ +//// [classExpressionTest2.ts] +function M() { + var m = class C { + f() { + var t: T; + var x: X; + return { t, x }; + } + } + + var v = new m(); + return v.f(); +} + +//// [classExpressionTest2.js] +function M() { + var m = (function () { + function C() { + } + C.prototype.f = function () { + var t; + var x; + return { t: t, x: x }; + }; + return C; + })(); + var v = new m(); + return v.f(); +} diff --git a/tests/cases/compiler/classExpressionTest1.ts b/tests/cases/compiler/classExpressionTest1.ts new file mode 100644 index 00000000000..b299a2fd733 --- /dev/null +++ b/tests/cases/compiler/classExpressionTest1.ts @@ -0,0 +1,12 @@ +function M() { + class C { + f() { + var t: T; + var x: X; + return { t, x }; + } + } + + var v = new C(); + return v.f(); +} \ No newline at end of file diff --git a/tests/cases/compiler/classExpressionTest2.ts b/tests/cases/compiler/classExpressionTest2.ts new file mode 100644 index 00000000000..c0b9792b82b --- /dev/null +++ b/tests/cases/compiler/classExpressionTest2.ts @@ -0,0 +1,12 @@ +function M() { + var m = class C { + f() { + var t: T; + var x: X; + return { t, x }; + } + } + + var v = new m(); + return v.f(); +} \ No newline at end of file From 434764329324f38f43c3e02b1003cbd119105d2c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 18:17:35 -0700 Subject: [PATCH 46/61] CR feedback. --- src/harness/fourslash.ts | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 1f233a4bfb8..7269b2db75d 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -116,7 +116,7 @@ module FourSlash { // Name of testcase metadata including ts.CompilerOptions properties that will be used by globalOptions // To add additional option, add property into the testOptMetadataNames, refer the property in either globalMetadataNames or fileMetadataNames // Add cases into convertGlobalOptionsToCompilationsSettings function for the compiler to acknowledge such option from meta data - var testOptMetadataNames = { + var metadataOptionNames = { baselineFile: 'BaselineFile', declaration: 'declaration', emitThisFile: 'emitThisFile', // This flag is used for testing getEmitOutput feature. It allows test-cases to indicate what file to be output in multiple files project @@ -132,10 +132,10 @@ module FourSlash { }; // List of allowed metadata names - var fileMetadataNames = [testOptMetadataNames.fileName, testOptMetadataNames.emitThisFile, testOptMetadataNames.resolveReference]; - var globalMetadataNames = [testOptMetadataNames.allowNonTsExtensions, testOptMetadataNames.baselineFile, testOptMetadataNames.declaration, - testOptMetadataNames.mapRoot, testOptMetadataNames.module, testOptMetadataNames.out, - testOptMetadataNames.outDir, testOptMetadataNames.sourceMap, testOptMetadataNames.sourceRoot] + var fileMetadataNames = [metadataOptionNames.fileName, metadataOptionNames.emitThisFile, metadataOptionNames.resolveReference]; + var globalMetadataNames = [metadataOptionNames.allowNonTsExtensions, metadataOptionNames.baselineFile, metadataOptionNames.declaration, + metadataOptionNames.mapRoot, metadataOptionNames.module, metadataOptionNames.out, + metadataOptionNames.outDir, metadataOptionNames.sourceMap, metadataOptionNames.sourceRoot] function convertGlobalOptionsToCompilerOptions(globalOptions: { [idx: string]: string }): ts.CompilerOptions { var settings: ts.CompilerOptions = { target: ts.ScriptTarget.ES5 }; @@ -143,16 +143,16 @@ module FourSlash { for (var prop in globalOptions) { if (globalOptions.hasOwnProperty(prop)) { switch (prop) { - case testOptMetadataNames.allowNonTsExtensions: + case metadataOptionNames.allowNonTsExtensions: settings.allowNonTsExtensions = true; break; - case testOptMetadataNames.declaration: + case metadataOptionNames.declaration: settings.declaration = true; break; - case testOptMetadataNames.mapRoot: + case metadataOptionNames.mapRoot: settings.mapRoot = globalOptions[prop]; break; - case testOptMetadataNames.module: + case metadataOptionNames.module: // create appropriate external module target for CompilationSettings switch (globalOptions[prop]) { case "AMD": @@ -167,16 +167,16 @@ module FourSlash { break; } break; - case testOptMetadataNames.out: + case metadataOptionNames.out: settings.out = globalOptions[prop]; break; - case testOptMetadataNames.outDir: + case metadataOptionNames.outDir: settings.outDir = globalOptions[prop]; break; - case testOptMetadataNames.sourceMap: + case metadataOptionNames.sourceMap: settings.sourceMap = true; break; - case testOptMetadataNames.sourceRoot: + case metadataOptionNames.sourceRoot: settings.sourceRoot = globalOptions[prop]; break; } @@ -308,7 +308,7 @@ module FourSlash { ts.forEach(testData.files, file => { // Create map between fileName and its content for easily looking up when resolveReference flag is specified this.inputFiles[file.fileName] = file.content; - if (!startResolveFileRef && file.fileOptions[testOptMetadataNames.resolveReference]) { + if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference]) { startResolveFileRef = file; } else if (startResolveFileRef) { // If entry point for resolving file references is already specified, report duplication error @@ -1143,7 +1143,7 @@ module FourSlash { Harness.Baseline.runBaseline( "Breakpoint Locations for " + this.activeFile.fileName, - this.testData.globalOptions[testOptMetadataNames.baselineFile], + this.testData.globalOptions[metadataOptionNames.baselineFile], () => { return this.baselineCurrentFileLocations(pos => this.getBreakpointStatementLocation(pos)); }, @@ -1158,7 +1158,7 @@ module FourSlash { var allFourSlashFiles = this.testData.files; for (var idx = 0; idx < allFourSlashFiles.length; ++idx) { var file = allFourSlashFiles[idx]; - if (file.fileOptions[testOptMetadataNames.emitThisFile]) { + if (file.fileOptions[metadataOptionNames.emitThisFile]) { // Find a file with the flag emitThisFile turned on emitFiles.push(file); } @@ -1171,7 +1171,7 @@ module FourSlash { Harness.Baseline.runBaseline( "Generate getEmitOutput baseline : " + emitFiles.join(" "), - this.testData.globalOptions[testOptMetadataNames.baselineFile], + this.testData.globalOptions[metadataOptionNames.baselineFile], () => { var resultString = ""; // Loop through all the emittedFiles and emit them one by one @@ -1716,7 +1716,7 @@ module FourSlash { Harness.Baseline.runBaseline( "Name OrDottedNameSpans for " + this.activeFile.fileName, - this.testData.globalOptions[testOptMetadataNames.baselineFile], + this.testData.globalOptions[metadataOptionNames.baselineFile], () => { return this.baselineCurrentFileLocations(pos => this.getNameOrDottedNameSpan(pos)); @@ -2292,7 +2292,7 @@ module FourSlash { if (globalMetadataNamesIndex === -1) { if (fileMetadataNamesIndex === -1) { throw new Error('Unrecognized metadata name "' + match[1] + '". Available global metadata names are: ' + globalMetadataNames.join(', ') + '; file metadata names are: ' + fileMetadataNames.join(', ')); - } else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(testOptMetadataNames.fileName)) { + } else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(metadataOptionNames.fileName)) { // Found an @FileName directive, if this is not the first then create a new subfile if (currentFileContent) { var file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges); From 54e1928b2ac048bc3a69ea1ec7516cd5cc04a62d Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 31 Mar 2015 18:34:43 -0700 Subject: [PATCH 47/61] Moved arrow function to function declaration. --- src/compiler/checker.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6bd75c5d283..b2f6e1634c2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -74,7 +74,7 @@ module ts { isImplementationOfOverload, getAliasedSymbol: resolveAlias, getEmitResolver, - getExportsOfModule: moduleSymbol => symbolsToArray(getExportsOfModule(moduleSymbol)), + getExportsOfModule: getExportsOfModuleAsArray, }; let unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown"); @@ -872,6 +872,10 @@ module ts { return moduleSymbol.exports["export="]; } + function getExportsOfModuleAsArray(moduleSymbol: Symbol): Symbol[] { + return symbolsToArray(getExportsOfModule(moduleSymbol)); + } + function getExportsOfSymbol(symbol: Symbol): SymbolTable { return symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : symbol.exports || emptySymbols; } From d06f3aa22478e4f5d1065dcd2ddc7b6f020aa105 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 31 Mar 2015 19:07:45 -0700 Subject: [PATCH 48/61] Update test. --- tests/baselines/reference/APISample_linter.types.pull | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/baselines/reference/APISample_linter.types.pull b/tests/baselines/reference/APISample_linter.types.pull index 759a8390d60..252478fb73a 100644 --- a/tests/baselines/reference/APISample_linter.types.pull +++ b/tests/baselines/reference/APISample_linter.types.pull @@ -5883,6 +5883,9 @@ declare module "typescript" { kindModifiers: string; >kindModifiers : string + + sortText: string; +>sortText : string } interface CompletionEntryDetails { >CompletionEntryDetails : CompletionEntryDetails @@ -6152,6 +6155,9 @@ declare module "typescript" { static unknown: string; >unknown : string + static warning: string; +>warning : string + static keyword: string; >keyword : string From 4f78695740159ed9cb93cace0ac78b7db044254f Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 20:42:45 -0700 Subject: [PATCH 49/61] Respond to code review comments --- Jakefile | 2 +- tests/cases/unittests/versionCache.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Jakefile b/Jakefile index a777e134dfd..3d733c4c5ae 100644 --- a/Jakefile +++ b/Jakefile @@ -144,7 +144,7 @@ var harnessSources = [ "services/documentRegistry.ts", "services/preProcessFile.ts", "services/patternMatcher.ts", - "versionCache.ts" + "versionCache.ts" ].map(function (f) { return path.join(unittestsDirectory, f); })).concat([ diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts index 5d10ed5006a..12cf9c1b817 100644 --- a/tests/cases/unittests/versionCache.ts +++ b/tests/cases/unittests/versionCache.ts @@ -159,7 +159,7 @@ and grew 1cm per day`; }); describe('VersionCache stress test', () => { - const interationCount = 20; + const iterationCount = 20; //const interationCount = 20000; // uncomment for testing // Use scanner.ts, decent size, does not change frequentlly @@ -205,7 +205,7 @@ and grew 1cm per day`; } it("Range (average length 1/4 file size)", () => { - for (let i = 0; i < interationCount; i++) { + for (let i = 0; i < iterationCount; i++) { let s2 = lineIndex.getText(rsa[i], la[i]); let s1 = testContent.substring(rsa[i], rsa[i] + la[i]); assert.equal(s1, s2); @@ -213,7 +213,7 @@ and grew 1cm per day`; }); it("Range (average length 4 chars)", () => { - for (let j = 0; j < interationCount; j++) { + for (let j = 0; j < iterationCount; j++) { let s2 = lineIndex.getText(rsa[j], las[j]); let s1 = testContent.substring(rsa[j], rsa[j] + las[j]); assert.equal(s1, s2); @@ -221,7 +221,7 @@ and grew 1cm per day`; }); it("Edit (average length 4)", () => { - for (let i = 0; i < interationCount; i++) { + for (let i = 0; i < iterationCount; i++) { let insertString = testContent.substring(rsa[100000 - i], rsa[100000 - i] + las[100000 - i]); let snapshot = lineIndex.edit(rsa[i], las[i], insertString); let checkText = editFlat(rsa[i], las[i], insertString, testContent); @@ -234,7 +234,7 @@ and grew 1cm per day`; let svc = server.ScriptVersionCache.fromString(testContent); let checkText = testContent; - for (let i = 0; i < interationCount; i++) { + for (let i = 0; i < iterationCount; i++) { let insertString = testContent.substring(rsa[i], rsa[i] + las[i]); svc.edit(ersa[i], elas[i], insertString); checkText = editFlat(ersa[i], elas[i], insertString, checkText); @@ -247,7 +247,7 @@ and grew 1cm per day`; }); it("Edit (average length 1/4th file size)", () => { - for (let i = 0; i < interationCount; i++) { + for (let i = 0; i < iterationCount; i++) { let insertString = testContent.substring(rsa[100000 - i], rsa[100000 - i] + la[100000 - i]); let snapshot = lineIndex.edit(rsa[i], la[i], insertString); let checkText = editFlat(rsa[i], la[i], insertString, testContent); @@ -257,7 +257,7 @@ and grew 1cm per day`; }); it("Line/offset from pos", () => { - for (let i = 0; i < interationCount; i++) { + for (let i = 0; i < iterationCount; i++) { let lp = lineIndex.charOffsetToLineNumberAndPos(rsa[i]); let lac = ts.computeLineAndCharacterOfPosition(lineMap, rsa[i]); assert.equal(lac.line + 1, lp.line, "Line number mismatch " + (lac.line + 1) + " " + lp.line + " " + i); @@ -266,7 +266,7 @@ and grew 1cm per day`; }); it("Start pos from line", () => { - for (let i = 0; i < interationCount; i++) { + for (let i = 0; i < iterationCount; i++) { for (let j = 0, llen = lines.length; j < llen; j++) { let lineInfo = lineIndex.lineNumberToInfo(j + 1); let lineIndexOffset = lineInfo.offset; From 0c5d736251da81caf6e81481b0db9b9eba207662 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 21:17:24 -0700 Subject: [PATCH 50/61] Respond to code review remarks --- src/compiler/checker.ts | 3 ++- src/compiler/utilities.ts | 17 ++++++++++------- src/services/services.ts | 7 +++++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cf4049294bb..73dc52a9b08 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -351,7 +351,8 @@ module ts { } else if (location.kind === SyntaxKind.SourceFile) { result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & SymbolFlags.ModuleMember); - if (result && (result.flags & meaning) && result.valueDeclaration && (result.valueDeclaration.flags & NodeFlags.Default) && result.valueDeclaration.localSymbol.name === name) { + let localSymbol = getLocalSymbolForExportDefault(result); + if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { break loop; } result = undefined; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9fa0674c25c..e9a18254f8e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -145,7 +145,7 @@ module ts { return node.pos === node.end && node.kind !== SyntaxKind.EndOfFileToken; } - + export function nodeIsPresent(node: Node) { return !nodeIsMissing(node); } @@ -288,7 +288,7 @@ module ts { errorNode = (node).name; break; } - + if (errorNode === undefined) { // If we don't have a better node, then just set the error on the first token of // construct. @@ -634,7 +634,7 @@ module ts { return false; } - + export function childIsDecorated(node: Node): boolean { switch (node.kind) { case SyntaxKind.ClassDeclaration: @@ -745,7 +745,7 @@ module ts { export function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean) { let moduleState = getModuleInstanceState(node) return moduleState === ModuleInstanceState.Instantiated || - (preserveConstEnums && moduleState === ModuleInstanceState.ConstEnumOnly); + (preserveConstEnums && moduleState === ModuleInstanceState.ConstEnumOnly); } export function isExternalModuleImportEqualsDeclaration(node: Node) { @@ -1161,7 +1161,7 @@ module ts { export function createTextSpanFromBounds(start: number, end: number) { return createTextSpan(start, end - start); } - + export function textChangeRangeNewSpan(range: TextChangeRange) { return createTextSpan(range.span.start, range.newLength); } @@ -1435,13 +1435,13 @@ module ts { return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); } } - + function get16BitUnicodeEscapeSequence(charCode: number): string { let hexCharCode = charCode.toString(16).toUpperCase(); let paddedHexCode = ("0000" + hexCharCode).slice(-4); return "\\u" + paddedHexCode; } - + let nonAsciiCharacters = /[^\u0000-\u007F]/g; export function escapeNonAsciiCharacters(s: string): string { // Replace non-ASCII characters with '\uNNNN' escapes if any exist. @@ -1768,4 +1768,7 @@ module ts { } } + export function getLocalSymbolForExportDefault(symbol: Symbol) { + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined; + } } diff --git a/src/services/services.ts b/src/services/services.ts index 4609c722786..0a05191cf6a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2405,8 +2405,11 @@ module ts { } // If this is the default export, get the name of the declaration if it exists - if (displayName === "default" && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) && symbol.valueDeclaration.localSymbol && symbol.valueDeclaration.localSymbol.name) { - displayName = symbol.valueDeclaration.localSymbol.name; + if (displayName === "default") { + let localSymbol = getLocalSymbolForExportDefault(symbol); + if (localSymbol && localSymbol.name) { + displayName = symbol.valueDeclaration.localSymbol.name; + } } let firstCharCode = displayName.charCodeAt(0); From 27f5a28d0121df4cab76364546a97fe29a0ebb2d Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 31 Mar 2015 21:49:31 -0700 Subject: [PATCH 51/61] mend --- .../reference/APISample_linter.types.pull | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/baselines/reference/APISample_linter.types.pull b/tests/baselines/reference/APISample_linter.types.pull index 759a8390d60..e2a29716fcc 100644 --- a/tests/baselines/reference/APISample_linter.types.pull +++ b/tests/baselines/reference/APISample_linter.types.pull @@ -4984,6 +4984,27 @@ declare module "typescript" { >CompilerHost : CompilerHost >Program : Program } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; +>readConfigFile : (fileName: string) => any +>fileName : string + + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine +>json : any +>basePath : string +>ParsedCommandLine : ParsedCommandLine +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; From 8bf61c7be126a5bb1cf75f5d5875433b41874f03 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 1 Apr 2015 09:26:30 -0700 Subject: [PATCH 52/61] Update LKG --- bin/lib.d.ts | 166 +- bin/lib.es6.d.ts | 166 +- bin/lib.scriptHost.d.ts | 166 +- bin/tsc.js | 11128 ++++++++++++++++++------- bin/tsserver.js | 3542 ++++---- bin/typescript.d.ts | 144 +- bin/typescript.js | 3653 ++++---- bin/typescriptServices.d.ts | 144 +- bin/typescriptServices.js | 3653 ++++---- bin/typescriptServices_internal.d.ts | 23 +- bin/typescript_internal.d.ts | 23 +- 11 files changed, 14725 insertions(+), 8083 deletions(-) diff --git a/bin/lib.d.ts b/bin/lib.d.ts index 15bcc31c8f7..e0fdf442967 100644 --- a/bin/lib.d.ts +++ b/bin/lib.d.ts @@ -14223,7 +14223,11 @@ declare function importScripts(...urls: string[]): void; /// Windows Script Host APIS ///////////////////////////// -declare var ActiveXObject: { new (s: string): any; }; + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; interface ITextWriter { Write(s: string): void; @@ -14231,11 +14235,157 @@ interface ITextWriter { Close(): void; } -declare var WScript: { - Echo(s: any): void; - StdErr: ITextWriter; - StdOut: ITextWriter; - Arguments: { length: number; Item(n: number): string; }; - ScriptFullName: string; - Quit(exitCode?: number): number; +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + /** + * The current line number in an input stream. + */ + Line: number; + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; } + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, beginning at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext). + */ + Echo(s: any): void; + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + /** + * Fully qualified path of the host executable. + */ + FullName: string; + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + /** + * Path of the directory containing the host executable. + */ + Path: string; + /** + * The filename of the currently running script. + */ + ScriptName: string; + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + /** + * Windows Script Host version + */ + Version: string; + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; diff --git a/bin/lib.es6.d.ts b/bin/lib.es6.d.ts index 114e15e6d44..edc51cad7cc 100644 --- a/bin/lib.es6.d.ts +++ b/bin/lib.es6.d.ts @@ -17205,7 +17205,11 @@ declare function importScripts(...urls: string[]): void; /// Windows Script Host APIS ///////////////////////////// -declare var ActiveXObject: { new (s: string): any; }; + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; interface ITextWriter { Write(s: string): void; @@ -17213,11 +17217,157 @@ interface ITextWriter { Close(): void; } -declare var WScript: { - Echo(s: any): void; - StdErr: ITextWriter; - StdOut: ITextWriter; - Arguments: { length: number; Item(n: number): string; }; - ScriptFullName: string; - Quit(exitCode?: number): number; +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + /** + * The current line number in an input stream. + */ + Line: number; + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; } + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, beginning at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext). + */ + Echo(s: any): void; + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + /** + * Fully qualified path of the host executable. + */ + FullName: string; + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + /** + * Path of the directory containing the host executable. + */ + Path: string; + /** + * The filename of the currently running script. + */ + ScriptName: string; + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + /** + * Windows Script Host version + */ + Version: string; + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; diff --git a/bin/lib.scriptHost.d.ts b/bin/lib.scriptHost.d.ts index 1498aeea63a..17b1fe956a2 100644 --- a/bin/lib.scriptHost.d.ts +++ b/bin/lib.scriptHost.d.ts @@ -20,7 +20,11 @@ and limitations under the License. /// Windows Script Host APIS ///////////////////////////// -declare var ActiveXObject: { new (s: string): any; }; + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; interface ITextWriter { Write(s: string): void; @@ -28,11 +32,157 @@ interface ITextWriter { Close(): void; } -declare var WScript: { - Echo(s: any): void; - StdErr: ITextWriter; - StdOut: ITextWriter; - Arguments: { length: number; Item(n: number): string; }; - ScriptFullName: string; - Quit(exitCode?: number): number; +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + /** + * The current line number in an input stream. + */ + Line: number; + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; } + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, beginning at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext). + */ + Echo(s: any): void; + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + /** + * Fully qualified path of the host executable. + */ + FullName: string; + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + /** + * Path of the directory containing the host executable. + */ + Path: string; + /** + * The filename of the currently running script. + */ + ScriptName: string; + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + /** + * Windows Script Host version + */ + Version: string; + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; diff --git a/bin/tsc.js b/bin/tsc.js index 21e5a8ff6a3..2acb2dd3a12 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -28,6 +28,7 @@ var ts; })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); var DiagnosticCategory = ts.DiagnosticCategory; })(ts || (ts = {})); +/// var ts; (function (ts) { function forEach(array, callback) { @@ -44,7 +45,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (v === value) { return true; @@ -68,7 +69,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -82,10 +83,10 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { - var _item = array[_i]; - if (f(_item)) { - result.push(_item); + for (var _i = 0; _i < array.length; _i++) { + var item_1 = array[_i]; + if (f(item_1)) { + result.push(item_1); } } } @@ -96,7 +97,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result.push(f(v)); } @@ -116,10 +117,10 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { - var _item = array[_i]; - if (!contains(result, _item)) { - result.push(_item); + for (var _i = 0; _i < array.length; _i++) { + var item_2 = array[_i]; + if (!contains(result, item_2)) { + result.push(item_2); } } } @@ -128,7 +129,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result += v[prop]; } @@ -137,7 +138,7 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0, _n = from.length; _i < _n; _i++) { + for (var _i = 0; _i < from.length; _i++) { var v = from[_i]; to.push(v); } @@ -230,9 +231,9 @@ var ts; for (var id in first) { result[id] = first[id]; } - for (var _id in second) { - if (!hasProperty(result, _id)) { - result[_id] = second[_id]; + for (var id in second) { + if (!hasProperty(result, id)) { + result[id] = second[id]; } } return result; @@ -276,13 +277,13 @@ var ts; ts.arrayToMap = arrayToMap; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (match, index) { + return args[+index + baseIndex]; + }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { - return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] - ? ts.localizedDiagnosticMessages[message] - : message; + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { @@ -353,12 +354,7 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || - compareValues(d1.start, d2.start) || - compareValues(d1.length, d2.length) || - compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || - 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -385,7 +381,9 @@ var ts; if (diagnostics.length < 2) { return diagnostics; } - var newDiagnostics = [diagnostics[0]]; + var newDiagnostics = [ + diagnostics[0] + ]; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; @@ -426,7 +424,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _n = parts.length; _i < _n; _i++) { + for (var _i = 0; _i < parts.length; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -462,7 +460,9 @@ var ts; ts.isRootedDiskPath = isRootedDiskPath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); - return [path.substr(0, rootLength)].concat(normalizedParts); + return [ + path.substr(0, rootLength) + ].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { path = normalizeSlashes(path); @@ -485,6 +485,9 @@ var ts; } ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; function getNormalizedPathComponentsOfUrl(url) { + // Get root length of http://www.website.com/folder1/foler2/ + // In this example the root is: http://www.website.com/ + // normalized path components should be ["http://www.website.com/", "folder1", "folder2"] var urlLength = url.length; var rootLength = url.indexOf("://") + "://".length; while (rootLength < urlLength) { @@ -496,7 +499,9 @@ var ts; } } if (rootLength === urlLength) { - return [url]; + return [ + url + ]; } var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { @@ -504,7 +509,9 @@ var ts; return normalizedPathComponents(url, rootLength); } else { - return [url + ts.directorySeparator]; + return [ + url + ts.directorySeparator + ]; } } function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { @@ -566,9 +573,13 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + var supportedExtensions = [ + ".d.ts", + ".ts", + ".js" + ]; function removeFileExtension(path) { - for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { + for (var _i = 0; _i < supportedExtensions.length; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -620,9 +631,15 @@ var ts; }; return Node; }, - getSymbolConstructor: function () { return Symbol; }, - getTypeConstructor: function () { return Type; }, - getSignatureConstructor: function () { return Signature; } + getSymbolConstructor: function () { + return Symbol; + }, + getTypeConstructor: function () { + return Type; + }, + getSignatureConstructor: function () { + return Signature; + } }; var Debug; (function (Debug) { @@ -647,6 +664,7 @@ var ts; Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); })(ts || (ts = {})); +/// var ts; (function (ts) { ts.sys = (function () { @@ -720,14 +738,14 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _n = files.length; _i < _n; _i++) { - var _name = files[_i]; - if (!extension || ts.fileExtensionIs(_name, extension)) { - result.push(ts.combinePaths(path, _name)); + for (var _i = 0; _i < files.length; _i++) { + var name_1 = files[_i]; + if (!extension || ts.fileExtensionIs(name_1, extension)) { + result.push(ts.combinePaths(path, name_1)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + for (var _a = 0; _a < subfolders.length; _a++) { var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } @@ -814,7 +832,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -827,9 +845,9 @@ var ts; directories.push(name); } } - for (var _a = 0, _b = directories.length; _a < _b; _a++) { - var _current = directories[_a]; - visitDirectory(_current); + for (var _a = 0; _a < directories.length; _a++) { + var current = directories[_a]; + visitDirectory(current); } } } @@ -843,9 +861,14 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + _fs.watchFile(fileName, { + persistent: true, + interval: 250 + }, fileChanged); return { - close: function () { _fs.unwatchFile(fileName, fileChanged); } + close: function () { + _fs.unwatchFile(fileName, fileChanged); + } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -898,507 +921,2554 @@ var ts; } })(); })(ts || (ts = {})); +/// var ts; (function (ts) { ts.Diagnostics = { - Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, - Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, - _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, - A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, - Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, - Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, - An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, - A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, - A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, - Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, - An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, - super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, - Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, - Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, - Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, - Type_expected: { code: 1110, category: 1, key: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, - Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, - Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, - Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, - Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, - Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, - Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, - case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, - Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, - Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, - Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, - Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, - Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, - Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, - Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, - Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, - Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, - Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, - or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, - Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, - Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, - Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, - An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, - yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, - Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, - extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, - extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, - Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, - implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, - Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, - Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, - Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, - Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, - Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, - Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, - A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, - Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, - Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, - A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, - A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, - An_import_declaration_cannot_have_modifiers: { code: 1191, category: 1, key: "An import declaration cannot have modifiers." }, - External_module_0_has_no_default_export: { code: 1192, category: 1, key: "External module '{0}' has no default export." }, - An_export_declaration_cannot_have_modifiers: { code: 1193, category: 1, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: 1, key: "Export declarations are not permitted in an internal module." }, - Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: 1, key: "Catch clause variable name must be an identifier." }, - Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: 1, key: "Catch clause variable cannot have a type annotation." }, - Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: 1, key: "Catch clause variable cannot have an initializer." }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: 1, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, - Unterminated_Unicode_escape_sequence: { code: 1199, category: 1, key: "Unterminated Unicode escape sequence." }, - Line_terminator_not_permitted_before_arrow: { code: 1200, category: 1, key: "Line terminator not permitted before arrow." }, - A_type_annotation_on_an_export_statement_is_only_allowed_in_an_ambient_external_module_declaration: { code: 1201, category: 1, key: "A type annotation on an export statement is only allowed in an ambient external module declaration." }, - Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: 1, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, - Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: 1, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: 1, key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." }, - Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: 1, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, - Decorators_are_not_valid_here: { code: 1206, category: 1, key: "Decorators are not valid here." }, - Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: 1, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, - Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, - Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, - Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, - Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, - Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, - A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, - Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, - A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, - An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, - Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, - Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, - Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, - Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, - Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, - Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, - Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, - Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, - Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, - Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, - Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, - Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, - Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, - Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, - this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, - this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, - this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, - super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, - super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, - Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, - Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, - Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, - Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, - No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, - Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, - A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, - Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, - Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, - Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, - Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, - get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, - Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, - Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, - Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, - Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, - Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, - Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, - Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, - Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, - Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, - Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, - Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, - A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, - Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, - Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, - An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, - Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, - An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, - Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, - Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, - Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, - this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, - super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, - Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, - The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: 1, key: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: 1, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, - Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: 1, key: "Invalid left-hand side in 'for...of' statement." }, - The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: 1, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." }, - The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: 1, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: 1, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: 1, key: "Cannot redeclare identifier '{0}' in catch clause" }, - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: 1, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: 1, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, - Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: 1, key: "Type '{0}' is not an array type or a string type." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, - External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: 1, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, - External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: 1, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, - Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, - Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: 1, key: "Default export of the module has or is using private name '{0}'." }, - Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: 1, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, - The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, - Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, - Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, - Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, - Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, - Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, - Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, - Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, - Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, - Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, - Print_this_message: { code: 6017, category: 2, key: "Print this message." }, - Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, - Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, - options: { code: 6024, category: 2, key: "options" }, - file: { code: 6025, category: 2, key: "file" }, - Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, - Options_Colon: { code: 6027, category: 2, key: "Options:" }, - Version_0: { code: 6029, category: 2, key: "Version {0}" }, - Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, - File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, - KIND: { code: 6034, category: 2, key: "KIND" }, - FILE: { code: 6035, category: 2, key: "FILE" }, - VERSION: { code: 6036, category: 2, key: "VERSION" }, - LOCATION: { code: 6037, category: 2, key: "LOCATION" }, - DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, - Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, - Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, - Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, - Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, - Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, - Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, - Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, - Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, - File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, - Preserve_new_lines_when_emitting_code: { code: 6057, category: 2, key: "Preserve new-lines when emitting code." }, - Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, - Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, - Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, - Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, - Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, - Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, - yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." } + Unterminated_string_literal: { + code: 1002, + category: ts.DiagnosticCategory.Error, + key: "Unterminated string literal." + }, + Identifier_expected: { + code: 1003, + category: ts.DiagnosticCategory.Error, + key: "Identifier expected." + }, + _0_expected: { + code: 1005, + category: ts.DiagnosticCategory.Error, + key: "'{0}' expected." + }, + A_file_cannot_have_a_reference_to_itself: { + code: 1006, + category: ts.DiagnosticCategory.Error, + key: "A file cannot have a reference to itself." + }, + Trailing_comma_not_allowed: { + code: 1009, + category: ts.DiagnosticCategory.Error, + key: "Trailing comma not allowed." + }, + Asterisk_Slash_expected: { + code: 1010, + category: ts.DiagnosticCategory.Error, + key: "'*/' expected." + }, + Unexpected_token: { + code: 1012, + category: ts.DiagnosticCategory.Error, + key: "Unexpected token." + }, + A_rest_parameter_must_be_last_in_a_parameter_list: { + code: 1014, + category: ts.DiagnosticCategory.Error, + key: "A rest parameter must be last in a parameter list." + }, + Parameter_cannot_have_question_mark_and_initializer: { + code: 1015, + category: ts.DiagnosticCategory.Error, + key: "Parameter cannot have question mark and initializer." + }, + A_required_parameter_cannot_follow_an_optional_parameter: { + code: 1016, + category: ts.DiagnosticCategory.Error, + key: "A required parameter cannot follow an optional parameter." + }, + An_index_signature_cannot_have_a_rest_parameter: { + code: 1017, + category: ts.DiagnosticCategory.Error, + key: "An index signature cannot have a rest parameter." + }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { + code: 1018, + category: ts.DiagnosticCategory.Error, + key: "An index signature parameter cannot have an accessibility modifier." + }, + An_index_signature_parameter_cannot_have_a_question_mark: { + code: 1019, + category: ts.DiagnosticCategory.Error, + key: "An index signature parameter cannot have a question mark." + }, + An_index_signature_parameter_cannot_have_an_initializer: { + code: 1020, + category: ts.DiagnosticCategory.Error, + key: "An index signature parameter cannot have an initializer." + }, + An_index_signature_must_have_a_type_annotation: { + code: 1021, + category: ts.DiagnosticCategory.Error, + key: "An index signature must have a type annotation." + }, + An_index_signature_parameter_must_have_a_type_annotation: { + code: 1022, + category: ts.DiagnosticCategory.Error, + key: "An index signature parameter must have a type annotation." + }, + An_index_signature_parameter_type_must_be_string_or_number: { + code: 1023, + category: ts.DiagnosticCategory.Error, + key: "An index signature parameter type must be 'string' or 'number'." + }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { + code: 1024, + category: ts.DiagnosticCategory.Error, + key: "A class or interface declaration can only have one 'extends' clause." + }, + An_extends_clause_must_precede_an_implements_clause: { + code: 1025, + category: ts.DiagnosticCategory.Error, + key: "An 'extends' clause must precede an 'implements' clause." + }, + A_class_can_only_extend_a_single_class: { + code: 1026, + category: ts.DiagnosticCategory.Error, + key: "A class can only extend a single class." + }, + A_class_declaration_can_only_have_one_implements_clause: { + code: 1027, + category: ts.DiagnosticCategory.Error, + key: "A class declaration can only have one 'implements' clause." + }, + Accessibility_modifier_already_seen: { + code: 1028, + category: ts.DiagnosticCategory.Error, + key: "Accessibility modifier already seen." + }, + _0_modifier_must_precede_1_modifier: { + code: 1029, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier must precede '{1}' modifier." + }, + _0_modifier_already_seen: { + code: 1030, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier already seen." + }, + _0_modifier_cannot_appear_on_a_class_element: { + code: 1031, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier cannot appear on a class element." + }, + An_interface_declaration_cannot_have_an_implements_clause: { + code: 1032, + category: ts.DiagnosticCategory.Error, + key: "An interface declaration cannot have an 'implements' clause." + }, + super_must_be_followed_by_an_argument_list_or_member_access: { + code: 1034, + category: ts.DiagnosticCategory.Error, + key: "'super' must be followed by an argument list or member access." + }, + Only_ambient_modules_can_use_quoted_names: { + code: 1035, + category: ts.DiagnosticCategory.Error, + key: "Only ambient modules can use quoted names." + }, + Statements_are_not_allowed_in_ambient_contexts: { + code: 1036, + category: ts.DiagnosticCategory.Error, + key: "Statements are not allowed in ambient contexts." + }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { + code: 1038, + category: ts.DiagnosticCategory.Error, + key: "A 'declare' modifier cannot be used in an already ambient context." + }, + Initializers_are_not_allowed_in_ambient_contexts: { + code: 1039, + category: ts.DiagnosticCategory.Error, + key: "Initializers are not allowed in ambient contexts." + }, + _0_modifier_cannot_appear_on_a_module_element: { + code: 1044, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier cannot appear on a module element." + }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { + code: 1045, + category: ts.DiagnosticCategory.Error, + key: "A 'declare' modifier cannot be used with an interface declaration." + }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { + code: 1046, + category: ts.DiagnosticCategory.Error, + key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." + }, + A_rest_parameter_cannot_be_optional: { + code: 1047, + category: ts.DiagnosticCategory.Error, + key: "A rest parameter cannot be optional." + }, + A_rest_parameter_cannot_have_an_initializer: { + code: 1048, + category: ts.DiagnosticCategory.Error, + key: "A rest parameter cannot have an initializer." + }, + A_set_accessor_must_have_exactly_one_parameter: { + code: 1049, + category: ts.DiagnosticCategory.Error, + key: "A 'set' accessor must have exactly one parameter." + }, + A_set_accessor_cannot_have_an_optional_parameter: { + code: 1051, + category: ts.DiagnosticCategory.Error, + key: "A 'set' accessor cannot have an optional parameter." + }, + A_set_accessor_parameter_cannot_have_an_initializer: { + code: 1052, + category: ts.DiagnosticCategory.Error, + key: "A 'set' accessor parameter cannot have an initializer." + }, + A_set_accessor_cannot_have_rest_parameter: { + code: 1053, + category: ts.DiagnosticCategory.Error, + key: "A 'set' accessor cannot have rest parameter." + }, + A_get_accessor_cannot_have_parameters: { + code: 1054, + category: ts.DiagnosticCategory.Error, + key: "A 'get' accessor cannot have parameters." + }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { + code: 1056, + category: ts.DiagnosticCategory.Error, + key: "Accessors are only available when targeting ECMAScript 5 and higher." + }, + Enum_member_must_have_initializer: { + code: 1061, + category: ts.DiagnosticCategory.Error, + key: "Enum member must have initializer." + }, + An_export_assignment_cannot_be_used_in_an_internal_module: { + code: 1063, + category: ts.DiagnosticCategory.Error, + key: "An export assignment cannot be used in an internal module." + }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { + code: 1066, + category: ts.DiagnosticCategory.Error, + key: "Ambient enum elements can only have integer literal initializers." + }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { + code: 1068, + category: ts.DiagnosticCategory.Error, + key: "Unexpected token. A constructor, method, accessor, or property was expected." + }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { + code: 1079, + category: ts.DiagnosticCategory.Error, + key: "A 'declare' modifier cannot be used with an import declaration." + }, + Invalid_reference_directive_syntax: { + code: 1084, + category: ts.DiagnosticCategory.Error, + key: "Invalid 'reference' directive syntax." + }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { + code: 1085, + category: ts.DiagnosticCategory.Error, + key: "Octal literals are not available when targeting ECMAScript 5 and higher." + }, + An_accessor_cannot_be_declared_in_an_ambient_context: { + code: 1086, + category: ts.DiagnosticCategory.Error, + key: "An accessor cannot be declared in an ambient context." + }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { + code: 1089, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier cannot appear on a constructor declaration." + }, + _0_modifier_cannot_appear_on_a_parameter: { + code: 1090, + category: ts.DiagnosticCategory.Error, + key: "'{0}' modifier cannot appear on a parameter." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { + code: 1091, + category: ts.DiagnosticCategory.Error, + key: "Only a single variable declaration is allowed in a 'for...in' statement." + }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { + code: 1092, + category: ts.DiagnosticCategory.Error, + key: "Type parameters cannot appear on a constructor declaration." + }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { + code: 1093, + category: ts.DiagnosticCategory.Error, + key: "Type annotation cannot appear on a constructor declaration." + }, + An_accessor_cannot_have_type_parameters: { + code: 1094, + category: ts.DiagnosticCategory.Error, + key: "An accessor cannot have type parameters." + }, + A_set_accessor_cannot_have_a_return_type_annotation: { + code: 1095, + category: ts.DiagnosticCategory.Error, + key: "A 'set' accessor cannot have a return type annotation." + }, + An_index_signature_must_have_exactly_one_parameter: { + code: 1096, + category: ts.DiagnosticCategory.Error, + key: "An index signature must have exactly one parameter." + }, + _0_list_cannot_be_empty: { + code: 1097, + category: ts.DiagnosticCategory.Error, + key: "'{0}' list cannot be empty." + }, + Type_parameter_list_cannot_be_empty: { + code: 1098, + category: ts.DiagnosticCategory.Error, + key: "Type parameter list cannot be empty." + }, + Type_argument_list_cannot_be_empty: { + code: 1099, + category: ts.DiagnosticCategory.Error, + key: "Type argument list cannot be empty." + }, + Invalid_use_of_0_in_strict_mode: { + code: 1100, + category: ts.DiagnosticCategory.Error, + key: "Invalid use of '{0}' in strict mode." + }, + with_statements_are_not_allowed_in_strict_mode: { + code: 1101, + category: ts.DiagnosticCategory.Error, + key: "'with' statements are not allowed in strict mode." + }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { + code: 1102, + category: ts.DiagnosticCategory.Error, + key: "'delete' cannot be called on an identifier in strict mode." + }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { + code: 1104, + category: ts.DiagnosticCategory.Error, + key: "A 'continue' statement can only be used within an enclosing iteration statement." + }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { + code: 1105, + category: ts.DiagnosticCategory.Error, + key: "A 'break' statement can only be used within an enclosing iteration or switch statement." + }, + Jump_target_cannot_cross_function_boundary: { + code: 1107, + category: ts.DiagnosticCategory.Error, + key: "Jump target cannot cross function boundary." + }, + A_return_statement_can_only_be_used_within_a_function_body: { + code: 1108, + category: ts.DiagnosticCategory.Error, + key: "A 'return' statement can only be used within a function body." + }, + Expression_expected: { + code: 1109, + category: ts.DiagnosticCategory.Error, + key: "Expression expected." + }, + Type_expected: { + code: 1110, + category: ts.DiagnosticCategory.Error, + key: "Type expected." + }, + A_class_member_cannot_be_declared_optional: { + code: 1112, + category: ts.DiagnosticCategory.Error, + key: "A class member cannot be declared optional." + }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { + code: 1113, + category: ts.DiagnosticCategory.Error, + key: "A 'default' clause cannot appear more than once in a 'switch' statement." + }, + Duplicate_label_0: { + code: 1114, + category: ts.DiagnosticCategory.Error, + key: "Duplicate label '{0}'" + }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { + code: 1115, + category: ts.DiagnosticCategory.Error, + key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." + }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { + code: 1116, + category: ts.DiagnosticCategory.Error, + key: "A 'break' statement can only jump to a label of an enclosing statement." + }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { + code: 1117, + category: ts.DiagnosticCategory.Error, + key: "An object literal cannot have multiple properties with the same name in strict mode." + }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { + code: 1118, + category: ts.DiagnosticCategory.Error, + key: "An object literal cannot have multiple get/set accessors with the same name." + }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { + code: 1119, + category: ts.DiagnosticCategory.Error, + key: "An object literal cannot have property and accessor with the same name." + }, + An_export_assignment_cannot_have_modifiers: { + code: 1120, + category: ts.DiagnosticCategory.Error, + key: "An export assignment cannot have modifiers." + }, + Octal_literals_are_not_allowed_in_strict_mode: { + code: 1121, + category: ts.DiagnosticCategory.Error, + key: "Octal literals are not allowed in strict mode." + }, + A_tuple_type_element_list_cannot_be_empty: { + code: 1122, + category: ts.DiagnosticCategory.Error, + key: "A tuple type element list cannot be empty." + }, + Variable_declaration_list_cannot_be_empty: { + code: 1123, + category: ts.DiagnosticCategory.Error, + key: "Variable declaration list cannot be empty." + }, + Digit_expected: { + code: 1124, + category: ts.DiagnosticCategory.Error, + key: "Digit expected." + }, + Hexadecimal_digit_expected: { + code: 1125, + category: ts.DiagnosticCategory.Error, + key: "Hexadecimal digit expected." + }, + Unexpected_end_of_text: { + code: 1126, + category: ts.DiagnosticCategory.Error, + key: "Unexpected end of text." + }, + Invalid_character: { + code: 1127, + category: ts.DiagnosticCategory.Error, + key: "Invalid character." + }, + Declaration_or_statement_expected: { + code: 1128, + category: ts.DiagnosticCategory.Error, + key: "Declaration or statement expected." + }, + Statement_expected: { + code: 1129, + category: ts.DiagnosticCategory.Error, + key: "Statement expected." + }, + case_or_default_expected: { + code: 1130, + category: ts.DiagnosticCategory.Error, + key: "'case' or 'default' expected." + }, + Property_or_signature_expected: { + code: 1131, + category: ts.DiagnosticCategory.Error, + key: "Property or signature expected." + }, + Enum_member_expected: { + code: 1132, + category: ts.DiagnosticCategory.Error, + key: "Enum member expected." + }, + Type_reference_expected: { + code: 1133, + category: ts.DiagnosticCategory.Error, + key: "Type reference expected." + }, + Variable_declaration_expected: { + code: 1134, + category: ts.DiagnosticCategory.Error, + key: "Variable declaration expected." + }, + Argument_expression_expected: { + code: 1135, + category: ts.DiagnosticCategory.Error, + key: "Argument expression expected." + }, + Property_assignment_expected: { + code: 1136, + category: ts.DiagnosticCategory.Error, + key: "Property assignment expected." + }, + Expression_or_comma_expected: { + code: 1137, + category: ts.DiagnosticCategory.Error, + key: "Expression or comma expected." + }, + Parameter_declaration_expected: { + code: 1138, + category: ts.DiagnosticCategory.Error, + key: "Parameter declaration expected." + }, + Type_parameter_declaration_expected: { + code: 1139, + category: ts.DiagnosticCategory.Error, + key: "Type parameter declaration expected." + }, + Type_argument_expected: { + code: 1140, + category: ts.DiagnosticCategory.Error, + key: "Type argument expected." + }, + String_literal_expected: { + code: 1141, + category: ts.DiagnosticCategory.Error, + key: "String literal expected." + }, + Line_break_not_permitted_here: { + code: 1142, + category: ts.DiagnosticCategory.Error, + key: "Line break not permitted here." + }, + or_expected: { + code: 1144, + category: ts.DiagnosticCategory.Error, + key: "'{' or ';' expected." + }, + Modifiers_not_permitted_on_index_signature_members: { + code: 1145, + category: ts.DiagnosticCategory.Error, + key: "Modifiers not permitted on index signature members." + }, + Declaration_expected: { + code: 1146, + category: ts.DiagnosticCategory.Error, + key: "Declaration expected." + }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { + code: 1147, + category: ts.DiagnosticCategory.Error, + key: "Import declarations in an internal module cannot reference an external module." + }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { + code: 1148, + category: ts.DiagnosticCategory.Error, + key: "Cannot compile external modules unless the '--module' flag is provided." + }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { + code: 1149, + category: ts.DiagnosticCategory.Error, + key: "File name '{0}' differs from already included file name '{1}' only in casing" + }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { + code: 1150, + category: ts.DiagnosticCategory.Error, + key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." + }, + var_let_or_const_expected: { + code: 1152, + category: ts.DiagnosticCategory.Error, + key: "'var', 'let' or 'const' expected." + }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1153, + category: ts.DiagnosticCategory.Error, + key: "'let' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1154, + category: ts.DiagnosticCategory.Error, + key: "'const' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_must_be_initialized: { + code: 1155, + category: ts.DiagnosticCategory.Error, + key: "'const' declarations must be initialized" + }, + const_declarations_can_only_be_declared_inside_a_block: { + code: 1156, + category: ts.DiagnosticCategory.Error, + key: "'const' declarations can only be declared inside a block." + }, + let_declarations_can_only_be_declared_inside_a_block: { + code: 1157, + category: ts.DiagnosticCategory.Error, + key: "'let' declarations can only be declared inside a block." + }, + Unterminated_template_literal: { + code: 1160, + category: ts.DiagnosticCategory.Error, + key: "Unterminated template literal." + }, + Unterminated_regular_expression_literal: { + code: 1161, + category: ts.DiagnosticCategory.Error, + key: "Unterminated regular expression literal." + }, + An_object_member_cannot_be_declared_optional: { + code: 1162, + category: ts.DiagnosticCategory.Error, + key: "An object member cannot be declared optional." + }, + yield_expression_must_be_contained_within_a_generator_declaration: { + code: 1163, + category: ts.DiagnosticCategory.Error, + key: "'yield' expression must be contained_within a generator declaration." + }, + Computed_property_names_are_not_allowed_in_enums: { + code: 1164, + category: ts.DiagnosticCategory.Error, + key: "Computed property names are not allowed in enums." + }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { + code: 1165, + category: ts.DiagnosticCategory.Error, + key: "A computed property name in an ambient context must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { + code: 1166, + category: ts.DiagnosticCategory.Error, + key: "A computed property name in a class property declaration must directly refer to a built-in symbol." + }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1167, + category: ts.DiagnosticCategory.Error, + key: "Computed property names are only available when targeting ECMAScript 6 and higher." + }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { + code: 1168, + category: ts.DiagnosticCategory.Error, + key: "A computed property name in a method overload must directly refer to a built-in symbol." + }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { + code: 1169, + category: ts.DiagnosticCategory.Error, + key: "A computed property name in an interface must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { + code: 1170, + category: ts.DiagnosticCategory.Error, + key: "A computed property name in a type literal must directly refer to a built-in symbol." + }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { + code: 1171, + category: ts.DiagnosticCategory.Error, + key: "A comma expression is not allowed in a computed property name." + }, + extends_clause_already_seen: { + code: 1172, + category: ts.DiagnosticCategory.Error, + key: "'extends' clause already seen." + }, + extends_clause_must_precede_implements_clause: { + code: 1173, + category: ts.DiagnosticCategory.Error, + key: "'extends' clause must precede 'implements' clause." + }, + Classes_can_only_extend_a_single_class: { + code: 1174, + category: ts.DiagnosticCategory.Error, + key: "Classes can only extend a single class." + }, + implements_clause_already_seen: { + code: 1175, + category: ts.DiagnosticCategory.Error, + key: "'implements' clause already seen." + }, + Interface_declaration_cannot_have_implements_clause: { + code: 1176, + category: ts.DiagnosticCategory.Error, + key: "Interface declaration cannot have 'implements' clause." + }, + Binary_digit_expected: { + code: 1177, + category: ts.DiagnosticCategory.Error, + key: "Binary digit expected." + }, + Octal_digit_expected: { + code: 1178, + category: ts.DiagnosticCategory.Error, + key: "Octal digit expected." + }, + Unexpected_token_expected: { + code: 1179, + category: ts.DiagnosticCategory.Error, + key: "Unexpected token. '{' expected." + }, + Property_destructuring_pattern_expected: { + code: 1180, + category: ts.DiagnosticCategory.Error, + key: "Property destructuring pattern expected." + }, + Array_element_destructuring_pattern_expected: { + code: 1181, + category: ts.DiagnosticCategory.Error, + key: "Array element destructuring pattern expected." + }, + A_destructuring_declaration_must_have_an_initializer: { + code: 1182, + category: ts.DiagnosticCategory.Error, + key: "A destructuring declaration must have an initializer." + }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { + code: 1183, + category: ts.DiagnosticCategory.Error, + key: "Destructuring declarations are not allowed in ambient contexts." + }, + An_implementation_cannot_be_declared_in_ambient_contexts: { + code: 1184, + category: ts.DiagnosticCategory.Error, + key: "An implementation cannot be declared in ambient contexts." + }, + Modifiers_cannot_appear_here: { + code: 1184, + category: ts.DiagnosticCategory.Error, + key: "Modifiers cannot appear here." + }, + Merge_conflict_marker_encountered: { + code: 1185, + category: ts.DiagnosticCategory.Error, + key: "Merge conflict marker encountered." + }, + A_rest_element_cannot_have_an_initializer: { + code: 1186, + category: ts.DiagnosticCategory.Error, + key: "A rest element cannot have an initializer." + }, + A_parameter_property_may_not_be_a_binding_pattern: { + code: 1187, + category: ts.DiagnosticCategory.Error, + key: "A parameter property may not be a binding pattern." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { + code: 1188, + category: ts.DiagnosticCategory.Error, + key: "Only a single variable declaration is allowed in a 'for...of' statement." + }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { + code: 1189, + category: ts.DiagnosticCategory.Error, + key: "The variable declaration of a 'for...in' statement cannot have an initializer." + }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { + code: 1190, + category: ts.DiagnosticCategory.Error, + key: "The variable declaration of a 'for...of' statement cannot have an initializer." + }, + An_import_declaration_cannot_have_modifiers: { + code: 1191, + category: ts.DiagnosticCategory.Error, + key: "An import declaration cannot have modifiers." + }, + External_module_0_has_no_default_export: { + code: 1192, + category: ts.DiagnosticCategory.Error, + key: "External module '{0}' has no default export." + }, + An_export_declaration_cannot_have_modifiers: { + code: 1193, + category: ts.DiagnosticCategory.Error, + key: "An export declaration cannot have modifiers." + }, + Export_declarations_are_not_permitted_in_an_internal_module: { + code: 1194, + category: ts.DiagnosticCategory.Error, + key: "Export declarations are not permitted in an internal module." + }, + Catch_clause_variable_name_must_be_an_identifier: { + code: 1195, + category: ts.DiagnosticCategory.Error, + key: "Catch clause variable name must be an identifier." + }, + Catch_clause_variable_cannot_have_a_type_annotation: { + code: 1196, + category: ts.DiagnosticCategory.Error, + key: "Catch clause variable cannot have a type annotation." + }, + Catch_clause_variable_cannot_have_an_initializer: { + code: 1197, + category: ts.DiagnosticCategory.Error, + key: "Catch clause variable cannot have an initializer." + }, + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { + code: 1198, + category: ts.DiagnosticCategory.Error, + key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." + }, + Unterminated_Unicode_escape_sequence: { + code: 1199, + category: ts.DiagnosticCategory.Error, + key: "Unterminated Unicode escape sequence." + }, + Line_terminator_not_permitted_before_arrow: { + code: 1200, + category: ts.DiagnosticCategory.Error, + key: "Line terminator not permitted before arrow." + }, + A_type_annotation_on_an_export_statement_is_only_allowed_in_an_ambient_external_module_declaration: { + code: 1201, + category: ts.DiagnosticCategory.Error, + key: "A type annotation on an export statement is only allowed in an ambient external module declaration." + }, + Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { + code: 1202, + category: ts.DiagnosticCategory.Error, + key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." + }, + Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { + code: 1203, + category: ts.DiagnosticCategory.Error, + key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." + }, + Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { + code: 1204, + category: ts.DiagnosticCategory.Error, + key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." + }, + Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { + code: 1205, + category: ts.DiagnosticCategory.Error, + key: "Decorators are only available when targeting ECMAScript 5 and higher." + }, + Decorators_are_not_valid_here: { + code: 1206, + category: ts.DiagnosticCategory.Error, + key: "Decorators are not valid here." + }, + Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { + code: 1207, + category: ts.DiagnosticCategory.Error, + key: "Decorators cannot be applied to multiple get/set accessors of the same name." + }, + Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { + code: 1208, + category: ts.DiagnosticCategory.Error, + key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." + }, + Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { + code: 1209, + category: ts.DiagnosticCategory.Error, + key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." + }, + Duplicate_identifier_0: { + code: 2300, + category: ts.DiagnosticCategory.Error, + key: "Duplicate identifier '{0}'." + }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { + code: 2301, + category: ts.DiagnosticCategory.Error, + key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." + }, + Static_members_cannot_reference_class_type_parameters: { + code: 2302, + category: ts.DiagnosticCategory.Error, + key: "Static members cannot reference class type parameters." + }, + Circular_definition_of_import_alias_0: { + code: 2303, + category: ts.DiagnosticCategory.Error, + key: "Circular definition of import alias '{0}'." + }, + Cannot_find_name_0: { + code: 2304, + category: ts.DiagnosticCategory.Error, + key: "Cannot find name '{0}'." + }, + Module_0_has_no_exported_member_1: { + code: 2305, + category: ts.DiagnosticCategory.Error, + key: "Module '{0}' has no exported member '{1}'." + }, + File_0_is_not_an_external_module: { + code: 2306, + category: ts.DiagnosticCategory.Error, + key: "File '{0}' is not an external module." + }, + Cannot_find_external_module_0: { + code: 2307, + category: ts.DiagnosticCategory.Error, + key: "Cannot find external module '{0}'." + }, + A_module_cannot_have_more_than_one_export_assignment: { + code: 2308, + category: ts.DiagnosticCategory.Error, + key: "A module cannot have more than one export assignment." + }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { + code: 2309, + category: ts.DiagnosticCategory.Error, + key: "An export assignment cannot be used in a module with other exported elements." + }, + Type_0_recursively_references_itself_as_a_base_type: { + code: 2310, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' recursively references itself as a base type." + }, + A_class_may_only_extend_another_class: { + code: 2311, + category: ts.DiagnosticCategory.Error, + key: "A class may only extend another class." + }, + An_interface_may_only_extend_a_class_or_another_interface: { + code: 2312, + category: ts.DiagnosticCategory.Error, + key: "An interface may only extend a class or another interface." + }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { + code: 2313, + category: ts.DiagnosticCategory.Error, + key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." + }, + Generic_type_0_requires_1_type_argument_s: { + code: 2314, + category: ts.DiagnosticCategory.Error, + key: "Generic type '{0}' requires {1} type argument(s)." + }, + Type_0_is_not_generic: { + code: 2315, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' is not generic." + }, + Global_type_0_must_be_a_class_or_interface_type: { + code: 2316, + category: ts.DiagnosticCategory.Error, + key: "Global type '{0}' must be a class or interface type." + }, + Global_type_0_must_have_1_type_parameter_s: { + code: 2317, + category: ts.DiagnosticCategory.Error, + key: "Global type '{0}' must have {1} type parameter(s)." + }, + Cannot_find_global_type_0: { + code: 2318, + category: ts.DiagnosticCategory.Error, + key: "Cannot find global type '{0}'." + }, + Named_property_0_of_types_1_and_2_are_not_identical: { + code: 2319, + category: ts.DiagnosticCategory.Error, + key: "Named property '{0}' of types '{1}' and '{2}' are not identical." + }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { + code: 2320, + category: ts.DiagnosticCategory.Error, + key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." + }, + Excessive_stack_depth_comparing_types_0_and_1: { + code: 2321, + category: ts.DiagnosticCategory.Error, + key: "Excessive stack depth comparing types '{0}' and '{1}'." + }, + Type_0_is_not_assignable_to_type_1: { + code: 2322, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' is not assignable to type '{1}'." + }, + Property_0_is_missing_in_type_1: { + code: 2324, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is missing in type '{1}'." + }, + Property_0_is_private_in_type_1_but_not_in_type_2: { + code: 2325, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is private in type '{1}' but not in type '{2}'." + }, + Types_of_property_0_are_incompatible: { + code: 2326, + category: ts.DiagnosticCategory.Error, + key: "Types of property '{0}' are incompatible." + }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { + code: 2327, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." + }, + Types_of_parameters_0_and_1_are_incompatible: { + code: 2328, + category: ts.DiagnosticCategory.Error, + key: "Types of parameters '{0}' and '{1}' are incompatible." + }, + Index_signature_is_missing_in_type_0: { + code: 2329, + category: ts.DiagnosticCategory.Error, + key: "Index signature is missing in type '{0}'." + }, + Index_signatures_are_incompatible: { + code: 2330, + category: ts.DiagnosticCategory.Error, + key: "Index signatures are incompatible." + }, + this_cannot_be_referenced_in_a_module_body: { + code: 2331, + category: ts.DiagnosticCategory.Error, + key: "'this' cannot be referenced in a module body." + }, + this_cannot_be_referenced_in_current_location: { + code: 2332, + category: ts.DiagnosticCategory.Error, + key: "'this' cannot be referenced in current location." + }, + this_cannot_be_referenced_in_constructor_arguments: { + code: 2333, + category: ts.DiagnosticCategory.Error, + key: "'this' cannot be referenced in constructor arguments." + }, + this_cannot_be_referenced_in_a_static_property_initializer: { + code: 2334, + category: ts.DiagnosticCategory.Error, + key: "'this' cannot be referenced in a static property initializer." + }, + super_can_only_be_referenced_in_a_derived_class: { + code: 2335, + category: ts.DiagnosticCategory.Error, + key: "'super' can only be referenced in a derived class." + }, + super_cannot_be_referenced_in_constructor_arguments: { + code: 2336, + category: ts.DiagnosticCategory.Error, + key: "'super' cannot be referenced in constructor arguments." + }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { + code: 2337, + category: ts.DiagnosticCategory.Error, + key: "Super calls are not permitted outside constructors or in nested functions inside constructors" + }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { + code: 2338, + category: ts.DiagnosticCategory.Error, + key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" + }, + Property_0_does_not_exist_on_type_1: { + code: 2339, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' does not exist on type '{1}'." + }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { + code: 2340, + category: ts.DiagnosticCategory.Error, + key: "Only public and protected methods of the base class are accessible via the 'super' keyword" + }, + Property_0_is_private_and_only_accessible_within_class_1: { + code: 2341, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is private and only accessible within class '{1}'." + }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { + code: 2342, + category: ts.DiagnosticCategory.Error, + key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." + }, + Type_0_does_not_satisfy_the_constraint_1: { + code: 2344, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' does not satisfy the constraint '{1}'." + }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { + code: 2345, + category: ts.DiagnosticCategory.Error, + key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." + }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { + code: 2346, + category: ts.DiagnosticCategory.Error, + key: "Supplied parameters do not match any signature of call target." + }, + Untyped_function_calls_may_not_accept_type_arguments: { + code: 2347, + category: ts.DiagnosticCategory.Error, + key: "Untyped function calls may not accept type arguments." + }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { + code: 2348, + category: ts.DiagnosticCategory.Error, + key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" + }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { + code: 2349, + category: ts.DiagnosticCategory.Error, + key: "Cannot invoke an expression whose type lacks a call signature." + }, + Only_a_void_function_can_be_called_with_the_new_keyword: { + code: 2350, + category: ts.DiagnosticCategory.Error, + key: "Only a void function can be called with the 'new' keyword." + }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { + code: 2351, + category: ts.DiagnosticCategory.Error, + key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." + }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { + code: 2352, + category: ts.DiagnosticCategory.Error, + key: "Neither type '{0}' nor type '{1}' is assignable to the other." + }, + No_best_common_type_exists_among_return_expressions: { + code: 2354, + category: ts.DiagnosticCategory.Error, + key: "No best common type exists among return expressions." + }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2355, + category: ts.DiagnosticCategory.Error, + key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." + }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { + code: 2356, + category: ts.DiagnosticCategory.Error, + key: "An arithmetic operand must be of type 'any', 'number' or an enum type." + }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { + code: 2357, + category: ts.DiagnosticCategory.Error, + key: "The operand of an increment or decrement operator must be a variable, property or indexer." + }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2358, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." + }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { + code: 2359, + category: ts.DiagnosticCategory.Error, + key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." + }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { + code: 2360, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." + }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2361, + category: ts.DiagnosticCategory.Error, + key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" + }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2362, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2363, + category: ts.DiagnosticCategory.Error, + key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + Invalid_left_hand_side_of_assignment_expression: { + code: 2364, + category: ts.DiagnosticCategory.Error, + key: "Invalid left-hand side of assignment expression." + }, + Operator_0_cannot_be_applied_to_types_1_and_2: { + code: 2365, + category: ts.DiagnosticCategory.Error, + key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." + }, + Type_parameter_name_cannot_be_0: { + code: 2368, + category: ts.DiagnosticCategory.Error, + key: "Type parameter name cannot be '{0}'" + }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { + code: 2369, + category: ts.DiagnosticCategory.Error, + key: "A parameter property is only allowed in a constructor implementation." + }, + A_rest_parameter_must_be_of_an_array_type: { + code: 2370, + category: ts.DiagnosticCategory.Error, + key: "A rest parameter must be of an array type." + }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { + code: 2371, + category: ts.DiagnosticCategory.Error, + key: "A parameter initializer is only allowed in a function or constructor implementation." + }, + Parameter_0_cannot_be_referenced_in_its_initializer: { + code: 2372, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' cannot be referenced in its initializer." + }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { + code: 2373, + category: ts.DiagnosticCategory.Error, + key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." + }, + Duplicate_string_index_signature: { + code: 2374, + category: ts.DiagnosticCategory.Error, + key: "Duplicate string index signature." + }, + Duplicate_number_index_signature: { + code: 2375, + category: ts.DiagnosticCategory.Error, + key: "Duplicate number index signature." + }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { + code: 2376, + category: ts.DiagnosticCategory.Error, + key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." + }, + Constructors_for_derived_classes_must_contain_a_super_call: { + code: 2377, + category: ts.DiagnosticCategory.Error, + key: "Constructors for derived classes must contain a 'super' call." + }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2378, + category: ts.DiagnosticCategory.Error, + key: "A 'get' accessor must return a value or consist of a single 'throw' statement." + }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { + code: 2379, + category: ts.DiagnosticCategory.Error, + key: "Getter and setter accessors do not agree in visibility." + }, + get_and_set_accessor_must_have_the_same_type: { + code: 2380, + category: ts.DiagnosticCategory.Error, + key: "'get' and 'set' accessor must have the same type." + }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { + code: 2381, + category: ts.DiagnosticCategory.Error, + key: "A signature with an implementation cannot use a string literal type." + }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { + code: 2382, + category: ts.DiagnosticCategory.Error, + key: "Specialized overload signature is not assignable to any non-specialized signature." + }, + Overload_signatures_must_all_be_exported_or_not_exported: { + code: 2383, + category: ts.DiagnosticCategory.Error, + key: "Overload signatures must all be exported or not exported." + }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { + code: 2384, + category: ts.DiagnosticCategory.Error, + key: "Overload signatures must all be ambient or non-ambient." + }, + Overload_signatures_must_all_be_public_private_or_protected: { + code: 2385, + category: ts.DiagnosticCategory.Error, + key: "Overload signatures must all be public, private or protected." + }, + Overload_signatures_must_all_be_optional_or_required: { + code: 2386, + category: ts.DiagnosticCategory.Error, + key: "Overload signatures must all be optional or required." + }, + Function_overload_must_be_static: { + code: 2387, + category: ts.DiagnosticCategory.Error, + key: "Function overload must be static." + }, + Function_overload_must_not_be_static: { + code: 2388, + category: ts.DiagnosticCategory.Error, + key: "Function overload must not be static." + }, + Function_implementation_name_must_be_0: { + code: 2389, + category: ts.DiagnosticCategory.Error, + key: "Function implementation name must be '{0}'." + }, + Constructor_implementation_is_missing: { + code: 2390, + category: ts.DiagnosticCategory.Error, + key: "Constructor implementation is missing." + }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { + code: 2391, + category: ts.DiagnosticCategory.Error, + key: "Function implementation is missing or not immediately following the declaration." + }, + Multiple_constructor_implementations_are_not_allowed: { + code: 2392, + category: ts.DiagnosticCategory.Error, + key: "Multiple constructor implementations are not allowed." + }, + Duplicate_function_implementation: { + code: 2393, + category: ts.DiagnosticCategory.Error, + key: "Duplicate function implementation." + }, + Overload_signature_is_not_compatible_with_function_implementation: { + code: 2394, + category: ts.DiagnosticCategory.Error, + key: "Overload signature is not compatible with function implementation." + }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { + code: 2395, + category: ts.DiagnosticCategory.Error, + key: "Individual declarations in merged declaration {0} must be all exported or all local." + }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { + code: 2396, + category: ts.DiagnosticCategory.Error, + key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." + }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { + code: 2399, + category: ts.DiagnosticCategory.Error, + key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." + }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { + code: 2400, + category: ts.DiagnosticCategory.Error, + key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." + }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { + code: 2401, + category: ts.DiagnosticCategory.Error, + key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." + }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { + code: 2402, + category: ts.DiagnosticCategory.Error, + key: "Expression resolves to '_super' that compiler uses to capture base class reference." + }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { + code: 2403, + category: ts.DiagnosticCategory.Error, + key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." + }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { + code: 2404, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...in' statement cannot use a type annotation." + }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { + code: 2405, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." + }, + Invalid_left_hand_side_in_for_in_statement: { + code: 2406, + category: ts.DiagnosticCategory.Error, + key: "Invalid left-hand side in 'for...in' statement." + }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2407, + category: ts.DiagnosticCategory.Error, + key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." + }, + Setters_cannot_return_a_value: { + code: 2408, + category: ts.DiagnosticCategory.Error, + key: "Setters cannot return a value." + }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { + code: 2409, + category: ts.DiagnosticCategory.Error, + key: "Return type of constructor signature must be assignable to the instance type of the class" + }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { + code: 2410, + category: ts.DiagnosticCategory.Error, + key: "All symbols within a 'with' block will be resolved to 'any'." + }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { + code: 2411, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." + }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { + code: 2412, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." + }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { + code: 2413, + category: ts.DiagnosticCategory.Error, + key: "Numeric index type '{0}' is not assignable to string index type '{1}'." + }, + Class_name_cannot_be_0: { + code: 2414, + category: ts.DiagnosticCategory.Error, + key: "Class name cannot be '{0}'" + }, + Class_0_incorrectly_extends_base_class_1: { + code: 2415, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' incorrectly extends base class '{1}'." + }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { + code: 2417, + category: ts.DiagnosticCategory.Error, + key: "Class static side '{0}' incorrectly extends base class static side '{1}'." + }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { + code: 2419, + category: ts.DiagnosticCategory.Error, + key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." + }, + Class_0_incorrectly_implements_interface_1: { + code: 2420, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' incorrectly implements interface '{1}'." + }, + A_class_may_only_implement_another_class_or_interface: { + code: 2422, + category: ts.DiagnosticCategory.Error, + key: "A class may only implement another class or interface." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { + code: 2423, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { + code: 2424, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." + }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2425, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." + }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2426, + category: ts.DiagnosticCategory.Error, + key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." + }, + Interface_name_cannot_be_0: { + code: 2427, + category: ts.DiagnosticCategory.Error, + key: "Interface name cannot be '{0}'" + }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { + code: 2428, + category: ts.DiagnosticCategory.Error, + key: "All declarations of an interface must have identical type parameters." + }, + Interface_0_incorrectly_extends_interface_1: { + code: 2430, + category: ts.DiagnosticCategory.Error, + key: "Interface '{0}' incorrectly extends interface '{1}'." + }, + Enum_name_cannot_be_0: { + code: 2431, + category: ts.DiagnosticCategory.Error, + key: "Enum name cannot be '{0}'" + }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { + code: 2432, + category: ts.DiagnosticCategory.Error, + key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." + }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { + code: 2433, + category: ts.DiagnosticCategory.Error, + key: "A module declaration cannot be in a different file from a class or function with which it is merged" + }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { + code: 2434, + category: ts.DiagnosticCategory.Error, + key: "A module declaration cannot be located prior to a class or function with which it is merged" + }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { + code: 2435, + category: ts.DiagnosticCategory.Error, + key: "Ambient external modules cannot be nested in other modules." + }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { + code: 2436, + category: ts.DiagnosticCategory.Error, + key: "Ambient external module declaration cannot specify relative module name." + }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { + code: 2437, + category: ts.DiagnosticCategory.Error, + key: "Module '{0}' is hidden by a local declaration with the same name" + }, + Import_name_cannot_be_0: { + code: 2438, + category: ts.DiagnosticCategory.Error, + key: "Import name cannot be '{0}'" + }, + Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { + code: 2439, + category: ts.DiagnosticCategory.Error, + key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." + }, + Import_declaration_conflicts_with_local_declaration_of_0: { + code: 2440, + category: ts.DiagnosticCategory.Error, + key: "Import declaration conflicts with local declaration of '{0}'" + }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { + code: 2441, + category: ts.DiagnosticCategory.Error, + key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." + }, + Types_have_separate_declarations_of_a_private_property_0: { + code: 2442, + category: ts.DiagnosticCategory.Error, + key: "Types have separate declarations of a private property '{0}'." + }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { + code: 2443, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." + }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { + code: 2444, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." + }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { + code: 2445, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." + }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { + code: 2446, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." + }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { + code: 2447, + category: ts.DiagnosticCategory.Error, + key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." + }, + Block_scoped_variable_0_used_before_its_declaration: { + code: 2448, + category: ts.DiagnosticCategory.Error, + key: "Block-scoped variable '{0}' used before its declaration." + }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { + code: 2449, + category: ts.DiagnosticCategory.Error, + key: "The operand of an increment or decrement operator cannot be a constant." + }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { + code: 2450, + category: ts.DiagnosticCategory.Error, + key: "Left-hand side of assignment expression cannot be a constant." + }, + Cannot_redeclare_block_scoped_variable_0: { + code: 2451, + category: ts.DiagnosticCategory.Error, + key: "Cannot redeclare block-scoped variable '{0}'." + }, + An_enum_member_cannot_have_a_numeric_name: { + code: 2452, + category: ts.DiagnosticCategory.Error, + key: "An enum member cannot have a numeric name." + }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { + code: 2453, + category: ts.DiagnosticCategory.Error, + key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." + }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { + code: 2455, + category: ts.DiagnosticCategory.Error, + key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." + }, + Type_alias_0_circularly_references_itself: { + code: 2456, + category: ts.DiagnosticCategory.Error, + key: "Type alias '{0}' circularly references itself." + }, + Type_alias_name_cannot_be_0: { + code: 2457, + category: ts.DiagnosticCategory.Error, + key: "Type alias name cannot be '{0}'" + }, + An_AMD_module_cannot_have_multiple_name_assignments: { + code: 2458, + category: ts.DiagnosticCategory.Error, + key: "An AMD module cannot have multiple name assignments." + }, + Type_0_has_no_property_1_and_no_string_index_signature: { + code: 2459, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' has no property '{1}' and no string index signature." + }, + Type_0_has_no_property_1: { + code: 2460, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' has no property '{1}'." + }, + Type_0_is_not_an_array_type: { + code: 2461, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' is not an array type." + }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { + code: 2462, + category: ts.DiagnosticCategory.Error, + key: "A rest element must be last in an array destructuring pattern" + }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { + code: 2463, + category: ts.DiagnosticCategory.Error, + key: "A binding pattern parameter cannot be optional in an implementation signature." + }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { + code: 2464, + category: ts.DiagnosticCategory.Error, + key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." + }, + this_cannot_be_referenced_in_a_computed_property_name: { + code: 2465, + category: ts.DiagnosticCategory.Error, + key: "'this' cannot be referenced in a computed property name." + }, + super_cannot_be_referenced_in_a_computed_property_name: { + code: 2466, + category: ts.DiagnosticCategory.Error, + key: "'super' cannot be referenced in a computed property name." + }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { + code: 2467, + category: ts.DiagnosticCategory.Error, + key: "A computed property name cannot reference a type parameter from its containing type." + }, + Cannot_find_global_value_0: { + code: 2468, + category: ts.DiagnosticCategory.Error, + key: "Cannot find global value '{0}'." + }, + The_0_operator_cannot_be_applied_to_type_symbol: { + code: 2469, + category: ts.DiagnosticCategory.Error, + key: "The '{0}' operator cannot be applied to type 'symbol'." + }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { + code: 2470, + category: ts.DiagnosticCategory.Error, + key: "'Symbol' reference does not refer to the global Symbol constructor object." + }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { + code: 2471, + category: ts.DiagnosticCategory.Error, + key: "A computed property name of the form '{0}' must be of type 'symbol'." + }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 2472, + category: ts.DiagnosticCategory.Error, + key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." + }, + Enum_declarations_must_all_be_const_or_non_const: { + code: 2473, + category: ts.DiagnosticCategory.Error, + key: "Enum declarations must all be const or non-const." + }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { + code: 2474, + category: ts.DiagnosticCategory.Error, + key: "In 'const' enum declarations member initializer must be constant expression." + }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { + code: 2475, + category: ts.DiagnosticCategory.Error, + key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." + }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { + code: 2476, + category: ts.DiagnosticCategory.Error, + key: "A const enum member can only be accessed using a string literal." + }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { + code: 2477, + category: ts.DiagnosticCategory.Error, + key: "'const' enum member initializer was evaluated to a non-finite value." + }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { + code: 2478, + category: ts.DiagnosticCategory.Error, + key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." + }, + Property_0_does_not_exist_on_const_enum_1: { + code: 2479, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' does not exist on 'const' enum '{1}'." + }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { + code: 2480, + category: ts.DiagnosticCategory.Error, + key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." + }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { + code: 2481, + category: ts.DiagnosticCategory.Error, + key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." + }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { + code: 2483, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...of' statement cannot use a type annotation." + }, + Export_declaration_conflicts_with_exported_declaration_of_0: { + code: 2484, + category: ts.DiagnosticCategory.Error, + key: "Export declaration conflicts with exported declaration of '{0}'" + }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { + code: 2485, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { + code: 2486, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." + }, + Invalid_left_hand_side_in_for_of_statement: { + code: 2487, + category: ts.DiagnosticCategory.Error, + key: "Invalid left-hand side in 'for...of' statement." + }, + The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { + code: 2488, + category: ts.DiagnosticCategory.Error, + key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." + }, + The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { + code: 2489, + category: ts.DiagnosticCategory.Error, + key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." + }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { + code: 2490, + category: ts.DiagnosticCategory.Error, + key: "The type returned by the 'next()' method of an iterator must have a 'value' property." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { + code: 2491, + category: ts.DiagnosticCategory.Error, + key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." + }, + Cannot_redeclare_identifier_0_in_catch_clause: { + code: 2492, + category: ts.DiagnosticCategory.Error, + key: "Cannot redeclare identifier '{0}' in catch clause" + }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { + code: 2493, + category: ts.DiagnosticCategory.Error, + key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." + }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { + code: 2494, + category: ts.DiagnosticCategory.Error, + key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." + }, + Type_0_is_not_an_array_type_or_a_string_type: { + code: 2495, + category: ts.DiagnosticCategory.Error, + key: "Type '{0}' is not an array type or a string type." + }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { + code: 2496, + category: ts.DiagnosticCategory.Error, + key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." + }, + External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { + code: 2497, + category: ts.DiagnosticCategory.Error, + key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." + }, + External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { + code: 2498, + category: ts.DiagnosticCategory.Error, + key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." + }, + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { + code: 2499, + category: ts.DiagnosticCategory.Error, + key: "An interface can only extend an identifier/qualified-name with optional type arguments." + }, + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { + code: 2500, + category: ts.DiagnosticCategory.Error, + key: "A class can only implement an identifier/qualified-name with optional type arguments." + }, + Import_declaration_0_is_using_private_name_1: { + code: 4000, + category: ts.DiagnosticCategory.Error, + key: "Import declaration '{0}' is using private name '{1}'." + }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4002, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4004, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4006, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4008, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4010, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4012, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4014, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4016, + category: ts.DiagnosticCategory.Error, + key: "Type parameter '{0}' of exported function has or is using private name '{1}'." + }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4019, + category: ts.DiagnosticCategory.Error, + key: "Implements clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4020, + category: ts.DiagnosticCategory.Error, + key: "Extends clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { + code: 4022, + category: ts.DiagnosticCategory.Error, + key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." + }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4023, + category: ts.DiagnosticCategory.Error, + key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." + }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { + code: 4024, + category: ts.DiagnosticCategory.Error, + key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." + }, + Exported_variable_0_has_or_is_using_private_name_1: { + code: 4025, + category: ts.DiagnosticCategory.Error, + key: "Exported variable '{0}' has or is using private name '{1}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4026, + category: ts.DiagnosticCategory.Error, + key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4027, + category: ts.DiagnosticCategory.Error, + key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4028, + category: ts.DiagnosticCategory.Error, + key: "Public static property '{0}' of exported class has or is using private name '{1}'." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4029, + category: ts.DiagnosticCategory.Error, + key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4030, + category: ts.DiagnosticCategory.Error, + key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4031, + category: ts.DiagnosticCategory.Error, + key: "Public property '{0}' of exported class has or is using private name '{1}'." + }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4032, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." + }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4033, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' of exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4034, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4035, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4036, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4037, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4038, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4039, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4040, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4041, + category: ts.DiagnosticCategory.Error, + key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4042, + category: ts.DiagnosticCategory.Error, + key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4043, + category: ts.DiagnosticCategory.Error, + key: "Return type of public property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4044, + category: ts.DiagnosticCategory.Error, + key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4045, + category: ts.DiagnosticCategory.Error, + key: "Return type of constructor signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4046, + category: ts.DiagnosticCategory.Error, + key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4047, + category: ts.DiagnosticCategory.Error, + key: "Return type of call signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4048, + category: ts.DiagnosticCategory.Error, + key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4049, + category: ts.DiagnosticCategory.Error, + key: "Return type of index signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4050, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4051, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4052, + category: ts.DiagnosticCategory.Error, + key: "Return type of public static method from exported class has or is using private name '{0}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4053, + category: ts.DiagnosticCategory.Error, + key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4054, + category: ts.DiagnosticCategory.Error, + key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4055, + category: ts.DiagnosticCategory.Error, + key: "Return type of public method from exported class has or is using private name '{0}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4056, + category: ts.DiagnosticCategory.Error, + key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { + code: 4057, + category: ts.DiagnosticCategory.Error, + key: "Return type of method from exported interface has or is using private name '{0}'." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4058, + category: ts.DiagnosticCategory.Error, + key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { + code: 4059, + category: ts.DiagnosticCategory.Error, + key: "Return type of exported function has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { + code: 4060, + category: ts.DiagnosticCategory.Error, + key: "Return type of exported function has or is using private name '{0}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4061, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4062, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { + code: 4063, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4064, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4065, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4066, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4067, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4068, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4069, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4070, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4071, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4072, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4073, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4074, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4075, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4076, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { + code: 4077, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4078, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' of exported function has or is using private name '{1}'." + }, + Exported_type_alias_0_has_or_is_using_private_name_1: { + code: 4081, + category: ts.DiagnosticCategory.Error, + key: "Exported type alias '{0}' has or is using private name '{1}'." + }, + Default_export_of_the_module_has_or_is_using_private_name_0: { + code: 4082, + category: ts.DiagnosticCategory.Error, + key: "Default export of the module has or is using private name '{0}'." + }, + Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { + code: 4091, + category: ts.DiagnosticCategory.Error, + key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." + }, + The_current_host_does_not_support_the_0_option: { + code: 5001, + category: ts.DiagnosticCategory.Error, + key: "The current host does not support the '{0}' option." + }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { + code: 5009, + category: ts.DiagnosticCategory.Error, + key: "Cannot find the common subdirectory path for the input files." + }, + Cannot_read_file_0_Colon_1: { + code: 5012, + category: ts.DiagnosticCategory.Error, + key: "Cannot read file '{0}': {1}" + }, + Unsupported_file_encoding: { + code: 5013, + category: ts.DiagnosticCategory.Error, + key: "Unsupported file encoding." + }, + Unknown_compiler_option_0: { + code: 5023, + category: ts.DiagnosticCategory.Error, + key: "Unknown compiler option '{0}'." + }, + Compiler_option_0_requires_a_value_of_type_1: { + code: 5024, + category: ts.DiagnosticCategory.Error, + key: "Compiler option '{0}' requires a value of type {1}." + }, + Could_not_write_file_0_Colon_1: { + code: 5033, + category: ts.DiagnosticCategory.Error, + key: "Could not write file '{0}': {1}" + }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5038, + category: ts.DiagnosticCategory.Error, + key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5039, + category: ts.DiagnosticCategory.Error, + key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { + code: 5040, + category: ts.DiagnosticCategory.Error, + key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." + }, + Option_noEmit_cannot_be_specified_with_option_declaration: { + code: 5041, + category: ts.DiagnosticCategory.Error, + key: "Option 'noEmit' cannot be specified with option 'declaration'." + }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { + code: 5042, + category: ts.DiagnosticCategory.Error, + key: "Option 'project' cannot be mixed with source files on a command line." + }, + Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { + code: 5043, + category: ts.DiagnosticCategory.Error, + key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." + }, + Option_declaration_cannot_be_specified_with_option_separateCompilation: { + code: 5044, + category: ts.DiagnosticCategory.Error, + key: "Option 'declaration' cannot be specified with option 'separateCompilation'." + }, + Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { + code: 5045, + category: ts.DiagnosticCategory.Error, + key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." + }, + Option_out_cannot_be_specified_with_option_separateCompilation: { + code: 5046, + category: ts.DiagnosticCategory.Error, + key: "Option 'out' cannot be specified with option 'separateCompilation'." + }, + Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { + code: 5047, + category: ts.DiagnosticCategory.Error, + key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." + }, + Concatenate_and_emit_output_to_single_file: { + code: 6001, + category: ts.DiagnosticCategory.Message, + key: "Concatenate and emit output to single file." + }, + Generates_corresponding_d_ts_file: { + code: 6002, + category: ts.DiagnosticCategory.Message, + key: "Generates corresponding '.d.ts' file." + }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { + code: 6003, + category: ts.DiagnosticCategory.Message, + key: "Specifies the location where debugger should locate map files instead of generated locations." + }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { + code: 6004, + category: ts.DiagnosticCategory.Message, + key: "Specifies the location where debugger should locate TypeScript files instead of source locations." + }, + Watch_input_files: { + code: 6005, + category: ts.DiagnosticCategory.Message, + key: "Watch input files." + }, + Redirect_output_structure_to_the_directory: { + code: 6006, + category: ts.DiagnosticCategory.Message, + key: "Redirect output structure to the directory." + }, + Do_not_erase_const_enum_declarations_in_generated_code: { + code: 6007, + category: ts.DiagnosticCategory.Message, + key: "Do not erase const enum declarations in generated code." + }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { + code: 6008, + category: ts.DiagnosticCategory.Message, + key: "Do not emit outputs if any type checking errors were reported." + }, + Do_not_emit_comments_to_output: { + code: 6009, + category: ts.DiagnosticCategory.Message, + key: "Do not emit comments to output." + }, + Do_not_emit_outputs: { + code: 6010, + category: ts.DiagnosticCategory.Message, + key: "Do not emit outputs." + }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { + code: 6015, + category: ts.DiagnosticCategory.Message, + key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" + }, + Specify_module_code_generation_Colon_commonjs_or_amd: { + code: 6016, + category: ts.DiagnosticCategory.Message, + key: "Specify module code generation: 'commonjs' or 'amd'" + }, + Print_this_message: { + code: 6017, + category: ts.DiagnosticCategory.Message, + key: "Print this message." + }, + Print_the_compiler_s_version: { + code: 6019, + category: ts.DiagnosticCategory.Message, + key: "Print the compiler's version." + }, + Compile_the_project_in_the_given_directory: { + code: 6020, + category: ts.DiagnosticCategory.Message, + key: "Compile the project in the given directory." + }, + Syntax_Colon_0: { + code: 6023, + category: ts.DiagnosticCategory.Message, + key: "Syntax: {0}" + }, + options: { + code: 6024, + category: ts.DiagnosticCategory.Message, + key: "options" + }, + file: { + code: 6025, + category: ts.DiagnosticCategory.Message, + key: "file" + }, + Examples_Colon_0: { + code: 6026, + category: ts.DiagnosticCategory.Message, + key: "Examples: {0}" + }, + Options_Colon: { + code: 6027, + category: ts.DiagnosticCategory.Message, + key: "Options:" + }, + Version_0: { + code: 6029, + category: ts.DiagnosticCategory.Message, + key: "Version {0}" + }, + Insert_command_line_options_and_files_from_a_file: { + code: 6030, + category: ts.DiagnosticCategory.Message, + key: "Insert command line options and files from a file." + }, + File_change_detected_Starting_incremental_compilation: { + code: 6032, + category: ts.DiagnosticCategory.Message, + key: "File change detected. Starting incremental compilation..." + }, + KIND: { + code: 6034, + category: ts.DiagnosticCategory.Message, + key: "KIND" + }, + FILE: { + code: 6035, + category: ts.DiagnosticCategory.Message, + key: "FILE" + }, + VERSION: { + code: 6036, + category: ts.DiagnosticCategory.Message, + key: "VERSION" + }, + LOCATION: { + code: 6037, + category: ts.DiagnosticCategory.Message, + key: "LOCATION" + }, + DIRECTORY: { + code: 6038, + category: ts.DiagnosticCategory.Message, + key: "DIRECTORY" + }, + Compilation_complete_Watching_for_file_changes: { + code: 6042, + category: ts.DiagnosticCategory.Message, + key: "Compilation complete. Watching for file changes." + }, + Generates_corresponding_map_file: { + code: 6043, + category: ts.DiagnosticCategory.Message, + key: "Generates corresponding '.map' file." + }, + Compiler_option_0_expects_an_argument: { + code: 6044, + category: ts.DiagnosticCategory.Error, + key: "Compiler option '{0}' expects an argument." + }, + Unterminated_quoted_string_in_response_file_0: { + code: 6045, + category: ts.DiagnosticCategory.Error, + key: "Unterminated quoted string in response file '{0}'." + }, + Argument_for_module_option_must_be_commonjs_or_amd: { + code: 6046, + category: ts.DiagnosticCategory.Error, + key: "Argument for '--module' option must be 'commonjs' or 'amd'." + }, + Argument_for_target_option_must_be_es3_es5_or_es6: { + code: 6047, + category: ts.DiagnosticCategory.Error, + key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." + }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { + code: 6048, + category: ts.DiagnosticCategory.Error, + key: "Locale must be of the form or -. For example '{0}' or '{1}'." + }, + Unsupported_locale_0: { + code: 6049, + category: ts.DiagnosticCategory.Error, + key: "Unsupported locale '{0}'." + }, + Unable_to_open_file_0: { + code: 6050, + category: ts.DiagnosticCategory.Error, + key: "Unable to open file '{0}'." + }, + Corrupted_locale_file_0: { + code: 6051, + category: ts.DiagnosticCategory.Error, + key: "Corrupted locale file {0}." + }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { + code: 6052, + category: ts.DiagnosticCategory.Message, + key: "Raise error on expressions and declarations with an implied 'any' type." + }, + File_0_not_found: { + code: 6053, + category: ts.DiagnosticCategory.Error, + key: "File '{0}' not found." + }, + File_0_must_have_extension_ts_or_d_ts: { + code: 6054, + category: ts.DiagnosticCategory.Error, + key: "File '{0}' must have extension '.ts' or '.d.ts'." + }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { + code: 6055, + category: ts.DiagnosticCategory.Message, + key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." + }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { + code: 6056, + category: ts.DiagnosticCategory.Message, + key: "Do not emit declarations for code that has an '@internal' annotation." + }, + Preserve_new_lines_when_emitting_code: { + code: 6057, + category: ts.DiagnosticCategory.Message, + key: "Preserve new-lines when emitting code." + }, + Variable_0_implicitly_has_an_1_type: { + code: 7005, + category: ts.DiagnosticCategory.Error, + key: "Variable '{0}' implicitly has an '{1}' type." + }, + Parameter_0_implicitly_has_an_1_type: { + code: 7006, + category: ts.DiagnosticCategory.Error, + key: "Parameter '{0}' implicitly has an '{1}' type." + }, + Member_0_implicitly_has_an_1_type: { + code: 7008, + category: ts.DiagnosticCategory.Error, + key: "Member '{0}' implicitly has an '{1}' type." + }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { + code: 7009, + category: ts.DiagnosticCategory.Error, + key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." + }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { + code: 7010, + category: ts.DiagnosticCategory.Error, + key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." + }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { + code: 7011, + category: ts.DiagnosticCategory.Error, + key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." + }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7013, + category: ts.DiagnosticCategory.Error, + key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { + code: 7016, + category: ts.DiagnosticCategory.Error, + key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." + }, + Index_signature_of_object_type_implicitly_has_an_any_type: { + code: 7017, + category: ts.DiagnosticCategory.Error, + key: "Index signature of object type implicitly has an 'any' type." + }, + Object_literal_s_property_0_implicitly_has_an_1_type: { + code: 7018, + category: ts.DiagnosticCategory.Error, + key: "Object literal's property '{0}' implicitly has an '{1}' type." + }, + Rest_parameter_0_implicitly_has_an_any_type: { + code: 7019, + category: ts.DiagnosticCategory.Error, + key: "Rest parameter '{0}' implicitly has an 'any[]' type." + }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7020, + category: ts.DiagnosticCategory.Error, + key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { + code: 7021, + category: ts.DiagnosticCategory.Error, + key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." + }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { + code: 7022, + category: ts.DiagnosticCategory.Error, + key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." + }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7023, + category: ts.DiagnosticCategory.Error, + key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7024, + category: ts.DiagnosticCategory.Error, + key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + You_cannot_rename_this_element: { + code: 8000, + category: ts.DiagnosticCategory.Error, + key: "You cannot rename this element." + }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { + code: 8001, + category: ts.DiagnosticCategory.Error, + key: "You cannot rename elements that are defined in the standard TypeScript library." + }, + yield_expressions_are_not_currently_supported: { + code: 9000, + category: ts.DiagnosticCategory.Error, + key: "'yield' expressions are not currently supported." + }, + Generators_are_not_currently_supported: { + code: 9001, + category: ts.DiagnosticCategory.Error, + key: "Generators are not currently supported." + }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { + code: 9002, + category: ts.DiagnosticCategory.Error, + key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." + }, + class_expressions_are_not_currently_supported: { + code: 9003, + category: ts.DiagnosticCategory.Error, + key: "'class' expressions are not currently supported." + }, + class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { + code: 9004, + category: ts.DiagnosticCategory.Error, + key: "'class' declarations are only supported directly inside a module or as a top level declaration." + } }; })(ts || (ts = {})); +/// +/// var ts; (function (ts) { var textToToken = { @@ -1514,10 +3584,2806 @@ var ts; "^=": 64, "@": 52 }; - var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1610, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1786, + 1788, + 1808, + 1808, + 1810, + 1836, + 1920, + 1957, + 2309, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2784, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3294, + 3294, + 3296, + 3297, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3424, + 3425, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3805, + 3840, + 3840, + 3904, + 3911, + 3913, + 3946, + 3976, + 3979, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4176, + 4181, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6067, + 6176, + 6263, + 6272, + 6312, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8319, + 8319, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12445, + 12446, + 12449, + 12538, + 12540, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES3IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 768, + 846, + 864, + 866, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1155, + 1158, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1441, + 1443, + 1465, + 1467, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1476, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1621, + 1632, + 1641, + 1648, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1773, + 1776, + 1788, + 1808, + 1836, + 1840, + 1866, + 1920, + 1968, + 2305, + 2307, + 2309, + 2361, + 2364, + 2381, + 2384, + 2388, + 2392, + 2403, + 2406, + 2415, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2492, + 2494, + 2500, + 2503, + 2504, + 2507, + 2509, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2562, + 2562, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2649, + 2652, + 2654, + 2654, + 2662, + 2676, + 2689, + 2691, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2784, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2876, + 2883, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2913, + 2918, + 2927, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3031, + 3031, + 3047, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3134, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3168, + 3169, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3262, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3297, + 3302, + 3311, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3390, + 3395, + 3398, + 3400, + 3402, + 3405, + 3415, + 3415, + 3424, + 3425, + 3430, + 3439, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3805, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3946, + 3953, + 3972, + 3974, + 3979, + 3984, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4140, + 4146, + 4150, + 4153, + 4160, + 4169, + 4176, + 4185, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 4969, + 4977, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6099, + 6112, + 6121, + 6160, + 6169, + 6176, + 6263, + 6272, + 6313, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8255, + 8256, + 8319, + 8319, + 8400, + 8412, + 8417, + 8417, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12441, + 12442, + 12445, + 12446, + 12449, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65056, + 65059, + 65075, + 65076, + 65101, + 65103, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65381, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 880, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1568, + 1610, + 1646, + 1647, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1774, + 1775, + 1786, + 1788, + 1791, + 1791, + 1808, + 1808, + 1810, + 1839, + 1869, + 1957, + 1969, + 1969, + 1994, + 2026, + 2036, + 2037, + 2042, + 2042, + 2048, + 2069, + 2074, + 2074, + 2084, + 2084, + 2088, + 2088, + 2112, + 2136, + 2208, + 2208, + 2210, + 2220, + 2308, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2417, + 2423, + 2425, + 2431, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2493, + 2493, + 2510, + 2510, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2785, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2929, + 2929, + 2947, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3024, + 3024, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3133, + 3160, + 3161, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3261, + 3261, + 3294, + 3294, + 3296, + 3297, + 3313, + 3314, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3389, + 3406, + 3406, + 3424, + 3425, + 3450, + 3455, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3807, + 3840, + 3840, + 3904, + 3911, + 3913, + 3948, + 3976, + 3980, + 4096, + 4138, + 4159, + 4159, + 4176, + 4181, + 4186, + 4189, + 4193, + 4193, + 4197, + 4198, + 4206, + 4208, + 4213, + 4225, + 4238, + 4238, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5905, + 5920, + 5937, + 5952, + 5969, + 5984, + 5996, + 5998, + 6000, + 6016, + 6067, + 6103, + 6103, + 6108, + 6108, + 6176, + 6263, + 6272, + 6312, + 6314, + 6314, + 6320, + 6389, + 6400, + 6428, + 6480, + 6509, + 6512, + 6516, + 6528, + 6571, + 6593, + 6599, + 6656, + 6678, + 6688, + 6740, + 6823, + 6823, + 6917, + 6963, + 6981, + 6987, + 7043, + 7072, + 7086, + 7087, + 7098, + 7141, + 7168, + 7203, + 7245, + 7247, + 7258, + 7293, + 7401, + 7404, + 7406, + 7409, + 7413, + 7414, + 7424, + 7615, + 7680, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11502, + 11506, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11648, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11823, + 11823, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42527, + 42538, + 42539, + 42560, + 42606, + 42623, + 42647, + 42656, + 42735, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43009, + 43011, + 43013, + 43015, + 43018, + 43020, + 43042, + 43072, + 43123, + 43138, + 43187, + 43250, + 43255, + 43259, + 43259, + 43274, + 43301, + 43312, + 43334, + 43360, + 43388, + 43396, + 43442, + 43471, + 43471, + 43520, + 43560, + 43584, + 43586, + 43588, + 43595, + 43616, + 43638, + 43642, + 43642, + 43648, + 43695, + 43697, + 43697, + 43701, + 43702, + 43705, + 43709, + 43712, + 43712, + 43714, + 43714, + 43739, + 43741, + 43744, + 43754, + 43762, + 43764, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44002, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 768, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1155, + 1159, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1477, + 1479, + 1479, + 1488, + 1514, + 1520, + 1522, + 1552, + 1562, + 1568, + 1641, + 1646, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1788, + 1791, + 1791, + 1808, + 1866, + 1869, + 1969, + 1984, + 2037, + 2042, + 2042, + 2048, + 2093, + 2112, + 2139, + 2208, + 2208, + 2210, + 2220, + 2276, + 2302, + 2304, + 2403, + 2406, + 2415, + 2417, + 2423, + 2425, + 2431, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2500, + 2503, + 2504, + 2507, + 2510, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2561, + 2563, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2641, + 2641, + 2649, + 2652, + 2654, + 2654, + 2662, + 2677, + 2689, + 2691, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2787, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2876, + 2884, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2915, + 2918, + 2927, + 2929, + 2929, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3024, + 3024, + 3031, + 3031, + 3046, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3160, + 3161, + 3168, + 3171, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3260, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3299, + 3302, + 3311, + 3313, + 3314, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3396, + 3398, + 3400, + 3402, + 3406, + 3415, + 3415, + 3424, + 3427, + 3430, + 3439, + 3450, + 3455, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3807, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3948, + 3953, + 3972, + 3974, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4169, + 4176, + 4253, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4957, + 4959, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5908, + 5920, + 5940, + 5952, + 5971, + 5984, + 5996, + 5998, + 6000, + 6002, + 6003, + 6016, + 6099, + 6103, + 6103, + 6108, + 6109, + 6112, + 6121, + 6155, + 6157, + 6160, + 6169, + 6176, + 6263, + 6272, + 6314, + 6320, + 6389, + 6400, + 6428, + 6432, + 6443, + 6448, + 6459, + 6470, + 6509, + 6512, + 6516, + 6528, + 6571, + 6576, + 6601, + 6608, + 6617, + 6656, + 6683, + 6688, + 6750, + 6752, + 6780, + 6783, + 6793, + 6800, + 6809, + 6823, + 6823, + 6912, + 6987, + 6992, + 7001, + 7019, + 7027, + 7040, + 7155, + 7168, + 7223, + 7232, + 7241, + 7245, + 7293, + 7376, + 7378, + 7380, + 7414, + 7424, + 7654, + 7676, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8204, + 8205, + 8255, + 8256, + 8276, + 8276, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8400, + 8412, + 8417, + 8417, + 8421, + 8432, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11647, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11744, + 11775, + 11823, + 11823, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12441, + 12442, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42539, + 42560, + 42607, + 42612, + 42621, + 42623, + 42647, + 42655, + 42737, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43047, + 43072, + 43123, + 43136, + 43204, + 43216, + 43225, + 43232, + 43255, + 43259, + 43259, + 43264, + 43309, + 43312, + 43347, + 43360, + 43388, + 43392, + 43456, + 43471, + 43481, + 43520, + 43574, + 43584, + 43597, + 43600, + 43609, + 43616, + 43638, + 43642, + 43643, + 43648, + 43714, + 43739, + 43741, + 43744, + 43759, + 43762, + 43766, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44010, + 44012, + 44013, + 44016, + 44025, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65024, + 65039, + 65056, + 65062, + 65075, + 65076, + 65101, + 65103, + 65136, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; function lookupInUnicodeMap(code, map) { if (code < map[0]) { return false; @@ -1541,21 +6407,17 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierStart) : - lookupInUnicodeMap(code, unicodeES3IdentifierStart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierPart) : - lookupInUnicodeMap(code, unicodeES3IdentifierPart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; - for (var _name in source) { - if (source.hasOwnProperty(_name)) { - result[source[_name]] = _name; + for (var name_2 in source) { + if (source.hasOwnProperty(name_2)) { + result[source[name_2]] = name_2; } } return result; @@ -1626,25 +6488,21 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || - ch === 9 || - ch === 11 || - ch === 12 || - ch === 160 || - ch === 133 || - ch === 5760 || - ch >= 8192 && ch <= 8203 || - ch === 8239 || - ch === 8287 || - ch === 12288 || - ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 133 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { - return ch === 10 || - ch === 13 || - ch === 8232 || - ch === 8233; + // ES5 7.3: + // The ECMAScript line terminator characters are listed in Table 3. + // Table 3 � Line Terminator Characters + // Code Unit Value Name Formal Name + // \u000A Line Feed + // \u000D Carriage Return + // \u2028 Line separator + // \u2029 Paragraph separator + // Only the characters in Table 3 are treated as line terminators. Other new line or line + // breaking characters are treated as white space but not as line terminators. + return ch === 10 || ch === 13 || ch === 8232 || ch === 8233; } ts.isLineBreak = isLineBreak; function isDigit(ch) { @@ -1727,8 +6585,7 @@ var ts; return false; } } - return ch === 61 || - text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -1747,8 +6604,8 @@ var ts; else { ts.Debug.assert(ch === 61); while (pos < len) { - var _ch = text.charCodeAt(pos); - if (_ch === 62 && isConflictMarkerTrivia(text, pos)) { + var ch_1 = text.charCodeAt(pos); + if (ch_1 === 62 && isConflictMarkerTrivia(text, pos)) { break; } pos++; @@ -1810,7 +6667,11 @@ var ts; if (!result) { result = []; } - result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + result.push({ + pos: startPos, + end: pos, + hasTrailingNewLine: hasTrailingNewLine + }); } continue; } @@ -1837,15 +6698,11 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -1864,14 +6721,10 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -2148,8 +7001,8 @@ var ts; return result; } function getIdentifierToken() { - var _len = tokenValue.length; - if (_len >= 2 && _len <= 11) { + var len = tokenValue.length; + if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { return token = textToToken[tokenValue]; @@ -2301,13 +7154,13 @@ var ts; pos += 2; var commentClosed = false; while (pos < len) { - var _ch = text.charCodeAt(pos); - if (_ch === 42 && text.charCodeAt(pos + 1) === 47) { + var ch_2 = text.charCodeAt(pos); + if (ch_2 === 42 && text.charCodeAt(pos + 1) === 47) { pos += 2; commentClosed = true; break; } - if (isLineBreak(_ch)) { + if (isLineBreak(ch_2)) { precedingLineBreak = true; } pos++; @@ -2340,22 +7193,22 @@ var ts; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { pos += 2; - var _value = scanBinaryOrOctalDigits(2); - if (_value < 0) { + var value = scanBinaryOrOctalDigits(2); + if (value < 0) { error(ts.Diagnostics.Binary_digit_expected); - _value = 0; + value = 0; } - tokenValue = "" + _value; + tokenValue = "" + value; return token = 7; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { pos += 2; - var _value_1 = scanBinaryOrOctalDigits(8); - if (_value_1 < 0) { + var value = scanBinaryOrOctalDigits(8); + if (value < 0) { error(ts.Diagnostics.Octal_digit_expected); - _value_1 = 0; + value = 0; } - tokenValue = "" + _value_1; + tokenValue = "" + value; return token = 7; } if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { @@ -2596,17 +7449,39 @@ var ts; } setText(text); return { - getStartPos: function () { return startPos; }, - getTextPos: function () { return pos; }, - getToken: function () { return token; }, - getTokenPos: function () { return tokenPos; }, - getTokenText: function () { return text.substring(tokenPos, pos); }, - getTokenValue: function () { return tokenValue; }, - hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, - hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 65 || token > 101; }, - isReservedWord: function () { return token >= 66 && token <= 101; }, - isUnterminated: function () { return tokenIsUnterminated; }, + getStartPos: function () { + return startPos; + }, + getTextPos: function () { + return pos; + }, + getToken: function () { + return token; + }, + getTokenPos: function () { + return tokenPos; + }, + getTokenText: function () { + return text.substring(tokenPos, pos); + }, + getTokenValue: function () { + return tokenValue; + }, + hasExtendedUnicodeEscape: function () { + return hasExtendedUnicodeEscape; + }, + hasPrecedingLineBreak: function () { + return precedingLineBreak; + }, + isIdentifier: function () { + return token === 65 || token > 101; + }, + isReservedWord: function () { + return token >= 66 && token <= 101; + }, + isUnterminated: function () { + return tokenIsUnterminated; + }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -2619,20 +7494,21 @@ var ts; } ts.createScanner = createScanner; })(ts || (ts = {})); +/// var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 199 || node.kind === 200) { + if (node.kind === 202 || node.kind === 203) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 206 || node.kind === 205) && !(node.flags & 1)) { + else if ((node.kind === 209 || node.kind === 208) && !(node.flags & 1)) { return 0; } - else if (node.kind === 203) { + else if (node.kind === 206) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -2648,7 +7524,7 @@ var ts; }); return state; } - else if (node.kind === 202) { + else if (node.kind === 205) { return getModuleInstanceState(node.body); } else { @@ -2663,7 +7539,7 @@ var ts; } ts.bindSourceFile = bindSourceFile; function bindSourceFileWorker(file) { - var _parent; + var parent; var container; var blockScopeContainer; var lastContainer; @@ -2701,7 +7577,7 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 202 && node.name.kind === 8) { + if (node.kind === 205 && node.name.kind === 8) { return '"' + node.name.text + '"'; } if (node.name.kind === 127) { @@ -2722,12 +7598,12 @@ var ts; return "__new"; case 140: return "__index"; - case 212: + case 215: return "__export"; - case 211: + case 214: return node.isExportEquals ? "export=" : "default"; - case 197: - case 198: + case 200: + case 201: return node.flags & 256 ? "default" : undefined; } } @@ -2736,22 +7612,20 @@ var ts; } function declareSymbol(symbols, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var _name = node.flags & 256 && parent ? "default" : getDeclarationName(node); + var name = node.flags & 256 && parent ? "default" : getDeclarationName(node); var symbol; - if (_name !== undefined) { - symbol = ts.hasProperty(symbols, _name) ? symbols[_name] : (symbols[_name] = createSymbol(0, _name)); + if (name !== undefined) { + symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); if (symbol.flags & excludes) { if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 - : ts.Diagnostics.Duplicate_identifier_0; + var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); - symbol = createSymbol(0, _name); + symbol = createSymbol(0, name); } } else { @@ -2759,7 +7633,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 198 && symbol.exports) { + if ((node.kind === 201 || node.kind === 174) && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -2775,7 +7649,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 214 || (node.kind === 205 && hasExportModifier)) { + if (node.kind === 217 || (node.kind === 208 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -2784,9 +7658,7 @@ var ts; } else { if (hasExportModifier || container.flags & 32768) { - var exportKind = (symbolKind & 107455 ? 1048576 : 0) | - (symbolKind & 793056 ? 2097152 : 0) | - (symbolKind & 1536 ? 4194304 : 0); + var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; @@ -2800,10 +7672,10 @@ var ts; if (symbolKind & 255504) { node.locals = {}; } - var saveParent = _parent; + var saveParent = parent; var saveContainer = container; var savedBlockScopeContainer = blockScopeContainer; - _parent = node; + parent = node; if (symbolKind & 262128) { container = node; if (lastContainer) { @@ -2812,19 +7684,19 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 224); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227); } ts.forEachChild(node, bind); container = saveContainer; - _parent = saveParent; + parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 202: + case 205: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -2839,22 +7711,23 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 198: + case 174: + case 201: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } case 145: case 154: - case 199: + case 202: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 201: + case 204: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -2869,11 +7742,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 224 ? node : node.body; - if (body.kind === 224 || body.kind === 203) { - for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { + var body = node.kind === 227 ? node : node.body; + if (body.kind === 227 || body.kind === 206) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 212 || stat.kind === 211) { + if (stat.kind === 215 || stat.kind === 214) { return true; } } @@ -2911,6 +7784,12 @@ var ts; } } function bindFunctionOrConstructorType(node) { + // For a given function symbol "<...>(...) => T" we want to generate a symbol identical + // to the one we would get for: { <...>(...): T } + // + // We do that by making an anonymous type literal symbol, and then setting the function + // symbol as its sole member. To the rest of the system, this symbol will be indistinguishable + // from an actual type literal symbol you would have gotten had you used the long form. var symbol = createSymbol(131072, getDeclarationName(node)); addDeclarationToSymbol(symbol, node, 131072); bindChildren(node, 131072, false); @@ -2929,10 +7808,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 202: + case 205: declareModuleMember(node, 2, 107455); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -2949,7 +7828,7 @@ var ts; return "__" + ts.indexOf(node.parent.parameters, node); } function bind(node) { - node.parent = _parent; + node.parent = parent; switch (node.kind) { case 128: bindDeclaration(node, 262144, 530912, false); @@ -2957,7 +7836,7 @@ var ts; case 129: bindParameter(node); break; - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); @@ -2973,11 +7852,11 @@ var ts; case 131: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 221: - case 222: + case 224: + case 225: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 223: + case 226: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 138: @@ -2989,7 +7868,7 @@ var ts; case 133: bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; - case 197: + case 200: bindDeclaration(node, 16, 106927, true); break; case 135: @@ -3015,19 +7894,22 @@ var ts; case 163: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 220: + case 174: + bindAnonymousDeclaration(node, 32, "__class", false); + break; + case 223: bindCatchVariableDeclaration(node); break; - case 198: + case 201: bindDeclaration(node, 32, 899583, false); break; - case 199: + case 202: bindDeclaration(node, 64, 792992, false); break; - case 200: + case 203: bindDeclaration(node, 524288, 793056, false); break; - case 201: + case 204: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -3035,16 +7917,16 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 202: + case 205: bindModuleDeclaration(node); break; - case 205: case 208: - case 210: - case 214: + case 211: + case 213: + case 217: bindDeclaration(node, 8388608, 8388608, false); break; - case 207: + case 210: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -3052,13 +7934,13 @@ var ts; bindChildren(node, 0, false); } break; - case 212: + case 215: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 211: + case 214: if (node.expression && node.expression.kind === 65) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } @@ -3067,27 +7949,27 @@ var ts; } bindChildren(node, 0, false); break; - case 224: + case 227: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 176: + case 179: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 220: - case 183: - case 184: - case 185: - case 204: + case 223: + case 186: + case 187: + case 188: + case 207: bindChildren(node, 0, true); break; default: - var saveParent = _parent; - _parent = node; + var saveParent = parent; + parent = node; ts.forEachChild(node, bind); - _parent = saveParent; + parent = saveParent; } } function bindParameter(node) { @@ -3097,9 +7979,7 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && - node.parent.kind === 135 && - node.parent.parent.kind === 198) { + if (node.flags & 112 && node.parent.kind === 135 && (node.parent.parent.kind === 201 || node.parent.parent.kind === 174)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -3114,11 +7994,12 @@ var ts; } } })(ts || (ts = {})); +/// var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -3131,9 +8012,13 @@ var ts; function getSingleLineStringWriter() { if (stringWriters.length == 0) { var str = ""; - var writeText = function (text) { return str += text; }; + var writeText = function (text) { + return str += text; + }; return { - string: function () { return str; }, + string: function () { + return str; + }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -3141,11 +8026,18 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { return str += " "; }, - increaseIndent: function () { }, - decreaseIndent: function () { }, - clear: function () { return str = ""; }, - trackSymbol: function () { } + writeLine: function () { + return str += " "; + }, + increaseIndent: function () { + }, + decreaseIndent: function () { + }, + clear: function () { + return str = ""; + }, + trackSymbol: function () { + } }; } return stringWriters.pop(); @@ -3167,8 +8059,7 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 128)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 32) !== 0) || - ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 32) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 64; } @@ -3176,7 +8067,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 224) { + while (node && node.kind !== 227) { node = node.parent; } return node; @@ -3247,8 +8138,7 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 12288) !== 0 || - isCatchClauseVariableDeclaration(declaration); + return (getCombinedNodeFlags(declaration) & 12288) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function getEnclosingBlockScopeContainer(node) { @@ -3258,15 +8148,15 @@ var ts; return current; } switch (current.kind) { - case 224: - case 204: - case 220: - case 202: - case 183: - case 184: - case 185: + case 227: + case 207: + case 223: + case 205: + case 186: + case 187: + case 188: return current; - case 176: + case 179: if (!isFunctionLike(current.parent)) { return current; } @@ -3276,10 +8166,7 @@ var ts; } ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { - return declaration && - declaration.kind === 195 && - declaration.parent && - declaration.parent.kind === 220; + return declaration && declaration.kind === 198 && declaration.parent && declaration.parent.kind === 223; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3316,14 +8203,21 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 195: - case 152: + case 227: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + if (pos_1 === sourceFile.text.length) { + return createTextSpan(0, 0); + } + return getSpanOfTokenAtPosition(sourceFile, pos_1); case 198: - case 199: - case 202: + case 152: case 201: - case 223: - case 197: + case 174: + case 202: + case 205: + case 204: + case 226: + case 200: case 162: errorNode = node.name; break; @@ -3331,9 +8225,7 @@ var ts; if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); } - var pos = nodeIsMissing(errorNode) - ? errorNode.pos - : ts.skipTrivia(sourceFile.text, errorNode.pos); + var pos = nodeIsMissing(errorNode) ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); return createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; @@ -3346,7 +8238,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 201 && isConst(node); + return node.kind === 204 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { @@ -3358,14 +8250,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 195) { + if (node.kind === 198) { node = node.parent; } - if (node && node.kind === 196) { + if (node && node.kind === 199) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 177) { + if (node && node.kind === 180) { flags |= node.flags; } return flags; @@ -3380,7 +8272,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 179 && node.expression.kind === 8; + return node.kind === 182 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -3395,9 +8287,7 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -3406,23 +8296,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188: + case 191: return visitor(node); - case 204: - case 176: - case 180: - case 181: - case 182: + case 207: + case 179: case 183: case 184: case 185: - case 189: - case 190: - case 217: - case 218: - case 191: + case 186: + case 187: + case 188: + case 192: case 193: case 220: + case 221: + case 194: + case 196: + case 223: return ts.forEachChild(node, traverse); } } @@ -3432,13 +8322,13 @@ var ts; if (node) { switch (node.kind) { case 152: - case 223: + case 226: case 129: - case 221: + case 224: case 132: case 131: - case 222: - case 195: + case 225: + case 198: return true; } } @@ -3450,7 +8340,7 @@ var ts; switch (node.kind) { case 135: case 162: - case 197: + case 200: case 163: case 134: case 133: @@ -3463,7 +8353,7 @@ var ts; case 143: case 162: case 163: - case 197: + case 200: return true; } } @@ -3471,7 +8361,7 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 176 && isFunctionLike(node.parent); + return node && node.kind === 179 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -3495,7 +8385,7 @@ var ts; } switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; @@ -3504,9 +8394,9 @@ var ts; if (!includeArrowFunctions) { continue; } - case 197: + case 200: case 162: - case 202: + case 205: case 132: case 131: case 134: @@ -3514,8 +8404,8 @@ var ts; case 135: case 136: case 137: - case 201: - case 224: + case 204: + case 227: return node; } } @@ -3528,12 +8418,12 @@ var ts; return node; switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; break; - case 197: + case 200: case 162: case 163: if (!includeFunctions) { @@ -3560,23 +8450,23 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 198: + case 201: return true; case 132: - return node.parent.kind === 198; + return node.parent.kind === 201; case 129: - return node.parent.body && node.parent.parent.kind === 198; + return node.parent.body && node.parent.parent.kind === 201; case 136: case 137: case 134: - return node.body && node.parent.kind === 198; + return node.body && node.parent.kind === 201; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 198: + case 201: if (node.decorators) { return true; } @@ -3604,7 +8494,7 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 198: + case 201: return ts.forEach(node.members, nodeOrChildIsDecorated); case 134: case 137: @@ -3635,6 +8525,7 @@ var ts; case 160: case 161: case 162: + case 174: case 163: case 166: case 164: @@ -3646,7 +8537,7 @@ var ts; case 173: case 171: case 10: - case 174: + case 175: return true; case 126: while (node.parent.kind === 126) { @@ -3659,45 +8550,42 @@ var ts; } case 7: case 8: - var _parent = node.parent; - switch (_parent.kind) { - case 195: + var parent_1 = node.parent; + switch (parent_1.kind) { + case 198: case 129: case 132: case 131: - case 223: - case 221: + case 226: + case 224: case 152: - return _parent.initializer === node; - case 179: - case 180: - case 181: + return parent_1.initializer === node; case 182: - case 188: - case 189: - case 190: - case 217: - case 192: - case 190: - return _parent.expression === node; case 183: - var forStatement = _parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 196) || - forStatement.condition === node || - forStatement.iterator === node; case 184: case 185: - var forInStatement = _parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 196) || - forInStatement.expression === node; + case 191: + case 192: + case 193: + case 220: + case 195: + case 193: + return parent_1.expression === node; + case 186: + var forStatement = parent_1; + return (forStatement.initializer === node && forStatement.initializer.kind !== 199) || forStatement.condition === node || forStatement.iterator === node; + case 187: + case 188: + var forInStatement = parent_1; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199) || forInStatement.expression === node; case 160: - return node === _parent.expression; - case 175: - return node === _parent.expression; + return node === parent_1.expression; + case 176: + return node === parent_1.expression; case 127: - return node === _parent.expression; + return node === parent_1.expression; default: - if (isExpression(_parent)) { + if (isExpression(parent_1)) { return true; } } @@ -3707,12 +8595,11 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || - (preserveConstEnums && moduleState === 2); + return moduleState === 1 || (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind === 216; + return node.kind === 208 && node.moduleReference.kind === 219; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -3721,20 +8608,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind !== 216; + return node.kind === 208 && node.moduleReference.kind !== 219; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 206) { + if (node.kind === 209) { return node.moduleSpecifier; } - if (node.kind === 205) { + if (node.kind === 208) { var reference = node.moduleReference; - if (reference.kind === 216) { + if (reference.kind === 219) { return reference.expression; } } - if (node.kind === 212) { + if (node.kind === 215) { return node.moduleSpecifier; } } @@ -3751,8 +8638,8 @@ var ts; case 134: case 133: return node.questionToken !== undefined; - case 222: - case 221: + case 225: + case 224: case 132: case 131: return node.questionToken !== undefined; @@ -3795,31 +8682,31 @@ var ts; switch (node.kind) { case 163: case 152: - case 198: - case 135: case 201: - case 223: - case 214: - case 197: + case 135: + case 204: + case 226: + case 217: + case 200: case 162: case 136: - case 207: - case 205: case 210: - case 199: + case 208: + case 213: + case 202: case 134: case 133: - case 202: - case 208: + case 205: + case 211: case 129: - case 221: + case 224: case 132: case 131: case 137: - case 222: - case 200: + case 225: + case 203: case 128: - case 195: + case 198: return true; } return false; @@ -3827,25 +8714,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 187: - case 186: - case 194: - case 181: - case 179: - case 178: - case 184: - case 185: - case 183: - case 180: - case 191: - case 188: case 190: - case 94: - case 193: - case 177: - case 182: case 189: - case 211: + case 197: + case 184: + case 182: + case 181: + case 187: + case 188: + case 186: + case 183: + case 194: + case 191: + case 193: + case 94: + case 196: + case 180: + case 185: + case 192: + case 214: return true; default: return false; @@ -3870,37 +8757,32 @@ var ts; if (name.kind !== 65 && name.kind !== 8 && name.kind !== 7) { return false; } - var _parent = name.parent; - if (_parent.kind === 210 || _parent.kind === 214) { - if (_parent.propertyName) { + var parent = name.parent; + if (parent.kind === 213 || parent.kind === 217) { + if (parent.propertyName) { return true; } } - if (isDeclaration(_parent)) { - return _parent.name === name; + if (isDeclaration(parent)) { + return parent.name === name; } return false; } ts.isDeclarationName = isDeclarationName; function isAliasSymbolDeclaration(node) { - return node.kind === 205 || - node.kind === 207 && !!node.name || - node.kind === 208 || - node.kind === 210 || - node.kind === 214 || - node.kind === 211 && node.expression.kind === 65; + return node.kind === 208 || node.kind === 210 && !!node.name || node.kind === 211 || node.kind === 213 || node.kind === 217 || node.kind === 214 && node.expression.kind === 65; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; - function getClassBaseTypeNode(node) { + function getClassExtendsHeritageClauseElement(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } - ts.getClassBaseTypeNode = getClassBaseTypeNode; - function getClassImplementedTypeNodes(node) { + ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; + function getClassImplementsHeritageClauseElements(node) { var heritageClause = getHeritageClause(node.heritageClauses, 103); return heritageClause ? heritageClause.types : undefined; } - ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause ? heritageClause.types : undefined; @@ -3908,7 +8790,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _n = clauses.length; _i < _n; _i++) { + for (var _i = 0; _i < clauses.length; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -3979,9 +8861,7 @@ var ts; } ts.isTrivia = isTrivia; function hasDynamicName(declaration) { - return declaration.name && - declaration.name.kind === 127 && - !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && declaration.name.kind === 127 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { @@ -4085,7 +8965,10 @@ var ts; if (length < 0) { throw new Error("length < 0"); } - return { start: start, length: length }; + return { + start: start, + length: length + }; } ts.createTextSpan = createTextSpan; function createTextSpanFromBounds(start, end) { @@ -4104,7 +8987,10 @@ var ts; if (newLength < 0) { throw new Error("newLength < 0"); } - return { span: span, newLength: newLength }; + return { + span: span, + newLength: newLength + }; } ts.createTextChangeRange = createTextChangeRange; ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); @@ -4135,7 +9021,7 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 202 || n.kind === 224; + return isFunctionLike(n) || n.kind === 205 || n.kind === 227; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -4245,12 +9131,15 @@ var ts; } var nonAsciiCharacters = /[^\u0000-\u007F]/g; function escapeNonAsciiCharacters(s) { - return nonAsciiCharacters.test(s) ? - s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : - s; + return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { + return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + }) : s; } ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; - var indentStrings = ["", " "]; + var indentStrings = [ + "", + " " + ]; function getIndentString(level) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; @@ -4312,13 +9201,27 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { return indent++; }, - decreaseIndent: function () { return indent--; }, - getIndent: function () { return indent; }, - getTextPos: function () { return output.length; }, - getLine: function () { return lineCount + 1; }, - getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, - getText: function () { return output; } + increaseIndent: function () { + return indent++; + }, + decreaseIndent: function () { + return indent--; + }, + getIndent: function () { + return indent; + }, + getTextPos: function () { + return output.length; + }, + getLine: function () { + return lineCount + 1; + }, + getColumn: function () { + return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; + }, + getText: function () { + return output; + } }; } ts.createTextWriter = createTextWriter; @@ -4387,8 +9290,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 136 || member.kind === 137) - && (member.flags & 128) === (accessor.flags & 128)) { + if ((member.kind === 136 || member.kind === 137) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -4417,8 +9319,7 @@ var ts; } ts.getAllAccessorDeclarations = getAllAccessorDeclarations; function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -4449,9 +9350,7 @@ var ts; var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount - ? currentSourceFile.text.length + 1 - : getStartPositionOfLine(currentLine + 1, currentSourceFile); + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); @@ -4505,10 +9404,35 @@ var ts; } } ts.writeCommentRange = writeCommentRange; + function isSupportedHeritageClauseElement(node) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; + function isSupportedHeritageClauseElementExpression(node) { + if (node.kind === 65) { + return true; + } + else if (node.kind === 155) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + else { + return false; + } + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 126 && node.parent.right === node) || (node.parent.kind === 155 && node.parent.name === node); + } + ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function getLocalSymbolForExportDefault(symbol) { + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256) ? symbol.valueDeclaration.localSymbol : undefined; + } + ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; })(ts || (ts = {})); +/// +/// var ts; (function (ts) { - var nodeConstructors = new Array(226); + var nodeConstructors = new Array(229); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -4530,7 +9454,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -4547,58 +9471,34 @@ var ts; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { case 126: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); case 128: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); case 129: case 132: case 131: - case 221: - case 222: - case 195: + case 224: + case 225: + case 198: case 152: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 142: case 143: case 138: case 139: case 140: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); case 134: case 133: case 135: case 136: case 137: case 162: - case 197: + case 200: case 163: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); case 141: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNodes, node.typeArguments); + return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); case 144: return visitNode(cbNode, node.exprName); case 145: @@ -4619,23 +9519,16 @@ var ts; case 154: return visitNodes(cbNodes, node.properties); case 155: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.dotToken) || - visitNode(cbNode, node.name); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); case 156: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.argumentExpression); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); case 157: case 158: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.typeArguments) || - visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); case 159: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.template); + return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); case 160: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); case 161: return visitNode(cbNode, node.expression); case 164: @@ -4647,221 +9540,195 @@ var ts; case 167: return visitNode(cbNode, node.operand); case 172: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); case 168: return visitNode(cbNode, node.operand); case 169: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); case 170: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); + return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); case 173: return visitNode(cbNode, node.expression); - case 176: - case 203: - return visitNodes(cbNodes, node.statements); - case 224: - return visitNodes(cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 177: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 196: - return visitNodes(cbNodes, node.declarations); case 179: - return visitNode(cbNode, node.expression); - case 180: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 181: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 182: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 183: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.iterator) || - visitNode(cbNode, node.statement); - case 184: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 185: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 186: - case 187: - return visitNode(cbNode, node.label); - case 188: - return visitNode(cbNode, node.expression); - case 189: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 190: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 204: - return visitNodes(cbNodes, node.clauses); - case 217: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); - case 218: + case 206: return visitNodes(cbNodes, node.statements); - case 191: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 192: + case 227: + return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); + case 180: + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); + case 199: + return visitNodes(cbNodes, node.declarations); + case 182: return visitNode(cbNode, node.expression); + case 183: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); + case 184: + return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); + case 185: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 186: + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); + case 187: + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 188: + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 189: + case 190: + return visitNode(cbNode, node.label); + case 191: + return visitNode(cbNode, node.expression); + case 192: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 193: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); + case 207: + return visitNodes(cbNodes, node.clauses); case 220: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); + case 221: + return visitNodes(cbNodes, node.statements); + case 194: + return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); + case 195: + return visitNode(cbNode, node.expression); + case 196: + return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); + case 223: + return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 130: return visitNode(cbNode, node.expression); - case 198: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); - case 199: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); - case 200: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); case 201: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); - case 223: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + case 174: + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); case 202: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); + case 203: + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); + case 204: + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); + case 226: + return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 205: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 206: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier); - case 207: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 208: - return visitNode(cbNode, node.name); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 209: - case 213: - return visitNodes(cbNodes, node.elements); - case 212: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); case 210: - case 214: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); case 211: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); + return visitNode(cbNode, node.name); + case 212: + case 216: + return visitNodes(cbNodes, node.elements); + case 215: + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); + case 213: + case 217: + return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); + case 214: + return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); case 171: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 175: + case 176: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 127: return visitNode(cbNode, node.expression); - case 219: + case 222: return visitNodes(cbNodes, node.types); - case 216: + case 177: + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); + case 219: return visitNode(cbNode, node.expression); - case 215: + case 218: return visitNodes(cbNodes, node.decorators); } } ts.forEachChild = forEachChild; function parsingContextErrors(context) { switch (context) { - case 0: return ts.Diagnostics.Declaration_or_statement_expected; - case 1: return ts.Diagnostics.Declaration_or_statement_expected; - case 2: return ts.Diagnostics.Statement_expected; - case 3: return ts.Diagnostics.case_or_default_expected; - case 4: return ts.Diagnostics.Statement_expected; - case 5: return ts.Diagnostics.Property_or_signature_expected; - case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; - case 9: return ts.Diagnostics.Variable_declaration_expected; - case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; - case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; - case 12: return ts.Diagnostics.Argument_expression_expected; - case 13: return ts.Diagnostics.Property_assignment_expected; - case 14: return ts.Diagnostics.Expression_or_comma_expected; - case 15: return ts.Diagnostics.Parameter_declaration_expected; - case 16: return ts.Diagnostics.Type_parameter_declaration_expected; - case 17: return ts.Diagnostics.Type_argument_expected; - case 18: return ts.Diagnostics.Type_expected; - case 19: return ts.Diagnostics.Unexpected_token_expected; - case 20: return ts.Diagnostics.Identifier_expected; + case 0: + return ts.Diagnostics.Declaration_or_statement_expected; + case 1: + return ts.Diagnostics.Declaration_or_statement_expected; + case 2: + return ts.Diagnostics.Statement_expected; + case 3: + return ts.Diagnostics.case_or_default_expected; + case 4: + return ts.Diagnostics.Statement_expected; + case 5: + return ts.Diagnostics.Property_or_signature_expected; + case 6: + return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: + return ts.Diagnostics.Enum_member_expected; + case 8: + return ts.Diagnostics.Expression_expected; + case 9: + return ts.Diagnostics.Variable_declaration_expected; + case 10: + return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: + return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: + return ts.Diagnostics.Argument_expression_expected; + case 13: + return ts.Diagnostics.Property_assignment_expected; + case 14: + return ts.Diagnostics.Expression_or_comma_expected; + case 15: + return ts.Diagnostics.Parameter_declaration_expected; + case 16: + return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: + return ts.Diagnostics.Type_argument_expected; + case 18: + return ts.Diagnostics.Type_expected; + case 19: + return ts.Diagnostics.Unexpected_token_expected; + case 20: + return ts.Diagnostics.Identifier_expected; } } ; function modifierToFlag(token) { switch (token) { - case 110: return 128; - case 109: return 16; - case 108: return 64; - case 107: return 32; - case 78: return 1; - case 115: return 2; - case 70: return 8192; - case 73: return 256; + case 110: + return 128; + case 109: + return 16; + case 108: + return 64; + case 107: + return 32; + case 78: + return 1; + case 115: + return 2; + case 70: + return 8192; + case 73: + return 256; } return 0; } ts.modifierToFlag = modifierToFlag; function fixupParentReferences(sourceFile) { - var _parent = sourceFile; + // normally parent references are set during binding. However, for clients that only need + // a syntax tree, and no semantic features, then the binding process is an unnecessary + // overhead. This functions allows us to set all the parents, without all the expense of + // binding. + var parent = sourceFile; forEachChild(sourceFile, visitNode); return; function visitNode(n) { - if (n.parent !== _parent) { - n.parent = _parent; - var saveParent = _parent; - _parent = n; + if (n.parent !== parent) { + n.parent = parent; + var saveParent = parent; + parent = n; forEachChild(n, visitNode); - _parent = saveParent; + parent = saveParent; } } } @@ -4899,7 +9766,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -4963,7 +9830,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5079,8 +9946,7 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 65 && - (node.text === "eval" || node.text === "arguments"); + return node.kind === 65 && (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -5163,7 +10029,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(224, 0); + var sourceFile = createNode(227, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -5284,8 +10150,8 @@ var ts; } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); - var _length = scanner.getTextPos() - start; - parseErrorAtPosition(start, _length, message, arg0); + var length = scanner.getTextPos() - start; + parseErrorAtPosition(start, length, message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { var lastError = ts.lastOrUndefined(sourceFile.parseDiagnostics); @@ -5324,9 +10190,7 @@ var ts; var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var saveContextFlags = contextFlags; - var result = isLookAhead - ? scanner.lookAhead(callback) - : scanner.tryScan(callback); + var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); ts.Debug.assert(saveContextFlags === contextFlags); if (!result || isLookAhead) { token = saveToken; @@ -5377,8 +10241,7 @@ var ts; return undefined; } function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { - return parseOptionalToken(t) || - createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); + return parseOptionalToken(t) || createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); } function parseTokenNode() { var node = createNode(token); @@ -5455,9 +10318,7 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || - token === 8 || - token === 7; + return isIdentifierOrKeyword() || token === 8 || token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -5510,10 +10371,7 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 - || token === 14 - || token === 35 - || isLiteralPropertyName(); + return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); @@ -5536,7 +10394,7 @@ var ts; case 5: return isStartOfTypeMember(); case 6: - return lookAhead(isClassMemberStart); + return lookAhead(isClassMemberStart) || (token === 22 && !inErrorRecovery); case 7: return token === 18 || isLiteralPropertyName(); case 13: @@ -5544,7 +10402,15 @@ var ts; case 10: return isLiteralPropertyName(); case 8: - return isIdentifier() && !isNotHeritageClauseTypeName(); + if (token === 14) { + return lookAhead(isValidHeritageClauseObjectLiteral); + } + if (!inErrorRecovery) { + return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + else { + return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); + } case 9: return isIdentifierOrPattern(); case 11: @@ -5566,17 +10432,28 @@ var ts; } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } + function isValidHeritageClauseObjectLiteral() { + ts.Debug.assert(token === 14); + if (nextToken() === 15) { + var next = nextToken(); + return next === 23 || next === 14 || next === 79 || next === 103; + } + return true; + } function nextTokenIsIdentifier() { nextToken(); return isIdentifier(); } - function isNotHeritageClauseTypeName() { - if (token === 103 || - token === 79) { - return lookAhead(nextTokenIsIdentifier); + function isHeritageClauseExtendsOrImplementsKeyword() { + if (token === 103 || token === 79) { + return lookAhead(nextTokenIsStartOfExpression); } return false; } + function nextTokenIsStartOfExpression() { + nextToken(); + return isStartOfExpression(); + } function isListTerminator(kind) { if (token === 1) { return true; @@ -5726,26 +10603,26 @@ var ts; case 15: return isReusableParameter(node); case 19: - case 8: case 16: case 18: case 17: case 12: case 13: + case 8: } return false; } function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 206: - case 205: - case 212: - case 211: - case 198: - case 199: - case 202: + case 209: + case 208: + case 215: + case 214: case 201: + case 202: + case 205: + case 204: return true; } return isReusableStatement(node); @@ -5761,6 +10638,7 @@ var ts; case 136: case 137: case 132: + case 178: return true; } } @@ -5769,8 +10647,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 217: - case 218: + case 220: + case 221: return true; } } @@ -5779,33 +10657,33 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 197: - case 177: - case 176: + case 200: case 180: case 179: - case 192: - case 188: - case 190: - case 187: - case 186: - case 184: - case 185: case 183: case 182: - case 189: - case 178: - case 193: + case 195: case 191: + case 193: + case 190: + case 189: + case 187: + case 188: + case 186: + case 185: + case 192: case 181: + case 196: case 194: + case 184: + case 197: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 223; + return node.kind === 226; } function isReusableTypeMember(node) { if (node) { @@ -5821,7 +10699,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 195) { + if (node.kind !== 198) { return false; } var variableDeclarator = node; @@ -5927,7 +10805,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(175); + var span = createNode(176); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -5953,9 +10831,7 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 - && sourceText.charCodeAt(tokenPos) === 48 - && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 16384; } return node; @@ -5994,9 +10870,7 @@ var ts; } function parseParameterType() { if (parseOptional(51)) { - return token === 8 - ? parseLiteralNode(true) - : parseType(); + return token === 8 ? parseLiteralNode(true) : parseType(); } return undefined; } @@ -6112,11 +10986,11 @@ var ts; } function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); - var _name = parsePropertyName(); + var name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (token === 16 || token === 24) { var method = createNode(133, fullStart); - method.name = _name; + method.name = name; method.questionToken = questionToken; fillSignature(51, false, false, method); parseTypeMemberSemicolon(); @@ -6124,7 +10998,7 @@ var ts; } else { var property = createNode(131, fullStart); - property.name = _name; + property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); @@ -6155,11 +11029,7 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || - token === 24 || - token === 50 || - token === 51 || - canParseSemicolon(); + return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); } function parseTypeMember() { switch (token) { @@ -6167,9 +11037,7 @@ var ts; case 24: return parseSignatureMember(138); case 18: - return isIndexSignature() - ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) - : parsePropertyOrMethodSignature(); + return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) : parsePropertyOrMethodSignature(); case 88: if (lookAhead(isStartOfConstructSignature)) { return parseSignatureMember(139); @@ -6193,9 +11061,7 @@ var ts; var fullStart = scanner.getStartPos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); - return isIndexSignature() - ? parseIndexSignatureDeclaration(fullStart, decorators, modifiers) - : undefined; + return isIndexSignature() ? parseIndexSignatureDeclaration(fullStart, decorators, modifiers) : undefined; } function isStartOfConstructSignature() { nextToken(); @@ -6301,7 +11167,9 @@ var ts; function parseUnionTypeOrHigher() { var type = parseArrayTypeOrHigher(); if (token === 44) { - var types = [type]; + var types = [ + type + ]; types.pos = type.pos; while (parseOptional(44)) { types.push(parseArrayTypeOrHigher()); @@ -6326,9 +11194,7 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || - token === 50 || token === 53 || - isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || token === 50 || token === 53 || isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -6362,7 +11228,7 @@ var ts; function parseTypeAnnotation() { return parseOptional(51) ? parseType() : undefined; } - function isStartOfExpression() { + function isStartOfLeftHandSideExpression() { switch (token) { case 93: case 91: @@ -6377,9 +11243,21 @@ var ts; case 18: case 14: case 83: + case 69: case 88: case 36: case 57: + case 65: + return true; + default: + return isIdentifier(); + } + } + function isStartOfExpression() { + if (isStartOfLeftHandSideExpression()) { + return true; + } + switch (token) { case 33: case 34: case 47: @@ -6390,7 +11268,6 @@ var ts; case 38: case 39: case 24: - case 65: case 111: return true; default: @@ -6401,9 +11278,12 @@ var ts; } } function isStartOfExpressionStatement() { - return token !== 14 && token !== 83 && token !== 52 && isStartOfExpression(); + return token !== 14 && token !== 83 && token !== 69 && token !== 52 && isStartOfExpression(); } function parseExpression() { + // Expression[in]: + // AssignmentExpression[in] + // Expression[in] , AssignmentExpression[in] var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { setDecoratorContext(false); @@ -6428,6 +11308,15 @@ var ts; return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { + // AssignmentExpression[in,yield]: + // 1) ConditionalExpression[?in,?yield] + // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield] + // 3) LeftHandSideExpression AssignmentOperator AssignmentExpression[?in,?yield] + // 4) ArrowFunctionExpression[?in,?yield] + // 5) [+Yield] YieldExpression[?In] + // + // Note: for ease of implementation we treat productions '2' and '3' as the same thing. + // (i.e. they're both BinaryExpressions with an assignment operator in it). if (isYieldExpression()) { return parseYieldExpression(); } @@ -6462,14 +11351,12 @@ var ts; } function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { nextToken(); - return !scanner.hasPrecedingLineBreak() && - (isIdentifier() || token === 14 || token === 18); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 14 || token === 18); } function parseYieldExpression() { var node = createNode(172); nextToken(); - if (!scanner.hasPrecedingLineBreak() && - (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -6484,7 +11371,9 @@ var ts; var parameter = createNode(129, identifier.pos); parameter.name = identifier; finishNode(parameter); - node.parameters = [parameter]; + node.parameters = [ + parameter + ]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; node.equalsGreaterThanToken = parseExpectedToken(32, false, ts.Diagnostics._0_expected, "=>"); @@ -6496,17 +11385,13 @@ var ts; if (triState === 0) { return undefined; } - var arrowFunction = triState === 1 - ? parseParenthesizedArrowFunctionExpressionHead(true) - : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { return undefined; } var lastToken = token; arrowFunction.equalsGreaterThanToken = parseExpectedToken(32, false, ts.Diagnostics._0_expected, "=>"); - arrowFunction.body = (lastToken === 32 || lastToken === 14) - ? parseArrowFunctionExpressionBody() - : parseIdentifier(); + arrowFunction.body = (lastToken === 32 || lastToken === 14) ? parseArrowFunctionExpressionBody() : parseIdentifier(); return finishNode(arrowFunction); } function isParenthesizedArrowFunctionExpression() { @@ -6570,7 +11455,7 @@ var ts; if (token === 14) { return parseFunctionBlock(false, false); } - if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 83) { + if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 83 && token !== 69) { return parseFunctionBlock(false, true); } return parseAssignmentExpressionOrHigher(); @@ -6719,9 +11604,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 91 - ? parseSuperExpression() - : parseMemberExpressionOrHigher(); + var expression = token === 91 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); } function parseMemberExpressionOrHigher() { @@ -6775,9 +11658,7 @@ var ts; if (token === 10 || token === 11) { var tagExpression = createNode(159, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 - ? parseLiteralNode() - : parseTemplateExpression(); + tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); continue; } @@ -6800,10 +11681,10 @@ var ts; continue; } else if (token === 16) { - var _callExpr = createNode(157, expression.pos); - _callExpr.expression = expression; - _callExpr.arguments = parseArgumentList(); - expression = finishNode(_callExpr); + var callExpr = createNode(157, expression.pos); + callExpr.expression = expression; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); continue; } return expression; @@ -6823,9 +11704,7 @@ var ts; if (!parseExpected(25)) { return undefined; } - return typeArguments && canFollowTypeArgumentsInExpression() - ? typeArguments - : undefined; + return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; } function canFollowTypeArgumentsInExpression() { switch (token) { @@ -6835,7 +11714,6 @@ var ts; case 19: case 51: case 22: - case 23: case 50: case 28: case 30: @@ -6849,6 +11727,8 @@ var ts; case 15: case 1: return true; + case 23: + case 14: default: return false; } @@ -6871,6 +11751,8 @@ var ts; return parseArrayLiteralExpression(); case 14: return parseObjectLiteralExpression(); + case 69: + return parseClassExpression(); case 83: return parseFunctionExpression(); case 88: @@ -6900,9 +11782,7 @@ var ts; return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(174) : - parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(175) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); @@ -6942,13 +11822,13 @@ var ts; return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(222, fullStart); + var shorthandDeclaration = createNode(225, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(221, fullStart); + var propertyAssignment = createNode(224, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6996,7 +11876,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(176); + var node = createNode(179); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -7021,12 +11901,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(178); + var node = createNode(181); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(180); + var node = createNode(183); parseExpected(84); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7036,7 +11916,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(181); + var node = createNode(184); parseExpected(75); node.statement = parseStatement(); parseExpected(100); @@ -7047,7 +11927,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(182); + var node = createNode(185); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7070,21 +11950,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86)) { - var forInStatement = createNode(184, pos); + var forInStatement = createNode(187, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(125)) { - var forOfStatement = createNode(185, pos); + var forOfStatement = createNode(188, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(183, pos); + var forStatement = createNode(186, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -7102,7 +11982,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 187 ? 66 : 71); + parseExpected(kind === 190 ? 66 : 71); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -7110,7 +11990,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(188); + var node = createNode(191); parseExpected(90); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -7119,7 +11999,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(189); + var node = createNode(192); parseExpected(101); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7128,7 +12008,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(217); + var node = createNode(220); parseExpected(67); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -7136,7 +12016,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(218); + var node = createNode(221); parseExpected(73); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -7146,12 +12026,12 @@ var ts; return token === 67 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(190); + var node = createNode(193); parseExpected(92); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); - var caseBlock = createNode(204, scanner.getStartPos()); + var caseBlock = createNode(207, scanner.getStartPos()); parseExpected(14); caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); @@ -7159,14 +12039,16 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(192); + // ThrowStatement[Yield] : + // throw [no LineTerminator here]Expression[In, ?Yield]; + var node = createNode(195); parseExpected(94); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(193); + var node = createNode(196); parseExpected(96); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 ? parseCatchClause() : undefined; @@ -7177,7 +12059,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(220); + var result = createNode(223); parseExpected(68); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7187,7 +12069,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(194); + var node = createNode(197); parseExpected(72); parseSemicolon(); return finishNode(node); @@ -7196,13 +12078,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 && parseOptional(51)) { - var labeledStatement = createNode(191, fullStart); + var labeledStatement = createNode(194, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(179, fullStart); + var expressionStatement = createNode(182, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -7210,7 +12092,7 @@ var ts; } function isStartOfStatement(inErrorRecovery) { if (ts.isModifier(token)) { - var result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return true; } @@ -7222,6 +12104,7 @@ var ts; case 98: case 105: case 83: + case 69: case 84: case 75: case 100: @@ -7241,7 +12124,6 @@ var ts; var isConstEnum = lookAhead(nextTokenIsEnumKeyword); return !isConstEnum; case 104: - case 69: case 117: case 77: case 123: @@ -7276,6 +12158,8 @@ var ts; return parseVariableStatement(scanner.getStartPos(), undefined, undefined); case 83: return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 69: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); case 22: return parseEmptyStatement(); case 84: @@ -7287,9 +12171,9 @@ var ts; case 82: return parseForOrForInOrForOfStatement(); case 71: - return parseBreakOrContinueStatement(186); + return parseBreakOrContinueStatement(189); case 66: - return parseBreakOrContinueStatement(187); + return parseBreakOrContinueStatement(190); case 90: return parseReturnStatement(); case 101: @@ -7310,7 +12194,7 @@ var ts; } default: if (ts.isModifier(token) || token === 52) { - var result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return result; } @@ -7318,7 +12202,7 @@ var ts; return parseExpressionOrLabeledStatement(); } } - function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers() { + function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers() { var start = scanner.getStartPos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -7338,6 +12222,8 @@ var ts; return parseVariableStatement(start, decorators, modifiers); case 83: return parseFunctionDeclaration(start, decorators, modifiers); + case 69: + return parseClassDeclaration(start, decorators, modifiers); } return undefined; } @@ -7350,7 +12236,7 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(174); + return createNode(175); } var node = createNode(152); node.dotDotDotToken = parseOptionalToken(21); @@ -7399,7 +12285,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(195); + var node = createNode(198); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -7408,7 +12294,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(196); + var node = createNode(199); switch (token) { case 98: break; @@ -7437,7 +12323,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(177, fullStart); + var node = createNode(180, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -7445,7 +12331,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(200, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83); @@ -7488,13 +12374,13 @@ var ts; } function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) { var asteriskToken = parseOptionalToken(35); - var _name = parsePropertyName(); + var name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (asteriskToken || token === 16 || token === 24) { - return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, _name, questionToken, ts.Diagnostics.or_expected); + return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } else { - return parsePropertyDeclaration(fullStart, decorators, modifiers, _name, questionToken); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken); } } function parseNonParameterInitializer() { @@ -7588,6 +12474,11 @@ var ts; return modifiers; } function parseClassElement() { + if (token === 22) { + var result = createNode(178); + nextToken(); + return finishNode(result); + } var fullStart = getNodePos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -7601,25 +12492,27 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(fullStart, decorators, modifiers); } - if (isIdentifierOrKeyword() || - token === 8 || - token === 7 || - token === 35 || - token === 18) { + if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators) { - var _name = createMissingNode(65, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, _name, undefined); + var name_3 = createMissingNode(65, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_3, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } + function parseClassExpression() { + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 174); + } function parseClassDeclaration(fullStart, decorators, modifiers) { + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201); + } + function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var savedStrictModeContext = inStrictModeContext(); if (languageVersion >= 2) { setStrictModeContext(true); } - var node = createNode(198, fullStart); + var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(69); @@ -7627,9 +12520,7 @@ var ts; node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(14)) { - node.members = inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseClassMembers) - : parseClassMembers(); + node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); parseExpected(15); } else { @@ -7640,10 +12531,11 @@ var ts; return finishedNode; } function parseHeritageClauses(isClassHeritageClause) { + // ClassTail[Yield,GeneratorParameter] : See 14.5 + // [~GeneratorParameter]ClassHeritage[?Yield]opt { ClassBody[?Yield]opt } + // [+GeneratorParameter] ClassHeritageopt { ClassBodyopt } if (isHeritageClause()) { - return isClassHeritageClause && inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseHeritageClausesWorker) - : parseHeritageClausesWorker(); + return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); } return undefined; } @@ -7652,14 +12544,22 @@ var ts; } function parseHeritageClause() { if (token === 79 || token === 103) { - var node = createNode(219); + var node = createNode(222); node.token = token; nextToken(); - node.types = parseDelimitedList(8, parseTypeReference); + node.types = parseDelimitedList(8, parseHeritageClauseElement); return finishNode(node); } return undefined; } + function parseHeritageClauseElement() { + var node = createNode(177); + node.expression = parseLeftHandSideExpressionOrHigher(); + if (token === 24) { + node.typeArguments = parseBracketedList(17, parseType, 24, 25); + } + return finishNode(node); + } function isHeritageClause() { return token === 79 || token === 103; } @@ -7667,7 +12567,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(199, fullStart); + var node = createNode(202, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(104); @@ -7678,7 +12578,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200, fullStart); + var node = createNode(203, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(123); @@ -7689,13 +12589,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(223, scanner.getStartPos()); + var node = createNode(226, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(201, fullStart); + var node = createNode(204, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77); @@ -7710,7 +12610,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(203, scanner.getStartPos()); + var node = createNode(206, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -7721,18 +12621,16 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) - ? parseInternalModuleTail(getNodePos(), undefined, undefined, 1) - : parseModuleBlock(); + node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, undefined, 1) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -7741,21 +12639,17 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { parseExpected(117); - return token === 8 - ? parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) - : parseInternalModuleTail(fullStart, decorators, modifiers, modifiers ? modifiers.flags : 0); + return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) : parseInternalModuleTail(fullStart, decorators, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 118 && - lookAhead(nextTokenIsOpenParen); + return token === 118 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || - token === 124; + return token === 23 || token === 124; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(85); @@ -7764,7 +12658,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 124) { - var importEqualsDeclaration = createNode(205, fullStart); + var importEqualsDeclaration = createNode(208, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -7774,12 +12668,10 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(206, fullStart); + var importDeclaration = createNode(209, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); - if (identifier || - token === 35 || - token === 14) { + if (identifier || token === 35 || token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); parseExpected(124); } @@ -7788,23 +12680,26 @@ var ts; return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(207, fullStart); + //ImportClause: + // ImportedDefaultBinding + // NameSpaceImport + // NamedImports + // ImportedDefaultBinding, NameSpaceImport + // ImportedDefaultBinding, NamedImports + var importClause = createNode(210, fullStart); if (identifier) { importClause.name = identifier; } - if (!importClause.name || - parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(209); + if (!importClause.name || parseOptional(23)) { + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(212); } return finishNode(importClause); } function parseModuleReference() { - return isExternalModuleReference() - ? parseExternalModuleReference() - : parseEntityName(false); + return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(216); + var node = createNode(219); parseExpected(118); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -7819,7 +12714,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(208); + var namespaceImport = createNode(211); parseExpected(35); parseExpected(102); namespaceImport.name = parseIdentifier(); @@ -7827,14 +12722,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 209 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 212 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(214); + return parseImportOrExportSpecifier(217); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(210); + return parseImportOrExportSpecifier(213); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -7853,13 +12748,13 @@ var ts; else { node.name = identifierName; } - if (kind === 210 && checkIdentifierIsKeyword) { + if (kind === 213 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35)) { @@ -7867,7 +12762,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(213); + node.exportClause = parseNamedImportsOrExports(216); if (parseOptional(124)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -7876,7 +12771,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(211, fullStart); + var node = createNode(214, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53)) { @@ -7940,13 +12835,11 @@ var ts; } function nextTokenCanFollowImportKeyword() { nextToken(); - return isIdentifierOrKeyword() || token === 8 || - token === 35 || token === 14; + return isIdentifierOrKeyword() || token === 8 || token === 35 || token === 14; } function nextTokenCanFollowExportKeyword() { nextToken(); - return token === 53 || token === 35 || - token === 14 || token === 73 || isDeclarationStart(true); + return token === 53 || token === 35 || token === 14 || token === 73 || isDeclarationStart(true); } function nextTokenIsDeclarationStart() { nextToken(); @@ -7989,7 +12882,7 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); default: if (decorators) { - var node = createMissingNode(215, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(218, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8008,9 +12901,7 @@ var ts; return parseSourceElementOrModuleElement(); } function parseSourceElementOrModuleElement() { - return isDeclarationStart() - ? parseDeclaration() - : parseStatement(); + return isDeclarationStart() ? parseDeclaration() : parseStatement(); } function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); @@ -8025,7 +12916,10 @@ var ts; if (kind !== 2) { break; } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; + var range = { + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos() + }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -8056,7 +12950,10 @@ var ts; var pathMatchResult = pathRegex.exec(comment); var nameMatchResult = nameRegex.exec(comment); if (pathMatchResult) { - var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined }; + var amdDependency = { + path: pathMatchResult[2], + name: nameMatchResult ? nameMatchResult[2] : undefined + }; amdDependencies.push(amdDependency); } } @@ -8068,13 +12965,7 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 - || node.kind === 205 && node.moduleReference.kind === 216 - || node.kind === 206 - || node.kind === 211 - || node.kind === 212 - ? node - : undefined; + return node.flags & 1 || node.kind === 208 && node.moduleReference.kind === 219 || node.kind === 209 || node.kind === 214 || node.kind === 215 ? node : undefined; }); } } @@ -8089,6 +12980,7 @@ var ts; case 153: case 161: case 154: + case 174: case 162: case 65: case 9: @@ -8112,6 +13004,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; })(ts || (ts = {})); +/// var ts; (function (ts) { var nextSymbolId = 1; @@ -8144,12 +13037,24 @@ var ts; var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { - getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, - getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, - getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, - getTypeCount: function () { return typeCount; }, - isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, - isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + getNodeCount: function () { + return ts.sum(host.getSourceFiles(), "nodeCount"); + }, + getIdentifierCount: function () { + return ts.sum(host.getSourceFiles(), "identifierCount"); + }, + getSymbolCount: function () { + return ts.sum(host.getSourceFiles(), "symbolCount"); + }, + getTypeCount: function () { + return typeCount; + }, + isUndefinedSymbol: function (symbol) { + return symbol === undefinedSymbol; + }, + isArgumentsSymbol: function (symbol) { + return symbol === argumentsSymbol; + }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, @@ -8248,9 +13153,7 @@ var ts; return emitResolver; } function error(location, message, arg0, arg1, arg2) { - var diagnostic = location - ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) - : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); diagnostics.add(diagnostic); } function createSymbol(flags, name) { @@ -8336,8 +13239,7 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { error(node.name ? node.name : node, message, symbolToString(source)); }); @@ -8382,10 +13284,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 224); + return ts.getAncestor(node, 227); } function isGlobalSourceFile(node) { - return node.kind === 224 && !ts.isExternalModule(node); + return node.kind === 227 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -8427,25 +13329,33 @@ var ts; } } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 214)) { + if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 217)) { + break loop; + } + result = undefined; + } + else if (location.kind === 227) { + result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { break loop; } result = undefined; } break; - case 201: + case 204: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; case 132: case 131: - if (location.parent.kind === 198 && !(location.flags & 128)) { + if (location.parent.kind === 201 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -8454,8 +13364,8 @@ var ts; } } break; - case 198: - case 199: + case 201: + case 202: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -8466,7 +13376,7 @@ var ts; break; case 127: grandparent = location.parent.parent; - if (grandparent.kind === 198 || grandparent.kind === 199) { + if (grandparent.kind === 201 || grandparent.kind === 202) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -8478,7 +13388,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 163: if (name === "arguments") { result = argumentsSymbol; @@ -8490,8 +13400,15 @@ var ts; result = argumentsSymbol; break loop; } - var id = location.name; - if (id && name === id.text) { + var functionName = location.name; + if (functionName && name === functionName.text) { + result = location.symbol; + break loop; + } + break; + case 174: + var className = location.name; + if (className && name === className.text) { result = location.symbol; break loop; } @@ -8531,18 +13448,18 @@ var ts; } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2) !== 0); - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); + var declaration = ts.forEach(result.declarations, function (d) { + return ts.isBlockOrCatchScoped(d) ? d : undefined; + }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 195); + var variableDeclaration = ts.getAncestor(declaration, 198); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 177 || - variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 180 || variableDeclaration.parent.parent.kind === 186) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 185 || - variableDeclaration.parent.parent.kind === 184) { + else if (variableDeclaration.parent.parent.kind === 188 || variableDeclaration.parent.parent.kind === 187) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -8564,20 +13481,22 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } - while (node && node.kind !== 206) { + while (node && node.kind !== 209) { node = node.parent; } return node; } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.forEach(symbol.declarations, function (d) { + return ts.isAliasSymbolDeclaration(d) ? d : undefined; + }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 216) { + if (node.moduleReference.kind === 219) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -8600,7 +13519,7 @@ var ts; if (moduleSymbol.flags & 3) { var typeAnnotation = moduleSymbol.valueDeclaration.type; if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); + return getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name); } } } @@ -8631,7 +13550,7 @@ var ts; if (symbol.flags & 3) { var typeAnnotation = symbol.valueDeclaration.type; if (typeAnnotation) { - return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); + return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name)); } } } @@ -8639,15 +13558,13 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var _name = specifier.propertyName || specifier.name; - if (_name.text) { - var symbolFromModule = getExportOfModule(targetSymbol, _name.text); - var symbolFromVariable = getPropertyOfVariable(targetSymbol, _name.text); - var symbol = symbolFromModule && symbolFromVariable ? - combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : - symbolFromModule || symbolFromVariable; + var name_4 = specifier.propertyName || specifier.name; + if (name_4.text) { + var symbolFromModule = getExportOfModule(targetSymbol, name_4.text); + var symbolFromVariable = getPropertyOfVariable(targetSymbol, name_4.text); + var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(_name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(_name)); + error(name_4, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_4)); } return symbol; } @@ -8657,26 +13574,24 @@ var ts; return getExternalModuleMember(node.parent.parent.parent, node); } function getTargetOfExportSpecifier(node) { - return node.parent.parent.moduleSpecifier ? - getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); + return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); } function getTargetOfExportAssignment(node) { return node.expression && resolveEntityName(node.expression, 107455 | 793056 | 1536); } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 205: - return getTargetOfImportEqualsDeclaration(node); - case 207: - return getTargetOfImportClause(node); case 208: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node); case 210: - return getTargetOfImportSpecifier(node); - case 214: - return getTargetOfExportSpecifier(node); + return getTargetOfImportClause(node); case 211: + return getTargetOfNamespaceImport(node); + case 213: + return getTargetOfImportSpecifier(node); + case 217: + return getTargetOfExportSpecifier(node); + case 214: return getTargetOfExportAssignment(node); } } @@ -8705,8 +13620,11 @@ var ts; function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); - if (target && target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target)) { - markAliasSymbolAsReferenced(symbol); + if (target) { + var markAlias = (target === unknownSymbol && compilerOptions.separateCompilation) || (target !== unknownSymbol && (target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); + if (markAlias) { + markAliasSymbolAsReferenced(symbol); + } } } function markAliasSymbolAsReferenced(symbol) { @@ -8714,10 +13632,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 211 && node.expression) { + if (node.kind === 214 && node.expression) { checkExpressionCached(node.expression); } - else if (node.kind === 214) { + else if (node.kind === 217) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -8727,17 +13645,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 205); + importDeclaration = ts.getAncestor(entityName, 208); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 65 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 65 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (entityName.kind === 65 || entityName.parent.kind === 126) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 205); + ts.Debug.assert(entityName.parent.kind === 208); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -8745,7 +13663,7 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(name, meaning) { - if (ts.getFullWidth(name) === 0) { + if (ts.nodeIsMissing(name)) { return undefined; } var symbol; @@ -8755,18 +13673,22 @@ var ts; return undefined; } } - else if (name.kind === 126) { - var namespace = resolveEntityName(name.left, 1536); - if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) { + else if (name.kind === 126 || name.kind === 155) { + var left = name.kind === 126 ? name.left : name.expression; + var right = name.kind === 126 ? name.right : name.name; + var namespace = resolveEntityName(left, 1536); + if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; } - var right = name.right; symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; } } + else { + ts.Debug.fail("Unknown entity name kind."); + } ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } @@ -8855,7 +13777,7 @@ var ts; } var exportStars = symbol.exports["__export"]; if (exportStars) { - for (var _i = 0, _a = exportStars.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; visit(resolveExternalModuleName(node, node.moduleSpecifier)); } @@ -8874,9 +13796,7 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 1048576) !== 0 - ? getMergedSymbol(symbol.exportSymbol) - : symbol; + return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; } function symbolIsValue(symbol) { if (symbol.flags & 16777216) { @@ -8892,7 +13812,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _n = members.length; _i < _n; _i++) { + for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; if (member.kind === 135 && ts.nodeIsPresent(member.body)) { return member; @@ -8915,10 +13835,7 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && - name.charCodeAt(1) === 95 && - name.charCodeAt(2) !== 95 && - name.charCodeAt(2) !== 64; + return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -8952,25 +13869,25 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var _location = enclosingDeclaration; _location; _location = _location.parent) { - if (_location.locals && !isGlobalSourceFile(_location)) { - if (result = callback(_location.locals)) { + for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { + if (location_1.locals && !isGlobalSourceFile(location_1)) { + if (result = callback(location_1.locals)) { return result; } } - switch (_location.kind) { - case 224: - if (!ts.isExternalModule(_location)) { + switch (location_1.kind) { + case 227: + if (!ts.isExternalModule(location_1)) { break; } - case 202: - if (result = callback(getSymbolOfNode(_location).exports)) { + case 205: + if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 198: - case 199: - if (result = callback(getSymbolOfNode(_location).members)) { + case 201: + case 202: + if (result = callback(getSymbolOfNode(location_1).members)) { return result; } break; @@ -8992,24 +13909,28 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && - canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { - return [symbol]; + return [ + symbol + ]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=") { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; + return [ + symbolFromSymbolTable + ]; } var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + return [ + symbolFromSymbolTable + ].concat(accessibleSymbolsFromExports); } } } @@ -9074,7 +13995,9 @@ var ts; errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) }; } - return { accessibility: 0 }; + return { + accessibility: 0 + }; function getExternalModuleContainer(declaration) { for (; declaration; declaration = declaration.parent) { if (hasExternalModuleSymbol(declaration)) { @@ -9084,21 +14007,23 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 202 && declaration.name.kind === 8) || - (declaration.kind === 224 && ts.isExternalModule(declaration)); + return (declaration.kind === 205 && declaration.name.kind === 8) || (declaration.kind === 227 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; - if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { + if (ts.forEach(symbol.declarations, function (declaration) { + return !getIsDeclarationVisible(declaration); + })) { return undefined; } - return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; + return { + accessibility: 0, + aliasesToMakeVisible: aliasesToMakeVisible + }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { var anyImportSyntax = getAnyImportSyntax(declaration); - if (anyImportSyntax && - !(anyImportSyntax.flags & 1) && - isDeclarationVisible(anyImportSyntax.parent)) { + if (anyImportSyntax && !(anyImportSyntax.flags & 1) && isDeclarationVisible(anyImportSyntax.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) { @@ -9106,7 +14031,9 @@ var ts; } } else { - aliasesToMakeVisible = [anyImportSyntax]; + aliasesToMakeVisible = [ + anyImportSyntax + ]; } return true; } @@ -9120,8 +14047,7 @@ var ts; if (entityName.parent.kind === 144) { meaning = 107455 | 1048576; } - else if (entityName.kind === 126 || - entityName.parent.kind === 205) { + else if (entityName.kind === 126 || entityName.kind === 155 || entityName.parent.kind === 208) { meaning = 1536; } else { @@ -9168,7 +14094,7 @@ var ts; while (node.kind === 149) { node = node.parent; } - if (node.kind === 200) { + if (node.kind === 203) { return getSymbolOfNode(node); } } @@ -9207,12 +14133,11 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || - needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -9241,8 +14166,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 1048703) { - writer.writeKeyword(!(globalFlags & 16) && - (type.flags & 1) ? "any" : type.intrinsicName); + writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -9335,16 +14259,14 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && - ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && - (type.symbol.parent || - ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 224 || declaration.parent.kind === 203; - })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.flags & 128; + })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 227 || declaration.parent.kind === 206; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || - (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); } } } @@ -9396,17 +14318,17 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { - var _signature = _c[_b]; + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { + var signature = _c[_b]; writeKeyword(writer, 88); writeSpace(writer); - buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -9436,18 +14358,18 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { - var p = _f[_e]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _h = 0, _j = signatures.length; _h < _j; _h++) { - var _signature_1 = signatures[_h]; + for (var _f = 0; _f < signatures.length; _f++) { + var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); } - buildSignatureDisplay(_signature_1, writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -9572,12 +14494,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 202) { + if (node.kind === 205) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 224) { + else if (node.kind === 227) { return ts.isExternalModule(node) ? node : undefined; } } @@ -9622,24 +14544,22 @@ var ts; switch (node.kind) { case 152: return isDeclarationVisible(node.parent.parent); - case 195: - if (ts.isBindingPattern(node.name) && - !node.name.elements.length) { + case 198: + if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 202: - case 198: - case 199: - case 200: - case 197: - case 201: case 205: - var _parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 205 && _parent.kind !== 224 && ts.isInAmbientContext(_parent))) { - return isGlobalSourceFile(_parent); + case 201: + case 202: + case 203: + case 200: + case 204: + case 208: + var parent_2 = getDeclarationContainer(node); + if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 208 && parent_2.kind !== 227 && ts.isInAmbientContext(parent_2))) { + return isGlobalSourceFile(parent_2); } - return isDeclarationVisible(_parent); + return isDeclarationVisible(parent_2); case 132: case 131: case 136: @@ -9654,7 +14574,7 @@ var ts; case 138: case 140: case 129: - case 203: + case 206: case 142: case 143: case 145: @@ -9664,13 +14584,15 @@ var ts; case 148: case 149: return isDeclarationVisible(node.parent); - case 207: - case 208: case 210: + case 211: + case 213: return false; case 128: - case 224: + case 227: return true; + case 214: + return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } @@ -9685,10 +14607,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 211) { + if (node.parent && node.parent.kind === 214) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 217) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -9720,11 +14642,13 @@ var ts; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 195 ? node.parent.parent.parent : node.parent; + return node.kind === 198 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); - return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { + return anyType; + })) : classType; } function getTypeOfPropertyOfType(type, name) { var prop = getPropertyOfType(type, name); @@ -9744,12 +14668,10 @@ var ts; } var type; if (pattern.kind === 150) { - var _name = declaration.propertyName || declaration.name; - type = getTypeOfPropertyOfType(parentType, _name.text) || - isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || - getIndexTypeOfType(parentType, 0); + var name_5 = declaration.propertyName || declaration.name; + type = getTypeOfPropertyOfType(parentType, name_5.text) || isNumericLiteralName(name_5.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(_name)); + error(name_5, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_5)); return unknownType; } } @@ -9778,17 +14700,17 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 184) { + if (declaration.parent.parent.kind === 187) { return anyType; } - if (declaration.parent.parent.kind === 185) { + if (declaration.parent.parent.kind === 188) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var func = declaration.parent; @@ -9806,7 +14728,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 222) { + if (declaration.kind === 225) { return checkIdentifier(declaration.name); } return undefined; @@ -9824,8 +14746,8 @@ var ts; var members = {}; ts.forEach(pattern.elements, function (e) { var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); - var _name = e.propertyName || e.name; - var symbol = createSymbol(flags, _name.text); + var name = e.propertyName || e.name; + var symbol = createSymbol(flags, name.text); symbol.type = getTypeFromBindingElement(e); members[symbol.name] = symbol; }); @@ -9835,7 +14757,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 174 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 175 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -9843,9 +14765,7 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 150 - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 150 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -9853,7 +14773,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 221 ? getWidenedType(type) : type; + return declaration.kind !== 224 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -9874,16 +14794,16 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 220) { + if (declaration.parent.kind === 223) { return links.type = anyType; } - if (declaration.kind === 211) { + if (declaration.kind === 214) { var exportAssignment = declaration; if (exportAssignment.expression) { return links.type = checkExpression(exportAssignment.expression); } else if (exportAssignment.type) { - return links.type = getTypeFromTypeNode(exportAssignment.type); + return links.type = getTypeFromTypeNodeOrHeritageClauseElement(exportAssignment.type); } else { return links.type = anyType; @@ -9898,9 +14818,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); } } @@ -9912,11 +14830,11 @@ var ts; function getAnnotatedAccessorType(accessor) { if (accessor) { if (accessor.kind === 136) { - return accessor.type && getTypeFromTypeNode(accessor.type); + return accessor.type && getTypeFromTypeNodeOrHeritageClauseElement(accessor.type); } else { var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation && getTypeFromTypeNodeOrHeritageClauseElement(setterTypeAnnotation); } } return undefined; @@ -9961,8 +14879,8 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var _getter = ts.getDeclarationOfKind(symbol, 136); - error(_getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + var getter = ts.getDeclarationOfKind(symbol, 136); + error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } } @@ -10028,13 +14946,15 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 199 || node.kind === 198) { + if (node.kind === 202 || node.kind === 201) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!result) { - result = [tp]; + result = [ + tp + ]; } else if (!ts.contains(result, tp)) { result.push(tp); @@ -10059,10 +14979,10 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(symbol, 198); - var baseTypeNode = ts.getClassBaseTypeNode(declaration); + var declaration = ts.getDeclarationOfKind(symbol, 201); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + var baseType = getTypeFromHeritageClauseElement(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10100,9 +15020,9 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 199 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 202 && ts.getInterfaceBaseTypeNodes(declaration)) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { - var baseType = getTypeFromTypeReferenceNode(node); + var baseType = getTypeFromHeritageClauseElement(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10131,16 +15051,16 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 200); - var type = getTypeFromTypeNode(declaration.type); + var declaration = ts.getDeclarationOfKind(symbol, 203); + var type = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var _declaration = ts.getDeclarationOfKind(symbol, 200); - error(_declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + var declaration = ts.getDeclarationOfKind(symbol, 203); + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; } @@ -10196,7 +15116,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -10204,14 +15124,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSymbols.length; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -10220,7 +15140,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSignatures.length; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -10281,14 +15201,15 @@ var ts; var baseType = classType.baseTypes[0]; var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); return ts.map(baseSignatures, function (baseSignature) { - var signature = baseType.flags & 4096 ? - getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; return signature; }); } - return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; + return [ + createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false) + ]; } function createTupleTypeMemberSymbols(memberTypes) { var members = {}; @@ -10317,16 +15238,18 @@ var ts; return true; } function getUnionSignatures(types, kind) { - var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var signatureLists = ts.map(types, function (t) { + return getSignaturesOfType(t, kind); + }); var signatures = signatureLists[0]; - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; } } - for (var _i_1 = 1; _i_1 < signatureLists.length; _i_1++) { - if (!signatureListsIdentical(signatures, signatureLists[_i_1])) { + for (var i_1 = 1; i_1 < signatureLists.length; i_1++) { + if (!signatureListsIdentical(signatures, signatureLists[i_1])) { return emptyArray; } } @@ -10334,13 +15257,15 @@ var ts; for (var i = 0; i < result.length; i++) { var s = result[i]; s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); + s.unionSignatures = ts.map(signatureLists, function (signatures) { + return signatures[i]; + }); } return result; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -10476,7 +15401,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -10485,7 +15410,9 @@ var ts; return undefined; } if (!props) { - props = [prop]; + props = [ + prop + ]; } else { props.push(prop); @@ -10494,12 +15421,12 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0, _b = props.length; _a < _b; _a++) { - var _prop = props[_a]; - if (_prop.declarations) { - declarations.push.apply(declarations, _prop.declarations); + for (var _a = 0; _a < props.length; _a++) { + var prop = props[_a]; + if (prop.declarations) { + declarations.push.apply(declarations, prop.declarations); } - propTypes.push(getTypeOfSymbol(_prop)); + propTypes.push(getTypeOfSymbol(prop)); } var result = createSymbol(4 | 67108864 | 268435456, name); result.unionType = unionType; @@ -10536,9 +15463,9 @@ var ts; } } if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { - var _symbol = getPropertyOfObjectType(globalFunctionType, name); - if (_symbol) - return _symbol; + var symbol = getPropertyOfObjectType(globalFunctionType, name); + if (symbol) + return symbol; } return getPropertyOfObjectType(globalObjectType, name); } @@ -10594,8 +15521,7 @@ var ts; var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var classType = declaration.kind === 135 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; - var typeParameters = classType ? classType.typeParameters : - declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; @@ -10619,7 +15545,7 @@ var ts; returnType = classType; } else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); + returnType = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } else { if (declaration.kind === 136 && !ts.hasDynamicName(declaration)) { @@ -10643,7 +15569,7 @@ var ts; switch (node.kind) { case 142: case 143: - case 197: + case 200: case 134: case 133: case 135: @@ -10727,8 +15653,12 @@ var ts; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; - type.callSignatures = !isConstructor ? [signature] : emptyArray; - type.constructSignatures = isConstructor ? [signature] : emptyArray; + type.callSignatures = !isConstructor ? [ + signature + ] : emptyArray; + type.constructSignatures = isConstructor ? [ + signature + ] : emptyArray; signature.isolatedSignatureType = type; } return signature.isolatedSignatureType; @@ -10741,7 +15671,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -10756,9 +15686,7 @@ var ts; } function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType - : undefined; + return declaration ? declaration.type ? getTypeFromTypeNodeOrHeritageClauseElement(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { if (!type.constraint) { @@ -10767,7 +15695,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128).constraint); + type.constraint = getTypeFromTypeNodeOrHeritageClauseElement(ts.getDeclarationOfKind(type.symbol, 128).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -10791,7 +15719,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } @@ -10814,7 +15742,9 @@ var ts; return links.isIllegalTypeReferenceInConstraint; } var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { + return d.parent === currentNode.parent; + })) { currentNode = currentNode.parent; } links.isIllegalTypeReferenceInConstraint = currentNode.kind === 128; @@ -10828,7 +15758,9 @@ var ts; if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { + return d.parent == typeParameter.parent; + }); } } if (links.isIllegalTypeReferenceInConstraint) { @@ -10842,31 +15774,40 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReferenceNode(node) { + function getTypeFromTypeReference(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromHeritageClauseElement(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromTypeReferenceOrHeritageClauseElement(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var symbol = resolveEntityName(node.typeName, 793056); var type; - if (symbol) { - if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - type = unknownType; - } - else { - type = getDeclaredTypeOfSymbol(symbol); - if (type.flags & (1024 | 2048) && type.flags & 4096) { - var typeParameters = type.typeParameters; - if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); - } - else { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); - type = undefined; - } + if (node.kind !== 177 || ts.isSupportedHeritageClauseElement(node)) { + var typeNameOrExpression = node.kind === 141 ? node.typeName : node.expression; + var symbol = resolveEntityName(typeNameOrExpression, 793056); + if (symbol) { + if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; } else { - if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); - type = undefined; + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 | 2048) && type.flags & 4096) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNodeOrHeritageClauseElement)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } } } } @@ -10885,12 +15826,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 198: - case 199: case 201: + case 202: + case 204: return declaration; } } @@ -10927,12 +15868,14 @@ var ts; } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); - return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [ + elementType + ]) : emptyObjectType; } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + links.resolvedType = createArrayType(getTypeFromTypeNodeOrHeritageClauseElement(node.elementType)); } return links.resolvedType; } @@ -10948,7 +15891,7 @@ var ts; function getTypeFromTupleTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNodeOrHeritageClauseElement)); } return links.resolvedType; } @@ -10968,13 +15911,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -10992,7 +15935,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -11039,7 +15982,7 @@ var ts; function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNodeOrHeritageClauseElement), true); } return links.resolvedType; } @@ -11065,7 +16008,7 @@ var ts; } return links.resolvedType; } - function getTypeFromTypeNode(node) { + function getTypeFromTypeNodeOrHeritageClauseElement(node) { switch (node.kind) { case 112: return anyType; @@ -11082,7 +16025,9 @@ var ts; case 8: return getTypeFromStringLiteral(node); case 141: - return getTypeFromTypeReferenceNode(node); + return getTypeFromTypeReference(node); + case 177: + return getTypeFromHeritageClauseElement(node); case 144: return getTypeFromTypeQueryNode(node); case 146: @@ -11092,7 +16037,7 @@ var ts; case 148: return getTypeFromUnionTypeNode(node); case 149: - return getTypeFromTypeNode(node.type); + return getTypeFromTypeNodeOrHeritageClauseElement(node.type); case 142: case 143: case 145: @@ -11108,7 +16053,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _n = items.length; _i < _n; _i++) { + for (var _i = 0; _i < items.length; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -11117,15 +16062,21 @@ var ts; return items; } function createUnaryTypeMapper(source, target) { - return function (t) { return t === source ? target : t; }; + return function (t) { + return t === source ? target : t; + }; } function createBinaryTypeMapper(source1, target1, source2, target2) { - return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; + return function (t) { + return t === source1 ? target1 : t === source2 ? target2 : t; + }; } function createTypeMapper(sources, targets) { switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + case 1: + return createUnaryTypeMapper(sources[0], targets[0]); + case 2: + return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -11137,18 +16088,24 @@ var ts; }; } function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; + return function (t) { + return t === source ? anyType : t; + }; } function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + return function (t) { + return t === source1 || t === source2 ? anyType : t; + }; } function createTypeEraser(sources) { switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); + case 1: + return createUnaryTypeEraser(sources[0]); + case 2: + return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _n = sources.length; _i < _n; _i++) { + for (var _i = 0; _i < sources.length; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -11172,7 +16129,9 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return mapper2(mapper1(t)); }; + return function (t) { + return mapper2(mapper1(t)); + }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -11233,8 +16192,7 @@ var ts; return mapper(type); } if (type.flags & 32768) { - return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? - instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -11259,12 +16217,10 @@ var ts; case 153: return ts.forEach(node.elements, isContextSensitive); case 170: - return isContextSensitive(node.whenTrue) || - isContextSensitive(node.whenFalse); + return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); case 169: - return node.operatorToken.kind === 49 && - (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 221: + return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 224: return isContextSensitive(node.initializer); case 134: case 133: @@ -11275,7 +16231,9 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { + return p.type; + }); } function getTypeWithoutConstructors(type) { if (type.flags & 48128) { @@ -11347,7 +16305,7 @@ var ts; errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } function isRelatedTo(source, target, reportErrors, headMessage) { - var _result; + var result; if (source === target) return -1; if (relation !== identityRelation) { @@ -11371,54 +16329,53 @@ var ts; if (source.flags & 16384 || target.flags & 16384) { if (relation === identityRelation) { if (source.flags & 16384 && target.flags & 16384) { - if (_result = unionTypeRelatedToUnionType(source, target)) { - if (_result &= unionTypeRelatedToUnionType(target, source)) { - return _result; + if (result = unionTypeRelatedToUnionType(source, target)) { + if (result &= unionTypeRelatedToUnionType(target, source)) { + return result; } } } else if (source.flags & 16384) { - if (_result = unionTypeRelatedToType(source, target, reportErrors)) { - return _result; + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; } } else { - if (_result = unionTypeRelatedToType(target, source, reportErrors)) { - return _result; + if (result = unionTypeRelatedToType(target, source, reportErrors)) { + return result; } } } else { if (source.flags & 16384) { - if (_result = unionTypeRelatedToType(source, target, reportErrors)) { - return _result; + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; } } else { - if (_result = typeRelatedToUnionType(source, target, reportErrors)) { - return _result; + if (result = typeRelatedToUnionType(source, target, reportErrors)) { + return result; } } } } else if (source.flags & 512 && target.flags & 512) { - if (_result = typeParameterRelatedTo(source, target, reportErrors)) { - return _result; + if (result = typeParameterRelatedTo(source, target, reportErrors)) { + return result; } } else { var saveErrorInfo = errorInfo; if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (_result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { - return _result; + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; } } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && - (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors))) { errorInfo = saveErrorInfo; - return _result; + return result; } } if (reportErrors) { @@ -11434,17 +16391,17 @@ var ts; return 0; } function unionTypeRelatedToUnionType(source, target) { - var _result = -1; + var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { return 0; } - _result &= related; + result &= related; } - return _result; + return result; } function typeRelatedToUnionType(source, target, reportErrors) { var targetTypes = target.types; @@ -11457,28 +16414,28 @@ var ts; return 0; } function unionTypeRelatedToType(source, target, reportErrors) { - var _result = -1; + var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return 0; } - _result &= related; + result &= related; } - return _result; + return result; } function typesRelatedTo(sources, targets, reportErrors) { - var _result = -1; + var result = -1; for (var i = 0, len = sources.length; i < len; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0; } - _result &= related; + result &= related; } - return _result; + return result; } function typeParameterRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -11543,20 +16500,20 @@ var ts; expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; - var _result; + var result; if (expandingFlags === 3) { - _result = 1; + result = 1; } else { - _result = propertiesRelatedTo(source, target, reportErrors); - if (_result) { - _result &= signaturesRelatedTo(source, target, 0, reportErrors); - if (_result) { - _result &= signaturesRelatedTo(source, target, 1, reportErrors); - if (_result) { - _result &= stringIndexTypesRelatedTo(source, target, reportErrors); - if (_result) { - _result &= numberIndexTypesRelatedTo(source, target, reportErrors); + result = propertiesRelatedTo(source, target, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 0, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (result) { + result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (result) { + result &= numberIndexTypesRelatedTo(source, target, reportErrors); } } } @@ -11564,23 +16521,23 @@ var ts; } expandingFlags = saveExpandingFlags; depth--; - if (_result) { + if (result) { var maybeCache = maybeStack[depth]; - var destinationCache = (_result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; ts.copyMap(maybeCache, destinationCache); } else { relation[id] = reportErrors ? 3 : 2; } - return _result; + return result; } function isDeeplyNestedGeneric(type, stack) { if (type.flags & 4096 && depth >= 10) { - var _target = type.target; + var target_1 = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === _target) { + if (t.flags & 4096 && t.target === target_1) { count++; if (count >= 10) return true; @@ -11593,10 +16550,10 @@ var ts; if (relation === identityRelation) { return propertiesIdenticalTo(source, target); } - var _result = -1; + var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -11648,7 +16605,7 @@ var ts; } return 0; } - _result &= related; + result &= related; if (sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); @@ -11658,7 +16615,7 @@ var ts; } } } - return _result; + return result; } function propertiesIdenticalTo(source, target) { var sourceProperties = getPropertiesOfObjectType(source); @@ -11666,8 +16623,8 @@ var ts; if (sourceProperties.length !== targetProperties.length) { return 0; } - var _result = -1; - for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { + var result = -1; + for (var _i = 0; _i < sourceProperties.length; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -11677,9 +16634,9 @@ var ts; if (!related) { return 0; } - _result &= related; + result &= related; } - return _result; + return result; } function signaturesRelatedTo(source, target, kind, reportErrors) { if (relation === identityRelation) { @@ -11690,18 +16647,18 @@ var ts; } var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); - var _result = -1; + var result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceSignatures.length; _a++) { var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { - _result &= related; + result &= related; errorInfo = saveErrorInfo; continue outer; } @@ -11711,7 +16668,7 @@ var ts; return 0; } } - return _result; + return result; } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { @@ -11741,14 +16698,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - var _result = -1; + var result = -1; for (var i = 0; i < checkCount; i++) { - var _s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var _t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + var s_1 = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var t_1 = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); var saveErrorInfo = errorInfo; - var related = isRelatedTo(_s, _t, reportErrors); + var related = isRelatedTo(s_1, t_1, reportErrors); if (!related) { - related = isRelatedTo(_t, _s, false); + related = isRelatedTo(t_1, s_1, false); if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); @@ -11757,13 +16714,13 @@ var ts; } errorInfo = saveErrorInfo; } - _result &= related; + result &= related; } var t = getReturnTypeOfSignature(target); if (t === voidType) - return _result; + return result; var s = getReturnTypeOfSignature(source); - return _result & isRelatedTo(s, t, reportErrors); + return result & isRelatedTo(s, t, reportErrors); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -11771,15 +16728,15 @@ var ts; if (sourceSignatures.length !== targetSignatures.length) { return 0; } - var _result = -1; + var result = -1; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); if (!related) { return 0; } - _result &= related; + result &= related; } - return _result; + return result; } function stringIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -11876,9 +16833,7 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || - source.minArgumentCount !== target.minArgumentCount || - source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -11899,14 +16854,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - for (var _i = 0, _len = source.parameters.length; _i < _len; _i++) { - var s = source.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[_i]); - var t = target.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[_i]); - var _related = compareTypes(s, t); - if (!_related) { + for (var i = 0, len = source.parameters.length; i < len; i++) { + var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var related = compareTypes(s, t); + if (!related) { return 0; } - result &= _related; + result &= related; } if (compareReturnTypes) { result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); @@ -11914,7 +16869,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -11922,7 +16877,9 @@ var ts; return true; } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + return ts.forEach(types, function (t) { + return isSupertypeOfEach(t, types) ? t : undefined; + }); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -12020,17 +16977,17 @@ var ts; return reportWideningErrorsInType(type.typeArguments[0]); } if (type.flags & 131072) { - var _errorReported = false; + var errorReported = false; ts.forEach(getPropertiesOfObjectType(type), function (p) { var t = getTypeOfSymbol(p); if (t.flags & 262144) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } - _errorReported = true; + errorReported = true; } }); - return _errorReported; + return errorReported; } return false; } @@ -12043,11 +17000,9 @@ var ts; diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 129: - diagnostic = declaration.dotDotDotToken ? - ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : - ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 197: + case 200: case 134: case 133: case 136: @@ -12100,9 +17055,13 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { + for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; - inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); + inferences.push({ + primary: undefined, + secondary: undefined, + isFixed: false + }); } return { typeParameters: typeParameters, @@ -12127,11 +17086,11 @@ var ts; } function isWithinDepthLimit(type, stack) { if (depth >= 5) { - var _target = type.target; + var target_2 = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === _target) { + if (t.flags & 4096 && t.target === target_2) { count++; } } @@ -12149,9 +17108,7 @@ var ts; if (target === typeParameters[i]) { var inferences = context.inferences[i]; if (!inferences.isFixed) { - var candidates = inferiority ? - inferences.secondary || (inferences.secondary = []) : - inferences.primary || (inferences.primary = []); + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); if (!ts.contains(candidates, source)) { candidates.push(source); } @@ -12163,16 +17120,16 @@ var ts; else if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { var sourceTypes = source.typeArguments; var targetTypes = target.typeArguments; - for (var _i = 0; _i < sourceTypes.length; _i++) { - inferFromTypes(sourceTypes[_i], targetTypes[_i]); + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); } } else if (target.flags & 16384) { - var _targetTypes = target.types; + var targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _a = 0, _n = _targetTypes.length; _a < _n; _a++) { - var t = _targetTypes[_a]; + for (var _i = 0; _i < targetTypes.length; _i++) { + var t = targetTypes[_i]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -12188,14 +17145,13 @@ var ts; } } else if (source.flags & 16384) { - var _sourceTypes = source.types; - for (var _b = 0, _c = _sourceTypes.length; _b < _c; _b++) { - var sourceType = _sourceTypes[_b]; + var sourceTypes = source.types; + for (var _a = 0; _a < sourceTypes.length; _a++) { + var sourceType = sourceTypes[_a]; inferFromTypes(sourceType, target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || - (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -12216,7 +17172,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -12289,7 +17245,7 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; } return links.resolvedSymbol; } @@ -12311,8 +17267,12 @@ var ts; function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { if (type.flags & 16384) { var types = type.types; - if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); + if (ts.forEach(types, function (t) { + return !!(t.flags & typeKind) === isOfTypeKind; + })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { + return !(t.flags & typeKind) === isOfTypeKind; + })); if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } @@ -12360,7 +17320,7 @@ var ts; switch (node.kind) { case 169: return isAssignedInBinaryExpression(node); - case 195: + case 198: case 152: return isAssignedInVariableDeclaration(node); case 150: @@ -12380,24 +17340,24 @@ var ts; case 168: case 170: case 173: - case 176: - case 177: case 179: case 180: - case 181: case 182: case 183: case 184: case 185: + case 186: + case 187: case 188: - case 189: - case 190: - case 217: - case 218: case 191: case 192: case 193: case 220: + case 221: + case 194: + case 195: + case 196: + case 223: return ts.forEachChild(node, isAssignedIn); } return false; @@ -12405,13 +17365,14 @@ var ts; } function resolveLocation(node) { var containerNodes = []; - for (var _parent = node.parent; _parent; _parent = _parent.parent) { - if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && - isContextSensitive(_parent)) { - containerNodes.unshift(_parent); + for (var parent_3 = node.parent; parent_3; parent_3 = parent_3.parent) { + if ((ts.isExpression(parent_3) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent_3)) { + containerNodes.unshift(parent_3); } } - ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); + ts.forEach(containerNodes, function (node) { + getTypeOfNode(node); + }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -12433,7 +17394,7 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 180: + case 183: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } @@ -12453,9 +17414,9 @@ var ts; } } break; - case 224: - case 202: - case 197: + case 227: + case 205: + case 200: case 134: case 133: case 136: @@ -12540,7 +17501,9 @@ var ts; return targetType; } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + return getUnionType(ts.filter(type.types, function (t) { + return isTypeSubtypeOf(t, targetType); + })); } return type; } @@ -12596,17 +17559,15 @@ var ts; return false; } function checkBlockScopedBindingCapturedInLoop(node, symbol) { - if (languageVersion >= 2 || - (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 220) { + if (languageVersion >= 2 || (symbol.flags & 2) === 0 || symbol.valueDeclaration.parent.kind === 223) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 196) { + while (container.kind !== 199) { container = container.parent; } container = container.parent; - if (container.kind === 177) { + if (container.kind === 180) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -12623,7 +17584,7 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; getNodeLinks(node).flags |= 2; if (container.kind === 132 || container.kind === 135) { getNodeLinks(classNode).flags |= 4; @@ -12640,10 +17601,10 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 202: + case 205: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 201: + case 204: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 135: @@ -12664,7 +17625,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -12681,9 +17642,9 @@ var ts; } function checkSuperExpression(node) { var isCallExpression = node.parent.kind === 157 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); var baseClass; - if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); baseClass = classType.baseTypes.length && classType.baseTypes[0]; } @@ -12704,23 +17665,12 @@ var ts; container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 198) { + if (container && container.parent && container.parent.kind === 201) { if (container.flags & 128) { - canUseSuperExpression = - container.kind === 134 || - container.kind === 133 || - container.kind === 136 || - container.kind === 137; + canUseSuperExpression = container.kind === 134 || container.kind === 133 || container.kind === 136 || container.kind === 137; } else { - canUseSuperExpression = - container.kind === 134 || - container.kind === 133 || - container.kind === 136 || - container.kind === 137 || - container.kind === 132 || - container.kind === 131 || - container.kind === 135; + canUseSuperExpression = container.kind === 134 || container.kind === 133 || container.kind === 136 || container.kind === 137 || container.kind === 132 || container.kind === 131 || container.kind === 135; } } } @@ -12767,8 +17717,7 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && - funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -12780,7 +17729,7 @@ var ts; var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var type = getContextuallyTypedParameterType(declaration); @@ -12846,7 +17795,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -12854,7 +17803,10 @@ var ts; mappedType = t; } else if (!mappedTypes) { - mappedTypes = [mappedType, t]; + mappedTypes = [ + mappedType, + t + ]; } else { mappedTypes.push(t); @@ -12870,13 +17822,17 @@ var ts; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); + return applyToContextualType(type, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }) : getIndexTypeOfObjectOrUnionType(type, kind)); } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -12896,8 +17852,7 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || - getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -12906,9 +17861,7 @@ var ts; var type = getContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) - || getIndexTypeOfContextualType(type, 1) - || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); } return undefined; } @@ -12923,35 +17876,35 @@ var ts; if (node.contextualType) { return node.contextualType; } - var _parent = node.parent; - switch (_parent.kind) { - case 195: + var parent = node.parent; + switch (parent.kind) { + case 198: case 129: case 132: case 131: case 152: return getContextualTypeForInitializerExpression(node); case 163: - case 188: + case 191: return getContextualTypeForReturnExpression(node); case 157: case 158: - return getContextualTypeForArgument(_parent, node); + return getContextualTypeForArgument(parent, node); case 160: - return getTypeFromTypeNode(_parent.type); + return getTypeFromTypeNodeOrHeritageClauseElement(parent.type); case 169: return getContextualTypeForBinaryOperand(node); - case 221: - return getContextualTypeForObjectLiteralElement(_parent); + case 224: + return getContextualTypeForObjectLiteralElement(parent); case 153: return getContextualTypeForElementExpression(node); case 170: return getContextualTypeForConditionalOperand(node); - case 175: - ts.Debug.assert(_parent.parent.kind === 171); - return getContextualTypeForSubstitutionExpression(_parent.parent, node); + case 176: + ts.Debug.assert(parent.parent.kind === 171); + return getContextualTypeForSubstitutionExpression(parent.parent, node); case 161: - return getContextualType(_parent); + return getContextualType(parent); } return undefined; } @@ -12972,9 +17925,7 @@ var ts; } function getContextualSignature(node) { ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); if (!type) { return undefined; } @@ -12983,16 +17934,17 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; - if (signatureList && - getSignaturesOfObjectOrUnionType(current, 0).length > 1) { + if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; } var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { - signatureList = [signature]; + signatureList = [ + signature + ]; } else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; @@ -13014,15 +17966,15 @@ var ts; return mapper && mapper !== identityMapper; } function isAssignmentTarget(node) { - var _parent = node.parent; - if (_parent.kind === 169 && _parent.operatorToken.kind === 53 && _parent.left === node) { + var parent = node.parent; + if (parent.kind === 169 && parent.operatorToken.kind === 53 && parent.left === node) { return true; } - if (_parent.kind === 221) { - return isAssignmentTarget(_parent.parent); + if (parent.kind === 224) { + return isAssignmentTarget(parent.parent); } - if (_parent.kind === 153) { - return isAssignmentTarget(_parent); + if (parent.kind === 153) { + return isAssignmentTarget(parent); } return false; } @@ -13087,24 +18039,20 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 221 || - memberDecl.kind === 222 || - ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 224 || memberDecl.kind === 225 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 221) { + if (memberDecl.kind === 224) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 134) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 222); - type = memberDecl.name.kind === 127 - ? unknownType - : checkExpression(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 225); + type = memberDecl.name.kind === 127 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -13137,15 +18085,15 @@ var ts; for (var i = 0; i < propertiesArray.length; i++) { var propertyDecl = node.properties[i]; if (kind === 0 || isNumericName(propertyDecl.name)) { - var _type = getTypeOfSymbol(propertiesArray[i]); - if (!ts.contains(propTypes, _type)) { - propTypes.push(_type); + var type = getTypeOfSymbol(propertiesArray[i]); + if (!ts.contains(propTypes, type)) { + propTypes.push(type); } } } - var _result = propTypes.length ? getUnionType(propTypes) : undefinedType; - typeFlags |= _result.flags; - return _result; + var result_1 = propTypes.length ? getUnionType(propTypes) : undefinedType; + typeFlags |= result_1.flags; + return result_1; } return undefined; } @@ -13161,7 +18109,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 198); + var enclosingClassDeclaration = ts.getAncestor(node, 201); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -13220,9 +18168,7 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 155 - ? node.expression - : node.left; + var left = node.kind === 155 ? node.expression : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); @@ -13248,9 +18194,9 @@ var ts; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { - var _start = node.end - "]".length; - var _end = node.end; - grammarErrorAtPos(sourceFile, _start, _end - _start, ts.Diagnostics.Expression_expected); + var start = node.end - "]".length; + var end = node.end; + grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); } } var objectType = getApparentType(checkExpression(node.expression)); @@ -13259,21 +18205,20 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && - (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } if (node.argumentExpression) { - var _name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (_name !== undefined) { - var prop = getPropertyOfType(objectType, _name); + var name_6 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name_6 !== undefined) { + var prop = getPropertyOfType(objectType, name_6); if (prop) { getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } else if (isConstEnum) { - error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, _name, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_6, symbolToString(objectType.symbol)); return unknownType; } } @@ -13360,22 +18305,22 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var _parent = signature.declaration && signature.declaration.parent; + var parent_4 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && _parent === lastParent) { + if (lastParent && parent_4 === lastParent) { index++; } else { - lastParent = _parent; + lastParent = parent_4; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = _parent; + lastParent = parent_4; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -13409,7 +18354,7 @@ var ts; var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); - callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } else { var templateLiteral = tagExpression.template; @@ -13427,8 +18372,7 @@ var ts; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -13445,8 +18389,7 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -13470,27 +18413,27 @@ var ts; if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) { context.failedTypeParameterIndex = undefined; } - for (var _i = 0; _i < args.length; _i++) { - var arg = args[_i]; - if (arg.kind !== 174) { - var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : _i); + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + if (arg.kind !== 175) { + var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = void 0; - if (_i === 0 && args[_i].parent.kind === 159) { + if (i === 0 && args[i].parent.kind === 159) { argType = globalTemplateStringsArrayType; } else { - var mapper = excludeArgument && excludeArgument[_i] !== undefined ? identityMapper : inferenceMapper; + var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } inferTypes(context, argType, paramType); } } if (excludeArgument) { - for (var _i_1 = 0; _i_1 < args.length; _i_1++) { - if (excludeArgument[_i_1] === false) { - var _arg = args[_i_1]; - var _paramType = getTypeAtPosition(signature, _arg.kind === 173 ? -1 : _i_1); - inferTypes(context, checkExpressionWithContextualType(_arg, _paramType, inferenceMapper), _paramType); + for (var i = 0; i < args.length; i++) { + if (excludeArgument[i] === false) { + var arg = args[i]; + var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); + inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -13501,7 +18444,7 @@ var ts; var typeArgumentsAreAssignable = true; for (var i = 0; i < typeParameters.length; i++) { var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); + var typeArgument = getTypeFromTypeNodeOrHeritageClauseElement(typeArgNode); typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); @@ -13515,11 +18458,9 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); - var argType = i === 0 && node.kind === 159 ? globalTemplateStringsArrayType : - arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : - checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = i === 0 && node.kind === 159 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -13531,7 +18472,9 @@ var ts; var args; if (node.kind === 159) { var template = node.template; - args = [template]; + args = [ + template + ]; if (template.kind === 171) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); @@ -13545,8 +18488,8 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91) { - var containingClass = ts.getAncestor(callExpression, 198); - var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + var containingClass = ts.getAncestor(callExpression, 201); + var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } else { @@ -13613,7 +18556,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -13622,45 +18565,43 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _a = 0, _b = candidates.length; _a < _b; _a++) { - var originalCandidate = candidates[_a]; + for (var _i = 0; _i < candidates.length; _i++) { + var originalCandidate = candidates[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; } - var _candidate = void 0; + var candidate = void 0; var typeArgumentsAreValid = void 0; - var inferenceContext = originalCandidate.typeParameters - ? createInferenceContext(originalCandidate.typeParameters, false) - : undefined; + var inferenceContext = originalCandidate.typeParameters ? createInferenceContext(originalCandidate.typeParameters, false) : undefined; while (true) { - _candidate = originalCandidate; - if (_candidate.typeParameters) { + candidate = originalCandidate; + if (candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = new Array(_candidate.typeParameters.length); - typeArgumentsAreValid = checkTypeArguments(_candidate, typeArguments, typeArgumentTypes, false); + typeArgumentTypes = new Array(candidate.typeParameters.length); + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); } else { - inferTypeArguments(_candidate, args, excludeArgument, inferenceContext); + inferTypeArguments(candidate, args, excludeArgument, inferenceContext); typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; typeArgumentTypes = inferenceContext.inferredTypes; } if (!typeArgumentsAreValid) { break; } - _candidate = getSignatureInstantiation(_candidate, typeArgumentTypes); + candidate = getSignatureInstantiation(candidate, typeArgumentTypes); } - if (!checkApplicableSignature(node, args, _candidate, relation, excludeArgument, false)) { + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { break; } var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; if (index < 0) { - return _candidate; + return candidate; } excludeArgument[index] = false; } if (originalCandidate.typeParameters) { - var instantiatedCandidate = _candidate; + var instantiatedCandidate = candidate; if (typeArgumentsAreValid) { candidateForArgumentError = instantiatedCandidate; } @@ -13672,7 +18613,7 @@ var ts; } } else { - ts.Debug.assert(originalCandidate === _candidate); + ts.Debug.assert(originalCandidate === candidate); candidateForArgumentError = originalCandidate; } } @@ -13787,10 +18728,7 @@ var ts; } if (node.kind === 158) { var declaration = signature.declaration; - if (declaration && - declaration.kind !== 135 && - declaration.kind !== 139 && - declaration.kind !== 143) { + if (declaration && declaration.kind !== 135 && declaration.kind !== 139 && declaration.kind !== 143) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -13804,7 +18742,7 @@ var ts; } function checkTypeAssertion(node) { var exprType = checkExpression(node.expression); - var targetType = getTypeFromTypeNode(node.type); + var targetType = getTypeFromTypeNodeOrHeritageClauseElement(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { @@ -13815,13 +18753,9 @@ var ts; } function getTypeAtPosition(signature, pos) { if (pos >= 0) { - return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; } - return signature.hasRestParameter ? - getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : - anyArrayType; + return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -13831,9 +18765,9 @@ var ts; links.type = instantiateType(getTypeAtPosition(context, i), mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { - var _parameter = signature.parameters[signature.parameters.length - 1]; - var _links = getSymbolLinks(_parameter); - _links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); + var parameter = signature.parameters[signature.parameters.length - 1]; + var links = getSymbolLinks(parameter); + links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); } } function getReturnTypeFromBody(func, contextualMapper) { @@ -13842,7 +18776,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 176) { + if (func.body.kind !== 179) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -13880,7 +18814,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 192); + return (body.statements.length === 1) && (body.statements[0].kind === 195); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -13889,7 +18823,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 176) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 179) { return; } var bodyBlock = func.body; @@ -13941,16 +18875,16 @@ var ts; function checkFunctionExpressionOrObjectLiteralMethodBody(node) { ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); if (node.type) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (node.body) { - if (node.body.kind === 176) { + if (node.body.kind === 179) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); if (node.type) { - checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrHeritageClauseElement(node.type), node.body, undefined); } checkFunctionExpressionBodies(node.body); } @@ -13970,14 +18904,16 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 65: { - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; - } - case 155: { - var _symbol = findSymbol(n); - return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; - } + case 65: + { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + } + case 155: + { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; + } case 156: return true; case 161: @@ -13989,39 +18925,28 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 65: - case 155: { - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; - } - case 156: { - var index = n.argumentExpression; - var _symbol = findSymbol(n.expression); - if (_symbol && index && index.kind === 8) { - var _name = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + case 155: + { + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + } + case 156: + { + var index = n.argumentExpression; + var symbol = findSymbol(n.expression); + if (symbol && index && index.kind === 8) { + var name_7 = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_7); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + } + return false; } - return false; - } case 161: return isConstVariableReference(n.expression); default: return false; } } - function isImportedNameFromExternalModule(n) { - switch (n.kind) { - case 156: - case 155: { - var symbol = findSymbol(n.expression); - return symbol && symbol.flags & 8388608 && isExternalModuleSymbol(resolveAlias(symbol)); - } - case 161: - return isImportedNameFromExternalModule(n.expression); - default: - return false; - } - } if (!isReferenceOrErrorExpression(n)) { error(n, invalidReferenceMessage); return false; @@ -14030,9 +18955,6 @@ var ts; error(n, constantVariableMessage); return false; } - if (isImportedNameFromExternalModule(n)) { - error(n, invalidReferenceMessage); - } return true; } function checkDeleteExpression(node) { @@ -14090,7 +19012,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -14106,7 +19028,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -14142,19 +19064,16 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 221 || p.kind === 222) { - var _name = p.name; - var type = sourceType.flags & 1 ? sourceType : - getTypeOfPropertyOfType(sourceType, _name.text) || - isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || - getIndexTypeOfType(sourceType, 0); + if (p.kind === 224 || p.kind === 225) { + var name_8 = p.name; + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name_8.text) || isNumericLiteralName(name_8.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { - checkDestructuringAssignment(p.initializer || _name, type); + checkDestructuringAssignment(p.initializer || name_8, type); } else { - error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(_name)); + error(name_8, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_8)); } } else { @@ -14171,12 +19090,10 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { var propName = "" + i; - var type = sourceType.flags & 1 ? sourceType : - isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : - getIndexTypeOfType(sourceType, 1); + var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } @@ -14257,9 +19174,7 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && - (rightType.flags & 8) && - (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { @@ -14321,7 +19236,10 @@ var ts; case 48: return rightType; case 49: - return getUnionType([leftType, rightType]); + return getUnionType([ + leftType, + rightType + ]); case 53: checkAssignmentOperator(rightType); return rightType; @@ -14329,9 +19247,7 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : - someConstituentTypeHasKind(rightType, 1048576) ? node.right : - undefined; + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); return false; @@ -14377,7 +19293,10 @@ var ts; checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); var type2 = checkExpression(node.whenFalse, contextualMapper); - return getUnionType([type1, type2]); + return getUnionType([ + type1, + type2 + ]); } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { @@ -14441,9 +19360,7 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 155 && node.parent.expression === node) || - (node.parent.kind === 156 && node.parent.expression === node) || - ((node.kind === 65 || node.kind === 126) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 155 && node.parent.expression === node) || (node.parent.kind === 156 && node.parent.expression === node) || ((node.kind === 65 || node.kind === 126) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -14493,6 +19410,8 @@ var ts; return checkTypeAssertion(node); case 161: return checkExpression(node.expression, contextualMapper); + case 174: + return checkClassExpression(node); case 162: case 163: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -14512,7 +19431,7 @@ var ts; return checkConditionalExpression(node, contextualMapper); case 173: return checkSpreadElementExpression(node, contextualMapper); - case 174: + case 175: return undefinedType; case 172: checkYieldExpression(node); @@ -14531,6 +19450,12 @@ var ts; } } function checkParameter(node) { + // Grammar checking + // It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs as the + // Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code + // or if its FunctionBody is strict code(11.1.5). + // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a + // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); @@ -14553,9 +19478,7 @@ var ts; if (node.kind === 140) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 || node.kind === 197 || node.kind === 143 || - node.kind === 138 || node.kind === 135 || - node.kind === 139) { + else if (node.kind === 142 || node.kind === 200 || node.kind === 143 || node.kind === 138 || node.kind === 135 || node.kind === 139) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -14579,7 +19502,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 199) { + if (node.kind === 202) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -14589,7 +19512,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -14647,32 +19570,33 @@ var ts; } switch (n.kind) { case 162: - case 197: + case 200: case 163: - case 154: return false; - default: return ts.forEachChild(n, containsSuperCall); + case 154: + return false; + default: + return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { if (n.kind === 93) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 && n.kind !== 197) { + else if (n.kind !== 162 && n.kind !== 200) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 132 && - !(n.flags & 128) && - !!n.initializer; + return n.kind === 132 && !(n.flags & 128) && !!n.initializer; } - if (ts.getClassBaseTypeNode(node.parent)) { + if (ts.getClassExtendsHeritageClauseElement(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { + return p.flags & (16 | 32 | 64); + }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 179 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 182 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -14716,9 +19640,15 @@ var ts; function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeReference(node) { + function checkTypeReferenceNode(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkHeritageClauseElement(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkTypeReferenceOrHeritageClauseElement(node) { checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceNode(node); + var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); if (type !== unknownType && node.typeArguments) { var len = node.typeArguments.length; for (var i = 0; i < len; i++) { @@ -14771,7 +19701,7 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 199) { + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202) { ts.Debug.assert(signatureDeclarationNode.kind === 138 || signatureDeclarationNode.kind === 139); var signatureKind = signatureDeclarationNode.kind === 138 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); @@ -14781,7 +19711,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { + for (var _i = 0; _i < signaturesToCheck.length; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -14791,7 +19721,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 199 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 202 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -14848,7 +19778,7 @@ var ts; var declarations = symbol.declarations; var isConstructor = (symbol.flags & 16384) !== 0; function reportImplementationExpectedError(node) { - if (node.name && ts.getFullWidth(node.name) === 0) { + if (node.name && ts.nodeIsMissing(node.name)) { return; } var seen = false; @@ -14862,16 +19792,16 @@ var ts; }); if (subsequentNode) { if (subsequentNode.kind === node.kind) { - var _errorNode = subsequentNode.name || subsequentNode; + var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { ts.Debug.assert(node.kind === 134 || node.kind === 133); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(_errorNode, diagnostic); + error(errorNode_1, diagnostic); return; } else if (ts.nodeIsPresent(subsequentNode.body)) { - error(_errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); + error(errorNode_1, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); return; } } @@ -14887,15 +19817,15 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 199 || node.parent.kind === 145 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 202 || node.parent.kind === 145 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 197 || node.kind === 134 || node.kind === 133 || node.kind === 135) { + if (node.kind === 200 || node.kind === 134 || node.kind === 133 || node.kind === 135) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -14946,7 +19876,7 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + for (var _a = 0; _a < signatures.length; _a++) { var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); @@ -14992,19 +19922,19 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 199: - return 2097152; case 202: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 - ? 4194304 | 1048576 - : 4194304; - case 198: - case 201: - return 2097152 | 1048576; + return 2097152; case 205: + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; + case 201: + case 204: + return 2097152 | 1048576; + case 208: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); + ts.forEach(target.declarations, function (d) { + result |= getDeclarationSpaces(d); + }); return result; default: return 1048576; @@ -15015,10 +19945,12 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 198: + case 201: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); - var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]); + var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [ + classConstructorType + ]); checkTypeAssignableTo(exprType, classDecoratorType, node); break; case 132: @@ -15028,7 +19960,9 @@ var ts; case 136: case 137: var methodType = getTypeOfNode(node.parent); - var methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType, [methodType]); + var methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType, [ + methodType + ]); checkTypeAssignableTo(exprType, methodDecoratorType, node); break; case 129: @@ -15041,7 +19975,7 @@ var ts; return; } switch (node.kind) { - case 198: + case 201: case 134: case 136: case 137: @@ -15056,10 +19990,7 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || - checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionName(node.name) || - checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -15086,18 +20017,18 @@ var ts; } checkSourceElement(node.body); if (node.type && !isAccessor(node.kind)) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !node.type && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } } function checkBlock(node) { - if (node.kind === 176) { + if (node.kind === 179) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 203) { + if (ts.isFunctionBlock(node) || node.kind === 206) { checkFunctionExpressionBodies(node); } } @@ -15115,12 +20046,7 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 132 || - node.kind === 131 || - node.kind === 134 || - node.kind === 133 || - node.kind === 136 || - node.kind === 137) { + if (node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 133 || node.kind === 136 || node.kind === 137) { return false; } if (ts.isInAmbientContext(node)) { @@ -15141,8 +20067,8 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4) { - var _isDeclaration = node.kind !== 65; - if (_isDeclaration) { + var isDeclaration_1 = node.kind !== 65; + if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } else { @@ -15157,13 +20083,13 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } - if (ts.getClassBaseTypeNode(enclosingClass)) { - var _isDeclaration = node.kind !== 65; - if (_isDeclaration) { + if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { + var isDeclaration_2 = node.kind !== 65; + if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -15175,40 +20101,35 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 202 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 205 && ts.getModuleInstanceState(node) !== 1) { return; } - var _parent = getDeclarationContainer(node); - if (_parent.kind === 224 && ts.isExternalModule(_parent)) { + var parent = getDeclarationContainer(node); + if (parent.kind === 227 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkVarDeclaredNamesNotShadowed(node) { + // - ScriptBody : StatementList + // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList + // also occurs in the VarDeclaredNames of StatementList. if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { return; } - if (node.kind === 195 && !node.initializer) { + if (node.kind === 198 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && - localDeclarationSymbol !== symbol && - localDeclarationSymbol.flags & 2) { + if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 196); - var container = varDeclList.parent.kind === 177 && varDeclList.parent.parent - ? varDeclList.parent.parent - : undefined; - var namesShareScope = container && - (container.kind === 176 && ts.isFunctionLike(container.parent) || - container.kind === 203 || - container.kind === 202 || - container.kind === 224); + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199); + var container = varDeclList.parent.kind === 180 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; + var namesShareScope = container && (container.kind === 179 && ts.isFunctionLike(container.parent) || container.kind === 206 || container.kind === 205 || container.kind === 227); if (!namesShareScope) { - var _name = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, _name, _name); + var name_9 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_9, name_9); } } } @@ -15289,7 +20210,7 @@ var ts; } if (node.kind !== 132 && node.kind !== 131) { checkExportsOnMergedDeclarations(node); - if (node.kind === 195 || node.kind === 152) { + if (node.kind === 198 || node.kind === 152) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -15318,7 +20239,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 176 || node.kind === 154) { + if (node.kind === 179 || node.kind === 154) { return true; } node = node.parent; @@ -15346,12 +20267,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 196) { + if (node.initializer && node.initializer.kind == 199) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -15366,7 +20287,7 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { checkForInOrForOfVariableDeclaration(node); } else { @@ -15387,7 +20308,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -15422,21 +20343,44 @@ var ts; } function checkRightHandSideOfForOf(rhsExpression) { var expressionType = getTypeOfExpression(rhsExpression); - return languageVersion >= 2 - ? checkIteratedType(expressionType, rhsExpression) - : checkElementTypeOfArrayOrString(expressionType, rhsExpression); + return languageVersion >= 2 ? checkIteratedType(expressionType, rhsExpression) : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } function checkIteratedType(iterable, expressionForError) { ts.Debug.assert(languageVersion >= 2); var iteratedType = getIteratedType(iterable, expressionForError); if (expressionForError && iteratedType) { - var completeIterableType = globalIterableType !== emptyObjectType - ? createTypeReference(globalIterableType, [iteratedType]) - : emptyObjectType; + var completeIterableType = globalIterableType !== emptyObjectType ? createTypeReference(globalIterableType, [ + iteratedType + ]) : emptyObjectType; checkTypeAssignableTo(iterable, completeIterableType, expressionForError); } return iteratedType; function getIteratedType(iterable, expressionForError) { + // We want to treat type as an iterable, and get the type it is an iterable of. The iterable + // must have the following structure (annotated with the names of the variables below): + // + // { // iterable + // [Symbol.iterator]: { // iteratorFunction + // (): { // iterator + // next: { // iteratorNextFunction + // (): { // iteratorNextResult + // value: T // iteratorNextValue + // } + // } + // } + // } + // } + // + // T is the type we are after. At every level that involves analyzing return types + // of signatures, we union the return types of all the signatures. + // + // Another thing to note is that at any step of this process, we could run into a dead end, + // meaning either the property is missing, or we run into the anyType. If either of these things + // happens, we return undefined to signal that we could not find the iterated type. If a property + // is missing, and the previous step did not result in 'any', then we also give an error if the + // caller requested it. Then the caller can decide what to do in the case where there is no iterated + // type. This is different from returning anyType, because that would signify that we have matched the + // whole pattern and that T (above) is 'any'. if (allConstituentTypesHaveKind(iterable, 1)) { return undefined; } @@ -15496,9 +20440,7 @@ var ts; } if (!isArrayLikeType(arrayType)) { if (!reportedError) { - var diagnostic = hasStringConstituent - ? ts.Diagnostics.Type_0_is_not_an_array_type - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + var diagnostic = hasStringConstituent ? ts.Diagnostics.Type_0_is_not_an_array_type : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(expressionForError, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : unknownType; @@ -15508,7 +20450,10 @@ var ts; if (arrayElementType.flags & 258) { return stringType; } - return getUnionType([arrayElementType, stringType]); + return getUnionType([ + arrayElementType, + stringType + ]); } return arrayElementType; } @@ -15561,7 +20506,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 218 && !hasDuplicateDefaultClause) { + if (clause.kind === 221 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -15573,7 +20518,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 217) { + if (produceDiagnostics && clause.kind === 220) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -15590,7 +20535,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 191 && current.label.text === node.label.text) { + if (current.kind === 194 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -15654,9 +20599,9 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 198) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 201) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -15670,7 +20615,9 @@ var ts; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; if (!errorNode && (type.flags & 2048)) { - var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { + return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); + }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -15684,22 +20631,22 @@ var ts; if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { return; } - var _errorNode; + var errorNode; if (prop.valueDeclaration.name.kind === 127 || prop.parent === containingType.symbol) { - _errorNode = prop.valueDeclaration; + errorNode = prop.valueDeclaration; } else if (indexDeclaration) { - _errorNode = indexDeclaration; + errorNode = indexDeclaration; } else if (containingType.flags & 2048) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); - _errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { + return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); + }); + errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } - if (_errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 - ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 - : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; - error(_errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { + var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } } @@ -15729,7 +20676,15 @@ var ts; } } } + function checkClassExpression(node) { + grammarErrorOnNode(node, ts.Diagnostics.class_expressions_are_not_currently_supported); + ts.forEach(node.members, checkSourceElement); + return unknownType; + } function checkClassDeclaration(node) { + if (node.parent.kind !== 206 && node.parent.kind !== 227) { + grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + } checkGrammarClassDeclarationHeritageClauses(node); checkDecorators(node); if (node.name) { @@ -15742,10 +20697,13 @@ var ts; var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); var staticType = getTypeOfSymbol(symbol); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); + } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkTypeReference(baseTypeNode); + checkHeritageClauseElement(baseTypeNode); } if (type.baseTypes.length) { if (produceDiagnostics) { @@ -15753,19 +20711,24 @@ var ts; checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); var staticBaseType = getTypeOfSymbol(baseType.symbol); checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType.symbol !== resolveEntityName(baseTypeNode.typeName, 107455)) { + if (baseType.symbol !== resolveEntityName(baseTypeNode.expression, 107455)) { error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); } checkKindsOfPropertyMemberOverrides(type, baseType); } - checkExpressionOrQualifiedName(baseTypeNode.typeName); } - var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (type.baseTypes.length || (baseTypeNode && compilerOptions.separateCompilation)) { + checkExpressionOrQualifiedName(baseTypeNode.expression); + } + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - checkTypeReference(typeRefNode); + if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromTypeReferenceNode(typeRefNode); + var t = getTypeFromHeritageClauseElement(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { @@ -15788,8 +20751,21 @@ var ts; return s.flags & 16777216 ? getSymbolLinks(s).target : s; } function checkKindsOfPropertyMemberOverrides(type, baseType) { + // TypeScript 1.0 spec (April 2014): 8.2.3 + // A derived class inherits all members from its base class it doesn't override. + // Inheritance means that a derived class implicitly contains all non - overridden members of the base class. + // Both public and private property members are inherited, but only public property members can be overridden. + // A property member in a derived class is said to override a property member in a base class + // when the derived class property member has the same name and kind(instance or static) + // as the base class property member. + // The type of an overriding property member must be assignable(section 3.8.4) + // to the type of the overridden property member, or otherwise a compile - time error occurs. + // Base class instance member functions can be overridden by derived class instance member functions, + // but not by other kinds of members. + // Base class instance member variables and accessors can be overridden by + // derived class instance member variables and accessors, but not by other kinds of members. var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < baseProperties.length; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -15853,7 +20829,7 @@ var ts; if (!tp1.constraint || !tp2.constraint) { return false; } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + if (!isTypeIdenticalTo(getTypeFromTypeNodeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrHeritageClauseElement(tp2.constraint))) { return false; } } @@ -15864,15 +20840,23 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(type.declaredProperties, function (p) { + seen[p.name] = { + prop: p, + containingType: type + }; + }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0, _c = properties.length; _b < _c; _b++) { + for (var _b = 0; _b < properties.length; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { prop: prop, containingType: base }; + seen[prop.name] = { + prop: prop, + containingType: base + }; } else { var existing = seen[prop.name]; @@ -15897,7 +20881,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 199); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -15913,7 +20897,12 @@ var ts; } } } - ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { + if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(heritageElement); + }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { checkTypeForDuplicateIndexSignatures(node); @@ -15925,8 +20914,8 @@ var ts; checkSourceElement(node.type); } function computeEnumMemberValues(node) { - var _nodeLinks = getNodeLinks(node); - if (!(_nodeLinks.flags & 128)) { + var nodeLinks = getNodeLinks(node); + if (!(nodeLinks.flags & 128)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; @@ -15963,7 +20952,7 @@ var ts; getNodeLinks(member).enumMemberValue = autoValue++; } }); - _nodeLinks.flags |= 128; + nodeLinks.flags |= 128; } function getConstantValueForEnumMemberInitializer(initializer) { return evalConstant(initializer); @@ -15975,9 +20964,12 @@ var ts; return undefined; } switch (e.operator) { - case 33: return value; - case 34: return -value; - case 47: return ~value; + case 33: + return value; + case 34: + return -value; + case 47: + return ~value; } return undefined; case 169: @@ -15990,17 +20982,28 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 44: return left | right; - case 43: return left & right; - case 41: return left >> right; - case 42: return left >>> right; - case 40: return left << right; - case 45: return left ^ right; - case 35: return left * right; - case 36: return left / right; - case 33: return left + right; - case 34: return left - right; - case 37: return left % right; + case 44: + return left | right; + case 43: + return left & right; + case 41: + return left >> right; + case 42: + return left >>> right; + case 40: + return left << right; + case 45: + return left ^ right; + case 35: + return left * right; + case 36: + return left / right; + case 33: + return left + right; + case 34: + return left - right; + case 37: + return left % right; } return undefined; case 7: @@ -16012,17 +21015,16 @@ var ts; case 155: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); - var _enumType; + var enumType; var propertyName; if (e.kind === 65) { - _enumType = currentType; + enumType = currentType; propertyName = e.text; } else { var expression; if (e.kind === 156) { - if (e.argumentExpression === undefined || - e.argumentExpression.kind !== 8) { + if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { return undefined; } expression = e.expression; @@ -16044,15 +21046,15 @@ var ts; return undefined; } } - _enumType = checkExpression(expression); - if (!(_enumType.symbol && (_enumType.symbol.flags & 384))) { + enumType = checkExpression(expression); + if (!(enumType.symbol && (enumType.symbol.flags & 384))) { return undefined; } } if (propertyName === undefined) { return undefined; } - var property = getPropertyOfObjectType(_enumType, propertyName); + var property = getPropertyOfObjectType(enumType, propertyName); if (!property || !(property.flags & 8)) { return undefined; } @@ -16078,11 +21080,14 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); + var enumIsConst = ts.isConst(node); + if (compilerOptions.separateCompilation && enumIsConst && ts.isInAmbientContext(node)) { + error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided); + } var enumSymbol = getSymbolOfNode(node); var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { if (enumSymbol.declarations.length > 1) { - var enumIsConst = ts.isConst(node); ts.forEach(enumSymbol.declarations, function (decl) { if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); @@ -16091,7 +21096,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 201) { + if (declaration.kind !== 204) { return false; } var enumDeclaration = declaration; @@ -16112,9 +21117,9 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 198 || (declaration.kind === 197 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 201 || (declaration.kind === 200 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -16131,10 +21136,7 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 512 - && symbol.declarations.length > 1 - && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -16157,22 +21159,29 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 126) { - node = node.left; + while (true) { + if (node.kind === 126) { + node = node.left; + } + else if (node.kind === 155) { + node = node.expression; + } + else { + break; + } } + ts.Debug.assert(node.kind === 65); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (ts.getFullWidth(moduleName) !== 0 && moduleName.kind !== 8) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { - error(moduleName, node.kind === 212 ? - ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : - ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { + error(moduleName, node.kind === 215 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -16185,13 +21194,9 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | - (symbol.flags & 793056 ? 793056 : 0) | - (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 214 ? - ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : - ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + var message = node.kind === 217 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); } } @@ -16212,7 +21217,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { checkImportBinding(importClause.namedBindings); } else { @@ -16257,8 +21262,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); } } @@ -16277,8 +21282,8 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 224 ? node.parent : node.parent.parent; - if (container.kind === 202 && container.name.kind === 65) { + var container = node.parent.kind === 227 ? node.parent : node.parent.parent; + if (container.kind === 205 && container.name.kind === 65) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; } @@ -16305,10 +21310,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 224) { + if (node.kind === 227) { return node.statements; } - if (node.kind === 202 && node.body.kind === 203) { + if (node.kind === 205 && node.body.kind === 206) { return node.body.statements; } return emptyArray; @@ -16360,7 +21365,7 @@ var ts; case 137: return checkAccessorDeclaration(node); case 141: - return checkTypeReference(node); + return checkTypeReferenceNode(node); case 144: return checkTypeQuery(node); case 145: @@ -16373,71 +21378,71 @@ var ts; return checkUnionType(node); case 149: return checkSourceElement(node.type); - case 197: + case 200: return checkFunctionDeclaration(node); - case 176: - case 203: - return checkBlock(node); - case 177: - return checkVariableStatement(node); case 179: - return checkExpressionStatement(node); + case 206: + return checkBlock(node); case 180: - return checkIfStatement(node); - case 181: - return checkDoStatement(node); + return checkVariableStatement(node); case 182: - return checkWhileStatement(node); + return checkExpressionStatement(node); case 183: - return checkForStatement(node); + return checkIfStatement(node); case 184: - return checkForInStatement(node); + return checkDoStatement(node); case 185: - return checkForOfStatement(node); + return checkWhileStatement(node); case 186: + return checkForStatement(node); case 187: - return checkBreakOrContinueStatement(node); + return checkForInStatement(node); case 188: - return checkReturnStatement(node); + return checkForOfStatement(node); case 189: - return checkWithStatement(node); case 190: - return checkSwitchStatement(node); + return checkBreakOrContinueStatement(node); case 191: - return checkLabeledStatement(node); + return checkReturnStatement(node); case 192: - return checkThrowStatement(node); + return checkWithStatement(node); case 193: - return checkTryStatement(node); + return checkSwitchStatement(node); + case 194: + return checkLabeledStatement(node); case 195: + return checkThrowStatement(node); + case 196: + return checkTryStatement(node); + case 198: return checkVariableDeclaration(node); case 152: return checkBindingElement(node); - case 198: - return checkClassDeclaration(node); - case 199: - return checkInterfaceDeclaration(node); - case 200: - return checkTypeAliasDeclaration(node); case 201: - return checkEnumDeclaration(node); + return checkClassDeclaration(node); case 202: - return checkModuleDeclaration(node); - case 206: - return checkImportDeclaration(node); + return checkInterfaceDeclaration(node); + case 203: + return checkTypeAliasDeclaration(node); + case 204: + return checkEnumDeclaration(node); case 205: + return checkModuleDeclaration(node); + case 209: + return checkImportDeclaration(node); + case 208: return checkImportEqualsDeclaration(node); - case 212: - return checkExportDeclaration(node); - case 211: - return checkExportAssignment(node); - case 178: - checkGrammarStatementInAmbientContext(node); - return; - case 194: - checkGrammarStatementInAmbientContext(node); - return; case 215: + return checkExportDeclaration(node); + case 214: + return checkExportAssignment(node); + case 181: + checkGrammarStatementInAmbientContext(node); + return; + case 197: + checkGrammarStatementInAmbientContext(node); + return; + case 218: return checkMissingDeclaration(node); } } @@ -16458,10 +21463,10 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 189: + case 192: checkFunctionExpressionBodies(node.expression); break; case 129: @@ -16472,14 +21477,14 @@ var ts; case 152: case 153: case 154: - case 221: + case 224: case 155: case 156: case 157: case 158: case 159: case 171: - case 175: + case 176: case 160: case 161: case 165: @@ -16490,12 +21495,9 @@ var ts; case 169: case 170: case 173: - case 176: - case 203: - case 177: case 179: + case 206: case 180: - case 181: case 182: case 183: case 184: @@ -16503,21 +21505,24 @@ var ts; case 186: case 187: case 188: + case 189: case 190: - case 204: - case 217: - case 218: case 191: - case 192: case 193: + case 207: case 220: + case 221: + case 194: case 195: case 196: - case 198: - case 201: case 223: - case 211: - case 224: + case 198: + case 199: + case 201: + case 204: + case 226: + case 214: + case 227: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -16572,7 +21577,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 189 && node.parent.statement === node) { + if (node.parent.kind === 192 && node.parent.statement === node) { return true; } node = node.parent; @@ -16594,18 +21599,18 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) { break; } - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -16646,17 +21651,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -16674,27 +21679,33 @@ var ts; return symbolsToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 65 && - isTypeDeclaration(name.parent) && - name.parent.name === name; + return name.kind == 65 && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { case 128: - case 198: - case 199: - case 200: case 201: + case 202: + case 203: + case 204: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126) + while (node.parent && node.parent.kind === 126) { node = node.parent; + } return node.parent && node.parent.kind === 141; } - function isTypeNode(node) { + function isHeritageClauseElementIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 155) { + node = node.parent; + } + return node.parent && node.parent.kind === 177; + } + function isTypeNodeOrHeritageClauseElement(node) { if (141 <= node.kind && node.kind <= 149) { return true; } @@ -16709,28 +21720,36 @@ var ts; return node.parent.kind !== 166; case 8: return node.parent.kind === 129; + case 177: + return true; case 65: if (node.parent.kind === 126 && node.parent.right === node) { node = node.parent; } + else if (node.parent.kind === 155 && node.parent.name === node) { + node = node.parent; + } case 126: - ts.Debug.assert(node.kind === 65 || node.kind === 126, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); - var _parent = node.parent; - if (_parent.kind === 144) { + case 155: + ts.Debug.assert(node.kind === 65 || node.kind === 126 || node.kind === 155, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + var parent_5 = node.parent; + if (parent_5.kind === 144) { return false; } - if (141 <= _parent.kind && _parent.kind <= 149) { + if (141 <= parent_5.kind && parent_5.kind <= 149) { return true; } - switch (_parent.kind) { + switch (parent_5.kind) { + case 177: + return true; case 128: - return node === _parent.constraint; + return node === parent_5.constraint; case 132: case 131: case 129: - case 195: - return node === _parent.type; - case 197: + case 198: + return node === parent_5.type; + case 200: case 162: case 163: case 135: @@ -16738,16 +21757,16 @@ var ts; case 133: case 136: case 137: - return node === _parent.type; + return node === parent_5.type; case 138: case 139: case 140: - return node === _parent.type; + return node === parent_5.type; case 160: - return node === _parent.type; + return node === parent_5.type; case 157: case 158: - return _parent.typeArguments && ts.indexOf(_parent.typeArguments, node) >= 0; + return parent_5.typeArguments && ts.indexOf(parent_5.typeArguments, node) >= 0; case 159: return false; } @@ -16758,10 +21777,10 @@ var ts; while (nodeOnRightSide.parent.kind === 126) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 205) { + if (nodeOnRightSide.parent.kind === 208) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 211) { + if (nodeOnRightSide.parent.kind === 214) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -16769,15 +21788,11 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } - function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 && node.parent.right === node) || - (node.parent.kind === 155 && node.parent.name === node); - } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 211) { + if (entityName.parent.kind === 214) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 155) { @@ -16785,11 +21800,16 @@ var ts; return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } } - if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (ts.isExpression(entityName)) { - if (ts.getFullWidth(entityName) === 0) { + if (isHeritageClauseElementIdentifier(entityName)) { + var meaning = entityName.parent.kind === 177 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, meaning); + } + else if (ts.isExpression(entityName)) { + if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 65) { @@ -16804,17 +21824,17 @@ var ts; return getNodeLinks(entityName).resolvedSymbol; } else if (entityName.kind === 126) { - var _symbol = getNodeLinks(entityName).resolvedSymbol; - if (!_symbol) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { checkQualifiedName(entityName); } return getNodeLinks(entityName).resolvedSymbol; } } else if (isTypeReferenceIdentifier(entityName)) { - var _meaning = entityName.parent.kind === 141 ? 793056 : 1536; - _meaning |= 8388608; - return resolveEntityName(entityName, _meaning); + var meaning = entityName.parent.kind === 141 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, meaning); } return undefined; } @@ -16826,9 +21846,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 211 - ? getSymbolOfEntityNameOrPropertyAccessExpression(node) - : getSymbolOfPartOfRightHandSideOfImportEquals(node); + return node.parent.kind === 214 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 65: @@ -16847,10 +21865,7 @@ var ts; return undefined; case 8: var moduleName; - if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && - ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 206 || node.parent.kind === 212) && - node.parent.moduleSpecifier === node)) { + if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === 209 || node.parent.kind === 215) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: @@ -16868,7 +21883,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 222) { + if (location && location.kind === 225) { return resolveEntityName(location.name, 107455); } return undefined; @@ -16877,37 +21892,37 @@ var ts; if (isInsideWithStatementBody(node)) { return unknownType; } + if (isTypeNodeOrHeritageClauseElement(node)) { + return getTypeFromTypeNodeOrHeritageClauseElement(node); + } if (ts.isExpression(node)) { return getTypeOfExpression(node); } - if (isTypeNode(node)) { - return getTypeFromTypeNode(node); - } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); } if (isTypeDeclarationName(node)) { - var _symbol = getSymbolInfo(node); - return _symbol && getDeclaredTypeOfSymbol(_symbol); + var symbol = getSymbolInfo(node); + return symbol && getDeclaredTypeOfSymbol(symbol); } if (ts.isDeclaration(node)) { - var _symbol_1 = getSymbolOfNode(node); - return getTypeOfSymbol(_symbol_1); + var symbol = getSymbolOfNode(node); + return getTypeOfSymbol(symbol); } if (ts.isDeclarationName(node)) { - var _symbol_2 = getSymbolInfo(node); - return _symbol_2 && getTypeOfSymbol(_symbol_2); + var symbol = getSymbolInfo(node); + return symbol && getTypeOfSymbol(symbol); } if (isInRightSideOfImportOrExportAssignment(node)) { - var _symbol_3 = getSymbolInfo(node); - var declaredType = _symbol_3 && getDeclaredTypeOfSymbol(_symbol_3); - return declaredType !== unknownType ? declaredType : getTypeOfSymbol(_symbol_3); + var symbol = getSymbolInfo(node); + var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); + return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); } return unknownType; } function getTypeOfExpression(expr) { - if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } return checkExpression(expr); @@ -16927,22 +21942,26 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols = []; - var _name = symbol.name; + var name_10 = symbol.name; ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { - symbols.push(getPropertyOfType(t, _name)); + symbols.push(getPropertyOfType(t, name_10)); }); return symbols; } else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; if (target) { - return [target]; + return [ + target + ]; } } - return [symbol]; + return [ + symbol + ]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 224; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { if (languageVersion >= 2) { @@ -16950,10 +21969,10 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 207) { + if (node.kind === 210) { return getGeneratedNameForNode(node.parent) + ".default"; } - if (node.kind === 210) { + if (node.kind === 213) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -16970,7 +21989,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 202 || node.kind === 201) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 205 || node.kind === 204) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -16993,29 +22012,33 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 205: - case 207: case 208: case 210: - case 214: + case 211: + case 213: + case 217: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 212: + case 215: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 211: + case 214: return node.expression && node.expression.kind === 65 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 224 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 227 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } - return isAliasResolvedToValue(getSymbolOfNode(node)); + var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); + return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - return target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + if (target === unknownSymbol && compilerOptions.separateCompilation) { + return true; + } + return target !== unknownSymbol && target && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -17028,7 +22051,9 @@ var ts; } } if (checkChildren) { - return ts.forEachChild(node, function (node) { return isReferencedAliasDeclaration(node, checkChildren); }); + return ts.forEachChild(node, function (node) { + return isReferencedAliasDeclaration(node, checkChildren); + }); } return false; } @@ -17036,8 +22061,7 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || - (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -17049,7 +22073,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 223) { + if (node.kind === 226) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -17062,9 +22086,7 @@ var ts; } function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (2048 | 131072)) - ? getTypeOfSymbol(symbol) - : unknownType; + var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -17084,13 +22106,9 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 195 && n.parent.name === n); - var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || - getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 107455 | 8388608, undefined, undefined); - var isLetOrConst = symbol && - (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 220; + var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 198 && n.parent.name === n); + var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); + var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 223; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -17196,17 +22214,17 @@ var ts; case 134: case 133: case 140: - case 198: - case 199: - case 202: case 201: - case 177: - case 197: - case 200: - case 206: + case 202: case 205: - case 212: - case 211: + case 204: + case 180: + case 200: + case 203: + case 209: + case 208: + case 215: + case 214: case 129: break; default: @@ -17217,7 +22235,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 109: @@ -17241,7 +22259,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -17250,7 +22268,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 129) { @@ -17266,7 +22284,7 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 129) { @@ -17278,13 +22296,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 129) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 203) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -17303,10 +22321,10 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 206 || node.kind === 205) && flags & 2) { + else if ((node.kind === 209 || node.kind === 208) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 199 && flags & 2) { + else if (node.kind === 202 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } else if (node.kind === 129 && (flags & 112) && ts.isBindingPattern(node.name)) { @@ -17365,8 +22383,7 @@ var ts; } function checkGrammarFunctionLikeDeclaration(node) { var file = ts.getSourceFileOfNode(node); - return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) || - checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); + return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { if (node.kind === 163) { @@ -17428,23 +22445,21 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || - checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _n = arguments.length; _i < _n; _i++) { + for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 174) { + if (arg.kind === 175) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || - checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -17461,7 +22476,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -17489,7 +22504,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -17535,19 +22550,18 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - var _name = prop.name; - if (prop.kind === 174 || - _name.kind === 127) { - checkGrammarComputedPropertyName(_name); + var name_11 = prop.name; + if (prop.kind === 175 || name_11.kind === 127) { + checkGrammarComputedPropertyName(name_11); continue; } var currentKind = void 0; - if (prop.kind === 221 || prop.kind === 222) { + if (prop.kind === 224 || prop.kind === 225) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (_name.kind === 7) { - checkGrammarNumbericLiteral(_name); + if (name_11.kind === 7) { + checkGrammarNumbericLiteral(name_11); } currentKind = Property; } @@ -17563,26 +22577,26 @@ var ts; else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, _name.text)) { - seen[_name.text] = currentKind; + if (!ts.hasProperty(seen, name_11.text)) { + seen[name_11.text] = currentKind; } else { - var existingKind = seen[_name.text]; + var existingKind = seen[name_11.text]; if (currentKind === Property && existingKind === Property) { if (inStrictMode) { - grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + grammarErrorOnNode(name_11, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); } } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[_name.text] = currentKind | existingKind; + seen[name_11.text] = currentKind | existingKind; } else { - return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name_11, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name_11, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -17591,27 +22605,21 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 196) { + if (forInOrOfStatement.initializer.kind === 199) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 184 - ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement - : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var _diagnostic = forInOrOfStatement.kind === 184 - ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer - : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; - return grammarErrorOnNode(firstDeclaration.name, _diagnostic); + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var _diagnostic_1 = forInOrOfStatement.kind === 184 - ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation - : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; - return grammarErrorOnNode(firstDeclaration, _diagnostic_1); + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, diagnostic); } } } @@ -17664,9 +22672,7 @@ var ts; } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionLikeDeclaration(node) || - checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { return true; } if (node.parent.kind === 154) { @@ -17677,7 +22683,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -17688,7 +22694,7 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === 145) { @@ -17697,13 +22703,13 @@ var ts; } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return true; - case 191: + case 194: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -17715,18 +22721,17 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 191: + case 194: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 186 - && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 189 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } return false; } break; - case 190: - if (node.kind === 187 && !node.label) { + case 193: + if (node.kind === 190 && !node.label) { return false; } break; @@ -17739,16 +22744,12 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 187 - ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement - : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 190 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var _message = node.kind === 187 - ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement - : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; - return grammarErrorOnNode(node, _message); + var message = node.kind === 190 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); } } function checkGrammarBindingElement(node) { @@ -17764,11 +22765,8 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 184 && node.parent.parent.kind !== 185) { + if (node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { if (ts.isInAmbientContext(node)) { - if (ts.isBindingPattern(node.name)) { - return grammarErrorOnNode(node, ts.Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); - } if (node.initializer) { var equalsTokenLength = "=".length; return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); @@ -17784,8 +22782,7 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || - checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 65) { @@ -17795,7 +22792,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _n = elements.length; _i < _n; _i++) { + for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -17812,15 +22809,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 180: - case 181: - case 182: - case 189: case 183: case 184: case 185: + case 192: + case 186: + case 187: + case 188: return false; - case 191: + case 194: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -17853,7 +22850,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; if (node.name.kind === 127) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -17917,13 +22914,12 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 198) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (node.parent.kind === 201) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -17938,21 +22934,15 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 199 || - node.kind === 206 || - node.kind === 205 || - node.kind === 212 || - node.kind === 211 || - (node.flags & 2) || - (node.flags & (1 | 256))) { + if (node.kind === 202 || node.kind === 209 || node.kind === 208 || node.kind === 215 || node.kind === 214 || (node.flags & 2) || (node.flags & (1 | 256))) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 177) { + if (ts.isDeclaration(decl) || decl.kind === 180) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -17971,10 +22961,10 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 176 || node.parent.kind === 203 || node.parent.kind === 224) { - var _links = getNodeLinks(node.parent); - if (!_links.hasReportedStatementInAmbientContext) { - return _links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + if (node.parent.kind === 179 || node.parent.kind === 206 || node.parent.kind === 227) { + var links_1 = getNodeLinks(node.parent); + if (!links_1.hasReportedStatementInAmbientContext) { + return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); } } else { @@ -18004,6 +22994,7 @@ var ts; } ts.createTypeChecker = createTypeChecker; })(ts || (ts = {})); +/// var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { @@ -18026,7 +23017,8 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { + } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var moduleElementDeclarationEmitInfo = []; var asynchronousSubModuleDeclarationEmitInfo; @@ -18036,9 +23028,7 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 2048) || - ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || - !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 2048) || ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!ts.isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -18051,7 +23041,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 206); + ts.Debug.assert(aliasEmitInfo.node.kind === 209); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -18068,8 +23058,7 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (ts.isExternalModuleOrDeclarationFile(referencedFile) && - !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (ts.isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -18100,17 +23089,17 @@ var ts; } } function createAndSetNewTextWriterWithSymbolWriter() { - var _writer = ts.createTextWriter(newLine); - _writer.trackSymbol = trackSymbol; - _writer.writeKeyword = _writer.write; - _writer.writeOperator = _writer.write; - _writer.writePunctuation = _writer.write; - _writer.writeSpace = _writer.write; - _writer.writeStringLiteral = _writer.writeLiteral; - _writer.writeParameter = _writer.write; - _writer.writeSymbol = _writer.write; - setWriter(_writer); - return _writer; + var writer = ts.createTextWriter(newLine); + writer.trackSymbol = trackSymbol; + writer.writeKeyword = writer.write; + writer.writeOperator = writer.write; + writer.writePunctuation = writer.write; + writer.writeSpace = writer.write; + writer.writeStringLiteral = writer.writeLiteral; + writer.writeParameter = writer.write; + writer.writeSymbol = writer.write; + setWriter(writer); + return writer; } function setWriter(newWriter) { writer = newWriter; @@ -18121,24 +23110,28 @@ var ts; decreaseIndent = newWriter.decreaseIndent; } function writeAsynchronousModuleElements(nodes) { - var _oldWriter = writer; + var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 195) { + if (declaration.kind === 198) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 209 || declaration.kind === 210 || declaration.kind === 207) { + else if (declaration.kind === 212 || declaration.kind === 213 || declaration.kind === 210) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { nodeToCheck = declaration; } - var moduleElementEmitInfo = ts.forEach(moduleElementDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); + var moduleElementEmitInfo = ts.forEach(moduleElementDeclarationEmitInfo, function (declEmitInfo) { + return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; + }); if (!moduleElementEmitInfo && asynchronousSubModuleDeclarationEmitInfo) { - moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); + moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { + return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; + }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 206) { + if (moduleElementEmitInfo.node.kind === 209) { moduleElementEmitInfo.isVisible = true; } else { @@ -18146,12 +23139,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -18159,7 +23152,7 @@ var ts; } } }); - setWriter(_oldWriter); + setWriter(oldWriter); } function handleSymbolAccessibilityError(symbolAccesibilityResult) { if (symbolAccesibilityResult.accessibility === 0) { @@ -18204,14 +23197,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { @@ -18246,6 +23239,8 @@ var ts; case 99: case 8: return writeTextOfNode(currentSourceFile, type); + case 177: + return emitHeritageClauseElement(type); case 141: return emitTypeReference(type); case 144: @@ -18267,11 +23262,9 @@ var ts; return emitEntityName(type); case 126: return emitEntityName(type); - default: - ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 205 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 208 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -18279,10 +23272,22 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var qualifiedName = entityName; - writeEntityName(qualifiedName.left); + var left = entityName.kind === 126 ? entityName.left : entityName.expression; + var right = entityName.kind === 126 ? entityName.right : entityName.name; + writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, qualifiedName.right); + writeTextOfNode(currentSourceFile, right); + } + } + } + function emitHeritageClauseElement(node) { + if (ts.isSupportedHeritageClauseElement(node)) { + ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 155); + emitEntityName(node.expression); + if (node.typeArguments) { + write("<"); + emitCommaList(node.typeArguments, emitType); + write(">"); } } } @@ -18366,10 +23371,9 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 205 || - (node.parent.kind === 224 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 208 || (node.parent.kind === 227 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 224) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -18378,11 +23382,10 @@ var ts; }); } else { - if (node.kind === 206) { + if (node.kind === 209) { var importDeclaration = node; if (importDeclaration.importClause) { - isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || - isVisibleNamedBinding(importDeclaration.importClause.namedBindings); + isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || isVisibleNamedBinding(importDeclaration.importClause.namedBindings); } } moduleElementDeclarationEmitInfo.push({ @@ -18396,23 +23399,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 197: - return writeFunctionDeclaration(node); - case 177: - return writeVariableStatement(node); - case 199: - return writeInterfaceDeclaration(node); - case 198: - return writeClassDeclaration(node); case 200: - return writeTypeAliasDeclaration(node); - case 201: - return writeEnumDeclaration(node); + return writeFunctionDeclaration(node); + case 180: + return writeVariableStatement(node); case 202: - return writeModuleDeclaration(node); + return writeInterfaceDeclaration(node); + case 201: + return writeClassDeclaration(node); + case 203: + return writeTypeAliasDeclaration(node); + case 204: + return writeEnumDeclaration(node); case 205: + return writeModuleDeclaration(node); + case 208: return writeImportEqualsDeclaration(node); - case 206: + case 209: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -18426,7 +23429,7 @@ var ts; if (node.flags & 256) { write("default "); } - else if (node.kind !== 199) { + else if (node.kind !== 202) { write("declare "); } } @@ -18470,11 +23473,13 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 208) { + if (namedBindings.kind === 211) { return resolver.isDeclarationVisible(namedBindings); } else { - return ts.forEach(namedBindings.elements, function (namedImport) { return resolver.isDeclarationVisible(namedImport); }); + return ts.forEach(namedBindings.elements, function (namedImport) { + return resolver.isDeclarationVisible(namedImport); + }); } } } @@ -18496,7 +23501,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -18547,7 +23552,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 203) { + while (node.body.kind !== 206) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -18618,15 +23623,8 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 142 || - node.parent.kind === 143 || - (node.parent.parent && node.parent.parent.kind === 145)) { - ts.Debug.assert(node.parent.kind === 134 || - node.parent.kind === 133 || - node.parent.kind === 142 || - node.parent.kind === 143 || - node.parent.kind === 138 || - node.parent.kind === 139); + if (node.parent.kind === 142 || node.parent.kind === 143 || (node.parent.parent && node.parent.parent.kind === 145)) { + ts.Debug.assert(node.parent.kind === 134 || node.parent.kind === 133 || node.parent.kind === 142 || node.parent.kind === 143 || node.parent.kind === 138 || node.parent.kind === 139); emitType(node.constraint); } else { @@ -18636,10 +23634,10 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 198: + case 201: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 199: + case 202: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 139: @@ -18653,14 +23651,14 @@ var ts; if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { + else if (node.parent.parent.kind === 201) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 197: + case 200: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -18685,13 +23683,13 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + if (ts.isSupportedHeritageClauseElement(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 198) { - diagnosticMessage = isImplementsList ? - ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + if (node.parent.parent.kind === 201) { + diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; @@ -18721,11 +23719,13 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], false); + emitHeritageClause([ + baseTypeNode + ], false); } - emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); write(" {"); writeLine(); increaseIndent(); @@ -18765,7 +23765,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 195 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 198 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -18783,32 +23783,18 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 195) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + if (node.kind === 198) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 132 || node.kind === 131) { if (node.flags & 128) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 198) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + else if (node.parent.kind === 201) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - return symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } } @@ -18821,7 +23807,14 @@ var ts; } : undefined; } function emitBindingPattern(bindingPattern) { - emitCommaList(bindingPattern.elements, emitBindingElement); + var elements = []; + for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 175) { + elements.push(element); + } + } + emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { @@ -18850,7 +23843,9 @@ var ts; } } function isVariableStatementVisible(node) { - return ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + return ts.forEach(node.declarationList.declarations, function (varDeclaration) { + return resolver.isDeclarationVisible(varDeclaration); + }); } function writeVariableStatement(node) { emitJsDocComments(node); @@ -18896,25 +23891,17 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 136 - ? accessor.type - : accessor.parameters.length > 0 - ? accessor.parameters[0].type - : undefined; + return accessor.kind === 136 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 137) { if (accessorWithTypeAnnotation.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -18924,18 +23911,10 @@ var ts; } else { if (accessorWithTypeAnnotation.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { diagnosticMessage: diagnosticMessage, @@ -18951,13 +23930,13 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 197) { + if (node.kind === 200) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 134) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 197) { + if (node.kind === 200) { write("function "); writeTextOfNode(currentSourceFile, node.name); } @@ -19016,48 +23995,28 @@ var ts; var diagnosticMessage; switch (node.kind) { case 139: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 140: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 134: case 133: if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 198) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + else if (node.parent.kind === 201) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 197: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + case 200: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind); @@ -19075,7 +24034,7 @@ var ts; write("..."); } if (ts.isBindingPattern(node.name)) { - write("_" + ts.indexOf(node.parent.parameters, node)); + emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); @@ -19084,88 +24043,109 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 142 || - node.parent.kind === 143 || - node.parent.parent.kind === 145) { + if (node.parent.kind === 142 || node.parent.kind === 143 || node.parent.parent.kind === 145) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage; - switch (node.parent.kind) { - case 135: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - break; - case 139: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - break; - case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - break; - case 134: - case 133: - if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; - } - else if (node.parent.parent.kind === 198) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; - } - else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; - } - break; - case 197: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - break; - default: - ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); - } - return { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: node.name - }; + } : undefined; + } + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { + switch (node.parent.kind) { + case 135: + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + case 139: + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + case 138: + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 134: + case 133: + if (node.parent.flags & 128) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 201) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + case 200: + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + default: + ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); + } + } + function emitBindingPattern(bindingPattern) { + if (bindingPattern.kind === 150) { + write("{"); + emitCommaList(bindingPattern.elements, emitBindingElement); + write("}"); + } + else if (bindingPattern.kind === 151) { + write("["); + var elements = bindingPattern.elements; + emitCommaList(elements, emitBindingElement); + if (elements && elements.hasTrailingComma) { + write(", "); + } + write("]"); + } + } + function emitBindingElement(bindingElement) { + function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: bindingElement, + typeName: bindingElement.name + } : undefined; + } + if (bindingElement.kind === 175) { + write(" "); + } + else if (bindingElement.kind === 152) { + if (bindingElement.propertyName) { + writeTextOfNode(currentSourceFile, bindingElement.propertyName); + write(": "); + emitBindingPattern(bindingElement.name); + } + else if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + emitBindingPattern(bindingElement.name); + } + else { + ts.Debug.assert(bindingElement.name.kind === 65); + if (bindingElement.dotDotDotToken) { + write("..."); + } + writeTextOfNode(currentSourceFile, bindingElement.name); + } + } + } } } function emitNode(node) { switch (node.kind) { - case 197: - case 202: - case 205: - case 199: - case 198: case 200: + case 205: + case 208: + case 202: case 201: + case 203: + case 204: return emitModuleElement(node, isModuleElementVisible(node)); - case 177: + case 180: return emitModuleElement(node, isVariableStatementVisible(node)); - case 206: + case 209: return emitModuleElement(node, !node.importClause); - case 212: + case 215: return emitExportDeclaration(node); case 135: case 134: @@ -19181,20 +24161,16 @@ var ts; case 132: case 131: return emitPropertyDeclaration(node); - case 223: + case 226: return emitEnumMemberDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFile(node); } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 2048 - ? referencedFile.fileName - : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) - ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") - : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 2048 ? referencedFile.fileName : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -19202,26 +24178,27 @@ var ts; function writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics) { var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); if (!emitDeclarationResult.reportedDeclarationError) { - var declarationOutput = emitDeclarationResult.referencePathsOutput - + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); + var declarationOutput = emitDeclarationResult.referencePathsOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, diagnostics, ts.removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, host.getCompilerOptions().emitBOM); } function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) { var appliedSyncOutputPos = 0; - var _declarationOutput = ""; + var declarationOutput = ""; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.asynchronousOutput) { - _declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); - _declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo); + declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); + declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo); appliedSyncOutputPos = aliasEmitInfo.outputPos; } }); - _declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos); - return _declarationOutput; + declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos); + return declarationOutput; } } ts.writeDeclarationFile = writeDeclarationFile; })(ts || (ts = {})); +/// +/// var ts; (function (ts) { function isExternalModuleOrDeclarationFile(sourceFile) { @@ -19285,7 +24262,6 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; - var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var generatedNameSet = {}; var nodeToGeneratedName = []; @@ -19304,11 +24280,15 @@ var ts; var detachedCommentsInfo; var writeComment = ts.writeCommentRange; var emit = emitNodeWithoutSourceMap; - var emitStart = function (node) { }; - var emitEnd = function (node) { }; + var emitStart = function (node) { + }; + var emitEnd = function (node) { + }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - var scopeEmitEnd = function () { }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { + }; + var scopeEmitEnd = function () { + }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); @@ -19331,9 +24311,7 @@ var ts; emit(sourceFile); } function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentSourceFile.identifiers, name) && - !ts.hasProperty(generatedNameSet, name); + return !resolver.hasGlobalName(name) && !ts.hasProperty(currentSourceFile.identifiers, name) && !ts.hasProperty(generatedNameSet, name); } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { @@ -19347,9 +24325,9 @@ var ts; var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var _name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(_name)) { - return _name; + var name_12 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); + if (isUniqueName(name_12)) { + return name_12; } } } @@ -19377,14 +24355,13 @@ var ts; } function generateNameForModuleOrEnum(node) { if (node.name.kind === 65) { - var _name = node.name.text; - assignGeneratedName(node, isUniqueLocalName(_name, node) ? _name : makeUniqueName(_name)); + var name_13 = node.name.text; + assignGeneratedName(node, isUniqueLocalName(name_13, node) ? name_13 : makeUniqueName(name_13)); } } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + var baseName = expr.kind === 8 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; assignGeneratedName(node, makeUniqueName(baseName)); } function generateNameForImportDeclaration(node) { @@ -19404,24 +24381,24 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 197: - case 198: + case 200: + case 201: generateNameForFunctionOrClassDeclaration(node); break; - case 202: + case 205: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 201: + case 204: generateNameForModuleOrEnum(node); break; - case 206: + case 209: generateNameForImportDeclaration(node); break; - case 212: + case 215: generateNameForExportDeclaration(node); break; - case 211: + case 214: generateNameForExportAssignment(node); break; } @@ -19507,12 +24484,7 @@ var ts; sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine != emittedLine || - lastRecordedSourceMapSpan.emittedColumn != emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -19557,8 +24529,8 @@ var ts; if (scopeName) { var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { - var _name = node.name; - if (!_name || _name.kind !== 127) { + var name_14 = node.name; + if (!name_14 || name_14.kind !== 127) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -19575,20 +24547,10 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 197 || - node.kind === 162 || - node.kind === 134 || - node.kind === 133 || - node.kind === 136 || - node.kind === 137 || - node.kind === 202 || - node.kind === 198 || - node.kind === 201) { + else if (node.kind === 200 || node.kind === 162 || node.kind === 134 || node.kind === 133 || node.kind === 136 || node.kind === 137 || node.kind === 205 || node.kind === 201 || node.kind === 204) { if (node.name) { - var _name = node.name; - scopeName = _name.kind === 127 - ? ts.getTextOfNode(_name) - : node.name.text; + var name_15 = node.name; + scopeName = name_15.kind === 127 ? ts.getTextOfNode(name_15) : node.name.text; } recordScopeNameStart(scopeName); } @@ -19671,7 +24633,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 224) { + if (node.kind != 227) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -19756,7 +24718,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -19766,7 +24728,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -19780,7 +24742,7 @@ var ts; write(","); } decreaseIndent(); - if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -19914,8 +24876,7 @@ var ts; if (node.template.kind === 171) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 169 - && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 169 && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -19926,8 +24887,7 @@ var ts; ts.forEachChild(node, emit); return; } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); + var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); if (emitOuterParens) { write("("); } @@ -19938,8 +24898,7 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 161 - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 161 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -19953,6 +24912,19 @@ var ts; write(")"); } function shouldEmitTemplateHead() { + // If this expression has an empty head literal and the first template span has a non-empty + // literal, then emitting the empty head literal is not necessary. + // `${ foo } and ${ bar }` + // can be emitted as + // foo + " and " + bar + // This is because it is only required that one of the first two operands in the emit + // output must be a string literal, so that the other operand and all following operands + // are forced into strings. + // + // If the first template span has an empty literal, then the head must still be emitted. + // `${ foo }${ bar }` + // must still be emitted as + // "" + foo + bar ts.Debug.assert(node.templateSpans.length !== 0); return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; } @@ -20029,38 +25001,38 @@ var ts; } } function isNotExpressionIdentifier(node) { - var _parent = node.parent; - switch (_parent.kind) { + var parent = node.parent; + switch (parent.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: - case 197: + case 200: case 136: case 137: case 162: - case 198: - case 199: case 201: case 202: + case 204: case 205: - case 207: case 208: - return _parent.name === node; case 210: - case 214: - return _parent.name === node || _parent.propertyName === node; - case 187: - case 186: case 211: + return parent.name === node; + case 213: + case 217: + return parent.name === node || parent.propertyName === node; + case 190: + case 189: + case 214: return false; - case 191: + case 194: return node.parent.label === node; } } @@ -20170,8 +25142,8 @@ var ts; function emitListWithSpread(elements, multiLine, trailingComma) { var pos = 0; var group = 0; - var _length = elements.length; - while (pos < _length) { + var length = elements.length; + while (pos < length) { if (group === 1) { write(".concat("); } @@ -20186,14 +25158,14 @@ var ts; } else { var i = pos; - while (i < _length && elements[i].kind !== 173) { + while (i < length && elements[i].kind !== 173) { i++; } write("["); if (multiLine) { increaseIndent(); } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === _length); + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); if (multiLine) { decreaseIndent(); } @@ -20254,9 +25226,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 221: + case 224: return property.initializer; - case 222: + case 225: return createIdentifier(resolver.getExpressionNameSubstitution(property.name, getGeneratedNameForNode)); case 134: return createFunctionExpression(property.parameters, property.body); @@ -20269,8 +25241,8 @@ var ts; var propertyDescriptor = ts.createSynthesizedNode(154); var descriptorProperties = []; if (getAccessor) { - var _getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); - descriptorProperties.push(_getProperty); + var getProperty_1 = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty_1); } if (setAccessor) { var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); @@ -20295,8 +25267,8 @@ var ts; } function createNodeArray() { var elements = []; - for (var _i = 0; _i < arguments.length; _i++) { - elements[_i - 0] = arguments[_i]; + for (var _a = 0; _a < arguments.length; _a++) { + elements[_a - 0] = arguments[_a]; } var result = elements; result.pos = -1; @@ -20311,7 +25283,7 @@ var ts; return result; } function createExpressionStatement(expression) { - var result = ts.createSynthesizedNode(179); + var result = ts.createSynthesizedNode(182); result.expression = expression; return result; } @@ -20330,7 +25302,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(221); + var result = ts.createSynthesizedNode(224); result.name = name; result.initializer = initializer; return result; @@ -20423,6 +25395,9 @@ var ts; } } function tryEmitConstantValue(node) { + if (compilerOptions.separateCompilation) { + return false; + } var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { write(constantValue.toString()); @@ -20435,7 +25410,7 @@ var ts; return false; } function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); @@ -20475,7 +25450,9 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 173; }); + return ts.forEach(elements, function (e) { + return e.kind === 173; + }); } function skipParentheses(node) { while (node.kind === 161 || node.kind === 160) { @@ -20588,14 +25565,7 @@ var ts; while (operand.kind == 160) { operand = operand.expression; } - if (operand.kind !== 167 && - operand.kind !== 166 && - operand.kind !== 165 && - operand.kind !== 164 && - operand.kind !== 168 && - operand.kind !== 158 && - !(operand.kind === 157 && node.parent.kind === 158) && - !(operand.kind === 162 && node.parent.kind === 157)) { + if (operand.kind !== 167 && operand.kind !== 166 && operand.kind !== 165 && operand.kind !== 164 && operand.kind !== 168 && operand.kind !== 158 && !(operand.kind === 157 && node.parent.kind === 158) && !(operand.kind === 162 && node.parent.kind === 157)) { emit(operand); return; } @@ -20638,9 +25608,8 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 53 && - (node.left.kind === 154 || node.left.kind === 153)) { - emitDestructuring(node, node.parent.kind === 179); + if (languageVersion < 2 && node.operatorToken.kind === 53 && (node.left.kind === 154 || node.left.kind === 153)) { + emitDestructuring(node, node.parent.kind === 182); } else { emit(node.left); @@ -20676,13 +25645,13 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 176) { + if (node && node.kind === 179) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { - if (preserveNewLines && isSingleLineEmptyBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -20691,12 +25660,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 203) { - ts.Debug.assert(node.parent.kind === 202); + if (node.kind === 206) { + ts.Debug.assert(node.parent.kind === 205); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 203) { + if (node.kind === 206) { emitTempDeclarations(true); } decreaseIndent(); @@ -20705,7 +25674,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 176) { + if (node.kind === 179) { write(" "); emit(node); } @@ -20730,7 +25699,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76, node.thenStatement.end); - if (node.elseStatement.kind === 180) { + if (node.elseStatement.kind === 183) { write(" "); emit(node.elseStatement); } @@ -20742,7 +25711,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { write(" "); } else { @@ -20786,7 +25755,7 @@ var ts; var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 196) { + if (node.initializer && node.initializer.kind === 199) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; emitStartOfVariableDeclarationList(declarations[0], endPos); @@ -20804,13 +25773,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 185) { + if (languageVersion < 2 && node.kind === 188) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; @@ -20822,7 +25791,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 184) { + if (node.kind === 187) { write(" in "); } else { @@ -20833,13 +25802,32 @@ var ts; emitEmbeddedStatement(node.statement); } function emitDownLevelForOfStatement(node) { + // The following ES6 code: + // + // for (let v of expr) { } + // + // should be emitted as + // + // for (let _i = 0, _a = expr; _i < _a.length; _i++) { + // let v = _a[_i]; + // } + // + // where _a and _i are temps emitted to capture the RHS and the counter, + // respectively. + // When the left hand side is an expression instead of a let declaration, + // the "let v" is not emitted. + // When the left hand side is a let/const, the v is renamed if there is + // another v in scope. + // Note that all assignments to the LHS are emitted in the body, including + // all destructuring. + // Note also that because an extra statement is needed to assign to the LHS, + // for-of bodies are always emitted as blocks. var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); var rhsIsIdentifier = node.expression.kind === 65; var counter = createTempVariable(268435456); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(536870912) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -20853,24 +25841,12 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } - if (cachedLength) { - write(", "); - emitNodeWithoutSourceMap(cachedLength); - write(" = "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - if (cachedLength) { - emitNodeWithoutSourceMap(cachedLength); - } - else { - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } + emitNodeWithoutSourceMap(rhsReference); + write(".length"); emitEnd(node.initializer); write("; "); emitStart(node.initializer); @@ -20883,7 +25859,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -20914,7 +25890,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { emitLines(node.statement.statements); } else { @@ -20926,7 +25902,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 187 ? 66 : 71, node.pos); + emitToken(node.kind === 190 ? 66 : 71, node.pos); emitOptional(" ", node.label); write(";"); } @@ -20959,19 +25935,16 @@ var ts; emitToken(15, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, node2.end); + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === ts.getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 217) { + if (node.kind === 220) { write("case "); emit(node.expression); write(":"); @@ -20979,7 +25952,7 @@ var ts; else { write("default:"); } - if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -21026,7 +25999,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 202); + } while (node && node.kind !== 205); return node; } function emitContainingModuleName(node) { @@ -21059,11 +26032,11 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (node.name) { - emitModuleMemberName(node); + if (node.flags & 256) { + write("exports.default"); } else { - write("exports.default"); + emitModuleMemberName(node); } write(" = "); emitDeclarationName(node); @@ -21073,8 +26046,8 @@ var ts; } function emitExportMemberAssignments(name) { if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _i = 0, _a = exportSpecifiers[name.text], _n = _a.length; _i < _n; _i++) { - var specifier = _a[_i]; + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { + var specifier = _b[_a]; writeLine(); emitStart(specifier.name); emitContainingModuleName(specifier); @@ -21089,7 +26062,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var _isDeclaration = (root.kind === 195 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; + var isDeclaration = (root.kind === 198 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; if (root.kind === 169) { emitAssignmentExpression(root); } @@ -21102,7 +26075,7 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 195 || name.parent.kind === 152)) { + if (name.parent && (name.parent.kind === 198 || name.parent.kind === 152)) { emitModuleMemberName(name.parent); } else { @@ -21114,7 +26087,7 @@ var ts; function ensureIdentifier(expr) { if (expr.kind !== 65) { var identifier = createTempVariable(0); - if (!_isDeclaration) { + if (!isDeclaration) { recordTempDeclaration(identifier); } emitAssignment(identifier, expr); @@ -21169,9 +26142,9 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _i = 0, _n = properties.length; _i < _n; _i++) { - var p = properties[_i]; - if (p.kind === 221 || p.kind === 222) { + for (var _a = 0; _a < properties.length; _a++) { + var p = properties[_a]; + if (p.kind === 224 || p.kind === 225) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -21184,7 +26157,7 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } @@ -21215,18 +26188,18 @@ var ts; } function emitAssignmentExpression(root) { var target = root.left; - var _value = root.right; + var value = root.right; if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, _value); + emitDestructuringAssignment(target, value); } else { if (root.parent.kind !== 161) { write("("); } - _value = ensureIdentifier(_value); - emitDestructuringAssignment(target, _value); + value = ensureIdentifier(value); + emitDestructuringAssignment(target, value); write(", "); - emit(_value); + emit(value); if (root.parent.kind !== 161) { write(")"); } @@ -21251,7 +26224,7 @@ var ts; var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 174) { + else if (element.kind !== 175) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -21285,11 +26258,8 @@ var ts; emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && - (getCombinedFlagsForIdentifier(node.name) & 4096); - if (isUninitializedLet && - node.parent.parent.kind !== 184 && - node.parent.parent.kind !== 185) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); + if (isUninitializedLet && node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { initializer = createVoidZero(); } } @@ -21297,48 +26267,43 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 174) { + if (node.kind === 175) { return; } - var _name = node.name; - if (_name.kind === 65) { - emitExportMemberAssignments(_name); + var name = node.name; + if (name.kind === 65) { + emitExportMemberAssignments(name); } - else if (ts.isBindingPattern(_name)) { - ts.forEach(_name.elements, emitExportVariableAssignments); + else if (ts.isBindingPattern(name)) { + ts.forEach(name.elements, emitExportVariableAssignments); } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 195 && node.parent.kind !== 152)) { + if (!node.parent || (node.parent.kind !== 198 && node.parent.kind !== 152)) { return 0; } return ts.getCombinedNodeFlags(node.parent); } function renameNonTopLevelLetAndConst(node) { - if (languageVersion >= 2 || - ts.nodeIsSynthesized(node) || - node.kind !== 65 || - (node.parent.kind !== 195 && node.parent.kind !== 152)) { + if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 65 || (node.parent.kind !== 198 && node.parent.kind !== 152)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); if (((combinedFlags & 12288) === 0) || combinedFlags & 1) { return; } - var list = ts.getAncestor(node, 196); - if (list.parent.kind === 177) { - var isSourceFileLevelBinding = list.parent.parent.kind === 224; - var isModuleLevelBinding = list.parent.parent.kind === 203; - var isFunctionLevelBinding = list.parent.parent.kind === 176 && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 199); + if (list.parent.kind === 180) { + var isSourceFileLevelBinding = list.parent.parent.kind === 227; + var isModuleLevelBinding = list.parent.parent.kind === 206; + var isFunctionLevelBinding = list.parent.parent.kind === 179 && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var _parent = blockScopeContainer.kind === 224 - ? blockScopeContainer - : blockScopeContainer.parent; - if (resolver.resolvesToSomeValue(_parent, node.text)) { + var parent = blockScopeContainer.kind === 227 ? blockScopeContainer : blockScopeContainer.parent; + if (resolver.resolvesToSomeValue(parent, node.text)) { var variableId = resolver.getBlockScopedVariableId(node); if (!blockScopedVariableToGeneratedName) { blockScopedVariableToGeneratedName = []; @@ -21348,9 +26313,7 @@ var ts; } } function isES6ExportedDeclaration(node) { - return !!(node.flags & 1) && - languageVersion >= 2 && - node.parent.kind === 224; + return !!(node.flags & 1) && languageVersion >= 2 && node.parent.kind === 227; } function emitVariableStatement(node) { if (!(node.flags & 1)) { @@ -21369,12 +26332,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2) { if (ts.isBindingPattern(node.name)) { - var _name = createTempVariable(0); + var name_16 = createTempVariable(0); if (!tempParameters) { tempParameters = []; } - tempParameters.push(_name); - emit(_name); + tempParameters.push(name_16); + emit(name_16); } else { emit(node.name); @@ -21475,8 +26438,8 @@ var ts; if (node.kind === 162) { return !!node.name; } - else if (node.kind === 197) { - return !!node.name || (languageVersion >= 2 && !(node.flags & 256)); + if (node.kind === 200) { + return !!node.name || languageVersion < 2; } } function emitFunctionDeclaration(node) { @@ -21499,7 +26462,7 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 197 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 200 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } if (node.kind !== 134 && node.kind !== 133) { @@ -21549,7 +26512,7 @@ var ts; if (!node.body) { write(" { }"); } - else if (node.body.kind === 176) { + else if (node.body.kind === 179) { emitBlockFunctionBody(node, node.body); } else { @@ -21588,7 +26551,7 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); @@ -21625,9 +26588,9 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { - var statement = _a[_i]; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { + var statement = _b[_a]; write(" "); emit(statement); } @@ -21649,7 +26612,7 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 179) { + if (statement && statement.kind === 182) { var expr = statement.expression; if (expr && expr.kind === 157) { var func = expr.expression; @@ -21715,7 +26678,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 134 || node.kind === 133) { + if (member.kind === 178) { + writeLine(); + write(";"); + } + else if (member.kind === 134 || node.kind === 133) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -21782,12 +26749,12 @@ var ts; }); } function emitMemberFunctionsForES6AndHigher(node) { - for (var _i = 0, _a = node.members, _n = _a.length; _i < _n; _i++) { - var member = _a[_i]; + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; if ((member.kind === 134 || node.kind === 133) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 || node.kind === 133 || member.kind === 136 || member.kind === 137) { + else if (member.kind === 134 || member.kind === 136 || member.kind === 137) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -21805,9 +26772,13 @@ var ts; emitEnd(member); emitTrailingComments(member); } + else if (member.kind === 178) { + writeLine(); + write(";"); + } } } - function emitConstructor(node, baseTypeNode) { + function emitConstructor(node, baseTypeElement) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; @@ -21842,7 +26813,7 @@ var ts; emitSignatureParameters(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { write("(...args)"); } else { @@ -21860,7 +26831,7 @@ var ts; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); - if (baseTypeNode) { + if (baseTypeElement) { var superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); @@ -21870,16 +26841,16 @@ var ts; emitParameterPropertyAssignments(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { writeLine(); - emitStart(baseTypeNode); + emitStart(baseTypeElement); if (languageVersion < 2) { write("_super.apply(this, arguments);"); } else { write("super(...args);"); } - emitEnd(baseTypeNode); + emitEnd(baseTypeElement); } } emitMemberAssignments(node, 0); @@ -21906,28 +26877,36 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { if (languageVersion < 2) { - emitClassDeclarationBelowES6(node); + emitClassLikeDeclarationBelowES6(node); } else { - emitClassDeclarationForES6AndHigher(node); + emitClassLikeDeclarationForES6AndHigher(node); } } - function emitClassDeclarationForES6AndHigher(node) { + function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { - write("export "); + if (node.kind === 201) { + if (thisNodeIsDecorated) { + if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 256) { - write("default "); + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 256) { + write("default "); + } } } write("class"); @@ -21935,10 +26914,10 @@ var ts; write(" "); emitDeclarationName(node); } - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write(" extends "); - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); } write(" {"); increaseIndent(); @@ -21981,11 +26960,14 @@ var ts; write(";"); } } - function emitClassDeclarationBelowES6(node) { - write("var "); - emitDeclarationName(node); - write(" = (function ("); - var baseTypeNode = ts.getClassBaseTypeNode(node); + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 201) { + write("var "); + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write("_super"); } @@ -22032,11 +27014,16 @@ var ts; emitStart(node); write(")("); if (baseTypeNode) { - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 201) { + write(";"); } - write(");"); emitEnd(node); - emitExportMemberAssignment(node); + if (node.kind === 201) { + emitExportMemberAssignment(node); + } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } @@ -22180,7 +27167,7 @@ var ts; } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums; + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.separateCompilation; } function emitEnumDeclaration(node) { if (!shouldEmitEnumDeclaration(node)) { @@ -22259,13 +27246,13 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 202) { + if (moduleDeclaration.body.kind === 205) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } } function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation); } function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); @@ -22287,7 +27274,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 203) { + if (node.body.kind === 206) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -22336,16 +27323,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 208) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 206 && node.importClause && !!node.importClause.name; + return node.kind === 209 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -22372,7 +27359,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -22398,7 +27385,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 205 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 208 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -22410,7 +27397,7 @@ var ts; write(" = "); } else { - var isNakedImport = 206 && !node.importClause; + var isNakedImport = 209 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -22452,8 +27439,7 @@ var ts; emitExternalImportDeclaration(node); return; } - if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + if (resolver.isReferencedAliasDeclaration(node) || (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); if (isES6ExportedDeclaration(node)) { @@ -22485,8 +27471,8 @@ var ts; emitRequire(ts.getExternalModuleName(node)); write(";"); } - for (var _i = 0, _a = node.exportClause.elements, _n = _a.length; _i < _n; _i++) { - var specifier = _a[_i]; + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { + var specifier = _b[_a]; if (resolver.isValueAliasDeclaration(specifier)) { writeLine(); emitStart(specifier); @@ -22540,8 +27526,8 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(languageVersion >= 2); var needsComma = false; - for (var _i = 0, _n = specifiers.length; _i < _n; _i++) { - var specifier = specifiers[_i]; + for (var _a = 0; _a < specifiers.length; _a++) { + var specifier = specifiers[_a]; if (shouldEmit(specifier)) { if (needsComma) { write(", "); @@ -22565,8 +27551,7 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 197 && - expression.kind !== 198) { + if (expression.kind !== 200 && expression.kind !== 201) { write(";"); } emitEnd(node); @@ -22587,21 +27572,20 @@ var ts; exportSpecifiers = {}; exportEquals = undefined; hasExportStars = false; - for (var _i = 0, _a = sourceFile.statements, _n = _a.length; _i < _n; _i++) { - var node = _a[_i]; + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { + var node = _b[_a]; switch (node.kind) { - case 206: - if (!node.importClause || - resolver.isReferencedAliasDeclaration(node.importClause, true)) { + case 209: + if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 205: - if (node.moduleReference.kind === 216 && resolver.isReferencedAliasDeclaration(node)) { + case 208: + if (node.moduleReference.kind === 219 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 212: + case 215: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -22612,14 +27596,14 @@ var ts; } } else { - for (var _b = 0, _c = node.exportClause.elements, _d = _c.length; _b < _d; _b++) { - var specifier = _c[_b]; - var _name = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[_name] || (exportSpecifiers[_name] = [])).push(specifier); + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; + var name_17 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_17] || (exportSpecifiers[name_17] = [])).push(specifier); } } break; - case 211: + case 214: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -22661,8 +27645,8 @@ var ts; write("\"" + node.amdModuleName + "\", "); } write("[\"require\", \"exports\""); - for (var _i = 0, _n = externalImports.length; _i < _n; _i++) { - var importNode = externalImports[_i]; + for (var _a = 0; _a < externalImports.length; _a++) { + var importNode = externalImports[_a]; write(", "); var moduleName = ts.getExternalModuleName(importNode); if (moduleName.kind === 8) { @@ -22672,29 +27656,29 @@ var ts; write("\"\""); } } - for (var _a = 0, _b = node.amdDependencies, _c = _b.length; _a < _c; _a++) { - var amdDependency = _b[_a]; + for (var _b = 0, _c = node.amdDependencies; _b < _c.length; _b++) { + var amdDependency = _c[_b]; var text = "\"" + amdDependency.path + "\""; write(", "); write(text); } write("], function (require, exports"); - for (var _d = 0, _e = externalImports.length; _d < _e; _d++) { - var _importNode = externalImports[_d]; + for (var _d = 0; _d < externalImports.length; _d++) { + var importNode = externalImports[_d]; write(", "); - var namespaceDeclaration = getNamespaceDeclarationNode(_importNode); - if (namespaceDeclaration && !isDefaultImport(_importNode)) { + var namespaceDeclaration = getNamespaceDeclarationNode(importNode); + if (namespaceDeclaration && !isDefaultImport(importNode)) { emit(namespaceDeclaration.name); } else { - write(getGeneratedNameForNode(_importNode)); + write(getGeneratedNameForNode(importNode)); } } - for (var _f = 0, _g = node.amdDependencies, _h = _g.length; _f < _h; _f++) { - var _amdDependency = _g[_f]; - if (_amdDependency.name) { + for (var _e = 0, _f = node.amdDependencies; _e < _f.length; _e++) { + var amdDependency = _f[_e]; + if (amdDependency.name) { write(", "); - write(_amdDependency.name); + write(amdDependency.name); } } write(") {"); @@ -22813,34 +27797,30 @@ var ts; if (node.flags & 2) { return emitOnlyPinnedOrTripleSlashComments(node); } - var _emitComments = shouldEmitLeadingAndTrailingComments(node); - if (_emitComments) { + var emitComments = shouldEmitLeadingAndTrailingComments(node); + if (emitComments) { emitLeadingComments(node); } emitJavaScriptWorker(node, allowGeneratedIdentifiers); - if (_emitComments) { + if (emitComments) { emitTrailingComments(node); } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 199: - case 197: - case 206: - case 205: - case 200: - case 211: - return false; case 202: + case 200: + case 209: + case 208: + case 203: + case 214: + return false; + case 205: return shouldEmitModuleDeclaration(node); - case 201: + case 204: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 176 && - node.parent && - node.parent.kind === 163 && - node.parent.body === node && - compilerOptions.target <= 1) { + if (node.kind !== 179 && node.parent && node.parent.kind === 163 && node.parent.body === node && compilerOptions.target <= 1) { return false; } return true; @@ -22878,7 +27858,7 @@ var ts; return emitLiteral(node); case 171: return emitTemplateExpression(node); - case 175: + case 176: return emitTemplateSpan(node); case 126: return emitQualifiedName(node); @@ -22892,9 +27872,9 @@ var ts; return emitArrayLiteral(node); case 154: return emitObjectLiteral(node); - case 221: + case 224: return emitPropertyAssignment(node); - case 222: + case 225: return emitShorthandPropertyAssignment(node); case 127: return emitComputedPropertyName(node); @@ -22912,7 +27892,7 @@ var ts; return emit(node.expression); case 161: return emitParenExpression(node); - case 197: + case 200: case 162: case 163: return emitFunctionDeclaration(node); @@ -22932,71 +27912,73 @@ var ts; return emitConditionalExpression(node); case 173: return emitSpreadElementExpression(node); - case 174: + case 175: return; - case 176: - case 203: - return emitBlock(node); - case 177: - return emitVariableStatement(node); - case 178: - return write(";"); case 179: - return emitExpressionStatement(node); - case 180: - return emitIfStatement(node); - case 181: - return emitDoStatement(node); - case 182: - return emitWhileStatement(node); - case 183: - return emitForStatement(node); - case 185: - case 184: - return emitForInOrForOfStatement(node); - case 186: - case 187: - return emitBreakOrContinueStatement(node); - case 188: - return emitReturnStatement(node); - case 189: - return emitWithStatement(node); - case 190: - return emitSwitchStatement(node); - case 217: - case 218: - return emitCaseOrDefaultClause(node); - case 191: - return emitLabelledStatement(node); - case 192: - return emitThrowStatement(node); - case 193: - return emitTryStatement(node); - case 220: - return emitCatchClause(node); - case 194: - return emitDebuggerStatement(node); - case 195: - return emitVariableDeclaration(node); - case 198: - return emitClassDeclaration(node); - case 199: - return emitInterfaceDeclaration(node); - case 201: - return emitEnumDeclaration(node); - case 223: - return emitEnumMember(node); - case 202: - return emitModuleDeclaration(node); case 206: - return emitImportDeclaration(node); + return emitBlock(node); + case 180: + return emitVariableStatement(node); + case 181: + return write(";"); + case 182: + return emitExpressionStatement(node); + case 183: + return emitIfStatement(node); + case 184: + return emitDoStatement(node); + case 185: + return emitWhileStatement(node); + case 186: + return emitForStatement(node); + case 188: + case 187: + return emitForInOrForOfStatement(node); + case 189: + case 190: + return emitBreakOrContinueStatement(node); + case 191: + return emitReturnStatement(node); + case 192: + return emitWithStatement(node); + case 193: + return emitSwitchStatement(node); + case 220: + case 221: + return emitCaseOrDefaultClause(node); + case 194: + return emitLabelledStatement(node); + case 195: + return emitThrowStatement(node); + case 196: + return emitTryStatement(node); + case 223: + return emitCatchClause(node); + case 197: + return emitDebuggerStatement(node); + case 198: + return emitVariableDeclaration(node); + case 174: + return emitClassExpression(node); + case 201: + return emitClassDeclaration(node); + case 202: + return emitInterfaceDeclaration(node); + case 204: + return emitEnumDeclaration(node); + case 226: + return emitEnumMember(node); case 205: + return emitModuleDeclaration(node); + case 209: + return emitImportDeclaration(node); + case 208: return emitImportEqualsDeclaration(node); - case 212: + case 215: return emitExportDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFileNode(node); } } @@ -23024,7 +28006,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.pos !== node.parent.pos) { + if (node.parent.kind === 227 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -23036,7 +28018,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.end !== node.parent.end) { + if (node.parent.kind === 227 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -23065,7 +28047,10 @@ var ts; leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } leadingComments = filterComments(leadingComments, compilerOptions.removeComments); - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { + pos: pos, + end: pos + }, leadingComments); ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedComments(node) { @@ -23090,12 +28075,17 @@ var ts; if (nodeLine >= lastCommentLine + 2) { ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + var currentDetachedCommentInfo = { + nodePos: node.pos, + detachedCommentEndPos: detachedComments[detachedComments.length - 1].end + }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } else { - detachedCommentsInfo = [currentDetachedCommentInfo]; + detachedCommentsInfo = [ + currentDetachedCommentInfo + ]; } } } @@ -23105,10 +28095,7 @@ var ts; if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && - currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -23122,13 +28109,15 @@ var ts; } ts.emitFiles = emitFiles; })(ts || (ts = {})); +/// +/// var ts; (function (ts) { ts.programTime = 0; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0.0"; + ts.version = "1.5.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -23161,9 +28150,7 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode - ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText - : e.message); + onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); } text = ""; } @@ -23201,12 +28188,20 @@ var ts; } return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibFileName: function (options) { + return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); + }, writeFile: writeFile, - getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, - useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCurrentDirectory: function () { + return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); + }, + useCaseSensitiveFileNames: function () { + return ts.sys.useCaseSensitiveFileNames; + }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { return ts.sys.newLine; } + getNewLine: function () { + return ts.sys.newLine; + } }; } ts.createCompilerHost = createCompilerHost; @@ -23252,7 +28247,9 @@ var ts; var noDiagnosticsTypeChecker; var start = new Date().getTime(); host = host || createCompilerHost(options); - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + ts.forEach(rootNames, function (name) { + return processRootFile(name, false); + }); if (!seenNoDefaultLib) { processRootFile(host.getDefaultLibFileName(options), true); } @@ -23260,21 +28257,35 @@ var ts; ts.programTime += new Date().getTime() - start; program = { getSourceFile: getSourceFile, - getSourceFiles: function () { return files; }, - getCompilerOptions: function () { return options; }, + getSourceFiles: function () { + return files; + }, + getCompilerOptions: function () { + return options; + }, getSyntacticDiagnostics: getSyntacticDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getTypeChecker: getTypeChecker, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { return commonSourceDirectory; }, + getCommonSourceDirectory: function () { + return commonSourceDirectory; + }, emit: emit, getCurrentDirectory: host.getCurrentDirectory, - getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, - getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, - getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, - getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + getNodeCount: function () { + return getDiagnosticsProducingTypeChecker().getNodeCount(); + }, + getIdentifierCount: function () { + return getDiagnosticsProducingTypeChecker().getIdentifierCount(); + }, + getSymbolCount: function () { + return getDiagnosticsProducingTypeChecker().getSymbolCount(); + }, + getTypeCount: function () { + return getDiagnosticsProducingTypeChecker().getTypeCount(); + } }; return program; function getEmitHost(writeFileCallback) { @@ -23297,12 +28308,16 @@ var ts; } function emit(sourceFile, writeFileCallback) { if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { - return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + return { + diagnostics: [], + sourceMaps: undefined, + emitSkipped: true + }; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); - var _start = new Date().getTime(); + var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); - ts.emitTime += new Date().getTime() - _start; + ts.emitTime += new Date().getTime() - start; return emitResult; } function getSourceFile(fileName) { @@ -23342,7 +28357,8 @@ var ts; function getDeclarationDiagnosticsForFile(sourceFile) { if (!ts.isDeclarationFile(sourceFile)) { var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); - var writeFile = function () { }; + var writeFile = function () { + }; return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); } } @@ -23360,11 +28376,11 @@ var ts; processSourceFile(ts.normalizePath(fileName), isDefaultLib); } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var _start; - var _length; + var start; + var length; if (refEnd !== undefined && refPos !== undefined) { - _start = refPos; - _length = refEnd - refPos; + start = refPos; + length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { @@ -23389,7 +28405,7 @@ var ts; } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, _start, _length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); } else { diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); @@ -23433,14 +28449,14 @@ var ts; return file; } function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { - var _file = filesByName[canonicalName]; - if (_file && host.useCaseSensitiveFileNames()) { - var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(_file.fileName, host.getCurrentDirectory()) : _file.fileName; + var file = filesByName[canonicalName]; + if (file && host.useCaseSensitiveFileNames()) { + var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } - return _file; + return file; } } function processReferencedFiles(file, basePath) { @@ -23451,7 +28467,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 206 || node.kind === 205 || node.kind === 212) { + if (node.kind === 209 || node.kind === 208 || node.kind === 215) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -23471,17 +28487,16 @@ var ts; } } } - else if (node.kind === 202 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 205 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { - var _searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(_searchName + ".ts", nameLiteral); + var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); + var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); if (!tsFile) { - findModuleSourceFile(_searchName + ".d.ts", nameLiteral); + findModuleSourceFile(searchName + ".d.ts", nameLiteral); } } } @@ -23493,6 +28508,20 @@ var ts; } } function verifyCompilerOptions() { + if (options.separateCompilation) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation)); + } + if (options.declaration) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation)); + } + if (options.noEmitOnError) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation)); + } + if (options.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); + } + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); @@ -23503,24 +28532,32 @@ var ts; return; } var languageVersion = options.target || 0; - var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); - if (firstExternalModuleSourceFile && !options.module) { + var firstExternalModuleSourceFile = ts.forEach(files, function (f) { + return ts.isExternalModule(f) ? f : undefined; + }); + if (options.separateCompilation) { if (!options.module && languageVersion < 2) { - var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } + var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { + return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; + }); + if (firstNonExternalModuleSourceFile) { + var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + } + } + else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { + var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher)); } - if (options.outDir || - options.sourceRoot || - (options.mapRoot && - (!options.out || firstExternalModuleSourceFile !== undefined))) { + if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) - && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + if (!(sourceFile.flags & 2048) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); if (commonPathComponents) { @@ -23560,6 +28597,10 @@ var ts; } ts.createProgram = createProgram; })(ts || (ts = {})); +/// +/// +/// +/// var ts; (function (ts) { ts.optionDeclarations = [ @@ -23567,10 +28608,6 @@ var ts; name: "charset", type: "string" }, - { - name: "codepage", - type: "number" - }, { name: "declaration", shortName: "d", @@ -23636,10 +28673,6 @@ var ts; name: "noLib", type: "boolean" }, - { - name: "noLibCheck", - type: "boolean" - }, { name: "noResolve", type: "boolean" @@ -23675,6 +28708,10 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "separateCompilation", + type: "boolean" + }, { name: "sourceMap", type: "boolean", @@ -23698,22 +28735,14 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, - { - name: "preserveNewLines", - type: "boolean", - description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, - experimental: true - }, - { - name: "cacheDownlevelForOfLength", - type: "boolean", - description: "Cache length access when downlevel emitting for-of statements", - experimental: true - }, { name: "target", shortName: "t", - type: { "es3": 0, "es5": 1, "es6": 2 }, + type: { + "es3": 0, + "es5": 1, + "es6": 2 + }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 @@ -23893,7 +28922,9 @@ var ts; var files = []; if (ts.hasProperty(json, "files")) { if (json["files"] instanceof Array) { - var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); + var files = ts.map(json["files"], function (s) { + return ts.combinePaths(basePath, s); + }); } } else { @@ -23910,6 +28941,8 @@ var ts; } ts.parseConfigFile = parseConfigFile; })(ts || (ts = {})); +/// +/// var ts; (function (ts) { function validateLocaleAndSetLanguage(locale, errors) { @@ -23920,8 +28953,7 @@ var ts; } var language = matchResult[1]; var territory = matchResult[3]; - if (!trySetLanguageAndTerritory(language, territory, errors) && - !trySetLanguageAndTerritory(language, undefined, errors)) { + if (!trySetLanguageAndTerritory(language, territory, errors) && !trySetLanguageAndTerritory(language, undefined, errors)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_locale_0, locale)); return false; } @@ -24021,32 +29053,32 @@ var ts; if (commandLine.options.locale) { if (!isJSONSupported()) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale")); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors); } if (commandLine.errors.length > 0) { reportDiagnostics(commandLine.errors); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } if (commandLine.options.version) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Version_0, ts.version)); - return ts.sys.exit(0); + return ts.sys.exit(ts.ExitStatus.Success); } if (commandLine.options.help) { printVersion(); printHelp(); - return ts.sys.exit(0); + return ts.sys.exit(ts.ExitStatus.Success); } if (commandLine.options.project) { if (!isJSONSupported()) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--project")); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } configFileName = ts.normalizePath(ts.combinePaths(commandLine.options.project, "tsconfig.json")); if (commandLine.fileNames.length !== 0) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } } else if (commandLine.fileNames.length === 0 && isJSONSupported()) { @@ -24056,12 +29088,12 @@ var ts; if (commandLine.fileNames.length === 0 && !configFileName) { printVersion(); printHelp(); - return ts.sys.exit(0); + return ts.sys.exit(ts.ExitStatus.Success); } if (commandLine.options.watch) { if (!ts.sys.watchFile) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } if (configFileName) { configFileWatcher = ts.sys.watchFile(configFileName, configFileChanged); @@ -24074,12 +29106,12 @@ var ts; var configObject = ts.readConfigFile(configFileName); if (!configObject) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, configFileName)); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } var configParseResult = ts.parseConfigFile(configObject, ts.getDirectoryPath(configFileName)); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors); - return ts.sys.exit(1); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } rootFileNames = configParseResult.fileNames; compilerOptions = ts.extend(commandLine.options, configParseResult.options); @@ -24108,7 +29140,9 @@ var ts; } var sourceFile = hostGetSourceFile(fileName, languageVersion, onError); if (sourceFile && compilerOptions.watch) { - sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function () { return sourceFileChanged(sourceFile); }); + sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function () { + return sourceFileChanged(sourceFile); + }); } return sourceFile; } @@ -24127,6 +29161,7 @@ var ts; cachedProgram = program; } function sourceFileChanged(sourceFile) { + sourceFile.fileWatcher.close(); sourceFile.fileWatcher = undefined; startTimer(); } @@ -24180,7 +29215,10 @@ var ts; reportTimeStatistic("Emit time", ts.emitTime); reportTimeStatistic("Total time", ts.programTime + ts.bindTime + ts.checkTime + ts.emitTime); } - return { program: program, exitStatus: exitStatus }; + return { + program: program, + exitStatus: exitStatus + }; function compileProgram() { var diagnostics = program.getSyntacticDiagnostics(); reportDiagnostics(diagnostics); @@ -24193,19 +29231,17 @@ var ts; } } if (compilerOptions.noEmit) { - return diagnostics.length - ? 1 - : 0; + return diagnostics.length ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success; } var emitOutput = program.emit(); reportDiagnostics(emitOutput.diagnostics); if (emitOutput.emitSkipped) { - return 1; + return ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } if (diagnostics.length > 0 || emitOutput.diagnostics.length > 0) { - return 2; + return ts.ExitStatus.DiagnosticsPresent_OutputsGenerated; } - return 0; + return ts.ExitStatus.Success; } } function printVersion() { @@ -24226,8 +29262,12 @@ var ts; output += padding + "tsc @args.txt" + ts.sys.newLine; output += ts.sys.newLine; output += getDiagnosticText(ts.Diagnostics.Options_Colon) + ts.sys.newLine; - var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { return !v.experimental; }); - optsList.sort(function (a, b) { return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); }); + var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { + return !v.experimental; + }); + optsList.sort(function (a, b) { + return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); + }); var marginLength = 0; var usageColumn = []; var descriptionColumn = []; diff --git a/bin/tsserver.js b/bin/tsserver.js index f05e1f27f34..e7cd07fc7a8 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -45,7 +45,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (v === value) { return true; @@ -69,7 +69,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -83,7 +83,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_1 = array[_i]; if (f(item_1)) { result.push(item_1); @@ -97,7 +97,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result.push(f(v)); } @@ -117,7 +117,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_2 = array[_i]; if (!contains(result, item_2)) { result.push(item_2); @@ -129,7 +129,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result += v[prop]; } @@ -138,7 +138,7 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0, _n = from.length; _i < _n; _i++) { + for (var _i = 0; _i < from.length; _i++) { var v = from[_i]; to.push(v); } @@ -427,7 +427,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _n = parts.length; _i < _n; _i++) { + for (var _i = 0; _i < parts.length; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -572,7 +572,7 @@ var ts; ts.fileExtensionIs = fileExtensionIs; var supportedExtensions = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { + for (var _i = 0; _i < supportedExtensions.length; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -725,14 +725,14 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var name_1 = files[_i]; if (!extension || ts.fileExtensionIs(name_1, extension)) { result.push(ts.combinePaths(path, name_1)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + for (var _a = 0; _a < subfolders.length; _a++) { var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } @@ -819,7 +819,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -832,7 +832,7 @@ var ts; directories.push(name); } } - for (var _a = 0, _b = directories.length; _a < _b; _a++) { + for (var _a = 0; _a < directories.length; _a++) { var current = directories[_a]; visitDirectory(current); } @@ -1070,6 +1070,8 @@ var ts; Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, + Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, + Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -1256,6 +1258,8 @@ var ts; The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1339,6 +1343,11 @@ var ts; Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, + Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { code: 5043, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." }, + Option_declaration_cannot_be_specified_with_option_separateCompilation: { code: 5044, category: ts.DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'separateCompilation'." }, + Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, + Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, + Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1402,7 +1411,10 @@ var ts; You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." }, yield_expressions_are_not_currently_supported: { code: 9000, category: ts.DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." } + Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "'class' expressions are not currently supported." }, + class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: ts.DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." } }; })(ts || (ts = {})); /// @@ -2648,10 +2660,6 @@ var ts; name: "charset", type: "string" }, - { - name: "codepage", - type: "number" - }, { name: "declaration", shortName: "d", @@ -2717,10 +2725,6 @@ var ts; name: "noLib", type: "boolean" }, - { - name: "noLibCheck", - type: "boolean" - }, { name: "noResolve", type: "boolean" @@ -2756,6 +2760,10 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "separateCompilation", + type: "boolean" + }, { name: "sourceMap", type: "boolean", @@ -2779,18 +2787,6 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, - { - name: "preserveNewLines", - type: "boolean", - description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, - experimental: true - }, - { - name: "cacheDownlevelForOfLength", - type: "boolean", - description: "Cache length access when downlevel emitting for-of statements", - experimental: true - }, { name: "target", shortName: "t", @@ -2996,7 +2992,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -3054,7 +3050,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 224) { + while (node && node.kind !== 227) { node = node.parent; } return node; @@ -3136,15 +3132,15 @@ var ts; return current; } switch (current.kind) { - case 224: - case 204: - case 220: - case 202: - case 183: - case 184: - case 185: + case 227: + case 207: + case 223: + case 205: + case 186: + case 187: + case 188: return current; - case 176: + case 179: if (!isFunctionLike(current.parent)) { return current; } @@ -3155,9 +3151,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 195 && + declaration.kind === 198 && declaration.parent && - declaration.parent.kind === 220; + declaration.parent.kind === 223; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3194,14 +3190,21 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 195: - case 152: + case 227: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + if (pos_1 === sourceFile.text.length) { + return createTextSpan(0, 0); + } + return getSpanOfTokenAtPosition(sourceFile, pos_1); case 198: - case 199: - case 202: + case 152: case 201: - case 223: - case 197: + case 174: + case 202: + case 205: + case 204: + case 226: + case 200: case 162: errorNode = node.name; break; @@ -3224,7 +3227,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 201 && isConst(node); + return node.kind === 204 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { @@ -3236,14 +3239,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 195) { + if (node.kind === 198) { node = node.parent; } - if (node && node.kind === 196) { + if (node && node.kind === 199) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 177) { + if (node && node.kind === 180) { flags |= node.flags; } return flags; @@ -3258,7 +3261,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 179 && node.expression.kind === 8; + return node.kind === 182 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -3284,23 +3287,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188: + case 191: return visitor(node); - case 204: - case 176: - case 180: - case 181: - case 182: + case 207: + case 179: case 183: case 184: case 185: - case 189: - case 190: - case 217: - case 218: - case 191: + case 186: + case 187: + case 188: + case 192: case 193: case 220: + case 221: + case 194: + case 196: + case 223: return ts.forEachChild(node, traverse); } } @@ -3310,13 +3313,13 @@ var ts; if (node) { switch (node.kind) { case 152: - case 223: + case 226: case 129: - case 221: + case 224: case 132: case 131: - case 222: - case 195: + case 225: + case 198: return true; } } @@ -3328,7 +3331,7 @@ var ts; switch (node.kind) { case 135: case 162: - case 197: + case 200: case 163: case 134: case 133: @@ -3341,7 +3344,7 @@ var ts; case 143: case 162: case 163: - case 197: + case 200: return true; } } @@ -3349,7 +3352,7 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 176 && isFunctionLike(node.parent); + return node && node.kind === 179 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -3373,7 +3376,7 @@ var ts; } switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; @@ -3382,9 +3385,9 @@ var ts; if (!includeArrowFunctions) { continue; } - case 197: + case 200: case 162: - case 202: + case 205: case 132: case 131: case 134: @@ -3392,8 +3395,8 @@ var ts; case 135: case 136: case 137: - case 201: - case 224: + case 204: + case 227: return node; } } @@ -3406,12 +3409,12 @@ var ts; return node; switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; break; - case 197: + case 200: case 162: case 163: if (!includeFunctions) { @@ -3438,23 +3441,23 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 198: + case 201: return true; case 132: - return node.parent.kind === 198; + return node.parent.kind === 201; case 129: - return node.parent.body && node.parent.parent.kind === 198; + return node.parent.body && node.parent.parent.kind === 201; case 136: case 137: case 134: - return node.body && node.parent.kind === 198; + return node.body && node.parent.kind === 201; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 198: + case 201: if (node.decorators) { return true; } @@ -3482,7 +3485,7 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 198: + case 201: return ts.forEach(node.members, nodeOrChildIsDecorated); case 134: case 137: @@ -3513,6 +3516,7 @@ var ts; case 160: case 161: case 162: + case 174: case 163: case 166: case 164: @@ -3524,7 +3528,7 @@ var ts; case 173: case 171: case 10: - case 174: + case 175: return true; case 126: while (node.parent.kind === 126) { @@ -3539,38 +3543,38 @@ var ts; case 8: var parent_1 = node.parent; switch (parent_1.kind) { - case 195: + case 198: case 129: case 132: case 131: - case 223: - case 221: + case 226: + case 224: case 152: return parent_1.initializer === node; - case 179: - case 180: - case 181: case 182: - case 188: - case 189: - case 190: - case 217: - case 192: - case 190: - return parent_1.expression === node; case 183: - var forStatement = parent_1; - return (forStatement.initializer === node && forStatement.initializer.kind !== 196) || - forStatement.condition === node || - forStatement.iterator === node; case 184: case 185: + case 191: + case 192: + case 193: + case 220: + case 195: + case 193: + return parent_1.expression === node; + case 186: + var forStatement = parent_1; + return (forStatement.initializer === node && forStatement.initializer.kind !== 199) || + forStatement.condition === node || + forStatement.iterator === node; + case 187: + case 188: var forInStatement = parent_1; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 196) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199) || forInStatement.expression === node; case 160: return node === parent_1.expression; - case 175: + case 176: return node === parent_1.expression; case 127: return node === parent_1.expression; @@ -3590,7 +3594,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind === 216; + return node.kind === 208 && node.moduleReference.kind === 219; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -3599,20 +3603,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind !== 216; + return node.kind === 208 && node.moduleReference.kind !== 219; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 206) { + if (node.kind === 209) { return node.moduleSpecifier; } - if (node.kind === 205) { + if (node.kind === 208) { var reference = node.moduleReference; - if (reference.kind === 216) { + if (reference.kind === 219) { return reference.expression; } } - if (node.kind === 212) { + if (node.kind === 215) { return node.moduleSpecifier; } } @@ -3629,8 +3633,8 @@ var ts; case 134: case 133: return node.questionToken !== undefined; - case 222: - case 221: + case 225: + case 224: case 132: case 131: return node.questionToken !== undefined; @@ -3673,31 +3677,31 @@ var ts; switch (node.kind) { case 163: case 152: - case 198: - case 135: case 201: - case 223: - case 214: - case 197: + case 135: + case 204: + case 226: + case 217: + case 200: case 162: case 136: - case 207: - case 205: case 210: - case 199: + case 208: + case 213: + case 202: case 134: case 133: - case 202: - case 208: + case 205: + case 211: case 129: - case 221: + case 224: case 132: case 131: case 137: - case 222: - case 200: + case 225: + case 203: case 128: - case 195: + case 198: return true; } return false; @@ -3705,25 +3709,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 187: - case 186: - case 194: - case 181: - case 179: - case 178: - case 184: - case 185: - case 183: - case 180: - case 191: - case 188: case 190: - case 94: - case 193: - case 177: - case 182: case 189: - case 211: + case 197: + case 184: + case 182: + case 181: + case 187: + case 188: + case 186: + case 183: + case 194: + case 191: + case 193: + case 94: + case 196: + case 180: + case 185: + case 192: + case 214: return true; default: return false; @@ -3749,7 +3753,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 210 || parent.kind === 214) { + if (parent.kind === 213 || parent.kind === 217) { if (parent.propertyName) { return true; } @@ -3761,24 +3765,24 @@ var ts; } ts.isDeclarationName = isDeclarationName; function isAliasSymbolDeclaration(node) { - return node.kind === 205 || - node.kind === 207 && !!node.name || - node.kind === 208 || - node.kind === 210 || - node.kind === 214 || - node.kind === 211 && node.expression.kind === 65; + return node.kind === 208 || + node.kind === 210 && !!node.name || + node.kind === 211 || + node.kind === 213 || + node.kind === 217 || + node.kind === 214 && node.expression.kind === 65; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; - function getClassBaseTypeNode(node) { + function getClassExtendsHeritageClauseElement(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } - ts.getClassBaseTypeNode = getClassBaseTypeNode; - function getClassImplementedTypeNodes(node) { + ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; + function getClassImplementsHeritageClauseElements(node) { var heritageClause = getHeritageClause(node.heritageClauses, 103); return heritageClause ? heritageClause.types : undefined; } - ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause ? heritageClause.types : undefined; @@ -3786,7 +3790,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _n = clauses.length; _i < _n; _i++) { + for (var _i = 0; _i < clauses.length; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -4013,7 +4017,7 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 202 || n.kind === 224; + return isFunctionLike(n) || n.kind === 205 || n.kind === 227; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -4383,12 +4387,36 @@ var ts; } } ts.writeCommentRange = writeCommentRange; + function isSupportedHeritageClauseElement(node) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; + function isSupportedHeritageClauseElementExpression(node) { + if (node.kind === 65) { + return true; + } + else if (node.kind === 155) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + else { + return false; + } + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 126 && node.parent.right === node) || + (node.parent.kind === 155 && node.parent.name === node); + } + ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function getLocalSymbolForExportDefault(symbol) { + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256) ? symbol.valueDeclaration.localSymbol : undefined; + } + ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; })(ts || (ts = {})); /// /// var ts; (function (ts) { - var nodeConstructors = new Array(226); + var nodeConstructors = new Array(229); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -4410,7 +4438,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -4436,9 +4464,9 @@ var ts; case 129: case 132: case 131: - case 221: - case 222: - case 195: + case 224: + case 225: + case 198: case 152: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -4464,7 +4492,7 @@ var ts; case 136: case 137: case 162: - case 197: + case 200: case 163: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -4543,150 +4571,154 @@ var ts; visitNode(cbNode, node.whenFalse); case 173: return visitNode(cbNode, node.expression); - case 176: - case 203: + case 179: + case 206: return visitNodes(cbNodes, node.statements); - case 224: + case 227: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 177: + case 180: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 196: + case 199: return visitNodes(cbNodes, node.declarations); - case 179: + case 182: return visitNode(cbNode, node.expression); - case 180: + case 183: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 181: + case 184: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 182: + case 185: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 183: + case 186: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); - case 184: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 185: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 186: case 187: - return visitNode(cbNode, node.label); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 189: + case 190: + return visitNode(cbNode, node.label); + case 191: + return visitNode(cbNode, node.expression); + case 192: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 190: + case 193: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 204: + case 207: return visitNodes(cbNodes, node.clauses); - case 217: + case 220: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 218: + case 221: return visitNodes(cbNodes, node.statements); - case 191: + case 194: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 192: + case 195: return visitNode(cbNode, node.expression); - case 193: + case 196: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 220: + case 223: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 130: return visitNode(cbNode, node.expression); - case 198: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); - case 199: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); - case 200: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); case 201: + case 174: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 223: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); case 202: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 203: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 204: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 226: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); case 205: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 208: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 206: + case 209: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 207: + case 210: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 208: + case 211: return visitNode(cbNode, node.name); - case 209: - case 213: - return visitNodes(cbNodes, node.elements); case 212: + case 216: + return visitNodes(cbNodes, node.elements); + case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 210: - case 214: + case 213: + case 217: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 211: + case 214: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); case 171: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 175: + case 176: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 127: return visitNode(cbNode, node.expression); - case 219: + case 222: return visitNodes(cbNodes, node.types); - case 216: + case 177: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments); + case 219: return visitNode(cbNode, node.expression); - case 215: + case 218: return visitNodes(cbNodes, node.decorators); } } @@ -4701,7 +4733,7 @@ var ts; case 5: return ts.Diagnostics.Property_or_signature_expected; case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; + case 8: return ts.Diagnostics.Expression_expected; case 9: return ts.Diagnostics.Variable_declaration_expected; case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; @@ -4783,7 +4815,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -4847,7 +4879,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5047,7 +5079,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(224, 0); + var sourceFile = createNode(227, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -5420,7 +5452,7 @@ var ts; case 5: return isStartOfTypeMember(); case 6: - return lookAhead(isClassMemberStart); + return lookAhead(isClassMemberStart) || (token === 22 && !inErrorRecovery); case 7: return token === 18 || isLiteralPropertyName(); case 13: @@ -5428,7 +5460,15 @@ var ts; case 10: return isLiteralPropertyName(); case 8: - return isIdentifier() && !isNotHeritageClauseTypeName(); + if (token === 14) { + return lookAhead(isValidHeritageClauseObjectLiteral); + } + if (!inErrorRecovery) { + return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + else { + return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); + } case 9: return isIdentifierOrPattern(); case 11: @@ -5450,17 +5490,29 @@ var ts; } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } + function isValidHeritageClauseObjectLiteral() { + ts.Debug.assert(token === 14); + if (nextToken() === 15) { + var next = nextToken(); + return next === 23 || next === 14 || next === 79 || next === 103; + } + return true; + } function nextTokenIsIdentifier() { nextToken(); return isIdentifier(); } - function isNotHeritageClauseTypeName() { + function isHeritageClauseExtendsOrImplementsKeyword() { if (token === 103 || token === 79) { - return lookAhead(nextTokenIsIdentifier); + return lookAhead(nextTokenIsStartOfExpression); } return false; } + function nextTokenIsStartOfExpression() { + nextToken(); + return isStartOfExpression(); + } function isListTerminator(kind) { if (token === 1) { return true; @@ -5610,26 +5662,26 @@ var ts; case 15: return isReusableParameter(node); case 19: - case 8: case 16: case 18: case 17: case 12: case 13: + case 8: } return false; } function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 206: - case 205: - case 212: - case 211: - case 198: - case 199: - case 202: + case 209: + case 208: + case 215: + case 214: case 201: + case 202: + case 205: + case 204: return true; } return isReusableStatement(node); @@ -5645,6 +5697,7 @@ var ts; case 136: case 137: case 132: + case 178: return true; } } @@ -5653,8 +5706,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 217: - case 218: + case 220: + case 221: return true; } } @@ -5663,33 +5716,33 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 197: - case 177: - case 176: + case 200: case 180: case 179: - case 192: - case 188: - case 190: - case 187: - case 186: - case 184: - case 185: case 183: case 182: - case 189: - case 178: - case 193: + case 195: case 191: + case 193: + case 190: + case 189: + case 187: + case 188: + case 186: + case 185: + case 192: case 181: + case 196: case 194: + case 184: + case 197: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 223; + return node.kind === 226; } function isReusableTypeMember(node) { if (node) { @@ -5705,7 +5758,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 195) { + if (node.kind !== 198) { return false; } var variableDeclarator = node; @@ -5811,7 +5864,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(175); + var span = createNode(176); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -6246,7 +6299,7 @@ var ts; function parseTypeAnnotation() { return parseOptional(51) ? parseType() : undefined; } - function isStartOfExpression() { + function isStartOfLeftHandSideExpression() { switch (token) { case 93: case 91: @@ -6261,9 +6314,21 @@ var ts; case 18: case 14: case 83: + case 69: case 88: case 36: case 57: + case 65: + return true; + default: + return isIdentifier(); + } + } + function isStartOfExpression() { + if (isStartOfLeftHandSideExpression()) { + return true; + } + switch (token) { case 33: case 34: case 47: @@ -6274,7 +6339,6 @@ var ts; case 38: case 39: case 24: - case 65: case 111: return true; default: @@ -6285,7 +6349,11 @@ var ts; } } function isStartOfExpressionStatement() { - return token !== 14 && token !== 83 && token !== 52 && isStartOfExpression(); + return token !== 14 && + token !== 83 && + token !== 69 && + token !== 52 && + isStartOfExpression(); } function parseExpression() { // Expression[in]: @@ -6466,7 +6534,10 @@ var ts; if (token === 14) { return parseFunctionBlock(false, false); } - if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 83) { + if (isStartOfStatement(true) && + !isStartOfExpressionStatement() && + token !== 83 && + token !== 69) { return parseFunctionBlock(false, true); } return parseAssignmentExpressionOrHigher(); @@ -6731,7 +6802,6 @@ var ts; case 19: case 51: case 22: - case 23: case 50: case 28: case 30: @@ -6745,6 +6815,8 @@ var ts; case 15: case 1: return true; + case 23: + case 14: default: return false; } @@ -6767,6 +6839,8 @@ var ts; return parseArrayLiteralExpression(); case 14: return parseObjectLiteralExpression(); + case 69: + return parseClassExpression(); case 83: return parseFunctionExpression(); case 88: @@ -6797,7 +6871,7 @@ var ts; } function parseArgumentOrArrayLiteralElement() { return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(174) : + token === 23 ? createNode(175) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { @@ -6838,13 +6912,13 @@ var ts; return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(222, fullStart); + var shorthandDeclaration = createNode(225, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(221, fullStart); + var propertyAssignment = createNode(224, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6892,7 +6966,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(176); + var node = createNode(179); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -6917,12 +6991,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(178); + var node = createNode(181); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(180); + var node = createNode(183); parseExpected(84); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6932,7 +7006,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(181); + var node = createNode(184); parseExpected(75); node.statement = parseStatement(); parseExpected(100); @@ -6943,7 +7017,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(182); + var node = createNode(185); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6966,21 +7040,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86)) { - var forInStatement = createNode(184, pos); + var forInStatement = createNode(187, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(125)) { - var forOfStatement = createNode(185, pos); + var forOfStatement = createNode(188, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(183, pos); + var forStatement = createNode(186, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -6998,7 +7072,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 187 ? 66 : 71); + parseExpected(kind === 190 ? 66 : 71); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -7006,7 +7080,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(188); + var node = createNode(191); parseExpected(90); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -7015,7 +7089,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(189); + var node = createNode(192); parseExpected(101); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7024,7 +7098,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(217); + var node = createNode(220); parseExpected(67); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -7032,7 +7106,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(218); + var node = createNode(221); parseExpected(73); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -7042,12 +7116,12 @@ var ts; return token === 67 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(190); + var node = createNode(193); parseExpected(92); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); - var caseBlock = createNode(204, scanner.getStartPos()); + var caseBlock = createNode(207, scanner.getStartPos()); parseExpected(14); caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); @@ -7057,14 +7131,14 @@ var ts; function parseThrowStatement() { // ThrowStatement[Yield] : // throw [no LineTerminator here]Expression[In, ?Yield]; - var node = createNode(192); + var node = createNode(195); parseExpected(94); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(193); + var node = createNode(196); parseExpected(96); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 ? parseCatchClause() : undefined; @@ -7075,7 +7149,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(220); + var result = createNode(223); parseExpected(68); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7085,7 +7159,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(194); + var node = createNode(197); parseExpected(72); parseSemicolon(); return finishNode(node); @@ -7094,13 +7168,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 && parseOptional(51)) { - var labeledStatement = createNode(191, fullStart); + var labeledStatement = createNode(194, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(179, fullStart); + var expressionStatement = createNode(182, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -7108,7 +7182,7 @@ var ts; } function isStartOfStatement(inErrorRecovery) { if (ts.isModifier(token)) { - var result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return true; } @@ -7120,6 +7194,7 @@ var ts; case 98: case 105: case 83: + case 69: case 84: case 75: case 100: @@ -7139,7 +7214,6 @@ var ts; var isConstEnum = lookAhead(nextTokenIsEnumKeyword); return !isConstEnum; case 104: - case 69: case 117: case 77: case 123: @@ -7174,6 +7248,8 @@ var ts; return parseVariableStatement(scanner.getStartPos(), undefined, undefined); case 83: return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 69: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); case 22: return parseEmptyStatement(); case 84: @@ -7185,9 +7261,9 @@ var ts; case 82: return parseForOrForInOrForOfStatement(); case 71: - return parseBreakOrContinueStatement(186); + return parseBreakOrContinueStatement(189); case 66: - return parseBreakOrContinueStatement(187); + return parseBreakOrContinueStatement(190); case 90: return parseReturnStatement(); case 101: @@ -7208,7 +7284,7 @@ var ts; } default: if (ts.isModifier(token) || token === 52) { - var result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return result; } @@ -7216,7 +7292,7 @@ var ts; return parseExpressionOrLabeledStatement(); } } - function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers() { + function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers() { var start = scanner.getStartPos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -7236,6 +7312,8 @@ var ts; return parseVariableStatement(start, decorators, modifiers); case 83: return parseFunctionDeclaration(start, decorators, modifiers); + case 69: + return parseClassDeclaration(start, decorators, modifiers); } return undefined; } @@ -7248,7 +7326,7 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(174); + return createNode(175); } var node = createNode(152); node.dotDotDotToken = parseOptionalToken(21); @@ -7297,7 +7375,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(195); + var node = createNode(198); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -7306,7 +7384,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(196); + var node = createNode(199); switch (token) { case 98: break; @@ -7335,7 +7413,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(177, fullStart); + var node = createNode(180, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -7343,7 +7421,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(200, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83); @@ -7486,6 +7564,11 @@ var ts; return modifiers; } function parseClassElement() { + if (token === 22) { + var result = createNode(178); + nextToken(); + return finishNode(result); + } var fullStart = getNodePos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -7512,12 +7595,18 @@ var ts; } ts.Debug.fail("Should not have attempted to parse class member declaration."); } + function parseClassExpression() { + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 174); + } function parseClassDeclaration(fullStart, decorators, modifiers) { + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201); + } + function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var savedStrictModeContext = inStrictModeContext(); if (languageVersion >= 2) { setStrictModeContext(true); } - var node = createNode(198, fullStart); + var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(69); @@ -7553,14 +7642,22 @@ var ts; } function parseHeritageClause() { if (token === 79 || token === 103) { - var node = createNode(219); + var node = createNode(222); node.token = token; nextToken(); - node.types = parseDelimitedList(8, parseTypeReference); + node.types = parseDelimitedList(8, parseHeritageClauseElement); return finishNode(node); } return undefined; } + function parseHeritageClauseElement() { + var node = createNode(177); + node.expression = parseLeftHandSideExpressionOrHigher(); + if (token === 24) { + node.typeArguments = parseBracketedList(17, parseType, 24, 25); + } + return finishNode(node); + } function isHeritageClause() { return token === 79 || token === 103; } @@ -7568,7 +7665,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(199, fullStart); + var node = createNode(202, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(104); @@ -7579,7 +7676,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200, fullStart); + var node = createNode(203, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(123); @@ -7590,13 +7687,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(223, scanner.getStartPos()); + var node = createNode(226, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(201, fullStart); + var node = createNode(204, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77); @@ -7611,7 +7708,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(203, scanner.getStartPos()); + var node = createNode(206, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -7622,7 +7719,7 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; @@ -7633,7 +7730,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -7665,7 +7762,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 124) { - var importEqualsDeclaration = createNode(205, fullStart); + var importEqualsDeclaration = createNode(208, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -7675,7 +7772,7 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(206, fullStart); + var importDeclaration = createNode(209, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || @@ -7695,13 +7792,13 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(207, fullStart); + var importClause = createNode(210, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(209); + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(212); } return finishNode(importClause); } @@ -7711,7 +7808,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(216); + var node = createNode(219); parseExpected(118); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -7726,7 +7823,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(208); + var namespaceImport = createNode(211); parseExpected(35); parseExpected(102); namespaceImport.name = parseIdentifier(); @@ -7734,14 +7831,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 209 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 212 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(214); + return parseImportOrExportSpecifier(217); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(210); + return parseImportOrExportSpecifier(213); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -7760,13 +7857,13 @@ var ts; else { node.name = identifierName; } - if (kind === 210 && checkIdentifierIsKeyword) { + if (kind === 213 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35)) { @@ -7774,7 +7871,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(213); + node.exportClause = parseNamedImportsOrExports(216); if (parseOptional(124)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -7783,7 +7880,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(211, fullStart); + var node = createNode(214, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53)) { @@ -7896,7 +7993,7 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); default: if (decorators) { - var node = createMissingNode(215, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(218, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -7976,10 +8073,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 205 && node.moduleReference.kind === 216 - || node.kind === 206 - || node.kind === 211 - || node.kind === 212 + || node.kind === 208 && node.moduleReference.kind === 219 + || node.kind === 209 + || node.kind === 214 + || node.kind === 215 ? node : undefined; }); @@ -7996,6 +8093,7 @@ var ts; case 153: case 161: case 154: + case 174: case 162: case 65: case 9: @@ -8024,16 +8122,16 @@ var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 199 || node.kind === 200) { + if (node.kind === 202 || node.kind === 203) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 206 || node.kind === 205) && !(node.flags & 1)) { + else if ((node.kind === 209 || node.kind === 208) && !(node.flags & 1)) { return 0; } - else if (node.kind === 203) { + else if (node.kind === 206) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -8049,7 +8147,7 @@ var ts; }); return state; } - else if (node.kind === 202) { + else if (node.kind === 205) { return getModuleInstanceState(node.body); } else { @@ -8102,7 +8200,7 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 202 && node.name.kind === 8) { + if (node.kind === 205 && node.name.kind === 8) { return '"' + node.name.text + '"'; } if (node.name.kind === 127) { @@ -8123,12 +8221,12 @@ var ts; return "__new"; case 140: return "__index"; - case 212: + case 215: return "__export"; - case 211: + case 214: return node.isExportEquals ? "export=" : "default"; - case 197: - case 198: + case 200: + case 201: return node.flags & 256 ? "default" : undefined; } } @@ -8160,7 +8258,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 198 && symbol.exports) { + if ((node.kind === 201 || node.kind === 174) && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -8176,7 +8274,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 214 || (node.kind === 205 && hasExportModifier)) { + if (node.kind === 217 || (node.kind === 208 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -8213,7 +8311,7 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 224); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227); } ts.forEachChild(node, bind); container = saveContainer; @@ -8222,10 +8320,10 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 202: + case 205: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -8240,22 +8338,23 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 198: + case 174: + case 201: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } case 145: case 154: - case 199: + case 202: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 201: + case 204: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -8270,11 +8369,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 224 ? node : node.body; - if (body.kind === 224 || body.kind === 203) { - for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { + var body = node.kind === 227 ? node : node.body; + if (body.kind === 227 || body.kind === 206) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 212 || stat.kind === 211) { + if (stat.kind === 215 || stat.kind === 214) { return true; } } @@ -8336,10 +8435,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 202: + case 205: declareModuleMember(node, 2, 107455); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -8364,7 +8463,7 @@ var ts; case 129: bindParameter(node); break; - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); @@ -8380,11 +8479,11 @@ var ts; case 131: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 221: - case 222: + case 224: + case 225: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 223: + case 226: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 138: @@ -8396,7 +8495,7 @@ var ts; case 133: bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; - case 197: + case 200: bindDeclaration(node, 16, 106927, true); break; case 135: @@ -8422,19 +8521,22 @@ var ts; case 163: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 220: + case 174: + bindAnonymousDeclaration(node, 32, "__class", false); + break; + case 223: bindCatchVariableDeclaration(node); break; - case 198: + case 201: bindDeclaration(node, 32, 899583, false); break; - case 199: + case 202: bindDeclaration(node, 64, 792992, false); break; - case 200: + case 203: bindDeclaration(node, 524288, 793056, false); break; - case 201: + case 204: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -8442,16 +8544,16 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 202: + case 205: bindModuleDeclaration(node); break; - case 205: case 208: - case 210: - case 214: + case 211: + case 213: + case 217: bindDeclaration(node, 8388608, 8388608, false); break; - case 207: + case 210: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -8459,13 +8561,13 @@ var ts; bindChildren(node, 0, false); } break; - case 212: + case 215: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 211: + case 214: if (node.expression && node.expression.kind === 65) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } @@ -8474,20 +8576,20 @@ var ts; } bindChildren(node, 0, false); break; - case 224: + case 227: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 176: + case 179: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 220: - case 183: - case 184: - case 185: - case 204: + case 223: + case 186: + case 187: + case 188: + case 207: bindChildren(node, 0, true); break; default: @@ -8506,7 +8608,7 @@ var ts; } if (node.flags & 112 && node.parent.kind === 135 && - node.parent.parent.kind === 198) { + (node.parent.parent.kind === 201 || node.parent.parent.kind === 174)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -8792,10 +8894,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 224); + return ts.getAncestor(node, 227); } function isGlobalSourceFile(node) { - return node.kind === 224 && !ts.isExternalModule(node); + return node.kind === 227 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -8837,25 +8939,33 @@ var ts; } } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 214)) { + if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 217)) { + break loop; + } + result = undefined; + } + else if (location.kind === 227) { + result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { break loop; } result = undefined; } break; - case 201: + case 204: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; case 132: case 131: - if (location.parent.kind === 198 && !(location.flags & 128)) { + if (location.parent.kind === 201 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -8864,8 +8974,8 @@ var ts; } } break; - case 198: - case 199: + case 201: + case 202: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -8876,7 +8986,7 @@ var ts; break; case 127: grandparent = location.parent.parent; - if (grandparent.kind === 198 || grandparent.kind === 199) { + if (grandparent.kind === 201 || grandparent.kind === 202) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -8888,7 +8998,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 163: if (name === "arguments") { result = argumentsSymbol; @@ -8900,8 +9010,15 @@ var ts; result = argumentsSymbol; break loop; } - var id = location.name; - if (id && name === id.text) { + var functionName = location.name; + if (functionName && name === functionName.text) { + result = location.symbol; + break loop; + } + break; + case 174: + var className = location.name; + if (className && name === className.text) { result = location.symbol; break loop; } @@ -8945,14 +9062,14 @@ var ts; ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 195); + var variableDeclaration = ts.getAncestor(declaration, 198); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 177 || - variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 180 || + variableDeclaration.parent.parent.kind === 186) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 185 || - variableDeclaration.parent.parent.kind === 184) { + else if (variableDeclaration.parent.parent.kind === 188 || + variableDeclaration.parent.parent.kind === 187) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -8974,10 +9091,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } - while (node && node.kind !== 206) { + while (node && node.kind !== 209) { node = node.parent; } return node; @@ -8987,7 +9104,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 216) { + if (node.moduleReference.kind === 219) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -9010,7 +9127,7 @@ var ts; if (moduleSymbol.flags & 3) { var typeAnnotation = moduleSymbol.valueDeclaration.type; if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); + return getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name); } } } @@ -9041,7 +9158,7 @@ var ts; if (symbol.flags & 3) { var typeAnnotation = symbol.valueDeclaration.type; if (typeAnnotation) { - return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); + return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name)); } } } @@ -9076,17 +9193,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 205: - return getTargetOfImportEqualsDeclaration(node); - case 207: - return getTargetOfImportClause(node); case 208: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node); case 210: - return getTargetOfImportSpecifier(node); - case 214: - return getTargetOfExportSpecifier(node); + return getTargetOfImportClause(node); case 211: + return getTargetOfNamespaceImport(node); + case 213: + return getTargetOfImportSpecifier(node); + case 217: + return getTargetOfExportSpecifier(node); + case 214: return getTargetOfExportAssignment(node); } } @@ -9115,8 +9232,12 @@ var ts; function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); - if (target && target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target)) { - markAliasSymbolAsReferenced(symbol); + if (target) { + var markAlias = (target === unknownSymbol && compilerOptions.separateCompilation) || + (target !== unknownSymbol && (target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); + if (markAlias) { + markAliasSymbolAsReferenced(symbol); + } } } function markAliasSymbolAsReferenced(symbol) { @@ -9124,10 +9245,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 211 && node.expression) { + if (node.kind === 214 && node.expression) { checkExpressionCached(node.expression); } - else if (node.kind === 214) { + else if (node.kind === 217) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -9137,17 +9258,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 205); + importDeclaration = ts.getAncestor(entityName, 208); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 65 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 65 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (entityName.kind === 65 || entityName.parent.kind === 126) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 205); + ts.Debug.assert(entityName.parent.kind === 208); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -9155,7 +9276,7 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(name, meaning) { - if (ts.getFullWidth(name) === 0) { + if (ts.nodeIsMissing(name)) { return undefined; } var symbol; @@ -9165,18 +9286,22 @@ var ts; return undefined; } } - else if (name.kind === 126) { - var namespace = resolveEntityName(name.left, 1536); - if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) { + else if (name.kind === 126 || name.kind === 155) { + var left = name.kind === 126 ? name.left : name.expression; + var right = name.kind === 126 ? name.right : name.name; + var namespace = resolveEntityName(left, 1536); + if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; } - var right = name.right; symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; } } + else { + ts.Debug.fail("Unknown entity name kind."); + } ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } @@ -9265,7 +9390,7 @@ var ts; } var exportStars = symbol.exports["__export"]; if (exportStars) { - for (var _i = 0, _a = exportStars.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; visit(resolveExternalModuleName(node, node.moduleSpecifier)); } @@ -9302,7 +9427,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _n = members.length; _i < _n; _i++) { + for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; if (member.kind === 135 && ts.nodeIsPresent(member.body)) { return member; @@ -9369,17 +9494,17 @@ var ts; } } switch (location_1.kind) { - case 224: + case 227: if (!ts.isExternalModule(location_1)) { break; } - case 202: + case 205: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 198: - case 199: + case 201: + case 202: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -9410,7 +9535,7 @@ var ts; return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608) { + if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=") { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -9494,8 +9619,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 202 && declaration.name.kind === 8) || - (declaration.kind === 224 && ts.isExternalModule(declaration)); + return (declaration.kind === 205 && declaration.name.kind === 8) || + (declaration.kind === 227 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9530,8 +9655,8 @@ var ts; if (entityName.parent.kind === 144) { meaning = 107455 | 1048576; } - else if (entityName.kind === 126 || - entityName.parent.kind === 205) { + else if (entityName.kind === 126 || entityName.kind === 155 || + entityName.parent.kind === 208) { meaning = 1536; } else { @@ -9578,7 +9703,7 @@ var ts; while (node.kind === 149) { node = node.parent; } - if (node.kind === 200) { + if (node.kind === 203) { return getSymbolOfNode(node); } } @@ -9622,7 +9747,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -9750,7 +9875,7 @@ var ts; var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 224 || declaration.parent.kind === 203; + return declaration.parent.kind === 227 || declaration.parent.kind === 206; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -9806,13 +9931,13 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; writeKeyword(writer, 88); writeSpace(writer); @@ -9846,13 +9971,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { - var p = _f[_e]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _h = 0, _j = signatures.length; _h < _j; _h++) { - var signature = signatures[_h]; + for (var _f = 0; _f < signatures.length; _f++) { + var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -9982,12 +10107,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 202) { + if (node.kind === 205) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 224) { + else if (node.kind === 227) { return ts.isExternalModule(node) ? node : undefined; } } @@ -10032,21 +10157,21 @@ var ts; switch (node.kind) { case 152: return isDeclarationVisible(node.parent.parent); - case 195: + case 198: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 202: - case 198: - case 199: - case 200: - case 197: - case 201: case 205: + case 201: + case 202: + case 203: + case 200: + case 204: + case 208: var parent_2 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 205 && parent_2.kind !== 224 && ts.isInAmbientContext(parent_2))) { + !(node.kind !== 208 && parent_2.kind !== 227 && ts.isInAmbientContext(parent_2))) { return isGlobalSourceFile(parent_2); } return isDeclarationVisible(parent_2); @@ -10064,7 +10189,7 @@ var ts; case 138: case 140: case 129: - case 203: + case 206: case 142: case 143: case 145: @@ -10074,13 +10199,15 @@ var ts; case 148: case 149: return isDeclarationVisible(node.parent); - case 207: - case 208: case 210: + case 211: + case 213: return false; case 128: - case 224: + case 227: return true; + case 214: + return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } @@ -10095,10 +10222,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 211) { + if (node.parent && node.parent.kind === 214) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 217) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -10130,7 +10257,7 @@ var ts; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 195 ? node.parent.parent.parent : node.parent; + return node.kind === 198 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -10188,17 +10315,17 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 184) { + if (declaration.parent.parent.kind === 187) { return anyType; } - if (declaration.parent.parent.kind === 185) { + if (declaration.parent.parent.kind === 188) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var func = declaration.parent; @@ -10216,7 +10343,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 222) { + if (declaration.kind === 225) { return checkIdentifier(declaration.name); } return undefined; @@ -10245,7 +10372,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 174 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 175 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -10263,7 +10390,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 221 ? getWidenedType(type) : type; + return declaration.kind !== 224 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -10284,16 +10411,16 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 220) { + if (declaration.parent.kind === 223) { return links.type = anyType; } - if (declaration.kind === 211) { + if (declaration.kind === 214) { var exportAssignment = declaration; if (exportAssignment.expression) { return links.type = checkExpression(exportAssignment.expression); } else if (exportAssignment.type) { - return links.type = getTypeFromTypeNode(exportAssignment.type); + return links.type = getTypeFromTypeNodeOrHeritageClauseElement(exportAssignment.type); } else { return links.type = anyType; @@ -10322,11 +10449,11 @@ var ts; function getAnnotatedAccessorType(accessor) { if (accessor) { if (accessor.kind === 136) { - return accessor.type && getTypeFromTypeNode(accessor.type); + return accessor.type && getTypeFromTypeNodeOrHeritageClauseElement(accessor.type); } else { var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation && getTypeFromTypeNodeOrHeritageClauseElement(setterTypeAnnotation); } } return undefined; @@ -10438,7 +10565,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 199 || node.kind === 198) { + if (node.kind === 202 || node.kind === 201) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10469,10 +10596,10 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(symbol, 198); - var baseTypeNode = ts.getClassBaseTypeNode(declaration); + var declaration = ts.getDeclarationOfKind(symbol, 201); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + var baseType = getTypeFromHeritageClauseElement(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10510,9 +10637,9 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 199 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 202 && ts.getInterfaceBaseTypeNodes(declaration)) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { - var baseType = getTypeFromTypeReferenceNode(node); + var baseType = getTypeFromHeritageClauseElement(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10541,15 +10668,15 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 200); - var type = getTypeFromTypeNode(declaration.type); + var declaration = ts.getDeclarationOfKind(symbol, 203); + var type = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 200); + var declaration = ts.getDeclarationOfKind(symbol, 203); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -10606,7 +10733,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -10614,14 +10741,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSymbols.length; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -10630,7 +10757,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSignatures.length; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -10729,7 +10856,7 @@ var ts; function getUnionSignatures(types, kind) { var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -10750,7 +10877,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -10886,7 +11013,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -10904,7 +11031,7 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0, _b = props.length; _a < _b; _a++) { + for (var _a = 0; _a < props.length; _a++) { var prop = props[_a]; if (prop.declarations) { declarations.push.apply(declarations, prop.declarations); @@ -11029,7 +11156,7 @@ var ts; returnType = classType; } else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); + returnType = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } else { if (declaration.kind === 136 && !ts.hasDynamicName(declaration)) { @@ -11053,7 +11180,7 @@ var ts; switch (node.kind) { case 142: case 143: - case 197: + case 200: case 134: case 133: case 135: @@ -11151,7 +11278,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -11167,7 +11294,7 @@ var ts; function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType + ? declaration.type ? getTypeFromTypeNodeOrHeritageClauseElement(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { @@ -11177,7 +11304,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128).constraint); + type.constraint = getTypeFromTypeNodeOrHeritageClauseElement(ts.getDeclarationOfKind(type.symbol, 128).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -11201,7 +11328,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } @@ -11252,31 +11379,42 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReferenceNode(node) { + function getTypeFromTypeReference(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromHeritageClauseElement(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromTypeReferenceOrHeritageClauseElement(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var symbol = resolveEntityName(node.typeName, 793056); var type; - if (symbol) { - if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - type = unknownType; - } - else { - type = getDeclaredTypeOfSymbol(symbol); - if (type.flags & (1024 | 2048) && type.flags & 4096) { - var typeParameters = type.typeParameters; - if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); - } - else { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); - type = undefined; - } + if (node.kind !== 177 || ts.isSupportedHeritageClauseElement(node)) { + var typeNameOrExpression = node.kind === 141 + ? node.typeName + : node.expression; + var symbol = resolveEntityName(typeNameOrExpression, 793056); + if (symbol) { + if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; } else { - if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); - type = undefined; + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 | 2048) && type.flags & 4096) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNodeOrHeritageClauseElement)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } } } } @@ -11295,12 +11433,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 198: - case 199: case 201: + case 202: + case 204: return declaration; } } @@ -11342,7 +11480,7 @@ var ts; function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + links.resolvedType = createArrayType(getTypeFromTypeNodeOrHeritageClauseElement(node.elementType)); } return links.resolvedType; } @@ -11358,7 +11496,7 @@ var ts; function getTypeFromTupleTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNodeOrHeritageClauseElement)); } return links.resolvedType; } @@ -11378,13 +11516,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -11402,7 +11540,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -11449,7 +11587,7 @@ var ts; function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNodeOrHeritageClauseElement), true); } return links.resolvedType; } @@ -11475,7 +11613,7 @@ var ts; } return links.resolvedType; } - function getTypeFromTypeNode(node) { + function getTypeFromTypeNodeOrHeritageClauseElement(node) { switch (node.kind) { case 112: return anyType; @@ -11492,7 +11630,9 @@ var ts; case 8: return getTypeFromStringLiteral(node); case 141: - return getTypeFromTypeReferenceNode(node); + return getTypeFromTypeReference(node); + case 177: + return getTypeFromHeritageClauseElement(node); case 144: return getTypeFromTypeQueryNode(node); case 146: @@ -11502,7 +11642,7 @@ var ts; case 148: return getTypeFromUnionTypeNode(node); case 149: - return getTypeFromTypeNode(node.type); + return getTypeFromTypeNodeOrHeritageClauseElement(node.type); case 142: case 143: case 145: @@ -11518,7 +11658,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _n = items.length; _i < _n; _i++) { + for (var _i = 0; _i < items.length; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -11558,7 +11698,7 @@ var ts; case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _n = sources.length; _i < _n; _i++) { + for (var _i = 0; _i < sources.length; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -11674,7 +11814,7 @@ var ts; case 169: return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 221: + case 224: return isContextSensitive(node.initializer); case 134: case 133: @@ -11846,7 +11986,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -11869,7 +12009,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -12006,7 +12146,7 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -12077,7 +12217,7 @@ var ts; return 0; } var result = -1; - for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceProperties.length; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -12102,11 +12242,11 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceSignatures.length; _a++) { var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); @@ -12324,7 +12464,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -12457,7 +12597,7 @@ var ts; ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 197: + case 200: case 134: case 133: case 136: @@ -12510,7 +12650,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { + for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); } @@ -12581,7 +12721,7 @@ var ts; var targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _i = 0, _n = targetTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < targetTypes.length; _i++) { var t = targetTypes[_i]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -12599,7 +12739,7 @@ var ts; } else if (source.flags & 16384) { var sourceTypes = source.types; - for (var _a = 0, _b = sourceTypes.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceTypes.length; _a++) { var sourceType = sourceTypes[_a]; inferFromTypes(sourceType, target); } @@ -12626,7 +12766,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -12699,7 +12839,7 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; } return links.resolvedSymbol; } @@ -12770,7 +12910,7 @@ var ts; switch (node.kind) { case 169: return isAssignedInBinaryExpression(node); - case 195: + case 198: case 152: return isAssignedInVariableDeclaration(node); case 150: @@ -12790,24 +12930,24 @@ var ts; case 168: case 170: case 173: - case 176: - case 177: case 179: case 180: - case 181: case 182: case 183: case 184: case 185: + case 186: + case 187: case 188: - case 189: - case 190: - case 217: - case 218: case 191: case 192: case 193: case 220: + case 221: + case 194: + case 195: + case 196: + case 223: return ts.forEachChild(node, isAssignedIn); } return false; @@ -12843,7 +12983,7 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 180: + case 183: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } @@ -12863,9 +13003,9 @@ var ts; } } break; - case 224: - case 202: - case 197: + case 227: + case 205: + case 200: case 134: case 133: case 136: @@ -13008,15 +13148,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 220) { + symbol.valueDeclaration.parent.kind === 223) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 196) { + while (container.kind !== 199) { container = container.parent; } container = container.parent; - if (container.kind === 177) { + if (container.kind === 180) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -13033,7 +13173,7 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; getNodeLinks(node).flags |= 2; if (container.kind === 132 || container.kind === 135) { getNodeLinks(classNode).flags |= 4; @@ -13050,10 +13190,10 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 202: + case 205: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 201: + case 204: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 135: @@ -13074,7 +13214,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -13091,9 +13231,9 @@ var ts; } function checkSuperExpression(node) { var isCallExpression = node.parent.kind === 157 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); var baseClass; - if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); baseClass = classType.baseTypes.length && classType.baseTypes[0]; } @@ -13114,7 +13254,7 @@ var ts; container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 198) { + if (container && container.parent && container.parent.kind === 201) { if (container.flags & 128) { canUseSuperExpression = container.kind === 134 || @@ -13190,7 +13330,7 @@ var ts; var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var type = getContextuallyTypedParameterType(declaration); @@ -13256,7 +13396,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -13335,29 +13475,29 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 195: + case 198: case 129: case 132: case 131: case 152: return getContextualTypeForInitializerExpression(node); case 163: - case 188: + case 191: return getContextualTypeForReturnExpression(node); case 157: case 158: return getContextualTypeForArgument(parent, node); case 160: - return getTypeFromTypeNode(parent.type); + return getTypeFromTypeNodeOrHeritageClauseElement(parent.type); case 169: return getContextualTypeForBinaryOperand(node); - case 221: + case 224: return getContextualTypeForObjectLiteralElement(parent); case 153: return getContextualTypeForElementExpression(node); case 170: return getContextualTypeForConditionalOperand(node); - case 175: + case 176: ts.Debug.assert(parent.parent.kind === 171); return getContextualTypeForSubstitutionExpression(parent.parent, node); case 161: @@ -13393,7 +13533,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { @@ -13428,7 +13568,7 @@ var ts; if (parent.kind === 169 && parent.operatorToken.kind === 53 && parent.left === node) { return true; } - if (parent.kind === 221) { + if (parent.kind === 224) { return isAssignmentTarget(parent.parent); } if (parent.kind === 153) { @@ -13497,21 +13637,21 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 221 || - memberDecl.kind === 222 || + if (memberDecl.kind === 224 || + memberDecl.kind === 225 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 221) { + if (memberDecl.kind === 224) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 134) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 222); + ts.Debug.assert(memberDecl.kind === 225); type = memberDecl.name.kind === 127 ? unknownType : checkExpression(memberDecl.name, contextualMapper); @@ -13571,7 +13711,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 198); + var enclosingClassDeclaration = ts.getAncestor(node, 201); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -13770,7 +13910,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var parent_4 = signature.declaration && signature.declaration.parent; @@ -13819,7 +13959,7 @@ var ts; var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); - callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } else { var templateLiteral = tagExpression.template; @@ -13882,7 +14022,7 @@ var ts; } for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = void 0; if (i === 0 && args[i].parent.kind === 159) { @@ -13911,7 +14051,7 @@ var ts; var typeArgumentsAreAssignable = true; for (var i = 0; i < typeParameters.length; i++) { var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); + var typeArgument = getTypeFromTypeNodeOrHeritageClauseElement(typeArgNode); typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); @@ -13925,7 +14065,7 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = i === 0 && node.kind === 159 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : @@ -13955,8 +14095,8 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91) { - var containingClass = ts.getAncestor(callExpression, 198); - var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + var containingClass = ts.getAncestor(callExpression, 201); + var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } else { @@ -14023,7 +14163,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -14032,7 +14172,7 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var originalCandidate = candidates[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; @@ -14214,7 +14354,7 @@ var ts; } function checkTypeAssertion(node) { var exprType = checkExpression(node.expression); - var targetType = getTypeFromTypeNode(node.type); + var targetType = getTypeFromTypeNodeOrHeritageClauseElement(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { @@ -14252,7 +14392,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 176) { + if (func.body.kind !== 179) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -14290,7 +14430,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 192); + return (body.statements.length === 1) && (body.statements[0].kind === 195); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -14299,7 +14439,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 176) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 179) { return; } var bodyBlock = func.body; @@ -14351,16 +14491,16 @@ var ts; function checkFunctionExpressionOrObjectLiteralMethodBody(node) { ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); if (node.type) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (node.body) { - if (node.body.kind === 176) { + if (node.body.kind === 179) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); if (node.type) { - checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrHeritageClauseElement(node.type), node.body, undefined); } checkFunctionExpressionBodies(node.body); } @@ -14419,19 +14559,6 @@ var ts; return false; } } - function isImportedNameFromExternalModule(n) { - switch (n.kind) { - case 156: - case 155: { - var symbol = findSymbol(n.expression); - return symbol && symbol.flags & 8388608 && isExternalModuleSymbol(resolveAlias(symbol)); - } - case 161: - return isImportedNameFromExternalModule(n.expression); - default: - return false; - } - } if (!isReferenceOrErrorExpression(n)) { error(n, invalidReferenceMessage); return false; @@ -14440,9 +14567,6 @@ var ts; error(n, constantVariableMessage); return false; } - if (isImportedNameFromExternalModule(n)) { - error(n, invalidReferenceMessage); - } return true; } function checkDeleteExpression(node) { @@ -14500,7 +14624,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -14516,7 +14640,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -14552,9 +14676,9 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var name_8 = p.name; var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name_8.text) || @@ -14581,7 +14705,7 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { var propName = "" + i; var type = sourceType.flags & 1 ? sourceType : @@ -14903,6 +15027,8 @@ var ts; return checkTypeAssertion(node); case 161: return checkExpression(node.expression, contextualMapper); + case 174: + return checkClassExpression(node); case 162: case 163: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -14922,7 +15048,7 @@ var ts; return checkConditionalExpression(node, contextualMapper); case 173: return checkSpreadElementExpression(node, contextualMapper); - case 174: + case 175: return undefinedType; case 172: checkYieldExpression(node); @@ -14969,7 +15095,7 @@ var ts; if (node.kind === 140) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 || node.kind === 197 || node.kind === 143 || + else if (node.kind === 142 || node.kind === 200 || node.kind === 143 || node.kind === 138 || node.kind === 135 || node.kind === 139) { checkGrammarFunctionLikeDeclaration(node); @@ -14995,7 +15121,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 199) { + if (node.kind === 202) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -15005,7 +15131,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -15063,7 +15189,7 @@ var ts; } switch (n.kind) { case 162: - case 197: + case 200: case 163: case 154: return false; default: return ts.forEachChild(n, containsSuperCall); @@ -15073,7 +15199,7 @@ var ts; if (n.kind === 93) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 && n.kind !== 197) { + else if (n.kind !== 162 && n.kind !== 200) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -15082,13 +15208,13 @@ var ts; !(n.flags & 128) && !!n.initializer; } - if (ts.getClassBaseTypeNode(node.parent)) { + if (ts.getClassExtendsHeritageClauseElement(node.parent)) { if (containsSuperCall(node.body)) { var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 179 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 182 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -15132,9 +15258,15 @@ var ts; function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeReference(node) { + function checkTypeReferenceNode(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkHeritageClauseElement(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkTypeReferenceOrHeritageClauseElement(node) { checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceNode(node); + var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); if (type !== unknownType && node.typeArguments) { var len = node.typeArguments.length; for (var i = 0; i < len; i++) { @@ -15187,7 +15319,7 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 199) { + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202) { ts.Debug.assert(signatureDeclarationNode.kind === 138 || signatureDeclarationNode.kind === 139); var signatureKind = signatureDeclarationNode.kind === 138 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); @@ -15197,7 +15329,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { + for (var _i = 0; _i < signaturesToCheck.length; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -15207,7 +15339,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 199 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 202 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -15264,7 +15396,7 @@ var ts; var declarations = symbol.declarations; var isConstructor = (symbol.flags & 16384) !== 0; function reportImplementationExpectedError(node) { - if (node.name && ts.getFullWidth(node.name) === 0) { + if (node.name && ts.nodeIsMissing(node.name)) { return; } var seen = false; @@ -15303,15 +15435,15 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 199 || node.parent.kind === 145 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 202 || node.parent.kind === 145 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 197 || node.kind === 134 || node.kind === 133 || node.kind === 135) { + if (node.kind === 200 || node.kind === 134 || node.kind === 133 || node.kind === 135) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -15362,7 +15494,7 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + for (var _a = 0; _a < signatures.length; _a++) { var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); @@ -15408,16 +15540,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 199: - return 2097152; case 202: + return 2097152; + case 205: return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 198: case 201: + case 204: return 2097152 | 1048576; - case 205: + case 208: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -15431,7 +15563,7 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 198: + case 201: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]); @@ -15457,7 +15589,7 @@ var ts; return; } switch (node.kind) { - case 198: + case 201: case 134: case 136: case 137: @@ -15502,18 +15634,18 @@ var ts; } checkSourceElement(node.body); if (node.type && !isAccessor(node.kind)) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !node.type && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } } function checkBlock(node) { - if (node.kind === 176) { + if (node.kind === 179) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 203) { + if (ts.isFunctionBlock(node) || node.kind === 206) { checkFunctionExpressionBodies(node); } } @@ -15573,11 +15705,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } - if (ts.getClassBaseTypeNode(enclosingClass)) { + if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var isDeclaration_2 = node.kind !== 65; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); @@ -15591,11 +15723,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 202 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 205 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 224 && ts.isExternalModule(parent)) { + if (parent.kind === 227 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -15606,7 +15738,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { return; } - if (node.kind === 195 && !node.initializer) { + if (node.kind === 198 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -15616,15 +15748,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 196); - var container = varDeclList.parent.kind === 177 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199); + var container = varDeclList.parent.kind === 180 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 176 && ts.isFunctionLike(container.parent) || - container.kind === 203 || - container.kind === 202 || - container.kind === 224); + (container.kind === 179 && ts.isFunctionLike(container.parent) || + container.kind === 206 || + container.kind === 205 || + container.kind === 227); if (!namesShareScope) { var name_9 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_9, name_9); @@ -15708,7 +15840,7 @@ var ts; } if (node.kind !== 132 && node.kind !== 131) { checkExportsOnMergedDeclarations(node); - if (node.kind === 195 || node.kind === 152) { + if (node.kind === 198 || node.kind === 152) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -15737,7 +15869,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 176 || node.kind === 154) { + if (node.kind === 179 || node.kind === 154) { return true; } node = node.parent; @@ -15765,12 +15897,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 196) { + if (node.initializer && node.initializer.kind == 199) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -15785,7 +15917,7 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { checkForInOrForOfVariableDeclaration(node); } else { @@ -15806,7 +15938,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -16005,7 +16137,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 218 && !hasDuplicateDefaultClause) { + if (clause.kind === 221 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -16017,7 +16149,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 217) { + if (produceDiagnostics && clause.kind === 220) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -16034,7 +16166,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 191 && current.label.text === node.label.text) { + if (current.kind === 194 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -16098,9 +16230,9 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 198) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 201) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -16173,7 +16305,15 @@ var ts; } } } + function checkClassExpression(node) { + grammarErrorOnNode(node, ts.Diagnostics.class_expressions_are_not_currently_supported); + ts.forEach(node.members, checkSourceElement); + return unknownType; + } function checkClassDeclaration(node) { + if (node.parent.kind !== 206 && node.parent.kind !== 227) { + grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + } checkGrammarClassDeclarationHeritageClauses(node); checkDecorators(node); if (node.name) { @@ -16186,10 +16326,13 @@ var ts; var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); var staticType = getTypeOfSymbol(symbol); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); + } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkTypeReference(baseTypeNode); + checkHeritageClauseElement(baseTypeNode); } if (type.baseTypes.length) { if (produceDiagnostics) { @@ -16197,19 +16340,24 @@ var ts; checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); var staticBaseType = getTypeOfSymbol(baseType.symbol); checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType.symbol !== resolveEntityName(baseTypeNode.typeName, 107455)) { + if (baseType.symbol !== resolveEntityName(baseTypeNode.expression, 107455)) { error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); } checkKindsOfPropertyMemberOverrides(type, baseType); } - checkExpressionOrQualifiedName(baseTypeNode.typeName); } - var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (type.baseTypes.length || (baseTypeNode && compilerOptions.separateCompilation)) { + checkExpressionOrQualifiedName(baseTypeNode.expression); + } + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - checkTypeReference(typeRefNode); + if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromTypeReferenceNode(typeRefNode); + var t = getTypeFromHeritageClauseElement(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { @@ -16246,7 +16394,7 @@ var ts; // Base class instance member variables and accessors can be overridden by // derived class instance member variables and accessors, but not by other kinds of members. var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < baseProperties.length; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -16310,7 +16458,7 @@ var ts; if (!tp1.constraint || !tp2.constraint) { return false; } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + if (!isTypeIdenticalTo(getTypeFromTypeNodeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrHeritageClauseElement(tp2.constraint))) { return false; } } @@ -16323,10 +16471,10 @@ var ts; var seen = {}; ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0, _c = properties.length; _b < _c; _b++) { + for (var _b = 0; _b < properties.length; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; @@ -16354,7 +16502,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 199); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -16370,7 +16518,12 @@ var ts; } } } - ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { + if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(heritageElement); + }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { checkTypeForDuplicateIndexSignatures(node); @@ -16535,11 +16688,14 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); + var enumIsConst = ts.isConst(node); + if (compilerOptions.separateCompilation && enumIsConst && ts.isInAmbientContext(node)) { + error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided); + } var enumSymbol = getSymbolOfNode(node); var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { if (enumSymbol.declarations.length > 1) { - var enumIsConst = ts.isConst(node); ts.forEach(enumSymbol.declarations, function (decl) { if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); @@ -16548,7 +16704,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 201) { + if (declaration.kind !== 204) { return false; } var enumDeclaration = declaration; @@ -16569,9 +16725,9 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 198 || (declaration.kind === 197 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 201 || (declaration.kind === 200 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -16591,7 +16747,7 @@ var ts; if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -16614,20 +16770,29 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 126) { - node = node.left; + while (true) { + if (node.kind === 126) { + node = node.left; + } + else if (node.kind === 155) { + node = node.expression; + } + else { + break; + } } + ts.Debug.assert(node.kind === 65); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (ts.getFullWidth(moduleName) !== 0 && moduleName.kind !== 8) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { - error(moduleName, node.kind === 212 ? + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { + error(moduleName, node.kind === 215 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; @@ -16646,7 +16811,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 214 ? + var message = node.kind === 217 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -16669,7 +16834,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { checkImportBinding(importClause.namedBindings); } else { @@ -16714,8 +16879,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); } } @@ -16734,8 +16899,8 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 224 ? node.parent : node.parent.parent; - if (container.kind === 202 && container.name.kind === 65) { + var container = node.parent.kind === 227 ? node.parent : node.parent.parent; + if (container.kind === 205 && container.name.kind === 65) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; } @@ -16762,10 +16927,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 224) { + if (node.kind === 227) { return node.statements; } - if (node.kind === 202 && node.body.kind === 203) { + if (node.kind === 205 && node.body.kind === 206) { return node.body.statements; } return emptyArray; @@ -16817,7 +16982,7 @@ var ts; case 137: return checkAccessorDeclaration(node); case 141: - return checkTypeReference(node); + return checkTypeReferenceNode(node); case 144: return checkTypeQuery(node); case 145: @@ -16830,71 +16995,71 @@ var ts; return checkUnionType(node); case 149: return checkSourceElement(node.type); - case 197: + case 200: return checkFunctionDeclaration(node); - case 176: - case 203: - return checkBlock(node); - case 177: - return checkVariableStatement(node); case 179: - return checkExpressionStatement(node); + case 206: + return checkBlock(node); case 180: - return checkIfStatement(node); - case 181: - return checkDoStatement(node); + return checkVariableStatement(node); case 182: - return checkWhileStatement(node); + return checkExpressionStatement(node); case 183: - return checkForStatement(node); + return checkIfStatement(node); case 184: - return checkForInStatement(node); + return checkDoStatement(node); case 185: - return checkForOfStatement(node); + return checkWhileStatement(node); case 186: + return checkForStatement(node); case 187: - return checkBreakOrContinueStatement(node); + return checkForInStatement(node); case 188: - return checkReturnStatement(node); + return checkForOfStatement(node); case 189: - return checkWithStatement(node); case 190: - return checkSwitchStatement(node); + return checkBreakOrContinueStatement(node); case 191: - return checkLabeledStatement(node); + return checkReturnStatement(node); case 192: - return checkThrowStatement(node); + return checkWithStatement(node); case 193: - return checkTryStatement(node); + return checkSwitchStatement(node); + case 194: + return checkLabeledStatement(node); case 195: + return checkThrowStatement(node); + case 196: + return checkTryStatement(node); + case 198: return checkVariableDeclaration(node); case 152: return checkBindingElement(node); - case 198: - return checkClassDeclaration(node); - case 199: - return checkInterfaceDeclaration(node); - case 200: - return checkTypeAliasDeclaration(node); case 201: - return checkEnumDeclaration(node); + return checkClassDeclaration(node); case 202: - return checkModuleDeclaration(node); - case 206: - return checkImportDeclaration(node); + return checkInterfaceDeclaration(node); + case 203: + return checkTypeAliasDeclaration(node); + case 204: + return checkEnumDeclaration(node); case 205: + return checkModuleDeclaration(node); + case 209: + return checkImportDeclaration(node); + case 208: return checkImportEqualsDeclaration(node); - case 212: - return checkExportDeclaration(node); - case 211: - return checkExportAssignment(node); - case 178: - checkGrammarStatementInAmbientContext(node); - return; - case 194: - checkGrammarStatementInAmbientContext(node); - return; case 215: + return checkExportDeclaration(node); + case 214: + return checkExportAssignment(node); + case 181: + checkGrammarStatementInAmbientContext(node); + return; + case 197: + checkGrammarStatementInAmbientContext(node); + return; + case 218: return checkMissingDeclaration(node); } } @@ -16915,10 +17080,10 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 189: + case 192: checkFunctionExpressionBodies(node.expression); break; case 129: @@ -16929,14 +17094,14 @@ var ts; case 152: case 153: case 154: - case 221: + case 224: case 155: case 156: case 157: case 158: case 159: case 171: - case 175: + case 176: case 160: case 161: case 165: @@ -16947,12 +17112,9 @@ var ts; case 169: case 170: case 173: - case 176: - case 203: - case 177: case 179: + case 206: case 180: - case 181: case 182: case 183: case 184: @@ -16960,21 +17122,24 @@ var ts; case 186: case 187: case 188: + case 189: case 190: - case 204: - case 217: - case 218: case 191: - case 192: case 193: + case 207: case 220: + case 221: + case 194: case 195: case 196: - case 198: - case 201: case 223: - case 211: - case 224: + case 198: + case 199: + case 201: + case 204: + case 226: + case 214: + case 227: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -17029,7 +17194,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 189 && node.parent.statement === node) { + if (node.parent.kind === 192 && node.parent.statement === node) { return true; } node = node.parent; @@ -17051,18 +17216,18 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) { break; } - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17103,17 +17268,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17138,20 +17303,28 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 128: - case 198: - case 199: - case 200: case 201: + case 202: + case 203: + case 204: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126) + while (node.parent && node.parent.kind === 126) { node = node.parent; + } return node.parent && node.parent.kind === 141; } - function isTypeNode(node) { + function isHeritageClauseElementIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 155) { + node = node.parent; + } + return node.parent && node.parent.kind === 177; + } + function isTypeNodeOrHeritageClauseElement(node) { if (141 <= node.kind && node.kind <= 149) { return true; } @@ -17166,12 +17339,18 @@ var ts; return node.parent.kind !== 166; case 8: return node.parent.kind === 129; + case 177: + return true; case 65: if (node.parent.kind === 126 && node.parent.right === node) { node = node.parent; } + else if (node.parent.kind === 155 && node.parent.name === node) { + node = node.parent; + } case 126: - ts.Debug.assert(node.kind === 65 || node.kind === 126, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 155: + ts.Debug.assert(node.kind === 65 || node.kind === 126 || node.kind === 155, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_5 = node.parent; if (parent_5.kind === 144) { return false; @@ -17180,14 +17359,16 @@ var ts; return true; } switch (parent_5.kind) { + case 177: + return true; case 128: return node === parent_5.constraint; case 132: case 131: case 129: - case 195: + case 198: return node === parent_5.type; - case 197: + case 200: case 162: case 163: case 135: @@ -17215,10 +17396,10 @@ var ts; while (nodeOnRightSide.parent.kind === 126) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 205) { + if (nodeOnRightSide.parent.kind === 208) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 211) { + if (nodeOnRightSide.parent.kind === 214) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -17226,15 +17407,11 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } - function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 && node.parent.right === node) || - (node.parent.kind === 155 && node.parent.name === node); - } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 211) { + if (entityName.parent.kind === 214) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 155) { @@ -17242,11 +17419,16 @@ var ts; return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } } - if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (ts.isExpression(entityName)) { - if (ts.getFullWidth(entityName) === 0) { + if (isHeritageClauseElementIdentifier(entityName)) { + var meaning = entityName.parent.kind === 177 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, meaning); + } + else if (ts.isExpression(entityName)) { + if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 65) { @@ -17283,7 +17465,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 211 + return node.parent.kind === 214 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } @@ -17306,7 +17488,7 @@ var ts; var moduleName; if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 206 || node.parent.kind === 212) && + ((node.parent.kind === 209 || node.parent.kind === 215) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -17325,7 +17507,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 222) { + if (location && location.kind === 225) { return resolveEntityName(location.name, 107455); } return undefined; @@ -17334,12 +17516,12 @@ var ts; if (isInsideWithStatementBody(node)) { return unknownType; } + if (isTypeNodeOrHeritageClauseElement(node)) { + return getTypeFromTypeNodeOrHeritageClauseElement(node); + } if (ts.isExpression(node)) { return getTypeOfExpression(node); } - if (isTypeNode(node)) { - return getTypeFromTypeNode(node); - } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -17364,7 +17546,7 @@ var ts; return unknownType; } function getTypeOfExpression(expr) { - if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } return checkExpression(expr); @@ -17399,7 +17581,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 224; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { if (languageVersion >= 2) { @@ -17407,10 +17589,10 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 207) { + if (node.kind === 210) { return getGeneratedNameForNode(node.parent) + ".default"; } - if (node.kind === 210) { + if (node.kind === 213) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -17427,7 +17609,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 202 || node.kind === 201) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 205 || node.kind === 204) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -17450,29 +17632,33 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 205: - case 207: case 208: case 210: - case 214: + case 211: + case 213: + case 217: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 212: + case 215: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 211: + case 214: return node.expression && node.expression.kind === 65 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 224 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 227 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } - return isAliasResolvedToValue(getSymbolOfNode(node)); + var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); + return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - return target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + if (target === unknownSymbol && compilerOptions.separateCompilation) { + return true; + } + return target !== unknownSymbol && target && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -17506,7 +17692,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 223) { + if (node.kind === 226) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -17541,13 +17727,13 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 195 && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 198 && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 220; + symbol.valueDeclaration.parent.kind !== 223; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -17653,17 +17839,17 @@ var ts; case 134: case 133: case 140: - case 198: - case 199: - case 202: case 201: - case 177: - case 197: - case 200: - case 206: + case 202: case 205: - case 212: - case 211: + case 204: + case 180: + case 200: + case 203: + case 209: + case 208: + case 215: + case 214: case 129: break; default: @@ -17674,7 +17860,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 109: @@ -17698,7 +17884,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -17707,7 +17893,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 129) { @@ -17723,7 +17909,7 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 129) { @@ -17735,13 +17921,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 129) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 203) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -17760,10 +17946,10 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 206 || node.kind === 205) && flags & 2) { + else if ((node.kind === 209 || node.kind === 208) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 199 && flags & 2) { + else if (node.kind === 202 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } else if (node.kind === 129 && (flags & 112) && ts.isBindingPattern(node.name)) { @@ -17891,9 +18077,9 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _n = arguments.length; _i < _n; _i++) { + for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 174) { + if (arg.kind === 175) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -17918,7 +18104,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -17946,7 +18132,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -17992,16 +18178,16 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_11 = prop.name; - if (prop.kind === 174 || + if (prop.kind === 175 || name_11.kind === 127) { checkGrammarComputedPropertyName(name_11); continue; } var currentKind = void 0; - if (prop.kind === 221 || prop.kind === 222) { + if (prop.kind === 224 || prop.kind === 225) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_11.kind === 7) { checkGrammarNumbericLiteral(name_11); @@ -18048,24 +18234,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 196) { + if (forInOrOfStatement.initializer.kind === 199) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -18134,7 +18320,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -18145,7 +18331,7 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === 145) { @@ -18154,13 +18340,13 @@ var ts; } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return true; - case 191: + case 194: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -18172,9 +18358,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 191: + case 194: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 186 + var isMisplacedContinueLabel = node.kind === 189 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -18182,8 +18368,8 @@ var ts; return false; } break; - case 190: - if (node.kind === 187 && !node.label) { + case 193: + if (node.kind === 190 && !node.label) { return false; } break; @@ -18196,13 +18382,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 187 + var message = node.kind === 190 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 187 + var message = node.kind === 190 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -18221,11 +18407,8 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 184 && node.parent.parent.kind !== 185) { + if (node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { if (ts.isInAmbientContext(node)) { - if (ts.isBindingPattern(node.name)) { - return grammarErrorOnNode(node, ts.Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); - } if (node.initializer) { var equalsTokenLength = "=".length; return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); @@ -18252,7 +18435,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _n = elements.length; _i < _n; _i++) { + for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -18269,15 +18452,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 180: - case 181: - case 182: - case 189: case 183: case 184: case 185: + case 192: + case 186: + case 187: + case 188: return false; - case 191: + case 194: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -18310,7 +18493,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; if (node.name.kind === 127) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -18374,13 +18557,13 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -18395,11 +18578,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 199 || - node.kind === 206 || - node.kind === 205 || - node.kind === 212 || - node.kind === 211 || + if (node.kind === 202 || + node.kind === 209 || + node.kind === 208 || + node.kind === 215 || + node.kind === 214 || (node.flags & 2) || (node.flags & (1 | 256))) { return false; @@ -18407,9 +18590,9 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 177) { + if (ts.isDeclaration(decl) || decl.kind === 180) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -18428,7 +18611,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 176 || node.parent.kind === 203 || node.parent.kind === 224) { + if (node.parent.kind === 179 || node.parent.kind === 206 || node.parent.kind === 227) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -18509,7 +18692,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 206); + ts.Debug.assert(aliasEmitInfo.node.kind === 209); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -18582,10 +18765,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 195) { + if (declaration.kind === 198) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 209 || declaration.kind === 210 || declaration.kind === 207) { + else if (declaration.kind === 212 || declaration.kind === 213 || declaration.kind === 210) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -18596,7 +18779,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 206) { + if (moduleElementEmitInfo.node.kind === 209) { moduleElementEmitInfo.isVisible = true; } else { @@ -18604,12 +18787,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -18662,14 +18845,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { @@ -18704,6 +18887,8 @@ var ts; case 99: case 8: return writeTextOfNode(currentSourceFile, type); + case 177: + return emitHeritageClauseElement(type); case 141: return emitTypeReference(type); case 144: @@ -18725,11 +18910,9 @@ var ts; return emitEntityName(type); case 126: return emitEntityName(type); - default: - ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 205 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 208 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -18737,10 +18920,22 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var qualifiedName = entityName; - writeEntityName(qualifiedName.left); + var left = entityName.kind === 126 ? entityName.left : entityName.expression; + var right = entityName.kind === 126 ? entityName.right : entityName.name; + writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, qualifiedName.right); + writeTextOfNode(currentSourceFile, right); + } + } + } + function emitHeritageClauseElement(node) { + if (ts.isSupportedHeritageClauseElement(node)) { + ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 155); + emitEntityName(node.expression); + if (node.typeArguments) { + write("<"); + emitCommaList(node.typeArguments, emitType); + write(">"); } } } @@ -18824,10 +19019,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 205 || - (node.parent.kind === 224 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 208 || + (node.parent.kind === 227 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 224) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -18836,7 +19031,7 @@ var ts; }); } else { - if (node.kind === 206) { + if (node.kind === 209) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -18854,23 +19049,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 197: - return writeFunctionDeclaration(node); - case 177: - return writeVariableStatement(node); - case 199: - return writeInterfaceDeclaration(node); - case 198: - return writeClassDeclaration(node); case 200: - return writeTypeAliasDeclaration(node); - case 201: - return writeEnumDeclaration(node); + return writeFunctionDeclaration(node); + case 180: + return writeVariableStatement(node); case 202: - return writeModuleDeclaration(node); + return writeInterfaceDeclaration(node); + case 201: + return writeClassDeclaration(node); + case 203: + return writeTypeAliasDeclaration(node); + case 204: + return writeEnumDeclaration(node); case 205: + return writeModuleDeclaration(node); + case 208: return writeImportEqualsDeclaration(node); - case 206: + case 209: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -18884,7 +19079,7 @@ var ts; if (node.flags & 256) { write("default "); } - else if (node.kind !== 199) { + else if (node.kind !== 202) { write("declare "); } } @@ -18928,7 +19123,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 208) { + if (namedBindings.kind === 211) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -18954,7 +19149,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -19005,7 +19200,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 203) { + while (node.body.kind !== 206) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -19094,10 +19289,10 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 198: + case 201: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 199: + case 202: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 139: @@ -19111,14 +19306,14 @@ var ts; if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { + else if (node.parent.parent.kind === 201) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 197: + case 200: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -19143,10 +19338,12 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + if (ts.isSupportedHeritageClauseElement(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; @@ -19179,11 +19376,11 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { emitHeritageClause([baseTypeNode], false); } - emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); write(" {"); writeLine(); increaseIndent(); @@ -19223,7 +19420,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 195 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 198 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -19241,7 +19438,7 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 195) { + if (node.kind === 198) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19256,7 +19453,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19279,7 +19476,14 @@ var ts; } : undefined; } function emitBindingPattern(bindingPattern) { - emitCommaList(bindingPattern.elements, emitBindingElement); + var elements = []; + for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 175) { + elements.push(element); + } + } + emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { @@ -19409,13 +19613,13 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 197) { + if (node.kind === 200) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 134) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 197) { + if (node.kind === 200) { write("function "); writeTextOfNode(currentSourceFile, node.name); } @@ -19497,7 +19701,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19510,7 +19714,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 197: + case 200: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19533,7 +19737,7 @@ var ts; write("..."); } if (ts.isBindingPattern(node.name)) { - write("_" + ts.indexOf(node.parent.parameters, node)); + emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); @@ -19551,79 +19755,124 @@ var ts; writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage; + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { case 135: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - break; case 139: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 134: case 133: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + else if (node.parent.parent.kind === 201) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - break; - case 197: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 200: + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); } - return { - diagnosticMessage: diagnosticMessage, - errorNode: node, - typeName: node.name - }; + } + function emitBindingPattern(bindingPattern) { + if (bindingPattern.kind === 150) { + write("{"); + emitCommaList(bindingPattern.elements, emitBindingElement); + write("}"); + } + else if (bindingPattern.kind === 151) { + write("["); + var elements = bindingPattern.elements; + emitCommaList(elements, emitBindingElement); + if (elements && elements.hasTrailingComma) { + write(", "); + } + write("]"); + } + } + function emitBindingElement(bindingElement) { + function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: bindingElement, + typeName: bindingElement.name + } : undefined; + } + if (bindingElement.kind === 175) { + write(" "); + } + else if (bindingElement.kind === 152) { + if (bindingElement.propertyName) { + writeTextOfNode(currentSourceFile, bindingElement.propertyName); + write(": "); + emitBindingPattern(bindingElement.name); + } + else if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + emitBindingPattern(bindingElement.name); + } + else { + ts.Debug.assert(bindingElement.name.kind === 65); + if (bindingElement.dotDotDotToken) { + write("..."); + } + writeTextOfNode(currentSourceFile, bindingElement.name); + } + } + } } } function emitNode(node) { switch (node.kind) { - case 197: - case 202: - case 205: - case 199: - case 198: case 200: + case 205: + case 208: + case 202: case 201: + case 203: + case 204: return emitModuleElement(node, isModuleElementVisible(node)); - case 177: + case 180: return emitModuleElement(node, isVariableStatementVisible(node)); - case 206: + case 209: return emitModuleElement(node, !node.importClause); - case 212: + case 215: return emitExportDeclaration(node); case 135: case 134: @@ -19639,11 +19888,11 @@ var ts; case 132: case 131: return emitPropertyDeclaration(node); - case 223: + case 226: return emitEnumMemberDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFile(node); } } @@ -19745,7 +19994,6 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; - var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var generatedNameSet = {}; var nodeToGeneratedName = []; @@ -19864,24 +20112,24 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 197: - case 198: + case 200: + case 201: generateNameForFunctionOrClassDeclaration(node); break; - case 202: + case 205: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 201: + case 204: generateNameForModuleOrEnum(node); break; - case 206: + case 209: generateNameForImportDeclaration(node); break; - case 212: + case 215: generateNameForExportDeclaration(node); break; - case 211: + case 214: generateNameForExportAssignment(node); break; } @@ -20035,15 +20283,15 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 197 || + else if (node.kind === 200 || node.kind === 162 || node.kind === 134 || node.kind === 133 || node.kind === 136 || node.kind === 137 || - node.kind === 202 || - node.kind === 198 || - node.kind === 201) { + node.kind === 205 || + node.kind === 201 || + node.kind === 204) { if (node.name) { var name_15 = node.name; scopeName = name_15.kind === 127 @@ -20131,7 +20379,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 224) { + if (node.kind != 227) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -20216,7 +20464,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -20226,7 +20474,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -20240,7 +20488,7 @@ var ts; write(","); } decreaseIndent(); - if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -20505,35 +20753,35 @@ var ts; var parent = node.parent; switch (parent.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: - case 197: + case 200: case 136: case 137: case 162: - case 198: - case 199: case 201: case 202: + case 204: case 205: - case 207: case 208: - return parent.name === node; case 210: - case 214: - return parent.name === node || parent.propertyName === node; - case 187: - case 186: case 211: + return parent.name === node; + case 213: + case 217: + return parent.name === node || parent.propertyName === node; + case 190: + case 189: + case 214: return false; - case 191: + case 194: return node.parent.label === node; } } @@ -20727,9 +20975,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 221: + case 224: return property.initializer; - case 222: + case 225: return createIdentifier(resolver.getExpressionNameSubstitution(property.name, getGeneratedNameForNode)); case 134: return createFunctionExpression(property.parameters, property.body); @@ -20784,7 +21032,7 @@ var ts; return result; } function createExpressionStatement(expression) { - var result = ts.createSynthesizedNode(179); + var result = ts.createSynthesizedNode(182); result.expression = expression; return result; } @@ -20803,7 +21051,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(221); + var result = ts.createSynthesizedNode(224); result.name = name; result.initializer = initializer; return result; @@ -20896,6 +21144,9 @@ var ts; } } function tryEmitConstantValue(node) { + if (compilerOptions.separateCompilation) { + return false; + } var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { write(constantValue.toString()); @@ -20908,7 +21159,7 @@ var ts; return false; } function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); @@ -21113,7 +21364,7 @@ var ts; function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 53 && (node.left.kind === 154 || node.left.kind === 153)) { - emitDestructuring(node, node.parent.kind === 179); + emitDestructuring(node, node.parent.kind === 182); } else { emit(node.left); @@ -21149,13 +21400,13 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 176) { + if (node && node.kind === 179) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { - if (preserveNewLines && isSingleLineEmptyBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -21164,12 +21415,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 203) { - ts.Debug.assert(node.parent.kind === 202); + if (node.kind === 206) { + ts.Debug.assert(node.parent.kind === 205); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 203) { + if (node.kind === 206) { emitTempDeclarations(true); } decreaseIndent(); @@ -21178,7 +21429,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 176) { + if (node.kind === 179) { write(" "); emit(node); } @@ -21203,7 +21454,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76, node.thenStatement.end); - if (node.elseStatement.kind === 180) { + if (node.elseStatement.kind === 183) { write(" "); emit(node.elseStatement); } @@ -21215,7 +21466,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { write(" "); } else { @@ -21259,7 +21510,7 @@ var ts; var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 196) { + if (node.initializer && node.initializer.kind === 199) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; emitStartOfVariableDeclarationList(declarations[0], endPos); @@ -21277,13 +21528,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 185) { + if (languageVersion < 2 && node.kind === 188) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; @@ -21295,7 +21546,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 184) { + if (node.kind === 187) { write(" in "); } else { @@ -21332,7 +21583,6 @@ var ts; var rhsIsIdentifier = node.expression.kind === 65; var counter = createTempVariable(268435456); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(536870912) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -21346,24 +21596,12 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } - if (cachedLength) { - write(", "); - emitNodeWithoutSourceMap(cachedLength); - write(" = "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - if (cachedLength) { - emitNodeWithoutSourceMap(cachedLength); - } - else { - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } + emitNodeWithoutSourceMap(rhsReference); + write(".length"); emitEnd(node.initializer); write("; "); emitStart(node.initializer); @@ -21376,7 +21614,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -21407,7 +21645,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { emitLines(node.statement.statements); } else { @@ -21419,7 +21657,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 187 ? 66 : 71, node.pos); + emitToken(node.kind === 190 ? 66 : 71, node.pos); emitOptional(" ", node.label); write(";"); } @@ -21464,7 +21702,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 217) { + if (node.kind === 220) { write("case "); emit(node.expression); write(":"); @@ -21472,7 +21710,7 @@ var ts; else { write("default:"); } - if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -21519,7 +21757,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 202); + } while (node && node.kind !== 205); return node; } function emitContainingModuleName(node) { @@ -21552,11 +21790,11 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (node.name) { - emitModuleMemberName(node); + if (node.flags & 256) { + write("exports.default"); } else { - write("exports.default"); + emitModuleMemberName(node); } write(" = "); emitDeclarationName(node); @@ -21566,7 +21804,7 @@ var ts; } function emitExportMemberAssignments(name) { if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _a = 0, _b = exportSpecifiers[name.text], _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); emitStart(specifier.name); @@ -21582,7 +21820,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var isDeclaration = (root.kind === 195 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; + var isDeclaration = (root.kind === 198 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; if (root.kind === 169) { emitAssignmentExpression(root); } @@ -21595,7 +21833,7 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 195 || name.parent.kind === 152)) { + if (name.parent && (name.parent.kind === 198 || name.parent.kind === 152)) { emitModuleMemberName(name.parent); } else { @@ -21662,9 +21900,9 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _a = 0, _b = properties.length; _a < _b; _a++) { + for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -21677,7 +21915,7 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } @@ -21744,7 +21982,7 @@ var ts; var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 174) { + else if (element.kind !== 175) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -21781,8 +22019,8 @@ var ts; var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); if (isUninitializedLet && - node.parent.parent.kind !== 184 && - node.parent.parent.kind !== 185) { + node.parent.parent.kind !== 187 && + node.parent.parent.kind !== 188) { initializer = createVoidZero(); } } @@ -21790,7 +22028,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 174) { + if (node.kind === 175) { return; } var name = node.name; @@ -21802,7 +22040,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 195 && node.parent.kind !== 152)) { + if (!node.parent || (node.parent.kind !== 198 && node.parent.kind !== 152)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -21811,24 +22049,24 @@ var ts; if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 65 || - (node.parent.kind !== 195 && node.parent.kind !== 152)) { + (node.parent.kind !== 198 && node.parent.kind !== 152)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); if (((combinedFlags & 12288) === 0) || combinedFlags & 1) { return; } - var list = ts.getAncestor(node, 196); - if (list.parent.kind === 177) { - var isSourceFileLevelBinding = list.parent.parent.kind === 224; - var isModuleLevelBinding = list.parent.parent.kind === 203; - var isFunctionLevelBinding = list.parent.parent.kind === 176 && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 199); + if (list.parent.kind === 180) { + var isSourceFileLevelBinding = list.parent.parent.kind === 227; + var isModuleLevelBinding = list.parent.parent.kind === 206; + var isFunctionLevelBinding = list.parent.parent.kind === 179 && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 224 + var parent = blockScopeContainer.kind === 227 ? blockScopeContainer : blockScopeContainer.parent; if (resolver.resolvesToSomeValue(parent, node.text)) { @@ -21843,7 +22081,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && languageVersion >= 2 && - node.parent.kind === 224; + node.parent.kind === 227; } function emitVariableStatement(node) { if (!(node.flags & 1)) { @@ -21968,8 +22206,8 @@ var ts; if (node.kind === 162) { return !!node.name; } - else if (node.kind === 197) { - return !!node.name || (languageVersion >= 2 && !(node.flags & 256)); + if (node.kind === 200) { + return !!node.name || languageVersion < 2; } } function emitFunctionDeclaration(node) { @@ -21992,7 +22230,7 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 197 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 200 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } if (node.kind !== 134 && node.kind !== 133) { @@ -22042,7 +22280,7 @@ var ts; if (!node.body) { write(" { }"); } - else if (node.body.kind === 176) { + else if (node.body.kind === 179) { emitBlockFunctionBody(node, node.body); } else { @@ -22081,7 +22319,7 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); @@ -22118,8 +22356,8 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements, _c = _b.length; _a < _c; _a++) { + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { var statement = _b[_a]; write(" "); emit(statement); @@ -22142,7 +22380,7 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 179) { + if (statement && statement.kind === 182) { var expr = statement.expression; if (expr && expr.kind === 157) { var func = expr.expression; @@ -22208,7 +22446,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 134 || node.kind === 133) { + if (member.kind === 178) { + writeLine(); + write(";"); + } + else if (member.kind === 134 || node.kind === 133) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -22275,12 +22517,14 @@ var ts; }); } function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; if ((member.kind === 134 || node.kind === 133) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 || node.kind === 133 || member.kind === 136 || member.kind === 137) { + else if (member.kind === 134 || + member.kind === 136 || + member.kind === 137) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -22298,9 +22542,13 @@ var ts; emitEnd(member); emitTrailingComments(member); } + else if (member.kind === 178) { + writeLine(); + write(";"); + } } } - function emitConstructor(node, baseTypeNode) { + function emitConstructor(node, baseTypeElement) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; @@ -22335,7 +22583,7 @@ var ts; emitSignatureParameters(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { write("(...args)"); } else { @@ -22353,7 +22601,7 @@ var ts; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); - if (baseTypeNode) { + if (baseTypeElement) { var superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); @@ -22363,16 +22611,16 @@ var ts; emitParameterPropertyAssignments(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { writeLine(); - emitStart(baseTypeNode); + emitStart(baseTypeElement); if (languageVersion < 2) { write("_super.apply(this, arguments);"); } else { write("super(...args);"); } - emitEnd(baseTypeNode); + emitEnd(baseTypeElement); } } emitMemberAssignments(node, 0); @@ -22399,28 +22647,36 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { if (languageVersion < 2) { - emitClassDeclarationBelowES6(node); + emitClassLikeDeclarationBelowES6(node); } else { - emitClassDeclarationForES6AndHigher(node); + emitClassLikeDeclarationForES6AndHigher(node); } } - function emitClassDeclarationForES6AndHigher(node) { + function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { - write("export "); + if (node.kind === 201) { + if (thisNodeIsDecorated) { + if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 256) { - write("default "); + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 256) { + write("default "); + } } } write("class"); @@ -22428,10 +22684,10 @@ var ts; write(" "); emitDeclarationName(node); } - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write(" extends "); - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); } write(" {"); increaseIndent(); @@ -22474,11 +22730,14 @@ var ts; write(";"); } } - function emitClassDeclarationBelowES6(node) { - write("var "); - emitDeclarationName(node); - write(" = (function ("); - var baseTypeNode = ts.getClassBaseTypeNode(node); + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 201) { + write("var "); + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write("_super"); } @@ -22525,11 +22784,16 @@ var ts; emitStart(node); write(")("); if (baseTypeNode) { - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 201) { + write(";"); } - write(");"); emitEnd(node); - emitExportMemberAssignment(node); + if (node.kind === 201) { + emitExportMemberAssignment(node); + } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } @@ -22673,7 +22937,7 @@ var ts; } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums; + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.separateCompilation; } function emitEnumDeclaration(node) { if (!shouldEmitEnumDeclaration(node)) { @@ -22752,13 +23016,13 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 202) { + if (moduleDeclaration.body.kind === 205) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } } function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation); } function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); @@ -22780,7 +23044,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 203) { + if (node.body.kind === 206) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -22829,16 +23093,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 208) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 206 && node.importClause && !!node.importClause.name; + return node.kind === 209 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -22865,7 +23129,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -22891,7 +23155,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 205 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 208 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -22903,7 +23167,7 @@ var ts; write(" = "); } else { - var isNakedImport = 206 && !node.importClause; + var isNakedImport = 209 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -22978,7 +23242,7 @@ var ts; emitRequire(ts.getExternalModuleName(node)); write(";"); } - for (var _a = 0, _b = node.exportClause.elements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { var specifier = _b[_a]; if (resolver.isValueAliasDeclaration(specifier)) { writeLine(); @@ -23033,7 +23297,7 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(languageVersion >= 2); var needsComma = false; - for (var _a = 0, _b = specifiers.length; _a < _b; _a++) { + for (var _a = 0; _a < specifiers.length; _a++) { var specifier = specifiers[_a]; if (shouldEmit(specifier)) { if (needsComma) { @@ -23058,8 +23322,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 197 && - expression.kind !== 198) { + if (expression.kind !== 200 && + expression.kind !== 201) { write(";"); } emitEnd(node); @@ -23080,21 +23344,21 @@ var ts; exportSpecifiers = {}; exportEquals = undefined; hasExportStars = false; - for (var _a = 0, _b = sourceFile.statements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 206: + case 209: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 205: - if (node.moduleReference.kind === 216 && resolver.isReferencedAliasDeclaration(node)) { + case 208: + if (node.moduleReference.kind === 219 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 212: + case 215: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -23105,14 +23369,14 @@ var ts; } } else { - for (var _d = 0, _e = node.exportClause.elements, _f = _e.length; _d < _f; _d++) { - var specifier = _e[_d]; + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; var name_17 = (specifier.propertyName || specifier.name).text; (exportSpecifiers[name_17] || (exportSpecifiers[name_17] = [])).push(specifier); } } break; - case 211: + case 214: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -23154,7 +23418,7 @@ var ts; write("\"" + node.amdModuleName + "\", "); } write("[\"require\", \"exports\""); - for (var _a = 0, _b = externalImports.length; _a < _b; _a++) { + for (var _a = 0; _a < externalImports.length; _a++) { var importNode = externalImports[_a]; write(", "); var moduleName = ts.getExternalModuleName(importNode); @@ -23165,15 +23429,15 @@ var ts; write("\"\""); } } - for (var _c = 0, _d = node.amdDependencies, _e = _d.length; _c < _e; _c++) { - var amdDependency = _d[_c]; + for (var _b = 0, _c = node.amdDependencies; _b < _c.length; _b++) { + var amdDependency = _c[_b]; var text = "\"" + amdDependency.path + "\""; write(", "); write(text); } write("], function (require, exports"); - for (var _f = 0, _g = externalImports.length; _f < _g; _f++) { - var importNode = externalImports[_f]; + for (var _d = 0; _d < externalImports.length; _d++) { + var importNode = externalImports[_d]; write(", "); var namespaceDeclaration = getNamespaceDeclarationNode(importNode); if (namespaceDeclaration && !isDefaultImport(importNode)) { @@ -23183,8 +23447,8 @@ var ts; write(getGeneratedNameForNode(importNode)); } } - for (var _h = 0, _j = node.amdDependencies, _k = _j.length; _h < _k; _h++) { - var amdDependency = _j[_h]; + for (var _e = 0, _f = node.amdDependencies; _e < _f.length; _e++) { + var amdDependency = _f[_e]; if (amdDependency.name) { write(", "); write(amdDependency.name); @@ -23317,19 +23581,19 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 199: - case 197: - case 206: - case 205: - case 200: - case 211: - return false; case 202: + case 200: + case 209: + case 208: + case 203: + case 214: + return false; + case 205: return shouldEmitModuleDeclaration(node); - case 201: + case 204: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 176 && + if (node.kind !== 179 && node.parent && node.parent.kind === 163 && node.parent.body === node && @@ -23371,7 +23635,7 @@ var ts; return emitLiteral(node); case 171: return emitTemplateExpression(node); - case 175: + case 176: return emitTemplateSpan(node); case 126: return emitQualifiedName(node); @@ -23385,9 +23649,9 @@ var ts; return emitArrayLiteral(node); case 154: return emitObjectLiteral(node); - case 221: + case 224: return emitPropertyAssignment(node); - case 222: + case 225: return emitShorthandPropertyAssignment(node); case 127: return emitComputedPropertyName(node); @@ -23405,7 +23669,7 @@ var ts; return emit(node.expression); case 161: return emitParenExpression(node); - case 197: + case 200: case 162: case 163: return emitFunctionDeclaration(node); @@ -23425,71 +23689,73 @@ var ts; return emitConditionalExpression(node); case 173: return emitSpreadElementExpression(node); - case 174: + case 175: return; - case 176: - case 203: - return emitBlock(node); - case 177: - return emitVariableStatement(node); - case 178: - return write(";"); case 179: - return emitExpressionStatement(node); - case 180: - return emitIfStatement(node); - case 181: - return emitDoStatement(node); - case 182: - return emitWhileStatement(node); - case 183: - return emitForStatement(node); - case 185: - case 184: - return emitForInOrForOfStatement(node); - case 186: - case 187: - return emitBreakOrContinueStatement(node); - case 188: - return emitReturnStatement(node); - case 189: - return emitWithStatement(node); - case 190: - return emitSwitchStatement(node); - case 217: - case 218: - return emitCaseOrDefaultClause(node); - case 191: - return emitLabelledStatement(node); - case 192: - return emitThrowStatement(node); - case 193: - return emitTryStatement(node); - case 220: - return emitCatchClause(node); - case 194: - return emitDebuggerStatement(node); - case 195: - return emitVariableDeclaration(node); - case 198: - return emitClassDeclaration(node); - case 199: - return emitInterfaceDeclaration(node); - case 201: - return emitEnumDeclaration(node); - case 223: - return emitEnumMember(node); - case 202: - return emitModuleDeclaration(node); case 206: - return emitImportDeclaration(node); + return emitBlock(node); + case 180: + return emitVariableStatement(node); + case 181: + return write(";"); + case 182: + return emitExpressionStatement(node); + case 183: + return emitIfStatement(node); + case 184: + return emitDoStatement(node); + case 185: + return emitWhileStatement(node); + case 186: + return emitForStatement(node); + case 188: + case 187: + return emitForInOrForOfStatement(node); + case 189: + case 190: + return emitBreakOrContinueStatement(node); + case 191: + return emitReturnStatement(node); + case 192: + return emitWithStatement(node); + case 193: + return emitSwitchStatement(node); + case 220: + case 221: + return emitCaseOrDefaultClause(node); + case 194: + return emitLabelledStatement(node); + case 195: + return emitThrowStatement(node); + case 196: + return emitTryStatement(node); + case 223: + return emitCatchClause(node); + case 197: + return emitDebuggerStatement(node); + case 198: + return emitVariableDeclaration(node); + case 174: + return emitClassExpression(node); + case 201: + return emitClassDeclaration(node); + case 202: + return emitInterfaceDeclaration(node); + case 204: + return emitEnumDeclaration(node); + case 226: + return emitEnumMember(node); case 205: + return emitModuleDeclaration(node); + case 209: + return emitImportDeclaration(node); + case 208: return emitImportEqualsDeclaration(node); - case 212: + case 215: return emitExportDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFileNode(node); } } @@ -23517,7 +23783,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.pos !== node.parent.pos) { + if (node.parent.kind === 227 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -23529,7 +23795,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.end !== node.parent.end) { + if (node.parent.kind === 227 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -23623,7 +23889,7 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0.0"; + ts.version = "1.5.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -23946,7 +24212,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 206 || node.kind === 205 || node.kind === 212) { + if (node.kind === 209 || node.kind === 208 || node.kind === 215) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -23966,7 +24232,7 @@ var ts; } } } - else if (node.kind === 202 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 205 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { @@ -23988,6 +24254,20 @@ var ts; } } function verifyCompilerOptions() { + if (options.separateCompilation) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation)); + } + if (options.declaration) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation)); + } + if (options.noEmitOnError) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation)); + } + if (options.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); + } + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); @@ -23999,11 +24279,19 @@ var ts; } var languageVersion = options.target || 0; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); - if (firstExternalModuleSourceFile && !options.module) { + if (options.separateCompilation) { if (!options.module && languageVersion < 2) { - var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } + var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); + if (firstNonExternalModuleSourceFile) { + var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + } + } + else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { + var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher)); @@ -24096,10 +24384,10 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } - if (node.parent.kind === 183) { + if (node.parent.kind === 186) { return textSpan(node); } if (node.parent.kind === 169 && node.parent.operatorToken.kind === 23) { @@ -24110,15 +24398,15 @@ var ts; } } switch (node.kind) { - case 177: + case 180: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 195: + case 198: case 132: case 131: return spanInVariableDeclaration(node); case 129: return spanInParameterDeclaration(node); - case 197: + case 200: case 134: case 133: case 136: @@ -24127,70 +24415,70 @@ var ts; case 162: case 163: return spanInFunctionDeclaration(node); - case 176: + case 179: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 203: + case 206: return spanInBlock(node); - case 220: + case 223: return spanInBlock(node.block); - case 179: - return textSpan(node.expression); - case 188: - return textSpan(node.getChildAt(0), node.expression); case 182: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 181: - return spanInNode(node.statement); - case 194: - return textSpan(node.getChildAt(0)); - case 180: - return textSpan(node, ts.findNextToken(node.expression, node)); + return textSpan(node.expression); case 191: - return spanInNode(node.statement); - case 187: - case 186: - return textSpan(node.getChildAt(0), node.label); - case 183: - return spanInForStatement(node); - case 184: + return textSpan(node.getChildAt(0), node.expression); case 185: return textSpan(node, ts.findNextToken(node.expression, node)); + case 184: + return spanInNode(node.statement); + case 197: + return textSpan(node.getChildAt(0)); + case 183: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 194: + return spanInNode(node.statement); case 190: + case 189: + return textSpan(node.getChildAt(0), node.label); + case 186: + return spanInForStatement(node); + case 187: + case 188: return textSpan(node, ts.findNextToken(node.expression, node)); - case 217: - case 218: - return spanInNode(node.statements[0]); case 193: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 220: + case 221: + return spanInNode(node.statements[0]); + case 196: return spanInBlock(node.tryBlock); - case 192: + case 195: return textSpan(node, node.expression); - case 211: + case 214: if (!node.expression) { return undefined; } return textSpan(node, node.expression); - case 205: + case 208: return textSpan(node, node.moduleReference); - case 206: + case 209: return textSpan(node, node.moduleSpecifier); - case 212: + case 215: return textSpan(node, node.moduleSpecifier); - case 202: + case 205: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 198: case 201: - case 223: + case 204: + case 226: case 157: case 158: return textSpan(node); - case 189: + case 192: return spanInNode(node.statement); - case 199: - case 200: + case 202: + case 203: return undefined; case 22: case 1: @@ -24217,7 +24505,7 @@ var ts; case 81: return spanInNextNode(node); default: - if (node.parent.kind === 221 && node.parent.name === node) { + if (node.parent.kind === 224 && node.parent.name === node) { return spanInNode(node.parent.initializer); } if (node.parent.kind === 160 && node.parent.type === node) { @@ -24230,12 +24518,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 184 || - variableDeclaration.parent.parent.kind === 185) { + if (variableDeclaration.parent.parent.kind === 187 || + variableDeclaration.parent.parent.kind === 188) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 177; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 183 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 180; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 186 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -24281,7 +24569,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 198 && functionDeclaration.kind !== 135); + (functionDeclaration.parent.kind === 201 && functionDeclaration.kind !== 135); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -24301,23 +24589,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 202: + case 205: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 182: - case 180: - case 184: case 185: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 183: + case 187: + case 188: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 186: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 196) { + if (forStatement.initializer.kind === 199) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -24336,34 +24624,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 201: + case 204: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 198: + case 201: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 204: + case 207: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 203: + case 206: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } + case 204: case 201: - case 198: return textSpan(node); - case 176: + case 179: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 220: + case 223: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 204: + case 207: var caseBlock = node.parent; var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { @@ -24375,7 +24663,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -24383,16 +24671,16 @@ var ts; function spanInCloseParenToken(node) { switch (node.parent.kind) { case 162: - case 197: + case 200: case 163: case 134: case 133: case 136: case 137: case 135: - case 182: - case 181: - case 183: + case 185: + case 184: + case 186: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -24400,7 +24688,7 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 221) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 224) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -24412,7 +24700,7 @@ var ts; return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); @@ -24464,23 +24752,23 @@ var ts; return; } switch (n.kind) { - case 176: + case 179: if (!ts.isFunctionBlock(n)) { var parent_6 = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent_6.kind === 181 || - parent_6.kind === 184 || - parent_6.kind === 185 || + if (parent_6.kind === 184 || + parent_6.kind === 187 || + parent_6.kind === 188 || + parent_6.kind === 186 || parent_6.kind === 183 || - parent_6.kind === 180 || - parent_6.kind === 182 || - parent_6.kind === 189 || - parent_6.kind === 220) { + parent_6.kind === 185 || + parent_6.kind === 192 || + parent_6.kind === 223) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_6.kind === 193) { + if (parent_6.kind === 196) { var tryStatement = parent_6; if (tryStatement.tryBlock === n) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); @@ -24503,17 +24791,17 @@ var ts; }); break; } - case 203: { + case 206: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 198: - case 199: case 201: + case 202: + case 204: case 154: - case 204: { + case 207: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -24545,7 +24833,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -24577,7 +24865,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -24658,7 +24946,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < bestMatchKind) { @@ -24705,14 +24993,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 202: + case 205: do { current = current.parent; - } while (current.kind === 202); - case 198: + } while (current.kind === 205); case 201: - case 199: - case 197: + case 204: + case 202: + case 200: indent++; } current = current.parent; @@ -24723,26 +25011,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 177: + case 180: ts.forEach(node.declarationList.declarations, visit); break; case 150: case 151: ts.forEach(node.elements, visit); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { childNodes.push(importClause.namedBindings); } else { @@ -24752,19 +25040,19 @@ var ts; } break; case 152: - case 195: + case 198: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 198: case 201: - case 199: + case 204: case 202: - case 197: case 205: - case 210: - case 214: + case 200: + case 208: + case 213: + case 217: childNodes.push(node); break; } @@ -24796,20 +25084,20 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 198: case 201: - case 199: + case 204: + case 202: topLevelNodes.push(node); break; - case 202: + case 205: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 197: + case 200: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -24820,9 +25108,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 197) { - if (functionDeclaration.body && functionDeclaration.body.kind === 176) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 197 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 200) { + if (functionDeclaration.body && functionDeclaration.body.kind === 179) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 200 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -24835,7 +25123,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; var item_3 = createItem(child); if (item_3 !== undefined) { @@ -24860,9 +25148,9 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems, _n = _a.length; _i < _n; _i++) { + outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { var sourceChild = _a[_i]; - for (var _b = 0, _c = target.childItems, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); @@ -24892,7 +25180,7 @@ var ts; return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); case 140: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 223: + case 226: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); case 138: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); @@ -24901,16 +25189,16 @@ var ts; case 132: case 131: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 197: + case 200: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 195: + case 198: case 152: var variableDeclarationNode; var name_18; if (node.kind === 152) { name_18 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 195) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 198) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -24931,11 +25219,11 @@ var ts; } case 135: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 214: - case 210: - case 205: - case 207: + case 217: + case 213: case 208: + case 210: + case 211: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -24965,17 +25253,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 224: + case 227: return createSourceFileItem(node); - case 198: - return createClassItem(node); case 201: + return createClassItem(node); + case 204: return createEnumItem(node); - case 199: - return createIterfaceItem(node); case 202: + return createIterfaceItem(node); + case 205: return createModuleItem(node); - case 197: + case 200: return createFunctionItem(node); } return undefined; @@ -24985,7 +25273,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 202) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 205) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -24997,7 +25285,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if ((node.name || node.flags & 256) && node.body && node.body.kind === 176) { + if ((node.name || node.flags & 256) && node.body && node.body.kind === 179) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem((!node.name && node.flags & 256) ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -25045,13 +25333,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 202) { + while (node.body.kind === 205) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 224 + return node.kind === 227 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -25143,7 +25431,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0, _n = wordSpans.length; _i < _n; _i++) { + for (var _i = 0; _i < wordSpans.length; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -25196,7 +25484,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0, _n = subWordTextChunks.length; _i < _n; _i++) { + for (var _i = 0; _i < subWordTextChunks.length; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -25581,7 +25869,7 @@ var ts; var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 175 && node.parent.parent.parent.kind === 159) { + else if (node.parent.kind === 176 && node.parent.parent.parent.kind === 159) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; @@ -25598,7 +25886,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0, _n = listChildren.length; _i < _n; _i++) { + for (var _i = 0; _i < listChildren.length; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -25658,7 +25946,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 224; n = n.parent) { + for (var n = node; n.kind !== 227; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -25839,17 +26127,17 @@ var ts; return false; } switch (n.kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 154: case 150: case 145: - case 176: - case 203: - case 204: + case 179: + case 206: + case 207: return nodeEndsWith(n, 15, sourceFile); - case 220: + case 223: return isCompletedNode(n.block, sourceFile); case 158: if (!n.arguments) { @@ -25865,7 +26153,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 134: case 133: @@ -25879,14 +26167,14 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 17, sourceFile); - case 202: + case 205: return n.body && isCompletedNode(n.body, sourceFile); - case 180: + case 183: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 179: + case 182: return isCompletedNode(n.expression, sourceFile); case 153: case 151: @@ -25899,15 +26187,15 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19, sourceFile); - case 217: - case 218: + case 220: + case 221: return false; - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: return isCompletedNode(n.statement, sourceFile); - case 181: + case 184: var hasWhileKeyword = findChildOfKind(n, 100, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 17, sourceFile); @@ -25927,7 +26215,7 @@ var ts; case 171: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 175: + case 176: return ts.nodeIsPresent(n.literal); case 167: return isCompletedNode(n.operand, sourceFile); @@ -25976,7 +26264,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 225 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 228 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -26041,7 +26329,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); @@ -26082,7 +26370,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 224); + ts.Debug.assert(startNode !== undefined || n.kind === 227); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -26122,7 +26410,7 @@ var ts; if (node.kind === 141 || node.kind === 157) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 198 || node.kind === 199) { + if (ts.isFunctionLike(node) || node.kind === 201 || node.kind === 202) { return node.typeParameters; } return undefined; @@ -26819,7 +27107,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -27003,7 +27291,7 @@ var ts; throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 183; + return context.contextNode.kind === 186; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); @@ -27013,16 +27301,16 @@ var ts; case 169: case 170: return true; - case 205: - case 195: + case 208: + case 198: case 129: - case 223: + case 226: case 132: case 131: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; - case 184: + case 187: return context.currentTokenSpan.kind === 86 || context.nextTokenSpan.kind === 86; - case 185: + case 188: return context.currentTokenSpan.kind === 125 || context.nextTokenSpan.kind === 125; case 152: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; @@ -27074,17 +27362,17 @@ var ts; return true; } switch (node.kind) { - case 176: - case 204: + case 179: + case 207: case 154: - case 203: + case 206: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 197: + case 200: case 134: case 133: case 136: @@ -27093,7 +27381,7 @@ var ts; case 162: case 135: case 163: - case 199: + case 202: return true; } return false; @@ -27103,40 +27391,40 @@ var ts; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 198: - case 199: case 201: - case 145: case 202: + case 204: + case 145: + case 205: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 198: - case 202: case 201: - case 176: - case 220: - case 203: - case 190: + case 205: + case 204: + case 179: + case 223: + case 206: + case 193: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 180: - case 190: case 183: - case 184: - case 185: - case 182: case 193: - case 181: - case 189: - case 220: + case 186: + case 187: + case 188: + case 185: + case 196: + case 184: + case 192: + case 223: return true; default: return false; @@ -27161,14 +27449,14 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 196 && + return context.currentTokenParent.kind === 199 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 202; + return context.contextNode.kind === 205; }; Rules.IsObjectTypeContext = function (context) { return context.contextNode.kind === 145; @@ -27179,9 +27467,9 @@ var ts; } switch (parent.kind) { case 141: - case 198: - case 199: - case 197: + case 201: + case 202: + case 200: case 162: case 163: case 134: @@ -27272,7 +27560,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(), _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -27686,17 +27974,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 198: - case 199: - return ts.rangeContainsRange(parent.members, node); + case 201: case 202: + return ts.rangeContainsRange(parent.members, node); + case 205: var body = parent.body; - return body && body.kind === 176 && ts.rangeContainsRange(body.statements, node); - case 224: - case 176: - case 203: + return body && body.kind === 179 && ts.rangeContainsRange(body.statements, node); + case 227: + case 179: + case 206: return ts.rangeContainsRange(parent.statements, node); - case 220: + case 223: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -27815,9 +28103,9 @@ var ts; if (indentation === -1) { if (isSomeBlock(node.kind)) { if (isSomeBlock(parent.kind) || - parent.kind === 224 || - parent.kind === 217 || - parent.kind === 218) { + parent.kind === 227 || + parent.kind === 220 || + parent.kind === 221) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -27848,10 +28136,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 198: return 69; - case 199: return 104; - case 197: return 83; - case 201: return 201; + case 201: return 69; + case 202: return 104; + case 200: return 83; + case 204: return 204; case 136: return 116; case 137: return 120; case 134: @@ -27990,7 +28278,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, true); } @@ -28035,7 +28323,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -28070,7 +28358,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0, _n = trivia.length; _i < _n; _i++) { + for (var _i = 0; _i < trivia.length; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -28250,8 +28538,8 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 176: - case 203: + case 179: + case 206: return true; } return false; @@ -28259,7 +28547,7 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 135: - case 197: + case 200: case 162: case 134: case 133: @@ -28462,7 +28750,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 224 || !parentAndChildShareLine); + (parent.kind === 227 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -28486,7 +28774,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 180 && parent.elseStatement === child) { + if (parent.kind === 183 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 76, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -28508,7 +28796,7 @@ var ts; return node.parent.properties; case 153: return node.parent.elements; - case 197: + case 200: case 162: case 163: case 134: @@ -28595,25 +28883,25 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 153: - case 176: - case 203: + case 179: + case 206: case 154: case 145: case 147: - case 204: - case 218: - case 217: + case 207: + case 221: + case 220: case 161: case 157: case 158: - case 177: - case 195: - case 211: - case 188: + case 180: + case 198: + case 214: + case 191: case 170: case 151: case 150: @@ -28626,13 +28914,13 @@ var ts; return true; } switch (parent) { - case 181: - case 182: case 184: case 185: + case 187: + case 188: + case 186: case 183: - case 180: - case 197: + case 200: case 162: case 134: case 133: @@ -28641,7 +28929,7 @@ var ts; case 135: case 136: case 137: - return child !== 176; + return child !== 179; default: return false; } @@ -28743,10 +29031,10 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(225, nodes.pos, nodes.end, 1024, this); + var list = createNode(228, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -28805,7 +29093,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (child.kind < 126) { return child; @@ -28871,13 +29159,13 @@ var ts; } }); } - if (declaration.kind === 202 && declaration.body.kind === 202) { + if (declaration.kind === 205 && declaration.body.kind === 205) { return; } - while (declaration.kind === 202 && declaration.parent.kind === 202) { + while (declaration.kind === 205 && declaration.parent.kind === 205) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 195 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 198 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -29162,7 +29450,7 @@ var ts; var namedDeclarations = []; ts.forEachChild(sourceFile, function visit(node) { switch (node.kind) { - case 197: + case 200: case 134: case 133: var functionDeclaration = node; @@ -29181,17 +29469,17 @@ var ts; ts.forEachChild(node, visit); } break; - case 198: - case 199: - case 200: case 201: case 202: + case 203: + case 204: case 205: - case 214: - case 210: - case 205: - case 207: case 208: + case 217: + case 213: + case 208: + case 210: + case 211: case 136: case 137: case 145: @@ -29199,14 +29487,14 @@ var ts; namedDeclarations.push(node); } case 135: - case 177: - case 196: + case 180: + case 199: case 150: case 151: - case 203: + case 206: ts.forEachChild(node, visit); break; - case 176: + case 179: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } @@ -29215,30 +29503,30 @@ var ts; if (!(node.flags & 112)) { break; } - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 223: + case 226: case 132: case 131: namedDeclarations.push(node); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { namedDeclarations.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { namedDeclarations.push(importClause.namedBindings); } else { @@ -29380,11 +29668,11 @@ var ts; if (declaration.kind === 162) { return true; } - if (declaration.kind !== 195 && declaration.kind !== 197) { + if (declaration.kind !== 198 && declaration.kind !== 200) { return false; } for (var parent_7 = declaration.parent; !ts.isFunctionBlock(parent_7); parent_7 = parent_7.parent) { - if (parent_7.kind === 224 || parent_7.kind === 203) { + if (parent_7.kind === 227 || parent_7.kind === 206) { return false; } } @@ -29425,7 +29713,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -29509,6 +29797,37 @@ var ts; sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; } + function transpile(input, compilerOptions, fileName, diagnostics) { + var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions(); + options.separateCompilation = true; + options.allowNonTsExtensions = true; + var inputFileName = fileName || "module.ts"; + var sourceFile = ts.createSourceFile(inputFileName, input, options.target); + if (diagnostics && sourceFile.parseDiagnostics) { + diagnostics.push.apply(diagnostics, sourceFile.parseDiagnostics); + } + var outputText; + var compilerHost = { + getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, + writeFile: function (name, text, writeByteOrderMark) { + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + outputText = text; + }, + getDefaultLibFileName: function () { return "lib.d.ts"; }, + useCaseSensitiveFileNames: function () { return false; }, + getCanonicalFileName: function (fileName) { return fileName; }, + getCurrentDirectory: function () { return ""; }, + getNewLine: function () { return "\r\n"; } + }; + var program = ts.createProgram([inputFileName], options, compilerHost); + if (diagnostics) { + diagnostics.push.apply(diagnostics, program.getGlobalDiagnostics()); + } + program.emit(); + ts.Debug.assert(outputText !== undefined, "Output generation failed"); + return outputText; + } + ts.transpile = transpile; function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { var sourceFile = ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); setSourceFileFields(sourceFile, scriptSnapshot, version); @@ -29750,7 +30069,7 @@ var ts; ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 191 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 194 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -29759,16 +30078,16 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 65 && - (node.parent.kind === 187 || node.parent.kind === 186) && + (node.parent.kind === 190 || node.parent.kind === 189) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 65 && - node.parent.kind === 191 && + node.parent.kind === 194 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 191; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 194; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -29797,7 +30116,7 @@ var ts; return node && node.parent && node.parent.kind === 158 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 202 && node.parent.name === node; + return node.parent.kind === 205 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 65 && @@ -29805,20 +30124,20 @@ var ts; } function isNameOfPropertyAssignment(node) { return (node.kind === 65 || node.kind === 8 || node.kind === 7) && - (node.parent.kind === 221 || node.parent.kind === 222) && node.parent.name === node; + (node.parent.kind === 224 || node.parent.kind === 225) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { case 132: case 131: - case 221: - case 223: + case 224: + case 226: case 134: case 133: case 136: case 137: - case 202: + case 205: return node.parent.name === node; case 156: return node.parent.argumentExpression === node; @@ -29872,17 +30191,17 @@ var ts; return undefined; } switch (node.kind) { - case 224: + case 227: case 134: case 133: - case 197: + case 200: case 162: case 136: case 137: - case 198: - case 199: case 201: case 202: + case 204: + case 205: return node; } } @@ -29890,18 +30209,18 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 202: return ScriptElementKind.moduleElement; - case 198: return ScriptElementKind.classElement; - case 199: return ScriptElementKind.interfaceElement; - case 200: return ScriptElementKind.typeElement; - case 201: return ScriptElementKind.enumElement; - case 195: + case 205: return ScriptElementKind.moduleElement; + case 201: return ScriptElementKind.classElement; + case 202: return ScriptElementKind.interfaceElement; + case 203: return ScriptElementKind.typeElement; + case 204: return ScriptElementKind.enumElement; + case 198: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 197: return ScriptElementKind.functionElement; + case 200: return ScriptElementKind.functionElement; case 136: return ScriptElementKind.memberGetAccessorElement; case 137: return ScriptElementKind.memberSetAccessorElement; case 134: @@ -29915,13 +30234,13 @@ var ts; case 138: return ScriptElementKind.callSignatureElement; case 135: return ScriptElementKind.constructorImplementationElement; case 128: return ScriptElementKind.typeParameterElement; - case 223: return ScriptElementKind.variableElement; + case 226: return ScriptElementKind.variableElement; case 129: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 205: - case 210: - case 207: - case 214: case 208: + case 213: + case 210: + case 217: + case 211: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -29981,7 +30300,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0, _n = oldSourceFiles.length; _i < _n; _i++) { + for (var _i = 0; _i < oldSourceFiles.length; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -30016,7 +30335,7 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; if (!sourceFileUpToDate(program.getSourceFile(fileName))) { return false; @@ -30064,6 +30383,12 @@ var ts; if (!displayName) { return undefined; } + if (displayName === "default") { + var localSymbol = ts.getLocalSymbolForExportDefault(symbol); + if (localSymbol && localSymbol.name) { + displayName = symbol.valueDeclaration.localSymbol.name; + } + } var firstCharCode = displayName.charCodeAt(0); if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; @@ -30180,11 +30505,11 @@ var ts; symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); } } - else if (ts.getAncestor(contextToken, 207)) { + else if (ts.getAncestor(contextToken, 210)) { isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(contextToken)) { - var importDeclaration = ts.getAncestor(contextToken, 206); + var importDeclaration = ts.getAncestor(contextToken, 209); ts.Debug.assert(importDeclaration !== undefined); var exports_2 = typeInfoResolver.getExportsOfExternalModule(importDeclaration); symbols = filterModuleExports(exports_2, importDeclaration); @@ -30199,7 +30524,7 @@ var ts; var adjustedPosition = previousToken !== contextToken ? previousToken.getStart() : position; - var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile); + var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; var symbolMeanings = 793056 | 107455 | 1536 | 8388608; symbols = typeInfoResolver.getSymbolsInScope(scopeNode, symbolMeanings); } @@ -30224,7 +30549,7 @@ var ts; function showCompletionsInImportsClause(node) { if (node) { if (node.kind === 14 || node.kind === 23) { - return node.parent.kind === 209; + return node.parent.kind === 212; } } return false; @@ -30249,16 +30574,16 @@ var ts; case 117: return true; case 20: - return containingNodeKind === 202; + return containingNodeKind === 205; case 14: - return containingNodeKind === 198; + return containingNodeKind === 201; case 53: - return containingNodeKind === 195 + return containingNodeKind === 198 || containingNodeKind === 169; case 11: return containingNodeKind === 171; case 12: - return containingNodeKind === 175; + return containingNodeKind === 176; case 109: case 107: case 108: @@ -30307,7 +30632,7 @@ var ts; switch (kind) { case 162: case 163: - case 197: + case 200: case 134: case 133: case 136: @@ -30324,14 +30649,14 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 195 || - containingNodeKind === 196 || - containingNodeKind === 177 || - containingNodeKind === 201 || - isFunction(containingNodeKind) || - containingNodeKind === 198 || - containingNodeKind === 197 || + return containingNodeKind === 198 || containingNodeKind === 199 || + containingNodeKind === 180 || + containingNodeKind === 204 || + isFunction(containingNodeKind) || + containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || containingNodeKind === 151 || containingNodeKind === 150; case 20: @@ -30339,21 +30664,21 @@ var ts; case 18: return containingNodeKind === 151; case 16: - return containingNodeKind === 220 || + return containingNodeKind === 223 || isFunction(containingNodeKind); case 14: - return containingNodeKind === 201 || - containingNodeKind === 199 || + return containingNodeKind === 204 || + containingNodeKind === 202 || containingNodeKind === 145 || containingNodeKind === 150; case 22: return containingNodeKind === 131 && - (previousToken.parent.parent.kind === 199 || + (previousToken.parent.parent.kind === 202 || previousToken.parent.parent.kind === 145); case 24: - return containingNodeKind === 198 || - containingNodeKind === 197 || - containingNodeKind === 199 || + return containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || isFunction(containingNodeKind); case 110: return containingNodeKind === 132; @@ -30406,7 +30731,7 @@ var ts; return exports; } if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 209) { + importDeclaration.importClause.namedBindings.kind === 212) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -30423,7 +30748,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 221 && m.kind !== 222) { + if (m.kind !== 224 && m.kind !== 225) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -30459,7 +30784,7 @@ var ts; var start = new Date().getTime(); var entries = []; var nameToSymbol = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; var entry = createCompletionEntry(symbol, typeInfoResolver, location); if (entry) { @@ -30774,7 +31099,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 223) { + if (declaration.kind === 226) { var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -30790,7 +31115,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 205) { + if (declaration.kind === 208) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -30989,7 +31314,7 @@ var ts; symbol = typeInfoResolver.getAliasedSymbol(symbol); } } - if (node.parent.kind === 222) { + if (node.parent.kind === 225) { var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -31017,7 +31342,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 114) { if (symbol.flags & 32) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 198); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 201); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -31034,7 +31359,7 @@ var ts; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 135) || - (!selectConstructors && (d.kind === 197 || d.kind === 134 || d.kind === 133))) { + (!selectConstructors && (d.kind === 200 || d.kind === 134 || d.kind === 133))) { declarations.push(d); if (d.body) definition = d; @@ -31052,6 +31377,17 @@ var ts; } } function getOccurrencesAtPosition(fileName, position) { + var results = getOccurrencesAtPositionCore(fileName, position); + if (results) { + var sourceFile = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results.forEach(function (value) { + var targetFile = getCanonicalFileName(ts.normalizeSlashes(value.fileName)); + ts.Debug.assert(sourceFile == targetFile, "Unexpected file in results. Found results in " + targetFile + " expected only results in " + sourceFile + "."); + }); + } + return results; + } + function getOccurrencesAtPositionCore(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingWord(sourceFile, position); @@ -31065,58 +31401,58 @@ var ts; switch (node.kind) { case 84: case 76: - if (hasKind(node.parent, 180)) { + if (hasKind(node.parent, 183)) { return getIfElseOccurrences(node.parent); } break; case 90: - if (hasKind(node.parent, 188)) { + if (hasKind(node.parent, 191)) { return getReturnOccurrences(node.parent); } break; case 94: - if (hasKind(node.parent, 192)) { + if (hasKind(node.parent, 195)) { return getThrowOccurrences(node.parent); } break; case 68: - if (hasKind(parent(parent(node)), 193)) { + if (hasKind(parent(parent(node)), 196)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 96: case 81: - if (hasKind(parent(node), 193)) { + if (hasKind(parent(node), 196)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 92: - if (hasKind(node.parent, 190)) { + if (hasKind(node.parent, 193)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 67: case 73: - if (hasKind(parent(parent(parent(node))), 190)) { + if (hasKind(parent(parent(parent(node))), 193)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 66: case 71: - if (hasKind(node.parent, 187) || hasKind(node.parent, 186)) { + if (hasKind(node.parent, 190) || hasKind(node.parent, 189)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 82: - if (hasKind(node.parent, 183) || - hasKind(node.parent, 184) || - hasKind(node.parent, 185)) { + if (hasKind(node.parent, 186) || + hasKind(node.parent, 187) || + hasKind(node.parent, 188)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 100: case 75: - if (hasKind(node.parent, 182) || hasKind(node.parent, 181)) { + if (hasKind(node.parent, 185) || hasKind(node.parent, 184)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -31132,14 +31468,14 @@ var ts; } default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 177)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 180)) { return getModifierOccurrences(node.kind, node.parent); } } return undefined; function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 180) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 183) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -31150,7 +31486,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 180)) { + if (!hasKind(ifStatement.elseStatement, 183)) { break; } ifStatement = ifStatement.elseStatement; @@ -31183,7 +31519,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 176))) { + if (!(func && hasKind(func.body, 179))) { return undefined; } var keywords = []; @@ -31216,10 +31552,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 192) { + if (node.kind === 195) { statementAccumulator.push(node); } - else if (node.kind === 193) { + else if (node.kind === 196) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -31241,10 +31577,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent_9 = child.parent; - if (ts.isFunctionBlock(parent_9) || parent_9.kind === 224) { + if (ts.isFunctionBlock(parent_9) || parent_9.kind === 227) { return parent_9; } - if (parent_9.kind === 193) { + if (parent_9.kind === 196) { var tryStatement = parent_9; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -31269,7 +31605,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 82, 100, 75)) { - if (loopNode.kind === 181) { + if (loopNode.kind === 184) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 100)) { @@ -31304,13 +31640,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return getLoopBreakContinueOccurrences(owner); - case 190: + case 193: return getSwitchCaseDefaultOccurrences(owner); } } @@ -31321,7 +31657,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 187 || node.kind === 186) { + if (node.kind === 190 || node.kind === 189) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -31337,15 +31673,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { switch (node_1.kind) { - case 190: - if (statement.kind === 186) { + case 193: + if (statement.kind === 189) { continue; } - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: - case 181: + case 184: if (!statement.label || isLabeledBy(node_1, statement.label.text)) { return node_1; } @@ -31384,18 +31720,18 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 198 || + if (!(container.kind === 201 || (declaration.kind === 129 && hasKind(container, 135)))) { return undefined; } } else if (modifier === 110) { - if (container.kind !== 198) { + if (container.kind !== 201) { return undefined; } } else if (modifier === 78 || modifier === 115) { - if (!(container.kind === 203 || container.kind === 224)) { + if (!(container.kind === 206 || container.kind === 227)) { return undefined; } } @@ -31406,14 +31742,14 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 203: - case 224: + case 206: + case 227: nodes = container.statements; break; case 135: nodes = container.parameters.concat(container.parent.members); break; - case 198: + case 201: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { @@ -31475,7 +31811,7 @@ var ts; return undefined; } var referenceEntries = []; - for (var _i = 0, _n = referenceSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < referenceSymbols.length; _i++) { var referenceSymbol = referenceSymbols[_i]; ts.addRange(referenceEntries, referenceSymbol.references); } @@ -31578,12 +31914,12 @@ var ts; } function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 210 || location.parent.kind === 214) && + (location.parent.kind === 213 || location.parent.kind === 217) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 210 || declaration.kind === 214; + return declaration.kind === 213 || declaration.kind === 217; }); } function getDeclaredName(symbol, location) { @@ -31620,7 +31956,7 @@ var ts; if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 198); + return ts.getAncestor(privateDeclaration, 201); } } if (symbol.flags & 8388608) { @@ -31632,7 +31968,7 @@ var ts; var scope = undefined; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -31641,7 +31977,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 224 && !ts.isExternalModule(container)) { + if (container.kind === 227 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -31847,11 +32183,11 @@ var ts; staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 224: + case 227: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 197: + case 200: case 162: break; default: @@ -31859,7 +32195,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 224) { + if (searchSpaceNode.kind === 227) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -31891,7 +32227,7 @@ var ts; var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { case 162: - case 197: + case 200: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } @@ -31902,13 +32238,13 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; - case 198: + case 201: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 224: - if (container.kind === 224 && !ts.isExternalModule(container)) { + case 227: + if (container.kind === 227 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -31943,11 +32279,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 198) { - getPropertySymbolFromTypeReference(ts.getClassBaseTypeNode(declaration)); - ts.forEach(ts.getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); + if (declaration.kind === 201) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 199) { + else if (declaration.kind === 202) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -32030,7 +32366,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -32098,32 +32434,32 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: - case 220: + case 223: return 1; case 128: - case 199: - case 200: + case 202: + case 203: case 145: return 2; - case 198: case 201: + case 204: return 1 | 2; - case 202: + case 205: if (node.name.kind === 8) { return 4 | 1; } @@ -32133,31 +32469,51 @@ var ts; else { return 4; } - case 209: - case 210: - case 205: - case 206: - case 211: case 212: + case 213: + case 208: + case 209: + case 214: + case 215: return 1 | 2 | 4; - case 224: + case 227: return 4 | 1; } return 1 | 2 | 4; ts.Debug.fail("Unknown declaration type"); } function isTypeReference(node) { - if (isRightSideOfQualifiedName(node)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 141; + return node.parent.kind === 141 || node.parent.kind === 177; } function isNamespaceReference(node) { + return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); + } + function isPropertyAccessNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 155) { + while (root.parent && root.parent.kind === 155) { + root = root.parent; + } + isLastClause = root.name === node; + } + if (!isLastClause && root.parent.kind === 177 && root.parent.parent.kind === 222) { + var decl = root.parent.parent.parent; + return (decl.kind === 201 && root.parent.parent.token === 103) || + (decl.kind === 202 && root.parent.parent.token === 79); + } + return false; + } + function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; if (root.parent.kind === 126) { - while (root.parent && root.parent.kind === 126) + while (root.parent && root.parent.kind === 126) { root = root.parent; + } isLastClause = root.right === node; } return root.parent.kind === 141 && !isLastClause; @@ -32172,13 +32528,13 @@ var ts; ts.Debug.assert(node.kind === 65); if (node.parent.kind === 126 && node.parent.right === node && - node.parent.parent.kind === 205) { + node.parent.parent.kind === 208) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 211) { + if (node.parent.kind === 214) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -32231,7 +32587,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 202 && + if (nodeForStartPos.parent.parent.kind === 205 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -32287,7 +32643,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 202 && ts.getModuleInstanceState(declaration) == 1; + return declaration.kind === 205 && ts.getModuleInstanceState(declaration) == 1; }); } } @@ -32405,7 +32761,7 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 53) { - if (token.parent.kind === 195 || + if (token.parent.kind === 198 || token.parent.kind === 132 || token.parent.kind === 129) { return ClassificationTypeNames.operator; @@ -32435,7 +32791,7 @@ var ts; else if (tokenKind === 65) { if (token) { switch (token.parent.kind) { - case 198: + case 201: if (token.parent.name === token) { return ClassificationTypeNames.className; } @@ -32445,17 +32801,17 @@ var ts; return ClassificationTypeNames.typeParameterName; } return; - case 199: + case 202: if (token.parent.name === token) { return ClassificationTypeNames.interfaceName; } return; - case 201: + case 204: if (token.parent.name === token) { return ClassificationTypeNames.enumName; } return; - case 202: + case 205: if (token.parent.name === token) { return ClassificationTypeNames.moduleName; } @@ -32468,7 +32824,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -32493,7 +32849,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0, _n = childNodes.length; _i < _n; _i++) { + for (var _i = 0; _i < childNodes.length; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -32626,7 +32982,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var sourceFile_1 = current.getSourceFile(); if (sourceFile_1 && getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { @@ -32716,7 +33072,7 @@ var ts; case 8: case 7: if (ts.isDeclarationName(node) || - node.parent.kind === 216 || + node.parent.kind === 219 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -33017,7 +33373,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 224 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 227 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index 3181d423310..e817dfb54ae 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -196,59 +196,62 @@ declare module "typescript" { TemplateExpression = 171, YieldExpression = 172, SpreadElementExpression = 173, - OmittedExpression = 174, - TemplateSpan = 175, - Block = 176, - VariableStatement = 177, - EmptyStatement = 178, - ExpressionStatement = 179, - IfStatement = 180, - DoStatement = 181, - WhileStatement = 182, - ForStatement = 183, - ForInStatement = 184, - ForOfStatement = 185, - ContinueStatement = 186, - BreakStatement = 187, - ReturnStatement = 188, - WithStatement = 189, - SwitchStatement = 190, - LabeledStatement = 191, - ThrowStatement = 192, - TryStatement = 193, - DebuggerStatement = 194, - VariableDeclaration = 195, - VariableDeclarationList = 196, - FunctionDeclaration = 197, - ClassDeclaration = 198, - InterfaceDeclaration = 199, - TypeAliasDeclaration = 200, - EnumDeclaration = 201, - ModuleDeclaration = 202, - ModuleBlock = 203, - CaseBlock = 204, - ImportEqualsDeclaration = 205, - ImportDeclaration = 206, - ImportClause = 207, - NamespaceImport = 208, - NamedImports = 209, - ImportSpecifier = 210, - ExportAssignment = 211, - ExportDeclaration = 212, - NamedExports = 213, - ExportSpecifier = 214, - MissingDeclaration = 215, - ExternalModuleReference = 216, - CaseClause = 217, - DefaultClause = 218, - HeritageClause = 219, - CatchClause = 220, - PropertyAssignment = 221, - ShorthandPropertyAssignment = 222, - EnumMember = 223, - SourceFile = 224, - SyntaxList = 225, - Count = 226, + ClassExpression = 174, + OmittedExpression = 175, + TemplateSpan = 176, + HeritageClauseElement = 177, + SemicolonClassElement = 178, + Block = 179, + VariableStatement = 180, + EmptyStatement = 181, + ExpressionStatement = 182, + IfStatement = 183, + DoStatement = 184, + WhileStatement = 185, + ForStatement = 186, + ForInStatement = 187, + ForOfStatement = 188, + ContinueStatement = 189, + BreakStatement = 190, + ReturnStatement = 191, + WithStatement = 192, + SwitchStatement = 193, + LabeledStatement = 194, + ThrowStatement = 195, + TryStatement = 196, + DebuggerStatement = 197, + VariableDeclaration = 198, + VariableDeclarationList = 199, + FunctionDeclaration = 200, + ClassDeclaration = 201, + InterfaceDeclaration = 202, + TypeAliasDeclaration = 203, + EnumDeclaration = 204, + ModuleDeclaration = 205, + ModuleBlock = 206, + CaseBlock = 207, + ImportEqualsDeclaration = 208, + ImportDeclaration = 209, + ImportClause = 210, + NamespaceImport = 211, + NamedImports = 212, + ImportSpecifier = 213, + ExportAssignment = 214, + ExportDeclaration = 215, + NamedExports = 216, + ExportSpecifier = 217, + MissingDeclaration = 218, + ExternalModuleReference = 219, + CaseClause = 220, + DefaultClause = 221, + HeritageClause = 222, + CatchClause = 223, + PropertyAssignment = 224, + ShorthandPropertyAssignment = 225, + EnumMember = 226, + SourceFile = 227, + SyntaxList = 228, + Count = 229, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -432,6 +435,9 @@ declare module "typescript" { interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { body?: Block; } + interface SemicolonClassElement extends ClassElement { + _semicolonClassElementBrand: any; + } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; body: Block; @@ -570,6 +576,10 @@ declare module "typescript" { typeArguments?: NodeArray; arguments: NodeArray; } + interface HeritageClauseElement extends Node { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + } interface NewExpression extends CallExpression, PrimaryExpression { } interface TaggedTemplateExpression extends MemberExpression { @@ -664,12 +674,16 @@ declare module "typescript" { interface ModuleElement extends Node { _moduleElementBrand: any; } - interface ClassDeclaration extends Declaration, ModuleElement { + interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + } interface ClassElement extends Declaration { _classElementBrand: any; } @@ -681,7 +695,7 @@ declare module "typescript" { } interface HeritageClause extends Node { token: SyntaxKind; - types?: NodeArray; + types?: NodeArray; } interface TypeAliasDeclaration extends Declaration, ModuleElement { name: Identifier; @@ -923,7 +937,7 @@ declare module "typescript" { writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; @@ -1179,7 +1193,6 @@ declare module "typescript" { interface CompilerOptions { allowNonTsExtensions?: boolean; charset?: string; - codepage?: number; declaration?: boolean; diagnostics?: boolean; emitBOM?: boolean; @@ -1193,7 +1206,6 @@ declare module "typescript" { noErrorTruncation?: boolean; noImplicitAny?: boolean; noLib?: boolean; - noLibCheck?: boolean; noResolve?: boolean; out?: string; outDir?: string; @@ -1206,6 +1218,7 @@ declare module "typescript" { target?: ScriptTarget; version?: boolean; watch?: boolean; + separateCompilation?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { @@ -1454,6 +1467,20 @@ declare module "typescript" { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; @@ -1947,6 +1974,7 @@ declare module "typescript" { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; diff --git a/bin/typescript.js b/bin/typescript.js index 2a8a4725b29..0ea54239508 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -190,59 +190,62 @@ var ts; SyntaxKind[SyntaxKind["TemplateExpression"] = 171] = "TemplateExpression"; SyntaxKind[SyntaxKind["YieldExpression"] = 172] = "YieldExpression"; SyntaxKind[SyntaxKind["SpreadElementExpression"] = 173] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 174] = "OmittedExpression"; - SyntaxKind[SyntaxKind["TemplateSpan"] = 175] = "TemplateSpan"; - SyntaxKind[SyntaxKind["Block"] = 176] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 177] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 178] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 179] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 180] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 181] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 182] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 183] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 184] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 185] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 186] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 187] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 188] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 189] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 190] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 191] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 192] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 193] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 194] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 195] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 196] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 197] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 198] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 199] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 200] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 201] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 202] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 203] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 204] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 205] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 206] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 207] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 208] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 209] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 210] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 211] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 212] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 213] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 214] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 215] = "MissingDeclaration"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 216] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["CaseClause"] = 217] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 218] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 219] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 220] = "CatchClause"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 221] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 222] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 223] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 224] = "SourceFile"; - SyntaxKind[SyntaxKind["SyntaxList"] = 225] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 226] = "Count"; + SyntaxKind[SyntaxKind["ClassExpression"] = 174] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 175] = "OmittedExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 176] = "TemplateSpan"; + SyntaxKind[SyntaxKind["HeritageClauseElement"] = 177] = "HeritageClauseElement"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 178] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["Block"] = 179] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 180] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 181] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 182] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 183] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 184] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 185] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 186] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 187] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 188] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 189] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 190] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 191] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 192] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 193] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 194] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 195] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 196] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 197] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 198] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 199] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 200] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 201] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 202] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 203] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 204] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 205] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 206] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 207] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 208] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 209] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 210] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 211] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 212] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 213] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 214] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 215] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 216] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 217] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 218] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 219] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["CaseClause"] = 220] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 221] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 222] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 223] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 224] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 225] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 226] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 227] = "SourceFile"; + SyntaxKind[SyntaxKind["SyntaxList"] = 228] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 229] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 53] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 64] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 66] = "FirstReservedWord"; @@ -632,7 +635,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (v === value) { return true; @@ -656,7 +659,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -670,7 +673,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_1 = array[_i]; if (f(item_1)) { result.push(item_1); @@ -684,7 +687,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result.push(f(v)); } @@ -704,7 +707,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_2 = array[_i]; if (!contains(result, item_2)) { result.push(item_2); @@ -716,7 +719,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result += v[prop]; } @@ -725,7 +728,7 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0, _n = from.length; _i < _n; _i++) { + for (var _i = 0; _i < from.length; _i++) { var v = from[_i]; to.push(v); } @@ -1014,7 +1017,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _n = parts.length; _i < _n; _i++) { + for (var _i = 0; _i < parts.length; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -1159,7 +1162,7 @@ var ts; ts.fileExtensionIs = fileExtensionIs; var supportedExtensions = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { + for (var _i = 0; _i < supportedExtensions.length; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -1319,14 +1322,14 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var name_1 = files[_i]; if (!extension || ts.fileExtensionIs(name_1, extension)) { result.push(ts.combinePaths(path, name_1)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + for (var _a = 0; _a < subfolders.length; _a++) { var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } @@ -1413,7 +1416,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -1426,7 +1429,7 @@ var ts; directories.push(name); } } - for (var _a = 0, _b = directories.length; _a < _b; _a++) { + for (var _a = 0; _a < directories.length; _a++) { var current = directories[_a]; visitDirectory(current); } @@ -1664,6 +1667,8 @@ var ts; Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, + Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, + Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -1850,6 +1855,8 @@ var ts; The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1933,6 +1940,11 @@ var ts; Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, + Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { code: 5043, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." }, + Option_declaration_cannot_be_specified_with_option_separateCompilation: { code: 5044, category: ts.DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'separateCompilation'." }, + Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, + Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, + Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1996,7 +2008,10 @@ var ts; You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." }, yield_expressions_are_not_currently_supported: { code: 9000, category: ts.DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." } + Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "'class' expressions are not currently supported." }, + class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: ts.DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." } }; })(ts || (ts = {})); /// @@ -3242,16 +3257,16 @@ var ts; })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); var ModuleInstanceState = ts.ModuleInstanceState; function getModuleInstanceState(node) { - if (node.kind === 199 || node.kind === 200) { + if (node.kind === 202 || node.kind === 203) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 206 || node.kind === 205) && !(node.flags & 1)) { + else if ((node.kind === 209 || node.kind === 208) && !(node.flags & 1)) { return 0; } - else if (node.kind === 203) { + else if (node.kind === 206) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -3267,7 +3282,7 @@ var ts; }); return state; } - else if (node.kind === 202) { + else if (node.kind === 205) { return getModuleInstanceState(node.body); } else { @@ -3320,7 +3335,7 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 202 && node.name.kind === 8) { + if (node.kind === 205 && node.name.kind === 8) { return '"' + node.name.text + '"'; } if (node.name.kind === 127) { @@ -3341,12 +3356,12 @@ var ts; return "__new"; case 140: return "__index"; - case 212: + case 215: return "__export"; - case 211: + case 214: return node.isExportEquals ? "export=" : "default"; - case 197: - case 198: + case 200: + case 201: return node.flags & 256 ? "default" : undefined; } } @@ -3378,7 +3393,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 198 && symbol.exports) { + if ((node.kind === 201 || node.kind === 174) && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -3394,7 +3409,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 214 || (node.kind === 205 && hasExportModifier)) { + if (node.kind === 217 || (node.kind === 208 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -3431,7 +3446,7 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 224); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227); } ts.forEachChild(node, bind); container = saveContainer; @@ -3440,10 +3455,10 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 202: + case 205: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -3458,22 +3473,23 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 198: + case 174: + case 201: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } case 145: case 154: - case 199: + case 202: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 201: + case 204: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -3488,11 +3504,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 224 ? node : node.body; - if (body.kind === 224 || body.kind === 203) { - for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { + var body = node.kind === 227 ? node : node.body; + if (body.kind === 227 || body.kind === 206) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 212 || stat.kind === 211) { + if (stat.kind === 215 || stat.kind === 214) { return true; } } @@ -3554,10 +3570,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 202: + case 205: declareModuleMember(node, 2, 107455); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -3582,7 +3598,7 @@ var ts; case 129: bindParameter(node); break; - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); @@ -3598,11 +3614,11 @@ var ts; case 131: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 221: - case 222: + case 224: + case 225: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 223: + case 226: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 138: @@ -3614,7 +3630,7 @@ var ts; case 133: bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; - case 197: + case 200: bindDeclaration(node, 16, 106927, true); break; case 135: @@ -3640,19 +3656,22 @@ var ts; case 163: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 220: + case 174: + bindAnonymousDeclaration(node, 32, "__class", false); + break; + case 223: bindCatchVariableDeclaration(node); break; - case 198: + case 201: bindDeclaration(node, 32, 899583, false); break; - case 199: + case 202: bindDeclaration(node, 64, 792992, false); break; - case 200: + case 203: bindDeclaration(node, 524288, 793056, false); break; - case 201: + case 204: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -3660,16 +3679,16 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 202: + case 205: bindModuleDeclaration(node); break; - case 205: case 208: - case 210: - case 214: + case 211: + case 213: + case 217: bindDeclaration(node, 8388608, 8388608, false); break; - case 207: + case 210: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -3677,13 +3696,13 @@ var ts; bindChildren(node, 0, false); } break; - case 212: + case 215: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 211: + case 214: if (node.expression && node.expression.kind === 65) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } @@ -3692,20 +3711,20 @@ var ts; } bindChildren(node, 0, false); break; - case 224: + case 227: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 176: + case 179: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 220: - case 183: - case 184: - case 185: - case 204: + case 223: + case 186: + case 187: + case 188: + case 207: bindChildren(node, 0, true); break; default: @@ -3724,7 +3743,7 @@ var ts; } if (node.flags & 112 && node.parent.kind === 135 && - node.parent.parent.kind === 198) { + (node.parent.parent.kind === 201 || node.parent.parent.kind === 174)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -3744,7 +3763,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -3802,7 +3821,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 224) { + while (node && node.kind !== 227) { node = node.parent; } return node; @@ -3884,15 +3903,15 @@ var ts; return current; } switch (current.kind) { - case 224: - case 204: - case 220: - case 202: - case 183: - case 184: - case 185: + case 227: + case 207: + case 223: + case 205: + case 186: + case 187: + case 188: return current; - case 176: + case 179: if (!isFunctionLike(current.parent)) { return current; } @@ -3903,9 +3922,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 195 && + declaration.kind === 198 && declaration.parent && - declaration.parent.kind === 220; + declaration.parent.kind === 223; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3942,14 +3961,21 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 195: - case 152: + case 227: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + if (pos_1 === sourceFile.text.length) { + return createTextSpan(0, 0); + } + return getSpanOfTokenAtPosition(sourceFile, pos_1); case 198: - case 199: - case 202: + case 152: case 201: - case 223: - case 197: + case 174: + case 202: + case 205: + case 204: + case 226: + case 200: case 162: errorNode = node.name; break; @@ -3972,7 +3998,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 201 && isConst(node); + return node.kind === 204 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { @@ -3984,14 +4010,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 195) { + if (node.kind === 198) { node = node.parent; } - if (node && node.kind === 196) { + if (node && node.kind === 199) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 177) { + if (node && node.kind === 180) { flags |= node.flags; } return flags; @@ -4006,7 +4032,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 179 && node.expression.kind === 8; + return node.kind === 182 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -4032,23 +4058,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188: + case 191: return visitor(node); - case 204: - case 176: - case 180: - case 181: - case 182: + case 207: + case 179: case 183: case 184: case 185: - case 189: - case 190: - case 217: - case 218: - case 191: + case 186: + case 187: + case 188: + case 192: case 193: case 220: + case 221: + case 194: + case 196: + case 223: return ts.forEachChild(node, traverse); } } @@ -4058,13 +4084,13 @@ var ts; if (node) { switch (node.kind) { case 152: - case 223: + case 226: case 129: - case 221: + case 224: case 132: case 131: - case 222: - case 195: + case 225: + case 198: return true; } } @@ -4076,7 +4102,7 @@ var ts; switch (node.kind) { case 135: case 162: - case 197: + case 200: case 163: case 134: case 133: @@ -4089,7 +4115,7 @@ var ts; case 143: case 162: case 163: - case 197: + case 200: return true; } } @@ -4097,7 +4123,7 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 176 && isFunctionLike(node.parent); + return node && node.kind === 179 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -4121,7 +4147,7 @@ var ts; } switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; @@ -4130,9 +4156,9 @@ var ts; if (!includeArrowFunctions) { continue; } - case 197: + case 200: case 162: - case 202: + case 205: case 132: case 131: case 134: @@ -4140,8 +4166,8 @@ var ts; case 135: case 136: case 137: - case 201: - case 224: + case 204: + case 227: return node; } } @@ -4154,12 +4180,12 @@ var ts; return node; switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; break; - case 197: + case 200: case 162: case 163: if (!includeFunctions) { @@ -4186,23 +4212,23 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 198: + case 201: return true; case 132: - return node.parent.kind === 198; + return node.parent.kind === 201; case 129: - return node.parent.body && node.parent.parent.kind === 198; + return node.parent.body && node.parent.parent.kind === 201; case 136: case 137: case 134: - return node.body && node.parent.kind === 198; + return node.body && node.parent.kind === 201; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 198: + case 201: if (node.decorators) { return true; } @@ -4230,7 +4256,7 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 198: + case 201: return ts.forEach(node.members, nodeOrChildIsDecorated); case 134: case 137: @@ -4261,6 +4287,7 @@ var ts; case 160: case 161: case 162: + case 174: case 163: case 166: case 164: @@ -4272,7 +4299,7 @@ var ts; case 173: case 171: case 10: - case 174: + case 175: return true; case 126: while (node.parent.kind === 126) { @@ -4287,38 +4314,38 @@ var ts; case 8: var parent_1 = node.parent; switch (parent_1.kind) { - case 195: + case 198: case 129: case 132: case 131: - case 223: - case 221: + case 226: + case 224: case 152: return parent_1.initializer === node; - case 179: - case 180: - case 181: case 182: - case 188: - case 189: - case 190: - case 217: - case 192: - case 190: - return parent_1.expression === node; case 183: - var forStatement = parent_1; - return (forStatement.initializer === node && forStatement.initializer.kind !== 196) || - forStatement.condition === node || - forStatement.iterator === node; case 184: case 185: + case 191: + case 192: + case 193: + case 220: + case 195: + case 193: + return parent_1.expression === node; + case 186: + var forStatement = parent_1; + return (forStatement.initializer === node && forStatement.initializer.kind !== 199) || + forStatement.condition === node || + forStatement.iterator === node; + case 187: + case 188: var forInStatement = parent_1; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 196) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199) || forInStatement.expression === node; case 160: return node === parent_1.expression; - case 175: + case 176: return node === parent_1.expression; case 127: return node === parent_1.expression; @@ -4338,7 +4365,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind === 216; + return node.kind === 208 && node.moduleReference.kind === 219; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4347,20 +4374,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind !== 216; + return node.kind === 208 && node.moduleReference.kind !== 219; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 206) { + if (node.kind === 209) { return node.moduleSpecifier; } - if (node.kind === 205) { + if (node.kind === 208) { var reference = node.moduleReference; - if (reference.kind === 216) { + if (reference.kind === 219) { return reference.expression; } } - if (node.kind === 212) { + if (node.kind === 215) { return node.moduleSpecifier; } } @@ -4377,8 +4404,8 @@ var ts; case 134: case 133: return node.questionToken !== undefined; - case 222: - case 221: + case 225: + case 224: case 132: case 131: return node.questionToken !== undefined; @@ -4421,31 +4448,31 @@ var ts; switch (node.kind) { case 163: case 152: - case 198: - case 135: case 201: - case 223: - case 214: - case 197: + case 135: + case 204: + case 226: + case 217: + case 200: case 162: case 136: - case 207: - case 205: case 210: - case 199: + case 208: + case 213: + case 202: case 134: case 133: - case 202: - case 208: + case 205: + case 211: case 129: - case 221: + case 224: case 132: case 131: case 137: - case 222: - case 200: + case 225: + case 203: case 128: - case 195: + case 198: return true; } return false; @@ -4453,25 +4480,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 187: - case 186: - case 194: - case 181: - case 179: - case 178: - case 184: - case 185: - case 183: - case 180: - case 191: - case 188: case 190: - case 94: - case 193: - case 177: - case 182: case 189: - case 211: + case 197: + case 184: + case 182: + case 181: + case 187: + case 188: + case 186: + case 183: + case 194: + case 191: + case 193: + case 94: + case 196: + case 180: + case 185: + case 192: + case 214: return true; default: return false; @@ -4497,7 +4524,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 210 || parent.kind === 214) { + if (parent.kind === 213 || parent.kind === 217) { if (parent.propertyName) { return true; } @@ -4509,24 +4536,24 @@ var ts; } ts.isDeclarationName = isDeclarationName; function isAliasSymbolDeclaration(node) { - return node.kind === 205 || - node.kind === 207 && !!node.name || - node.kind === 208 || - node.kind === 210 || - node.kind === 214 || - node.kind === 211 && node.expression.kind === 65; + return node.kind === 208 || + node.kind === 210 && !!node.name || + node.kind === 211 || + node.kind === 213 || + node.kind === 217 || + node.kind === 214 && node.expression.kind === 65; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; - function getClassBaseTypeNode(node) { + function getClassExtendsHeritageClauseElement(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } - ts.getClassBaseTypeNode = getClassBaseTypeNode; - function getClassImplementedTypeNodes(node) { + ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; + function getClassImplementsHeritageClauseElements(node) { var heritageClause = getHeritageClause(node.heritageClauses, 103); return heritageClause ? heritageClause.types : undefined; } - ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause ? heritageClause.types : undefined; @@ -4534,7 +4561,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _n = clauses.length; _i < _n; _i++) { + for (var _i = 0; _i < clauses.length; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -4761,7 +4788,7 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 202 || n.kind === 224; + return isFunctionLike(n) || n.kind === 205 || n.kind === 227; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -5131,12 +5158,36 @@ var ts; } } ts.writeCommentRange = writeCommentRange; + function isSupportedHeritageClauseElement(node) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; + function isSupportedHeritageClauseElementExpression(node) { + if (node.kind === 65) { + return true; + } + else if (node.kind === 155) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + else { + return false; + } + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 126 && node.parent.right === node) || + (node.parent.kind === 155 && node.parent.name === node); + } + ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function getLocalSymbolForExportDefault(symbol) { + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256) ? symbol.valueDeclaration.localSymbol : undefined; + } + ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; })(ts || (ts = {})); /// /// var ts; (function (ts) { - var nodeConstructors = new Array(226); + var nodeConstructors = new Array(229); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -5158,7 +5209,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -5184,9 +5235,9 @@ var ts; case 129: case 132: case 131: - case 221: - case 222: - case 195: + case 224: + case 225: + case 198: case 152: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -5212,7 +5263,7 @@ var ts; case 136: case 137: case 162: - case 197: + case 200: case 163: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -5291,150 +5342,154 @@ var ts; visitNode(cbNode, node.whenFalse); case 173: return visitNode(cbNode, node.expression); - case 176: - case 203: + case 179: + case 206: return visitNodes(cbNodes, node.statements); - case 224: + case 227: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 177: + case 180: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 196: + case 199: return visitNodes(cbNodes, node.declarations); - case 179: + case 182: return visitNode(cbNode, node.expression); - case 180: + case 183: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 181: + case 184: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 182: + case 185: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 183: + case 186: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); - case 184: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 185: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 186: case 187: - return visitNode(cbNode, node.label); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 189: + case 190: + return visitNode(cbNode, node.label); + case 191: + return visitNode(cbNode, node.expression); + case 192: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 190: + case 193: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 204: + case 207: return visitNodes(cbNodes, node.clauses); - case 217: + case 220: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 218: + case 221: return visitNodes(cbNodes, node.statements); - case 191: + case 194: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 192: + case 195: return visitNode(cbNode, node.expression); - case 193: + case 196: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 220: + case 223: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 130: return visitNode(cbNode, node.expression); - case 198: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); - case 199: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); - case 200: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); case 201: + case 174: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 223: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); case 202: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 203: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 204: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 226: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); case 205: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 208: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 206: + case 209: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 207: + case 210: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 208: + case 211: return visitNode(cbNode, node.name); - case 209: - case 213: - return visitNodes(cbNodes, node.elements); case 212: + case 216: + return visitNodes(cbNodes, node.elements); + case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 210: - case 214: + case 213: + case 217: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 211: + case 214: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); case 171: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 175: + case 176: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 127: return visitNode(cbNode, node.expression); - case 219: + case 222: return visitNodes(cbNodes, node.types); - case 216: + case 177: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments); + case 219: return visitNode(cbNode, node.expression); - case 215: + case 218: return visitNodes(cbNodes, node.decorators); } } @@ -5449,7 +5504,7 @@ var ts; ParsingContext[ParsingContext["TypeMembers"] = 5] = "TypeMembers"; ParsingContext[ParsingContext["ClassMembers"] = 6] = "ClassMembers"; ParsingContext[ParsingContext["EnumMembers"] = 7] = "EnumMembers"; - ParsingContext[ParsingContext["TypeReferences"] = 8] = "TypeReferences"; + ParsingContext[ParsingContext["HeritageClauseElement"] = 8] = "HeritageClauseElement"; ParsingContext[ParsingContext["VariableDeclarations"] = 9] = "VariableDeclarations"; ParsingContext[ParsingContext["ObjectBindingElements"] = 10] = "ObjectBindingElements"; ParsingContext[ParsingContext["ArrayBindingElements"] = 11] = "ArrayBindingElements"; @@ -5480,7 +5535,7 @@ var ts; case 5: return ts.Diagnostics.Property_or_signature_expected; case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; + case 8: return ts.Diagnostics.Expression_expected; case 9: return ts.Diagnostics.Variable_declaration_expected; case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; @@ -5562,7 +5617,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5626,7 +5681,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5830,7 +5885,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(224, 0); + var sourceFile = createNode(227, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -6203,7 +6258,7 @@ var ts; case 5: return isStartOfTypeMember(); case 6: - return lookAhead(isClassMemberStart); + return lookAhead(isClassMemberStart) || (token === 22 && !inErrorRecovery); case 7: return token === 18 || isLiteralPropertyName(); case 13: @@ -6211,7 +6266,15 @@ var ts; case 10: return isLiteralPropertyName(); case 8: - return isIdentifier() && !isNotHeritageClauseTypeName(); + if (token === 14) { + return lookAhead(isValidHeritageClauseObjectLiteral); + } + if (!inErrorRecovery) { + return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + else { + return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); + } case 9: return isIdentifierOrPattern(); case 11: @@ -6233,17 +6296,29 @@ var ts; } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } + function isValidHeritageClauseObjectLiteral() { + ts.Debug.assert(token === 14); + if (nextToken() === 15) { + var next = nextToken(); + return next === 23 || next === 14 || next === 79 || next === 103; + } + return true; + } function nextTokenIsIdentifier() { nextToken(); return isIdentifier(); } - function isNotHeritageClauseTypeName() { + function isHeritageClauseExtendsOrImplementsKeyword() { if (token === 103 || token === 79) { - return lookAhead(nextTokenIsIdentifier); + return lookAhead(nextTokenIsStartOfExpression); } return false; } + function nextTokenIsStartOfExpression() { + nextToken(); + return isStartOfExpression(); + } function isListTerminator(kind) { if (token === 1) { return true; @@ -6393,26 +6468,26 @@ var ts; case 15: return isReusableParameter(node); case 19: - case 8: case 16: case 18: case 17: case 12: case 13: + case 8: } return false; } function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 206: - case 205: - case 212: - case 211: - case 198: - case 199: - case 202: + case 209: + case 208: + case 215: + case 214: case 201: + case 202: + case 205: + case 204: return true; } return isReusableStatement(node); @@ -6428,6 +6503,7 @@ var ts; case 136: case 137: case 132: + case 178: return true; } } @@ -6436,8 +6512,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 217: - case 218: + case 220: + case 221: return true; } } @@ -6446,33 +6522,33 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 197: - case 177: - case 176: + case 200: case 180: case 179: - case 192: - case 188: - case 190: - case 187: - case 186: - case 184: - case 185: case 183: case 182: - case 189: - case 178: - case 193: + case 195: case 191: + case 193: + case 190: + case 189: + case 187: + case 188: + case 186: + case 185: + case 192: case 181: + case 196: case 194: + case 184: + case 197: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 223; + return node.kind === 226; } function isReusableTypeMember(node) { if (node) { @@ -6488,7 +6564,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 195) { + if (node.kind !== 198) { return false; } var variableDeclarator = node; @@ -6594,7 +6670,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(175); + var span = createNode(176); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -7029,7 +7105,7 @@ var ts; function parseTypeAnnotation() { return parseOptional(51) ? parseType() : undefined; } - function isStartOfExpression() { + function isStartOfLeftHandSideExpression() { switch (token) { case 93: case 91: @@ -7044,9 +7120,21 @@ var ts; case 18: case 14: case 83: + case 69: case 88: case 36: case 57: + case 65: + return true; + default: + return isIdentifier(); + } + } + function isStartOfExpression() { + if (isStartOfLeftHandSideExpression()) { + return true; + } + switch (token) { case 33: case 34: case 47: @@ -7057,7 +7145,6 @@ var ts; case 38: case 39: case 24: - case 65: case 111: return true; default: @@ -7068,7 +7155,11 @@ var ts; } } function isStartOfExpressionStatement() { - return token !== 14 && token !== 83 && token !== 52 && isStartOfExpression(); + return token !== 14 && + token !== 83 && + token !== 69 && + token !== 52 && + isStartOfExpression(); } function parseExpression() { // Expression[in]: @@ -7249,7 +7340,10 @@ var ts; if (token === 14) { return parseFunctionBlock(false, false); } - if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 83) { + if (isStartOfStatement(true) && + !isStartOfExpressionStatement() && + token !== 83 && + token !== 69) { return parseFunctionBlock(false, true); } return parseAssignmentExpressionOrHigher(); @@ -7514,7 +7608,6 @@ var ts; case 19: case 51: case 22: - case 23: case 50: case 28: case 30: @@ -7528,6 +7621,8 @@ var ts; case 15: case 1: return true; + case 23: + case 14: default: return false; } @@ -7550,6 +7645,8 @@ var ts; return parseArrayLiteralExpression(); case 14: return parseObjectLiteralExpression(); + case 69: + return parseClassExpression(); case 83: return parseFunctionExpression(); case 88: @@ -7580,7 +7677,7 @@ var ts; } function parseArgumentOrArrayLiteralElement() { return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(174) : + token === 23 ? createNode(175) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { @@ -7621,13 +7718,13 @@ var ts; return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(222, fullStart); + var shorthandDeclaration = createNode(225, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(221, fullStart); + var propertyAssignment = createNode(224, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -7675,7 +7772,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(176); + var node = createNode(179); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -7700,12 +7797,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(178); + var node = createNode(181); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(180); + var node = createNode(183); parseExpected(84); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7715,7 +7812,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(181); + var node = createNode(184); parseExpected(75); node.statement = parseStatement(); parseExpected(100); @@ -7726,7 +7823,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(182); + var node = createNode(185); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7749,21 +7846,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86)) { - var forInStatement = createNode(184, pos); + var forInStatement = createNode(187, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(125)) { - var forOfStatement = createNode(185, pos); + var forOfStatement = createNode(188, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(183, pos); + var forStatement = createNode(186, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -7781,7 +7878,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 187 ? 66 : 71); + parseExpected(kind === 190 ? 66 : 71); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -7789,7 +7886,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(188); + var node = createNode(191); parseExpected(90); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -7798,7 +7895,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(189); + var node = createNode(192); parseExpected(101); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7807,7 +7904,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(217); + var node = createNode(220); parseExpected(67); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -7815,7 +7912,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(218); + var node = createNode(221); parseExpected(73); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -7825,12 +7922,12 @@ var ts; return token === 67 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(190); + var node = createNode(193); parseExpected(92); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); - var caseBlock = createNode(204, scanner.getStartPos()); + var caseBlock = createNode(207, scanner.getStartPos()); parseExpected(14); caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); @@ -7840,14 +7937,14 @@ var ts; function parseThrowStatement() { // ThrowStatement[Yield] : // throw [no LineTerminator here]Expression[In, ?Yield]; - var node = createNode(192); + var node = createNode(195); parseExpected(94); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(193); + var node = createNode(196); parseExpected(96); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 ? parseCatchClause() : undefined; @@ -7858,7 +7955,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(220); + var result = createNode(223); parseExpected(68); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7868,7 +7965,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(194); + var node = createNode(197); parseExpected(72); parseSemicolon(); return finishNode(node); @@ -7877,13 +7974,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 && parseOptional(51)) { - var labeledStatement = createNode(191, fullStart); + var labeledStatement = createNode(194, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(179, fullStart); + var expressionStatement = createNode(182, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -7891,7 +7988,7 @@ var ts; } function isStartOfStatement(inErrorRecovery) { if (ts.isModifier(token)) { - var result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return true; } @@ -7903,6 +8000,7 @@ var ts; case 98: case 105: case 83: + case 69: case 84: case 75: case 100: @@ -7922,7 +8020,6 @@ var ts; var isConstEnum = lookAhead(nextTokenIsEnumKeyword); return !isConstEnum; case 104: - case 69: case 117: case 77: case 123: @@ -7957,6 +8054,8 @@ var ts; return parseVariableStatement(scanner.getStartPos(), undefined, undefined); case 83: return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 69: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); case 22: return parseEmptyStatement(); case 84: @@ -7968,9 +8067,9 @@ var ts; case 82: return parseForOrForInOrForOfStatement(); case 71: - return parseBreakOrContinueStatement(186); + return parseBreakOrContinueStatement(189); case 66: - return parseBreakOrContinueStatement(187); + return parseBreakOrContinueStatement(190); case 90: return parseReturnStatement(); case 101: @@ -7991,7 +8090,7 @@ var ts; } default: if (ts.isModifier(token) || token === 52) { - var result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return result; } @@ -7999,7 +8098,7 @@ var ts; return parseExpressionOrLabeledStatement(); } } - function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers() { + function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers() { var start = scanner.getStartPos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -8019,6 +8118,8 @@ var ts; return parseVariableStatement(start, decorators, modifiers); case 83: return parseFunctionDeclaration(start, decorators, modifiers); + case 69: + return parseClassDeclaration(start, decorators, modifiers); } return undefined; } @@ -8031,7 +8132,7 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(174); + return createNode(175); } var node = createNode(152); node.dotDotDotToken = parseOptionalToken(21); @@ -8080,7 +8181,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(195); + var node = createNode(198); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -8089,7 +8190,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(196); + var node = createNode(199); switch (token) { case 98: break; @@ -8118,7 +8219,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(177, fullStart); + var node = createNode(180, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -8126,7 +8227,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(200, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83); @@ -8269,6 +8370,11 @@ var ts; return modifiers; } function parseClassElement() { + if (token === 22) { + var result = createNode(178); + nextToken(); + return finishNode(result); + } var fullStart = getNodePos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -8295,12 +8401,18 @@ var ts; } ts.Debug.fail("Should not have attempted to parse class member declaration."); } + function parseClassExpression() { + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 174); + } function parseClassDeclaration(fullStart, decorators, modifiers) { + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201); + } + function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var savedStrictModeContext = inStrictModeContext(); if (languageVersion >= 2) { setStrictModeContext(true); } - var node = createNode(198, fullStart); + var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(69); @@ -8336,14 +8448,22 @@ var ts; } function parseHeritageClause() { if (token === 79 || token === 103) { - var node = createNode(219); + var node = createNode(222); node.token = token; nextToken(); - node.types = parseDelimitedList(8, parseTypeReference); + node.types = parseDelimitedList(8, parseHeritageClauseElement); return finishNode(node); } return undefined; } + function parseHeritageClauseElement() { + var node = createNode(177); + node.expression = parseLeftHandSideExpressionOrHigher(); + if (token === 24) { + node.typeArguments = parseBracketedList(17, parseType, 24, 25); + } + return finishNode(node); + } function isHeritageClause() { return token === 79 || token === 103; } @@ -8351,7 +8471,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(199, fullStart); + var node = createNode(202, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(104); @@ -8362,7 +8482,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200, fullStart); + var node = createNode(203, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(123); @@ -8373,13 +8493,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(223, scanner.getStartPos()); + var node = createNode(226, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(201, fullStart); + var node = createNode(204, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77); @@ -8394,7 +8514,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(203, scanner.getStartPos()); + var node = createNode(206, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -8405,7 +8525,7 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; @@ -8416,7 +8536,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -8448,7 +8568,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 124) { - var importEqualsDeclaration = createNode(205, fullStart); + var importEqualsDeclaration = createNode(208, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -8458,7 +8578,7 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(206, fullStart); + var importDeclaration = createNode(209, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || @@ -8478,13 +8598,13 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(207, fullStart); + var importClause = createNode(210, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(209); + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(212); } return finishNode(importClause); } @@ -8494,7 +8614,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(216); + var node = createNode(219); parseExpected(118); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -8509,7 +8629,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(208); + var namespaceImport = createNode(211); parseExpected(35); parseExpected(102); namespaceImport.name = parseIdentifier(); @@ -8517,14 +8637,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 209 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 212 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(214); + return parseImportOrExportSpecifier(217); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(210); + return parseImportOrExportSpecifier(213); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -8543,13 +8663,13 @@ var ts; else { node.name = identifierName; } - if (kind === 210 && checkIdentifierIsKeyword) { + if (kind === 213 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35)) { @@ -8557,7 +8677,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(213); + node.exportClause = parseNamedImportsOrExports(216); if (parseOptional(124)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -8566,7 +8686,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(211, fullStart); + var node = createNode(214, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53)) { @@ -8679,7 +8799,7 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); default: if (decorators) { - var node = createMissingNode(215, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(218, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8759,10 +8879,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 205 && node.moduleReference.kind === 216 - || node.kind === 206 - || node.kind === 211 - || node.kind === 212 + || node.kind === 208 && node.moduleReference.kind === 219 + || node.kind === 209 + || node.kind === 214 + || node.kind === 215 ? node : undefined; }); @@ -8779,6 +8899,7 @@ var ts; case 153: case 161: case 154: + case 174: case 162: case 65: case 9: @@ -9073,10 +9194,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 224); + return ts.getAncestor(node, 227); } function isGlobalSourceFile(node) { - return node.kind === 224 && !ts.isExternalModule(node); + return node.kind === 227 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -9118,25 +9239,33 @@ var ts; } } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 214)) { + if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 217)) { + break loop; + } + result = undefined; + } + else if (location.kind === 227) { + result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { break loop; } result = undefined; } break; - case 201: + case 204: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; case 132: case 131: - if (location.parent.kind === 198 && !(location.flags & 128)) { + if (location.parent.kind === 201 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -9145,8 +9274,8 @@ var ts; } } break; - case 198: - case 199: + case 201: + case 202: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -9157,7 +9286,7 @@ var ts; break; case 127: grandparent = location.parent.parent; - if (grandparent.kind === 198 || grandparent.kind === 199) { + if (grandparent.kind === 201 || grandparent.kind === 202) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -9169,7 +9298,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 163: if (name === "arguments") { result = argumentsSymbol; @@ -9181,8 +9310,15 @@ var ts; result = argumentsSymbol; break loop; } - var id = location.name; - if (id && name === id.text) { + var functionName = location.name; + if (functionName && name === functionName.text) { + result = location.symbol; + break loop; + } + break; + case 174: + var className = location.name; + if (className && name === className.text) { result = location.symbol; break loop; } @@ -9226,14 +9362,14 @@ var ts; ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 195); + var variableDeclaration = ts.getAncestor(declaration, 198); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 177 || - variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 180 || + variableDeclaration.parent.parent.kind === 186) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 185 || - variableDeclaration.parent.parent.kind === 184) { + else if (variableDeclaration.parent.parent.kind === 188 || + variableDeclaration.parent.parent.kind === 187) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -9255,10 +9391,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } - while (node && node.kind !== 206) { + while (node && node.kind !== 209) { node = node.parent; } return node; @@ -9268,7 +9404,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 216) { + if (node.moduleReference.kind === 219) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -9291,7 +9427,7 @@ var ts; if (moduleSymbol.flags & 3) { var typeAnnotation = moduleSymbol.valueDeclaration.type; if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); + return getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name); } } } @@ -9322,7 +9458,7 @@ var ts; if (symbol.flags & 3) { var typeAnnotation = symbol.valueDeclaration.type; if (typeAnnotation) { - return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); + return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name)); } } } @@ -9357,17 +9493,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 205: - return getTargetOfImportEqualsDeclaration(node); - case 207: - return getTargetOfImportClause(node); case 208: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node); case 210: - return getTargetOfImportSpecifier(node); - case 214: - return getTargetOfExportSpecifier(node); + return getTargetOfImportClause(node); case 211: + return getTargetOfNamespaceImport(node); + case 213: + return getTargetOfImportSpecifier(node); + case 217: + return getTargetOfExportSpecifier(node); + case 214: return getTargetOfExportAssignment(node); } } @@ -9396,8 +9532,12 @@ var ts; function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); - if (target && target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target)) { - markAliasSymbolAsReferenced(symbol); + if (target) { + var markAlias = (target === unknownSymbol && compilerOptions.separateCompilation) || + (target !== unknownSymbol && (target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); + if (markAlias) { + markAliasSymbolAsReferenced(symbol); + } } } function markAliasSymbolAsReferenced(symbol) { @@ -9405,10 +9545,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 211 && node.expression) { + if (node.kind === 214 && node.expression) { checkExpressionCached(node.expression); } - else if (node.kind === 214) { + else if (node.kind === 217) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -9418,17 +9558,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 205); + importDeclaration = ts.getAncestor(entityName, 208); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 65 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 65 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (entityName.kind === 65 || entityName.parent.kind === 126) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 205); + ts.Debug.assert(entityName.parent.kind === 208); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -9436,7 +9576,7 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(name, meaning) { - if (ts.getFullWidth(name) === 0) { + if (ts.nodeIsMissing(name)) { return undefined; } var symbol; @@ -9446,18 +9586,22 @@ var ts; return undefined; } } - else if (name.kind === 126) { - var namespace = resolveEntityName(name.left, 1536); - if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) { + else if (name.kind === 126 || name.kind === 155) { + var left = name.kind === 126 ? name.left : name.expression; + var right = name.kind === 126 ? name.right : name.name; + var namespace = resolveEntityName(left, 1536); + if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; } - var right = name.right; symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; } } + else { + ts.Debug.fail("Unknown entity name kind."); + } ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } @@ -9546,7 +9690,7 @@ var ts; } var exportStars = symbol.exports["__export"]; if (exportStars) { - for (var _i = 0, _a = exportStars.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; visit(resolveExternalModuleName(node, node.moduleSpecifier)); } @@ -9583,7 +9727,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _n = members.length; _i < _n; _i++) { + for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; if (member.kind === 135 && ts.nodeIsPresent(member.body)) { return member; @@ -9650,17 +9794,17 @@ var ts; } } switch (location_1.kind) { - case 224: + case 227: if (!ts.isExternalModule(location_1)) { break; } - case 202: + case 205: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 198: - case 199: + case 201: + case 202: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -9691,7 +9835,7 @@ var ts; return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608) { + if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=") { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -9775,8 +9919,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 202 && declaration.name.kind === 8) || - (declaration.kind === 224 && ts.isExternalModule(declaration)); + return (declaration.kind === 205 && declaration.name.kind === 8) || + (declaration.kind === 227 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9811,8 +9955,8 @@ var ts; if (entityName.parent.kind === 144) { meaning = 107455 | 1048576; } - else if (entityName.kind === 126 || - entityName.parent.kind === 205) { + else if (entityName.kind === 126 || entityName.kind === 155 || + entityName.parent.kind === 208) { meaning = 1536; } else { @@ -9859,7 +10003,7 @@ var ts; while (node.kind === 149) { node = node.parent; } - if (node.kind === 200) { + if (node.kind === 203) { return getSymbolOfNode(node); } } @@ -9903,7 +10047,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -10031,7 +10175,7 @@ var ts; var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 224 || declaration.parent.kind === 203; + return declaration.parent.kind === 227 || declaration.parent.kind === 206; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -10087,13 +10231,13 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; writeKeyword(writer, 88); writeSpace(writer); @@ -10127,13 +10271,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { - var p = _f[_e]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _h = 0, _j = signatures.length; _h < _j; _h++) { - var signature = signatures[_h]; + for (var _f = 0; _f < signatures.length; _f++) { + var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -10263,12 +10407,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 202) { + if (node.kind === 205) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 224) { + else if (node.kind === 227) { return ts.isExternalModule(node) ? node : undefined; } } @@ -10313,21 +10457,21 @@ var ts; switch (node.kind) { case 152: return isDeclarationVisible(node.parent.parent); - case 195: + case 198: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 202: - case 198: - case 199: - case 200: - case 197: - case 201: case 205: + case 201: + case 202: + case 203: + case 200: + case 204: + case 208: var parent_2 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 205 && parent_2.kind !== 224 && ts.isInAmbientContext(parent_2))) { + !(node.kind !== 208 && parent_2.kind !== 227 && ts.isInAmbientContext(parent_2))) { return isGlobalSourceFile(parent_2); } return isDeclarationVisible(parent_2); @@ -10345,7 +10489,7 @@ var ts; case 138: case 140: case 129: - case 203: + case 206: case 142: case 143: case 145: @@ -10355,13 +10499,15 @@ var ts; case 148: case 149: return isDeclarationVisible(node.parent); - case 207: - case 208: case 210: + case 211: + case 213: return false; case 128: - case 224: + case 227: return true; + case 214: + return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } @@ -10376,10 +10522,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 211) { + if (node.parent && node.parent.kind === 214) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 217) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -10411,7 +10557,7 @@ var ts; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 195 ? node.parent.parent.parent : node.parent; + return node.kind === 198 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -10469,17 +10615,17 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 184) { + if (declaration.parent.parent.kind === 187) { return anyType; } - if (declaration.parent.parent.kind === 185) { + if (declaration.parent.parent.kind === 188) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var func = declaration.parent; @@ -10497,7 +10643,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 222) { + if (declaration.kind === 225) { return checkIdentifier(declaration.name); } return undefined; @@ -10526,7 +10672,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 174 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 175 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -10544,7 +10690,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 221 ? getWidenedType(type) : type; + return declaration.kind !== 224 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -10565,16 +10711,16 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 220) { + if (declaration.parent.kind === 223) { return links.type = anyType; } - if (declaration.kind === 211) { + if (declaration.kind === 214) { var exportAssignment = declaration; if (exportAssignment.expression) { return links.type = checkExpression(exportAssignment.expression); } else if (exportAssignment.type) { - return links.type = getTypeFromTypeNode(exportAssignment.type); + return links.type = getTypeFromTypeNodeOrHeritageClauseElement(exportAssignment.type); } else { return links.type = anyType; @@ -10603,11 +10749,11 @@ var ts; function getAnnotatedAccessorType(accessor) { if (accessor) { if (accessor.kind === 136) { - return accessor.type && getTypeFromTypeNode(accessor.type); + return accessor.type && getTypeFromTypeNodeOrHeritageClauseElement(accessor.type); } else { var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation && getTypeFromTypeNodeOrHeritageClauseElement(setterTypeAnnotation); } } return undefined; @@ -10719,7 +10865,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 199 || node.kind === 198) { + if (node.kind === 202 || node.kind === 201) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10750,10 +10896,10 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(symbol, 198); - var baseTypeNode = ts.getClassBaseTypeNode(declaration); + var declaration = ts.getDeclarationOfKind(symbol, 201); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + var baseType = getTypeFromHeritageClauseElement(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10791,9 +10937,9 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 199 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 202 && ts.getInterfaceBaseTypeNodes(declaration)) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { - var baseType = getTypeFromTypeReferenceNode(node); + var baseType = getTypeFromHeritageClauseElement(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10822,15 +10968,15 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 200); - var type = getTypeFromTypeNode(declaration.type); + var declaration = ts.getDeclarationOfKind(symbol, 203); + var type = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 200); + var declaration = ts.getDeclarationOfKind(symbol, 203); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -10887,7 +11033,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -10895,14 +11041,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSymbols.length; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -10911,7 +11057,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSignatures.length; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -11010,7 +11156,7 @@ var ts; function getUnionSignatures(types, kind) { var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -11031,7 +11177,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -11167,7 +11313,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -11185,7 +11331,7 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0, _b = props.length; _a < _b; _a++) { + for (var _a = 0; _a < props.length; _a++) { var prop = props[_a]; if (prop.declarations) { declarations.push.apply(declarations, prop.declarations); @@ -11310,7 +11456,7 @@ var ts; returnType = classType; } else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); + returnType = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } else { if (declaration.kind === 136 && !ts.hasDynamicName(declaration)) { @@ -11334,7 +11480,7 @@ var ts; switch (node.kind) { case 142: case 143: - case 197: + case 200: case 134: case 133: case 135: @@ -11432,7 +11578,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -11448,7 +11594,7 @@ var ts; function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType + ? declaration.type ? getTypeFromTypeNodeOrHeritageClauseElement(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { @@ -11458,7 +11604,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128).constraint); + type.constraint = getTypeFromTypeNodeOrHeritageClauseElement(ts.getDeclarationOfKind(type.symbol, 128).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -11482,7 +11628,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } @@ -11533,31 +11679,42 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReferenceNode(node) { + function getTypeFromTypeReference(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromHeritageClauseElement(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromTypeReferenceOrHeritageClauseElement(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var symbol = resolveEntityName(node.typeName, 793056); var type; - if (symbol) { - if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - type = unknownType; - } - else { - type = getDeclaredTypeOfSymbol(symbol); - if (type.flags & (1024 | 2048) && type.flags & 4096) { - var typeParameters = type.typeParameters; - if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); - } - else { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); - type = undefined; - } + if (node.kind !== 177 || ts.isSupportedHeritageClauseElement(node)) { + var typeNameOrExpression = node.kind === 141 + ? node.typeName + : node.expression; + var symbol = resolveEntityName(typeNameOrExpression, 793056); + if (symbol) { + if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; } else { - if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); - type = undefined; + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 | 2048) && type.flags & 4096) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNodeOrHeritageClauseElement)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } } } } @@ -11576,12 +11733,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 198: - case 199: case 201: + case 202: + case 204: return declaration; } } @@ -11623,7 +11780,7 @@ var ts; function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + links.resolvedType = createArrayType(getTypeFromTypeNodeOrHeritageClauseElement(node.elementType)); } return links.resolvedType; } @@ -11639,7 +11796,7 @@ var ts; function getTypeFromTupleTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNodeOrHeritageClauseElement)); } return links.resolvedType; } @@ -11659,13 +11816,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -11683,7 +11840,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -11730,7 +11887,7 @@ var ts; function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNodeOrHeritageClauseElement), true); } return links.resolvedType; } @@ -11756,7 +11913,7 @@ var ts; } return links.resolvedType; } - function getTypeFromTypeNode(node) { + function getTypeFromTypeNodeOrHeritageClauseElement(node) { switch (node.kind) { case 112: return anyType; @@ -11773,7 +11930,9 @@ var ts; case 8: return getTypeFromStringLiteral(node); case 141: - return getTypeFromTypeReferenceNode(node); + return getTypeFromTypeReference(node); + case 177: + return getTypeFromHeritageClauseElement(node); case 144: return getTypeFromTypeQueryNode(node); case 146: @@ -11783,7 +11942,7 @@ var ts; case 148: return getTypeFromUnionTypeNode(node); case 149: - return getTypeFromTypeNode(node.type); + return getTypeFromTypeNodeOrHeritageClauseElement(node.type); case 142: case 143: case 145: @@ -11799,7 +11958,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _n = items.length; _i < _n; _i++) { + for (var _i = 0; _i < items.length; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -11839,7 +11998,7 @@ var ts; case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _n = sources.length; _i < _n; _i++) { + for (var _i = 0; _i < sources.length; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -11955,7 +12114,7 @@ var ts; case 169: return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 221: + case 224: return isContextSensitive(node.initializer); case 134: case 133: @@ -12127,7 +12286,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -12150,7 +12309,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -12287,7 +12446,7 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -12358,7 +12517,7 @@ var ts; return 0; } var result = -1; - for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceProperties.length; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -12383,11 +12542,11 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceSignatures.length; _a++) { var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); @@ -12605,7 +12764,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -12738,7 +12897,7 @@ var ts; ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 197: + case 200: case 134: case 133: case 136: @@ -12791,7 +12950,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { + for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); } @@ -12862,7 +13021,7 @@ var ts; var targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _i = 0, _n = targetTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < targetTypes.length; _i++) { var t = targetTypes[_i]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -12880,7 +13039,7 @@ var ts; } else if (source.flags & 16384) { var sourceTypes = source.types; - for (var _a = 0, _b = sourceTypes.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceTypes.length; _a++) { var sourceType = sourceTypes[_a]; inferFromTypes(sourceType, target); } @@ -12907,7 +13066,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -12980,7 +13139,7 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; } return links.resolvedSymbol; } @@ -13051,7 +13210,7 @@ var ts; switch (node.kind) { case 169: return isAssignedInBinaryExpression(node); - case 195: + case 198: case 152: return isAssignedInVariableDeclaration(node); case 150: @@ -13071,24 +13230,24 @@ var ts; case 168: case 170: case 173: - case 176: - case 177: case 179: case 180: - case 181: case 182: case 183: case 184: case 185: + case 186: + case 187: case 188: - case 189: - case 190: - case 217: - case 218: case 191: case 192: case 193: case 220: + case 221: + case 194: + case 195: + case 196: + case 223: return ts.forEachChild(node, isAssignedIn); } return false; @@ -13124,7 +13283,7 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 180: + case 183: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } @@ -13144,9 +13303,9 @@ var ts; } } break; - case 224: - case 202: - case 197: + case 227: + case 205: + case 200: case 134: case 133: case 136: @@ -13289,15 +13448,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 220) { + symbol.valueDeclaration.parent.kind === 223) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 196) { + while (container.kind !== 199) { container = container.parent; } container = container.parent; - if (container.kind === 177) { + if (container.kind === 180) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -13314,7 +13473,7 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; getNodeLinks(node).flags |= 2; if (container.kind === 132 || container.kind === 135) { getNodeLinks(classNode).flags |= 4; @@ -13331,10 +13490,10 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 202: + case 205: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 201: + case 204: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 135: @@ -13355,7 +13514,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -13372,9 +13531,9 @@ var ts; } function checkSuperExpression(node) { var isCallExpression = node.parent.kind === 157 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); var baseClass; - if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); baseClass = classType.baseTypes.length && classType.baseTypes[0]; } @@ -13395,7 +13554,7 @@ var ts; container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 198) { + if (container && container.parent && container.parent.kind === 201) { if (container.flags & 128) { canUseSuperExpression = container.kind === 134 || @@ -13471,7 +13630,7 @@ var ts; var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var type = getContextuallyTypedParameterType(declaration); @@ -13537,7 +13696,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -13616,29 +13775,29 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 195: + case 198: case 129: case 132: case 131: case 152: return getContextualTypeForInitializerExpression(node); case 163: - case 188: + case 191: return getContextualTypeForReturnExpression(node); case 157: case 158: return getContextualTypeForArgument(parent, node); case 160: - return getTypeFromTypeNode(parent.type); + return getTypeFromTypeNodeOrHeritageClauseElement(parent.type); case 169: return getContextualTypeForBinaryOperand(node); - case 221: + case 224: return getContextualTypeForObjectLiteralElement(parent); case 153: return getContextualTypeForElementExpression(node); case 170: return getContextualTypeForConditionalOperand(node); - case 175: + case 176: ts.Debug.assert(parent.parent.kind === 171); return getContextualTypeForSubstitutionExpression(parent.parent, node); case 161: @@ -13674,7 +13833,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { @@ -13709,7 +13868,7 @@ var ts; if (parent.kind === 169 && parent.operatorToken.kind === 53 && parent.left === node) { return true; } - if (parent.kind === 221) { + if (parent.kind === 224) { return isAssignmentTarget(parent.parent); } if (parent.kind === 153) { @@ -13778,21 +13937,21 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 221 || - memberDecl.kind === 222 || + if (memberDecl.kind === 224 || + memberDecl.kind === 225 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 221) { + if (memberDecl.kind === 224) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 134) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 222); + ts.Debug.assert(memberDecl.kind === 225); type = memberDecl.name.kind === 127 ? unknownType : checkExpression(memberDecl.name, contextualMapper); @@ -13852,7 +14011,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 198); + var enclosingClassDeclaration = ts.getAncestor(node, 201); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -14051,7 +14210,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var parent_4 = signature.declaration && signature.declaration.parent; @@ -14100,7 +14259,7 @@ var ts; var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); - callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } else { var templateLiteral = tagExpression.template; @@ -14163,7 +14322,7 @@ var ts; } for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = void 0; if (i === 0 && args[i].parent.kind === 159) { @@ -14192,7 +14351,7 @@ var ts; var typeArgumentsAreAssignable = true; for (var i = 0; i < typeParameters.length; i++) { var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); + var typeArgument = getTypeFromTypeNodeOrHeritageClauseElement(typeArgNode); typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); @@ -14206,7 +14365,7 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = i === 0 && node.kind === 159 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : @@ -14236,8 +14395,8 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91) { - var containingClass = ts.getAncestor(callExpression, 198); - var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + var containingClass = ts.getAncestor(callExpression, 201); + var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } else { @@ -14304,7 +14463,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -14313,7 +14472,7 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var originalCandidate = candidates[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; @@ -14495,7 +14654,7 @@ var ts; } function checkTypeAssertion(node) { var exprType = checkExpression(node.expression); - var targetType = getTypeFromTypeNode(node.type); + var targetType = getTypeFromTypeNodeOrHeritageClauseElement(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { @@ -14533,7 +14692,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 176) { + if (func.body.kind !== 179) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -14571,7 +14730,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 192); + return (body.statements.length === 1) && (body.statements[0].kind === 195); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -14580,7 +14739,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 176) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 179) { return; } var bodyBlock = func.body; @@ -14632,16 +14791,16 @@ var ts; function checkFunctionExpressionOrObjectLiteralMethodBody(node) { ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); if (node.type) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (node.body) { - if (node.body.kind === 176) { + if (node.body.kind === 179) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); if (node.type) { - checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrHeritageClauseElement(node.type), node.body, undefined); } checkFunctionExpressionBodies(node.body); } @@ -14700,19 +14859,6 @@ var ts; return false; } } - function isImportedNameFromExternalModule(n) { - switch (n.kind) { - case 156: - case 155: { - var symbol = findSymbol(n.expression); - return symbol && symbol.flags & 8388608 && isExternalModuleSymbol(resolveAlias(symbol)); - } - case 161: - return isImportedNameFromExternalModule(n.expression); - default: - return false; - } - } if (!isReferenceOrErrorExpression(n)) { error(n, invalidReferenceMessage); return false; @@ -14721,9 +14867,6 @@ var ts; error(n, constantVariableMessage); return false; } - if (isImportedNameFromExternalModule(n)) { - error(n, invalidReferenceMessage); - } return true; } function checkDeleteExpression(node) { @@ -14781,7 +14924,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -14797,7 +14940,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -14833,9 +14976,9 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var name_8 = p.name; var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name_8.text) || @@ -14862,7 +15005,7 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { var propName = "" + i; var type = sourceType.flags & 1 ? sourceType : @@ -15184,6 +15327,8 @@ var ts; return checkTypeAssertion(node); case 161: return checkExpression(node.expression, contextualMapper); + case 174: + return checkClassExpression(node); case 162: case 163: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -15203,7 +15348,7 @@ var ts; return checkConditionalExpression(node, contextualMapper); case 173: return checkSpreadElementExpression(node, contextualMapper); - case 174: + case 175: return undefinedType; case 172: checkYieldExpression(node); @@ -15250,7 +15395,7 @@ var ts; if (node.kind === 140) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 || node.kind === 197 || node.kind === 143 || + else if (node.kind === 142 || node.kind === 200 || node.kind === 143 || node.kind === 138 || node.kind === 135 || node.kind === 139) { checkGrammarFunctionLikeDeclaration(node); @@ -15276,7 +15421,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 199) { + if (node.kind === 202) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -15286,7 +15431,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -15344,7 +15489,7 @@ var ts; } switch (n.kind) { case 162: - case 197: + case 200: case 163: case 154: return false; default: return ts.forEachChild(n, containsSuperCall); @@ -15354,7 +15499,7 @@ var ts; if (n.kind === 93) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 && n.kind !== 197) { + else if (n.kind !== 162 && n.kind !== 200) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -15363,13 +15508,13 @@ var ts; !(n.flags & 128) && !!n.initializer; } - if (ts.getClassBaseTypeNode(node.parent)) { + if (ts.getClassExtendsHeritageClauseElement(node.parent)) { if (containsSuperCall(node.body)) { var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 179 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 182 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -15413,9 +15558,15 @@ var ts; function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeReference(node) { + function checkTypeReferenceNode(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkHeritageClauseElement(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkTypeReferenceOrHeritageClauseElement(node) { checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceNode(node); + var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); if (type !== unknownType && node.typeArguments) { var len = node.typeArguments.length; for (var i = 0; i < len; i++) { @@ -15468,7 +15619,7 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 199) { + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202) { ts.Debug.assert(signatureDeclarationNode.kind === 138 || signatureDeclarationNode.kind === 139); var signatureKind = signatureDeclarationNode.kind === 138 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); @@ -15478,7 +15629,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { + for (var _i = 0; _i < signaturesToCheck.length; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -15488,7 +15639,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 199 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 202 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -15545,7 +15696,7 @@ var ts; var declarations = symbol.declarations; var isConstructor = (symbol.flags & 16384) !== 0; function reportImplementationExpectedError(node) { - if (node.name && ts.getFullWidth(node.name) === 0) { + if (node.name && ts.nodeIsMissing(node.name)) { return; } var seen = false; @@ -15584,15 +15735,15 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 199 || node.parent.kind === 145 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 202 || node.parent.kind === 145 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 197 || node.kind === 134 || node.kind === 133 || node.kind === 135) { + if (node.kind === 200 || node.kind === 134 || node.kind === 133 || node.kind === 135) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -15643,7 +15794,7 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + for (var _a = 0; _a < signatures.length; _a++) { var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); @@ -15689,16 +15840,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 199: - return 2097152; case 202: + return 2097152; + case 205: return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 198: case 201: + case 204: return 2097152 | 1048576; - case 205: + case 208: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -15712,7 +15863,7 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 198: + case 201: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]); @@ -15738,7 +15889,7 @@ var ts; return; } switch (node.kind) { - case 198: + case 201: case 134: case 136: case 137: @@ -15783,18 +15934,18 @@ var ts; } checkSourceElement(node.body); if (node.type && !isAccessor(node.kind)) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !node.type && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } } function checkBlock(node) { - if (node.kind === 176) { + if (node.kind === 179) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 203) { + if (ts.isFunctionBlock(node) || node.kind === 206) { checkFunctionExpressionBodies(node); } } @@ -15854,11 +16005,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } - if (ts.getClassBaseTypeNode(enclosingClass)) { + if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var isDeclaration_2 = node.kind !== 65; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); @@ -15872,11 +16023,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 202 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 205 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 224 && ts.isExternalModule(parent)) { + if (parent.kind === 227 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -15887,7 +16038,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { return; } - if (node.kind === 195 && !node.initializer) { + if (node.kind === 198 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -15897,15 +16048,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 196); - var container = varDeclList.parent.kind === 177 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199); + var container = varDeclList.parent.kind === 180 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 176 && ts.isFunctionLike(container.parent) || - container.kind === 203 || - container.kind === 202 || - container.kind === 224); + (container.kind === 179 && ts.isFunctionLike(container.parent) || + container.kind === 206 || + container.kind === 205 || + container.kind === 227); if (!namesShareScope) { var name_9 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_9, name_9); @@ -15989,7 +16140,7 @@ var ts; } if (node.kind !== 132 && node.kind !== 131) { checkExportsOnMergedDeclarations(node); - if (node.kind === 195 || node.kind === 152) { + if (node.kind === 198 || node.kind === 152) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -16018,7 +16169,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 176 || node.kind === 154) { + if (node.kind === 179 || node.kind === 154) { return true; } node = node.parent; @@ -16046,12 +16197,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 196) { + if (node.initializer && node.initializer.kind == 199) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -16066,7 +16217,7 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { checkForInOrForOfVariableDeclaration(node); } else { @@ -16087,7 +16238,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -16286,7 +16437,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 218 && !hasDuplicateDefaultClause) { + if (clause.kind === 221 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -16298,7 +16449,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 217) { + if (produceDiagnostics && clause.kind === 220) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -16315,7 +16466,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 191 && current.label.text === node.label.text) { + if (current.kind === 194 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -16379,9 +16530,9 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 198) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 201) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -16454,7 +16605,15 @@ var ts; } } } + function checkClassExpression(node) { + grammarErrorOnNode(node, ts.Diagnostics.class_expressions_are_not_currently_supported); + ts.forEach(node.members, checkSourceElement); + return unknownType; + } function checkClassDeclaration(node) { + if (node.parent.kind !== 206 && node.parent.kind !== 227) { + grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + } checkGrammarClassDeclarationHeritageClauses(node); checkDecorators(node); if (node.name) { @@ -16467,10 +16626,13 @@ var ts; var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); var staticType = getTypeOfSymbol(symbol); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); + } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkTypeReference(baseTypeNode); + checkHeritageClauseElement(baseTypeNode); } if (type.baseTypes.length) { if (produceDiagnostics) { @@ -16478,19 +16640,24 @@ var ts; checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); var staticBaseType = getTypeOfSymbol(baseType.symbol); checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType.symbol !== resolveEntityName(baseTypeNode.typeName, 107455)) { + if (baseType.symbol !== resolveEntityName(baseTypeNode.expression, 107455)) { error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); } checkKindsOfPropertyMemberOverrides(type, baseType); } - checkExpressionOrQualifiedName(baseTypeNode.typeName); } - var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (type.baseTypes.length || (baseTypeNode && compilerOptions.separateCompilation)) { + checkExpressionOrQualifiedName(baseTypeNode.expression); + } + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - checkTypeReference(typeRefNode); + if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromTypeReferenceNode(typeRefNode); + var t = getTypeFromHeritageClauseElement(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { @@ -16527,7 +16694,7 @@ var ts; // Base class instance member variables and accessors can be overridden by // derived class instance member variables and accessors, but not by other kinds of members. var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < baseProperties.length; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -16591,7 +16758,7 @@ var ts; if (!tp1.constraint || !tp2.constraint) { return false; } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + if (!isTypeIdenticalTo(getTypeFromTypeNodeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrHeritageClauseElement(tp2.constraint))) { return false; } } @@ -16604,10 +16771,10 @@ var ts; var seen = {}; ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0, _c = properties.length; _b < _c; _b++) { + for (var _b = 0; _b < properties.length; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; @@ -16635,7 +16802,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 199); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -16651,7 +16818,12 @@ var ts; } } } - ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { + if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(heritageElement); + }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { checkTypeForDuplicateIndexSignatures(node); @@ -16816,11 +16988,14 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); + var enumIsConst = ts.isConst(node); + if (compilerOptions.separateCompilation && enumIsConst && ts.isInAmbientContext(node)) { + error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided); + } var enumSymbol = getSymbolOfNode(node); var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { if (enumSymbol.declarations.length > 1) { - var enumIsConst = ts.isConst(node); ts.forEach(enumSymbol.declarations, function (decl) { if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); @@ -16829,7 +17004,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 201) { + if (declaration.kind !== 204) { return false; } var enumDeclaration = declaration; @@ -16850,9 +17025,9 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 198 || (declaration.kind === 197 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 201 || (declaration.kind === 200 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -16872,7 +17047,7 @@ var ts; if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -16895,20 +17070,29 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 126) { - node = node.left; + while (true) { + if (node.kind === 126) { + node = node.left; + } + else if (node.kind === 155) { + node = node.expression; + } + else { + break; + } } + ts.Debug.assert(node.kind === 65); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (ts.getFullWidth(moduleName) !== 0 && moduleName.kind !== 8) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { - error(moduleName, node.kind === 212 ? + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { + error(moduleName, node.kind === 215 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; @@ -16927,7 +17111,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 214 ? + var message = node.kind === 217 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -16950,7 +17134,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { checkImportBinding(importClause.namedBindings); } else { @@ -16995,8 +17179,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); } } @@ -17015,8 +17199,8 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 224 ? node.parent : node.parent.parent; - if (container.kind === 202 && container.name.kind === 65) { + var container = node.parent.kind === 227 ? node.parent : node.parent.parent; + if (container.kind === 205 && container.name.kind === 65) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; } @@ -17043,10 +17227,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 224) { + if (node.kind === 227) { return node.statements; } - if (node.kind === 202 && node.body.kind === 203) { + if (node.kind === 205 && node.body.kind === 206) { return node.body.statements; } return emptyArray; @@ -17098,7 +17282,7 @@ var ts; case 137: return checkAccessorDeclaration(node); case 141: - return checkTypeReference(node); + return checkTypeReferenceNode(node); case 144: return checkTypeQuery(node); case 145: @@ -17111,71 +17295,71 @@ var ts; return checkUnionType(node); case 149: return checkSourceElement(node.type); - case 197: + case 200: return checkFunctionDeclaration(node); - case 176: - case 203: - return checkBlock(node); - case 177: - return checkVariableStatement(node); case 179: - return checkExpressionStatement(node); + case 206: + return checkBlock(node); case 180: - return checkIfStatement(node); - case 181: - return checkDoStatement(node); + return checkVariableStatement(node); case 182: - return checkWhileStatement(node); + return checkExpressionStatement(node); case 183: - return checkForStatement(node); + return checkIfStatement(node); case 184: - return checkForInStatement(node); + return checkDoStatement(node); case 185: - return checkForOfStatement(node); + return checkWhileStatement(node); case 186: + return checkForStatement(node); case 187: - return checkBreakOrContinueStatement(node); + return checkForInStatement(node); case 188: - return checkReturnStatement(node); + return checkForOfStatement(node); case 189: - return checkWithStatement(node); case 190: - return checkSwitchStatement(node); + return checkBreakOrContinueStatement(node); case 191: - return checkLabeledStatement(node); + return checkReturnStatement(node); case 192: - return checkThrowStatement(node); + return checkWithStatement(node); case 193: - return checkTryStatement(node); + return checkSwitchStatement(node); + case 194: + return checkLabeledStatement(node); case 195: + return checkThrowStatement(node); + case 196: + return checkTryStatement(node); + case 198: return checkVariableDeclaration(node); case 152: return checkBindingElement(node); - case 198: - return checkClassDeclaration(node); - case 199: - return checkInterfaceDeclaration(node); - case 200: - return checkTypeAliasDeclaration(node); case 201: - return checkEnumDeclaration(node); + return checkClassDeclaration(node); case 202: - return checkModuleDeclaration(node); - case 206: - return checkImportDeclaration(node); + return checkInterfaceDeclaration(node); + case 203: + return checkTypeAliasDeclaration(node); + case 204: + return checkEnumDeclaration(node); case 205: + return checkModuleDeclaration(node); + case 209: + return checkImportDeclaration(node); + case 208: return checkImportEqualsDeclaration(node); - case 212: - return checkExportDeclaration(node); - case 211: - return checkExportAssignment(node); - case 178: - checkGrammarStatementInAmbientContext(node); - return; - case 194: - checkGrammarStatementInAmbientContext(node); - return; case 215: + return checkExportDeclaration(node); + case 214: + return checkExportAssignment(node); + case 181: + checkGrammarStatementInAmbientContext(node); + return; + case 197: + checkGrammarStatementInAmbientContext(node); + return; + case 218: return checkMissingDeclaration(node); } } @@ -17196,10 +17380,10 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 189: + case 192: checkFunctionExpressionBodies(node.expression); break; case 129: @@ -17210,14 +17394,14 @@ var ts; case 152: case 153: case 154: - case 221: + case 224: case 155: case 156: case 157: case 158: case 159: case 171: - case 175: + case 176: case 160: case 161: case 165: @@ -17228,12 +17412,9 @@ var ts; case 169: case 170: case 173: - case 176: - case 203: - case 177: case 179: + case 206: case 180: - case 181: case 182: case 183: case 184: @@ -17241,21 +17422,24 @@ var ts; case 186: case 187: case 188: + case 189: case 190: - case 204: - case 217: - case 218: case 191: - case 192: case 193: + case 207: case 220: + case 221: + case 194: case 195: case 196: - case 198: - case 201: case 223: - case 211: - case 224: + case 198: + case 199: + case 201: + case 204: + case 226: + case 214: + case 227: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -17310,7 +17494,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 189 && node.parent.statement === node) { + if (node.parent.kind === 192 && node.parent.statement === node) { return true; } node = node.parent; @@ -17332,18 +17516,18 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) { break; } - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17384,17 +17568,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17419,20 +17603,28 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 128: - case 198: - case 199: - case 200: case 201: + case 202: + case 203: + case 204: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126) + while (node.parent && node.parent.kind === 126) { node = node.parent; + } return node.parent && node.parent.kind === 141; } - function isTypeNode(node) { + function isHeritageClauseElementIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 155) { + node = node.parent; + } + return node.parent && node.parent.kind === 177; + } + function isTypeNodeOrHeritageClauseElement(node) { if (141 <= node.kind && node.kind <= 149) { return true; } @@ -17447,12 +17639,18 @@ var ts; return node.parent.kind !== 166; case 8: return node.parent.kind === 129; + case 177: + return true; case 65: if (node.parent.kind === 126 && node.parent.right === node) { node = node.parent; } + else if (node.parent.kind === 155 && node.parent.name === node) { + node = node.parent; + } case 126: - ts.Debug.assert(node.kind === 65 || node.kind === 126, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 155: + ts.Debug.assert(node.kind === 65 || node.kind === 126 || node.kind === 155, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_5 = node.parent; if (parent_5.kind === 144) { return false; @@ -17461,14 +17659,16 @@ var ts; return true; } switch (parent_5.kind) { + case 177: + return true; case 128: return node === parent_5.constraint; case 132: case 131: case 129: - case 195: + case 198: return node === parent_5.type; - case 197: + case 200: case 162: case 163: case 135: @@ -17496,10 +17696,10 @@ var ts; while (nodeOnRightSide.parent.kind === 126) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 205) { + if (nodeOnRightSide.parent.kind === 208) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 211) { + if (nodeOnRightSide.parent.kind === 214) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -17507,15 +17707,11 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } - function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 && node.parent.right === node) || - (node.parent.kind === 155 && node.parent.name === node); - } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 211) { + if (entityName.parent.kind === 214) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 155) { @@ -17523,11 +17719,16 @@ var ts; return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } } - if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (ts.isExpression(entityName)) { - if (ts.getFullWidth(entityName) === 0) { + if (isHeritageClauseElementIdentifier(entityName)) { + var meaning = entityName.parent.kind === 177 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, meaning); + } + else if (ts.isExpression(entityName)) { + if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 65) { @@ -17564,7 +17765,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 211 + return node.parent.kind === 214 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } @@ -17587,7 +17788,7 @@ var ts; var moduleName; if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 206 || node.parent.kind === 212) && + ((node.parent.kind === 209 || node.parent.kind === 215) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -17606,7 +17807,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 222) { + if (location && location.kind === 225) { return resolveEntityName(location.name, 107455); } return undefined; @@ -17615,12 +17816,12 @@ var ts; if (isInsideWithStatementBody(node)) { return unknownType; } + if (isTypeNodeOrHeritageClauseElement(node)) { + return getTypeFromTypeNodeOrHeritageClauseElement(node); + } if (ts.isExpression(node)) { return getTypeOfExpression(node); } - if (isTypeNode(node)) { - return getTypeFromTypeNode(node); - } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -17645,7 +17846,7 @@ var ts; return unknownType; } function getTypeOfExpression(expr) { - if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } return checkExpression(expr); @@ -17680,7 +17881,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 224; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { if (languageVersion >= 2) { @@ -17688,10 +17889,10 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 207) { + if (node.kind === 210) { return getGeneratedNameForNode(node.parent) + ".default"; } - if (node.kind === 210) { + if (node.kind === 213) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -17708,7 +17909,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 202 || node.kind === 201) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 205 || node.kind === 204) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -17731,29 +17932,33 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 205: - case 207: case 208: case 210: - case 214: + case 211: + case 213: + case 217: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 212: + case 215: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 211: + case 214: return node.expression && node.expression.kind === 65 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 224 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 227 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } - return isAliasResolvedToValue(getSymbolOfNode(node)); + var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); + return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - return target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + if (target === unknownSymbol && compilerOptions.separateCompilation) { + return true; + } + return target !== unknownSymbol && target && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -17787,7 +17992,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 223) { + if (node.kind === 226) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -17822,13 +18027,13 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 195 && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 198 && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 220; + symbol.valueDeclaration.parent.kind !== 223; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -17934,17 +18139,17 @@ var ts; case 134: case 133: case 140: - case 198: - case 199: - case 202: case 201: - case 177: - case 197: - case 200: - case 206: + case 202: case 205: - case 212: - case 211: + case 204: + case 180: + case 200: + case 203: + case 209: + case 208: + case 215: + case 214: case 129: break; default: @@ -17955,7 +18160,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 109: @@ -17979,7 +18184,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -17988,7 +18193,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 129) { @@ -18004,7 +18209,7 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 129) { @@ -18016,13 +18221,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 129) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 203) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -18041,10 +18246,10 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 206 || node.kind === 205) && flags & 2) { + else if ((node.kind === 209 || node.kind === 208) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 199 && flags & 2) { + else if (node.kind === 202 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } else if (node.kind === 129 && (flags & 112) && ts.isBindingPattern(node.name)) { @@ -18172,9 +18377,9 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _n = arguments.length; _i < _n; _i++) { + for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 174) { + if (arg.kind === 175) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -18199,7 +18404,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -18227,7 +18432,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -18273,16 +18478,16 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_11 = prop.name; - if (prop.kind === 174 || + if (prop.kind === 175 || name_11.kind === 127) { checkGrammarComputedPropertyName(name_11); continue; } var currentKind = void 0; - if (prop.kind === 221 || prop.kind === 222) { + if (prop.kind === 224 || prop.kind === 225) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_11.kind === 7) { checkGrammarNumbericLiteral(name_11); @@ -18329,24 +18534,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 196) { + if (forInOrOfStatement.initializer.kind === 199) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -18415,7 +18620,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -18426,7 +18631,7 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === 145) { @@ -18435,13 +18640,13 @@ var ts; } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return true; - case 191: + case 194: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -18453,9 +18658,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 191: + case 194: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 186 + var isMisplacedContinueLabel = node.kind === 189 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -18463,8 +18668,8 @@ var ts; return false; } break; - case 190: - if (node.kind === 187 && !node.label) { + case 193: + if (node.kind === 190 && !node.label) { return false; } break; @@ -18477,13 +18682,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 187 + var message = node.kind === 190 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 187 + var message = node.kind === 190 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -18502,11 +18707,8 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 184 && node.parent.parent.kind !== 185) { + if (node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { if (ts.isInAmbientContext(node)) { - if (ts.isBindingPattern(node.name)) { - return grammarErrorOnNode(node, ts.Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); - } if (node.initializer) { var equalsTokenLength = "=".length; return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); @@ -18533,7 +18735,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _n = elements.length; _i < _n; _i++) { + for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -18550,15 +18752,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 180: - case 181: - case 182: - case 189: case 183: case 184: case 185: + case 192: + case 186: + case 187: + case 188: return false; - case 191: + case 194: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -18591,7 +18793,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; if (node.name.kind === 127) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -18655,13 +18857,13 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -18676,11 +18878,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 199 || - node.kind === 206 || - node.kind === 205 || - node.kind === 212 || - node.kind === 211 || + if (node.kind === 202 || + node.kind === 209 || + node.kind === 208 || + node.kind === 215 || + node.kind === 214 || (node.flags & 2) || (node.flags & (1 | 256))) { return false; @@ -18688,9 +18890,9 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 177) { + if (ts.isDeclaration(decl) || decl.kind === 180) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -18709,7 +18911,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 176 || node.parent.kind === 203 || node.parent.kind === 224) { + if (node.parent.kind === 179 || node.parent.kind === 206 || node.parent.kind === 227) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -18790,7 +18992,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 206); + ts.Debug.assert(aliasEmitInfo.node.kind === 209); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -18863,10 +19065,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 195) { + if (declaration.kind === 198) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 209 || declaration.kind === 210 || declaration.kind === 207) { + else if (declaration.kind === 212 || declaration.kind === 213 || declaration.kind === 210) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -18877,7 +19079,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 206) { + if (moduleElementEmitInfo.node.kind === 209) { moduleElementEmitInfo.isVisible = true; } else { @@ -18885,12 +19087,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -18943,14 +19145,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { @@ -18985,6 +19187,8 @@ var ts; case 99: case 8: return writeTextOfNode(currentSourceFile, type); + case 177: + return emitHeritageClauseElement(type); case 141: return emitTypeReference(type); case 144: @@ -19006,11 +19210,9 @@ var ts; return emitEntityName(type); case 126: return emitEntityName(type); - default: - ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 205 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 208 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -19018,10 +19220,22 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var qualifiedName = entityName; - writeEntityName(qualifiedName.left); + var left = entityName.kind === 126 ? entityName.left : entityName.expression; + var right = entityName.kind === 126 ? entityName.right : entityName.name; + writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, qualifiedName.right); + writeTextOfNode(currentSourceFile, right); + } + } + } + function emitHeritageClauseElement(node) { + if (ts.isSupportedHeritageClauseElement(node)) { + ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 155); + emitEntityName(node.expression); + if (node.typeArguments) { + write("<"); + emitCommaList(node.typeArguments, emitType); + write(">"); } } } @@ -19105,10 +19319,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 205 || - (node.parent.kind === 224 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 208 || + (node.parent.kind === 227 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 224) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -19117,7 +19331,7 @@ var ts; }); } else { - if (node.kind === 206) { + if (node.kind === 209) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -19135,23 +19349,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 197: - return writeFunctionDeclaration(node); - case 177: - return writeVariableStatement(node); - case 199: - return writeInterfaceDeclaration(node); - case 198: - return writeClassDeclaration(node); case 200: - return writeTypeAliasDeclaration(node); - case 201: - return writeEnumDeclaration(node); + return writeFunctionDeclaration(node); + case 180: + return writeVariableStatement(node); case 202: - return writeModuleDeclaration(node); + return writeInterfaceDeclaration(node); + case 201: + return writeClassDeclaration(node); + case 203: + return writeTypeAliasDeclaration(node); + case 204: + return writeEnumDeclaration(node); case 205: + return writeModuleDeclaration(node); + case 208: return writeImportEqualsDeclaration(node); - case 206: + case 209: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -19165,7 +19379,7 @@ var ts; if (node.flags & 256) { write("default "); } - else if (node.kind !== 199) { + else if (node.kind !== 202) { write("declare "); } } @@ -19209,7 +19423,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 208) { + if (namedBindings.kind === 211) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -19235,7 +19449,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -19286,7 +19500,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 203) { + while (node.body.kind !== 206) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -19375,10 +19589,10 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 198: + case 201: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 199: + case 202: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 139: @@ -19392,14 +19606,14 @@ var ts; if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { + else if (node.parent.parent.kind === 201) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 197: + case 200: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -19424,10 +19638,12 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + if (ts.isSupportedHeritageClauseElement(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; @@ -19460,11 +19676,11 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { emitHeritageClause([baseTypeNode], false); } - emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); write(" {"); writeLine(); increaseIndent(); @@ -19504,7 +19720,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 195 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 198 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -19522,7 +19738,7 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 195) { + if (node.kind === 198) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19537,7 +19753,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19560,7 +19776,14 @@ var ts; } : undefined; } function emitBindingPattern(bindingPattern) { - emitCommaList(bindingPattern.elements, emitBindingElement); + var elements = []; + for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 175) { + elements.push(element); + } + } + emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { @@ -19690,13 +19913,13 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 197) { + if (node.kind === 200) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 134) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 197) { + if (node.kind === 200) { write("function "); writeTextOfNode(currentSourceFile, node.name); } @@ -19778,7 +20001,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19791,7 +20014,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 197: + case 200: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19814,7 +20037,7 @@ var ts; write("..."); } if (ts.isBindingPattern(node.name)) { - write("_" + ts.indexOf(node.parent.parameters, node)); + emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); @@ -19832,79 +20055,124 @@ var ts; writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage; + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { case 135: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - break; case 139: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 134: case 133: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + else if (node.parent.parent.kind === 201) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - break; - case 197: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 200: + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); } - return { - diagnosticMessage: diagnosticMessage, - errorNode: node, - typeName: node.name - }; + } + function emitBindingPattern(bindingPattern) { + if (bindingPattern.kind === 150) { + write("{"); + emitCommaList(bindingPattern.elements, emitBindingElement); + write("}"); + } + else if (bindingPattern.kind === 151) { + write("["); + var elements = bindingPattern.elements; + emitCommaList(elements, emitBindingElement); + if (elements && elements.hasTrailingComma) { + write(", "); + } + write("]"); + } + } + function emitBindingElement(bindingElement) { + function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: bindingElement, + typeName: bindingElement.name + } : undefined; + } + if (bindingElement.kind === 175) { + write(" "); + } + else if (bindingElement.kind === 152) { + if (bindingElement.propertyName) { + writeTextOfNode(currentSourceFile, bindingElement.propertyName); + write(": "); + emitBindingPattern(bindingElement.name); + } + else if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + emitBindingPattern(bindingElement.name); + } + else { + ts.Debug.assert(bindingElement.name.kind === 65); + if (bindingElement.dotDotDotToken) { + write("..."); + } + writeTextOfNode(currentSourceFile, bindingElement.name); + } + } + } } } function emitNode(node) { switch (node.kind) { - case 197: - case 202: - case 205: - case 199: - case 198: case 200: + case 205: + case 208: + case 202: case 201: + case 203: + case 204: return emitModuleElement(node, isModuleElementVisible(node)); - case 177: + case 180: return emitModuleElement(node, isVariableStatementVisible(node)); - case 206: + case 209: return emitModuleElement(node, !node.importClause); - case 212: + case 215: return emitExportDeclaration(node); case 135: case 134: @@ -19920,11 +20188,11 @@ var ts; case 132: case 131: return emitPropertyDeclaration(node); - case 223: + case 226: return emitEnumMemberDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFile(node); } } @@ -20033,7 +20301,6 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; - var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var generatedNameSet = {}; var nodeToGeneratedName = []; @@ -20152,24 +20419,24 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 197: - case 198: + case 200: + case 201: generateNameForFunctionOrClassDeclaration(node); break; - case 202: + case 205: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 201: + case 204: generateNameForModuleOrEnum(node); break; - case 206: + case 209: generateNameForImportDeclaration(node); break; - case 212: + case 215: generateNameForExportDeclaration(node); break; - case 211: + case 214: generateNameForExportAssignment(node); break; } @@ -20323,15 +20590,15 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 197 || + else if (node.kind === 200 || node.kind === 162 || node.kind === 134 || node.kind === 133 || node.kind === 136 || node.kind === 137 || - node.kind === 202 || - node.kind === 198 || - node.kind === 201) { + node.kind === 205 || + node.kind === 201 || + node.kind === 204) { if (node.name) { var name_15 = node.name; scopeName = name_15.kind === 127 @@ -20419,7 +20686,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 224) { + if (node.kind != 227) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -20504,7 +20771,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -20514,7 +20781,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -20528,7 +20795,7 @@ var ts; write(","); } decreaseIndent(); - if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -20793,35 +21060,35 @@ var ts; var parent = node.parent; switch (parent.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: - case 197: + case 200: case 136: case 137: case 162: - case 198: - case 199: case 201: case 202: + case 204: case 205: - case 207: case 208: - return parent.name === node; case 210: - case 214: - return parent.name === node || parent.propertyName === node; - case 187: - case 186: case 211: + return parent.name === node; + case 213: + case 217: + return parent.name === node || parent.propertyName === node; + case 190: + case 189: + case 214: return false; - case 191: + case 194: return node.parent.label === node; } } @@ -21015,9 +21282,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 221: + case 224: return property.initializer; - case 222: + case 225: return createIdentifier(resolver.getExpressionNameSubstitution(property.name, getGeneratedNameForNode)); case 134: return createFunctionExpression(property.parameters, property.body); @@ -21072,7 +21339,7 @@ var ts; return result; } function createExpressionStatement(expression) { - var result = ts.createSynthesizedNode(179); + var result = ts.createSynthesizedNode(182); result.expression = expression; return result; } @@ -21091,7 +21358,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(221); + var result = ts.createSynthesizedNode(224); result.name = name; result.initializer = initializer; return result; @@ -21184,6 +21451,9 @@ var ts; } } function tryEmitConstantValue(node) { + if (compilerOptions.separateCompilation) { + return false; + } var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { write(constantValue.toString()); @@ -21196,7 +21466,7 @@ var ts; return false; } function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); @@ -21401,7 +21671,7 @@ var ts; function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 53 && (node.left.kind === 154 || node.left.kind === 153)) { - emitDestructuring(node, node.parent.kind === 179); + emitDestructuring(node, node.parent.kind === 182); } else { emit(node.left); @@ -21437,13 +21707,13 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 176) { + if (node && node.kind === 179) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { - if (preserveNewLines && isSingleLineEmptyBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -21452,12 +21722,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 203) { - ts.Debug.assert(node.parent.kind === 202); + if (node.kind === 206) { + ts.Debug.assert(node.parent.kind === 205); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 203) { + if (node.kind === 206) { emitTempDeclarations(true); } decreaseIndent(); @@ -21466,7 +21736,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 176) { + if (node.kind === 179) { write(" "); emit(node); } @@ -21491,7 +21761,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76, node.thenStatement.end); - if (node.elseStatement.kind === 180) { + if (node.elseStatement.kind === 183) { write(" "); emit(node.elseStatement); } @@ -21503,7 +21773,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { write(" "); } else { @@ -21547,7 +21817,7 @@ var ts; var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 196) { + if (node.initializer && node.initializer.kind === 199) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; emitStartOfVariableDeclarationList(declarations[0], endPos); @@ -21565,13 +21835,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 185) { + if (languageVersion < 2 && node.kind === 188) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; @@ -21583,7 +21853,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 184) { + if (node.kind === 187) { write(" in "); } else { @@ -21620,7 +21890,6 @@ var ts; var rhsIsIdentifier = node.expression.kind === 65; var counter = createTempVariable(268435456); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(536870912) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -21634,24 +21903,12 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } - if (cachedLength) { - write(", "); - emitNodeWithoutSourceMap(cachedLength); - write(" = "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - if (cachedLength) { - emitNodeWithoutSourceMap(cachedLength); - } - else { - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } + emitNodeWithoutSourceMap(rhsReference); + write(".length"); emitEnd(node.initializer); write("; "); emitStart(node.initializer); @@ -21664,7 +21921,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -21695,7 +21952,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { emitLines(node.statement.statements); } else { @@ -21707,7 +21964,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 187 ? 66 : 71, node.pos); + emitToken(node.kind === 190 ? 66 : 71, node.pos); emitOptional(" ", node.label); write(";"); } @@ -21752,7 +22009,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 217) { + if (node.kind === 220) { write("case "); emit(node.expression); write(":"); @@ -21760,7 +22017,7 @@ var ts; else { write("default:"); } - if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -21807,7 +22064,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 202); + } while (node && node.kind !== 205); return node; } function emitContainingModuleName(node) { @@ -21840,11 +22097,11 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (node.name) { - emitModuleMemberName(node); + if (node.flags & 256) { + write("exports.default"); } else { - write("exports.default"); + emitModuleMemberName(node); } write(" = "); emitDeclarationName(node); @@ -21854,7 +22111,7 @@ var ts; } function emitExportMemberAssignments(name) { if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _a = 0, _b = exportSpecifiers[name.text], _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); emitStart(specifier.name); @@ -21870,7 +22127,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var isDeclaration = (root.kind === 195 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; + var isDeclaration = (root.kind === 198 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; if (root.kind === 169) { emitAssignmentExpression(root); } @@ -21883,7 +22140,7 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 195 || name.parent.kind === 152)) { + if (name.parent && (name.parent.kind === 198 || name.parent.kind === 152)) { emitModuleMemberName(name.parent); } else { @@ -21950,9 +22207,9 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _a = 0, _b = properties.length; _a < _b; _a++) { + for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -21965,7 +22222,7 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } @@ -22032,7 +22289,7 @@ var ts; var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 174) { + else if (element.kind !== 175) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -22069,8 +22326,8 @@ var ts; var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); if (isUninitializedLet && - node.parent.parent.kind !== 184 && - node.parent.parent.kind !== 185) { + node.parent.parent.kind !== 187 && + node.parent.parent.kind !== 188) { initializer = createVoidZero(); } } @@ -22078,7 +22335,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 174) { + if (node.kind === 175) { return; } var name = node.name; @@ -22090,7 +22347,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 195 && node.parent.kind !== 152)) { + if (!node.parent || (node.parent.kind !== 198 && node.parent.kind !== 152)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -22099,24 +22356,24 @@ var ts; if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 65 || - (node.parent.kind !== 195 && node.parent.kind !== 152)) { + (node.parent.kind !== 198 && node.parent.kind !== 152)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); if (((combinedFlags & 12288) === 0) || combinedFlags & 1) { return; } - var list = ts.getAncestor(node, 196); - if (list.parent.kind === 177) { - var isSourceFileLevelBinding = list.parent.parent.kind === 224; - var isModuleLevelBinding = list.parent.parent.kind === 203; - var isFunctionLevelBinding = list.parent.parent.kind === 176 && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 199); + if (list.parent.kind === 180) { + var isSourceFileLevelBinding = list.parent.parent.kind === 227; + var isModuleLevelBinding = list.parent.parent.kind === 206; + var isFunctionLevelBinding = list.parent.parent.kind === 179 && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 224 + var parent = blockScopeContainer.kind === 227 ? blockScopeContainer : blockScopeContainer.parent; if (resolver.resolvesToSomeValue(parent, node.text)) { @@ -22131,7 +22388,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && languageVersion >= 2 && - node.parent.kind === 224; + node.parent.kind === 227; } function emitVariableStatement(node) { if (!(node.flags & 1)) { @@ -22256,8 +22513,8 @@ var ts; if (node.kind === 162) { return !!node.name; } - else if (node.kind === 197) { - return !!node.name || (languageVersion >= 2 && !(node.flags & 256)); + if (node.kind === 200) { + return !!node.name || languageVersion < 2; } } function emitFunctionDeclaration(node) { @@ -22280,7 +22537,7 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 197 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 200 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } if (node.kind !== 134 && node.kind !== 133) { @@ -22330,7 +22587,7 @@ var ts; if (!node.body) { write(" { }"); } - else if (node.body.kind === 176) { + else if (node.body.kind === 179) { emitBlockFunctionBody(node, node.body); } else { @@ -22369,7 +22626,7 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); @@ -22406,8 +22663,8 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements, _c = _b.length; _a < _c; _a++) { + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { var statement = _b[_a]; write(" "); emit(statement); @@ -22430,7 +22687,7 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 179) { + if (statement && statement.kind === 182) { var expr = statement.expression; if (expr && expr.kind === 157) { var func = expr.expression; @@ -22496,7 +22753,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 134 || node.kind === 133) { + if (member.kind === 178) { + writeLine(); + write(";"); + } + else if (member.kind === 134 || node.kind === 133) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -22563,12 +22824,14 @@ var ts; }); } function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; if ((member.kind === 134 || node.kind === 133) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 || node.kind === 133 || member.kind === 136 || member.kind === 137) { + else if (member.kind === 134 || + member.kind === 136 || + member.kind === 137) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -22586,9 +22849,13 @@ var ts; emitEnd(member); emitTrailingComments(member); } + else if (member.kind === 178) { + writeLine(); + write(";"); + } } } - function emitConstructor(node, baseTypeNode) { + function emitConstructor(node, baseTypeElement) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; @@ -22623,7 +22890,7 @@ var ts; emitSignatureParameters(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { write("(...args)"); } else { @@ -22641,7 +22908,7 @@ var ts; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); - if (baseTypeNode) { + if (baseTypeElement) { var superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); @@ -22651,16 +22918,16 @@ var ts; emitParameterPropertyAssignments(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { writeLine(); - emitStart(baseTypeNode); + emitStart(baseTypeElement); if (languageVersion < 2) { write("_super.apply(this, arguments);"); } else { write("super(...args);"); } - emitEnd(baseTypeNode); + emitEnd(baseTypeElement); } } emitMemberAssignments(node, 0); @@ -22687,28 +22954,36 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { if (languageVersion < 2) { - emitClassDeclarationBelowES6(node); + emitClassLikeDeclarationBelowES6(node); } else { - emitClassDeclarationForES6AndHigher(node); + emitClassLikeDeclarationForES6AndHigher(node); } } - function emitClassDeclarationForES6AndHigher(node) { + function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { - write("export "); + if (node.kind === 201) { + if (thisNodeIsDecorated) { + if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 256) { - write("default "); + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 256) { + write("default "); + } } } write("class"); @@ -22716,10 +22991,10 @@ var ts; write(" "); emitDeclarationName(node); } - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write(" extends "); - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); } write(" {"); increaseIndent(); @@ -22762,11 +23037,14 @@ var ts; write(";"); } } - function emitClassDeclarationBelowES6(node) { - write("var "); - emitDeclarationName(node); - write(" = (function ("); - var baseTypeNode = ts.getClassBaseTypeNode(node); + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 201) { + write("var "); + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write("_super"); } @@ -22813,11 +23091,16 @@ var ts; emitStart(node); write(")("); if (baseTypeNode) { - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 201) { + write(";"); } - write(");"); emitEnd(node); - emitExportMemberAssignment(node); + if (node.kind === 201) { + emitExportMemberAssignment(node); + } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } @@ -22961,7 +23244,7 @@ var ts; } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums; + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.separateCompilation; } function emitEnumDeclaration(node) { if (!shouldEmitEnumDeclaration(node)) { @@ -23040,13 +23323,13 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 202) { + if (moduleDeclaration.body.kind === 205) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } } function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation); } function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); @@ -23068,7 +23351,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 203) { + if (node.body.kind === 206) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -23117,16 +23400,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 208) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 206 && node.importClause && !!node.importClause.name; + return node.kind === 209 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -23153,7 +23436,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -23179,7 +23462,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 205 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 208 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -23191,7 +23474,7 @@ var ts; write(" = "); } else { - var isNakedImport = 206 && !node.importClause; + var isNakedImport = 209 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -23266,7 +23549,7 @@ var ts; emitRequire(ts.getExternalModuleName(node)); write(";"); } - for (var _a = 0, _b = node.exportClause.elements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { var specifier = _b[_a]; if (resolver.isValueAliasDeclaration(specifier)) { writeLine(); @@ -23321,7 +23604,7 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(languageVersion >= 2); var needsComma = false; - for (var _a = 0, _b = specifiers.length; _a < _b; _a++) { + for (var _a = 0; _a < specifiers.length; _a++) { var specifier = specifiers[_a]; if (shouldEmit(specifier)) { if (needsComma) { @@ -23346,8 +23629,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 197 && - expression.kind !== 198) { + if (expression.kind !== 200 && + expression.kind !== 201) { write(";"); } emitEnd(node); @@ -23368,21 +23651,21 @@ var ts; exportSpecifiers = {}; exportEquals = undefined; hasExportStars = false; - for (var _a = 0, _b = sourceFile.statements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 206: + case 209: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 205: - if (node.moduleReference.kind === 216 && resolver.isReferencedAliasDeclaration(node)) { + case 208: + if (node.moduleReference.kind === 219 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 212: + case 215: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -23393,14 +23676,14 @@ var ts; } } else { - for (var _d = 0, _e = node.exportClause.elements, _f = _e.length; _d < _f; _d++) { - var specifier = _e[_d]; + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; var name_17 = (specifier.propertyName || specifier.name).text; (exportSpecifiers[name_17] || (exportSpecifiers[name_17] = [])).push(specifier); } } break; - case 211: + case 214: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -23442,7 +23725,7 @@ var ts; write("\"" + node.amdModuleName + "\", "); } write("[\"require\", \"exports\""); - for (var _a = 0, _b = externalImports.length; _a < _b; _a++) { + for (var _a = 0; _a < externalImports.length; _a++) { var importNode = externalImports[_a]; write(", "); var moduleName = ts.getExternalModuleName(importNode); @@ -23453,15 +23736,15 @@ var ts; write("\"\""); } } - for (var _c = 0, _d = node.amdDependencies, _e = _d.length; _c < _e; _c++) { - var amdDependency = _d[_c]; + for (var _b = 0, _c = node.amdDependencies; _b < _c.length; _b++) { + var amdDependency = _c[_b]; var text = "\"" + amdDependency.path + "\""; write(", "); write(text); } write("], function (require, exports"); - for (var _f = 0, _g = externalImports.length; _f < _g; _f++) { - var importNode = externalImports[_f]; + for (var _d = 0; _d < externalImports.length; _d++) { + var importNode = externalImports[_d]; write(", "); var namespaceDeclaration = getNamespaceDeclarationNode(importNode); if (namespaceDeclaration && !isDefaultImport(importNode)) { @@ -23471,8 +23754,8 @@ var ts; write(getGeneratedNameForNode(importNode)); } } - for (var _h = 0, _j = node.amdDependencies, _k = _j.length; _h < _k; _h++) { - var amdDependency = _j[_h]; + for (var _e = 0, _f = node.amdDependencies; _e < _f.length; _e++) { + var amdDependency = _f[_e]; if (amdDependency.name) { write(", "); write(amdDependency.name); @@ -23605,19 +23888,19 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 199: - case 197: - case 206: - case 205: - case 200: - case 211: - return false; case 202: + case 200: + case 209: + case 208: + case 203: + case 214: + return false; + case 205: return shouldEmitModuleDeclaration(node); - case 201: + case 204: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 176 && + if (node.kind !== 179 && node.parent && node.parent.kind === 163 && node.parent.body === node && @@ -23659,7 +23942,7 @@ var ts; return emitLiteral(node); case 171: return emitTemplateExpression(node); - case 175: + case 176: return emitTemplateSpan(node); case 126: return emitQualifiedName(node); @@ -23673,9 +23956,9 @@ var ts; return emitArrayLiteral(node); case 154: return emitObjectLiteral(node); - case 221: + case 224: return emitPropertyAssignment(node); - case 222: + case 225: return emitShorthandPropertyAssignment(node); case 127: return emitComputedPropertyName(node); @@ -23693,7 +23976,7 @@ var ts; return emit(node.expression); case 161: return emitParenExpression(node); - case 197: + case 200: case 162: case 163: return emitFunctionDeclaration(node); @@ -23713,71 +23996,73 @@ var ts; return emitConditionalExpression(node); case 173: return emitSpreadElementExpression(node); - case 174: + case 175: return; - case 176: - case 203: - return emitBlock(node); - case 177: - return emitVariableStatement(node); - case 178: - return write(";"); case 179: - return emitExpressionStatement(node); - case 180: - return emitIfStatement(node); - case 181: - return emitDoStatement(node); - case 182: - return emitWhileStatement(node); - case 183: - return emitForStatement(node); - case 185: - case 184: - return emitForInOrForOfStatement(node); - case 186: - case 187: - return emitBreakOrContinueStatement(node); - case 188: - return emitReturnStatement(node); - case 189: - return emitWithStatement(node); - case 190: - return emitSwitchStatement(node); - case 217: - case 218: - return emitCaseOrDefaultClause(node); - case 191: - return emitLabelledStatement(node); - case 192: - return emitThrowStatement(node); - case 193: - return emitTryStatement(node); - case 220: - return emitCatchClause(node); - case 194: - return emitDebuggerStatement(node); - case 195: - return emitVariableDeclaration(node); - case 198: - return emitClassDeclaration(node); - case 199: - return emitInterfaceDeclaration(node); - case 201: - return emitEnumDeclaration(node); - case 223: - return emitEnumMember(node); - case 202: - return emitModuleDeclaration(node); case 206: - return emitImportDeclaration(node); + return emitBlock(node); + case 180: + return emitVariableStatement(node); + case 181: + return write(";"); + case 182: + return emitExpressionStatement(node); + case 183: + return emitIfStatement(node); + case 184: + return emitDoStatement(node); + case 185: + return emitWhileStatement(node); + case 186: + return emitForStatement(node); + case 188: + case 187: + return emitForInOrForOfStatement(node); + case 189: + case 190: + return emitBreakOrContinueStatement(node); + case 191: + return emitReturnStatement(node); + case 192: + return emitWithStatement(node); + case 193: + return emitSwitchStatement(node); + case 220: + case 221: + return emitCaseOrDefaultClause(node); + case 194: + return emitLabelledStatement(node); + case 195: + return emitThrowStatement(node); + case 196: + return emitTryStatement(node); + case 223: + return emitCatchClause(node); + case 197: + return emitDebuggerStatement(node); + case 198: + return emitVariableDeclaration(node); + case 174: + return emitClassExpression(node); + case 201: + return emitClassDeclaration(node); + case 202: + return emitInterfaceDeclaration(node); + case 204: + return emitEnumDeclaration(node); + case 226: + return emitEnumMember(node); case 205: + return emitModuleDeclaration(node); + case 209: + return emitImportDeclaration(node); + case 208: return emitImportEqualsDeclaration(node); - case 212: + case 215: return emitExportDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFileNode(node); } } @@ -23805,7 +24090,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.pos !== node.parent.pos) { + if (node.parent.kind === 227 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -23817,7 +24102,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.end !== node.parent.end) { + if (node.parent.kind === 227 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -23911,7 +24196,7 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0.0"; + ts.version = "1.5.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -24234,7 +24519,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 206 || node.kind === 205 || node.kind === 212) { + if (node.kind === 209 || node.kind === 208 || node.kind === 215) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -24254,7 +24539,7 @@ var ts; } } } - else if (node.kind === 202 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 205 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { @@ -24276,6 +24561,20 @@ var ts; } } function verifyCompilerOptions() { + if (options.separateCompilation) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation)); + } + if (options.declaration) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation)); + } + if (options.noEmitOnError) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation)); + } + if (options.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); + } + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); @@ -24287,11 +24586,19 @@ var ts; } var languageVersion = options.target || 0; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); - if (firstExternalModuleSourceFile && !options.module) { + if (options.separateCompilation) { if (!options.module && languageVersion < 2) { - var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } + var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); + if (firstNonExternalModuleSourceFile) { + var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + } + } + else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { + var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher)); @@ -24354,10 +24661,6 @@ var ts; name: "charset", type: "string" }, - { - name: "codepage", - type: "number" - }, { name: "declaration", shortName: "d", @@ -24423,10 +24726,6 @@ var ts; name: "noLib", type: "boolean" }, - { - name: "noLibCheck", - type: "boolean" - }, { name: "noResolve", type: "boolean" @@ -24462,6 +24761,10 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "separateCompilation", + type: "boolean" + }, { name: "sourceMap", type: "boolean", @@ -24485,18 +24788,6 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, - { - name: "preserveNewLines", - type: "boolean", - description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, - experimental: true - }, - { - name: "cacheDownlevelForOfLength", - type: "boolean", - description: "Cache length access when downlevel emitting for-of statements", - experimental: true - }, { name: "target", shortName: "t", @@ -24739,23 +25030,23 @@ var ts; return; } switch (n.kind) { - case 176: + case 179: if (!ts.isFunctionBlock(n)) { var parent_6 = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent_6.kind === 181 || - parent_6.kind === 184 || - parent_6.kind === 185 || + if (parent_6.kind === 184 || + parent_6.kind === 187 || + parent_6.kind === 188 || + parent_6.kind === 186 || parent_6.kind === 183 || - parent_6.kind === 180 || - parent_6.kind === 182 || - parent_6.kind === 189 || - parent_6.kind === 220) { + parent_6.kind === 185 || + parent_6.kind === 192 || + parent_6.kind === 223) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_6.kind === 193) { + if (parent_6.kind === 196) { var tryStatement = parent_6; if (tryStatement.tryBlock === n) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); @@ -24778,17 +25069,17 @@ var ts; }); break; } - case 203: { + case 206: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 198: - case 199: case 201: + case 202: + case 204: case 154: - case 204: { + case 207: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -24820,7 +25111,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -24852,7 +25143,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -24933,7 +25224,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < bestMatchKind) { @@ -24980,14 +25271,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 202: + case 205: do { current = current.parent; - } while (current.kind === 202); - case 198: + } while (current.kind === 205); case 201: - case 199: - case 197: + case 204: + case 202: + case 200: indent++; } current = current.parent; @@ -24998,26 +25289,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 177: + case 180: ts.forEach(node.declarationList.declarations, visit); break; case 150: case 151: ts.forEach(node.elements, visit); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { childNodes.push(importClause.namedBindings); } else { @@ -25027,19 +25318,19 @@ var ts; } break; case 152: - case 195: + case 198: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 198: case 201: - case 199: + case 204: case 202: - case 197: case 205: - case 210: - case 214: + case 200: + case 208: + case 213: + case 217: childNodes.push(node); break; } @@ -25071,20 +25362,20 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 198: case 201: - case 199: + case 204: + case 202: topLevelNodes.push(node); break; - case 202: + case 205: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 197: + case 200: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -25095,9 +25386,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 197) { - if (functionDeclaration.body && functionDeclaration.body.kind === 176) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 197 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 200) { + if (functionDeclaration.body && functionDeclaration.body.kind === 179) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 200 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -25110,7 +25401,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; var item_3 = createItem(child); if (item_3 !== undefined) { @@ -25135,9 +25426,9 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems, _n = _a.length; _i < _n; _i++) { + outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { var sourceChild = _a[_i]; - for (var _b = 0, _c = target.childItems, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); @@ -25167,7 +25458,7 @@ var ts; return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); case 140: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 223: + case 226: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); case 138: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); @@ -25176,16 +25467,16 @@ var ts; case 132: case 131: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 197: + case 200: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 195: + case 198: case 152: var variableDeclarationNode; var name_18; if (node.kind === 152) { name_18 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 195) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 198) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -25206,11 +25497,11 @@ var ts; } case 135: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 214: - case 210: - case 205: - case 207: + case 217: + case 213: case 208: + case 210: + case 211: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -25240,17 +25531,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 224: + case 227: return createSourceFileItem(node); - case 198: - return createClassItem(node); case 201: + return createClassItem(node); + case 204: return createEnumItem(node); - case 199: - return createIterfaceItem(node); case 202: + return createIterfaceItem(node); + case 205: return createModuleItem(node); - case 197: + case 200: return createFunctionItem(node); } return undefined; @@ -25260,7 +25551,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 202) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 205) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -25272,7 +25563,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if ((node.name || node.flags & 256) && node.body && node.body.kind === 176) { + if ((node.name || node.flags & 256) && node.body && node.body.kind === 179) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem((!node.name && node.flags & 256) ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -25320,13 +25611,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 202) { + while (node.body.kind === 205) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 224 + return node.kind === 227 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -25418,7 +25709,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0, _n = wordSpans.length; _i < _n; _i++) { + for (var _i = 0; _i < wordSpans.length; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -25471,7 +25762,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0, _n = subWordTextChunks.length; _i < _n; _i++) { + for (var _i = 0; _i < subWordTextChunks.length; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -25862,7 +26153,7 @@ var ts; var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 175 && node.parent.parent.parent.kind === 159) { + else if (node.parent.kind === 176 && node.parent.parent.parent.kind === 159) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; @@ -25879,7 +26170,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0, _n = listChildren.length; _i < _n; _i++) { + for (var _i = 0; _i < listChildren.length; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -25939,7 +26230,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 224; n = n.parent) { + for (var n = node; n.kind !== 227; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -26120,17 +26411,17 @@ var ts; return false; } switch (n.kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 154: case 150: case 145: - case 176: - case 203: - case 204: + case 179: + case 206: + case 207: return nodeEndsWith(n, 15, sourceFile); - case 220: + case 223: return isCompletedNode(n.block, sourceFile); case 158: if (!n.arguments) { @@ -26146,7 +26437,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 134: case 133: @@ -26160,14 +26451,14 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 17, sourceFile); - case 202: + case 205: return n.body && isCompletedNode(n.body, sourceFile); - case 180: + case 183: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 179: + case 182: return isCompletedNode(n.expression, sourceFile); case 153: case 151: @@ -26180,15 +26471,15 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19, sourceFile); - case 217: - case 218: + case 220: + case 221: return false; - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: return isCompletedNode(n.statement, sourceFile); - case 181: + case 184: var hasWhileKeyword = findChildOfKind(n, 100, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 17, sourceFile); @@ -26208,7 +26499,7 @@ var ts; case 171: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 175: + case 176: return ts.nodeIsPresent(n.literal); case 167: return isCompletedNode(n.operand, sourceFile); @@ -26257,7 +26548,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 225 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 228 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -26322,7 +26613,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); @@ -26363,7 +26654,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 224); + ts.Debug.assert(startNode !== undefined || n.kind === 227); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -26403,7 +26694,7 @@ var ts; if (node.kind === 141 || node.kind === 157) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 198 || node.kind === 199) { + if (ts.isFunctionLike(node) || node.kind === 201 || node.kind === 202) { return node.typeParameters; } return undefined; @@ -27145,7 +27436,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -27329,7 +27620,7 @@ var ts; throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 183; + return context.contextNode.kind === 186; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); @@ -27339,16 +27630,16 @@ var ts; case 169: case 170: return true; - case 205: - case 195: + case 208: + case 198: case 129: - case 223: + case 226: case 132: case 131: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; - case 184: + case 187: return context.currentTokenSpan.kind === 86 || context.nextTokenSpan.kind === 86; - case 185: + case 188: return context.currentTokenSpan.kind === 125 || context.nextTokenSpan.kind === 125; case 152: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; @@ -27400,17 +27691,17 @@ var ts; return true; } switch (node.kind) { - case 176: - case 204: + case 179: + case 207: case 154: - case 203: + case 206: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 197: + case 200: case 134: case 133: case 136: @@ -27419,7 +27710,7 @@ var ts; case 162: case 135: case 163: - case 199: + case 202: return true; } return false; @@ -27429,40 +27720,40 @@ var ts; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 198: - case 199: case 201: - case 145: case 202: + case 204: + case 145: + case 205: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 198: - case 202: case 201: - case 176: - case 220: - case 203: - case 190: + case 205: + case 204: + case 179: + case 223: + case 206: + case 193: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 180: - case 190: case 183: - case 184: - case 185: - case 182: case 193: - case 181: - case 189: - case 220: + case 186: + case 187: + case 188: + case 185: + case 196: + case 184: + case 192: + case 223: return true; default: return false; @@ -27487,14 +27778,14 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 196 && + return context.currentTokenParent.kind === 199 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 202; + return context.contextNode.kind === 205; }; Rules.IsObjectTypeContext = function (context) { return context.contextNode.kind === 145; @@ -27505,9 +27796,9 @@ var ts; } switch (parent.kind) { case 141: - case 198: - case 199: - case 197: + case 201: + case 202: + case 200: case 162: case 163: case 134: @@ -27598,7 +27889,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(), _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -28016,17 +28307,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 198: - case 199: - return ts.rangeContainsRange(parent.members, node); + case 201: case 202: + return ts.rangeContainsRange(parent.members, node); + case 205: var body = parent.body; - return body && body.kind === 176 && ts.rangeContainsRange(body.statements, node); - case 224: - case 176: - case 203: + return body && body.kind === 179 && ts.rangeContainsRange(body.statements, node); + case 227: + case 179: + case 206: return ts.rangeContainsRange(parent.statements, node); - case 220: + case 223: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -28145,9 +28436,9 @@ var ts; if (indentation === -1) { if (isSomeBlock(node.kind)) { if (isSomeBlock(parent.kind) || - parent.kind === 224 || - parent.kind === 217 || - parent.kind === 218) { + parent.kind === 227 || + parent.kind === 220 || + parent.kind === 221) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -28178,10 +28469,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 198: return 69; - case 199: return 104; - case 197: return 83; - case 201: return 201; + case 201: return 69; + case 202: return 104; + case 200: return 83; + case 204: return 204; case 136: return 116; case 137: return 120; case 134: @@ -28320,7 +28611,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, true); } @@ -28365,7 +28656,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -28400,7 +28691,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0, _n = trivia.length; _i < _n; _i++) { + for (var _i = 0; _i < trivia.length; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -28580,8 +28871,8 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 176: - case 203: + case 179: + case 206: return true; } return false; @@ -28589,7 +28880,7 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 135: - case 197: + case 200: case 162: case 134: case 133: @@ -28796,7 +29087,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 224 || !parentAndChildShareLine); + (parent.kind === 227 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -28820,7 +29111,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 180 && parent.elseStatement === child) { + if (parent.kind === 183 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 76, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -28842,7 +29133,7 @@ var ts; return node.parent.properties; case 153: return node.parent.elements; - case 197: + case 200: case 162: case 163: case 134: @@ -28929,25 +29220,25 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 153: - case 176: - case 203: + case 179: + case 206: case 154: case 145: case 147: - case 204: - case 218: - case 217: + case 207: + case 221: + case 220: case 161: case 157: case 158: - case 177: - case 195: - case 211: - case 188: + case 180: + case 198: + case 214: + case 191: case 170: case 151: case 150: @@ -28960,13 +29251,13 @@ var ts; return true; } switch (parent) { - case 181: - case 182: case 184: case 185: + case 187: + case 188: + case 186: case 183: - case 180: - case 197: + case 200: case 162: case 134: case 133: @@ -28975,7 +29266,7 @@ var ts; case 135: case 136: case 137: - return child !== 176; + return child !== 179; default: return false; } @@ -29077,10 +29368,10 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(225, nodes.pos, nodes.end, 1024, this); + var list = createNode(228, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -29139,7 +29430,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (child.kind < 126) { return child; @@ -29205,13 +29496,13 @@ var ts; } }); } - if (declaration.kind === 202 && declaration.body.kind === 202) { + if (declaration.kind === 205 && declaration.body.kind === 205) { return; } - while (declaration.kind === 202 && declaration.parent.kind === 202) { + while (declaration.kind === 205 && declaration.parent.kind === 205) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 195 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 198 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -29496,7 +29787,7 @@ var ts; var namedDeclarations = []; ts.forEachChild(sourceFile, function visit(node) { switch (node.kind) { - case 197: + case 200: case 134: case 133: var functionDeclaration = node; @@ -29515,17 +29806,17 @@ var ts; ts.forEachChild(node, visit); } break; - case 198: - case 199: - case 200: case 201: case 202: + case 203: + case 204: case 205: - case 214: - case 210: - case 205: - case 207: case 208: + case 217: + case 213: + case 208: + case 210: + case 211: case 136: case 137: case 145: @@ -29533,14 +29824,14 @@ var ts; namedDeclarations.push(node); } case 135: - case 177: - case 196: + case 180: + case 199: case 150: case 151: - case 203: + case 206: ts.forEachChild(node, visit); break; - case 176: + case 179: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } @@ -29549,30 +29840,30 @@ var ts; if (!(node.flags & 112)) { break; } - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 223: + case 226: case 132: case 131: namedDeclarations.push(node); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { namedDeclarations.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { namedDeclarations.push(importClause.namedBindings); } else { @@ -29730,11 +30021,11 @@ var ts; if (declaration.kind === 162) { return true; } - if (declaration.kind !== 195 && declaration.kind !== 197) { + if (declaration.kind !== 198 && declaration.kind !== 200) { return false; } for (var parent_7 = declaration.parent; !ts.isFunctionBlock(parent_7); parent_7 = parent_7.parent) { - if (parent_7.kind === 224 || parent_7.kind === 203) { + if (parent_7.kind === 227 || parent_7.kind === 206) { return false; } } @@ -29775,7 +30066,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -29859,6 +30150,37 @@ var ts; sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; } + function transpile(input, compilerOptions, fileName, diagnostics) { + var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions(); + options.separateCompilation = true; + options.allowNonTsExtensions = true; + var inputFileName = fileName || "module.ts"; + var sourceFile = ts.createSourceFile(inputFileName, input, options.target); + if (diagnostics && sourceFile.parseDiagnostics) { + diagnostics.push.apply(diagnostics, sourceFile.parseDiagnostics); + } + var outputText; + var compilerHost = { + getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, + writeFile: function (name, text, writeByteOrderMark) { + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + outputText = text; + }, + getDefaultLibFileName: function () { return "lib.d.ts"; }, + useCaseSensitiveFileNames: function () { return false; }, + getCanonicalFileName: function (fileName) { return fileName; }, + getCurrentDirectory: function () { return ""; }, + getNewLine: function () { return "\r\n"; } + }; + var program = ts.createProgram([inputFileName], options, compilerHost); + if (diagnostics) { + diagnostics.push.apply(diagnostics, program.getGlobalDiagnostics()); + } + program.emit(); + ts.Debug.assert(outputText !== undefined, "Output generation failed"); + return outputText; + } + ts.transpile = transpile; function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { var sourceFile = ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); setSourceFileFields(sourceFile, scriptSnapshot, version); @@ -30100,7 +30422,7 @@ var ts; ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 191 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 194 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -30109,16 +30431,16 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 65 && - (node.parent.kind === 187 || node.parent.kind === 186) && + (node.parent.kind === 190 || node.parent.kind === 189) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 65 && - node.parent.kind === 191 && + node.parent.kind === 194 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 191; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 194; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -30147,7 +30469,7 @@ var ts; return node && node.parent && node.parent.kind === 158 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 202 && node.parent.name === node; + return node.parent.kind === 205 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 65 && @@ -30155,20 +30477,20 @@ var ts; } function isNameOfPropertyAssignment(node) { return (node.kind === 65 || node.kind === 8 || node.kind === 7) && - (node.parent.kind === 221 || node.parent.kind === 222) && node.parent.name === node; + (node.parent.kind === 224 || node.parent.kind === 225) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { case 132: case 131: - case 221: - case 223: + case 224: + case 226: case 134: case 133: case 136: case 137: - case 202: + case 205: return node.parent.name === node; case 156: return node.parent.argumentExpression === node; @@ -30237,17 +30559,17 @@ var ts; return undefined; } switch (node.kind) { - case 224: + case 227: case 134: case 133: - case 197: + case 200: case 162: case 136: case 137: - case 198: - case 199: case 201: case 202: + case 204: + case 205: return node; } } @@ -30255,18 +30577,18 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 202: return ScriptElementKind.moduleElement; - case 198: return ScriptElementKind.classElement; - case 199: return ScriptElementKind.interfaceElement; - case 200: return ScriptElementKind.typeElement; - case 201: return ScriptElementKind.enumElement; - case 195: + case 205: return ScriptElementKind.moduleElement; + case 201: return ScriptElementKind.classElement; + case 202: return ScriptElementKind.interfaceElement; + case 203: return ScriptElementKind.typeElement; + case 204: return ScriptElementKind.enumElement; + case 198: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 197: return ScriptElementKind.functionElement; + case 200: return ScriptElementKind.functionElement; case 136: return ScriptElementKind.memberGetAccessorElement; case 137: return ScriptElementKind.memberSetAccessorElement; case 134: @@ -30280,13 +30602,13 @@ var ts; case 138: return ScriptElementKind.callSignatureElement; case 135: return ScriptElementKind.constructorImplementationElement; case 128: return ScriptElementKind.typeParameterElement; - case 223: return ScriptElementKind.variableElement; + case 226: return ScriptElementKind.variableElement; case 129: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 205: - case 210: - case 207: - case 214: case 208: + case 213: + case 210: + case 217: + case 211: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -30346,7 +30668,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0, _n = oldSourceFiles.length; _i < _n; _i++) { + for (var _i = 0; _i < oldSourceFiles.length; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -30381,7 +30703,7 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; if (!sourceFileUpToDate(program.getSourceFile(fileName))) { return false; @@ -30429,6 +30751,12 @@ var ts; if (!displayName) { return undefined; } + if (displayName === "default") { + var localSymbol = ts.getLocalSymbolForExportDefault(symbol); + if (localSymbol && localSymbol.name) { + displayName = symbol.valueDeclaration.localSymbol.name; + } + } var firstCharCode = displayName.charCodeAt(0); if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; @@ -30545,11 +30873,11 @@ var ts; symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); } } - else if (ts.getAncestor(contextToken, 207)) { + else if (ts.getAncestor(contextToken, 210)) { isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(contextToken)) { - var importDeclaration = ts.getAncestor(contextToken, 206); + var importDeclaration = ts.getAncestor(contextToken, 209); ts.Debug.assert(importDeclaration !== undefined); var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); symbols = filterModuleExports(exports, importDeclaration); @@ -30564,7 +30892,7 @@ var ts; var adjustedPosition = previousToken !== contextToken ? previousToken.getStart() : position; - var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile); + var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; var symbolMeanings = 793056 | 107455 | 1536 | 8388608; symbols = typeInfoResolver.getSymbolsInScope(scopeNode, symbolMeanings); } @@ -30589,7 +30917,7 @@ var ts; function showCompletionsInImportsClause(node) { if (node) { if (node.kind === 14 || node.kind === 23) { - return node.parent.kind === 209; + return node.parent.kind === 212; } } return false; @@ -30614,16 +30942,16 @@ var ts; case 117: return true; case 20: - return containingNodeKind === 202; + return containingNodeKind === 205; case 14: - return containingNodeKind === 198; + return containingNodeKind === 201; case 53: - return containingNodeKind === 195 + return containingNodeKind === 198 || containingNodeKind === 169; case 11: return containingNodeKind === 171; case 12: - return containingNodeKind === 175; + return containingNodeKind === 176; case 109: case 107: case 108: @@ -30672,7 +31000,7 @@ var ts; switch (kind) { case 162: case 163: - case 197: + case 200: case 134: case 133: case 136: @@ -30689,14 +31017,14 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 195 || - containingNodeKind === 196 || - containingNodeKind === 177 || - containingNodeKind === 201 || - isFunction(containingNodeKind) || - containingNodeKind === 198 || - containingNodeKind === 197 || + return containingNodeKind === 198 || containingNodeKind === 199 || + containingNodeKind === 180 || + containingNodeKind === 204 || + isFunction(containingNodeKind) || + containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || containingNodeKind === 151 || containingNodeKind === 150; case 20: @@ -30704,21 +31032,21 @@ var ts; case 18: return containingNodeKind === 151; case 16: - return containingNodeKind === 220 || + return containingNodeKind === 223 || isFunction(containingNodeKind); case 14: - return containingNodeKind === 201 || - containingNodeKind === 199 || + return containingNodeKind === 204 || + containingNodeKind === 202 || containingNodeKind === 145 || containingNodeKind === 150; case 22: return containingNodeKind === 131 && - (previousToken.parent.parent.kind === 199 || + (previousToken.parent.parent.kind === 202 || previousToken.parent.parent.kind === 145); case 24: - return containingNodeKind === 198 || - containingNodeKind === 197 || - containingNodeKind === 199 || + return containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || isFunction(containingNodeKind); case 110: return containingNodeKind === 132; @@ -30771,7 +31099,7 @@ var ts; return exports; } if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 209) { + importDeclaration.importClause.namedBindings.kind === 212) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -30788,7 +31116,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 221 && m.kind !== 222) { + if (m.kind !== 224 && m.kind !== 225) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -30824,7 +31152,7 @@ var ts; var start = new Date().getTime(); var entries = []; var nameToSymbol = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; var entry = createCompletionEntry(symbol, typeInfoResolver, location); if (entry) { @@ -31139,7 +31467,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 223) { + if (declaration.kind === 226) { var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -31155,7 +31483,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 205) { + if (declaration.kind === 208) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -31354,7 +31682,7 @@ var ts; symbol = typeInfoResolver.getAliasedSymbol(symbol); } } - if (node.parent.kind === 222) { + if (node.parent.kind === 225) { var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -31382,7 +31710,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 114) { if (symbol.flags & 32) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 198); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 201); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -31399,7 +31727,7 @@ var ts; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 135) || - (!selectConstructors && (d.kind === 197 || d.kind === 134 || d.kind === 133))) { + (!selectConstructors && (d.kind === 200 || d.kind === 134 || d.kind === 133))) { declarations.push(d); if (d.body) definition = d; @@ -31417,6 +31745,17 @@ var ts; } } function getOccurrencesAtPosition(fileName, position) { + var results = getOccurrencesAtPositionCore(fileName, position); + if (results) { + var sourceFile = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results.forEach(function (value) { + var targetFile = getCanonicalFileName(ts.normalizeSlashes(value.fileName)); + ts.Debug.assert(sourceFile == targetFile, "Unexpected file in results. Found results in " + targetFile + " expected only results in " + sourceFile + "."); + }); + } + return results; + } + function getOccurrencesAtPositionCore(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingWord(sourceFile, position); @@ -31430,58 +31769,58 @@ var ts; switch (node.kind) { case 84: case 76: - if (hasKind(node.parent, 180)) { + if (hasKind(node.parent, 183)) { return getIfElseOccurrences(node.parent); } break; case 90: - if (hasKind(node.parent, 188)) { + if (hasKind(node.parent, 191)) { return getReturnOccurrences(node.parent); } break; case 94: - if (hasKind(node.parent, 192)) { + if (hasKind(node.parent, 195)) { return getThrowOccurrences(node.parent); } break; case 68: - if (hasKind(parent(parent(node)), 193)) { + if (hasKind(parent(parent(node)), 196)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 96: case 81: - if (hasKind(parent(node), 193)) { + if (hasKind(parent(node), 196)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 92: - if (hasKind(node.parent, 190)) { + if (hasKind(node.parent, 193)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 67: case 73: - if (hasKind(parent(parent(parent(node))), 190)) { + if (hasKind(parent(parent(parent(node))), 193)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 66: case 71: - if (hasKind(node.parent, 187) || hasKind(node.parent, 186)) { + if (hasKind(node.parent, 190) || hasKind(node.parent, 189)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 82: - if (hasKind(node.parent, 183) || - hasKind(node.parent, 184) || - hasKind(node.parent, 185)) { + if (hasKind(node.parent, 186) || + hasKind(node.parent, 187) || + hasKind(node.parent, 188)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 100: case 75: - if (hasKind(node.parent, 182) || hasKind(node.parent, 181)) { + if (hasKind(node.parent, 185) || hasKind(node.parent, 184)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -31497,14 +31836,14 @@ var ts; } default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 177)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 180)) { return getModifierOccurrences(node.kind, node.parent); } } return undefined; function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 180) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 183) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -31515,7 +31854,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 180)) { + if (!hasKind(ifStatement.elseStatement, 183)) { break; } ifStatement = ifStatement.elseStatement; @@ -31548,7 +31887,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 176))) { + if (!(func && hasKind(func.body, 179))) { return undefined; } var keywords = []; @@ -31581,10 +31920,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 192) { + if (node.kind === 195) { statementAccumulator.push(node); } - else if (node.kind === 193) { + else if (node.kind === 196) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -31606,10 +31945,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent_9 = child.parent; - if (ts.isFunctionBlock(parent_9) || parent_9.kind === 224) { + if (ts.isFunctionBlock(parent_9) || parent_9.kind === 227) { return parent_9; } - if (parent_9.kind === 193) { + if (parent_9.kind === 196) { var tryStatement = parent_9; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -31634,7 +31973,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 82, 100, 75)) { - if (loopNode.kind === 181) { + if (loopNode.kind === 184) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 100)) { @@ -31669,13 +32008,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return getLoopBreakContinueOccurrences(owner); - case 190: + case 193: return getSwitchCaseDefaultOccurrences(owner); } } @@ -31686,7 +32025,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 187 || node.kind === 186) { + if (node.kind === 190 || node.kind === 189) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -31702,15 +32041,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { switch (node_1.kind) { - case 190: - if (statement.kind === 186) { + case 193: + if (statement.kind === 189) { continue; } - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: - case 181: + case 184: if (!statement.label || isLabeledBy(node_1, statement.label.text)) { return node_1; } @@ -31749,18 +32088,18 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 198 || + if (!(container.kind === 201 || (declaration.kind === 129 && hasKind(container, 135)))) { return undefined; } } else if (modifier === 110) { - if (container.kind !== 198) { + if (container.kind !== 201) { return undefined; } } else if (modifier === 78 || modifier === 115) { - if (!(container.kind === 203 || container.kind === 224)) { + if (!(container.kind === 206 || container.kind === 227)) { return undefined; } } @@ -31771,14 +32110,14 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 203: - case 224: + case 206: + case 227: nodes = container.statements; break; case 135: nodes = container.parameters.concat(container.parent.members); break; - case 198: + case 201: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { @@ -31840,7 +32179,7 @@ var ts; return undefined; } var referenceEntries = []; - for (var _i = 0, _n = referenceSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < referenceSymbols.length; _i++) { var referenceSymbol = referenceSymbols[_i]; ts.addRange(referenceEntries, referenceSymbol.references); } @@ -31943,12 +32282,12 @@ var ts; } function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 210 || location.parent.kind === 214) && + (location.parent.kind === 213 || location.parent.kind === 217) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 210 || declaration.kind === 214; + return declaration.kind === 213 || declaration.kind === 217; }); } function getDeclaredName(symbol, location) { @@ -31985,7 +32324,7 @@ var ts; if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 198); + return ts.getAncestor(privateDeclaration, 201); } } if (symbol.flags & 8388608) { @@ -31997,7 +32336,7 @@ var ts; var scope = undefined; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -32006,7 +32345,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 224 && !ts.isExternalModule(container)) { + if (container.kind === 227 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -32212,11 +32551,11 @@ var ts; staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 224: + case 227: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 197: + case 200: case 162: break; default: @@ -32224,7 +32563,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 224) { + if (searchSpaceNode.kind === 227) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -32256,7 +32595,7 @@ var ts; var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { case 162: - case 197: + case 200: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } @@ -32267,13 +32606,13 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; - case 198: + case 201: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 224: - if (container.kind === 224 && !ts.isExternalModule(container)) { + case 227: + if (container.kind === 227 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -32308,11 +32647,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 198) { - getPropertySymbolFromTypeReference(ts.getClassBaseTypeNode(declaration)); - ts.forEach(ts.getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); + if (declaration.kind === 201) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 199) { + else if (declaration.kind === 202) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -32395,7 +32734,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -32463,32 +32802,32 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: - case 220: + case 223: return 1; case 128: - case 199: - case 200: + case 202: + case 203: case 145: return 2; - case 198: case 201: + case 204: return 1 | 2; - case 202: + case 205: if (node.name.kind === 8) { return 4 | 1; } @@ -32498,31 +32837,51 @@ var ts; else { return 4; } - case 209: - case 210: - case 205: - case 206: - case 211: case 212: + case 213: + case 208: + case 209: + case 214: + case 215: return 1 | 2 | 4; - case 224: + case 227: return 4 | 1; } return 1 | 2 | 4; ts.Debug.fail("Unknown declaration type"); } function isTypeReference(node) { - if (isRightSideOfQualifiedName(node)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 141; + return node.parent.kind === 141 || node.parent.kind === 177; } function isNamespaceReference(node) { + return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); + } + function isPropertyAccessNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 155) { + while (root.parent && root.parent.kind === 155) { + root = root.parent; + } + isLastClause = root.name === node; + } + if (!isLastClause && root.parent.kind === 177 && root.parent.parent.kind === 222) { + var decl = root.parent.parent.parent; + return (decl.kind === 201 && root.parent.parent.token === 103) || + (decl.kind === 202 && root.parent.parent.token === 79); + } + return false; + } + function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; if (root.parent.kind === 126) { - while (root.parent && root.parent.kind === 126) + while (root.parent && root.parent.kind === 126) { root = root.parent; + } isLastClause = root.right === node; } return root.parent.kind === 141 && !isLastClause; @@ -32537,13 +32896,13 @@ var ts; ts.Debug.assert(node.kind === 65); if (node.parent.kind === 126 && node.parent.right === node && - node.parent.parent.kind === 205) { + node.parent.parent.kind === 208) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 211) { + if (node.parent.kind === 214) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -32596,7 +32955,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 202 && + if (nodeForStartPos.parent.parent.kind === 205 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -32652,7 +33011,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 202 && ts.getModuleInstanceState(declaration) == 1; + return declaration.kind === 205 && ts.getModuleInstanceState(declaration) == 1; }); } } @@ -32770,7 +33129,7 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 53) { - if (token.parent.kind === 195 || + if (token.parent.kind === 198 || token.parent.kind === 132 || token.parent.kind === 129) { return ClassificationTypeNames.operator; @@ -32800,7 +33159,7 @@ var ts; else if (tokenKind === 65) { if (token) { switch (token.parent.kind) { - case 198: + case 201: if (token.parent.name === token) { return ClassificationTypeNames.className; } @@ -32810,17 +33169,17 @@ var ts; return ClassificationTypeNames.typeParameterName; } return; - case 199: + case 202: if (token.parent.name === token) { return ClassificationTypeNames.interfaceName; } return; - case 201: + case 204: if (token.parent.name === token) { return ClassificationTypeNames.enumName; } return; - case 202: + case 205: if (token.parent.name === token) { return ClassificationTypeNames.moduleName; } @@ -32833,7 +33192,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -32858,7 +33217,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0, _n = childNodes.length; _i < _n; _i++) { + for (var _i = 0; _i < childNodes.length; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -32991,7 +33350,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var sourceFile_1 = current.getSourceFile(); if (sourceFile_1 && getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { @@ -33081,7 +33440,7 @@ var ts; case 8: case 7: if (ts.isDeclarationName(node) || - node.parent.kind === 216 || + node.parent.kind === 219 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -33382,7 +33741,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 224 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 227 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -33439,10 +33798,10 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } - if (node.parent.kind === 183) { + if (node.parent.kind === 186) { return textSpan(node); } if (node.parent.kind === 169 && node.parent.operatorToken.kind === 23) { @@ -33453,15 +33812,15 @@ var ts; } } switch (node.kind) { - case 177: + case 180: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 195: + case 198: case 132: case 131: return spanInVariableDeclaration(node); case 129: return spanInParameterDeclaration(node); - case 197: + case 200: case 134: case 133: case 136: @@ -33470,70 +33829,70 @@ var ts; case 162: case 163: return spanInFunctionDeclaration(node); - case 176: + case 179: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 203: + case 206: return spanInBlock(node); - case 220: + case 223: return spanInBlock(node.block); - case 179: - return textSpan(node.expression); - case 188: - return textSpan(node.getChildAt(0), node.expression); case 182: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 181: - return spanInNode(node.statement); - case 194: - return textSpan(node.getChildAt(0)); - case 180: - return textSpan(node, ts.findNextToken(node.expression, node)); + return textSpan(node.expression); case 191: - return spanInNode(node.statement); - case 187: - case 186: - return textSpan(node.getChildAt(0), node.label); - case 183: - return spanInForStatement(node); - case 184: + return textSpan(node.getChildAt(0), node.expression); case 185: return textSpan(node, ts.findNextToken(node.expression, node)); + case 184: + return spanInNode(node.statement); + case 197: + return textSpan(node.getChildAt(0)); + case 183: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 194: + return spanInNode(node.statement); case 190: + case 189: + return textSpan(node.getChildAt(0), node.label); + case 186: + return spanInForStatement(node); + case 187: + case 188: return textSpan(node, ts.findNextToken(node.expression, node)); - case 217: - case 218: - return spanInNode(node.statements[0]); case 193: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 220: + case 221: + return spanInNode(node.statements[0]); + case 196: return spanInBlock(node.tryBlock); - case 192: + case 195: return textSpan(node, node.expression); - case 211: + case 214: if (!node.expression) { return undefined; } return textSpan(node, node.expression); - case 205: + case 208: return textSpan(node, node.moduleReference); - case 206: + case 209: return textSpan(node, node.moduleSpecifier); - case 212: + case 215: return textSpan(node, node.moduleSpecifier); - case 202: + case 205: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 198: case 201: - case 223: + case 204: + case 226: case 157: case 158: return textSpan(node); - case 189: + case 192: return spanInNode(node.statement); - case 199: - case 200: + case 202: + case 203: return undefined; case 22: case 1: @@ -33560,7 +33919,7 @@ var ts; case 81: return spanInNextNode(node); default: - if (node.parent.kind === 221 && node.parent.name === node) { + if (node.parent.kind === 224 && node.parent.name === node) { return spanInNode(node.parent.initializer); } if (node.parent.kind === 160 && node.parent.type === node) { @@ -33573,12 +33932,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 184 || - variableDeclaration.parent.parent.kind === 185) { + if (variableDeclaration.parent.parent.kind === 187 || + variableDeclaration.parent.parent.kind === 188) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 177; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 183 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 180; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 186 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -33624,7 +33983,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 198 && functionDeclaration.kind !== 135); + (functionDeclaration.parent.kind === 201 && functionDeclaration.kind !== 135); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -33644,23 +34003,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 202: + case 205: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 182: - case 180: - case 184: case 185: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 183: + case 187: + case 188: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 186: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 196) { + if (forStatement.initializer.kind === 199) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -33679,34 +34038,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 201: + case 204: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 198: + case 201: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 204: + case 207: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 203: + case 206: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } + case 204: case 201: - case 198: return textSpan(node); - case 176: + case 179: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 220: + case 223: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 204: + case 207: var caseBlock = node.parent; var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { @@ -33718,7 +34077,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -33726,16 +34085,16 @@ var ts; function spanInCloseParenToken(node) { switch (node.parent.kind) { case 162: - case 197: + case 200: case 163: case 134: case 133: case 136: case 137: case 135: - case 182: - case 181: - case 183: + case 185: + case 184: + case 186: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -33743,7 +34102,7 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 221) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 224) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -33755,7 +34114,7 @@ var ts; return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index 6046a83da13..972a63a67bf 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -196,59 +196,62 @@ declare module ts { TemplateExpression = 171, YieldExpression = 172, SpreadElementExpression = 173, - OmittedExpression = 174, - TemplateSpan = 175, - Block = 176, - VariableStatement = 177, - EmptyStatement = 178, - ExpressionStatement = 179, - IfStatement = 180, - DoStatement = 181, - WhileStatement = 182, - ForStatement = 183, - ForInStatement = 184, - ForOfStatement = 185, - ContinueStatement = 186, - BreakStatement = 187, - ReturnStatement = 188, - WithStatement = 189, - SwitchStatement = 190, - LabeledStatement = 191, - ThrowStatement = 192, - TryStatement = 193, - DebuggerStatement = 194, - VariableDeclaration = 195, - VariableDeclarationList = 196, - FunctionDeclaration = 197, - ClassDeclaration = 198, - InterfaceDeclaration = 199, - TypeAliasDeclaration = 200, - EnumDeclaration = 201, - ModuleDeclaration = 202, - ModuleBlock = 203, - CaseBlock = 204, - ImportEqualsDeclaration = 205, - ImportDeclaration = 206, - ImportClause = 207, - NamespaceImport = 208, - NamedImports = 209, - ImportSpecifier = 210, - ExportAssignment = 211, - ExportDeclaration = 212, - NamedExports = 213, - ExportSpecifier = 214, - MissingDeclaration = 215, - ExternalModuleReference = 216, - CaseClause = 217, - DefaultClause = 218, - HeritageClause = 219, - CatchClause = 220, - PropertyAssignment = 221, - ShorthandPropertyAssignment = 222, - EnumMember = 223, - SourceFile = 224, - SyntaxList = 225, - Count = 226, + ClassExpression = 174, + OmittedExpression = 175, + TemplateSpan = 176, + HeritageClauseElement = 177, + SemicolonClassElement = 178, + Block = 179, + VariableStatement = 180, + EmptyStatement = 181, + ExpressionStatement = 182, + IfStatement = 183, + DoStatement = 184, + WhileStatement = 185, + ForStatement = 186, + ForInStatement = 187, + ForOfStatement = 188, + ContinueStatement = 189, + BreakStatement = 190, + ReturnStatement = 191, + WithStatement = 192, + SwitchStatement = 193, + LabeledStatement = 194, + ThrowStatement = 195, + TryStatement = 196, + DebuggerStatement = 197, + VariableDeclaration = 198, + VariableDeclarationList = 199, + FunctionDeclaration = 200, + ClassDeclaration = 201, + InterfaceDeclaration = 202, + TypeAliasDeclaration = 203, + EnumDeclaration = 204, + ModuleDeclaration = 205, + ModuleBlock = 206, + CaseBlock = 207, + ImportEqualsDeclaration = 208, + ImportDeclaration = 209, + ImportClause = 210, + NamespaceImport = 211, + NamedImports = 212, + ImportSpecifier = 213, + ExportAssignment = 214, + ExportDeclaration = 215, + NamedExports = 216, + ExportSpecifier = 217, + MissingDeclaration = 218, + ExternalModuleReference = 219, + CaseClause = 220, + DefaultClause = 221, + HeritageClause = 222, + CatchClause = 223, + PropertyAssignment = 224, + ShorthandPropertyAssignment = 225, + EnumMember = 226, + SourceFile = 227, + SyntaxList = 228, + Count = 229, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, @@ -432,6 +435,9 @@ declare module ts { interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { body?: Block; } + interface SemicolonClassElement extends ClassElement { + _semicolonClassElementBrand: any; + } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; body: Block; @@ -570,6 +576,10 @@ declare module ts { typeArguments?: NodeArray; arguments: NodeArray; } + interface HeritageClauseElement extends Node { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + } interface NewExpression extends CallExpression, PrimaryExpression { } interface TaggedTemplateExpression extends MemberExpression { @@ -664,12 +674,16 @@ declare module ts { interface ModuleElement extends Node { _moduleElementBrand: any; } - interface ClassDeclaration extends Declaration, ModuleElement { + interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } + interface ClassDeclaration extends ClassLikeDeclaration, Statement { + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + } interface ClassElement extends Declaration { _classElementBrand: any; } @@ -681,7 +695,7 @@ declare module ts { } interface HeritageClause extends Node { token: SyntaxKind; - types?: NodeArray; + types?: NodeArray; } interface TypeAliasDeclaration extends Declaration, ModuleElement { name: Identifier; @@ -923,7 +937,7 @@ declare module ts { writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; - isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; @@ -1179,7 +1193,6 @@ declare module ts { interface CompilerOptions { allowNonTsExtensions?: boolean; charset?: string; - codepage?: number; declaration?: boolean; diagnostics?: boolean; emitBOM?: boolean; @@ -1193,7 +1206,6 @@ declare module ts { noErrorTruncation?: boolean; noImplicitAny?: boolean; noLib?: boolean; - noLibCheck?: boolean; noResolve?: boolean; out?: string; outDir?: string; @@ -1206,6 +1218,7 @@ declare module ts { target?: ScriptTarget; version?: boolean; watch?: boolean; + separateCompilation?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { @@ -1454,6 +1467,20 @@ declare module ts { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module ts { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module ts { /** The version of the language service API */ let servicesVersion: string; @@ -1947,6 +1974,7 @@ declare module ts { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 2a8a4725b29..0ea54239508 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -190,59 +190,62 @@ var ts; SyntaxKind[SyntaxKind["TemplateExpression"] = 171] = "TemplateExpression"; SyntaxKind[SyntaxKind["YieldExpression"] = 172] = "YieldExpression"; SyntaxKind[SyntaxKind["SpreadElementExpression"] = 173] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 174] = "OmittedExpression"; - SyntaxKind[SyntaxKind["TemplateSpan"] = 175] = "TemplateSpan"; - SyntaxKind[SyntaxKind["Block"] = 176] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 177] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 178] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 179] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 180] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 181] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 182] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 183] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 184] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 185] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 186] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 187] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 188] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 189] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 190] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 191] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 192] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 193] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 194] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 195] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 196] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 197] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 198] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 199] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 200] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 201] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 202] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 203] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 204] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 205] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 206] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 207] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 208] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 209] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 210] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 211] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 212] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 213] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 214] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 215] = "MissingDeclaration"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 216] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["CaseClause"] = 217] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 218] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 219] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 220] = "CatchClause"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 221] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 222] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 223] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 224] = "SourceFile"; - SyntaxKind[SyntaxKind["SyntaxList"] = 225] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 226] = "Count"; + SyntaxKind[SyntaxKind["ClassExpression"] = 174] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 175] = "OmittedExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 176] = "TemplateSpan"; + SyntaxKind[SyntaxKind["HeritageClauseElement"] = 177] = "HeritageClauseElement"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 178] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["Block"] = 179] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 180] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 181] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 182] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 183] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 184] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 185] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 186] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 187] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 188] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 189] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 190] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 191] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 192] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 193] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 194] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 195] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 196] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 197] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 198] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 199] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 200] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 201] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 202] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 203] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 204] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 205] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 206] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 207] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 208] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 209] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 210] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 211] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 212] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 213] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 214] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 215] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 216] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 217] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 218] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 219] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["CaseClause"] = 220] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 221] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 222] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 223] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 224] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 225] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 226] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 227] = "SourceFile"; + SyntaxKind[SyntaxKind["SyntaxList"] = 228] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 229] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 53] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 64] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 66] = "FirstReservedWord"; @@ -632,7 +635,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (v === value) { return true; @@ -656,7 +659,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -670,7 +673,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_1 = array[_i]; if (f(item_1)) { result.push(item_1); @@ -684,7 +687,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result.push(f(v)); } @@ -704,7 +707,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var item_2 = array[_i]; if (!contains(result, item_2)) { result.push(item_2); @@ -716,7 +719,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result += v[prop]; } @@ -725,7 +728,7 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0, _n = from.length; _i < _n; _i++) { + for (var _i = 0; _i < from.length; _i++) { var v = from[_i]; to.push(v); } @@ -1014,7 +1017,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _n = parts.length; _i < _n; _i++) { + for (var _i = 0; _i < parts.length; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -1159,7 +1162,7 @@ var ts; ts.fileExtensionIs = fileExtensionIs; var supportedExtensions = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { + for (var _i = 0; _i < supportedExtensions.length; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -1319,14 +1322,14 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var name_1 = files[_i]; if (!extension || ts.fileExtensionIs(name_1, extension)) { result.push(ts.combinePaths(path, name_1)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + for (var _a = 0; _a < subfolders.length; _a++) { var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } @@ -1413,7 +1416,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _n = files.length; _i < _n; _i++) { + for (var _i = 0; _i < files.length; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -1426,7 +1429,7 @@ var ts; directories.push(name); } } - for (var _a = 0, _b = directories.length; _a < _b; _a++) { + for (var _a = 0; _a < directories.length; _a++) { var current = directories[_a]; visitDirectory(current); } @@ -1664,6 +1667,8 @@ var ts; Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, + Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, + Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -1850,6 +1855,8 @@ var ts; The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1933,6 +1940,11 @@ var ts; Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, + Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { code: 5043, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." }, + Option_declaration_cannot_be_specified_with_option_separateCompilation: { code: 5044, category: ts.DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'separateCompilation'." }, + Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, + Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, + Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1996,7 +2008,10 @@ var ts; You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." }, yield_expressions_are_not_currently_supported: { code: 9000, category: ts.DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." } + Generators_are_not_currently_supported: { code: 9001, category: ts.DiagnosticCategory.Error, key: "Generators are not currently supported." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "'class' expressions are not currently supported." }, + class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: ts.DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." } }; })(ts || (ts = {})); /// @@ -3242,16 +3257,16 @@ var ts; })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); var ModuleInstanceState = ts.ModuleInstanceState; function getModuleInstanceState(node) { - if (node.kind === 199 || node.kind === 200) { + if (node.kind === 202 || node.kind === 203) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 206 || node.kind === 205) && !(node.flags & 1)) { + else if ((node.kind === 209 || node.kind === 208) && !(node.flags & 1)) { return 0; } - else if (node.kind === 203) { + else if (node.kind === 206) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -3267,7 +3282,7 @@ var ts; }); return state; } - else if (node.kind === 202) { + else if (node.kind === 205) { return getModuleInstanceState(node.body); } else { @@ -3320,7 +3335,7 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 202 && node.name.kind === 8) { + if (node.kind === 205 && node.name.kind === 8) { return '"' + node.name.text + '"'; } if (node.name.kind === 127) { @@ -3341,12 +3356,12 @@ var ts; return "__new"; case 140: return "__index"; - case 212: + case 215: return "__export"; - case 211: + case 214: return node.isExportEquals ? "export=" : "default"; - case 197: - case 198: + case 200: + case 201: return node.flags & 256 ? "default" : undefined; } } @@ -3378,7 +3393,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 198 && symbol.exports) { + if ((node.kind === 201 || node.kind === 174) && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -3394,7 +3409,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 214 || (node.kind === 205 && hasExportModifier)) { + if (node.kind === 217 || (node.kind === 208 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -3431,7 +3446,7 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 224); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227); } ts.forEachChild(node, bind); container = saveContainer; @@ -3440,10 +3455,10 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 202: + case 205: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -3458,22 +3473,23 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 198: + case 174: + case 201: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } case 145: case 154: - case 199: + case 202: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 201: + case 204: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -3488,11 +3504,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 224 ? node : node.body; - if (body.kind === 224 || body.kind === 203) { - for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { + var body = node.kind === 227 ? node : node.body; + if (body.kind === 227 || body.kind === 206) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 212 || stat.kind === 211) { + if (stat.kind === 215 || stat.kind === 214) { return true; } } @@ -3554,10 +3570,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 202: + case 205: declareModuleMember(node, 2, 107455); break; - case 224: + case 227: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -3582,7 +3598,7 @@ var ts; case 129: bindParameter(node); break; - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); @@ -3598,11 +3614,11 @@ var ts; case 131: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 221: - case 222: + case 224: + case 225: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 223: + case 226: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 138: @@ -3614,7 +3630,7 @@ var ts; case 133: bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; - case 197: + case 200: bindDeclaration(node, 16, 106927, true); break; case 135: @@ -3640,19 +3656,22 @@ var ts; case 163: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 220: + case 174: + bindAnonymousDeclaration(node, 32, "__class", false); + break; + case 223: bindCatchVariableDeclaration(node); break; - case 198: + case 201: bindDeclaration(node, 32, 899583, false); break; - case 199: + case 202: bindDeclaration(node, 64, 792992, false); break; - case 200: + case 203: bindDeclaration(node, 524288, 793056, false); break; - case 201: + case 204: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -3660,16 +3679,16 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 202: + case 205: bindModuleDeclaration(node); break; - case 205: case 208: - case 210: - case 214: + case 211: + case 213: + case 217: bindDeclaration(node, 8388608, 8388608, false); break; - case 207: + case 210: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -3677,13 +3696,13 @@ var ts; bindChildren(node, 0, false); } break; - case 212: + case 215: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 211: + case 214: if (node.expression && node.expression.kind === 65) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } @@ -3692,20 +3711,20 @@ var ts; } bindChildren(node, 0, false); break; - case 224: + case 227: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 176: + case 179: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 220: - case 183: - case 184: - case 185: - case 204: + case 223: + case 186: + case 187: + case 188: + case 207: bindChildren(node, 0, true); break; default: @@ -3724,7 +3743,7 @@ var ts; } if (node.flags & 112 && node.parent.kind === 135 && - node.parent.parent.kind === 198) { + (node.parent.parent.kind === 201 || node.parent.parent.kind === 174)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -3744,7 +3763,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -3802,7 +3821,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 224) { + while (node && node.kind !== 227) { node = node.parent; } return node; @@ -3884,15 +3903,15 @@ var ts; return current; } switch (current.kind) { - case 224: - case 204: - case 220: - case 202: - case 183: - case 184: - case 185: + case 227: + case 207: + case 223: + case 205: + case 186: + case 187: + case 188: return current; - case 176: + case 179: if (!isFunctionLike(current.parent)) { return current; } @@ -3903,9 +3922,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 195 && + declaration.kind === 198 && declaration.parent && - declaration.parent.kind === 220; + declaration.parent.kind === 223; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3942,14 +3961,21 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 195: - case 152: + case 227: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + if (pos_1 === sourceFile.text.length) { + return createTextSpan(0, 0); + } + return getSpanOfTokenAtPosition(sourceFile, pos_1); case 198: - case 199: - case 202: + case 152: case 201: - case 223: - case 197: + case 174: + case 202: + case 205: + case 204: + case 226: + case 200: case 162: errorNode = node.name; break; @@ -3972,7 +3998,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 201 && isConst(node); + return node.kind === 204 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { @@ -3984,14 +4010,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 195) { + if (node.kind === 198) { node = node.parent; } - if (node && node.kind === 196) { + if (node && node.kind === 199) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 177) { + if (node && node.kind === 180) { flags |= node.flags; } return flags; @@ -4006,7 +4032,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 179 && node.expression.kind === 8; + return node.kind === 182 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -4032,23 +4058,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188: + case 191: return visitor(node); - case 204: - case 176: - case 180: - case 181: - case 182: + case 207: + case 179: case 183: case 184: case 185: - case 189: - case 190: - case 217: - case 218: - case 191: + case 186: + case 187: + case 188: + case 192: case 193: case 220: + case 221: + case 194: + case 196: + case 223: return ts.forEachChild(node, traverse); } } @@ -4058,13 +4084,13 @@ var ts; if (node) { switch (node.kind) { case 152: - case 223: + case 226: case 129: - case 221: + case 224: case 132: case 131: - case 222: - case 195: + case 225: + case 198: return true; } } @@ -4076,7 +4102,7 @@ var ts; switch (node.kind) { case 135: case 162: - case 197: + case 200: case 163: case 134: case 133: @@ -4089,7 +4115,7 @@ var ts; case 143: case 162: case 163: - case 197: + case 200: return true; } } @@ -4097,7 +4123,7 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 176 && isFunctionLike(node.parent); + return node && node.kind === 179 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -4121,7 +4147,7 @@ var ts; } switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; @@ -4130,9 +4156,9 @@ var ts; if (!includeArrowFunctions) { continue; } - case 197: + case 200: case 162: - case 202: + case 205: case 132: case 131: case 134: @@ -4140,8 +4166,8 @@ var ts; case 135: case 136: case 137: - case 201: - case 224: + case 204: + case 227: return node; } } @@ -4154,12 +4180,12 @@ var ts; return node; switch (node.kind) { case 127: - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { return node; } node = node.parent; break; - case 197: + case 200: case 162: case 163: if (!includeFunctions) { @@ -4186,23 +4212,23 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 198: + case 201: return true; case 132: - return node.parent.kind === 198; + return node.parent.kind === 201; case 129: - return node.parent.body && node.parent.parent.kind === 198; + return node.parent.body && node.parent.parent.kind === 201; case 136: case 137: case 134: - return node.body && node.parent.kind === 198; + return node.body && node.parent.kind === 201; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 198: + case 201: if (node.decorators) { return true; } @@ -4230,7 +4256,7 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 198: + case 201: return ts.forEach(node.members, nodeOrChildIsDecorated); case 134: case 137: @@ -4261,6 +4287,7 @@ var ts; case 160: case 161: case 162: + case 174: case 163: case 166: case 164: @@ -4272,7 +4299,7 @@ var ts; case 173: case 171: case 10: - case 174: + case 175: return true; case 126: while (node.parent.kind === 126) { @@ -4287,38 +4314,38 @@ var ts; case 8: var parent_1 = node.parent; switch (parent_1.kind) { - case 195: + case 198: case 129: case 132: case 131: - case 223: - case 221: + case 226: + case 224: case 152: return parent_1.initializer === node; - case 179: - case 180: - case 181: case 182: - case 188: - case 189: - case 190: - case 217: - case 192: - case 190: - return parent_1.expression === node; case 183: - var forStatement = parent_1; - return (forStatement.initializer === node && forStatement.initializer.kind !== 196) || - forStatement.condition === node || - forStatement.iterator === node; case 184: case 185: + case 191: + case 192: + case 193: + case 220: + case 195: + case 193: + return parent_1.expression === node; + case 186: + var forStatement = parent_1; + return (forStatement.initializer === node && forStatement.initializer.kind !== 199) || + forStatement.condition === node || + forStatement.iterator === node; + case 187: + case 188: var forInStatement = parent_1; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 196) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199) || forInStatement.expression === node; case 160: return node === parent_1.expression; - case 175: + case 176: return node === parent_1.expression; case 127: return node === parent_1.expression; @@ -4338,7 +4365,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind === 216; + return node.kind === 208 && node.moduleReference.kind === 219; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4347,20 +4374,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 205 && node.moduleReference.kind !== 216; + return node.kind === 208 && node.moduleReference.kind !== 219; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 206) { + if (node.kind === 209) { return node.moduleSpecifier; } - if (node.kind === 205) { + if (node.kind === 208) { var reference = node.moduleReference; - if (reference.kind === 216) { + if (reference.kind === 219) { return reference.expression; } } - if (node.kind === 212) { + if (node.kind === 215) { return node.moduleSpecifier; } } @@ -4377,8 +4404,8 @@ var ts; case 134: case 133: return node.questionToken !== undefined; - case 222: - case 221: + case 225: + case 224: case 132: case 131: return node.questionToken !== undefined; @@ -4421,31 +4448,31 @@ var ts; switch (node.kind) { case 163: case 152: - case 198: - case 135: case 201: - case 223: - case 214: - case 197: + case 135: + case 204: + case 226: + case 217: + case 200: case 162: case 136: - case 207: - case 205: case 210: - case 199: + case 208: + case 213: + case 202: case 134: case 133: - case 202: - case 208: + case 205: + case 211: case 129: - case 221: + case 224: case 132: case 131: case 137: - case 222: - case 200: + case 225: + case 203: case 128: - case 195: + case 198: return true; } return false; @@ -4453,25 +4480,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 187: - case 186: - case 194: - case 181: - case 179: - case 178: - case 184: - case 185: - case 183: - case 180: - case 191: - case 188: case 190: - case 94: - case 193: - case 177: - case 182: case 189: - case 211: + case 197: + case 184: + case 182: + case 181: + case 187: + case 188: + case 186: + case 183: + case 194: + case 191: + case 193: + case 94: + case 196: + case 180: + case 185: + case 192: + case 214: return true; default: return false; @@ -4497,7 +4524,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 210 || parent.kind === 214) { + if (parent.kind === 213 || parent.kind === 217) { if (parent.propertyName) { return true; } @@ -4509,24 +4536,24 @@ var ts; } ts.isDeclarationName = isDeclarationName; function isAliasSymbolDeclaration(node) { - return node.kind === 205 || - node.kind === 207 && !!node.name || - node.kind === 208 || - node.kind === 210 || - node.kind === 214 || - node.kind === 211 && node.expression.kind === 65; + return node.kind === 208 || + node.kind === 210 && !!node.name || + node.kind === 211 || + node.kind === 213 || + node.kind === 217 || + node.kind === 214 && node.expression.kind === 65; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; - function getClassBaseTypeNode(node) { + function getClassExtendsHeritageClauseElement(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } - ts.getClassBaseTypeNode = getClassBaseTypeNode; - function getClassImplementedTypeNodes(node) { + ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; + function getClassImplementsHeritageClauseElements(node) { var heritageClause = getHeritageClause(node.heritageClauses, 103); return heritageClause ? heritageClause.types : undefined; } - ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { var heritageClause = getHeritageClause(node.heritageClauses, 79); return heritageClause ? heritageClause.types : undefined; @@ -4534,7 +4561,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _n = clauses.length; _i < _n; _i++) { + for (var _i = 0; _i < clauses.length; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -4761,7 +4788,7 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 202 || n.kind === 224; + return isFunctionLike(n) || n.kind === 205 || n.kind === 227; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -5131,12 +5158,36 @@ var ts; } } ts.writeCommentRange = writeCommentRange; + function isSupportedHeritageClauseElement(node) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; + function isSupportedHeritageClauseElementExpression(node) { + if (node.kind === 65) { + return true; + } + else if (node.kind === 155) { + return isSupportedHeritageClauseElementExpression(node.expression); + } + else { + return false; + } + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 126 && node.parent.right === node) || + (node.parent.kind === 155 && node.parent.name === node); + } + ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function getLocalSymbolForExportDefault(symbol) { + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256) ? symbol.valueDeclaration.localSymbol : undefined; + } + ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; })(ts || (ts = {})); /// /// var ts; (function (ts) { - var nodeConstructors = new Array(226); + var nodeConstructors = new Array(229); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -5158,7 +5209,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -5184,9 +5235,9 @@ var ts; case 129: case 132: case 131: - case 221: - case 222: - case 195: + case 224: + case 225: + case 198: case 152: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -5212,7 +5263,7 @@ var ts; case 136: case 137: case 162: - case 197: + case 200: case 163: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -5291,150 +5342,154 @@ var ts; visitNode(cbNode, node.whenFalse); case 173: return visitNode(cbNode, node.expression); - case 176: - case 203: + case 179: + case 206: return visitNodes(cbNodes, node.statements); - case 224: + case 227: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 177: + case 180: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 196: + case 199: return visitNodes(cbNodes, node.declarations); - case 179: + case 182: return visitNode(cbNode, node.expression); - case 180: + case 183: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 181: + case 184: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 182: + case 185: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 183: + case 186: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); - case 184: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 185: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 186: case 187: - return visitNode(cbNode, node.label); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 189: + case 190: + return visitNode(cbNode, node.label); + case 191: + return visitNode(cbNode, node.expression); + case 192: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 190: + case 193: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 204: + case 207: return visitNodes(cbNodes, node.clauses); - case 217: + case 220: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 218: + case 221: return visitNodes(cbNodes, node.statements); - case 191: + case 194: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 192: + case 195: return visitNode(cbNode, node.expression); - case 193: + case 196: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 220: + case 223: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 130: return visitNode(cbNode, node.expression); - case 198: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); - case 199: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); - case 200: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); case 201: + case 174: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 223: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); case 202: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 203: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 204: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 226: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); case 205: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 208: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 206: + case 209: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 207: + case 210: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 208: + case 211: return visitNode(cbNode, node.name); - case 209: - case 213: - return visitNodes(cbNodes, node.elements); case 212: + case 216: + return visitNodes(cbNodes, node.elements); + case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 210: - case 214: + case 213: + case 217: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 211: + case 214: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); case 171: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 175: + case 176: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 127: return visitNode(cbNode, node.expression); - case 219: + case 222: return visitNodes(cbNodes, node.types); - case 216: + case 177: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments); + case 219: return visitNode(cbNode, node.expression); - case 215: + case 218: return visitNodes(cbNodes, node.decorators); } } @@ -5449,7 +5504,7 @@ var ts; ParsingContext[ParsingContext["TypeMembers"] = 5] = "TypeMembers"; ParsingContext[ParsingContext["ClassMembers"] = 6] = "ClassMembers"; ParsingContext[ParsingContext["EnumMembers"] = 7] = "EnumMembers"; - ParsingContext[ParsingContext["TypeReferences"] = 8] = "TypeReferences"; + ParsingContext[ParsingContext["HeritageClauseElement"] = 8] = "HeritageClauseElement"; ParsingContext[ParsingContext["VariableDeclarations"] = 9] = "VariableDeclarations"; ParsingContext[ParsingContext["ObjectBindingElements"] = 10] = "ObjectBindingElements"; ParsingContext[ParsingContext["ArrayBindingElements"] = 11] = "ArrayBindingElements"; @@ -5480,7 +5535,7 @@ var ts; case 5: return ts.Diagnostics.Property_or_signature_expected; case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; + case 8: return ts.Diagnostics.Expression_expected; case 9: return ts.Diagnostics.Variable_declaration_expected; case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; @@ -5562,7 +5617,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5626,7 +5681,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _n = array.length; _i < _n; _i++) { + for (var _i = 0; _i < array.length; _i++) { var node = array[_i]; visitNode(node); } @@ -5830,7 +5885,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(224, 0); + var sourceFile = createNode(227, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -6203,7 +6258,7 @@ var ts; case 5: return isStartOfTypeMember(); case 6: - return lookAhead(isClassMemberStart); + return lookAhead(isClassMemberStart) || (token === 22 && !inErrorRecovery); case 7: return token === 18 || isLiteralPropertyName(); case 13: @@ -6211,7 +6266,15 @@ var ts; case 10: return isLiteralPropertyName(); case 8: - return isIdentifier() && !isNotHeritageClauseTypeName(); + if (token === 14) { + return lookAhead(isValidHeritageClauseObjectLiteral); + } + if (!inErrorRecovery) { + return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + else { + return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); + } case 9: return isIdentifierOrPattern(); case 11: @@ -6233,17 +6296,29 @@ var ts; } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } + function isValidHeritageClauseObjectLiteral() { + ts.Debug.assert(token === 14); + if (nextToken() === 15) { + var next = nextToken(); + return next === 23 || next === 14 || next === 79 || next === 103; + } + return true; + } function nextTokenIsIdentifier() { nextToken(); return isIdentifier(); } - function isNotHeritageClauseTypeName() { + function isHeritageClauseExtendsOrImplementsKeyword() { if (token === 103 || token === 79) { - return lookAhead(nextTokenIsIdentifier); + return lookAhead(nextTokenIsStartOfExpression); } return false; } + function nextTokenIsStartOfExpression() { + nextToken(); + return isStartOfExpression(); + } function isListTerminator(kind) { if (token === 1) { return true; @@ -6393,26 +6468,26 @@ var ts; case 15: return isReusableParameter(node); case 19: - case 8: case 16: case 18: case 17: case 12: case 13: + case 8: } return false; } function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 206: - case 205: - case 212: - case 211: - case 198: - case 199: - case 202: + case 209: + case 208: + case 215: + case 214: case 201: + case 202: + case 205: + case 204: return true; } return isReusableStatement(node); @@ -6428,6 +6503,7 @@ var ts; case 136: case 137: case 132: + case 178: return true; } } @@ -6436,8 +6512,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 217: - case 218: + case 220: + case 221: return true; } } @@ -6446,33 +6522,33 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 197: - case 177: - case 176: + case 200: case 180: case 179: - case 192: - case 188: - case 190: - case 187: - case 186: - case 184: - case 185: case 183: case 182: - case 189: - case 178: - case 193: + case 195: case 191: + case 193: + case 190: + case 189: + case 187: + case 188: + case 186: + case 185: + case 192: case 181: + case 196: case 194: + case 184: + case 197: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 223; + return node.kind === 226; } function isReusableTypeMember(node) { if (node) { @@ -6488,7 +6564,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 195) { + if (node.kind !== 198) { return false; } var variableDeclarator = node; @@ -6594,7 +6670,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(175); + var span = createNode(176); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -7029,7 +7105,7 @@ var ts; function parseTypeAnnotation() { return parseOptional(51) ? parseType() : undefined; } - function isStartOfExpression() { + function isStartOfLeftHandSideExpression() { switch (token) { case 93: case 91: @@ -7044,9 +7120,21 @@ var ts; case 18: case 14: case 83: + case 69: case 88: case 36: case 57: + case 65: + return true; + default: + return isIdentifier(); + } + } + function isStartOfExpression() { + if (isStartOfLeftHandSideExpression()) { + return true; + } + switch (token) { case 33: case 34: case 47: @@ -7057,7 +7145,6 @@ var ts; case 38: case 39: case 24: - case 65: case 111: return true; default: @@ -7068,7 +7155,11 @@ var ts; } } function isStartOfExpressionStatement() { - return token !== 14 && token !== 83 && token !== 52 && isStartOfExpression(); + return token !== 14 && + token !== 83 && + token !== 69 && + token !== 52 && + isStartOfExpression(); } function parseExpression() { // Expression[in]: @@ -7249,7 +7340,10 @@ var ts; if (token === 14) { return parseFunctionBlock(false, false); } - if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 83) { + if (isStartOfStatement(true) && + !isStartOfExpressionStatement() && + token !== 83 && + token !== 69) { return parseFunctionBlock(false, true); } return parseAssignmentExpressionOrHigher(); @@ -7514,7 +7608,6 @@ var ts; case 19: case 51: case 22: - case 23: case 50: case 28: case 30: @@ -7528,6 +7621,8 @@ var ts; case 15: case 1: return true; + case 23: + case 14: default: return false; } @@ -7550,6 +7645,8 @@ var ts; return parseArrayLiteralExpression(); case 14: return parseObjectLiteralExpression(); + case 69: + return parseClassExpression(); case 83: return parseFunctionExpression(); case 88: @@ -7580,7 +7677,7 @@ var ts; } function parseArgumentOrArrayLiteralElement() { return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(174) : + token === 23 ? createNode(175) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { @@ -7621,13 +7718,13 @@ var ts; return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(222, fullStart); + var shorthandDeclaration = createNode(225, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(221, fullStart); + var propertyAssignment = createNode(224, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -7675,7 +7772,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(176); + var node = createNode(179); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -7700,12 +7797,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(178); + var node = createNode(181); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(180); + var node = createNode(183); parseExpected(84); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7715,7 +7812,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(181); + var node = createNode(184); parseExpected(75); node.statement = parseStatement(); parseExpected(100); @@ -7726,7 +7823,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(182); + var node = createNode(185); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7749,21 +7846,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86)) { - var forInStatement = createNode(184, pos); + var forInStatement = createNode(187, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(125)) { - var forOfStatement = createNode(185, pos); + var forOfStatement = createNode(188, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(183, pos); + var forStatement = createNode(186, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -7781,7 +7878,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 187 ? 66 : 71); + parseExpected(kind === 190 ? 66 : 71); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -7789,7 +7886,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(188); + var node = createNode(191); parseExpected(90); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -7798,7 +7895,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(189); + var node = createNode(192); parseExpected(101); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7807,7 +7904,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(217); + var node = createNode(220); parseExpected(67); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -7815,7 +7912,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(218); + var node = createNode(221); parseExpected(73); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -7825,12 +7922,12 @@ var ts; return token === 67 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(190); + var node = createNode(193); parseExpected(92); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); - var caseBlock = createNode(204, scanner.getStartPos()); + var caseBlock = createNode(207, scanner.getStartPos()); parseExpected(14); caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); @@ -7840,14 +7937,14 @@ var ts; function parseThrowStatement() { // ThrowStatement[Yield] : // throw [no LineTerminator here]Expression[In, ?Yield]; - var node = createNode(192); + var node = createNode(195); parseExpected(94); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(193); + var node = createNode(196); parseExpected(96); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 ? parseCatchClause() : undefined; @@ -7858,7 +7955,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(220); + var result = createNode(223); parseExpected(68); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7868,7 +7965,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(194); + var node = createNode(197); parseExpected(72); parseSemicolon(); return finishNode(node); @@ -7877,13 +7974,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 && parseOptional(51)) { - var labeledStatement = createNode(191, fullStart); + var labeledStatement = createNode(194, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(179, fullStart); + var expressionStatement = createNode(182, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -7891,7 +7988,7 @@ var ts; } function isStartOfStatement(inErrorRecovery) { if (ts.isModifier(token)) { - var result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return true; } @@ -7903,6 +8000,7 @@ var ts; case 98: case 105: case 83: + case 69: case 84: case 75: case 100: @@ -7922,7 +8020,6 @@ var ts; var isConstEnum = lookAhead(nextTokenIsEnumKeyword); return !isConstEnum; case 104: - case 69: case 117: case 77: case 123: @@ -7957,6 +8054,8 @@ var ts; return parseVariableStatement(scanner.getStartPos(), undefined, undefined); case 83: return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 69: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); case 22: return parseEmptyStatement(); case 84: @@ -7968,9 +8067,9 @@ var ts; case 82: return parseForOrForInOrForOfStatement(); case 71: - return parseBreakOrContinueStatement(186); + return parseBreakOrContinueStatement(189); case 66: - return parseBreakOrContinueStatement(187); + return parseBreakOrContinueStatement(190); case 90: return parseReturnStatement(); case 101: @@ -7991,7 +8090,7 @@ var ts; } default: if (ts.isModifier(token) || token === 52) { - var result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers); + var result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers); if (result) { return result; } @@ -7999,7 +8098,7 @@ var ts; return parseExpressionOrLabeledStatement(); } } - function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers() { + function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers() { var start = scanner.getStartPos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -8019,6 +8118,8 @@ var ts; return parseVariableStatement(start, decorators, modifiers); case 83: return parseFunctionDeclaration(start, decorators, modifiers); + case 69: + return parseClassDeclaration(start, decorators, modifiers); } return undefined; } @@ -8031,7 +8132,7 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(174); + return createNode(175); } var node = createNode(152); node.dotDotDotToken = parseOptionalToken(21); @@ -8080,7 +8181,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(195); + var node = createNode(198); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -8089,7 +8190,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(196); + var node = createNode(199); switch (token) { case 98: break; @@ -8118,7 +8219,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(177, fullStart); + var node = createNode(180, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -8126,7 +8227,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(200, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83); @@ -8269,6 +8370,11 @@ var ts; return modifiers; } function parseClassElement() { + if (token === 22) { + var result = createNode(178); + nextToken(); + return finishNode(result); + } var fullStart = getNodePos(); var decorators = parseDecorators(); var modifiers = parseModifiers(); @@ -8295,12 +8401,18 @@ var ts; } ts.Debug.fail("Should not have attempted to parse class member declaration."); } + function parseClassExpression() { + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 174); + } function parseClassDeclaration(fullStart, decorators, modifiers) { + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201); + } + function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var savedStrictModeContext = inStrictModeContext(); if (languageVersion >= 2) { setStrictModeContext(true); } - var node = createNode(198, fullStart); + var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(69); @@ -8336,14 +8448,22 @@ var ts; } function parseHeritageClause() { if (token === 79 || token === 103) { - var node = createNode(219); + var node = createNode(222); node.token = token; nextToken(); - node.types = parseDelimitedList(8, parseTypeReference); + node.types = parseDelimitedList(8, parseHeritageClauseElement); return finishNode(node); } return undefined; } + function parseHeritageClauseElement() { + var node = createNode(177); + node.expression = parseLeftHandSideExpressionOrHigher(); + if (token === 24) { + node.typeArguments = parseBracketedList(17, parseType, 24, 25); + } + return finishNode(node); + } function isHeritageClause() { return token === 79 || token === 103; } @@ -8351,7 +8471,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(199, fullStart); + var node = createNode(202, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(104); @@ -8362,7 +8482,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200, fullStart); + var node = createNode(203, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(123); @@ -8373,13 +8493,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(223, scanner.getStartPos()); + var node = createNode(226, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(201, fullStart); + var node = createNode(204, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77); @@ -8394,7 +8514,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(203, scanner.getStartPos()); + var node = createNode(206, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -8405,7 +8525,7 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; @@ -8416,7 +8536,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -8448,7 +8568,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 124) { - var importEqualsDeclaration = createNode(205, fullStart); + var importEqualsDeclaration = createNode(208, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -8458,7 +8578,7 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(206, fullStart); + var importDeclaration = createNode(209, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || @@ -8478,13 +8598,13 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(207, fullStart); + var importClause = createNode(210, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(209); + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(212); } return finishNode(importClause); } @@ -8494,7 +8614,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(216); + var node = createNode(219); parseExpected(118); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -8509,7 +8629,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(208); + var namespaceImport = createNode(211); parseExpected(35); parseExpected(102); namespaceImport.name = parseIdentifier(); @@ -8517,14 +8637,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 209 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 212 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(214); + return parseImportOrExportSpecifier(217); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(210); + return parseImportOrExportSpecifier(213); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -8543,13 +8663,13 @@ var ts; else { node.name = identifierName; } - if (kind === 210 && checkIdentifierIsKeyword) { + if (kind === 213 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35)) { @@ -8557,7 +8677,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(213); + node.exportClause = parseNamedImportsOrExports(216); if (parseOptional(124)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -8566,7 +8686,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(211, fullStart); + var node = createNode(214, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53)) { @@ -8679,7 +8799,7 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); default: if (decorators) { - var node = createMissingNode(215, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(218, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8759,10 +8879,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 205 && node.moduleReference.kind === 216 - || node.kind === 206 - || node.kind === 211 - || node.kind === 212 + || node.kind === 208 && node.moduleReference.kind === 219 + || node.kind === 209 + || node.kind === 214 + || node.kind === 215 ? node : undefined; }); @@ -8779,6 +8899,7 @@ var ts; case 153: case 161: case 154: + case 174: case 162: case 65: case 9: @@ -9073,10 +9194,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 224); + return ts.getAncestor(node, 227); } function isGlobalSourceFile(node) { - return node.kind === 224 && !ts.isExternalModule(node); + return node.kind === 227 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -9118,25 +9239,33 @@ var ts; } } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 214)) { + if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 217)) { + break loop; + } + result = undefined; + } + else if (location.kind === 227) { + result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { break loop; } result = undefined; } break; - case 201: + case 204: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; case 132: case 131: - if (location.parent.kind === 198 && !(location.flags & 128)) { + if (location.parent.kind === 201 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -9145,8 +9274,8 @@ var ts; } } break; - case 198: - case 199: + case 201: + case 202: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -9157,7 +9286,7 @@ var ts; break; case 127: grandparent = location.parent.parent; - if (grandparent.kind === 198 || grandparent.kind === 199) { + if (grandparent.kind === 201 || grandparent.kind === 202) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -9169,7 +9298,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 163: if (name === "arguments") { result = argumentsSymbol; @@ -9181,8 +9310,15 @@ var ts; result = argumentsSymbol; break loop; } - var id = location.name; - if (id && name === id.text) { + var functionName = location.name; + if (functionName && name === functionName.text) { + result = location.symbol; + break loop; + } + break; + case 174: + var className = location.name; + if (className && name === className.text) { result = location.symbol; break loop; } @@ -9226,14 +9362,14 @@ var ts; ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 195); + var variableDeclaration = ts.getAncestor(declaration, 198); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 177 || - variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 180 || + variableDeclaration.parent.parent.kind === 186) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 185 || - variableDeclaration.parent.parent.kind === 184) { + else if (variableDeclaration.parent.parent.kind === 188 || + variableDeclaration.parent.parent.kind === 187) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -9255,10 +9391,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } - while (node && node.kind !== 206) { + while (node && node.kind !== 209) { node = node.parent; } return node; @@ -9268,7 +9404,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 216) { + if (node.moduleReference.kind === 219) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -9291,7 +9427,7 @@ var ts; if (moduleSymbol.flags & 3) { var typeAnnotation = moduleSymbol.valueDeclaration.type; if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); + return getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name); } } } @@ -9322,7 +9458,7 @@ var ts; if (symbol.flags & 3) { var typeAnnotation = symbol.valueDeclaration.type; if (typeAnnotation) { - return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); + return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name)); } } } @@ -9357,17 +9493,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 205: - return getTargetOfImportEqualsDeclaration(node); - case 207: - return getTargetOfImportClause(node); case 208: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node); case 210: - return getTargetOfImportSpecifier(node); - case 214: - return getTargetOfExportSpecifier(node); + return getTargetOfImportClause(node); case 211: + return getTargetOfNamespaceImport(node); + case 213: + return getTargetOfImportSpecifier(node); + case 217: + return getTargetOfExportSpecifier(node); + case 214: return getTargetOfExportAssignment(node); } } @@ -9396,8 +9532,12 @@ var ts; function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); - if (target && target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target)) { - markAliasSymbolAsReferenced(symbol); + if (target) { + var markAlias = (target === unknownSymbol && compilerOptions.separateCompilation) || + (target !== unknownSymbol && (target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); + if (markAlias) { + markAliasSymbolAsReferenced(symbol); + } } } function markAliasSymbolAsReferenced(symbol) { @@ -9405,10 +9545,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 211 && node.expression) { + if (node.kind === 214 && node.expression) { checkExpressionCached(node.expression); } - else if (node.kind === 214) { + else if (node.kind === 217) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -9418,17 +9558,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 205); + importDeclaration = ts.getAncestor(entityName, 208); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 65 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 65 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } if (entityName.kind === 65 || entityName.parent.kind === 126) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 205); + ts.Debug.assert(entityName.parent.kind === 208); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -9436,7 +9576,7 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(name, meaning) { - if (ts.getFullWidth(name) === 0) { + if (ts.nodeIsMissing(name)) { return undefined; } var symbol; @@ -9446,18 +9586,22 @@ var ts; return undefined; } } - else if (name.kind === 126) { - var namespace = resolveEntityName(name.left, 1536); - if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) { + else if (name.kind === 126 || name.kind === 155) { + var left = name.kind === 126 ? name.left : name.expression; + var right = name.kind === 126 ? name.right : name.name; + var namespace = resolveEntityName(left, 1536); + if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; } - var right = name.right; symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; } } + else { + ts.Debug.fail("Unknown entity name kind."); + } ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } @@ -9546,7 +9690,7 @@ var ts; } var exportStars = symbol.exports["__export"]; if (exportStars) { - for (var _i = 0, _a = exportStars.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; visit(resolveExternalModuleName(node, node.moduleSpecifier)); } @@ -9583,7 +9727,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _n = members.length; _i < _n; _i++) { + for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; if (member.kind === 135 && ts.nodeIsPresent(member.body)) { return member; @@ -9650,17 +9794,17 @@ var ts; } } switch (location_1.kind) { - case 224: + case 227: if (!ts.isExternalModule(location_1)) { break; } - case 202: + case 205: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 198: - case 199: + case 201: + case 202: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -9691,7 +9835,7 @@ var ts; return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608) { + if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=") { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -9775,8 +9919,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 202 && declaration.name.kind === 8) || - (declaration.kind === 224 && ts.isExternalModule(declaration)); + return (declaration.kind === 205 && declaration.name.kind === 8) || + (declaration.kind === 227 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9811,8 +9955,8 @@ var ts; if (entityName.parent.kind === 144) { meaning = 107455 | 1048576; } - else if (entityName.kind === 126 || - entityName.parent.kind === 205) { + else if (entityName.kind === 126 || entityName.kind === 155 || + entityName.parent.kind === 208) { meaning = 1536; } else { @@ -9859,7 +10003,7 @@ var ts; while (node.kind === 149) { node = node.parent; } - if (node.kind === 200) { + if (node.kind === 203) { return getSymbolOfNode(node); } } @@ -9903,7 +10047,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -10031,7 +10175,7 @@ var ts; var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 224 || declaration.parent.kind === 203; + return declaration.parent.kind === 227 || declaration.parent.kind === 206; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -10087,13 +10231,13 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; writeKeyword(writer, 88); writeSpace(writer); @@ -10127,13 +10271,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { - var p = _f[_e]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _h = 0, _j = signatures.length; _h < _j; _h++) { - var signature = signatures[_h]; + for (var _f = 0; _f < signatures.length; _f++) { + var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -10263,12 +10407,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 202) { + if (node.kind === 205) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 224) { + else if (node.kind === 227) { return ts.isExternalModule(node) ? node : undefined; } } @@ -10313,21 +10457,21 @@ var ts; switch (node.kind) { case 152: return isDeclarationVisible(node.parent.parent); - case 195: + case 198: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 202: - case 198: - case 199: - case 200: - case 197: - case 201: case 205: + case 201: + case 202: + case 203: + case 200: + case 204: + case 208: var parent_2 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 205 && parent_2.kind !== 224 && ts.isInAmbientContext(parent_2))) { + !(node.kind !== 208 && parent_2.kind !== 227 && ts.isInAmbientContext(parent_2))) { return isGlobalSourceFile(parent_2); } return isDeclarationVisible(parent_2); @@ -10345,7 +10489,7 @@ var ts; case 138: case 140: case 129: - case 203: + case 206: case 142: case 143: case 145: @@ -10355,13 +10499,15 @@ var ts; case 148: case 149: return isDeclarationVisible(node.parent); - case 207: - case 208: case 210: + case 211: + case 213: return false; case 128: - case 224: + case 227: return true; + case 214: + return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } @@ -10376,10 +10522,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 211) { + if (node.parent && node.parent.kind === 214) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 217) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -10411,7 +10557,7 @@ var ts; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 195 ? node.parent.parent.parent : node.parent; + return node.kind === 198 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -10469,17 +10615,17 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 184) { + if (declaration.parent.parent.kind === 187) { return anyType; } - if (declaration.parent.parent.kind === 185) { + if (declaration.parent.parent.kind === 188) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var func = declaration.parent; @@ -10497,7 +10643,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 222) { + if (declaration.kind === 225) { return checkIdentifier(declaration.name); } return undefined; @@ -10526,7 +10672,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 174 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 175 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -10544,7 +10690,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 221 ? getWidenedType(type) : type; + return declaration.kind !== 224 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -10565,16 +10711,16 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 220) { + if (declaration.parent.kind === 223) { return links.type = anyType; } - if (declaration.kind === 211) { + if (declaration.kind === 214) { var exportAssignment = declaration; if (exportAssignment.expression) { return links.type = checkExpression(exportAssignment.expression); } else if (exportAssignment.type) { - return links.type = getTypeFromTypeNode(exportAssignment.type); + return links.type = getTypeFromTypeNodeOrHeritageClauseElement(exportAssignment.type); } else { return links.type = anyType; @@ -10603,11 +10749,11 @@ var ts; function getAnnotatedAccessorType(accessor) { if (accessor) { if (accessor.kind === 136) { - return accessor.type && getTypeFromTypeNode(accessor.type); + return accessor.type && getTypeFromTypeNodeOrHeritageClauseElement(accessor.type); } else { var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation && getTypeFromTypeNodeOrHeritageClauseElement(setterTypeAnnotation); } } return undefined; @@ -10719,7 +10865,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 199 || node.kind === 198) { + if (node.kind === 202 || node.kind === 201) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10750,10 +10896,10 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(symbol, 198); - var baseTypeNode = ts.getClassBaseTypeNode(declaration); + var declaration = ts.getDeclarationOfKind(symbol, 201); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + var baseType = getTypeFromHeritageClauseElement(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10791,9 +10937,9 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 199 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 202 && ts.getInterfaceBaseTypeNodes(declaration)) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { - var baseType = getTypeFromTypeReferenceNode(node); + var baseType = getTypeFromHeritageClauseElement(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10822,15 +10968,15 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 200); - var type = getTypeFromTypeNode(declaration.type); + var declaration = ts.getDeclarationOfKind(symbol, 203); + var type = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 200); + var declaration = ts.getDeclarationOfKind(symbol, 203); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -10887,7 +11033,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -10895,14 +11041,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSymbols.length; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -10911,7 +11057,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { + for (var _i = 0; _i < baseSignatures.length; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -11010,7 +11156,7 @@ var ts; function getUnionSignatures(types, kind) { var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -11031,7 +11177,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -11167,7 +11313,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -11185,7 +11331,7 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0, _b = props.length; _a < _b; _a++) { + for (var _a = 0; _a < props.length; _a++) { var prop = props[_a]; if (prop.declarations) { declarations.push.apply(declarations, prop.declarations); @@ -11310,7 +11456,7 @@ var ts; returnType = classType; } else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); + returnType = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } else { if (declaration.kind === 136 && !ts.hasDynamicName(declaration)) { @@ -11334,7 +11480,7 @@ var ts; switch (node.kind) { case 142: case 143: - case 197: + case 200: case 134: case 133: case 135: @@ -11432,7 +11578,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -11448,7 +11594,7 @@ var ts; function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType + ? declaration.type ? getTypeFromTypeNodeOrHeritageClauseElement(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { @@ -11458,7 +11604,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128).constraint); + type.constraint = getTypeFromTypeNodeOrHeritageClauseElement(ts.getDeclarationOfKind(type.symbol, 128).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -11482,7 +11628,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } @@ -11533,31 +11679,42 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReferenceNode(node) { + function getTypeFromTypeReference(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromHeritageClauseElement(node) { + return getTypeFromTypeReferenceOrHeritageClauseElement(node); + } + function getTypeFromTypeReferenceOrHeritageClauseElement(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var symbol = resolveEntityName(node.typeName, 793056); var type; - if (symbol) { - if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - type = unknownType; - } - else { - type = getDeclaredTypeOfSymbol(symbol); - if (type.flags & (1024 | 2048) && type.flags & 4096) { - var typeParameters = type.typeParameters; - if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); - } - else { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); - type = undefined; - } + if (node.kind !== 177 || ts.isSupportedHeritageClauseElement(node)) { + var typeNameOrExpression = node.kind === 141 + ? node.typeName + : node.expression; + var symbol = resolveEntityName(typeNameOrExpression, 793056); + if (symbol) { + if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; } else { - if (node.typeArguments) { - error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); - type = undefined; + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 | 2048) && type.flags & 4096) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNodeOrHeritageClauseElement)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } } } } @@ -11576,12 +11733,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 198: - case 199: case 201: + case 202: + case 204: return declaration; } } @@ -11623,7 +11780,7 @@ var ts; function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + links.resolvedType = createArrayType(getTypeFromTypeNodeOrHeritageClauseElement(node.elementType)); } return links.resolvedType; } @@ -11639,7 +11796,7 @@ var ts; function getTypeFromTupleTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNodeOrHeritageClauseElement)); } return links.resolvedType; } @@ -11659,13 +11816,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -11683,7 +11840,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -11730,7 +11887,7 @@ var ts; function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNodeOrHeritageClauseElement), true); } return links.resolvedType; } @@ -11756,7 +11913,7 @@ var ts; } return links.resolvedType; } - function getTypeFromTypeNode(node) { + function getTypeFromTypeNodeOrHeritageClauseElement(node) { switch (node.kind) { case 112: return anyType; @@ -11773,7 +11930,9 @@ var ts; case 8: return getTypeFromStringLiteral(node); case 141: - return getTypeFromTypeReferenceNode(node); + return getTypeFromTypeReference(node); + case 177: + return getTypeFromHeritageClauseElement(node); case 144: return getTypeFromTypeQueryNode(node); case 146: @@ -11783,7 +11942,7 @@ var ts; case 148: return getTypeFromUnionTypeNode(node); case 149: - return getTypeFromTypeNode(node.type); + return getTypeFromTypeNodeOrHeritageClauseElement(node.type); case 142: case 143: case 145: @@ -11799,7 +11958,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _n = items.length; _i < _n; _i++) { + for (var _i = 0; _i < items.length; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -11839,7 +11998,7 @@ var ts; case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _n = sources.length; _i < _n; _i++) { + for (var _i = 0; _i < sources.length; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -11955,7 +12114,7 @@ var ts; case 169: return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 221: + case 224: return isContextSensitive(node.initializer); case 134: case 133: @@ -12127,7 +12286,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -12150,7 +12309,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; - for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceTypes.length; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -12287,7 +12446,7 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -12358,7 +12517,7 @@ var ts; return 0; } var result = -1; - for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < sourceProperties.length; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -12383,11 +12542,11 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceSignatures.length; _a++) { var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); @@ -12605,7 +12764,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -12738,7 +12897,7 @@ var ts; ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 197: + case 200: case 134: case 133: case 136: @@ -12791,7 +12950,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { + for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); } @@ -12862,7 +13021,7 @@ var ts; var targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _i = 0, _n = targetTypes.length; _i < _n; _i++) { + for (var _i = 0; _i < targetTypes.length; _i++) { var t = targetTypes[_i]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -12880,7 +13039,7 @@ var ts; } else if (source.flags & 16384) { var sourceTypes = source.types; - for (var _a = 0, _b = sourceTypes.length; _a < _b; _a++) { + for (var _a = 0; _a < sourceTypes.length; _a++) { var sourceType = sourceTypes[_a]; inferFromTypes(sourceType, target); } @@ -12907,7 +13066,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -12980,7 +13139,7 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; } return links.resolvedSymbol; } @@ -13051,7 +13210,7 @@ var ts; switch (node.kind) { case 169: return isAssignedInBinaryExpression(node); - case 195: + case 198: case 152: return isAssignedInVariableDeclaration(node); case 150: @@ -13071,24 +13230,24 @@ var ts; case 168: case 170: case 173: - case 176: - case 177: case 179: case 180: - case 181: case 182: case 183: case 184: case 185: + case 186: + case 187: case 188: - case 189: - case 190: - case 217: - case 218: case 191: case 192: case 193: case 220: + case 221: + case 194: + case 195: + case 196: + case 223: return ts.forEachChild(node, isAssignedIn); } return false; @@ -13124,7 +13283,7 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 180: + case 183: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } @@ -13144,9 +13303,9 @@ var ts; } } break; - case 224: - case 202: - case 197: + case 227: + case 205: + case 200: case 134: case 133: case 136: @@ -13289,15 +13448,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 220) { + symbol.valueDeclaration.parent.kind === 223) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 196) { + while (container.kind !== 199) { container = container.parent; } container = container.parent; - if (container.kind === 177) { + if (container.kind === 180) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -13314,7 +13473,7 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; getNodeLinks(node).flags |= 2; if (container.kind === 132 || container.kind === 135) { getNodeLinks(classNode).flags |= 4; @@ -13331,10 +13490,10 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 202: + case 205: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 201: + case 204: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 135: @@ -13355,7 +13514,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 198 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -13372,9 +13531,9 @@ var ts; } function checkSuperExpression(node) { var isCallExpression = node.parent.kind === 157 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); var baseClass; - if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); baseClass = classType.baseTypes.length && classType.baseTypes[0]; } @@ -13395,7 +13554,7 @@ var ts; container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 198) { + if (container && container.parent && container.parent.kind === 201) { if (container.flags & 128) { canUseSuperExpression = container.kind === 134 || @@ -13471,7 +13630,7 @@ var ts; var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type); } if (declaration.kind === 129) { var type = getContextuallyTypedParameterType(declaration); @@ -13537,7 +13696,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -13616,29 +13775,29 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 195: + case 198: case 129: case 132: case 131: case 152: return getContextualTypeForInitializerExpression(node); case 163: - case 188: + case 191: return getContextualTypeForReturnExpression(node); case 157: case 158: return getContextualTypeForArgument(parent, node); case 160: - return getTypeFromTypeNode(parent.type); + return getTypeFromTypeNodeOrHeritageClauseElement(parent.type); case 169: return getContextualTypeForBinaryOperand(node); - case 221: + case 224: return getContextualTypeForObjectLiteralElement(parent); case 153: return getContextualTypeForElementExpression(node); case 170: return getContextualTypeForConditionalOperand(node); - case 175: + case 176: ts.Debug.assert(parent.parent.kind === 171); return getContextualTypeForSubstitutionExpression(parent.parent, node); case 161: @@ -13674,7 +13833,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { @@ -13709,7 +13868,7 @@ var ts; if (parent.kind === 169 && parent.operatorToken.kind === 53 && parent.left === node) { return true; } - if (parent.kind === 221) { + if (parent.kind === 224) { return isAssignmentTarget(parent.parent); } if (parent.kind === 153) { @@ -13778,21 +13937,21 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 221 || - memberDecl.kind === 222 || + if (memberDecl.kind === 224 || + memberDecl.kind === 225 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 221) { + if (memberDecl.kind === 224) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 134) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 222); + ts.Debug.assert(memberDecl.kind === 225); type = memberDecl.name.kind === 127 ? unknownType : checkExpression(memberDecl.name, contextualMapper); @@ -13852,7 +14011,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 198); + var enclosingClassDeclaration = ts.getAncestor(node, 201); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -14051,7 +14210,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _n = signatures.length; _i < _n; _i++) { + for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var parent_4 = signature.declaration && signature.declaration.parent; @@ -14100,7 +14259,7 @@ var ts; var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); - callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } else { var templateLiteral = tagExpression.template; @@ -14163,7 +14322,7 @@ var ts; } for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = void 0; if (i === 0 && args[i].parent.kind === 159) { @@ -14192,7 +14351,7 @@ var ts; var typeArgumentsAreAssignable = true; for (var i = 0; i < typeParameters.length; i++) { var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); + var typeArgument = getTypeFromTypeNodeOrHeritageClauseElement(typeArgNode); typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); @@ -14206,7 +14365,7 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 174) { + if (arg.kind !== 175) { var paramType = getTypeAtPosition(signature, arg.kind === 173 ? -1 : i); var argType = i === 0 && node.kind === 159 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : @@ -14236,8 +14395,8 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91) { - var containingClass = ts.getAncestor(callExpression, 198); - var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + var containingClass = ts.getAncestor(callExpression, 201); + var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } else { @@ -14304,7 +14463,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -14313,7 +14472,7 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _i = 0, _n = candidates.length; _i < _n; _i++) { + for (var _i = 0; _i < candidates.length; _i++) { var originalCandidate = candidates[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; @@ -14495,7 +14654,7 @@ var ts; } function checkTypeAssertion(node) { var exprType = checkExpression(node.expression); - var targetType = getTypeFromTypeNode(node.type); + var targetType = getTypeFromTypeNodeOrHeritageClauseElement(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { @@ -14533,7 +14692,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 176) { + if (func.body.kind !== 179) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -14571,7 +14730,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 192); + return (body.statements.length === 1) && (body.statements[0].kind === 195); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -14580,7 +14739,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 176) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 179) { return; } var bodyBlock = func.body; @@ -14632,16 +14791,16 @@ var ts; function checkFunctionExpressionOrObjectLiteralMethodBody(node) { ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); if (node.type) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (node.body) { - if (node.body.kind === 176) { + if (node.body.kind === 179) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); if (node.type) { - checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrHeritageClauseElement(node.type), node.body, undefined); } checkFunctionExpressionBodies(node.body); } @@ -14700,19 +14859,6 @@ var ts; return false; } } - function isImportedNameFromExternalModule(n) { - switch (n.kind) { - case 156: - case 155: { - var symbol = findSymbol(n.expression); - return symbol && symbol.flags & 8388608 && isExternalModuleSymbol(resolveAlias(symbol)); - } - case 161: - return isImportedNameFromExternalModule(n.expression); - default: - return false; - } - } if (!isReferenceOrErrorExpression(n)) { error(n, invalidReferenceMessage); return false; @@ -14721,9 +14867,6 @@ var ts; error(n, constantVariableMessage); return false; } - if (isImportedNameFromExternalModule(n)) { - error(n, invalidReferenceMessage); - } return true; } function checkDeleteExpression(node) { @@ -14781,7 +14924,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -14797,7 +14940,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _n = types.length; _i < _n; _i++) { + for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -14833,9 +14976,9 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _n = properties.length; _i < _n; _i++) { + for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var name_8 = p.name; var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name_8.text) || @@ -14862,7 +15005,7 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { var propName = "" + i; var type = sourceType.flags & 1 ? sourceType : @@ -15184,6 +15327,8 @@ var ts; return checkTypeAssertion(node); case 161: return checkExpression(node.expression, contextualMapper); + case 174: + return checkClassExpression(node); case 162: case 163: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -15203,7 +15348,7 @@ var ts; return checkConditionalExpression(node, contextualMapper); case 173: return checkSpreadElementExpression(node, contextualMapper); - case 174: + case 175: return undefinedType; case 172: checkYieldExpression(node); @@ -15250,7 +15395,7 @@ var ts; if (node.kind === 140) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 || node.kind === 197 || node.kind === 143 || + else if (node.kind === 142 || node.kind === 200 || node.kind === 143 || node.kind === 138 || node.kind === 135 || node.kind === 139) { checkGrammarFunctionLikeDeclaration(node); @@ -15276,7 +15421,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 199) { + if (node.kind === 202) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -15286,7 +15431,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -15344,7 +15489,7 @@ var ts; } switch (n.kind) { case 162: - case 197: + case 200: case 163: case 154: return false; default: return ts.forEachChild(n, containsSuperCall); @@ -15354,7 +15499,7 @@ var ts; if (n.kind === 93) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 && n.kind !== 197) { + else if (n.kind !== 162 && n.kind !== 200) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -15363,13 +15508,13 @@ var ts; !(n.flags & 128) && !!n.initializer; } - if (ts.getClassBaseTypeNode(node.parent)) { + if (ts.getClassExtendsHeritageClauseElement(node.parent)) { if (containsSuperCall(node.body)) { var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 179 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 182 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -15413,9 +15558,15 @@ var ts; function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeReference(node) { + function checkTypeReferenceNode(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkHeritageClauseElement(node) { + return checkTypeReferenceOrHeritageClauseElement(node); + } + function checkTypeReferenceOrHeritageClauseElement(node) { checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceNode(node); + var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); if (type !== unknownType && node.typeArguments) { var len = node.typeArguments.length; for (var i = 0; i < len; i++) { @@ -15468,7 +15619,7 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 199) { + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202) { ts.Debug.assert(signatureDeclarationNode.kind === 138 || signatureDeclarationNode.kind === 139); var signatureKind = signatureDeclarationNode.kind === 138 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); @@ -15478,7 +15629,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { + for (var _i = 0; _i < signaturesToCheck.length; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -15488,7 +15639,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 199 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 202 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -15545,7 +15696,7 @@ var ts; var declarations = symbol.declarations; var isConstructor = (symbol.flags & 16384) !== 0; function reportImplementationExpectedError(node) { - if (node.name && ts.getFullWidth(node.name) === 0) { + if (node.name && ts.nodeIsMissing(node.name)) { return; } var seen = false; @@ -15584,15 +15735,15 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 199 || node.parent.kind === 145 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 202 || node.parent.kind === 145 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 197 || node.kind === 134 || node.kind === 133 || node.kind === 135) { + if (node.kind === 200 || node.kind === 134 || node.kind === 133 || node.kind === 135) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -15643,7 +15794,7 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + for (var _a = 0; _a < signatures.length; _a++) { var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); @@ -15689,16 +15840,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 199: - return 2097152; case 202: + return 2097152; + case 205: return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 198: case 201: + case 204: return 2097152 | 1048576; - case 205: + case 208: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -15712,7 +15863,7 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 198: + case 201: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]); @@ -15738,7 +15889,7 @@ var ts; return; } switch (node.kind) { - case 198: + case 201: case 134: case 136: case 137: @@ -15783,18 +15934,18 @@ var ts; } checkSourceElement(node.body); if (node.type && !isAccessor(node.kind)) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type)); } if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !node.type && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } } function checkBlock(node) { - if (node.kind === 176) { + if (node.kind === 179) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 203) { + if (ts.isFunctionBlock(node) || node.kind === 206) { checkFunctionExpressionBodies(node); } } @@ -15854,11 +16005,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 198); + var enclosingClass = ts.getAncestor(node, 201); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } - if (ts.getClassBaseTypeNode(enclosingClass)) { + if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var isDeclaration_2 = node.kind !== 65; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); @@ -15872,11 +16023,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 202 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 205 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 224 && ts.isExternalModule(parent)) { + if (parent.kind === 227 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -15887,7 +16038,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { return; } - if (node.kind === 195 && !node.initializer) { + if (node.kind === 198 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -15897,15 +16048,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 196); - var container = varDeclList.parent.kind === 177 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199); + var container = varDeclList.parent.kind === 180 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 176 && ts.isFunctionLike(container.parent) || - container.kind === 203 || - container.kind === 202 || - container.kind === 224); + (container.kind === 179 && ts.isFunctionLike(container.parent) || + container.kind === 206 || + container.kind === 205 || + container.kind === 227); if (!namesShareScope) { var name_9 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_9, name_9); @@ -15989,7 +16140,7 @@ var ts; } if (node.kind !== 132 && node.kind !== 131) { checkExportsOnMergedDeclarations(node); - if (node.kind === 195 || node.kind === 152) { + if (node.kind === 198 || node.kind === 152) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -16018,7 +16169,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 176 || node.kind === 154) { + if (node.kind === 179 || node.kind === 154) { return true; } node = node.parent; @@ -16046,12 +16197,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 196) { + if (node.initializer && node.initializer.kind == 199) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -16066,7 +16217,7 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { checkForInOrForOfVariableDeclaration(node); } else { @@ -16087,7 +16238,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -16286,7 +16437,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 218 && !hasDuplicateDefaultClause) { + if (clause.kind === 221 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -16298,7 +16449,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 217) { + if (produceDiagnostics && clause.kind === 220) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -16315,7 +16466,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 191 && current.label.text === node.label.text) { + if (current.kind === 194 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -16379,9 +16530,9 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 198) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 201) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -16454,7 +16605,15 @@ var ts; } } } + function checkClassExpression(node) { + grammarErrorOnNode(node, ts.Diagnostics.class_expressions_are_not_currently_supported); + ts.forEach(node.members, checkSourceElement); + return unknownType; + } function checkClassDeclaration(node) { + if (node.parent.kind !== 206 && node.parent.kind !== 227) { + grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + } checkGrammarClassDeclarationHeritageClauses(node); checkDecorators(node); if (node.name) { @@ -16467,10 +16626,13 @@ var ts; var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); var staticType = getTypeOfSymbol(symbol); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); + } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkTypeReference(baseTypeNode); + checkHeritageClauseElement(baseTypeNode); } if (type.baseTypes.length) { if (produceDiagnostics) { @@ -16478,19 +16640,24 @@ var ts; checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); var staticBaseType = getTypeOfSymbol(baseType.symbol); checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType.symbol !== resolveEntityName(baseTypeNode.typeName, 107455)) { + if (baseType.symbol !== resolveEntityName(baseTypeNode.expression, 107455)) { error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); } checkKindsOfPropertyMemberOverrides(type, baseType); } - checkExpressionOrQualifiedName(baseTypeNode.typeName); } - var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (type.baseTypes.length || (baseTypeNode && compilerOptions.separateCompilation)) { + checkExpressionOrQualifiedName(baseTypeNode.expression); + } + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - checkTypeReference(typeRefNode); + if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromTypeReferenceNode(typeRefNode); + var t = getTypeFromHeritageClauseElement(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { @@ -16527,7 +16694,7 @@ var ts; // Base class instance member variables and accessors can be overridden by // derived class instance member variables and accessors, but not by other kinds of members. var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { + for (var _i = 0; _i < baseProperties.length; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -16591,7 +16758,7 @@ var ts; if (!tp1.constraint || !tp2.constraint) { return false; } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + if (!isTypeIdenticalTo(getTypeFromTypeNodeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrHeritageClauseElement(tp2.constraint))) { return false; } } @@ -16604,10 +16771,10 @@ var ts; var seen = {}; ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0, _c = properties.length; _b < _c; _b++) { + for (var _b = 0; _b < properties.length; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; @@ -16635,7 +16802,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 199); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -16651,7 +16818,12 @@ var ts; } } } - ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { + if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkHeritageClauseElement(heritageElement); + }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { checkTypeForDuplicateIndexSignatures(node); @@ -16816,11 +16988,14 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); + var enumIsConst = ts.isConst(node); + if (compilerOptions.separateCompilation && enumIsConst && ts.isInAmbientContext(node)) { + error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided); + } var enumSymbol = getSymbolOfNode(node); var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { if (enumSymbol.declarations.length > 1) { - var enumIsConst = ts.isConst(node); ts.forEach(enumSymbol.declarations, function (decl) { if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); @@ -16829,7 +17004,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 201) { + if (declaration.kind !== 204) { return false; } var enumDeclaration = declaration; @@ -16850,9 +17025,9 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 198 || (declaration.kind === 197 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 201 || (declaration.kind === 200 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -16872,7 +17047,7 @@ var ts; if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -16895,20 +17070,29 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 126) { - node = node.left; + while (true) { + if (node.kind === 126) { + node = node.left; + } + else if (node.kind === 155) { + node = node.expression; + } + else { + break; + } } + ts.Debug.assert(node.kind === 65); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (ts.getFullWidth(moduleName) !== 0 && moduleName.kind !== 8) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { - error(moduleName, node.kind === 212 ? + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { + error(moduleName, node.kind === 215 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; @@ -16927,7 +17111,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 214 ? + var message = node.kind === 217 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -16950,7 +17134,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { checkImportBinding(importClause.namedBindings); } else { @@ -16995,8 +17179,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 203 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 224 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 227 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); } } @@ -17015,8 +17199,8 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 224 ? node.parent : node.parent.parent; - if (container.kind === 202 && container.name.kind === 65) { + var container = node.parent.kind === 227 ? node.parent : node.parent.parent; + if (container.kind === 205 && container.name.kind === 65) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; } @@ -17043,10 +17227,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 224) { + if (node.kind === 227) { return node.statements; } - if (node.kind === 202 && node.body.kind === 203) { + if (node.kind === 205 && node.body.kind === 206) { return node.body.statements; } return emptyArray; @@ -17098,7 +17282,7 @@ var ts; case 137: return checkAccessorDeclaration(node); case 141: - return checkTypeReference(node); + return checkTypeReferenceNode(node); case 144: return checkTypeQuery(node); case 145: @@ -17111,71 +17295,71 @@ var ts; return checkUnionType(node); case 149: return checkSourceElement(node.type); - case 197: + case 200: return checkFunctionDeclaration(node); - case 176: - case 203: - return checkBlock(node); - case 177: - return checkVariableStatement(node); case 179: - return checkExpressionStatement(node); + case 206: + return checkBlock(node); case 180: - return checkIfStatement(node); - case 181: - return checkDoStatement(node); + return checkVariableStatement(node); case 182: - return checkWhileStatement(node); + return checkExpressionStatement(node); case 183: - return checkForStatement(node); + return checkIfStatement(node); case 184: - return checkForInStatement(node); + return checkDoStatement(node); case 185: - return checkForOfStatement(node); + return checkWhileStatement(node); case 186: + return checkForStatement(node); case 187: - return checkBreakOrContinueStatement(node); + return checkForInStatement(node); case 188: - return checkReturnStatement(node); + return checkForOfStatement(node); case 189: - return checkWithStatement(node); case 190: - return checkSwitchStatement(node); + return checkBreakOrContinueStatement(node); case 191: - return checkLabeledStatement(node); + return checkReturnStatement(node); case 192: - return checkThrowStatement(node); + return checkWithStatement(node); case 193: - return checkTryStatement(node); + return checkSwitchStatement(node); + case 194: + return checkLabeledStatement(node); case 195: + return checkThrowStatement(node); + case 196: + return checkTryStatement(node); + case 198: return checkVariableDeclaration(node); case 152: return checkBindingElement(node); - case 198: - return checkClassDeclaration(node); - case 199: - return checkInterfaceDeclaration(node); - case 200: - return checkTypeAliasDeclaration(node); case 201: - return checkEnumDeclaration(node); + return checkClassDeclaration(node); case 202: - return checkModuleDeclaration(node); - case 206: - return checkImportDeclaration(node); + return checkInterfaceDeclaration(node); + case 203: + return checkTypeAliasDeclaration(node); + case 204: + return checkEnumDeclaration(node); case 205: + return checkModuleDeclaration(node); + case 209: + return checkImportDeclaration(node); + case 208: return checkImportEqualsDeclaration(node); - case 212: - return checkExportDeclaration(node); - case 211: - return checkExportAssignment(node); - case 178: - checkGrammarStatementInAmbientContext(node); - return; - case 194: - checkGrammarStatementInAmbientContext(node); - return; case 215: + return checkExportDeclaration(node); + case 214: + return checkExportAssignment(node); + case 181: + checkGrammarStatementInAmbientContext(node); + return; + case 197: + checkGrammarStatementInAmbientContext(node); + return; + case 218: return checkMissingDeclaration(node); } } @@ -17196,10 +17380,10 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 189: + case 192: checkFunctionExpressionBodies(node.expression); break; case 129: @@ -17210,14 +17394,14 @@ var ts; case 152: case 153: case 154: - case 221: + case 224: case 155: case 156: case 157: case 158: case 159: case 171: - case 175: + case 176: case 160: case 161: case 165: @@ -17228,12 +17412,9 @@ var ts; case 169: case 170: case 173: - case 176: - case 203: - case 177: case 179: + case 206: case 180: - case 181: case 182: case 183: case 184: @@ -17241,21 +17422,24 @@ var ts; case 186: case 187: case 188: + case 189: case 190: - case 204: - case 217: - case 218: case 191: - case 192: case 193: + case 207: case 220: + case 221: + case 194: case 195: case 196: - case 198: - case 201: case 223: - case 211: - case 224: + case 198: + case 199: + case 201: + case 204: + case 226: + case 214: + case 227: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -17310,7 +17494,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 189 && node.parent.statement === node) { + if (node.parent.kind === 192 && node.parent.statement === node) { return true; } node = node.parent; @@ -17332,18 +17516,18 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) { break; } - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17384,17 +17568,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 224: + case 227: if (!ts.isExternalModule(location)) break; - case 202: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 201: + case 204: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 198: - case 199: + case 201: + case 202: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } @@ -17419,20 +17603,28 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 128: - case 198: - case 199: - case 200: case 201: + case 202: + case 203: + case 204: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126) + while (node.parent && node.parent.kind === 126) { node = node.parent; + } return node.parent && node.parent.kind === 141; } - function isTypeNode(node) { + function isHeritageClauseElementIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 155) { + node = node.parent; + } + return node.parent && node.parent.kind === 177; + } + function isTypeNodeOrHeritageClauseElement(node) { if (141 <= node.kind && node.kind <= 149) { return true; } @@ -17447,12 +17639,18 @@ var ts; return node.parent.kind !== 166; case 8: return node.parent.kind === 129; + case 177: + return true; case 65: if (node.parent.kind === 126 && node.parent.right === node) { node = node.parent; } + else if (node.parent.kind === 155 && node.parent.name === node) { + node = node.parent; + } case 126: - ts.Debug.assert(node.kind === 65 || node.kind === 126, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 155: + ts.Debug.assert(node.kind === 65 || node.kind === 126 || node.kind === 155, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_5 = node.parent; if (parent_5.kind === 144) { return false; @@ -17461,14 +17659,16 @@ var ts; return true; } switch (parent_5.kind) { + case 177: + return true; case 128: return node === parent_5.constraint; case 132: case 131: case 129: - case 195: + case 198: return node === parent_5.type; - case 197: + case 200: case 162: case 163: case 135: @@ -17496,10 +17696,10 @@ var ts; while (nodeOnRightSide.parent.kind === 126) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 205) { + if (nodeOnRightSide.parent.kind === 208) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 211) { + if (nodeOnRightSide.parent.kind === 214) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -17507,15 +17707,11 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } - function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 && node.parent.right === node) || - (node.parent.kind === 155 && node.parent.name === node); - } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 211) { + if (entityName.parent.kind === 214) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 155) { @@ -17523,11 +17719,16 @@ var ts; return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } } - if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (ts.isExpression(entityName)) { - if (ts.getFullWidth(entityName) === 0) { + if (isHeritageClauseElementIdentifier(entityName)) { + var meaning = entityName.parent.kind === 177 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, meaning); + } + else if (ts.isExpression(entityName)) { + if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 65) { @@ -17564,7 +17765,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 211 + return node.parent.kind === 214 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } @@ -17587,7 +17788,7 @@ var ts; var moduleName; if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 206 || node.parent.kind === 212) && + ((node.parent.kind === 209 || node.parent.kind === 215) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -17606,7 +17807,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 222) { + if (location && location.kind === 225) { return resolveEntityName(location.name, 107455); } return undefined; @@ -17615,12 +17816,12 @@ var ts; if (isInsideWithStatementBody(node)) { return unknownType; } + if (isTypeNodeOrHeritageClauseElement(node)) { + return getTypeFromTypeNodeOrHeritageClauseElement(node); + } if (ts.isExpression(node)) { return getTypeOfExpression(node); } - if (isTypeNode(node)) { - return getTypeFromTypeNode(node); - } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -17645,7 +17846,7 @@ var ts; return unknownType; } function getTypeOfExpression(expr) { - if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } return checkExpression(expr); @@ -17680,7 +17881,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 224; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { if (languageVersion >= 2) { @@ -17688,10 +17889,10 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 207) { + if (node.kind === 210) { return getGeneratedNameForNode(node.parent) + ".default"; } - if (node.kind === 210) { + if (node.kind === 213) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -17708,7 +17909,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 202 || node.kind === 201) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 205 || node.kind === 204) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -17731,29 +17932,33 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 205: - case 207: case 208: case 210: - case 214: + case 211: + case 213: + case 217: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 212: + case 215: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 211: + case 214: return node.expression && node.expression.kind === 65 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 224 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 227 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } - return isAliasResolvedToValue(getSymbolOfNode(node)); + var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); + return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - return target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + if (target === unknownSymbol && compilerOptions.separateCompilation) { + return true; + } + return target !== unknownSymbol && target && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -17787,7 +17992,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 223) { + if (node.kind === 226) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -17822,13 +18027,13 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 195 && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 198 && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 220; + symbol.valueDeclaration.parent.kind !== 223; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -17934,17 +18139,17 @@ var ts; case 134: case 133: case 140: - case 198: - case 199: - case 202: case 201: - case 177: - case 197: - case 200: - case 206: + case 202: case 205: - case 212: - case 211: + case 204: + case 180: + case 200: + case 203: + case 209: + case 208: + case 215: + case 214: case 129: break; default: @@ -17955,7 +18160,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 109: @@ -17979,7 +18184,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -17988,7 +18193,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 203 || node.parent.kind === 224) { + else if (node.parent.kind === 206 || node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 129) { @@ -18004,7 +18209,7 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 129) { @@ -18016,13 +18221,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 129) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 203) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -18041,10 +18246,10 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 206 || node.kind === 205) && flags & 2) { + else if ((node.kind === 209 || node.kind === 208) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 199 && flags & 2) { + else if (node.kind === 202 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } else if (node.kind === 129 && (flags & 112) && ts.isBindingPattern(node.name)) { @@ -18172,9 +18377,9 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _n = arguments.length; _i < _n; _i++) { + for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 174) { + if (arg.kind === 175) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -18199,7 +18404,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -18227,7 +18432,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 79) { if (seenExtendsClause) { @@ -18273,16 +18478,16 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_11 = prop.name; - if (prop.kind === 174 || + if (prop.kind === 175 || name_11.kind === 127) { checkGrammarComputedPropertyName(name_11); continue; } var currentKind = void 0; - if (prop.kind === 221 || prop.kind === 222) { + if (prop.kind === 224 || prop.kind === 225) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_11.kind === 7) { checkGrammarNumbericLiteral(name_11); @@ -18329,24 +18534,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 196) { + if (forInOrOfStatement.initializer.kind === 199) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 184 + var diagnostic = forInOrOfStatement.kind === 187 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -18415,7 +18620,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -18426,7 +18631,7 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === 145) { @@ -18435,13 +18640,13 @@ var ts; } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return true; - case 191: + case 194: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -18453,9 +18658,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 191: + case 194: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 186 + var isMisplacedContinueLabel = node.kind === 189 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -18463,8 +18668,8 @@ var ts; return false; } break; - case 190: - if (node.kind === 187 && !node.label) { + case 193: + if (node.kind === 190 && !node.label) { return false; } break; @@ -18477,13 +18682,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 187 + var message = node.kind === 190 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 187 + var message = node.kind === 190 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -18502,11 +18707,8 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 184 && node.parent.parent.kind !== 185) { + if (node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { if (ts.isInAmbientContext(node)) { - if (ts.isBindingPattern(node.name)) { - return grammarErrorOnNode(node, ts.Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); - } if (node.initializer) { var equalsTokenLength = "=".length; return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); @@ -18533,7 +18735,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _n = elements.length; _i < _n; _i++) { + for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -18550,15 +18752,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 180: - case 181: - case 182: - case 189: case 183: case 184: case 185: + case 192: + case 186: + case 187: + case 188: return false; - case 191: + case 194: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -18591,7 +18793,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; if (node.name.kind === 127) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -18655,13 +18857,13 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 199) { + else if (node.parent.kind === 202) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -18676,11 +18878,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 199 || - node.kind === 206 || - node.kind === 205 || - node.kind === 212 || - node.kind === 211 || + if (node.kind === 202 || + node.kind === 209 || + node.kind === 208 || + node.kind === 215 || + node.kind === 214 || (node.flags & 2) || (node.flags & (1 | 256))) { return false; @@ -18688,9 +18890,9 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 177) { + if (ts.isDeclaration(decl) || decl.kind === 180) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -18709,7 +18911,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 176 || node.parent.kind === 203 || node.parent.kind === 224) { + if (node.parent.kind === 179 || node.parent.kind === 206 || node.parent.kind === 227) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -18790,7 +18992,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 206); + ts.Debug.assert(aliasEmitInfo.node.kind === 209); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -18863,10 +19065,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 195) { + if (declaration.kind === 198) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 209 || declaration.kind === 210 || declaration.kind === 207) { + else if (declaration.kind === 212 || declaration.kind === 213 || declaration.kind === 210) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -18877,7 +19079,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 206) { + if (moduleElementEmitInfo.node.kind === 209) { moduleElementEmitInfo.isVisible = true; } else { @@ -18885,12 +19087,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 202) { + if (nodeToCheck.kind === 205) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -18943,14 +19145,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { @@ -18985,6 +19187,8 @@ var ts; case 99: case 8: return writeTextOfNode(currentSourceFile, type); + case 177: + return emitHeritageClauseElement(type); case 141: return emitTypeReference(type); case 144: @@ -19006,11 +19210,9 @@ var ts; return emitEntityName(type); case 126: return emitEntityName(type); - default: - ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 205 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 208 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -19018,10 +19220,22 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var qualifiedName = entityName; - writeEntityName(qualifiedName.left); + var left = entityName.kind === 126 ? entityName.left : entityName.expression; + var right = entityName.kind === 126 ? entityName.right : entityName.name; + writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, qualifiedName.right); + writeTextOfNode(currentSourceFile, right); + } + } + } + function emitHeritageClauseElement(node) { + if (ts.isSupportedHeritageClauseElement(node)) { + ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 155); + emitEntityName(node.expression); + if (node.typeArguments) { + write("<"); + emitCommaList(node.typeArguments, emitType); + write(">"); } } } @@ -19105,10 +19319,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 205 || - (node.parent.kind === 224 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 208 || + (node.parent.kind === 227 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 224) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -19117,7 +19331,7 @@ var ts; }); } else { - if (node.kind === 206) { + if (node.kind === 209) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -19135,23 +19349,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 197: - return writeFunctionDeclaration(node); - case 177: - return writeVariableStatement(node); - case 199: - return writeInterfaceDeclaration(node); - case 198: - return writeClassDeclaration(node); case 200: - return writeTypeAliasDeclaration(node); - case 201: - return writeEnumDeclaration(node); + return writeFunctionDeclaration(node); + case 180: + return writeVariableStatement(node); case 202: - return writeModuleDeclaration(node); + return writeInterfaceDeclaration(node); + case 201: + return writeClassDeclaration(node); + case 203: + return writeTypeAliasDeclaration(node); + case 204: + return writeEnumDeclaration(node); case 205: + return writeModuleDeclaration(node); + case 208: return writeImportEqualsDeclaration(node); - case 206: + case 209: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -19165,7 +19379,7 @@ var ts; if (node.flags & 256) { write("default "); } - else if (node.kind !== 199) { + else if (node.kind !== 202) { write("declare "); } } @@ -19209,7 +19423,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 208) { + if (namedBindings.kind === 211) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -19235,7 +19449,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -19286,7 +19500,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 203) { + while (node.body.kind !== 206) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -19375,10 +19589,10 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 198: + case 201: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 199: + case 202: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 139: @@ -19392,14 +19606,14 @@ var ts; if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { + else if (node.parent.parent.kind === 201) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 197: + case 200: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -19424,10 +19638,12 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + if (ts.isSupportedHeritageClauseElement(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 198) { + if (node.parent.parent.kind === 201) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; @@ -19460,11 +19676,11 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { emitHeritageClause([baseTypeNode], false); } - emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); write(" {"); writeLine(); increaseIndent(); @@ -19504,7 +19720,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 195 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 198 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -19522,7 +19738,7 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 195) { + if (node.kind === 198) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19537,7 +19753,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -19560,7 +19776,14 @@ var ts; } : undefined; } function emitBindingPattern(bindingPattern) { - emitCommaList(bindingPattern.elements, emitBindingElement); + var elements = []; + for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 175) { + elements.push(element); + } + } + emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { @@ -19690,13 +19913,13 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 197) { + if (node.kind === 200) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 134) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 197) { + if (node.kind === 200) { write("function "); writeTextOfNode(currentSourceFile, node.name); } @@ -19778,7 +20001,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 198) { + else if (node.parent.kind === 201) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19791,7 +20014,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 197: + case 200: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -19814,7 +20037,7 @@ var ts; write("..."); } if (ts.isBindingPattern(node.name)) { - write("_" + ts.indexOf(node.parent.parameters, node)); + emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); @@ -19832,79 +20055,124 @@ var ts; writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage; + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { case 135: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - break; case 139: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - break; case 134: case 133: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 198) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + else if (node.parent.parent.kind === 201) { + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - break; - case 197: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 200: + return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); } - return { - diagnosticMessage: diagnosticMessage, - errorNode: node, - typeName: node.name - }; + } + function emitBindingPattern(bindingPattern) { + if (bindingPattern.kind === 150) { + write("{"); + emitCommaList(bindingPattern.elements, emitBindingElement); + write("}"); + } + else if (bindingPattern.kind === 151) { + write("["); + var elements = bindingPattern.elements; + emitCommaList(elements, emitBindingElement); + if (elements && elements.hasTrailingComma) { + write(", "); + } + write("]"); + } + } + function emitBindingElement(bindingElement) { + function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: bindingElement, + typeName: bindingElement.name + } : undefined; + } + if (bindingElement.kind === 175) { + write(" "); + } + else if (bindingElement.kind === 152) { + if (bindingElement.propertyName) { + writeTextOfNode(currentSourceFile, bindingElement.propertyName); + write(": "); + emitBindingPattern(bindingElement.name); + } + else if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + emitBindingPattern(bindingElement.name); + } + else { + ts.Debug.assert(bindingElement.name.kind === 65); + if (bindingElement.dotDotDotToken) { + write("..."); + } + writeTextOfNode(currentSourceFile, bindingElement.name); + } + } + } } } function emitNode(node) { switch (node.kind) { - case 197: - case 202: - case 205: - case 199: - case 198: case 200: + case 205: + case 208: + case 202: case 201: + case 203: + case 204: return emitModuleElement(node, isModuleElementVisible(node)); - case 177: + case 180: return emitModuleElement(node, isVariableStatementVisible(node)); - case 206: + case 209: return emitModuleElement(node, !node.importClause); - case 212: + case 215: return emitExportDeclaration(node); case 135: case 134: @@ -19920,11 +20188,11 @@ var ts; case 132: case 131: return emitPropertyDeclaration(node); - case 223: + case 226: return emitEnumMemberDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFile(node); } } @@ -20033,7 +20301,6 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; - var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var generatedNameSet = {}; var nodeToGeneratedName = []; @@ -20152,24 +20419,24 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 197: - case 198: + case 200: + case 201: generateNameForFunctionOrClassDeclaration(node); break; - case 202: + case 205: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 201: + case 204: generateNameForModuleOrEnum(node); break; - case 206: + case 209: generateNameForImportDeclaration(node); break; - case 212: + case 215: generateNameForExportDeclaration(node); break; - case 211: + case 214: generateNameForExportAssignment(node); break; } @@ -20323,15 +20590,15 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 197 || + else if (node.kind === 200 || node.kind === 162 || node.kind === 134 || node.kind === 133 || node.kind === 136 || node.kind === 137 || - node.kind === 202 || - node.kind === 198 || - node.kind === 201) { + node.kind === 205 || + node.kind === 201 || + node.kind === 204) { if (node.name) { var name_15 = node.name; scopeName = name_15.kind === 127 @@ -20419,7 +20686,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 224) { + if (node.kind != 227) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -20504,7 +20771,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -20514,7 +20781,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -20528,7 +20795,7 @@ var ts; write(","); } decreaseIndent(); - if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -20793,35 +21060,35 @@ var ts; var parent = node.parent; switch (parent.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: - case 197: + case 200: case 136: case 137: case 162: - case 198: - case 199: case 201: case 202: + case 204: case 205: - case 207: case 208: - return parent.name === node; case 210: - case 214: - return parent.name === node || parent.propertyName === node; - case 187: - case 186: case 211: + return parent.name === node; + case 213: + case 217: + return parent.name === node || parent.propertyName === node; + case 190: + case 189: + case 214: return false; - case 191: + case 194: return node.parent.label === node; } } @@ -21015,9 +21282,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 221: + case 224: return property.initializer; - case 222: + case 225: return createIdentifier(resolver.getExpressionNameSubstitution(property.name, getGeneratedNameForNode)); case 134: return createFunctionExpression(property.parameters, property.body); @@ -21072,7 +21339,7 @@ var ts; return result; } function createExpressionStatement(expression) { - var result = ts.createSynthesizedNode(179); + var result = ts.createSynthesizedNode(182); result.expression = expression; return result; } @@ -21091,7 +21358,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(221); + var result = ts.createSynthesizedNode(224); result.name = name; result.initializer = initializer; return result; @@ -21184,6 +21451,9 @@ var ts; } } function tryEmitConstantValue(node) { + if (compilerOptions.separateCompilation) { + return false; + } var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { write(constantValue.toString()); @@ -21196,7 +21466,7 @@ var ts; return false; } function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); @@ -21401,7 +21671,7 @@ var ts; function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 53 && (node.left.kind === 154 || node.left.kind === 153)) { - emitDestructuring(node, node.parent.kind === 179); + emitDestructuring(node, node.parent.kind === 182); } else { emit(node.left); @@ -21437,13 +21707,13 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 176) { + if (node && node.kind === 179) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { - if (preserveNewLines && isSingleLineEmptyBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -21452,12 +21722,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 203) { - ts.Debug.assert(node.parent.kind === 202); + if (node.kind === 206) { + ts.Debug.assert(node.parent.kind === 205); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 203) { + if (node.kind === 206) { emitTempDeclarations(true); } decreaseIndent(); @@ -21466,7 +21736,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 176) { + if (node.kind === 179) { write(" "); emit(node); } @@ -21491,7 +21761,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76, node.thenStatement.end); - if (node.elseStatement.kind === 180) { + if (node.elseStatement.kind === 183) { write(" "); emit(node.elseStatement); } @@ -21503,7 +21773,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { write(" "); } else { @@ -21547,7 +21817,7 @@ var ts; var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 196) { + if (node.initializer && node.initializer.kind === 199) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; emitStartOfVariableDeclarationList(declarations[0], endPos); @@ -21565,13 +21835,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 185) { + if (languageVersion < 2 && node.kind === 188) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; @@ -21583,7 +21853,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 184) { + if (node.kind === 187) { write(" in "); } else { @@ -21620,7 +21890,6 @@ var ts; var rhsIsIdentifier = node.expression.kind === 65; var counter = createTempVariable(268435456); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(536870912) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -21634,24 +21903,12 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } - if (cachedLength) { - write(", "); - emitNodeWithoutSourceMap(cachedLength); - write(" = "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - if (cachedLength) { - emitNodeWithoutSourceMap(cachedLength); - } - else { - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } + emitNodeWithoutSourceMap(rhsReference); + write(".length"); emitEnd(node.initializer); write("; "); emitStart(node.initializer); @@ -21664,7 +21921,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 196) { + if (node.initializer.kind === 199) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -21695,7 +21952,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 176) { + if (node.statement.kind === 179) { emitLines(node.statement.statements); } else { @@ -21707,7 +21964,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 187 ? 66 : 71, node.pos); + emitToken(node.kind === 190 ? 66 : 71, node.pos); emitOptional(" ", node.label); write(";"); } @@ -21752,7 +22009,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 217) { + if (node.kind === 220) { write("case "); emit(node.expression); write(":"); @@ -21760,7 +22017,7 @@ var ts; else { write("default:"); } - if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -21807,7 +22064,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 202); + } while (node && node.kind !== 205); return node; } function emitContainingModuleName(node) { @@ -21840,11 +22097,11 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (node.name) { - emitModuleMemberName(node); + if (node.flags & 256) { + write("exports.default"); } else { - write("exports.default"); + emitModuleMemberName(node); } write(" = "); emitDeclarationName(node); @@ -21854,7 +22111,7 @@ var ts; } function emitExportMemberAssignments(name) { if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _a = 0, _b = exportSpecifiers[name.text], _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); emitStart(specifier.name); @@ -21870,7 +22127,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var isDeclaration = (root.kind === 195 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; + var isDeclaration = (root.kind === 198 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; if (root.kind === 169) { emitAssignmentExpression(root); } @@ -21883,7 +22140,7 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 195 || name.parent.kind === 152)) { + if (name.parent && (name.parent.kind === 198 || name.parent.kind === 152)) { emitModuleMemberName(name.parent); } else { @@ -21950,9 +22207,9 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _a = 0, _b = properties.length; _a < _b; _a++) { + for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 221 || p.kind === 222) { + if (p.kind === 224 || p.kind === 225) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -21965,7 +22222,7 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 174) { + if (e.kind !== 175) { if (e.kind !== 173) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } @@ -22032,7 +22289,7 @@ var ts; var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 174) { + else if (element.kind !== 175) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -22069,8 +22326,8 @@ var ts; var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); if (isUninitializedLet && - node.parent.parent.kind !== 184 && - node.parent.parent.kind !== 185) { + node.parent.parent.kind !== 187 && + node.parent.parent.kind !== 188) { initializer = createVoidZero(); } } @@ -22078,7 +22335,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 174) { + if (node.kind === 175) { return; } var name = node.name; @@ -22090,7 +22347,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 195 && node.parent.kind !== 152)) { + if (!node.parent || (node.parent.kind !== 198 && node.parent.kind !== 152)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -22099,24 +22356,24 @@ var ts; if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 65 || - (node.parent.kind !== 195 && node.parent.kind !== 152)) { + (node.parent.kind !== 198 && node.parent.kind !== 152)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); if (((combinedFlags & 12288) === 0) || combinedFlags & 1) { return; } - var list = ts.getAncestor(node, 196); - if (list.parent.kind === 177) { - var isSourceFileLevelBinding = list.parent.parent.kind === 224; - var isModuleLevelBinding = list.parent.parent.kind === 203; - var isFunctionLevelBinding = list.parent.parent.kind === 176 && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 199); + if (list.parent.kind === 180) { + var isSourceFileLevelBinding = list.parent.parent.kind === 227; + var isModuleLevelBinding = list.parent.parent.kind === 206; + var isFunctionLevelBinding = list.parent.parent.kind === 179 && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 224 + var parent = blockScopeContainer.kind === 227 ? blockScopeContainer : blockScopeContainer.parent; if (resolver.resolvesToSomeValue(parent, node.text)) { @@ -22131,7 +22388,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && languageVersion >= 2 && - node.parent.kind === 224; + node.parent.kind === 227; } function emitVariableStatement(node) { if (!(node.flags & 1)) { @@ -22256,8 +22513,8 @@ var ts; if (node.kind === 162) { return !!node.name; } - else if (node.kind === 197) { - return !!node.name || (languageVersion >= 2 && !(node.flags & 256)); + if (node.kind === 200) { + return !!node.name || languageVersion < 2; } } function emitFunctionDeclaration(node) { @@ -22280,7 +22537,7 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 197 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 200 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } if (node.kind !== 134 && node.kind !== 133) { @@ -22330,7 +22587,7 @@ var ts; if (!node.body) { write(" { }"); } - else if (node.body.kind === 176) { + else if (node.body.kind === 179) { emitBlockFunctionBody(node, node.body); } else { @@ -22369,7 +22626,7 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); @@ -22406,8 +22663,8 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements, _c = _b.length; _a < _c; _a++) { + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { var statement = _b[_a]; write(" "); emit(statement); @@ -22430,7 +22687,7 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 179) { + if (statement && statement.kind === 182) { var expr = statement.expression; if (expr && expr.kind === 157) { var func = expr.expression; @@ -22496,7 +22753,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 134 || node.kind === 133) { + if (member.kind === 178) { + writeLine(); + write(";"); + } + else if (member.kind === 134 || node.kind === 133) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -22563,12 +22824,14 @@ var ts; }); } function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; if ((member.kind === 134 || node.kind === 133) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 || node.kind === 133 || member.kind === 136 || member.kind === 137) { + else if (member.kind === 134 || + member.kind === 136 || + member.kind === 137) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -22586,9 +22849,13 @@ var ts; emitEnd(member); emitTrailingComments(member); } + else if (member.kind === 178) { + writeLine(); + write(";"); + } } } - function emitConstructor(node, baseTypeNode) { + function emitConstructor(node, baseTypeElement) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; @@ -22623,7 +22890,7 @@ var ts; emitSignatureParameters(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { write("(...args)"); } else { @@ -22641,7 +22908,7 @@ var ts; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); - if (baseTypeNode) { + if (baseTypeElement) { var superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); @@ -22651,16 +22918,16 @@ var ts; emitParameterPropertyAssignments(ctor); } else { - if (baseTypeNode) { + if (baseTypeElement) { writeLine(); - emitStart(baseTypeNode); + emitStart(baseTypeElement); if (languageVersion < 2) { write("_super.apply(this, arguments);"); } else { write("super(...args);"); } - emitEnd(baseTypeNode); + emitEnd(baseTypeElement); } } emitMemberAssignments(node, 0); @@ -22687,28 +22954,36 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { if (languageVersion < 2) { - emitClassDeclarationBelowES6(node); + emitClassLikeDeclarationBelowES6(node); } else { - emitClassDeclarationForES6AndHigher(node); + emitClassLikeDeclarationForES6AndHigher(node); } } - function emitClassDeclarationForES6AndHigher(node) { + function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { - write("export "); + if (node.kind === 201) { + if (thisNodeIsDecorated) { + if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 256) { - write("default "); + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 256) { + write("default "); + } } } write("class"); @@ -22716,10 +22991,10 @@ var ts; write(" "); emitDeclarationName(node); } - var baseTypeNode = ts.getClassBaseTypeNode(node); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write(" extends "); - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); } write(" {"); increaseIndent(); @@ -22762,11 +23037,14 @@ var ts; write(";"); } } - function emitClassDeclarationBelowES6(node) { - write("var "); - emitDeclarationName(node); - write(" = (function ("); - var baseTypeNode = ts.getClassBaseTypeNode(node); + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 201) { + write("var "); + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write("_super"); } @@ -22813,11 +23091,16 @@ var ts; emitStart(node); write(")("); if (baseTypeNode) { - emit(baseTypeNode.typeName); + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 201) { + write(";"); } - write(");"); emitEnd(node); - emitExportMemberAssignment(node); + if (node.kind === 201) { + emitExportMemberAssignment(node); + } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } @@ -22961,7 +23244,7 @@ var ts; } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums; + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.separateCompilation; } function emitEnumDeclaration(node) { if (!shouldEmitEnumDeclaration(node)) { @@ -23040,13 +23323,13 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 202) { + if (moduleDeclaration.body.kind === 205) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } } function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation); } function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); @@ -23068,7 +23351,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 203) { + if (node.body.kind === 206) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -23117,16 +23400,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 205) { + if (node.kind === 208) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 208) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 206 && node.importClause && !!node.importClause.name; + return node.kind === 209 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -23153,7 +23436,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 208) { + if (node.importClause.namedBindings.kind === 211) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -23179,7 +23462,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 205 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 208 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -23191,7 +23474,7 @@ var ts; write(" = "); } else { - var isNakedImport = 206 && !node.importClause; + var isNakedImport = 209 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -23266,7 +23549,7 @@ var ts; emitRequire(ts.getExternalModuleName(node)); write(";"); } - for (var _a = 0, _b = node.exportClause.elements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { var specifier = _b[_a]; if (resolver.isValueAliasDeclaration(specifier)) { writeLine(); @@ -23321,7 +23604,7 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(languageVersion >= 2); var needsComma = false; - for (var _a = 0, _b = specifiers.length; _a < _b; _a++) { + for (var _a = 0; _a < specifiers.length; _a++) { var specifier = specifiers[_a]; if (shouldEmit(specifier)) { if (needsComma) { @@ -23346,8 +23629,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 197 && - expression.kind !== 198) { + if (expression.kind !== 200 && + expression.kind !== 201) { write(";"); } emitEnd(node); @@ -23368,21 +23651,21 @@ var ts; exportSpecifiers = {}; exportEquals = undefined; hasExportStars = false; - for (var _a = 0, _b = sourceFile.statements, _c = _b.length; _a < _c; _a++) { + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 206: + case 209: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 205: - if (node.moduleReference.kind === 216 && resolver.isReferencedAliasDeclaration(node)) { + case 208: + if (node.moduleReference.kind === 219 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 212: + case 215: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -23393,14 +23676,14 @@ var ts; } } else { - for (var _d = 0, _e = node.exportClause.elements, _f = _e.length; _d < _f; _d++) { - var specifier = _e[_d]; + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; var name_17 = (specifier.propertyName || specifier.name).text; (exportSpecifiers[name_17] || (exportSpecifiers[name_17] = [])).push(specifier); } } break; - case 211: + case 214: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -23442,7 +23725,7 @@ var ts; write("\"" + node.amdModuleName + "\", "); } write("[\"require\", \"exports\""); - for (var _a = 0, _b = externalImports.length; _a < _b; _a++) { + for (var _a = 0; _a < externalImports.length; _a++) { var importNode = externalImports[_a]; write(", "); var moduleName = ts.getExternalModuleName(importNode); @@ -23453,15 +23736,15 @@ var ts; write("\"\""); } } - for (var _c = 0, _d = node.amdDependencies, _e = _d.length; _c < _e; _c++) { - var amdDependency = _d[_c]; + for (var _b = 0, _c = node.amdDependencies; _b < _c.length; _b++) { + var amdDependency = _c[_b]; var text = "\"" + amdDependency.path + "\""; write(", "); write(text); } write("], function (require, exports"); - for (var _f = 0, _g = externalImports.length; _f < _g; _f++) { - var importNode = externalImports[_f]; + for (var _d = 0; _d < externalImports.length; _d++) { + var importNode = externalImports[_d]; write(", "); var namespaceDeclaration = getNamespaceDeclarationNode(importNode); if (namespaceDeclaration && !isDefaultImport(importNode)) { @@ -23471,8 +23754,8 @@ var ts; write(getGeneratedNameForNode(importNode)); } } - for (var _h = 0, _j = node.amdDependencies, _k = _j.length; _h < _k; _h++) { - var amdDependency = _j[_h]; + for (var _e = 0, _f = node.amdDependencies; _e < _f.length; _e++) { + var amdDependency = _f[_e]; if (amdDependency.name) { write(", "); write(amdDependency.name); @@ -23605,19 +23888,19 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 199: - case 197: - case 206: - case 205: - case 200: - case 211: - return false; case 202: + case 200: + case 209: + case 208: + case 203: + case 214: + return false; + case 205: return shouldEmitModuleDeclaration(node); - case 201: + case 204: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 176 && + if (node.kind !== 179 && node.parent && node.parent.kind === 163 && node.parent.body === node && @@ -23659,7 +23942,7 @@ var ts; return emitLiteral(node); case 171: return emitTemplateExpression(node); - case 175: + case 176: return emitTemplateSpan(node); case 126: return emitQualifiedName(node); @@ -23673,9 +23956,9 @@ var ts; return emitArrayLiteral(node); case 154: return emitObjectLiteral(node); - case 221: + case 224: return emitPropertyAssignment(node); - case 222: + case 225: return emitShorthandPropertyAssignment(node); case 127: return emitComputedPropertyName(node); @@ -23693,7 +23976,7 @@ var ts; return emit(node.expression); case 161: return emitParenExpression(node); - case 197: + case 200: case 162: case 163: return emitFunctionDeclaration(node); @@ -23713,71 +23996,73 @@ var ts; return emitConditionalExpression(node); case 173: return emitSpreadElementExpression(node); - case 174: + case 175: return; - case 176: - case 203: - return emitBlock(node); - case 177: - return emitVariableStatement(node); - case 178: - return write(";"); case 179: - return emitExpressionStatement(node); - case 180: - return emitIfStatement(node); - case 181: - return emitDoStatement(node); - case 182: - return emitWhileStatement(node); - case 183: - return emitForStatement(node); - case 185: - case 184: - return emitForInOrForOfStatement(node); - case 186: - case 187: - return emitBreakOrContinueStatement(node); - case 188: - return emitReturnStatement(node); - case 189: - return emitWithStatement(node); - case 190: - return emitSwitchStatement(node); - case 217: - case 218: - return emitCaseOrDefaultClause(node); - case 191: - return emitLabelledStatement(node); - case 192: - return emitThrowStatement(node); - case 193: - return emitTryStatement(node); - case 220: - return emitCatchClause(node); - case 194: - return emitDebuggerStatement(node); - case 195: - return emitVariableDeclaration(node); - case 198: - return emitClassDeclaration(node); - case 199: - return emitInterfaceDeclaration(node); - case 201: - return emitEnumDeclaration(node); - case 223: - return emitEnumMember(node); - case 202: - return emitModuleDeclaration(node); case 206: - return emitImportDeclaration(node); + return emitBlock(node); + case 180: + return emitVariableStatement(node); + case 181: + return write(";"); + case 182: + return emitExpressionStatement(node); + case 183: + return emitIfStatement(node); + case 184: + return emitDoStatement(node); + case 185: + return emitWhileStatement(node); + case 186: + return emitForStatement(node); + case 188: + case 187: + return emitForInOrForOfStatement(node); + case 189: + case 190: + return emitBreakOrContinueStatement(node); + case 191: + return emitReturnStatement(node); + case 192: + return emitWithStatement(node); + case 193: + return emitSwitchStatement(node); + case 220: + case 221: + return emitCaseOrDefaultClause(node); + case 194: + return emitLabelledStatement(node); + case 195: + return emitThrowStatement(node); + case 196: + return emitTryStatement(node); + case 223: + return emitCatchClause(node); + case 197: + return emitDebuggerStatement(node); + case 198: + return emitVariableDeclaration(node); + case 174: + return emitClassExpression(node); + case 201: + return emitClassDeclaration(node); + case 202: + return emitInterfaceDeclaration(node); + case 204: + return emitEnumDeclaration(node); + case 226: + return emitEnumMember(node); case 205: + return emitModuleDeclaration(node); + case 209: + return emitImportDeclaration(node); + case 208: return emitImportEqualsDeclaration(node); - case 212: + case 215: return emitExportDeclaration(node); - case 211: + case 214: return emitExportAssignment(node); - case 224: + case 227: return emitSourceFileNode(node); } } @@ -23805,7 +24090,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.pos !== node.parent.pos) { + if (node.parent.kind === 227 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -23817,7 +24102,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 224 || node.end !== node.parent.end) { + if (node.parent.kind === 227 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -23911,7 +24196,7 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0.0"; + ts.version = "1.5.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -24234,7 +24519,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 206 || node.kind === 205 || node.kind === 212) { + if (node.kind === 209 || node.kind === 208 || node.kind === 215) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -24254,7 +24539,7 @@ var ts; } } } - else if (node.kind === 202 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 205 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { @@ -24276,6 +24561,20 @@ var ts; } } function verifyCompilerOptions() { + if (options.separateCompilation) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation)); + } + if (options.declaration) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation)); + } + if (options.noEmitOnError) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation)); + } + if (options.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); + } + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); @@ -24287,11 +24586,19 @@ var ts; } var languageVersion = options.target || 0; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); - if (firstExternalModuleSourceFile && !options.module) { + if (options.separateCompilation) { if (!options.module && languageVersion < 2) { - var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } + var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); + if (firstNonExternalModuleSourceFile) { + var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + } + } + else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { + var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher)); @@ -24354,10 +24661,6 @@ var ts; name: "charset", type: "string" }, - { - name: "codepage", - type: "number" - }, { name: "declaration", shortName: "d", @@ -24423,10 +24726,6 @@ var ts; name: "noLib", type: "boolean" }, - { - name: "noLibCheck", - type: "boolean" - }, { name: "noResolve", type: "boolean" @@ -24462,6 +24761,10 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "separateCompilation", + type: "boolean" + }, { name: "sourceMap", type: "boolean", @@ -24485,18 +24788,6 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, - { - name: "preserveNewLines", - type: "boolean", - description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, - experimental: true - }, - { - name: "cacheDownlevelForOfLength", - type: "boolean", - description: "Cache length access when downlevel emitting for-of statements", - experimental: true - }, { name: "target", shortName: "t", @@ -24739,23 +25030,23 @@ var ts; return; } switch (n.kind) { - case 176: + case 179: if (!ts.isFunctionBlock(n)) { var parent_6 = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent_6.kind === 181 || - parent_6.kind === 184 || - parent_6.kind === 185 || + if (parent_6.kind === 184 || + parent_6.kind === 187 || + parent_6.kind === 188 || + parent_6.kind === 186 || parent_6.kind === 183 || - parent_6.kind === 180 || - parent_6.kind === 182 || - parent_6.kind === 189 || - parent_6.kind === 220) { + parent_6.kind === 185 || + parent_6.kind === 192 || + parent_6.kind === 223) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_6.kind === 193) { + if (parent_6.kind === 196) { var tryStatement = parent_6; if (tryStatement.tryBlock === n) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); @@ -24778,17 +25069,17 @@ var ts; }); break; } - case 203: { + case 206: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 198: - case 199: case 201: + case 202: + case 204: case 154: - case 204: { + case 207: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -24820,7 +25111,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -24852,7 +25143,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -24933,7 +25224,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0, _n = matches.length; _i < _n; _i++) { + for (var _i = 0; _i < matches.length; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < bestMatchKind) { @@ -24980,14 +25271,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 202: + case 205: do { current = current.parent; - } while (current.kind === 202); - case 198: + } while (current.kind === 205); case 201: - case 199: - case 197: + case 204: + case 202: + case 200: indent++; } current = current.parent; @@ -24998,26 +25289,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 177: + case 180: ts.forEach(node.declarationList.declarations, visit); break; case 150: case 151: ts.forEach(node.elements, visit); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { childNodes.push(importClause.namedBindings); } else { @@ -25027,19 +25318,19 @@ var ts; } break; case 152: - case 195: + case 198: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 198: case 201: - case 199: + case 204: case 202: - case 197: case 205: - case 210: - case 214: + case 200: + case 208: + case 213: + case 217: childNodes.push(node); break; } @@ -25071,20 +25362,20 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 198: case 201: - case 199: + case 204: + case 202: topLevelNodes.push(node); break; - case 202: + case 205: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 197: + case 200: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -25095,9 +25386,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 197) { - if (functionDeclaration.body && functionDeclaration.body.kind === 176) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 197 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 200) { + if (functionDeclaration.body && functionDeclaration.body.kind === 179) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 200 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -25110,7 +25401,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; var item_3 = createItem(child); if (item_3 !== undefined) { @@ -25135,9 +25426,9 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems, _n = _a.length; _i < _n; _i++) { + outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { var sourceChild = _a[_i]; - for (var _b = 0, _c = target.childItems, _d = _c.length; _b < _d; _b++) { + for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); @@ -25167,7 +25458,7 @@ var ts; return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); case 140: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 223: + case 226: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); case 138: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); @@ -25176,16 +25467,16 @@ var ts; case 132: case 131: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 197: + case 200: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 195: + case 198: case 152: var variableDeclarationNode; var name_18; if (node.kind === 152) { name_18 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 195) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 198) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -25206,11 +25497,11 @@ var ts; } case 135: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 214: - case 210: - case 205: - case 207: + case 217: + case 213: case 208: + case 210: + case 211: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -25240,17 +25531,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 224: + case 227: return createSourceFileItem(node); - case 198: - return createClassItem(node); case 201: + return createClassItem(node); + case 204: return createEnumItem(node); - case 199: - return createIterfaceItem(node); case 202: + return createIterfaceItem(node); + case 205: return createModuleItem(node); - case 197: + case 200: return createFunctionItem(node); } return undefined; @@ -25260,7 +25551,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 202) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 205) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -25272,7 +25563,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if ((node.name || node.flags & 256) && node.body && node.body.kind === 176) { + if ((node.name || node.flags & 256) && node.body && node.body.kind === 179) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem((!node.name && node.flags & 256) ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -25320,13 +25611,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 202) { + while (node.body.kind === 205) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 224 + return node.kind === 227 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -25418,7 +25709,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0, _n = wordSpans.length; _i < _n; _i++) { + for (var _i = 0; _i < wordSpans.length; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -25471,7 +25762,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0, _n = subWordTextChunks.length; _i < _n; _i++) { + for (var _i = 0; _i < subWordTextChunks.length; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -25862,7 +26153,7 @@ var ts; var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 175 && node.parent.parent.parent.kind === 159) { + else if (node.parent.kind === 176 && node.parent.parent.parent.kind === 159) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; @@ -25879,7 +26170,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0, _n = listChildren.length; _i < _n; _i++) { + for (var _i = 0; _i < listChildren.length; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -25939,7 +26230,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 224; n = n.parent) { + for (var n = node; n.kind !== 227; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -26120,17 +26411,17 @@ var ts; return false; } switch (n.kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 154: case 150: case 145: - case 176: - case 203: - case 204: + case 179: + case 206: + case 207: return nodeEndsWith(n, 15, sourceFile); - case 220: + case 223: return isCompletedNode(n.block, sourceFile); case 158: if (!n.arguments) { @@ -26146,7 +26437,7 @@ var ts; case 135: case 136: case 137: - case 197: + case 200: case 162: case 134: case 133: @@ -26160,14 +26451,14 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 17, sourceFile); - case 202: + case 205: return n.body && isCompletedNode(n.body, sourceFile); - case 180: + case 183: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 179: + case 182: return isCompletedNode(n.expression, sourceFile); case 153: case 151: @@ -26180,15 +26471,15 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19, sourceFile); - case 217: - case 218: + case 220: + case 221: return false; - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: return isCompletedNode(n.statement, sourceFile); - case 181: + case 184: var hasWhileKeyword = findChildOfKind(n, 100, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 17, sourceFile); @@ -26208,7 +26499,7 @@ var ts; case 171: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 175: + case 176: return ts.nodeIsPresent(n.literal); case 167: return isCompletedNode(n.operand, sourceFile); @@ -26257,7 +26548,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 225 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 228 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -26322,7 +26613,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); @@ -26363,7 +26654,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 224); + ts.Debug.assert(startNode !== undefined || n.kind === 227); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -26403,7 +26694,7 @@ var ts; if (node.kind === 141 || node.kind === 157) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 198 || node.kind === 199) { + if (ts.isFunctionLike(node) || node.kind === 201 || node.kind === 202) { return node.typeParameters; } return undefined; @@ -27145,7 +27436,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -27329,7 +27620,7 @@ var ts; throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 183; + return context.contextNode.kind === 186; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); @@ -27339,16 +27630,16 @@ var ts; case 169: case 170: return true; - case 205: - case 195: + case 208: + case 198: case 129: - case 223: + case 226: case 132: case 131: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; - case 184: + case 187: return context.currentTokenSpan.kind === 86 || context.nextTokenSpan.kind === 86; - case 185: + case 188: return context.currentTokenSpan.kind === 125 || context.nextTokenSpan.kind === 125; case 152: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; @@ -27400,17 +27691,17 @@ var ts; return true; } switch (node.kind) { - case 176: - case 204: + case 179: + case 207: case 154: - case 203: + case 206: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 197: + case 200: case 134: case 133: case 136: @@ -27419,7 +27710,7 @@ var ts; case 162: case 135: case 163: - case 199: + case 202: return true; } return false; @@ -27429,40 +27720,40 @@ var ts; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 198: - case 199: case 201: - case 145: case 202: + case 204: + case 145: + case 205: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 198: - case 202: case 201: - case 176: - case 220: - case 203: - case 190: + case 205: + case 204: + case 179: + case 223: + case 206: + case 193: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 180: - case 190: case 183: - case 184: - case 185: - case 182: case 193: - case 181: - case 189: - case 220: + case 186: + case 187: + case 188: + case 185: + case 196: + case 184: + case 192: + case 223: return true; default: return false; @@ -27487,14 +27778,14 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 196 && + return context.currentTokenParent.kind === 199 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 202; + return context.contextNode.kind === 205; }; Rules.IsObjectTypeContext = function (context) { return context.contextNode.kind === 145; @@ -27505,9 +27796,9 @@ var ts; } switch (parent.kind) { case 141: - case 198: - case 199: - case 197: + case 201: + case 202: + case 200: case 162: case 163: case 134: @@ -27598,7 +27889,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(), _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -28016,17 +28307,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 198: - case 199: - return ts.rangeContainsRange(parent.members, node); + case 201: case 202: + return ts.rangeContainsRange(parent.members, node); + case 205: var body = parent.body; - return body && body.kind === 176 && ts.rangeContainsRange(body.statements, node); - case 224: - case 176: - case 203: + return body && body.kind === 179 && ts.rangeContainsRange(body.statements, node); + case 227: + case 179: + case 206: return ts.rangeContainsRange(parent.statements, node); - case 220: + case 223: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -28145,9 +28436,9 @@ var ts; if (indentation === -1) { if (isSomeBlock(node.kind)) { if (isSomeBlock(parent.kind) || - parent.kind === 224 || - parent.kind === 217 || - parent.kind === 218) { + parent.kind === 227 || + parent.kind === 220 || + parent.kind === 221) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -28178,10 +28469,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 198: return 69; - case 199: return 104; - case 197: return 83; - case 201: return 201; + case 201: return 69; + case 202: return 104; + case 200: return 83; + case 204: return 204; case 136: return 116; case 137: return 120; case 134: @@ -28320,7 +28611,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, true); } @@ -28365,7 +28656,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _n = _a.length; _i < _n; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -28400,7 +28691,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0, _n = trivia.length; _i < _n; _i++) { + for (var _i = 0; _i < trivia.length; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -28580,8 +28871,8 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 176: - case 203: + case 179: + case 206: return true; } return false; @@ -28589,7 +28880,7 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 135: - case 197: + case 200: case 162: case 134: case 133: @@ -28796,7 +29087,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 224 || !parentAndChildShareLine); + (parent.kind === 227 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -28820,7 +29111,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 180 && parent.elseStatement === child) { + if (parent.kind === 183 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 76, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -28842,7 +29133,7 @@ var ts; return node.parent.properties; case 153: return node.parent.elements; - case 197: + case 200: case 162: case 163: case 134: @@ -28929,25 +29220,25 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 198: - case 199: case 201: + case 202: + case 204: case 153: - case 176: - case 203: + case 179: + case 206: case 154: case 145: case 147: - case 204: - case 218: - case 217: + case 207: + case 221: + case 220: case 161: case 157: case 158: - case 177: - case 195: - case 211: - case 188: + case 180: + case 198: + case 214: + case 191: case 170: case 151: case 150: @@ -28960,13 +29251,13 @@ var ts; return true; } switch (parent) { - case 181: - case 182: case 184: case 185: + case 187: + case 188: + case 186: case 183: - case 180: - case 197: + case 200: case 162: case 134: case 133: @@ -28975,7 +29266,7 @@ var ts; case 135: case 136: case 137: - return child !== 176; + return child !== 179; default: return false; } @@ -29077,10 +29368,10 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(225, nodes.pos, nodes.end, 1024, this); + var list = createNode(228, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, _n = nodes.length; _i < _n; _i++) { + for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -29139,7 +29430,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (child.kind < 126) { return child; @@ -29205,13 +29496,13 @@ var ts; } }); } - if (declaration.kind === 202 && declaration.body.kind === 202) { + if (declaration.kind === 205 && declaration.body.kind === 205) { return; } - while (declaration.kind === 202 && declaration.parent.kind === 202) { + while (declaration.kind === 205 && declaration.parent.kind === 205) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 195 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 198 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -29496,7 +29787,7 @@ var ts; var namedDeclarations = []; ts.forEachChild(sourceFile, function visit(node) { switch (node.kind) { - case 197: + case 200: case 134: case 133: var functionDeclaration = node; @@ -29515,17 +29806,17 @@ var ts; ts.forEachChild(node, visit); } break; - case 198: - case 199: - case 200: case 201: case 202: + case 203: + case 204: case 205: - case 214: - case 210: - case 205: - case 207: case 208: + case 217: + case 213: + case 208: + case 210: + case 211: case 136: case 137: case 145: @@ -29533,14 +29824,14 @@ var ts; namedDeclarations.push(node); } case 135: - case 177: - case 196: + case 180: + case 199: case 150: case 151: - case 203: + case 206: ts.forEachChild(node, visit); break; - case 176: + case 179: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } @@ -29549,30 +29840,30 @@ var ts; if (!(node.flags & 112)) { break; } - case 195: + case 198: case 152: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 223: + case 226: case 132: case 131: namedDeclarations.push(node); break; - case 212: + case 215: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 206: + case 209: var importClause = node.importClause; if (importClause) { if (importClause.name) { namedDeclarations.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 208) { + if (importClause.namedBindings.kind === 211) { namedDeclarations.push(importClause.namedBindings); } else { @@ -29730,11 +30021,11 @@ var ts; if (declaration.kind === 162) { return true; } - if (declaration.kind !== 195 && declaration.kind !== 197) { + if (declaration.kind !== 198 && declaration.kind !== 200) { return false; } for (var parent_7 = declaration.parent; !ts.isFunctionBlock(parent_7); parent_7 = parent_7.parent) { - if (parent_7.kind === 224 || parent_7.kind === 203) { + if (parent_7.kind === 227 || parent_7.kind === 206) { return false; } } @@ -29775,7 +30066,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -29859,6 +30150,37 @@ var ts; sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; } + function transpile(input, compilerOptions, fileName, diagnostics) { + var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions(); + options.separateCompilation = true; + options.allowNonTsExtensions = true; + var inputFileName = fileName || "module.ts"; + var sourceFile = ts.createSourceFile(inputFileName, input, options.target); + if (diagnostics && sourceFile.parseDiagnostics) { + diagnostics.push.apply(diagnostics, sourceFile.parseDiagnostics); + } + var outputText; + var compilerHost = { + getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, + writeFile: function (name, text, writeByteOrderMark) { + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + outputText = text; + }, + getDefaultLibFileName: function () { return "lib.d.ts"; }, + useCaseSensitiveFileNames: function () { return false; }, + getCanonicalFileName: function (fileName) { return fileName; }, + getCurrentDirectory: function () { return ""; }, + getNewLine: function () { return "\r\n"; } + }; + var program = ts.createProgram([inputFileName], options, compilerHost); + if (diagnostics) { + diagnostics.push.apply(diagnostics, program.getGlobalDiagnostics()); + } + program.emit(); + ts.Debug.assert(outputText !== undefined, "Output generation failed"); + return outputText; + } + ts.transpile = transpile; function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { var sourceFile = ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); setSourceFileFields(sourceFile, scriptSnapshot, version); @@ -30100,7 +30422,7 @@ var ts; ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 191 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 194 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -30109,16 +30431,16 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 65 && - (node.parent.kind === 187 || node.parent.kind === 186) && + (node.parent.kind === 190 || node.parent.kind === 189) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 65 && - node.parent.kind === 191 && + node.parent.kind === 194 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 191; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 194; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -30147,7 +30469,7 @@ var ts; return node && node.parent && node.parent.kind === 158 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 202 && node.parent.name === node; + return node.parent.kind === 205 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 65 && @@ -30155,20 +30477,20 @@ var ts; } function isNameOfPropertyAssignment(node) { return (node.kind === 65 || node.kind === 8 || node.kind === 7) && - (node.parent.kind === 221 || node.parent.kind === 222) && node.parent.name === node; + (node.parent.kind === 224 || node.parent.kind === 225) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { case 132: case 131: - case 221: - case 223: + case 224: + case 226: case 134: case 133: case 136: case 137: - case 202: + case 205: return node.parent.name === node; case 156: return node.parent.argumentExpression === node; @@ -30237,17 +30559,17 @@ var ts; return undefined; } switch (node.kind) { - case 224: + case 227: case 134: case 133: - case 197: + case 200: case 162: case 136: case 137: - case 198: - case 199: case 201: case 202: + case 204: + case 205: return node; } } @@ -30255,18 +30577,18 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 202: return ScriptElementKind.moduleElement; - case 198: return ScriptElementKind.classElement; - case 199: return ScriptElementKind.interfaceElement; - case 200: return ScriptElementKind.typeElement; - case 201: return ScriptElementKind.enumElement; - case 195: + case 205: return ScriptElementKind.moduleElement; + case 201: return ScriptElementKind.classElement; + case 202: return ScriptElementKind.interfaceElement; + case 203: return ScriptElementKind.typeElement; + case 204: return ScriptElementKind.enumElement; + case 198: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 197: return ScriptElementKind.functionElement; + case 200: return ScriptElementKind.functionElement; case 136: return ScriptElementKind.memberGetAccessorElement; case 137: return ScriptElementKind.memberSetAccessorElement; case 134: @@ -30280,13 +30602,13 @@ var ts; case 138: return ScriptElementKind.callSignatureElement; case 135: return ScriptElementKind.constructorImplementationElement; case 128: return ScriptElementKind.typeParameterElement; - case 223: return ScriptElementKind.variableElement; + case 226: return ScriptElementKind.variableElement; case 129: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 205: - case 210: - case 207: - case 214: case 208: + case 213: + case 210: + case 217: + case 211: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -30346,7 +30668,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0, _n = oldSourceFiles.length; _i < _n; _i++) { + for (var _i = 0; _i < oldSourceFiles.length; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -30381,7 +30703,7 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { + for (var _i = 0; _i < rootFileNames.length; _i++) { var fileName = rootFileNames[_i]; if (!sourceFileUpToDate(program.getSourceFile(fileName))) { return false; @@ -30429,6 +30751,12 @@ var ts; if (!displayName) { return undefined; } + if (displayName === "default") { + var localSymbol = ts.getLocalSymbolForExportDefault(symbol); + if (localSymbol && localSymbol.name) { + displayName = symbol.valueDeclaration.localSymbol.name; + } + } var firstCharCode = displayName.charCodeAt(0); if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; @@ -30545,11 +30873,11 @@ var ts; symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); } } - else if (ts.getAncestor(contextToken, 207)) { + else if (ts.getAncestor(contextToken, 210)) { isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(contextToken)) { - var importDeclaration = ts.getAncestor(contextToken, 206); + var importDeclaration = ts.getAncestor(contextToken, 209); ts.Debug.assert(importDeclaration !== undefined); var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); symbols = filterModuleExports(exports, importDeclaration); @@ -30564,7 +30892,7 @@ var ts; var adjustedPosition = previousToken !== contextToken ? previousToken.getStart() : position; - var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile); + var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; var symbolMeanings = 793056 | 107455 | 1536 | 8388608; symbols = typeInfoResolver.getSymbolsInScope(scopeNode, symbolMeanings); } @@ -30589,7 +30917,7 @@ var ts; function showCompletionsInImportsClause(node) { if (node) { if (node.kind === 14 || node.kind === 23) { - return node.parent.kind === 209; + return node.parent.kind === 212; } } return false; @@ -30614,16 +30942,16 @@ var ts; case 117: return true; case 20: - return containingNodeKind === 202; + return containingNodeKind === 205; case 14: - return containingNodeKind === 198; + return containingNodeKind === 201; case 53: - return containingNodeKind === 195 + return containingNodeKind === 198 || containingNodeKind === 169; case 11: return containingNodeKind === 171; case 12: - return containingNodeKind === 175; + return containingNodeKind === 176; case 109: case 107: case 108: @@ -30672,7 +31000,7 @@ var ts; switch (kind) { case 162: case 163: - case 197: + case 200: case 134: case 133: case 136: @@ -30689,14 +31017,14 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 195 || - containingNodeKind === 196 || - containingNodeKind === 177 || - containingNodeKind === 201 || - isFunction(containingNodeKind) || - containingNodeKind === 198 || - containingNodeKind === 197 || + return containingNodeKind === 198 || containingNodeKind === 199 || + containingNodeKind === 180 || + containingNodeKind === 204 || + isFunction(containingNodeKind) || + containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || containingNodeKind === 151 || containingNodeKind === 150; case 20: @@ -30704,21 +31032,21 @@ var ts; case 18: return containingNodeKind === 151; case 16: - return containingNodeKind === 220 || + return containingNodeKind === 223 || isFunction(containingNodeKind); case 14: - return containingNodeKind === 201 || - containingNodeKind === 199 || + return containingNodeKind === 204 || + containingNodeKind === 202 || containingNodeKind === 145 || containingNodeKind === 150; case 22: return containingNodeKind === 131 && - (previousToken.parent.parent.kind === 199 || + (previousToken.parent.parent.kind === 202 || previousToken.parent.parent.kind === 145); case 24: - return containingNodeKind === 198 || - containingNodeKind === 197 || - containingNodeKind === 199 || + return containingNodeKind === 201 || + containingNodeKind === 200 || + containingNodeKind === 202 || isFunction(containingNodeKind); case 110: return containingNodeKind === 132; @@ -30771,7 +31099,7 @@ var ts; return exports; } if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 209) { + importDeclaration.importClause.namedBindings.kind === 212) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -30788,7 +31116,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 221 && m.kind !== 222) { + if (m.kind !== 224 && m.kind !== 225) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -30824,7 +31152,7 @@ var ts; var start = new Date().getTime(); var entries = []; var nameToSymbol = {}; - for (var _i = 0, _n = symbols.length; _i < _n; _i++) { + for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; var entry = createCompletionEntry(symbol, typeInfoResolver, location); if (entry) { @@ -31139,7 +31467,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 223) { + if (declaration.kind === 226) { var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -31155,7 +31483,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 205) { + if (declaration.kind === 208) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -31354,7 +31682,7 @@ var ts; symbol = typeInfoResolver.getAliasedSymbol(symbol); } } - if (node.parent.kind === 222) { + if (node.parent.kind === 225) { var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -31382,7 +31710,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 114) { if (symbol.flags & 32) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 198); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 201); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -31399,7 +31727,7 @@ var ts; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 135) || - (!selectConstructors && (d.kind === 197 || d.kind === 134 || d.kind === 133))) { + (!selectConstructors && (d.kind === 200 || d.kind === 134 || d.kind === 133))) { declarations.push(d); if (d.body) definition = d; @@ -31417,6 +31745,17 @@ var ts; } } function getOccurrencesAtPosition(fileName, position) { + var results = getOccurrencesAtPositionCore(fileName, position); + if (results) { + var sourceFile = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results.forEach(function (value) { + var targetFile = getCanonicalFileName(ts.normalizeSlashes(value.fileName)); + ts.Debug.assert(sourceFile == targetFile, "Unexpected file in results. Found results in " + targetFile + " expected only results in " + sourceFile + "."); + }); + } + return results; + } + function getOccurrencesAtPositionCore(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingWord(sourceFile, position); @@ -31430,58 +31769,58 @@ var ts; switch (node.kind) { case 84: case 76: - if (hasKind(node.parent, 180)) { + if (hasKind(node.parent, 183)) { return getIfElseOccurrences(node.parent); } break; case 90: - if (hasKind(node.parent, 188)) { + if (hasKind(node.parent, 191)) { return getReturnOccurrences(node.parent); } break; case 94: - if (hasKind(node.parent, 192)) { + if (hasKind(node.parent, 195)) { return getThrowOccurrences(node.parent); } break; case 68: - if (hasKind(parent(parent(node)), 193)) { + if (hasKind(parent(parent(node)), 196)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 96: case 81: - if (hasKind(parent(node), 193)) { + if (hasKind(parent(node), 196)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 92: - if (hasKind(node.parent, 190)) { + if (hasKind(node.parent, 193)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 67: case 73: - if (hasKind(parent(parent(parent(node))), 190)) { + if (hasKind(parent(parent(parent(node))), 193)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 66: case 71: - if (hasKind(node.parent, 187) || hasKind(node.parent, 186)) { + if (hasKind(node.parent, 190) || hasKind(node.parent, 189)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 82: - if (hasKind(node.parent, 183) || - hasKind(node.parent, 184) || - hasKind(node.parent, 185)) { + if (hasKind(node.parent, 186) || + hasKind(node.parent, 187) || + hasKind(node.parent, 188)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 100: case 75: - if (hasKind(node.parent, 182) || hasKind(node.parent, 181)) { + if (hasKind(node.parent, 185) || hasKind(node.parent, 184)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -31497,14 +31836,14 @@ var ts; } default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 177)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 180)) { return getModifierOccurrences(node.kind, node.parent); } } return undefined; function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 180) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 183) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -31515,7 +31854,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 180)) { + if (!hasKind(ifStatement.elseStatement, 183)) { break; } ifStatement = ifStatement.elseStatement; @@ -31548,7 +31887,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 176))) { + if (!(func && hasKind(func.body, 179))) { return undefined; } var keywords = []; @@ -31581,10 +31920,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 192) { + if (node.kind === 195) { statementAccumulator.push(node); } - else if (node.kind === 193) { + else if (node.kind === 196) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -31606,10 +31945,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent_9 = child.parent; - if (ts.isFunctionBlock(parent_9) || parent_9.kind === 224) { + if (ts.isFunctionBlock(parent_9) || parent_9.kind === 227) { return parent_9; } - if (parent_9.kind === 193) { + if (parent_9.kind === 196) { var tryStatement = parent_9; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -31634,7 +31973,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 82, 100, 75)) { - if (loopNode.kind === 181) { + if (loopNode.kind === 184) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 100)) { @@ -31669,13 +32008,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 183: + case 186: + case 187: + case 188: case 184: case 185: - case 181: - case 182: return getLoopBreakContinueOccurrences(owner); - case 190: + case 193: return getSwitchCaseDefaultOccurrences(owner); } } @@ -31686,7 +32025,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 187 || node.kind === 186) { + if (node.kind === 190 || node.kind === 189) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -31702,15 +32041,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { switch (node_1.kind) { - case 190: - if (statement.kind === 186) { + case 193: + if (statement.kind === 189) { continue; } - case 183: - case 184: + case 186: + case 187: + case 188: case 185: - case 182: - case 181: + case 184: if (!statement.label || isLabeledBy(node_1, statement.label.text)) { return node_1; } @@ -31749,18 +32088,18 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 198 || + if (!(container.kind === 201 || (declaration.kind === 129 && hasKind(container, 135)))) { return undefined; } } else if (modifier === 110) { - if (container.kind !== 198) { + if (container.kind !== 201) { return undefined; } } else if (modifier === 78 || modifier === 115) { - if (!(container.kind === 203 || container.kind === 224)) { + if (!(container.kind === 206 || container.kind === 227)) { return undefined; } } @@ -31771,14 +32110,14 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 203: - case 224: + case 206: + case 227: nodes = container.statements; break; case 135: nodes = container.parameters.concat(container.parent.members); break; - case 198: + case 201: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { @@ -31840,7 +32179,7 @@ var ts; return undefined; } var referenceEntries = []; - for (var _i = 0, _n = referenceSymbols.length; _i < _n; _i++) { + for (var _i = 0; _i < referenceSymbols.length; _i++) { var referenceSymbol = referenceSymbols[_i]; ts.addRange(referenceEntries, referenceSymbol.references); } @@ -31943,12 +32282,12 @@ var ts; } function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 210 || location.parent.kind === 214) && + (location.parent.kind === 213 || location.parent.kind === 217) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 210 || declaration.kind === 214; + return declaration.kind === 213 || declaration.kind === 217; }); } function getDeclaredName(symbol, location) { @@ -31985,7 +32324,7 @@ var ts; if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 198); + return ts.getAncestor(privateDeclaration, 201); } } if (symbol.flags & 8388608) { @@ -31997,7 +32336,7 @@ var ts; var scope = undefined; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -32006,7 +32345,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 224 && !ts.isExternalModule(container)) { + if (container.kind === 227 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -32212,11 +32551,11 @@ var ts; staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 224: + case 227: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 197: + case 200: case 162: break; default: @@ -32224,7 +32563,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 224) { + if (searchSpaceNode.kind === 227) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -32256,7 +32595,7 @@ var ts; var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { case 162: - case 197: + case 200: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } @@ -32267,13 +32606,13 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; - case 198: + case 201: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 224: - if (container.kind === 224 && !ts.isExternalModule(container)) { + case 227: + if (container.kind === 227 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -32308,11 +32647,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 198) { - getPropertySymbolFromTypeReference(ts.getClassBaseTypeNode(declaration)); - ts.forEach(ts.getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); + if (declaration.kind === 201) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 199) { + else if (declaration.kind === 202) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -32395,7 +32734,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -32463,32 +32802,32 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 129: - case 195: + case 198: case 152: case 132: case 131: - case 221: - case 222: - case 223: + case 224: + case 225: + case 226: case 134: case 133: case 135: case 136: case 137: - case 197: + case 200: case 162: case 163: - case 220: + case 223: return 1; case 128: - case 199: - case 200: + case 202: + case 203: case 145: return 2; - case 198: case 201: + case 204: return 1 | 2; - case 202: + case 205: if (node.name.kind === 8) { return 4 | 1; } @@ -32498,31 +32837,51 @@ var ts; else { return 4; } - case 209: - case 210: - case 205: - case 206: - case 211: case 212: + case 213: + case 208: + case 209: + case 214: + case 215: return 1 | 2 | 4; - case 224: + case 227: return 4 | 1; } return 1 | 2 | 4; ts.Debug.fail("Unknown declaration type"); } function isTypeReference(node) { - if (isRightSideOfQualifiedName(node)) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 141; + return node.parent.kind === 141 || node.parent.kind === 177; } function isNamespaceReference(node) { + return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); + } + function isPropertyAccessNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 155) { + while (root.parent && root.parent.kind === 155) { + root = root.parent; + } + isLastClause = root.name === node; + } + if (!isLastClause && root.parent.kind === 177 && root.parent.parent.kind === 222) { + var decl = root.parent.parent.parent; + return (decl.kind === 201 && root.parent.parent.token === 103) || + (decl.kind === 202 && root.parent.parent.token === 79); + } + return false; + } + function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; if (root.parent.kind === 126) { - while (root.parent && root.parent.kind === 126) + while (root.parent && root.parent.kind === 126) { root = root.parent; + } isLastClause = root.right === node; } return root.parent.kind === 141 && !isLastClause; @@ -32537,13 +32896,13 @@ var ts; ts.Debug.assert(node.kind === 65); if (node.parent.kind === 126 && node.parent.right === node && - node.parent.parent.kind === 205) { + node.parent.parent.kind === 208) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 211) { + if (node.parent.kind === 214) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -32596,7 +32955,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 202 && + if (nodeForStartPos.parent.parent.kind === 205 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -32652,7 +33011,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 202 && ts.getModuleInstanceState(declaration) == 1; + return declaration.kind === 205 && ts.getModuleInstanceState(declaration) == 1; }); } } @@ -32770,7 +33129,7 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 53) { - if (token.parent.kind === 195 || + if (token.parent.kind === 198 || token.parent.kind === 132 || token.parent.kind === 129) { return ClassificationTypeNames.operator; @@ -32800,7 +33159,7 @@ var ts; else if (tokenKind === 65) { if (token) { switch (token.parent.kind) { - case 198: + case 201: if (token.parent.name === token) { return ClassificationTypeNames.className; } @@ -32810,17 +33169,17 @@ var ts; return ClassificationTypeNames.typeParameterName; } return; - case 199: + case 202: if (token.parent.name === token) { return ClassificationTypeNames.interfaceName; } return; - case 201: + case 204: if (token.parent.name === token) { return ClassificationTypeNames.enumName; } return; - case 202: + case 205: if (token.parent.name === token) { return ClassificationTypeNames.moduleName; } @@ -32833,7 +33192,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0, _n = children.length; _i < _n; _i++) { + for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -32858,7 +33217,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0, _n = childNodes.length; _i < _n; _i++) { + for (var _i = 0; _i < childNodes.length; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -32991,7 +33350,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0, _n = declarations.length; _i < _n; _i++) { + for (var _i = 0; _i < declarations.length; _i++) { var current = declarations[_i]; var sourceFile_1 = current.getSourceFile(); if (sourceFile_1 && getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { @@ -33081,7 +33440,7 @@ var ts; case 8: case 7: if (ts.isDeclarationName(node) || - node.parent.kind === 216 || + node.parent.kind === 219 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -33382,7 +33741,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 224 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 227 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -33439,10 +33798,10 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } - if (node.parent.kind === 183) { + if (node.parent.kind === 186) { return textSpan(node); } if (node.parent.kind === 169 && node.parent.operatorToken.kind === 23) { @@ -33453,15 +33812,15 @@ var ts; } } switch (node.kind) { - case 177: + case 180: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 195: + case 198: case 132: case 131: return spanInVariableDeclaration(node); case 129: return spanInParameterDeclaration(node); - case 197: + case 200: case 134: case 133: case 136: @@ -33470,70 +33829,70 @@ var ts; case 162: case 163: return spanInFunctionDeclaration(node); - case 176: + case 179: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 203: + case 206: return spanInBlock(node); - case 220: + case 223: return spanInBlock(node.block); - case 179: - return textSpan(node.expression); - case 188: - return textSpan(node.getChildAt(0), node.expression); case 182: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 181: - return spanInNode(node.statement); - case 194: - return textSpan(node.getChildAt(0)); - case 180: - return textSpan(node, ts.findNextToken(node.expression, node)); + return textSpan(node.expression); case 191: - return spanInNode(node.statement); - case 187: - case 186: - return textSpan(node.getChildAt(0), node.label); - case 183: - return spanInForStatement(node); - case 184: + return textSpan(node.getChildAt(0), node.expression); case 185: return textSpan(node, ts.findNextToken(node.expression, node)); + case 184: + return spanInNode(node.statement); + case 197: + return textSpan(node.getChildAt(0)); + case 183: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 194: + return spanInNode(node.statement); case 190: + case 189: + return textSpan(node.getChildAt(0), node.label); + case 186: + return spanInForStatement(node); + case 187: + case 188: return textSpan(node, ts.findNextToken(node.expression, node)); - case 217: - case 218: - return spanInNode(node.statements[0]); case 193: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 220: + case 221: + return spanInNode(node.statements[0]); + case 196: return spanInBlock(node.tryBlock); - case 192: + case 195: return textSpan(node, node.expression); - case 211: + case 214: if (!node.expression) { return undefined; } return textSpan(node, node.expression); - case 205: + case 208: return textSpan(node, node.moduleReference); - case 206: + case 209: return textSpan(node, node.moduleSpecifier); - case 212: + case 215: return textSpan(node, node.moduleSpecifier); - case 202: + case 205: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 198: case 201: - case 223: + case 204: + case 226: case 157: case 158: return textSpan(node); - case 189: + case 192: return spanInNode(node.statement); - case 199: - case 200: + case 202: + case 203: return undefined; case 22: case 1: @@ -33560,7 +33919,7 @@ var ts; case 81: return spanInNextNode(node); default: - if (node.parent.kind === 221 && node.parent.name === node) { + if (node.parent.kind === 224 && node.parent.name === node) { return spanInNode(node.parent.initializer); } if (node.parent.kind === 160 && node.parent.type === node) { @@ -33573,12 +33932,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 184 || - variableDeclaration.parent.parent.kind === 185) { + if (variableDeclaration.parent.parent.kind === 187 || + variableDeclaration.parent.parent.kind === 188) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 177; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 183 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 180; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 186 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -33624,7 +33983,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 198 && functionDeclaration.kind !== 135); + (functionDeclaration.parent.kind === 201 && functionDeclaration.kind !== 135); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -33644,23 +34003,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 202: + case 205: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 182: - case 180: - case 184: case 185: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 183: + case 187: + case 188: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 186: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 196) { + if (forStatement.initializer.kind === 199) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -33679,34 +34038,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 201: + case 204: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 198: + case 201: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 204: + case 207: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 203: + case 206: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } + case 204: case 201: - case 198: return textSpan(node); - case 176: + case 179: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 220: + case 223: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 204: + case 207: var caseBlock = node.parent; var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { @@ -33718,7 +34077,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -33726,16 +34085,16 @@ var ts; function spanInCloseParenToken(node) { switch (node.parent.kind) { case 162: - case 197: + case 200: case 163: case 134: case 133: case 136: case 137: case 135: - case 182: - case 181: - case 183: + case 185: + case 184: + case 186: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -33743,7 +34102,7 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 221) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 224) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -33755,7 +34114,7 @@ var ts; return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 181) { + if (node.parent.kind === 184) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); diff --git a/bin/typescriptServices_internal.d.ts b/bin/typescriptServices_internal.d.ts index 692c34786ec..f0f86ebfe02 100644 --- a/bin/typescriptServices_internal.d.ts +++ b/bin/typescriptServices_internal.d.ts @@ -221,9 +221,9 @@ declare module ts { function isClassElement(n: Node): boolean; function isDeclarationName(name: Node): boolean; function isAliasSymbolDeclaration(node: Node): boolean; - function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode; - function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray; - function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; + function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration): HeritageClauseElement; + function getClassImplementsHeritageClauseElements(node: ClassDeclaration): NodeArray; + function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; function getHeritageClause(clauses: NodeArray, kind: SyntaxKind): HeritageClause; function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile; function getAncestor(node: Node, kind: SyntaxKind): Node; @@ -307,7 +307,7 @@ declare module ts { function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string; function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean): void; function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number; - function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration; + function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration; function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean; function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration): { firstAccessor: AccessorDeclaration; @@ -318,11 +318,22 @@ declare module ts { function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void; function emitComments(currentSourceFile: SourceFile, writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void): void; function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string): void; + function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean; + function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean; + function getLocalSymbolForExportDefault(symbol: Symbol): Symbol; } declare module ts { - var optionDeclarations: CommandLineOption[]; - function parseCommandLine(commandLine: string[]): ParsedCommandLine; + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; } declare module ts { diff --git a/bin/typescript_internal.d.ts b/bin/typescript_internal.d.ts index 845f01eb360..6fc997c62d5 100644 --- a/bin/typescript_internal.d.ts +++ b/bin/typescript_internal.d.ts @@ -221,9 +221,9 @@ declare module "typescript" { function isClassElement(n: Node): boolean; function isDeclarationName(name: Node): boolean; function isAliasSymbolDeclaration(node: Node): boolean; - function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode; - function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray; - function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; + function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration): HeritageClauseElement; + function getClassImplementsHeritageClauseElements(node: ClassDeclaration): NodeArray; + function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; function getHeritageClause(clauses: NodeArray, kind: SyntaxKind): HeritageClause; function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile; function getAncestor(node: Node, kind: SyntaxKind): Node; @@ -307,7 +307,7 @@ declare module "typescript" { function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string; function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean): void; function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number; - function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration; + function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration; function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean; function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration): { firstAccessor: AccessorDeclaration; @@ -318,11 +318,22 @@ declare module "typescript" { function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void; function emitComments(currentSourceFile: SourceFile, writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void): void; function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string): void; + function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean; + function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean; + function getLocalSymbolForExportDefault(symbol: Symbol): Symbol; } declare module "typescript" { - var optionDeclarations: CommandLineOption[]; - function parseCommandLine(commandLine: string[]): ParsedCommandLine; + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; } declare module "typescript" { From 3290814b714b932a2e842c6988b62cd085008d10 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 1 Apr 2015 12:31:39 -0700 Subject: [PATCH 53/61] Update test. --- tests/baselines/reference/APISample_linter.types.pull | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/baselines/reference/APISample_linter.types.pull b/tests/baselines/reference/APISample_linter.types.pull index e2a29716fcc..68ff796104b 100644 --- a/tests/baselines/reference/APISample_linter.types.pull +++ b/tests/baselines/reference/APISample_linter.types.pull @@ -2453,9 +2453,8 @@ declare module "typescript" { >expression : Expression >Expression : Expression } - interface ImportDeclaration extends Statement, ModuleElement { + interface ImportDeclaration extends ModuleElement { >ImportDeclaration : ImportDeclaration ->Statement : Statement >ModuleElement : ModuleElement importClause?: ImportClause; @@ -2964,10 +2963,10 @@ declare module "typescript" { >Symbol : Symbol >Symbol : Symbol - getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; ->getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; +>getExportsOfModule : (moduleSymbol: Symbol) => Symbol[] +>moduleSymbol : Symbol +>Symbol : Symbol >Symbol : Symbol } interface SymbolDisplayBuilder { From 22a87fb9cafce07e2701d15a95415349e161154a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Apr 2015 16:24:51 -0700 Subject: [PATCH 54/61] Class declarations should be block scoped. --- src/compiler/binder.ts | 17 +++++++---- .../classDeclarationBlockScoping1.errors.txt | 13 +++++++++ .../classDeclarationBlockScoping1.js | 22 ++++++++++++++ .../classDeclarationBlockScoping2.errors.txt | 18 ++++++++++++ .../classDeclarationBlockScoping2.js | 29 +++++++++++++++++++ .../reference/externModule.errors.txt | 14 ++++++++- .../compiler/classDeclarationBlockScoping1.ts | 7 +++++ .../compiler/classDeclarationBlockScoping2.ts | 9 ++++++ 8 files changed, 122 insertions(+), 7 deletions(-) create mode 100644 tests/baselines/reference/classDeclarationBlockScoping1.errors.txt create mode 100644 tests/baselines/reference/classDeclarationBlockScoping1.js create mode 100644 tests/baselines/reference/classDeclarationBlockScoping2.errors.txt create mode 100644 tests/baselines/reference/classDeclarationBlockScoping2.js create mode 100644 tests/cases/compiler/classDeclarationBlockScoping1.ts create mode 100644 tests/cases/compiler/classDeclarationBlockScoping2.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 0ae33d08fd6..494570c85c1 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -388,23 +388,28 @@ module ts { bindChildren(node, /*symbolKind:*/ 0, /*isBlockScopeContainer:*/ true); } - function bindBlockScopedVariableDeclaration(node: Declaration) { + function bindBlockScopedDeclaration(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags) { switch (blockScopeContainer.kind) { case SyntaxKind.ModuleDeclaration: - declareModuleMember(node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes); + declareModuleMember(node, symbolKind, symbolExcludes); break; case SyntaxKind.SourceFile: if (isExternalModule(container)) { - declareModuleMember(node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes); + declareModuleMember(node, symbolKind, symbolExcludes); break; } + // fall through. default: if (!blockScopeContainer.locals) { blockScopeContainer.locals = {}; } - declareSymbol(blockScopeContainer.locals, undefined, node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes); + declareSymbol(blockScopeContainer.locals, undefined, node, symbolKind, symbolExcludes); } - bindChildren(node, SymbolFlags.BlockScopedVariable, /*isBlockScopeContainer*/ false); + bindChildren(node, symbolKind, /*isBlockScopeContainer*/ false); + } + + function bindBlockScopedVariableDeclaration(node: Declaration) { + bindBlockScopedDeclaration(node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes); } function getDestructuringParameterName(node: Declaration) { @@ -493,7 +498,7 @@ module ts { bindCatchVariableDeclaration(node); break; case SyntaxKind.ClassDeclaration: - bindDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes, /*isBlockScopeContainer*/ false); + bindBlockScopedDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes); break; case SyntaxKind.InterfaceDeclaration: bindDeclaration(node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes, /*isBlockScopeContainer*/ false); diff --git a/tests/baselines/reference/classDeclarationBlockScoping1.errors.txt b/tests/baselines/reference/classDeclarationBlockScoping1.errors.txt new file mode 100644 index 00000000000..4f15007bb2a --- /dev/null +++ b/tests/baselines/reference/classDeclarationBlockScoping1.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/classDeclarationBlockScoping1.ts(5,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. + + +==== tests/cases/compiler/classDeclarationBlockScoping1.ts (1 errors) ==== + class C { + } + + { + class C { + ~ +!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/classDeclarationBlockScoping1.js b/tests/baselines/reference/classDeclarationBlockScoping1.js new file mode 100644 index 00000000000..717c2f788c3 --- /dev/null +++ b/tests/baselines/reference/classDeclarationBlockScoping1.js @@ -0,0 +1,22 @@ +//// [classDeclarationBlockScoping1.ts] +class C { +} + +{ + class C { + } +} + +//// [classDeclarationBlockScoping1.js] +var C = (function () { + function C() { + } + return C; +})(); +{ + var C = (function () { + function C() { + } + return C; + })(); +} diff --git a/tests/baselines/reference/classDeclarationBlockScoping2.errors.txt b/tests/baselines/reference/classDeclarationBlockScoping2.errors.txt new file mode 100644 index 00000000000..2a9885e110b --- /dev/null +++ b/tests/baselines/reference/classDeclarationBlockScoping2.errors.txt @@ -0,0 +1,18 @@ +tests/cases/compiler/classDeclarationBlockScoping2.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. +tests/cases/compiler/classDeclarationBlockScoping2.ts(5,15): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. + + +==== tests/cases/compiler/classDeclarationBlockScoping2.ts (2 errors) ==== + function f() { + class C {} + ~ +!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. + var c1 = C; + { + class C {} + ~ +!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. + var c2 = C; + } + return C === c1; + } \ No newline at end of file diff --git a/tests/baselines/reference/classDeclarationBlockScoping2.js b/tests/baselines/reference/classDeclarationBlockScoping2.js new file mode 100644 index 00000000000..9e468077119 --- /dev/null +++ b/tests/baselines/reference/classDeclarationBlockScoping2.js @@ -0,0 +1,29 @@ +//// [classDeclarationBlockScoping2.ts] +function f() { + class C {} + var c1 = C; + { + class C {} + var c2 = C; + } + return C === c1; +} + +//// [classDeclarationBlockScoping2.js] +function f() { + var C = (function () { + function C() { + } + return C; + })(); + var c1 = C; + { + var C = (function () { + function C() { + } + return C; + })(); + var c2 = C; + } + return C === c1; +} diff --git a/tests/baselines/reference/externModule.errors.txt b/tests/baselines/reference/externModule.errors.txt index d16c71ab05b..8d4126350c1 100644 --- a/tests/baselines/reference/externModule.errors.txt +++ b/tests/baselines/reference/externModule.errors.txt @@ -8,9 +8,13 @@ tests/cases/compiler/externModule.ts(18,6): error TS2390: Constructor implementa tests/cases/compiler/externModule.ts(20,13): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/externModule.ts(26,13): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/externModule.ts(28,13): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/externModule.ts(32,11): error TS2304: Cannot find name 'XDate'. +tests/cases/compiler/externModule.ts(34,7): error TS2304: Cannot find name 'XDate'. +tests/cases/compiler/externModule.ts(36,7): error TS2304: Cannot find name 'XDate'. +tests/cases/compiler/externModule.ts(37,3): error TS2304: Cannot find name 'XDate'. -==== tests/cases/compiler/externModule.ts (10 errors) ==== +==== tests/cases/compiler/externModule.ts (14 errors) ==== declare module { ~~~~~~~ !!! error TS2304: Cannot find name 'declare'. @@ -63,10 +67,18 @@ tests/cases/compiler/externModule.ts(28,13): error TS2391: Function implementati } var d=new XDate(); + ~~~~~ +!!! error TS2304: Cannot find name 'XDate'. d.getDay(); d=new XDate(1978,2); + ~~~~~ +!!! error TS2304: Cannot find name 'XDate'. d.getXDate(); var n=XDate.parse("3/2/2004"); + ~~~~~ +!!! error TS2304: Cannot find name 'XDate'. n=XDate.UTC(1964,2,1); + ~~~~~ +!!! error TS2304: Cannot find name 'XDate'. \ No newline at end of file diff --git a/tests/cases/compiler/classDeclarationBlockScoping1.ts b/tests/cases/compiler/classDeclarationBlockScoping1.ts new file mode 100644 index 00000000000..b6012f785b6 --- /dev/null +++ b/tests/cases/compiler/classDeclarationBlockScoping1.ts @@ -0,0 +1,7 @@ +class C { +} + +{ + class C { + } +} \ No newline at end of file diff --git a/tests/cases/compiler/classDeclarationBlockScoping2.ts b/tests/cases/compiler/classDeclarationBlockScoping2.ts new file mode 100644 index 00000000000..2a0c4c1213f --- /dev/null +++ b/tests/cases/compiler/classDeclarationBlockScoping2.ts @@ -0,0 +1,9 @@ +function f() { + class C {} + var c1 = C; + { + class C {} + var c2 = C; + } + return C === c1; +} \ No newline at end of file From ba8be9eef4a8e0a17467609f143e741ed8f9317f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Apr 2015 17:20:20 -0700 Subject: [PATCH 55/61] Support classes without names in our AST. Report any issues with this at 'check' time. --- src/compiler/checker.ts | 7 ++++++- src/compiler/diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/parser.ts | 2 +- src/services/navigationBar.ts | 6 +++--- .../reference/anonymousClassExpression1.errors.txt | 9 +++++++++ .../reference/anonymousClassExpression1.js | 13 +++++++++++++ .../classDeclarationBlockScoping1.errors.txt | 4 ++-- .../classDeclarationBlockScoping2.errors.txt | 8 ++++---- .../reference/classExpressionTest1.errors.txt | 4 ++-- .../baselines/reference/classInsideBlock.errors.txt | 4 ++-- .../classWithPredefinedTypesAsNames2.errors.txt | 4 ++-- .../reference/classWithPredefinedTypesAsNames2.js | 6 +++--- ...objectTypesWithPredefinedTypesAsName2.errors.txt | 4 ++-- .../objectTypesWithPredefinedTypesAsName2.js | 6 +++--- ...validIdentifiersInVariableStatements1.errors.txt | 4 ++-- ...parserInvalidIdentifiersInVariableStatements1.js | 6 +++--- tests/cases/compiler/anonymousClassExpression1.ts | 3 +++ .../cases/fourslash/scriptLexicalStructureItems2.ts | 2 +- .../fourslash/scriptLexicalStructureMissingName2.ts | 2 +- 20 files changed, 67 insertions(+), 32 deletions(-) create mode 100644 tests/baselines/reference/anonymousClassExpression1.errors.txt create mode 100644 tests/baselines/reference/anonymousClassExpression1.js create mode 100644 tests/cases/compiler/anonymousClassExpression1.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3ce7fe5e1cf..f9d91ab083c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9757,7 +9757,12 @@ module ts { function checkClassDeclaration(node: ClassDeclaration) { // Grammar checking if (node.parent.kind !== SyntaxKind.ModuleBlock && node.parent.kind !== SyntaxKind.SourceFile) { - grammarErrorOnNode(node, Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + grammarErrorOnFirstToken(node, Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + } + + // node.flags & NodeFlags.Default || kind === SyntaxKind.ClassExpression + if (!node.name && !(node.flags & NodeFlags.Default)) { + grammarErrorOnNode(node, Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkGrammarClassDeclarationHeritageClauses(node); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 3e9017786e5..b141ce607f2 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -167,6 +167,7 @@ module ts { Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, + A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1210, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f6edb3150b6..cafc1f5efa9 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -659,6 +659,10 @@ "category": "Error", "code": 1209 }, + "A class declaration without the 'default' modifier must have a name": { + "category": "Error", + "code": 1210 + }, "Duplicate identifier '{0}'.": { "category": "Error", "code": 2300 diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2972fba3979..7a28ad0441b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4764,7 +4764,7 @@ module ts { node.decorators = decorators; setModifiers(node, modifiers); parseExpected(SyntaxKind.ClassKeyword); - node.name = node.flags & NodeFlags.Default ? parseOptionalIdentifier() : parseIdentifier(); + node.name = parseOptionalIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause:*/ true); diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index c6463aba733..e475827837c 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -418,10 +418,10 @@ module ts.NavigationBar { } function createFunctionItem(node: FunctionDeclaration) { - if ((node.name || node.flags & NodeFlags.Default) && node.body && node.body.kind === SyntaxKind.Block) { + if (node.body && node.body.kind === SyntaxKind.Block) { let childItems = getItemsWorker(sortNodes((node.body).statements), createChildItem); - return getNavigationBarItem((!node.name && node.flags & NodeFlags.Default) ? "default": node.name.text , + return getNavigationBarItem(!node.name ? "default": node.name.text , ts.ScriptElementKind.functionElement, getNodeModifiers(node), [getNodeSpan(node)], @@ -470,7 +470,7 @@ module ts.NavigationBar { childItems = getItemsWorker(sortNodes(nodes), createChildItem); } - var nodeName = !node.name && (node.flags & NodeFlags.Default) ? "default" : node.name.text; + var nodeName = !node.name ? "default" : node.name.text; return getNavigationBarItem( nodeName, diff --git a/tests/baselines/reference/anonymousClassExpression1.errors.txt b/tests/baselines/reference/anonymousClassExpression1.errors.txt new file mode 100644 index 00000000000..db4c5b4ce3d --- /dev/null +++ b/tests/baselines/reference/anonymousClassExpression1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/anonymousClassExpression1.ts(2,19): error TS9003: 'class' expressions are not currently supported. + + +==== tests/cases/compiler/anonymousClassExpression1.ts (1 errors) ==== + function f() { + return typeof class {} === "function"; + ~~~~~ +!!! error TS9003: 'class' expressions are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/anonymousClassExpression1.js b/tests/baselines/reference/anonymousClassExpression1.js new file mode 100644 index 00000000000..a796b126a0e --- /dev/null +++ b/tests/baselines/reference/anonymousClassExpression1.js @@ -0,0 +1,13 @@ +//// [anonymousClassExpression1.ts] +function f() { + return typeof class {} === "function"; +} + +//// [anonymousClassExpression1.js] +function f() { + return typeof (function () { + function () { + } + return ; + })() === "function"; +} diff --git a/tests/baselines/reference/classDeclarationBlockScoping1.errors.txt b/tests/baselines/reference/classDeclarationBlockScoping1.errors.txt index 4f15007bb2a..367e53c0660 100644 --- a/tests/baselines/reference/classDeclarationBlockScoping1.errors.txt +++ b/tests/baselines/reference/classDeclarationBlockScoping1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/classDeclarationBlockScoping1.ts(5,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. +tests/cases/compiler/classDeclarationBlockScoping1.ts(5,5): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. ==== tests/cases/compiler/classDeclarationBlockScoping1.ts (1 errors) ==== @@ -7,7 +7,7 @@ tests/cases/compiler/classDeclarationBlockScoping1.ts(5,11): error TS9004: 'clas { class C { - ~ + ~~~~~ !!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. } } \ No newline at end of file diff --git a/tests/baselines/reference/classDeclarationBlockScoping2.errors.txt b/tests/baselines/reference/classDeclarationBlockScoping2.errors.txt index 2a9885e110b..a6d320fa415 100644 --- a/tests/baselines/reference/classDeclarationBlockScoping2.errors.txt +++ b/tests/baselines/reference/classDeclarationBlockScoping2.errors.txt @@ -1,16 +1,16 @@ -tests/cases/compiler/classDeclarationBlockScoping2.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. -tests/cases/compiler/classDeclarationBlockScoping2.ts(5,15): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. +tests/cases/compiler/classDeclarationBlockScoping2.ts(2,5): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. +tests/cases/compiler/classDeclarationBlockScoping2.ts(5,9): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. ==== tests/cases/compiler/classDeclarationBlockScoping2.ts (2 errors) ==== function f() { class C {} - ~ + ~~~~~ !!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. var c1 = C; { class C {} - ~ + ~~~~~ !!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. var c2 = C; } diff --git a/tests/baselines/reference/classExpressionTest1.errors.txt b/tests/baselines/reference/classExpressionTest1.errors.txt index 4d7e1cda639..2da1f0427c3 100644 --- a/tests/baselines/reference/classExpressionTest1.errors.txt +++ b/tests/baselines/reference/classExpressionTest1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/classExpressionTest1.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. +tests/cases/compiler/classExpressionTest1.ts(2,5): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. ==== tests/cases/compiler/classExpressionTest1.ts (1 errors) ==== function M() { class C { - ~ + ~~~~~ !!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. f() { var t: T; diff --git a/tests/baselines/reference/classInsideBlock.errors.txt b/tests/baselines/reference/classInsideBlock.errors.txt index 369e77735e2..8fb8e165b1d 100644 --- a/tests/baselines/reference/classInsideBlock.errors.txt +++ b/tests/baselines/reference/classInsideBlock.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. +tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts(2,5): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. ==== tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts (1 errors) ==== function foo() { class C { } - ~ + ~~~~~ !!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/classWithPredefinedTypesAsNames2.errors.txt b/tests/baselines/reference/classWithPredefinedTypesAsNames2.errors.txt index 73cb373180c..84c258b550d 100644 --- a/tests/baselines/reference/classWithPredefinedTypesAsNames2.errors.txt +++ b/tests/baselines/reference/classWithPredefinedTypesAsNames2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames2.ts(3,7): error TS1003: Identifier expected. +tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames2.ts(3,7): error TS1005: '{' expected. ==== tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames2.ts (1 errors) ==== @@ -6,4 +6,4 @@ tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsName class void {} ~~~~ -!!! error TS1003: Identifier expected. \ No newline at end of file +!!! error TS1005: '{' expected. \ No newline at end of file diff --git a/tests/baselines/reference/classWithPredefinedTypesAsNames2.js b/tests/baselines/reference/classWithPredefinedTypesAsNames2.js index a47adcbe32f..91ff735accc 100644 --- a/tests/baselines/reference/classWithPredefinedTypesAsNames2.js +++ b/tests/baselines/reference/classWithPredefinedTypesAsNames2.js @@ -5,9 +5,9 @@ class void {} //// [classWithPredefinedTypesAsNames2.js] // classes cannot use predefined types as names -var = (function () { - function () { +var default_1 = (function () { + function default_1() { } - return ; + return default_1; })(); void {}; diff --git a/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.errors.txt b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.errors.txt index 32a693abdcb..f2dbd672300 100644 --- a/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.errors.txt +++ b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName2.ts(3,7): error TS1003: Identifier expected. +tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName2.ts(3,7): error TS1005: '{' expected. ==== tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName2.ts (1 errors) ==== @@ -6,4 +6,4 @@ tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPre class void {} // parse error unlike the others ~~~~ -!!! error TS1003: Identifier expected. \ No newline at end of file +!!! error TS1005: '{' expected. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.js b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.js index b47901b2f0c..974744f1870 100644 --- a/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.js +++ b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.js @@ -5,9 +5,9 @@ class void {} // parse error unlike the others //// [objectTypesWithPredefinedTypesAsName2.js] // it is an error to use a predefined type as a type name -var = (function () { - function () { +var default_1 = (function () { + function default_1() { } - return ; + return default_1; })(); void {}; // parse error unlike the others diff --git a/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.errors.txt b/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.errors.txt index 35b279b4437..d7245fc7082 100644 --- a/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.errors.txt +++ b/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts(1,5): error TS1134: Variable declaration expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts(3,5): error TS1134: Variable declaration expected. -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts(3,10): error TS1003: Identifier expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts(3,10): error TS1005: '{' expected. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts (3 errors) ==== @@ -12,6 +12,6 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInv ~~~~~ !!! error TS1134: Variable declaration expected. ~ -!!! error TS1003: Identifier expected. +!!! error TS1005: '{' expected. var bar; \ No newline at end of file diff --git a/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.js b/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.js index 422b0122466..e6b9c9fa1b8 100644 --- a/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.js +++ b/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.js @@ -9,10 +9,10 @@ var bar; var ; var foo; var ; -var = (function () { - function () { +var default_1 = (function () { + function default_1() { } - return ; + return default_1; })(); ; var bar; diff --git a/tests/cases/compiler/anonymousClassExpression1.ts b/tests/cases/compiler/anonymousClassExpression1.ts new file mode 100644 index 00000000000..594ac092512 --- /dev/null +++ b/tests/cases/compiler/anonymousClassExpression1.ts @@ -0,0 +1,3 @@ +function f() { + return typeof class {} === "function"; +} \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureItems2.ts b/tests/cases/fourslash/scriptLexicalStructureItems2.ts index 7022c082ced..3b94260ddbd 100644 --- a/tests/cases/fourslash/scriptLexicalStructureItems2.ts +++ b/tests/cases/fourslash/scriptLexicalStructureItems2.ts @@ -8,5 +8,5 @@ edit.insertLine("module A"); edit.insert("export class "); // should not crash -verify.getScriptLexicalStructureListCount(1); +verify.getScriptLexicalStructureListCount(2); diff --git a/tests/cases/fourslash/scriptLexicalStructureMissingName2.ts b/tests/cases/fourslash/scriptLexicalStructureMissingName2.ts index b805427ff63..bf0dc038991 100644 --- a/tests/cases/fourslash/scriptLexicalStructureMissingName2.ts +++ b/tests/cases/fourslash/scriptLexicalStructureMissingName2.ts @@ -8,4 +8,4 @@ // The class is unnamed, so its method is not included either. -verify.getScriptLexicalStructureListCount(0); +verify.getScriptLexicalStructureListCount(2); From 189482e730bbb4cc5b5b081923ebefb141ca15c3 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Apr 2015 17:28:59 -0700 Subject: [PATCH 56/61] Produce a name for anonymous class expressions when we perform downlevel emit. --- src/compiler/emitter.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 6ec4ea23898..5d4bf9df3e1 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -262,6 +262,7 @@ module ts { switch (node.kind) { case SyntaxKind.FunctionDeclaration: case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: generateNameForFunctionOrClassDeclaration(node); break; case SyntaxKind.ModuleDeclaration: From 2eddf310dc37c4d4f6982da3c5a65f69bba3dc07 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 1 Apr 2015 18:56:57 -0700 Subject: [PATCH 57/61] Fix error spans for classes. --- src/compiler/checker.ts | 5 ++--- .../reference/classDeclarationBlockScoping1.errors.txt | 4 ++-- .../reference/classDeclarationBlockScoping2.errors.txt | 8 ++++---- tests/baselines/reference/classExpressionTest1.errors.txt | 4 ++-- tests/baselines/reference/classInsideBlock.errors.txt | 4 ++-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f9d91ab083c..f0882a51c4f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9757,12 +9757,11 @@ module ts { function checkClassDeclaration(node: ClassDeclaration) { // Grammar checking if (node.parent.kind !== SyntaxKind.ModuleBlock && node.parent.kind !== SyntaxKind.SourceFile) { - grammarErrorOnFirstToken(node, Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); + grammarErrorOnNode(node, Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); } - // node.flags & NodeFlags.Default || kind === SyntaxKind.ClassExpression if (!node.name && !(node.flags & NodeFlags.Default)) { - grammarErrorOnNode(node, Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); + grammarErrorOnFirstToken(node, Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkGrammarClassDeclarationHeritageClauses(node); diff --git a/tests/baselines/reference/classDeclarationBlockScoping1.errors.txt b/tests/baselines/reference/classDeclarationBlockScoping1.errors.txt index 367e53c0660..4f15007bb2a 100644 --- a/tests/baselines/reference/classDeclarationBlockScoping1.errors.txt +++ b/tests/baselines/reference/classDeclarationBlockScoping1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/classDeclarationBlockScoping1.ts(5,5): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. +tests/cases/compiler/classDeclarationBlockScoping1.ts(5,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. ==== tests/cases/compiler/classDeclarationBlockScoping1.ts (1 errors) ==== @@ -7,7 +7,7 @@ tests/cases/compiler/classDeclarationBlockScoping1.ts(5,5): error TS9004: 'class { class C { - ~~~~~ + ~ !!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. } } \ No newline at end of file diff --git a/tests/baselines/reference/classDeclarationBlockScoping2.errors.txt b/tests/baselines/reference/classDeclarationBlockScoping2.errors.txt index a6d320fa415..2a9885e110b 100644 --- a/tests/baselines/reference/classDeclarationBlockScoping2.errors.txt +++ b/tests/baselines/reference/classDeclarationBlockScoping2.errors.txt @@ -1,16 +1,16 @@ -tests/cases/compiler/classDeclarationBlockScoping2.ts(2,5): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. -tests/cases/compiler/classDeclarationBlockScoping2.ts(5,9): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. +tests/cases/compiler/classDeclarationBlockScoping2.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. +tests/cases/compiler/classDeclarationBlockScoping2.ts(5,15): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. ==== tests/cases/compiler/classDeclarationBlockScoping2.ts (2 errors) ==== function f() { class C {} - ~~~~~ + ~ !!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. var c1 = C; { class C {} - ~~~~~ + ~ !!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. var c2 = C; } diff --git a/tests/baselines/reference/classExpressionTest1.errors.txt b/tests/baselines/reference/classExpressionTest1.errors.txt index 2da1f0427c3..4d7e1cda639 100644 --- a/tests/baselines/reference/classExpressionTest1.errors.txt +++ b/tests/baselines/reference/classExpressionTest1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/classExpressionTest1.ts(2,5): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. +tests/cases/compiler/classExpressionTest1.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. ==== tests/cases/compiler/classExpressionTest1.ts (1 errors) ==== function M() { class C { - ~~~~~ + ~ !!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. f() { var t: T; diff --git a/tests/baselines/reference/classInsideBlock.errors.txt b/tests/baselines/reference/classInsideBlock.errors.txt index 8fb8e165b1d..369e77735e2 100644 --- a/tests/baselines/reference/classInsideBlock.errors.txt +++ b/tests/baselines/reference/classInsideBlock.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts(2,5): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. +tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. ==== tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts (1 errors) ==== function foo() { class C { } - ~~~~~ + ~ !!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration. } \ No newline at end of file From d048d7d3d27a6eb61837b221ad73538a83b29397 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 2 Apr 2015 13:59:53 -0700 Subject: [PATCH 58/61] Fix tests. --- tests/baselines/reference/anonymousClassExpression1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/baselines/reference/anonymousClassExpression1.js b/tests/baselines/reference/anonymousClassExpression1.js index a796b126a0e..78cf5b05c51 100644 --- a/tests/baselines/reference/anonymousClassExpression1.js +++ b/tests/baselines/reference/anonymousClassExpression1.js @@ -6,8 +6,8 @@ function f() { //// [anonymousClassExpression1.js] function f() { return typeof (function () { - function () { + function default_1() { } - return ; + return default_1; })() === "function"; } From 0f079632b9642568f09f23ae94ec81bf109a733a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 2 Apr 2015 14:58:43 -0700 Subject: [PATCH 59/61] PR feedback. --- .../diagnosticInformationMap.generated.ts | 31 ++++---- src/compiler/diagnosticMessages.json | 34 +++++---- src/services/services.ts | 75 ++++++++++--------- .../getJavaScriptSemanticDiagnostics1.ts | 2 +- .../getJavaScriptSemanticDiagnostics10.ts | 2 +- .../getJavaScriptSemanticDiagnostics11.ts | 2 +- .../getJavaScriptSemanticDiagnostics12.ts | 2 +- .../getJavaScriptSemanticDiagnostics13.ts | 2 +- .../getJavaScriptSemanticDiagnostics14.ts | 2 +- .../getJavaScriptSemanticDiagnostics15.ts | 2 +- .../getJavaScriptSemanticDiagnostics16.ts | 2 +- .../getJavaScriptSemanticDiagnostics17.ts | 2 +- .../getJavaScriptSemanticDiagnostics18.ts | 2 +- .../getJavaScriptSemanticDiagnostics19.ts | 2 +- .../getJavaScriptSemanticDiagnostics2.ts | 2 +- .../getJavaScriptSemanticDiagnostics20.ts | 2 +- .../getJavaScriptSemanticDiagnostics21.ts | 15 ++++ .../getJavaScriptSemanticDiagnostics3.ts | 2 +- .../getJavaScriptSemanticDiagnostics4.ts | 2 +- .../getJavaScriptSemanticDiagnostics5.ts | 2 +- .../getJavaScriptSemanticDiagnostics6.ts | 2 +- .../getJavaScriptSemanticDiagnostics7.ts | 2 +- .../getJavaScriptSemanticDiagnostics8.ts | 2 +- .../getJavaScriptSemanticDiagnostics9.ts | 2 +- 24 files changed, 109 insertions(+), 86 deletions(-) create mode 100644 tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 5f0ca431aa2..64a2515e774 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -506,21 +506,22 @@ module ts { Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." }, - import_can_only_be_used_in_TypeScript: { code: 8002, category: DiagnosticCategory.Error, key: "'import ... =' can only be used in TypeScript." }, - export_can_only_be_used_in_TypeScript: { code: 8003, category: DiagnosticCategory.Error, key: "'export=' can only be used in TypeScript." }, - type_parameter_declarations_can_only_be_used_in_TypeScript: { code: 8004, category: DiagnosticCategory.Error, key: "'type parameter declarations' can only be used in TypeScript." }, - implements_clauses_can_only_be_used_in_TypeScript: { code: 8005, category: DiagnosticCategory.Error, key: "'implements clauses' can only be used in TypeScript." }, - interface_declarations_can_only_be_used_in_TypeScript: { code: 8006, category: DiagnosticCategory.Error, key: "'interface declarations' can only be used in TypeScript." }, - module_declarations_can_only_be_used_in_TypeScript: { code: 8007, category: DiagnosticCategory.Error, key: "'module declarations' can only be used in TypeScript." }, - type_aliases_can_only_be_used_in_TypeScript: { code: 8008, category: DiagnosticCategory.Error, key: "'type aliases' can only be used in TypeScript." }, - _0_can_only_be_used_in_TypeScript: { code: 8009, category: DiagnosticCategory.Error, key: "'{0}' can only be used in TypeScript." }, - types_can_only_be_used_in_TypeScript: { code: 8010, category: DiagnosticCategory.Error, key: "'types' can only be used in TypeScript." }, - type_arguments_can_only_be_used_in_TypeScript: { code: 8011, category: DiagnosticCategory.Error, key: "'type arguments' can only be used in TypeScript." }, - parameter_modifiers_can_only_be_used_in_TypeScript: { code: 8012, category: DiagnosticCategory.Error, key: "'parameter modifiers' can only be used in TypeScript." }, - can_only_be_used_in_TypeScript: { code: 8013, category: DiagnosticCategory.Error, key: "'?' can only be used in TypeScript." }, - property_declarations_can_only_be_used_in_TypeScript: { code: 8014, category: DiagnosticCategory.Error, key: "'property declarations' can only be used in TypeScript." }, - enum_declarations_can_only_be_used_in_TypeScript: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in TypeScript." }, - type_assertion_expressions_can_only_be_used_in_TypeScript: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in TypeScript." }, + import_can_only_be_used_in_a_ts_file: { code: 8002, category: DiagnosticCategory.Error, key: "'import ... =' can only be used in a .ts file." }, + export_can_only_be_used_in_a_ts_file: { code: 8003, category: DiagnosticCategory.Error, key: "'export=' can only be used in a .ts file." }, + type_parameter_declarations_can_only_be_used_in_a_ts_file: { code: 8004, category: DiagnosticCategory.Error, key: "'type parameter declarations' can only be used in a .ts file." }, + implements_clauses_can_only_be_used_in_a_ts_file: { code: 8005, category: DiagnosticCategory.Error, key: "'implements clauses' can only be used in a .ts file." }, + interface_declarations_can_only_be_used_in_a_ts_file: { code: 8006, category: DiagnosticCategory.Error, key: "'interface declarations' can only be used in a .ts file." }, + module_declarations_can_only_be_used_in_a_ts_file: { code: 8007, category: DiagnosticCategory.Error, key: "'module declarations' can only be used in a .ts file." }, + type_aliases_can_only_be_used_in_a_ts_file: { code: 8008, category: DiagnosticCategory.Error, key: "'type aliases' can only be used in a .ts file." }, + _0_can_only_be_used_in_a_ts_file: { code: 8009, category: DiagnosticCategory.Error, key: "'{0}' can only be used in a .ts file." }, + types_can_only_be_used_in_a_ts_file: { code: 8010, category: DiagnosticCategory.Error, key: "'types' can only be used in a .ts file." }, + type_arguments_can_only_be_used_in_a_ts_file: { code: 8011, category: DiagnosticCategory.Error, key: "'type arguments' can only be used in a .ts file." }, + parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: DiagnosticCategory.Error, key: "'parameter modifiers' can only be used in a .ts file." }, + can_only_be_used_in_a_ts_file: { code: 8013, category: DiagnosticCategory.Error, key: "'?' can only be used in a .ts file." }, + property_declarations_can_only_be_used_in_a_ts_file: { code: 8014, category: DiagnosticCategory.Error, key: "'property declarations' can only be used in a .ts file." }, + enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in a .ts file." }, + type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in a .ts file." }, + decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: DiagnosticCategory.Error, key: "'decorators' can only be used in a .ts file." }, yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 085d4ccb33d..79b652619b5 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2017,66 +2017,70 @@ "category": "Error", "code": 8001 }, - "'import ... =' can only be used in TypeScript.": { + "'import ... =' can only be used in a .ts file.": { "category": "Error", "code": 8002 }, - "'export=' can only be used in TypeScript.": { + "'export=' can only be used in a .ts file.": { "category": "Error", "code": 8003 }, - "'type parameter declarations' can only be used in TypeScript.": { + "'type parameter declarations' can only be used in a .ts file.": { "category": "Error", "code": 8004 }, - "'implements clauses' can only be used in TypeScript.": { + "'implements clauses' can only be used in a .ts file.": { "category": "Error", "code": 8005 }, - "'interface declarations' can only be used in TypeScript.": { + "'interface declarations' can only be used in a .ts file.": { "category": "Error", "code": 8006 }, - "'module declarations' can only be used in TypeScript.": { + "'module declarations' can only be used in a .ts file.": { "category": "Error", "code": 8007 }, - "'type aliases' can only be used in TypeScript.": { + "'type aliases' can only be used in a .ts file.": { "category": "Error", "code": 8008 }, - "'{0}' can only be used in TypeScript.": { + "'{0}' can only be used in a .ts file.": { "category": "Error", "code": 8009 }, - "'types' can only be used in TypeScript.": { + "'types' can only be used in a .ts file.": { "category": "Error", "code": 8010 }, - "'type arguments' can only be used in TypeScript.": { + "'type arguments' can only be used in a .ts file.": { "category": "Error", "code": 8011 }, - "'parameter modifiers' can only be used in TypeScript.": { + "'parameter modifiers' can only be used in a .ts file.": { "category": "Error", "code": 8012 }, - "'?' can only be used in TypeScript.": { + "'?' can only be used in a .ts file.": { "category": "Error", "code": 8013 }, - "'property declarations' can only be used in TypeScript.": { + "'property declarations' can only be used in a .ts file.": { "category": "Error", "code": 8014 }, - "'enum declarations' can only be used in TypeScript.": { + "'enum declarations' can only be used in a .ts file.": { "category": "Error", "code": 8015 }, - "'type assertion expressions' can only be used in TypeScript.": { + "'type assertion expressions' can only be used in a .ts file.": { "category": "Error", "code": 8016 }, + "'decorators' can only be used in a .ts file.": { + "category": "Error", + "code": 8017 + }, "'yield' expressions are not currently supported.": { "category": "Error", diff --git a/src/services/services.ts b/src/services/services.ts index 4c0d3e751c0..831e8a95de3 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2472,41 +2472,41 @@ module ts { return diagnostics; - function walk(node: Node) { + function walk(node: Node): boolean { if (!node) { - return; + return false; } switch (node.kind) { case SyntaxKind.ImportEqualsDeclaration: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.import_can_only_be_used_in_TypeScript)); - return; + diagnostics.push(createDiagnosticForNode(node, Diagnostics.import_can_only_be_used_in_a_ts_file)); + return true; case SyntaxKind.ExportAssignment: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.export_can_only_be_used_in_TypeScript)); - return; + diagnostics.push(createDiagnosticForNode(node, Diagnostics.export_can_only_be_used_in_a_ts_file)); + return true; case SyntaxKind.ClassDeclaration: let classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { - return; + return true; } break; case SyntaxKind.HeritageClause: let heritageClause = node; if (heritageClause.token === SyntaxKind.ImplementsKeyword) { - diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_TypeScript)); - return; + diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); + return true; } break; case SyntaxKind.InterfaceDeclaration: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.interface_declarations_can_only_be_used_in_TypeScript)); - return; + diagnostics.push(createDiagnosticForNode(node, Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); + return true; case SyntaxKind.ModuleDeclaration: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.module_declarations_can_only_be_used_in_TypeScript)); - return; + diagnostics.push(createDiagnosticForNode(node, Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); + return true; case SyntaxKind.TypeAliasDeclaration: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.type_aliases_can_only_be_used_in_TypeScript)); - return; + diagnostics.push(createDiagnosticForNode(node, Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); + return true; case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: case SyntaxKind.Constructor: @@ -2520,19 +2520,19 @@ module ts { if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || checkTypeAnnotation(functionDeclaration.type)) { - return; + return true; } break; case SyntaxKind.VariableStatement: let variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { - return; + return true; } break; case SyntaxKind.VariableDeclaration: let variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { - return; + return true; } break; case SyntaxKind.CallExpression: @@ -2541,8 +2541,8 @@ module ts { if (expression.typeArguments && expression.typeArguments.length > 0) { let start = expression.typeArguments.pos; diagnostics.push(createFileDiagnostic(sourceFile, start, expression.typeArguments.end - start, - Diagnostics.type_arguments_can_only_be_used_in_TypeScript)); - return; + Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); + return true; } break; case SyntaxKind.Parameter: @@ -2550,37 +2550,40 @@ module ts { if (parameter.modifiers) { let start = parameter.modifiers.pos; diagnostics.push(createFileDiagnostic(sourceFile, start, parameter.modifiers.end - start, - Diagnostics.parameter_modifiers_can_only_be_used_in_TypeScript)); - return; + Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); + return true; } if (parameter.questionToken) { - diagnostics.push(createDiagnosticForNode(parameter.questionToken, Diagnostics.can_only_be_used_in_TypeScript)); - return; + diagnostics.push(createDiagnosticForNode(parameter.questionToken, Diagnostics.can_only_be_used_in_a_ts_file)); + return true; } if (parameter.type) { - diagnostics.push(createDiagnosticForNode(parameter.type, Diagnostics.types_can_only_be_used_in_TypeScript)); - return; + diagnostics.push(createDiagnosticForNode(parameter.type, Diagnostics.types_can_only_be_used_in_a_ts_file)); + return true; } break; case SyntaxKind.PropertyDeclaration: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.property_declarations_can_only_be_used_in_TypeScript)); - return + diagnostics.push(createDiagnosticForNode(node, Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); + return true; case SyntaxKind.EnumDeclaration: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.enum_declarations_can_only_be_used_in_TypeScript)); - return; + diagnostics.push(createDiagnosticForNode(node, Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); + return true; case SyntaxKind.TypeAssertionExpression: let typeAssertionExpression = node; - diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, Diagnostics.type_assertion_expressions_can_only_be_used_in_TypeScript)); - return; + diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); + return true; + case SyntaxKind.Decorator: + diagnostics.push(createDiagnosticForNode(node, Diagnostics.decorators_can_only_be_used_in_a_ts_file)); + return true; } - forEachChild(node, walk); + return forEachChild(node, walk); } function checkTypeParameters(typeParameters: NodeArray): boolean { if (typeParameters) { let start = typeParameters.pos; - diagnostics.push(createFileDiagnostic(sourceFile, start, typeParameters.end - start, Diagnostics.type_parameter_declarations_can_only_be_used_in_TypeScript)); + diagnostics.push(createFileDiagnostic(sourceFile, start, typeParameters.end - start, Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return true; } return false; @@ -2588,7 +2591,7 @@ module ts { function checkTypeAnnotation(type: TypeNode): boolean { if (type) { - diagnostics.push(createDiagnosticForNode(type, Diagnostics.types_can_only_be_used_in_TypeScript)); + diagnostics.push(createDiagnosticForNode(type, Diagnostics.types_can_only_be_used_in_a_ts_file)); return true; } @@ -2603,7 +2606,7 @@ module ts { case SyntaxKind.PrivateKeyword: case SyntaxKind.ProtectedKeyword: case SyntaxKind.DeclareKeyword: - diagnostics.push(createDiagnosticForNode(modifier, Diagnostics._0_can_only_be_used_in_TypeScript, tokenToString(modifier.kind))); + diagnostics.push(createDiagnosticForNode(modifier, Diagnostics._0_can_only_be_used_in_a_ts_file, tokenToString(modifier.kind))); return true; // These are all legal modifiers. diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts index 5fbe669de30..05bc6727710 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics1.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'import ... =' can only be used in TypeScript.", + "message": "'import ... =' can only be used in a .ts file.", "start": 0, "length": 13, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts index ecefb25d218..84c6c45f870 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics10.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'type parameter declarations' can only be used in TypeScript.", + "message": "'type parameter declarations' can only be used in a .ts file.", "start": 11, "length": 1, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts index da468d59f3b..7dfd3c4965b 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics11.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'types' can only be used in TypeScript.", + "message": "'types' can only be used in a .ts file.", "start": 14, "length": 6, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts index 89e459d2a5b..88a1331ef23 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics12.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'declare' can only be used in TypeScript.", + "message": "'declare' can only be used in a .ts file.", "start": 0, "length": 7, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts index c3c0fc9ef7b..21a5e9cdcaa 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics13.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'types' can only be used in TypeScript.", + "message": "'types' can only be used in a .ts file.", "start": 7, "length": 12, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts index 5e7c2010480..8cd178ffec1 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics14.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'type arguments' can only be used in TypeScript.", + "message": "'type arguments' can only be used in a .ts file.", "start": 4, "length": 6, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts index 2c7d87a74e2..d1c3a8c6e63 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics15.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'parameter modifiers' can only be used in TypeScript.", + "message": "'parameter modifiers' can only be used in a .ts file.", "start": 11, "length": 6, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts index 3bc3030e2b1..2ccac13dbf9 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics16.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'?' can only be used in TypeScript.", + "message": "'?' can only be used in a .ts file.", "start": 12, "length": 1, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts index 39b67b13ea8..5e94c806c60 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics17.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'types' can only be used in TypeScript.", + "message": "'types' can only be used in a .ts file.", "start": 14, "length": 6, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts index 96dc2bce892..a2859060cde 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics18.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'property declarations' can only be used in TypeScript.", + "message": "'property declarations' can only be used in a .ts file.", "start": 10, "length": 1, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts index efbe1694419..34dbbc0271d 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics19.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'enum declarations' can only be used in TypeScript.", + "message": "'enum declarations' can only be used in a .ts file.", "start": 5, "length": 1, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts index abf9f693b0c..b26d16f9017 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'export=' can only be used in TypeScript.", + "message": "'export=' can only be used in a .ts file.", "start": 0, "length": 11, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts index d0f6cef468e..790f02bac92 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'type assertion expressions' can only be used in TypeScript.", + "message": "'type assertion expressions' can only be used in a .ts file.", "start": 9, "length": 6, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts new file mode 100644 index 00000000000..23e3274261c --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: a.js +//// @internal class C {} + +verify.getSemanticDiagnostics(`[ + { + "message": "'decorators' can only be used in a .ts file.", + "start": 0, + "length": 9, + "category": "error", + "code": 8017 + } +]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts index 4e424281dfd..c7b6c6a80cf 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics3.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'type parameter declarations' can only be used in TypeScript.", + "message": "'type parameter declarations' can only be used in a .ts file.", "start": 8, "length": 1, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts index 80e8873b01a..f32ee5c4b68 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics4.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'public' can only be used in TypeScript.", + "message": "'public' can only be used in a .ts file.", "start": 0, "length": 6, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts index 411bef8a82f..e405624c9b0 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics5.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'implements clauses' can only be used in TypeScript.", + "message": "'implements clauses' can only be used in a .ts file.", "start": 8, "length": 12, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts index f86d26ba723..918eb035a8b 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics6.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'interface declarations' can only be used in TypeScript.", + "message": "'interface declarations' can only be used in a .ts file.", "start": 10, "length": 1, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts index ccd9450f49b..cdec262f699 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics7.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'module declarations' can only be used in TypeScript.", + "message": "'module declarations' can only be used in a .ts file.", "start": 7, "length": 1, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts index 11105a44197..a71a2cf2bc7 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'type aliases' can only be used in TypeScript.", + "message": "'type aliases' can only be used in a .ts file.", "start": 0, "length": 11, "category": "error", diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts index 81016fd8ba7..4bd4ce706b9 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics9.ts @@ -6,7 +6,7 @@ verify.getSemanticDiagnostics(`[ { - "message": "'public' can only be used in TypeScript.", + "message": "'public' can only be used in a .ts file.", "start": 0, "length": 6, "category": "error", From 5ecfafd32bc8094140cf229b67971e2ba20c08b7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 2 Apr 2015 15:14:41 -0700 Subject: [PATCH 60/61] PR feedback. --- src/services/services.ts | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 831e8a95de3..12ea84eafc1 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3238,26 +3238,25 @@ module ts { function getJavaScriptCompletionEntries(): CompletionEntry[] { let entries: CompletionEntry[] = []; - let allIdentifiers: Map = {}; + let allNames: Map = {}; + let target = program.getCompilerOptions().target; for (let sourceFile of program.getSourceFiles()) { let nameTable = getNameTable(sourceFile); for (let name in nameTable) { - allIdentifiers[name] = name; - } - } - - var target = program.getCompilerOptions().target; - for (let name in allIdentifiers) { - let displayName = getCompletionEntryDisplayName(name, target, /*performCharacterChecks:*/ true); - if (displayName) { - // Use '1' so that all javascript identifier entries sort after Symbol entries. - entries.push({ - name: displayName, - kind: ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }); + if (!allNames[name]) { + allNames[name] = name; + let displayName = getCompletionEntryDisplayName(name, target, /*performCharacterChecks:*/ true); + if (displayName) { + let entry = { + name: displayName, + kind: ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); + } + } } } From 0bf65e4c672d2f37f44bb41790b09d6b6690cc66 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Thu, 2 Apr 2015 15:36:45 -0700 Subject: [PATCH 61/61] Fix annoying spellin errors. --- src/compiler/parser.ts | 8 ++++---- src/services/navigateTo.ts | 2 +- src/services/patternMatcher.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 14311ccbc52..13dbccbe4b1 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -824,7 +824,7 @@ module ts { // to reuse are already at the appropriate position in the new text. That way when we // reuse them, we don't have to figure out if they need to be adjusted. Second, it makes // it very easy to determine if we can reuse a node. If the node's position is at where - // we are in the text, then we can reuse it. Otherwise we can't. If hte node's position + // we are in the text, then we can reuse it. Otherwise we can't. If the node's position // is ahead of us, then we'll need to rescan tokens. If the node's position is behind // us, then we'll need to skip it or crumble it as appropriate // @@ -1029,7 +1029,7 @@ module ts { // that some tokens that would be considered identifiers may be considered keywords. // // When adding more parser context flags, consider which is the more common case that the - // flag will be in. This should be hte 'false' state for that flag. The reason for this is + // flag will be in. This should be the 'false' state for that flag. The reason for this is // that we don't store data in our nodes unless the value is in the *non-default* state. So, // for example, more often than code 'allows-in' (or doesn't 'disallow-in'). We opt for // 'disallow-in' set to 'false'. Otherwise, if we had 'allowsIn' set to 'true', then almost @@ -1040,7 +1040,7 @@ module ts { // // An important thing about these context concepts. By default they are effectively inherited // while parsing through every grammar production. i.e. if you don't change them, then when - // you parse a sub-production, it will have the same context values as hte parent production. + // you parse a sub-production, it will have the same context values as the parent production. // This is great most of the time. After all, consider all the 'expression' grammar productions // and how nearly all of them pass along the 'in' and 'yield' context values: // @@ -1793,7 +1793,7 @@ module ts { // some node, then we cannot get a node from the old source tree. This is because we // want to mark the next node we encounter as being unusable. // - // Note: This may be too conservative. Perhaps we could reuse hte node and set the bit + // Note: This may be too conservative. Perhaps we could reuse the node and set the bit // on it (or its leftmost child) as having the error. For now though, being conservative // is nice and likely won't ever affect perf. if (parseErrorBeforeNextFinishedNode) { diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index 9871a447c05..54f87d8e50b 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -22,7 +22,7 @@ module ts.NavigateTo { continue; } - // It was a match! If the pattern has dots in it, then also see if hte + // It was a match! If the pattern has dots in it, then also see if the // declaration container matches as well. if (patternMatcher.patternContainsDots) { let containers = getContainers(declaration); diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index 61642552cab..646782b2cf0 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -471,7 +471,7 @@ module ts { // Helper function to compare two matches to determine which is better. Matches are first // ordered by kind (so all prefix matches always beat all substring matches). Then, if the - // match is a camel case match, the relative weights of hte match are used to determine + // match is a camel case match, the relative weights of the match are used to determine // which is better (with a greater weight being better). Then if the match is of the same // type, then a case sensitive match is considered better than an insensitive one. function patternMatchCompareTo(match1: PatternMatch, match2: PatternMatch): number {